From 9886021c6a4608f0512a4eff8f5b87908aad4c92 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 24 Mar 2018 16:55:28 +0100 Subject: [PATCH] Add "Timeout action" setting --- src/messages/layouts/messagelayout.cpp | 2 +- src/singletons/settingsmanager.hpp | 1 + src/widgets/settingspages/moderationpage.cpp | 7 +++++++ src/widgets/settingspages/moderationpage.hpp | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/messages/layouts/messagelayout.cpp b/src/messages/layouts/messagelayout.cpp index f24ce1739..baed03814 100644 --- a/src/messages/layouts/messagelayout.cpp +++ b/src/messages/layouts/messagelayout.cpp @@ -164,7 +164,7 @@ void MessageLayout::paint(QPainter &painter, int y, int messageIndex, Selection QColor color = isWindowFocused ? themeManager.tabs.selected.backgrounds.regular.color() : themeManager.tabs.selected.backgrounds.unfocused.color(); - QBrush brush = QBrush(color, Qt::VerPattern); + QBrush brush(color, Qt::VerPattern); painter.fillRect(0, y + this->container.getHeight() - 1, this->container.getWidth(), 1, brush); diff --git a/src/singletons/settingsmanager.hpp b/src/singletons/settingsmanager.hpp index 056cf1f08..b3dce5221 100644 --- a/src/singletons/settingsmanager.hpp +++ b/src/singletons/settingsmanager.hpp @@ -82,6 +82,7 @@ public: /// Moderation QStringSetting moderationActions = {"/moderation/actions", "/ban {user}\n/timeout {user} 300"}; + QStringSetting timeoutAction = {"/moderation/timeoutAction", "Disable"}; /// Highlighting BoolSetting enableHighlights = {"/highlighting/enabled", true}; diff --git a/src/widgets/settingspages/moderationpage.cpp b/src/widgets/settingspages/moderationpage.cpp index 625661643..5106d95ab 100644 --- a/src/widgets/settingspages/moderationpage.cpp +++ b/src/widgets/settingspages/moderationpage.cpp @@ -13,6 +13,7 @@ namespace chatterino { namespace widgets { namespace settingspages { + ModerationPage::ModerationPage() : SettingsPage("Moderation", "") { @@ -27,6 +28,12 @@ ModerationPage::ModerationPage() label->setStyleSheet("color: #bbb"); // clang-format on + auto form = layout.emplace(); + { + form->addRow("Action on timed out messages (unimplemented):", + this->createComboBox({"Disable", "Hide"}, settings.timeoutAction)); + } + auto modButtons = layout.emplace("Custom moderator buttons").setLayoutType(); { diff --git a/src/widgets/settingspages/moderationpage.hpp b/src/widgets/settingspages/moderationpage.hpp index c6ebdbdc3..4e30c717c 100644 --- a/src/widgets/settingspages/moderationpage.hpp +++ b/src/widgets/settingspages/moderationpage.hpp @@ -18,6 +18,7 @@ public: private: QTimer itemsChangedTimer; }; + } // namespace settingspages } // namespace widgets } // namespace chatterino