From d741bf6df326e33adcb7c01c053c602e19135037 Mon Sep 17 00:00:00 2001 From: fourtf Date: Tue, 23 Jan 2018 23:10:27 +0100 Subject: [PATCH] added SpecialChannelPage with a description for /mentions --- chatterino.pro | 6 ++- src/widgets/settingsdialog.cpp | 9 +++-- .../settingspages/ignoremessagespage.cpp | 2 +- src/widgets/settingspages/ignoreuserspage.cpp | 38 ++++++++++--------- src/widgets/settingspages/logspage.cpp | 2 +- .../settingspages/specialchannelspage.cpp | 28 ++++++++++++++ .../settingspages/specialchannelspage.hpp | 15 ++++++++ 7 files changed, 76 insertions(+), 24 deletions(-) create mode 100644 src/widgets/settingspages/specialchannelspage.cpp create mode 100644 src/widgets/settingspages/specialchannelspage.hpp diff --git a/chatterino.pro b/chatterino.pro index 81788de6e..788a26abc 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -165,7 +165,8 @@ SOURCES += \ src/widgets/streamview.cpp \ src/util/networkrequest.cpp \ src/widgets/settingspages/ignoreuserspage.cpp \ - src/widgets/settingspages/ignoremessagespage.cpp + src/widgets/settingspages/ignoremessagespage.cpp \ + src/widgets/settingspages/specialchannelspage.cpp HEADERS += \ src/precompiled_header.hpp \ @@ -270,7 +271,8 @@ HEADERS += \ src/util/networkworker.hpp \ src/util/networkrequester.hpp \ src/widgets/settingspages/ignoreuserspage.hpp \ - src/widgets/settingspages/ignoremessagespage.hpp + src/widgets/settingspages/ignoremessagespage.hpp \ + src/widgets/settingspages/specialchannelspage.hpp RESOURCES += \ resources/resources.qrc diff --git a/src/widgets/settingsdialog.cpp b/src/widgets/settingsdialog.cpp index f6c62ee7f..edd23fd07 100644 --- a/src/widgets/settingsdialog.cpp +++ b/src/widgets/settingsdialog.cpp @@ -12,6 +12,7 @@ #include "widgets/settingspages/ignoreuserspage.hpp" #include "widgets/settingspages/logspage.hpp" #include "widgets/settingspages/moderationpage.hpp" +#include "widgets/settingspages/specialchannelspage.hpp" #include @@ -79,11 +80,13 @@ void SettingsDialog::addTabs() this->addTab(new settingspages::BehaviourPage); this->addTab(new settingspages::CommandPage); this->addTab(new settingspages::EmotesPage); - this->addTab(new settingspages::IgnoreUsersPage); - this->addTab(new settingspages::IgnoreMessagesPage); this->addTab(new settingspages::HighlightingPage); - // this->addTab(new settingspages::LogsPage); + this->addTab(new settingspages::IgnoreMessagesPage); + this->addTab(new settingspages::IgnoreUsersPage); + this->addTab(new settingspages::LogsPage); this->addTab(new settingspages::ModerationPage); + this->addTab(new settingspages::SpecialChannelsPage); + this->ui.tabContainer->addStretch(1); this->addTab(new settingspages::AboutPage, Qt::AlignBottom); } diff --git a/src/widgets/settingspages/ignoremessagespage.cpp b/src/widgets/settingspages/ignoremessagespage.cpp index d52c5a29e..19f8b5518 100644 --- a/src/widgets/settingspages/ignoremessagespage.cpp +++ b/src/widgets/settingspages/ignoremessagespage.cpp @@ -9,7 +9,7 @@ namespace chatterino { namespace widgets { namespace settingspages { IgnoreMessagesPage::IgnoreMessagesPage() - : SettingsPage("Ignore Messages", ":/images/theme.svg") + : SettingsPage("Ignore Messages", "") { singletons::SettingManager &settings = singletons::SettingManager::getInstance(); util::LayoutCreator layoutCreator(this); diff --git a/src/widgets/settingspages/ignoreuserspage.cpp b/src/widgets/settingspages/ignoreuserspage.cpp index 986fc4f8a..bccef00ce 100644 --- a/src/widgets/settingspages/ignoreuserspage.cpp +++ b/src/widgets/settingspages/ignoreuserspage.cpp @@ -4,20 +4,21 @@ #include "util/layoutcreator.hpp" #include +#include #include #include #include #include // clang-format off -#define INFO "/ignore in chat ignores a user\n/unignore in chat unignores a user\n\nChatterino uses the twitch api for ignored users so they are shared with the webchat.\nIf you use your own oauth key make sure that it has the correct permissions." +#define INFO "/ignore in chat ignores a user\n/unignore in chat unignores a user\n\nChatterino uses the twitch api for ignored users so they are shared with the webchat.\nIf you use your own oauth key make sure that it has the correct permissions.\n" // clang-format on namespace chatterino { namespace widgets { namespace settingspages { IgnoreUsersPage::IgnoreUsersPage() - : SettingsPage("Ignore Users", ":/images/theme.svg") + : SettingsPage("Ignore Users", "") { singletons::SettingManager &settings = singletons::SettingManager::getInstance(); util::LayoutCreator layoutCreator(this); @@ -27,24 +28,27 @@ IgnoreUsersPage::IgnoreUsersPage() label->setWordWrap(true); label->setStyleSheet("color: #BBB"); - layout.append( - this->createCheckBox("Enable twitch ignored users", settings.enableTwitchIgnoredUsers)); - - auto anyways = layout.emplace().withoutMargin(); + auto group = layout.emplace("Ignored users").setLayoutType(); { - anyways.emplace("Show anyways if:"); - anyways.emplace(); - anyways->addStretch(1); - } + group.append( + this->createCheckBox("Enable twitch ignored users", settings.enableTwitchIgnoredUsers)); - auto addremove = layout.emplace().withoutMargin(); - { - auto add = addremove.emplace("Ignore user"); - auto remove = addremove.emplace("Unignore User"); - addremove->addStretch(1); - } + auto anyways = group.emplace().withoutMargin(); + { + anyways.emplace("Show anyways if:"); + anyways.emplace(); + anyways->addStretch(1); + } - auto userList = layout.emplace(); + auto addremove = group.emplace().withoutMargin(); + { + auto add = addremove.emplace("Ignore user"); + auto remove = addremove.emplace("Unignore User"); + addremove->addStretch(1); + } + + auto userList = group.emplace(); + } } } // namespace settingspages } // namespace widgets diff --git a/src/widgets/settingspages/logspage.cpp b/src/widgets/settingspages/logspage.cpp index 606278c4c..62adefc5b 100644 --- a/src/widgets/settingspages/logspage.cpp +++ b/src/widgets/settingspages/logspage.cpp @@ -4,7 +4,7 @@ namespace chatterino { namespace widgets { namespace settingspages { LogsPage::LogsPage() - : SettingsPage("Logs", ":/images/VSO_Link_blue_16x.png") + : SettingsPage("Logs", "") { } } // namespace settingspages diff --git a/src/widgets/settingspages/specialchannelspage.cpp b/src/widgets/settingspages/specialchannelspage.cpp new file mode 100644 index 000000000..6c3685c74 --- /dev/null +++ b/src/widgets/settingspages/specialchannelspage.cpp @@ -0,0 +1,28 @@ +#include "specialchannelspage.hpp" + +#include "singletons/settingsmanager.hpp" +#include "util/layoutcreator.hpp" + +#include +#include +#include + +namespace chatterino { +namespace widgets { +namespace settingspages { +SpecialChannelsPage::SpecialChannelsPage() + : SettingsPage("Special channels", "") +{ + util::LayoutCreator layoutCreator(this); + auto layout = layoutCreator.setLayoutType(); + + auto mentions = layout.emplace("Mentions channel").setLayoutType(); + { + mentions.emplace("Join /mentions to view your mentions."); + } + + layout->addStretch(1); +} +} // namespace settingspages +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/settingspages/specialchannelspage.hpp b/src/widgets/settingspages/specialchannelspage.hpp new file mode 100644 index 000000000..5c9645592 --- /dev/null +++ b/src/widgets/settingspages/specialchannelspage.hpp @@ -0,0 +1,15 @@ +#pragma once + +#include "widgets/settingspages/settingspage.hpp" + +namespace chatterino { +namespace widgets { +namespace settingspages { +class SpecialChannelsPage : public SettingsPage +{ +public: + SpecialChannelsPage(); +}; +} // namespace settingspages +} // namespace widgets +} // namespace chatterino