Add an indicator in the title bar if Streamer Mode is active (#4410)
This commit is contained in:
@@ -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,51 @@ void Window::addCustomTitlebarButtons()
|
||||
this->userLabel_->rect().bottomLeft()));
|
||||
});
|
||||
this->userLabel_->setMinimumWidth(20 * scale());
|
||||
|
||||
// streamer mode
|
||||
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())
|
||||
{
|
||||
this->streamerModeTitlebarIcon_->setPixmap(
|
||||
getResources().buttons.streamerModeEnabledLight);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->streamerModeTitlebarIcon_->setPixmap(
|
||||
getResources().buttons.streamerModeEnabledDark);
|
||||
}
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user