From 7310f1b8888c7005b0b395e61b148dd1ccb1408b Mon Sep 17 00:00:00 2001 From: fourtf Date: Wed, 17 Jan 2018 17:17:26 +0100 Subject: [PATCH] fix for bur0k --- src/twitch/twitchchannel.cpp | 16 ++++++++++++++++ src/twitch/twitchchannel.hpp | 7 +++++++ src/widgets/helper/notebooktab.cpp | 6 ++++-- src/widgets/helper/splitheader.cpp | 2 ++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/twitch/twitchchannel.cpp b/src/twitch/twitchchannel.cpp index 02ed977e1..90f68d08d 100644 --- a/src/twitch/twitchchannel.cpp +++ b/src/twitch/twitchchannel.cpp @@ -83,6 +83,22 @@ void TwitchChannel::sendMessage(const QString &message) singletons::IrcManager::getInstance().sendMessage(this->name, parsedMessage); } +bool TwitchChannel::isMod() +{ + return this->mod; +} + +bool TwitchChannel::isBroadcaster() +{ + return this->name == singletons::AccountManager::getInstance().Twitch.getCurrent()->getUserId(); +} + +bool TwitchChannel::hasModRights() +{ + // fourtf: check if staff + return this->isMod() || this->isBroadcaster(); +} + void TwitchChannel::setLive(bool newLiveStatus) { if (this->isLive == newLiveStatus) { diff --git a/src/twitch/twitchchannel.hpp b/src/twitch/twitchchannel.hpp index f7f1a0733..014aa031c 100644 --- a/src/twitch/twitchchannel.hpp +++ b/src/twitch/twitchchannel.hpp @@ -22,6 +22,10 @@ public: bool canSendMessage() const override; void sendMessage(const QString &message) override; + bool isMod(); + bool isBroadcaster(); + bool hasModRights(); + const std::shared_ptr bttvChannelEmotes; const std::shared_ptr ffzChannelEmotes; @@ -34,6 +38,7 @@ public: boost::signals2::signal onlineStatusChanged; pajlada::Signals::NoArgBoltSignal fetchMessages; + pajlada::Signals::NoArgSignal userStateChanged; QString roomID; bool isLive; @@ -47,6 +52,8 @@ private: void refreshLiveStatus(); void fetchRecentMessages(); + + bool mod; }; } // namespace twitch diff --git a/src/widgets/helper/notebooktab.cpp b/src/widgets/helper/notebooktab.cpp index b7e2eef85..38f215769 100644 --- a/src/widgets/helper/notebooktab.cpp +++ b/src/widgets/helper/notebooktab.cpp @@ -120,9 +120,11 @@ void NotebookTab::setHighlightState(HighlightState newHighlightStyle) return; } - this->highlightState = newHighlightStyle; + if (this->highlightState != HighlightState::Highlighted) { + this->highlightState = newHighlightStyle; - this->update(); + this->update(); + } } QRect NotebookTab::getDesiredRect() const diff --git a/src/widgets/helper/splitheader.cpp b/src/widgets/helper/splitheader.cpp index d60015855..f92477303 100644 --- a/src/widgets/helper/splitheader.cpp +++ b/src/widgets/helper/splitheader.cpp @@ -160,6 +160,8 @@ void SplitHeader::updateModerationModeIcon() this->moderationButton->setPixmap(this->split->getModerationMode() ? resourceManager.moderationmode_enabled->getPixmap() : resourceManager.moderationmode_disabled->getPixmap()); + + this->moderationButton->setVisible(this->split->channel->hasModRights()); } void SplitHeader::paintEvent(QPaintEvent *)