refactor: turn StreamerMode into a singleton(-like thing) (#5216)

This commit is contained in:
nerix
2024-03-01 21:12:02 +01:00
committed by GitHub
parent ea19c5c989
commit c1fa51242f
28 changed files with 386 additions and 210 deletions
+5 -5
View File
@@ -7,10 +7,10 @@
#include "controllers/hotkeys/HotkeyController.hpp"
#include "singletons/Resources.hpp"
#include "singletons/Settings.hpp"
#include "singletons/StreamerMode.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"
@@ -1437,9 +1437,8 @@ void SplitNotebook::addCustomButtons()
getIApp()->getWindows()->showSettingsDialog(
this, SettingsDialogPreference::StreamerMode);
});
this->signalHolder_.managedConnect(getApp()->streamerModeChanged, [this]() {
this->updateStreamerModeIcon();
});
QObject::connect(getIApp()->getStreamerMode(), &IStreamerMode::changed,
this, &SplitNotebook::updateStreamerModeIcon);
this->updateStreamerModeIcon();
}
@@ -1462,7 +1461,8 @@ void SplitNotebook::updateStreamerModeIcon()
this->streamerModeIcon_->setPixmap(
getResources().buttons.streamerModeEnabledDark);
}
this->streamerModeIcon_->setVisible(isInStreamerMode());
this->streamerModeIcon_->setVisible(
getIApp()->getStreamerMode()->isEnabled());
}
void SplitNotebook::themeChangedEvent()