From 289aaa8ec61149ff3f779f4795d435be5aec7973 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Fri, 24 Feb 2023 23:58:56 +0100 Subject: [PATCH 01/14] Implement a Notebook button that shows when streamer mode is active --- src/Application.hpp | 5 +++++ src/singletons/Settings.cpp | 6 ++++++ src/util/StreamerMode.cpp | 1 + src/widgets/Notebook.cpp | 25 ++++++++++++++++++++++++ src/widgets/dialogs/SettingsDialog.cpp | 17 +++++++++++++++- src/widgets/dialogs/SettingsDialog.hpp | 2 ++ src/widgets/helper/SettingsDialogTab.hpp | 1 + 7 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/Application.hpp b/src/Application.hpp index dada8d02a09..7f3462d3280 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -3,6 +3,8 @@ #include "common/Singleton.hpp" #include "singletons/NativeMessaging.hpp" +#include +#include #include #include @@ -148,6 +150,9 @@ class Application : public IApplication } IUserDataController *getUserData() override; + // parameter: enabled + pajlada::Signals::NoArgSignal streamerModeChanged; + private: void addSingleton(Singleton *singleton); void initPubSub(); diff --git a/src/singletons/Settings.cpp b/src/singletons/Settings.cpp index a4cf20f9632..f608cafe7a7 100644 --- a/src/singletons/Settings.cpp +++ b/src/singletons/Settings.cpp @@ -1,5 +1,6 @@ #include "singletons/Settings.hpp" +#include "Application.hpp" #include "controllers/filters/FilterRecord.hpp" #include "controllers/highlights/HighlightBadge.hpp" #include "controllers/highlights/HighlightBlacklistUser.hpp" @@ -136,6 +137,11 @@ Settings::Settings(const QString &settingsDirectory) }, false); #endif + this->enableStreamerMode.connect( + []() { + getApp()->streamerModeChanged.invoke(); + }, + false); } Settings &Settings::instance() diff --git a/src/util/StreamerMode.cpp b/src/util/StreamerMode.cpp index 03f3f59aae8..85468d0a630 100644 --- a/src/util/StreamerMode.cpp +++ b/src/util/StreamerMode.cpp @@ -71,6 +71,7 @@ bool isInStreamerMode() p.exitStatus() == QProcess::NormalExit) { cache = (p.exitCode() == 0); + getApp()->streamerModeChanged.invoke(); return (p.exitCode() == 0); } diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index 1d7671f7c52..214330bd4e3 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -4,10 +4,12 @@ #include "common/QLogging.hpp" #include "controllers/hotkeys/HotkeyCategory.hpp" #include "controllers/hotkeys/HotkeyController.hpp" +#include "singletons/Resources.hpp" #include "singletons/Settings.hpp" #include "singletons/Theme.hpp" #include "singletons/WindowManager.hpp" #include "util/InitUpdateButton.hpp" +#include "util/StreamerMode.hpp" #include "widgets/dialogs/SettingsDialog.hpp" #include "widgets/helper/ChannelView.hpp" #include "widgets/helper/NotebookButton.hpp" @@ -1154,6 +1156,29 @@ void SplitNotebook::addCustomButtons() auto updateBtn = this->addCustomButton(); initUpdateButton(*updateBtn, this->signalHolder_); + + // streamer mode + auto *streamerModeIcon = this->addCustomButton(); + if (getTheme()->isLightTheme()) + { + streamerModeIcon->setPixmap( + getResources().buttons.streamerModeEnabledLight); + } + else + { + streamerModeIcon->setPixmap( + getResources().buttons.streamerModeEnabledDark); + } + streamerModeIcon->setVisible(isInStreamerMode()); + this->signalHolder_.managedConnect( + getApp()->streamerModeChanged, [streamerModeIcon]() { + streamerModeIcon->setVisible(isInStreamerMode()); + }); + QObject::connect(streamerModeIcon, &NotebookButton::leftClicked, + [this, streamerModeIcon] { + getApp()->windows->showSettingsDialog( + this, SettingsDialogPreference::StreamerMode); + }); } SplitContainer *SplitNotebook::addPage(bool select) diff --git a/src/widgets/dialogs/SettingsDialog.cpp b/src/widgets/dialogs/SettingsDialog.cpp index ebc33774a46..e5357d016ac 100644 --- a/src/widgets/dialogs/SettingsDialog.cpp +++ b/src/widgets/dialogs/SettingsDialog.cpp @@ -194,6 +194,11 @@ void SettingsDialog::filterElements(const QString &text) } } +void SettingsDialog::setElementFilter(const QString &query) +{ + this->ui_.search->setText(query); +} + void SettingsDialog::addTabs() { this->ui_.tabContainer->setSpacing(0); @@ -202,7 +207,7 @@ void SettingsDialog::addTabs() // Constructors are wrapped in std::function to remove some strain from first time loading. // clang-format off - this->addTab([]{return new GeneralPage;}, "General", ":/settings/about.svg"); + this->addTab([]{return new GeneralPage;}, "General", ":/settings/about.svg", SettingsTabId::General); this->ui_.tabContainer->addSpacing(16); this->addTab([]{return new AccountsPage;}, "Accounts", ":/settings/accounts.svg", SettingsTabId::Accounts); this->addTab([]{return new NicknamesPage;}, "Nicknames", ":/settings/accounts.svg"); @@ -312,10 +317,20 @@ void SettingsDialog::showDialog(QWidget *parent, } break; + case SettingsDialogPreference::StreamerMode: { + instance->selectTab(SettingsTabId::General); + } + break; + default:; } instance->show(); + if (preferredTab == SettingsDialogPreference::StreamerMode) + { + // this is needed because each time the settings are opened, the query is reset + instance->setElementFilter("Streamer Mode"); + } instance->activateWindow(); instance->raise(); instance->setFocus(); diff --git a/src/widgets/dialogs/SettingsDialog.hpp b/src/widgets/dialogs/SettingsDialog.hpp index ad8f873d387..303842af21a 100644 --- a/src/widgets/dialogs/SettingsDialog.hpp +++ b/src/widgets/dialogs/SettingsDialog.hpp @@ -27,6 +27,7 @@ class PageHeader : public QFrame enum class SettingsDialogPreference { NoPreference, + StreamerMode, Accounts, ModerationActions, }; @@ -57,6 +58,7 @@ class SettingsDialog : public BaseWindow void selectTab(SettingsDialogTab *tab, const bool byUser = true); void selectTab(SettingsTabId id); void filterElements(const QString &query); + void setElementFilter(const QString &query); void onOkClicked(); void onCancelClicked(); diff --git a/src/widgets/helper/SettingsDialogTab.hpp b/src/widgets/helper/SettingsDialogTab.hpp index 1c907ad459d..921d157f7ab 100644 --- a/src/widgets/helper/SettingsDialogTab.hpp +++ b/src/widgets/helper/SettingsDialogTab.hpp @@ -15,6 +15,7 @@ class SettingsDialog; enum class SettingsTabId { None, + General, Accounts, Moderation, }; From 09f0a8a7bd5b1cefa3c9f70d0fae7fdb85ba9c47 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 25 Feb 2023 00:04:54 +0100 Subject: [PATCH 02/14] Attempt to add windows support for this --- src/widgets/Notebook.cpp | 9 ++++----- src/widgets/Window.cpp | 13 +++++++++++++ src/widgets/helper/TitlebarButton.hpp | 3 ++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index 214330bd4e3..76a378dd5f9 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -1174,11 +1174,10 @@ void SplitNotebook::addCustomButtons() getApp()->streamerModeChanged, [streamerModeIcon]() { streamerModeIcon->setVisible(isInStreamerMode()); }); - QObject::connect(streamerModeIcon, &NotebookButton::leftClicked, - [this, streamerModeIcon] { - getApp()->windows->showSettingsDialog( - this, SettingsDialogPreference::StreamerMode); - }); + QObject::connect(streamerModeIcon, &NotebookButton::leftClicked, [this] { + getApp()->windows->showSettingsDialog( + this, SettingsDialogPreference::StreamerMode); + }); } SplitContainer *SplitNotebook::addPage(bool select) diff --git a/src/widgets/Window.cpp b/src/widgets/Window.cpp index dfac8ba6ecc..5dbbfbeb475 100644 --- a/src/widgets/Window.cpp +++ b/src/widgets/Window.cpp @@ -9,6 +9,7 @@ #include "controllers/hotkeys/HotkeyController.hpp" #include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchIrcServer.hpp" +#include "singletons/Resources.hpp" #include "singletons/Settings.hpp" #include "singletons/Theme.hpp" #include "singletons/Updates.hpp" @@ -186,6 +187,18 @@ void Window::addCustomTitlebarButtons() this->userLabel_->rect().bottomLeft())); }); this->userLabel_->setMinimumWidth(20 * scale()); + + // streamer mode + auto *streamerModeIcon = + this->addTitleBarButton(TitleBarButtonStyle::StreamerMode, [this] { + getApp()->windows->showSettingsDialog( + this, SettingsDialogPreference::StreamerMode); + }); + streamerModeIcon->setPixmap(getResources().buttons.streamerModeEnabledDark); + this->signalHolder_.managedConnect( + getApp()->streamerModeChanged, [streamerModeIcon]() { + streamerModeIcon->setVisible(isInStreamerMode()); + }); } void Window::addDebugStuff(HotkeyController::HotkeyMap &actions) diff --git a/src/widgets/helper/TitlebarButton.hpp b/src/widgets/helper/TitlebarButton.hpp index 85e435005bb..46358237027 100644 --- a/src/widgets/helper/TitlebarButton.hpp +++ b/src/widgets/helper/TitlebarButton.hpp @@ -11,7 +11,8 @@ enum class TitleBarButtonStyle { Unmaximize = 4, Close = 8, User = 16, - Settings = 32 + Settings = 32, + StreamerMode = 64, }; class TitleBarButton : public Button From 60312227d9d582d4d6e0f4e26109ec7e2c09bece Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 25 Feb 2023 00:05:24 +0100 Subject: [PATCH 03/14] Actually add the icons lol --- resources/buttons/streamerModeEnabledDark.png | Bin 0 -> 2526 bytes resources/buttons/streamerModeEnabledDark.svg | 13 +++++++++++++ resources/buttons/streamerModeEnabledLight.png | Bin 0 -> 3559 bytes resources/buttons/streamerModeEnabledLight.svg | 13 +++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 resources/buttons/streamerModeEnabledDark.png create mode 100644 resources/buttons/streamerModeEnabledDark.svg create mode 100644 resources/buttons/streamerModeEnabledLight.png create mode 100644 resources/buttons/streamerModeEnabledLight.svg diff --git a/resources/buttons/streamerModeEnabledDark.png b/resources/buttons/streamerModeEnabledDark.png new file mode 100644 index 0000000000000000000000000000000000000000..5c8fcfb3564b5e7186ce36049b3bc92ee959beb8 GIT binary patch literal 2526 zcma);`6CmI1IBkSb6=B17?EpudC8fuVMENZ0JBNJ0{RQ3iV++O6(RoeHa@Jb=6N0QjojE& z*!9ldA||5syT}jTV4)jAEQb8(xw$AMn}wEZMN;JM!Q;n(hqk{s>b3h) z2OzI|OK%PSip>BxbB&6P`v&P;;Mv_idHdXQ@)Q5$`mYE|O%8f&s;CAVW~8ZPYF{SV zxRsmQl%RWHfs~At)4TnS+I8J5BjU$Pts!z)$iuI-cE>rY@b2r$|RfQgGg|#G|V8@gK}!3*rC0*FuLq((<5N|BrPn-SP3&- zGLgNC4d+T#IQkMkTe++HDu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QR?`gU3DTXx36h#t5xAlC%~Q5V{w5jAx_1TFJGm#xft^7aNW zqcUlNtVn^w(1V8wdlZJ-gdO!J+6g!Yl?+MRJ*^`;)|9W-=c+qq9VX^D0^>G;SJ`{8 z-L@$!(*a+djAi`MsQK)ktcNN;E7YYlOj6o_4Nt@o>3nwUfSpDM=z_v6|DQfvF;_(? zrIHsX!!|tznT3N*@y1=Bd9LhZtZae0EXB%rff=RMLB{Guoh~mWPPdPF&0%NKOQM)p zf@hweEy|zAPhAB`CFaG0UOY-v7W^i?mF-akp=NNta=PyGviYuN$5W_!L@C20OQ#3X zV>(bp3m92+0J@TqiO%ETlIh+m8T4J<@AiN_FD@ec@4d{^qwUuyiG@wh4labnVvww@ z5jStBVd8ovUZo#HYAr?fS13TGKRzg-!3?hSUJ+g7ldSHBK}r#Zvw(PrTn zM(m#?%w($pe#OXABLsZ2DF)qmfCOU<@(F304Tom1?>6%(YOc-WIJ~bpe}}V$pYIaP za5dbrtOG}hTQ6X7u2P!4;tjEJy)iC-%<--%Sym2Mv?2=Hsnzqe#C=tKpv~>|J8O&} zP&?JRtv1V|jPMX8$yoApvRMrZ^nb4Tb!%P#E$sAR_O@f7xRoP80IG90ICH@z1@j}kPf|5hXs(D1s@7n;t M8e5`kjEJ%S2gQDrB>(^b literal 0 HcmV?d00001 diff --git a/resources/buttons/streamerModeEnabledDark.svg b/resources/buttons/streamerModeEnabledDark.svg new file mode 100644 index 00000000000..c633f927150 --- /dev/null +++ b/resources/buttons/streamerModeEnabledDark.svg @@ -0,0 +1,13 @@ + + + + + + + diff --git a/resources/buttons/streamerModeEnabledLight.png b/resources/buttons/streamerModeEnabledLight.png new file mode 100644 index 0000000000000000000000000000000000000000..86a592c3f3ca911ab857b9075f57c92e23f86020 GIT binary patch literal 3559 zcmb7H`8U)L)c$A~V#pLWgo#2(wy}*R`!>kF%TAaq(R{6Co$PzIY+1%mCcWOP%*2b`z_YV~>@#B7TpIi!Lw_&GMg{sfbM@kqkcjy-jh7X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F(v%HI{ zP@bu_p>8<>qGHS9I852km=6L4or%!=mgtsL+q%!ur`j>4Z9bfTaO{EplQZEz7hwtq zmH)m%8N6!bg1bPH=0kt5%Qa8^zpm}EKJD?obKr}tI9=s=LHFPP0npY!s@FfTkNF?Q CcEoQ0 literal 0 HcmV?d00001 diff --git a/resources/buttons/streamerModeEnabledLight.svg b/resources/buttons/streamerModeEnabledLight.svg new file mode 100644 index 00000000000..4af5445591f --- /dev/null +++ b/resources/buttons/streamerModeEnabledLight.svg @@ -0,0 +1,13 @@ + + + + + + + From 2340e34e77121e6c849d088987e633d79c04a9d1 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 25 Feb 2023 00:06:54 +0100 Subject: [PATCH 04/14] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0bddeaad9a..ea5b6478e87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unversioned - Minor: Delete all but the last 5 crashdumps on application start. (#4392) +- Minor: Add an icon showing when streamer mode is enabled (#4410) - Bugfix: Fixed uploaded AppImage not being able most web requests. (#4400) - Bugfix: Fixed a potential race condition due to using the wrong lock when loading 7TV badges. (#4402) - Dev: Add capability to build Chatterino with Qt6. (#4393) From 95e16daa6eb91cd09503894eba1642fc76346fad Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 25 Feb 2023 00:09:50 +0100 Subject: [PATCH 05/14] Add license for Fluent icons --- resources/licenses/fluenticons.txt | 21 +++++++++++++++++++++ src/widgets/settingspages/AboutPage.cpp | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 resources/licenses/fluenticons.txt diff --git a/resources/licenses/fluenticons.txt b/resources/licenses/fluenticons.txt new file mode 100644 index 00000000000..a11b004ac59 --- /dev/null +++ b/resources/licenses/fluenticons.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Microsoft Corporation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/widgets/settingspages/AboutPage.cpp b/src/widgets/settingspages/AboutPage.cpp index 712549e1c06..2b9017c3516 100644 --- a/src/widgets/settingspages/AboutPage.cpp +++ b/src/widgets/settingspages/AboutPage.cpp @@ -119,6 +119,9 @@ AboutPage::AboutPage() "https://github.com/getsentry/crashpad", ":/licenses/crashpad.txt"); #endif + addLicense(form.getElement(), "Fluent icons", + "https://github.com/microsoft/fluentui-system-icons", + ":/licenses/fluenticons.txt"); } // Attributions From e6ee39b3b16471cd793ca6581d035d8e32356add Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 25 Feb 2023 12:15:44 +0100 Subject: [PATCH 06/14] Show/Hide Windows-only icon on initialization --- src/widgets/Window.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widgets/Window.cpp b/src/widgets/Window.cpp index 5dbbfbeb475..f1aa0fefb1f 100644 --- a/src/widgets/Window.cpp +++ b/src/widgets/Window.cpp @@ -194,6 +194,7 @@ void Window::addCustomTitlebarButtons() getApp()->windows->showSettingsDialog( this, SettingsDialogPreference::StreamerMode); }); + streamerModeIcon->setVisible(isInStreamerMode()); streamerModeIcon->setPixmap(getResources().buttons.streamerModeEnabledDark); this->signalHolder_.managedConnect( getApp()->streamerModeChanged, [streamerModeIcon]() { From c5264a05eb61c854e07e3c1084a4af660171b1e0 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 25 Feb 2023 13:04:01 +0100 Subject: [PATCH 07/14] Call the fucking signal on windows --- src/util/StreamerMode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/StreamerMode.cpp b/src/util/StreamerMode.cpp index 85468d0a630..a713c19b21e 100644 --- a/src/util/StreamerMode.cpp +++ b/src/util/StreamerMode.cpp @@ -123,6 +123,7 @@ bool isInStreamerMode() if (broadcastingBinaries().contains(processName)) { cache = true; + getApp()->streamerModeChanged.invoke(); return true; } } From ecd8f578b6a2e18198d478ac9f8eedfe0c0b6cd9 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 25 Feb 2023 13:06:24 +0100 Subject: [PATCH 08/14] Invoke signal in all cases --- src/util/StreamerMode.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/StreamerMode.cpp b/src/util/StreamerMode.cpp index a713c19b21e..c905b88a03a 100644 --- a/src/util/StreamerMode.cpp +++ b/src/util/StreamerMode.cpp @@ -90,6 +90,7 @@ bool isInStreamerMode() qCWarning(chatterinoStreamerMode) << "pgrep execution timed out!"; cache = false; + getApp()->streamerModeChanged.invoke(); return false; #endif @@ -135,6 +136,7 @@ bool isInStreamerMode() } cache = false; + getApp()->streamerModeChanged.invoke(); #endif return false; } From f9562b89b2f8e15269fd63bdbf350b1f77b1cbf8 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 25 Feb 2023 13:18:00 +0100 Subject: [PATCH 09/14] Consider light mode on windows --- src/widgets/Window.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/widgets/Window.cpp b/src/widgets/Window.cpp index f1aa0fefb1f..a4ff9125783 100644 --- a/src/widgets/Window.cpp +++ b/src/widgets/Window.cpp @@ -194,8 +194,17 @@ void Window::addCustomTitlebarButtons() getApp()->windows->showSettingsDialog( this, SettingsDialogPreference::StreamerMode); }); + if (getTheme()->isLightTheme()) + { + streamerModeIcon->setPixmap( + getResources().buttons.streamerModeEnabledLight); + } + else + { + streamerModeIcon->setPixmap( + getResources().buttons.streamerModeEnabledDark); + } streamerModeIcon->setVisible(isInStreamerMode()); - streamerModeIcon->setPixmap(getResources().buttons.streamerModeEnabledDark); this->signalHolder_.managedConnect( getApp()->streamerModeChanged, [streamerModeIcon]() { streamerModeIcon->setVisible(isInStreamerMode()); From 93c46120311f2a47f705b1ba3a3e4e92e3ef9005 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 25 Feb 2023 13:21:02 +0100 Subject: [PATCH 10/14] Account for nitpick --- src/widgets/Notebook.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index 76a378dd5f9..b8944117c77 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -1159,6 +1159,10 @@ void SplitNotebook::addCustomButtons() // streamer mode auto *streamerModeIcon = this->addCustomButton(); + QObject::connect(streamerModeIcon, &NotebookButton::leftClicked, [this] { + getApp()->windows->showSettingsDialog( + this, SettingsDialogPreference::StreamerMode); + }); if (getTheme()->isLightTheme()) { streamerModeIcon->setPixmap( @@ -1174,10 +1178,6 @@ void SplitNotebook::addCustomButtons() getApp()->streamerModeChanged, [streamerModeIcon]() { streamerModeIcon->setVisible(isInStreamerMode()); }); - QObject::connect(streamerModeIcon, &NotebookButton::leftClicked, [this] { - getApp()->windows->showSettingsDialog( - this, SettingsDialogPreference::StreamerMode); - }); } SplitContainer *SplitNotebook::addPage(bool select) From 861432b69b68497d8a263049c3ae9d0abb875f12 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Fri, 3 Mar 2023 23:47:45 +0100 Subject: [PATCH 11/14] Color the icons somewhat nicely --- resources/buttons/streamerModeEnabledDark.png | Bin 2526 -> 3574 bytes resources/buttons/streamerModeEnabledDark.svg | 2 +- .../buttons/streamerModeEnabledLight.png | Bin 3559 -> 3528 bytes .../buttons/streamerModeEnabledLight.svg | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/buttons/streamerModeEnabledDark.png b/resources/buttons/streamerModeEnabledDark.png index 5c8fcfb3564b5e7186ce36049b3bc92ee959beb8..7ab2b1d8b3fcd6f5235a479b6c40e0a54fd7d7aa 100644 GIT binary patch delta 3558 zcma)23)LhejFlk01z02ucV;hqSbkGlayDbBRkz zNtcL2!+iH{zU})i&f+Yd9-TI43|B%^5#8f9=Ix6a3&2=de)I`Nk-6 zWVvY-?1n?m$Pl%KW0Q!97EIvQfv9y?5Ovp|{+A=!lyB9W?HteL%(_@iyKGiow6_DZ z>6uh1RBQapV()q-D2tMdixAr13@7^kev|s<~&g1H_U7VFt9X* zou5*VTlbpi6N9OOVoTI(1&@SSArujqE_Wb4)q)1=Y+Jwui(8#5dit=uty+j#s)=dMSSfsg+hmc03Qw`9|CA__DkI{CWQQjD)2aByz6`k_&eK(km&Vmw5k(SjE0d6OicRUth)q}na@T|i|cG{2fF{n zI7bC<)P_56QFb>po#HmNSL#1l?)Z=?ywArQ*C>y!vp%IVHOJ9_3=C9#qy|%ECyO<| zWY7gU?l$hvb^)~BN{QPsI=P~`mSr^Y63gu*C<53rwCwO(b z^$hgK6#9v~@Ue*m=Faq&Z_%y}yvZIF=}|eU`zp%Q8|a#_y6z@a&CDWiT-l>r=4u_2 z89a$7a~2#X$fi)a52B!mx)6|-`lSa~g;af6Ny@)#AvE|lCL;?J({CiEM2p?)CZWVL zO*|0=6}Obv9a(TTmVpkA+eN_MJ`O~z$%L8s^;5k`>=`7crGj=m{S;v|O@^+|O$fpBs=W{;z?p$pN0}unQx%Eg*kRjBj5sD9Zk6+a1BaIhB{vwcDlT{Q`e2;%E-Rqj8 zaIOI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dav9@146N$Ss# zaCC=}Z=Mb(_^y=J_u11@o zyQ=+W@`h2p?Ts6pM6UI`Bu|h|67}BTphDK77LkX&`EVm)OciP`sWCeb4F_jCzn#^Q% zWj;{*QKl)QWp<|pT=!TCl_u!00@|#1g3l^l5BTA?PP-@p6r<0Khp&0{v-A5K;!Qg~ z@n6`%+1P^tJ&rN4-Epa%}kIf30Nm_*l6 zXc4QsLJoUd@0%lN+lSAC``2b>7%`5^Kw^G_s}tZxnk$6J+Z&${2s27tDJQD+;>gX# znBFoaxa^1fMGQovVi^8@%$Kf{3ky67*KOOD{1vBVWM<5Xt(vBH+E6BbEW z4j|np{}BH9>T|9Ob1%d?#v$iwode{C4Px@;&%F>9Z+I=%BI5Lr?DGunIo`|81pP7Je_;1QBYZXd4|B_d&%`1k}Kj=he*1+(YkdFG+N4b7Ef@O z(e9S2i;e51x&1aRu&iQT-e=W}%4?+pl{56j9d%-m-Hnx7%gkU%E7i57I@79z^uPqo zoWJQ}w-g){@J##5`iwAAYNo+PbZOa&#nJxVctV=?lp$~haZI>m{*)A}Zup6(%jvjB z*ZHPtFq9Gg*5L93(&yzVl+IpziOXo^#4`@hxmsTZ;!%4^c2m0;I7@mwZXg6eB)`@6 zB`3bK!IWiVOrC04-Zz@R`QcukU*_x7GV9YNqxKfuzK(Ba#GY_lW_QP#lG%|bV@7H& z1U7VJSi!Fq$Ui-deqFmzpf5^|a84)}+vd5}%WpmdPnOv)}&0+ru5;WC~gxm34# z^shft(b?*PYa}aCo04mMNGOwfQQhM|{vY@RV8>7q^Z=$}237UzM}Y9A*4QdzkJx_$ D`lOa6 diff --git a/resources/buttons/streamerModeEnabledDark.svg b/resources/buttons/streamerModeEnabledDark.svg index c633f927150..7f95aae5fb6 100644 --- a/resources/buttons/streamerModeEnabledDark.svg +++ b/resources/buttons/streamerModeEnabledDark.svg @@ -9,5 +9,5 @@ height="69.12pt" viewBox="0 0 69.12 69.12"> - + diff --git a/resources/buttons/streamerModeEnabledLight.png b/resources/bu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6Mdq)1AXNL&&X8?v_nXBdW?iI!2963?}E-aEvC^RXQ}9y@a-I)?wJdjU*^_12@Iw z5Ncx?J_zOy+vH*kjoO|mZ7xEr7!s1HheE%Y`IPUGF$Qt9NUp>^$y5=gQ;Zvy`KTqr ztgx=>#aO3nY5M^9e(_`eZpHrQcJ1FiZl!TdEf8{+j&p~S!i7@rpv;wD<2TM0$9oe_ zwl430Z%eJL7r$p3+St{NdyyG0K`!|~!mO~b z1TVobP#iT#XGk36}ICqfvqoj`1}jyiGGdQQfr=WR14 zx!N_kT=0jtxGJ82QmjmO*!keXZ?P`{{=>tHn^$Qv!z*?UGaxDFHU9%##8qJ(2|%TmNDn#VoN|Q zk~SxOJQCju3OQqv4>Yv$?6Av{M=;43Q{sx9S*vtG-yf|L^4~18*KG*oeU%G8*a%)l zZmL+Lr~Tolzjo+g$l##OVq)3g zc!RFTmsV$170kP7g9Kmjjj!C8lTkaUv_pP)(5p-W{ZyeGb9ioBjDyq6)gjJymqdk% zc@o|Rmt}8SXOE=1pqAXmQo-}#17^)MWqARM*PdhqwL6qM#38f7pZ8gPvNHF(v%HI{ zP@bu_p>8<>qGHS9I852km=6L4or%!=mgtsL+q%!ur`j>4Z9bfTaO{EplQZEz7hwtq zmH)m%8N6!bg1bPH=0kt5%Qa8^zpm}EKJD?obKr}tI9=s=LHFPP0npY!s@FfTkNF?Q CcEoQ0 diff --git a/resources/buttons/streamerModeEnabledLight.svg b/resources/buttons/streamerModeEnabledLight.svg index 4af5445591f..5f27d4393ba 100644 --- a/resources/buttons/streamerModeEnabledLight.svg +++ b/resources/buttons/streamerModeEnabledLight.svg @@ -9,5 +9,5 @@ height="69.12pt" viewBox="0 0 69.12 69.12"> - + From 1419ba172a6d53c2970ba6cd196f84b9a0e6a084 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 4 Mar 2023 01:43:38 +0100 Subject: [PATCH 12/14] Update on theme change, add scary comments and a scary assert --- src/widgets/Notebook.cpp | 35 ++++++++++++++++++++++++----------- src/widgets/Notebook.hpp | 6 ++++++ src/widgets/Window.cpp | 39 +++++++++++++++++++++++++++++++-------- src/widgets/Window.hpp | 5 +++++ 4 files changed, 66 insertions(+), 19 deletions(-) diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index b8944117c77..e4f04de0f31 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -1158,26 +1158,39 @@ void SplitNotebook::addCustomButtons() initUpdateButton(*updateBtn, this->signalHolder_); // streamer mode - auto *streamerModeIcon = this->addCustomButton(); - QObject::connect(streamerModeIcon, &NotebookButton::leftClicked, [this] { - getApp()->windows->showSettingsDialog( - this, SettingsDialogPreference::StreamerMode); + this->streamerModeIcon_ = this->addCustomButton(); + QObject::connect(this->streamerModeIcon_, &NotebookButton::leftClicked, + [this] { + getApp()->windows->showSettingsDialog( + this, SettingsDialogPreference::StreamerMode); + }); + this->signalHolder_.managedConnect(getApp()->streamerModeChanged, [this]() { + this->updateStreamerModeIcon(); }); + this->updateStreamerModeIcon(); +} + +void SplitNotebook::updateStreamerModeIcon() +{ + // A duplicate of this code is in Window class + // That copy handles the TitleBar icon in Window (main window on Windows) + // This one is the one near splits (on linux and mac or non-main windows on Windows) if (getTheme()->isLightTheme()) { - streamerModeIcon->setPixmap( + this->streamerModeIcon_->setPixmap( getResources().buttons.streamerModeEnabledLight); } else { - streamerModeIcon->setPixmap( + this->streamerModeIcon_->setPixmap( getResources().buttons.streamerModeEnabledDark); } - streamerModeIcon->setVisible(isInStreamerMode()); - this->signalHolder_.managedConnect( - getApp()->streamerModeChanged, [streamerModeIcon]() { - streamerModeIcon->setVisible(isInStreamerMode()); - }); + this->streamerModeIcon_->setVisible(isInStreamerMode()); +} + +void SplitNotebook::themeChangedEvent() +{ + this->updateStreamerModeIcon(); } SplitContainer *SplitNotebook::addPage(bool select) diff --git a/src/widgets/Notebook.hpp b/src/widgets/Notebook.hpp index 7cc49cfa67b..0107ebea6fc 100644 --- a/src/widgets/Notebook.hpp +++ b/src/widgets/Notebook.hpp @@ -123,6 +123,7 @@ class SplitNotebook : public Notebook SplitContainer *addPage(bool select = false); SplitContainer *getOrAddSelectedPage(); void select(QWidget *page, bool focusPage = true) override; + void themeChangedEvent() override; protected: void showEvent(QShowEvent *event) override; @@ -131,6 +132,11 @@ class SplitNotebook : public Notebook void addCustomButtons(); pajlada::Signals::SignalHolder signalHolder_; + + // Main window on Windows has basically a duplicate of this in Window + NotebookButton *streamerModeIcon_; + + void updateStreamerModeIcon(); }; } // namespace chatterino diff --git a/src/widgets/Window.cpp b/src/widgets/Window.cpp index a4ff9125783..12f605838ed 100644 --- a/src/widgets/Window.cpp +++ b/src/widgets/Window.cpp @@ -189,26 +189,49 @@ void Window::addCustomTitlebarButtons() this->userLabel_->setMinimumWidth(20 * scale()); // streamer mode - auto *streamerModeIcon = + this->streamerModeTitlebarIcon_ = this->addTitleBarButton(TitleBarButtonStyle::StreamerMode, [this] { getApp()->windows->showSettingsDialog( this, SettingsDialogPreference::StreamerMode); }); + this->signalHolder_.managedConnect(getApp()->streamerModeChanged, [this]() { + this->updateStreamerModeIcon(); + }); +} + +void Window::updateStreamerModeIcon() +{ + // A duplicate of this code is in SplitNotebook class (in Notebook.{c,h}pp) + // That one is the one near splits (on linux and mac or non-main windows on Windows) + // This copy handles the TitleBar icon in Window (main window on Windows) + if (this->streamerModeTitlebarIcon_ == nullptr) + { + return; + } +#ifdef Q_OS_WIN + assert(this->getType() == WindowType::Main); if (getTheme()->isLightTheme()) { - streamerModeIcon->setPixmap( + this->streamerModeTitlebarIcon_->setPixmap( getResources().buttons.streamerModeEnabledLight); } else { - streamerModeIcon->setPixmap( + this->streamerModeTitlebarIcon_->setPixmap( getResources().buttons.streamerModeEnabledDark); } - streamerModeIcon->setVisible(isInStreamerMode()); - this->signalHolder_.managedConnect( - getApp()->streamerModeChanged, [streamerModeIcon]() { - streamerModeIcon->setVisible(isInStreamerMode()); - }); + this->streamerModeTitlebarIcon_->setVisible(isInStreamerMode()); +#else + // clang-format off + assert(false && "Streamer mode TitleBar icon should not exist on non-Windows OSes"); + // clang-format on +#endif +} + +void Window::themeChangedEvent() +{ + this->updateStreamerModeIcon(); + BaseWindow::themeChangedEvent(); } void Window::addDebugStuff(HotkeyController::HotkeyMap &actions) diff --git a/src/widgets/Window.hpp b/src/widgets/Window.hpp index d9974759172..6d25d875c5a 100644 --- a/src/widgets/Window.hpp +++ b/src/widgets/Window.hpp @@ -31,6 +31,7 @@ class Window : public BaseWindow protected: void closeEvent(QCloseEvent *event) override; bool event(QEvent *event) override; + void themeChangedEvent() override; private: void addCustomTitlebarButtons(); @@ -51,6 +52,10 @@ class Window : public BaseWindow pajlada::Signals::SignalHolder signalHolder_; std::vector bSignals_; + // this is only used on Windows and only on the main window, for the one used otherwise, see SplitNotebook in Notebook.hpp + TitleBarButton *streamerModeTitlebarIcon_ = nullptr; + void updateStreamerModeIcon(); + friend class Notebook; }; From 1480087aafe023b8e933d88447d8e4d2ec89199c Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 4 Mar 2023 14:07:49 +0100 Subject: [PATCH 13/14] Default initialize and check for initialization of SplitNotebook::streamerModeIcon_ --- src/widgets/Notebook.cpp | 4 ++++ src/widgets/Notebook.hpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index e4f04de0f31..21422ef2b2f 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -1172,6 +1172,10 @@ void SplitNotebook::addCustomButtons() void SplitNotebook::updateStreamerModeIcon() { + if (this->streamerModeIcon_ == nullptr) + { + return; + } // A duplicate of this code is in Window class // That copy handles the TitleBar icon in Window (main window on Windows) // This one is the one near splits (on linux and mac or non-main windows on Windows) diff --git a/src/widgets/Notebook.hpp b/src/widgets/Notebook.hpp index 0107ebea6fc..382b260ec54 100644 --- a/src/widgets/Notebook.hpp +++ b/src/widgets/Notebook.hpp @@ -134,7 +134,7 @@ class SplitNotebook : public Notebook pajlada::Signals::SignalHolder signalHolder_; // Main window on Windows has basically a duplicate of this in Window - NotebookButton *streamerModeIcon_; + NotebookButton *streamerModeIcon_{}; void updateStreamerModeIcon(); }; From c0e33723505e0e04f38e3bf3c617047f0a8f9a1a Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 4 Mar 2023 14:10:53 +0100 Subject: [PATCH 14/14] remove comment --- src/Application.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Application.hpp b/src/Application.hpp index 7f3462d3280..01428ba8424 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -150,7 +150,6 @@ class Application : public IApplication } IUserDataController *getUserData() override; - // parameter: enabled pajlada::Signals::NoArgSignal streamerModeChanged; private: