From ff54b4c8d2e632eec320eac9df0550a57613498c Mon Sep 17 00:00:00 2001 From: nerix Date: Wed, 7 Dec 2022 22:02:54 +0100 Subject: [PATCH] feat: Add Setting to Hide Reply Context (#4224) --- CHANGELOG.md | 1 + src/providers/twitch/IrcMessageHandler.cpp | 5 +++++ src/singletons/Settings.hpp | 1 + src/widgets/helper/ChannelView.cpp | 4 +++- src/widgets/settingspages/GeneralPage.cpp | 13 +++++++++---- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ede644f..148c2151 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Minor: Cleared up highlight sound settings (#4194) - Minor: Tables in settings window will now scroll to newly added rows. (#4216) - Minor: Added link to streamlink docs for easier user setup. (#4217) +- Minor: Added setting to turn off rendering of reply context. (#4224) - Bugfix: Fixed highlight sounds not reloading on change properly. (#4194) - Bugfix: Fixed CTRL + C not working in reply thread popups. (#4209) - Bugfix: Fixed message input showing as red after removing a message that was more than 500 characters. (#4204) diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index 922b8cf4..12c8f3f8 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -74,6 +74,11 @@ int stripLeadingReplyMention(const QVariantMap &tags, QString &content) { return 0; } + if (getSettings()->hideReplyContext) + { + // Never strip reply mentions if reply contexts are hidden + return 0; + } if (const auto it = tags.find("reply-parent-display-name"); it != tags.end()) diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index b6148930..2f2d0e7f 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -119,6 +119,7 @@ public: // BoolSetting collapseLongMessages = // {"/appearance/messages/collapseLongMessages", false}; + BoolSetting hideReplyContext = {"/appearance/hideReplyContext", false}; BoolSetting showReplyButton = {"/appearance/showReplyButton", false}; BoolSetting stripReplyMention = {"/appearance/stripReplyMention", true}; IntSetting collpseMessagesMinLines = { diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 39211072..e2b0c2f3 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -1127,9 +1127,11 @@ MessageElementFlags ChannelView::getFlags() const if (this->sourceChannel_ == app->twitch->mentionsChannel) flags.set(MessageElementFlag::ChannelName); - if (this->context_ == Context::ReplyThread) + if (this->context_ == Context::ReplyThread || + getSettings()->hideReplyContext) { // Don't show inline replies within the ReplyThreadPopup + // or if they're hidden flags.unset(MessageElementFlag::RepliedMessage); } diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 24d189c3..dff4f659 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -190,6 +190,10 @@ void GeneralPage::initLayout(GeneralPageView &layout) tabDirectionDropdown->setMinimumWidth( tabDirectionDropdown->minimumSizeHint().width()); + layout.addCheckbox( + "Show message reply context", s.hideReplyContext, true, + "This setting will only affect how messages are shown. You can reply " + "to a message regardless of this setting."); layout.addCheckbox("Show message reply button", s.showReplyButton); layout.addCheckbox("Show tab close button", s.showTabCloseButton); layout.addCheckbox("Always on top", s.windowTopMost, false, @@ -843,10 +847,11 @@ void GeneralPage::initLayout(GeneralPageView &layout) "message) into one cheermote."); layout.addCheckbox("Messages in /mentions highlights tab", s.highlightMentions); - layout.addCheckbox("Strip leading mention in replies", s.stripReplyMention, - true, - "When disabled, messages sent in reply threads will " - "include the @mention for the related thread"); + layout.addCheckbox( + "Strip leading mention in replies", s.stripReplyMention, true, + "When disabled, messages sent in reply threads will include the " + "@mention for the related thread. If the reply context is hidden, " + "these mentions will never be stripped."); // Helix timegate settings auto helixTimegateGetValue = [](auto val) {