refactor: turn StreamerMode into a singleton(-like thing) (#5216)
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "singletons/Resources.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/StreamerMode.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "singletons/Updates.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
@@ -202,9 +203,8 @@ void Window::addCustomTitlebarButtons()
|
||||
getIApp()->getWindows()->showSettingsDialog(
|
||||
this, SettingsDialogPreference::StreamerMode);
|
||||
});
|
||||
this->signalHolder_.managedConnect(getApp()->streamerModeChanged, [this]() {
|
||||
this->updateStreamerModeIcon();
|
||||
});
|
||||
QObject::connect(getIApp()->getStreamerMode(), &IStreamerMode::changed,
|
||||
this, &Window::updateStreamerModeIcon);
|
||||
|
||||
// Update initial state
|
||||
this->updateStreamerModeIcon();
|
||||
@@ -231,7 +231,8 @@ void Window::updateStreamerModeIcon()
|
||||
this->streamerModeTitlebarIcon_->setPixmap(
|
||||
getResources().buttons.streamerModeEnabledDark);
|
||||
}
|
||||
this->streamerModeTitlebarIcon_->setVisible(isInStreamerMode());
|
||||
this->streamerModeTitlebarIcon_->setVisible(
|
||||
getIApp()->getStreamerMode()->isEnabled());
|
||||
#else
|
||||
// clang-format off
|
||||
assert(false && "Streamer mode TitleBar icon should not exist on non-Windows OSes");
|
||||
@@ -609,7 +610,7 @@ void Window::addShortcuts()
|
||||
}
|
||||
else if (mode == 2)
|
||||
{
|
||||
if (isInStreamerMode())
|
||||
if (getIApp()->getStreamerMode()->isEnabled())
|
||||
{
|
||||
getSettings()->enableStreamerMode.setValue(
|
||||
StreamerModeSetting::Disabled);
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "singletons/Resources.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/StreamerMode.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
#include "util/Clipboard.hpp"
|
||||
#include "util/Helpers.hpp"
|
||||
#include "util/LayoutCreator.hpp"
|
||||
#include "util/StreamerMode.hpp"
|
||||
#include "widgets/helper/ChannelView.hpp"
|
||||
#include "widgets/helper/EffectLabel.hpp"
|
||||
#include "widgets/helper/InvisibleSizeGrip.hpp"
|
||||
@@ -858,7 +858,7 @@ void UserInfoPopup::updateUserData()
|
||||
this->ui_.userIDLabel->setText(TEXT_USER_ID + user.id);
|
||||
this->ui_.userIDLabel->setProperty("copy-text", user.id);
|
||||
|
||||
if (isInStreamerMode() &&
|
||||
if (getIApp()->getStreamerMode()->isEnabled() &&
|
||||
getSettings()->streamerModeHideUsercardAvatars)
|
||||
{
|
||||
this->ui_.avatarButton->setPixmap(getResources().streamerMode);
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "singletons/Resources.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/StreamerMode.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
#include "util/Clipboard.hpp"
|
||||
#include "util/DistanceBetweenPoints.hpp"
|
||||
#include "util/Helpers.hpp"
|
||||
#include "util/IncognitoBrowser.hpp"
|
||||
#include "util/StreamerMode.hpp"
|
||||
#include "util/Twitch.hpp"
|
||||
#include "widgets/dialogs/ReplyThreadPopup.hpp"
|
||||
#include "widgets/dialogs/SettingsDialog.hpp"
|
||||
@@ -3079,7 +3079,8 @@ void ChannelView::setLinkInfoTooltip(LinkInfo *info)
|
||||
ImagePtr thumbnail;
|
||||
if (info->hasThumbnail() && thumbnailSize > 0)
|
||||
{
|
||||
if (isInStreamerMode() && getSettings()->streamerModeHideLinkThumbnails)
|
||||
if (getIApp()->getStreamerMode()->isEnabled() &&
|
||||
getSettings()->streamerModeHideLinkThumbnails)
|
||||
{
|
||||
thumbnail = Image::fromResourcePixmap(getResources().streamerMode);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "util/FuzzyConvert.hpp"
|
||||
#include "util/Helpers.hpp"
|
||||
#include "util/IncognitoBrowser.hpp"
|
||||
#include "util/StreamerMode.hpp"
|
||||
#include "widgets/BaseWindow.hpp"
|
||||
#include "widgets/settingspages/GeneralPageView.hpp"
|
||||
#include "widgets/splits/SplitInput.hpp"
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "singletons/Resources.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/StreamerMode.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
#include "util/Helpers.hpp"
|
||||
#include "util/LayoutHelper.hpp"
|
||||
#include "util/StreamerMode.hpp"
|
||||
#include "widgets/dialogs/SettingsDialog.hpp"
|
||||
#include "widgets/helper/CommonTexts.hpp"
|
||||
#include "widgets/helper/EffectLabel.hpp"
|
||||
@@ -140,7 +140,7 @@ auto formatTooltip(const TwitchChannel::StreamStatus &s, QString thumbnail)
|
||||
}();
|
||||
|
||||
auto extraStreamData = [&s]() -> QString {
|
||||
if (isInStreamerMode() &&
|
||||
if (getIApp()->getStreamerMode()->isEnabled() &&
|
||||
getSettings()->streamerModeHideViewerCountAndDuration)
|
||||
{
|
||||
return QStringLiteral(
|
||||
|
||||
Reference in New Issue
Block a user