From 562bdae09f46fd3343322a2f7a93dcebaa796d43 Mon Sep 17 00:00:00 2001 From: apa420 Date: Wed, 10 Apr 2019 15:32:18 +0200 Subject: [PATCH] Option to hide moderated messages (timed out messages) --- src/messages/layouts/MessageLayout.cpp | 6 +++++- src/singletons/Settings.hpp | 2 ++ src/widgets/settingspages/GeneralPage.cpp | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/messages/layouts/MessageLayout.cpp b/src/messages/layouts/MessageLayout.cpp index e80a1b2c6..3dfb0e68e 100644 --- a/src/messages/layouts/MessageLayout.cpp +++ b/src/messages/layouts/MessageLayout.cpp @@ -127,7 +127,11 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags _flags) for (const auto &element : this->message_->elements) { - element->addToContainer(*this->container_, _flags); + if (!(getSettings()->removeModerated && + this->message_->flags.has(MessageFlag::Disabled))) + { + element->addToContainer(*this->container_, _flags); + } } if (addTest) diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index 953374193..c041246e9 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -41,6 +41,8 @@ public: BoolSetting separateMessages = {"/appearance/messages/separateMessages", false}; BoolSetting compactEmotes = {"/appearance/messages/compactEmotes", true}; + BoolSetting removeModerated = {"/appearance/messages/removeModerated", + false}; // BoolSetting collapseLongMessages = // {"/appearance/messages/collapseLongMessages", false}; diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 2d188a60a..dc9fc9ad4 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -210,6 +210,7 @@ void GeneralPage::initLayout(SettingsLayout &layout) layout.addCheckbox("Alternate background color", s.alternateMessages); // layout.addCheckbox("Mark last message you read"); // layout.addDropdown("Last read message style", {"Default"}); + layout.addCheckbox("Remove moderated messages", s.removeModerated); layout.addTitle("Emotes"); layout.addDropdown(