refactor: turn StreamerMode into a singleton(-like thing) (#5216)
This commit is contained in:
+11
-5
@@ -51,6 +51,7 @@
|
||||
#include "singletons/Logging.hpp"
|
||||
#include "singletons/Paths.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/StreamerMode.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "singletons/Toasts.hpp"
|
||||
#include "singletons/Updates.hpp"
|
||||
@@ -144,6 +145,7 @@ Application::Application(Settings &_settings, const Paths &paths,
|
||||
, seventvEmotes(new SeventvEmotes)
|
||||
, logging(new Logging(_settings))
|
||||
, linkResolver(new LinkResolver)
|
||||
, streamerMode(new StreamerMode)
|
||||
#ifdef CHATTERINO_HAVE_PLUGINS
|
||||
, plugins(&this->emplace(new PluginController(paths)))
|
||||
#endif
|
||||
@@ -503,6 +505,11 @@ ILinkResolver *Application::getLinkResolver()
|
||||
return this->linkResolver.get();
|
||||
}
|
||||
|
||||
IStreamerMode *Application::getStreamerMode()
|
||||
{
|
||||
return this->streamerMode.get();
|
||||
}
|
||||
|
||||
BttvEmotes *Application::getBttvEmotes()
|
||||
{
|
||||
assertInGuiThread();
|
||||
@@ -707,7 +714,7 @@ void Application::initPubSub()
|
||||
}
|
||||
|
||||
if (getSettings()->streamerModeHideModActions &&
|
||||
isInStreamerMode())
|
||||
this->getStreamerMode()->isEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -756,7 +763,7 @@ void Application::initPubSub()
|
||||
}
|
||||
|
||||
if (getSettings()->streamerModeHideModActions &&
|
||||
isInStreamerMode())
|
||||
this->getStreamerMode()->isEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -892,9 +899,8 @@ void Application::initPubSub()
|
||||
|
||||
std::ignore = this->twitchPubSub->moderation.automodUserMessage.connect(
|
||||
[&](const auto &action) {
|
||||
// This condition has been set up to execute isInStreamerMode() as the last thing
|
||||
// as it could end up being expensive.
|
||||
if (getSettings()->streamerModeHideModActions && isInStreamerMode())
|
||||
if (getSettings()->streamerModeHideModActions &&
|
||||
this->getStreamerMode()->isEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user