From f19cc60a5b7a949f469c3a91cbbe2f63730d3be3 Mon Sep 17 00:00:00 2001 From: apa420 <17131426+apa420@users.noreply.github.com> Date: Sat, 16 Jan 2021 14:27:19 +0100 Subject: [PATCH] Setting for disabling /mentions tab highlight (#1994) Co-authored-by: pajlada --- CHANGELOG.md | 1 + src/singletons/Settings.hpp | 2 ++ src/widgets/helper/ChannelView.cpp | 5 ++++- src/widgets/settingspages/GeneralPage.cpp | 2 ++ src/widgets/splits/SplitHeader.cpp | 17 +++++++++++++++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7397629f9..ad469a0b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - Minor: Deprecate loading of "v1" window layouts. If you haven't updated Chatterino in more than 2 years, there's a chance you will lose your window layout. - Minor: User popup will now automatically display messages as they are received - Minor: Changed the English in two rate-limited system messages (#1878) +- Minor: Added a setting to disable messages sent to /mentions split from making the tab highlight with the red marker (#1994) - Minor: Added image for streamer mode in the user popup icon. - Minor: Added vip and unvip buttons. - Minor: Added settings for displaying where the last message was. diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index 7f9ed3d84..0799fb1d9 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -264,6 +264,8 @@ public: BoolSetting longAlerts = {"/highlighting/alerts", false}; + BoolSetting highlightMentions = {"/highlighting/mentions", true}; + /// Filtering BoolSetting excludeUserMessagesFromFilter = { "/filtering/excludeUserMessages", false}; diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 6aadf2c8d..657e03aba 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -805,7 +805,10 @@ void ChannelView::messageAppended(MessagePtr &message, { if (messageFlags->has(MessageFlag::Highlighted) && messageFlags->has(MessageFlag::ShowInMentions) && - !messageFlags->has(MessageFlag::Subscription)) + !messageFlags->has(MessageFlag::Subscription) && + (getSettings()->highlightMentions || + this->channel_->getType() != Channel::Type::TwitchMentions)) + { this->tabHighlightRequested.invoke(HighlightState::Highlighted); } diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 557db35dd..4d1ad8f02 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -625,6 +625,8 @@ void GeneralPage::initLayout(GeneralPageView &layout) layout.addCheckbox("Combine multiple bit tips into one", s.stackBits); layout.addCheckbox("Ask for confirmation when uploading an image", s.askOnImageUpload); + layout.addCheckbox("Messages in /mentions highlights tab", + s.highlightMentions); layout.addStretch(); diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index 1d9f79d0f..903405b05 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -425,6 +425,23 @@ std::unique_ptr SplitHeader::createMainMenu() this->split_->setModerationMode(!this->split_->getModerationMode()); }); + if (this->split_->getChannel()->getType() == Channel::Type::TwitchMentions) + { + auto action = new QAction(this); + action->setText("Enable /mention tab highlights"); + action->setCheckable(true); + + QObject::connect(moreMenu, &QMenu::aboutToShow, this, [action, this]() { + action->setChecked(getSettings()->highlightMentions); + }); + action->connect(action, &QAction::triggered, this, [this]() { + getSettings()->highlightMentions = + !getSettings()->highlightMentions; + }); + + moreMenu->addAction(action); + } + if (dynamic_cast(this->split_->getChannel().get())) { moreMenu->addAction("Show viewer list", this->split_,