diff --git a/CHANGELOG.md b/CHANGELOG.md index 0553969b..e3f0f96e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Dev: Removed dependency to Qt5 Compatibility module by updating libcommuni. (#6500) - Dev: Merged emote element flags from different providers into two. (#6511) - Dev: Removed unused method in `Emojis`. (#6517) +- Dev: Refactored `Emotes` into `EmoteController`. (#6516) ## 2.5.4 diff --git a/benchmarks/src/RecentMessages.cpp b/benchmarks/src/RecentMessages.cpp index f66ead3f..4888d3e1 100644 --- a/benchmarks/src/RecentMessages.cpp +++ b/benchmarks/src/RecentMessages.cpp @@ -4,7 +4,7 @@ #include "messages/Emote.hpp" #include "mocks/BaseApplication.hpp" #include "mocks/DisabledStreamerMode.hpp" -#include "mocks/Emotes.hpp" +#include "mocks/EmoteController.hpp" #include "mocks/LinkResolver.hpp" #include "mocks/Logging.hpp" #include "mocks/TwitchIrcServer.hpp" @@ -41,7 +41,7 @@ public: { } - IEmotes *getEmotes() override + EmoteController *getEmotes() override { return &this->emotes; } @@ -118,7 +118,7 @@ public: mock::EmptyLogging logging; AccountController accounts; - mock::Emotes emotes; + mock::EmoteController emotes; mock::UserDataController userData; mock::MockTwitchIrcServer twitch; mock::EmptyLinkResolver linkResolver; diff --git a/mocks/include/mocks/EmoteController.hpp b/mocks/include/mocks/EmoteController.hpp new file mode 100644 index 00000000..9edce358 --- /dev/null +++ b/mocks/include/mocks/EmoteController.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "controllers/emotes/EmoteController.hpp" +#include "providers/emoji/Emojis.hpp" + +namespace chatterino::mock { + +class EmoteController : public chatterino::EmoteController +{ +public: + EmoteController() + { + this->getEmojis()->load(); + } + + void initialize() override + { + } +}; + +} // namespace chatterino::mock diff --git a/mocks/include/mocks/Emotes.hpp b/mocks/include/mocks/Emotes.hpp deleted file mode 100644 index 96c5dcc6..00000000 --- a/mocks/include/mocks/Emotes.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include "singletons/Emotes.hpp" - -namespace chatterino::mock { - -class Emotes : public IEmotes -{ -public: - Emotes() - { - this->emojis.load(); - // don't initialize GIFTimer - } - - ITwitchEmotes *getTwitchEmotes() override - { - return &this->twitch; - } - - IEmojis *getEmojis() override - { - return &this->emojis; - } - - GIFTimer &getGIFTimer() override - { - return this->gifTimer; - } - -private: - TwitchEmotes twitch; - Emojis emojis; - - GIFTimer gifTimer; -}; - -} // namespace chatterino::mock diff --git a/mocks/include/mocks/EmptyApplication.hpp b/mocks/include/mocks/EmptyApplication.hpp index 2964ec9a..1e6ade4f 100644 --- a/mocks/include/mocks/EmptyApplication.hpp +++ b/mocks/include/mocks/EmptyApplication.hpp @@ -56,7 +56,7 @@ public: return nullptr; } - IEmotes *getEmotes() override + EmoteController *getEmotes() override { assert( false && diff --git a/src/Application.cpp b/src/Application.cpp index 5e078dec..ca8f2b59 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -24,6 +24,7 @@ #ifdef CHATTERINO_HAVE_PLUGINS # include "controllers/plugins/PluginController.hpp" #endif +#include "controllers/emotes/EmoteController.hpp" #include "controllers/sound/MiniaudioBackend.hpp" #include "controllers/sound/NullBackend.hpp" #include "controllers/twitch/LiveController.hpp" @@ -43,7 +44,6 @@ #include "providers/twitch/TwitchIrcServer.hpp" #include "providers/twitch/TwitchUsers.hpp" #include "singletons/CrashHandler.hpp" -#include "singletons/Emotes.hpp" #include "singletons/Fonts.hpp" #include "singletons/helper/LoggingChannel.hpp" #include "singletons/Logging.hpp" @@ -163,7 +163,7 @@ Application::Application(Settings &_settings, const Paths &paths, , themes(new Theme(paths)) , fonts(new Fonts(_settings)) , logging(new Logging(_settings)) - , emotes(new Emotes) + , emotes(new EmoteController) , accounts(new AccountController) , eventSub(makeEventSubController(_settings)) , hotkeys(new HotkeyController) @@ -233,6 +233,7 @@ void Application::initialize(Settings &settings, const Paths &paths) { getSettings()->currentVersion.setValue(CHATTERINO_VERSION); } + this->emotes->initialize(); this->accounts->load(); @@ -343,7 +344,7 @@ Fonts *Application::getFonts() return this->fonts.get(); } -IEmotes *Application::getEmotes() +EmoteController *Application::getEmotes() { assertInGuiThread(); assert(this->emotes); diff --git a/src/Application.hpp b/src/Application.hpp index 29ffe1c9..1c106549 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -32,8 +32,7 @@ class WindowManager; class ILogging; class Logging; class Paths; -class Emotes; -class IEmotes; +class EmoteController; class Settings; class Fonts; class Toasts; @@ -77,7 +76,7 @@ public: virtual const Args &getArgs() = 0; virtual Theme *getThemes() = 0; virtual Fonts *getFonts() = 0; - virtual IEmotes *getEmotes() = 0; + virtual EmoteController *getEmotes() = 0; virtual AccountController *getAccounts() = 0; virtual HotkeyController *getHotkeys() = 0; virtual WindowManager *getWindows() = 0; @@ -149,7 +148,7 @@ private: std::unique_ptr themes; std::unique_ptr fonts; std::unique_ptr logging; - std::unique_ptr emotes; + std::unique_ptr emotes; std::unique_ptr accounts; std::unique_ptr eventSub; std::unique_ptr hotkeys; @@ -194,7 +193,7 @@ public: } Theme *getThemes() override; Fonts *getFonts() override; - IEmotes *getEmotes() override; + EmoteController *getEmotes() override; AccountController *getAccounts() override; HotkeyController *getHotkeys() override; WindowManager *getWindows() override; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 03d7c79c..1aed747c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -158,6 +158,9 @@ set(SOURCE_FILES controllers/completion/TabCompletionModel.cpp controllers/completion/TabCompletionModel.hpp + controllers/emotes/EmoteController.cpp + controllers/emotes/EmoteController.hpp + controllers/filters/FilterModel.cpp controllers/filters/FilterModel.hpp controllers/filters/FilterRecord.cpp @@ -473,8 +476,6 @@ set(SOURCE_FILES singletons/CrashHandler.cpp singletons/CrashHandler.hpp - singletons/Emotes.cpp - singletons/Emotes.hpp singletons/Fonts.cpp singletons/Fonts.hpp singletons/ImageUploader.cpp diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 0397efd4..eecc54fa 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -30,13 +30,14 @@ #include "controllers/commands/Command.hpp" #include "controllers/commands/CommandContext.hpp" #include "controllers/commands/CommandModel.hpp" +#include "controllers/emotes/EmoteController.hpp" #include "controllers/plugins/PluginController.hpp" #include "messages/Message.hpp" #include "messages/MessageBuilder.hpp" +#include "providers/emoji/Emojis.hpp" #include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchCommon.hpp" -#include "singletons/Emotes.hpp" #include "singletons/Paths.hpp" #include "util/CombinePath.hpp" #include "util/QStringHash.hpp" diff --git a/src/controllers/commands/builtin/twitch/SendWhisper.cpp b/src/controllers/commands/builtin/twitch/SendWhisper.cpp index 64e77901..ff88f98e 100644 --- a/src/controllers/commands/builtin/twitch/SendWhisper.cpp +++ b/src/controllers/commands/builtin/twitch/SendWhisper.cpp @@ -4,15 +4,16 @@ #include "common/LinkParser.hpp" #include "controllers/accounts/AccountController.hpp" #include "controllers/commands/CommandContext.hpp" +#include "controllers/emotes/EmoteController.hpp" #include "messages/Message.hpp" #include "messages/MessageBuilder.hpp" #include "messages/MessageElement.hpp" #include "providers/bttv/BttvEmotes.hpp" +#include "providers/emoji/Emojis.hpp" #include "providers/ffz/FfzEmotes.hpp" #include "providers/twitch/api/Helix.hpp" #include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchIrcServer.hpp" -#include "singletons/Emotes.hpp" #include "singletons/Settings.hpp" #include "singletons/StreamerMode.hpp" #include "singletons/Theme.hpp" diff --git a/src/controllers/completion/sources/EmoteSource.cpp b/src/controllers/completion/sources/EmoteSource.cpp index e78d9584..cc1704cd 100644 --- a/src/controllers/completion/sources/EmoteSource.cpp +++ b/src/controllers/completion/sources/EmoteSource.cpp @@ -3,6 +3,7 @@ #include "Application.hpp" #include "controllers/accounts/AccountController.hpp" #include "controllers/completion/sources/Helpers.hpp" +#include "controllers/emotes/EmoteController.hpp" #include "providers/bttv/BttvEmotes.hpp" #include "providers/emoji/Emojis.hpp" #include "providers/ffz/FfzEmotes.hpp" @@ -10,7 +11,6 @@ #include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchIrcServer.hpp" -#include "singletons/Emotes.hpp" #include "widgets/splits/InputCompletionItem.hpp" namespace chatterino::completion { diff --git a/src/controllers/emotes/EmoteController.cpp b/src/controllers/emotes/EmoteController.cpp new file mode 100644 index 00000000..d8885d43 --- /dev/null +++ b/src/controllers/emotes/EmoteController.cpp @@ -0,0 +1,38 @@ +#include "controllers/emotes/EmoteController.hpp" + +#include "providers/emoji/Emojis.hpp" +#include "providers/twitch/TwitchEmotes.hpp" +#include "singletons/helper/GifTimer.hpp" + +namespace chatterino { + +EmoteController::EmoteController() + : twitchEmotes_(std::make_unique()) + , emojis_(std::make_unique()) + , gifTimer_(std::make_unique()) +{ +} +EmoteController::~EmoteController() = default; + +void EmoteController::initialize() +{ + this->emojis_->load(); + this->gifTimer_->initialize(); +} + +TwitchEmotes *EmoteController::getTwitchEmotes() const +{ + return this->twitchEmotes_.get(); +} + +Emojis *EmoteController::getEmojis() const +{ + return this->emojis_.get(); +} + +GIFTimer *EmoteController::getGIFTimer() const +{ + return this->gifTimer_.get(); +} + +} // namespace chatterino diff --git a/src/controllers/emotes/EmoteController.hpp b/src/controllers/emotes/EmoteController.hpp new file mode 100644 index 00000000..1d9c0c25 --- /dev/null +++ b/src/controllers/emotes/EmoteController.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include + +namespace chatterino { + +class TwitchEmotes; +class Emojis; +class GIFTimer; + +class EmoteController +{ +public: + EmoteController(); + virtual ~EmoteController(); + + virtual void initialize(); + + TwitchEmotes *getTwitchEmotes() const; + + Emojis *getEmojis() const; + + GIFTimer *getGIFTimer() const; + +private: + std::unique_ptr twitchEmotes_; + std::unique_ptr emojis_; + std::unique_ptr gifTimer_; +}; + +} // namespace chatterino diff --git a/src/messages/Image.cpp b/src/messages/Image.cpp index ce636b5a..c7c7a167 100644 --- a/src/messages/Image.cpp +++ b/src/messages/Image.cpp @@ -5,9 +5,9 @@ #include "common/network/NetworkRequest.hpp" #include "common/network/NetworkResult.hpp" #include "common/QLogging.hpp" +#include "controllers/emotes/EmoteController.hpp" #include "debug/AssertInGuiThread.hpp" #include "debug/Benchmark.hpp" -#include "singletons/Emotes.hpp" #include "singletons/helper/GifTimer.hpp" #include "singletons/WindowManager.hpp" #include "util/DebugCount.hpp" @@ -58,7 +58,7 @@ Frames::Frames(QList &&frames) DebugCount::increase("animated images"); this->gifTimerConnection_ = - app->getEmotes()->getGIFTimer().signal.connect([this] { + app->getEmotes()->getGIFTimer()->signal.connect([this] { this->advance(); }); @@ -75,7 +75,7 @@ Frames::Frames(QList &&frames) else { this->durationOffset_ = std::min( - int(app->getEmotes()->getGIFTimer().position() % totalLength), + int(app->getEmotes()->getGIFTimer()->position() % totalLength), 60000); } this->processOffset(); diff --git a/src/messages/MessageBuilder.cpp b/src/messages/MessageBuilder.cpp index 93d2831b..de096163 100644 --- a/src/messages/MessageBuilder.cpp +++ b/src/messages/MessageBuilder.cpp @@ -5,6 +5,7 @@ #include "common/Literals.hpp" #include "common/QLogging.hpp" #include "controllers/accounts/AccountController.hpp" +#include "controllers/emotes/EmoteController.hpp" #include "controllers/highlights/HighlightController.hpp" #include "controllers/ignores/IgnoreController.hpp" #include "controllers/ignores/IgnorePhrase.hpp" @@ -18,6 +19,7 @@ #include "providers/bttv/BttvEmotes.hpp" #include "providers/chatterino/ChatterinoBadges.hpp" #include "providers/colors/ColorProvider.hpp" +#include "providers/emoji/Emojis.hpp" #include "providers/ffz/FfzBadges.hpp" #include "providers/ffz/FfzEmotes.hpp" #include "providers/links/LinkResolver.hpp" @@ -33,7 +35,6 @@ #include "providers/twitch/TwitchIrcServer.hpp" #include "providers/twitch/TwitchUsers.hpp" #include "providers/twitch/UserColor.hpp" -#include "singletons/Emotes.hpp" #include "singletons/Resources.hpp" #include "singletons/Settings.hpp" #include "singletons/StreamerMode.hpp" diff --git a/src/messages/MessageElement.cpp b/src/messages/MessageElement.cpp index e98f2f80..eb059be6 100644 --- a/src/messages/MessageElement.cpp +++ b/src/messages/MessageElement.cpp @@ -2,6 +2,7 @@ #include "Application.hpp" #include "common/Literals.hpp" +#include "controllers/emotes/EmoteController.hpp" #include "controllers/moderationactions/ModerationAction.hpp" #include "debug/Benchmark.hpp" #include "messages/Emote.hpp" @@ -10,7 +11,7 @@ #include "messages/layouts/MessageLayoutContext.hpp" #include "messages/layouts/MessageLayoutElement.hpp" #include "providers/emoji/Emojis.hpp" -#include "singletons/Emotes.hpp" +#include "providers/twitch/TwitchEmotes.hpp" #include "singletons/Settings.hpp" #include "singletons/Theme.hpp" #include "util/DebugCount.hpp" diff --git a/src/providers/twitch/TwitchAccount.cpp b/src/providers/twitch/TwitchAccount.cpp index 1c8e14ca..f29d3fc1 100644 --- a/src/providers/twitch/TwitchAccount.cpp +++ b/src/providers/twitch/TwitchAccount.cpp @@ -5,6 +5,7 @@ #include "common/network/NetworkResult.hpp" // IWYU pragma: keep #include "common/QLogging.hpp" #include "controllers/accounts/AccountController.hpp" +#include "controllers/emotes/EmoteController.hpp" #include "debug/AssertInGuiThread.hpp" #include "messages/Emote.hpp" #include "messages/MessageBuilder.hpp" @@ -12,7 +13,6 @@ #include "providers/twitch/api/Helix.hpp" #include "providers/twitch/TwitchCommon.hpp" #include "providers/twitch/TwitchUsers.hpp" -#include "singletons/Emotes.hpp" #include "util/CancellationToken.hpp" #include "util/QStringHash.hpp" // IWYU pragma: keep diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index 46e298eb..6cae7942 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -8,6 +8,7 @@ #include "common/network/NetworkResult.hpp" #include "common/QLogging.hpp" #include "controllers/accounts/AccountController.hpp" +#include "controllers/emotes/EmoteController.hpp" #include "controllers/notifications/NotificationController.hpp" #include "controllers/twitch/LiveController.hpp" #include "messages/Emote.hpp" @@ -20,6 +21,7 @@ #include "providers/bttv/BttvEmotes.hpp" #include "providers/bttv/BttvLiveUpdates.hpp" #include "providers/bttv/liveupdates/BttvLiveUpdateMessages.hpp" +#include "providers/emoji/Emojis.hpp" #include "providers/ffz/FfzBadges.hpp" #include "providers/ffz/FfzEmotes.hpp" #include "providers/recentmessages/Api.hpp" @@ -36,7 +38,6 @@ #include "providers/twitch/TwitchCommon.hpp" #include "providers/twitch/TwitchIrcServer.hpp" #include "providers/twitch/TwitchUsers.hpp" -#include "singletons/Emotes.hpp" #include "singletons/Settings.hpp" #include "singletons/StreamerMode.hpp" #include "singletons/Toasts.hpp" diff --git a/src/providers/twitch/TwitchIrc.cpp b/src/providers/twitch/TwitchIrc.cpp index 962618f6..c36fa78b 100644 --- a/src/providers/twitch/TwitchIrc.cpp +++ b/src/providers/twitch/TwitchIrc.cpp @@ -3,7 +3,8 @@ #include "Application.hpp" #include "common/Aliases.hpp" #include "common/QLogging.hpp" -#include "singletons/Emotes.hpp" +#include "controllers/emotes/EmoteController.hpp" +#include "providers/twitch/TwitchEmotes.hpp" #include "util/IrcHelpers.hpp" namespace { diff --git a/src/singletons/Emotes.cpp b/src/singletons/Emotes.cpp deleted file mode 100644 index a5b16990..00000000 --- a/src/singletons/Emotes.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "singletons/Emotes.hpp" - -namespace chatterino { - -Emotes::Emotes() -{ - this->emojis.load(); - - this->gifTimer.initialize(); -} - -} // namespace chatterino diff --git a/src/singletons/Emotes.hpp b/src/singletons/Emotes.hpp deleted file mode 100644 index 9b252039..00000000 --- a/src/singletons/Emotes.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include "providers/emoji/Emojis.hpp" -#include "providers/twitch/TwitchEmotes.hpp" -#include "singletons/helper/GifTimer.hpp" - -namespace chatterino { - -class IEmotes -{ -public: - virtual ~IEmotes() = default; - - virtual ITwitchEmotes *getTwitchEmotes() = 0; - virtual IEmojis *getEmojis() = 0; - virtual GIFTimer &getGIFTimer() = 0; -}; - -class Emotes final : public IEmotes -{ -public: - Emotes(); - - ITwitchEmotes *getTwitchEmotes() final - { - return &this->twitch; - } - - IEmojis *getEmojis() final - { - return &this->emojis; - } - - GIFTimer &getGIFTimer() final - { - return this->gifTimer; - } - - TwitchEmotes twitch; - Emojis emojis; - - GIFTimer gifTimer; -}; - -} // namespace chatterino diff --git a/src/widgets/OverlayWindow.cpp b/src/widgets/OverlayWindow.cpp index ec54f0d2..db7537fb 100644 --- a/src/widgets/OverlayWindow.cpp +++ b/src/widgets/OverlayWindow.cpp @@ -4,8 +4,9 @@ #include "common/FlagsEnum.hpp" #include "common/Literals.hpp" #include "common/QLogging.hpp" +#include "controllers/emotes/EmoteController.hpp" #include "controllers/hotkeys/HotkeyController.hpp" -#include "singletons/Emotes.hpp" +#include "singletons/helper/GifTimer.hpp" #include "singletons/Settings.hpp" #include "singletons/WindowManager.hpp" #include "util/PostToThread.hpp" @@ -191,7 +192,7 @@ OverlayWindow::OverlayWindow(IndirectChannel channel, this->updateScale(); this->triggerFirstActivation(); - getApp()->getEmotes()->getGIFTimer().registerOpenOverlayWindow(); + getApp()->getEmotes()->getGIFTimer()->registerOpenOverlayWindow(); } OverlayWindow::~OverlayWindow() @@ -199,7 +200,7 @@ OverlayWindow::~OverlayWindow() #ifdef Q_OS_WIN ::DestroyCursor(this->sizeAllCursor_); #endif - getApp()->getEmotes()->getGIFTimer().unregisterOpenOverlayWindow(); + getApp()->getEmotes()->getGIFTimer()->unregisterOpenOverlayWindow(); } void OverlayWindow::applyTheme() diff --git a/src/widgets/dialogs/EmotePopup.cpp b/src/widgets/dialogs/EmotePopup.cpp index 0764faa2..3ef91640 100644 --- a/src/widgets/dialogs/EmotePopup.cpp +++ b/src/widgets/dialogs/EmotePopup.cpp @@ -3,6 +3,7 @@ #include "Application.hpp" #include "common/QLogging.hpp" #include "controllers/accounts/AccountController.hpp" +#include "controllers/emotes/EmoteController.hpp" #include "controllers/hotkeys/HotkeyController.hpp" #include "debug/Benchmark.hpp" #include "messages/Emote.hpp" @@ -10,11 +11,11 @@ #include "messages/MessageBuilder.hpp" #include "messages/MessageElement.hpp" #include "providers/bttv/BttvEmotes.hpp" +#include "providers/emoji/Emojis.hpp" #include "providers/ffz/FfzEmotes.hpp" #include "providers/seventv/SeventvEmotes.hpp" #include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchChannel.hpp" -#include "singletons/Emotes.hpp" #include "singletons/Settings.hpp" #include "singletons/Theme.hpp" #include "singletons/WindowManager.hpp" diff --git a/tests/src/Commands.cpp b/tests/src/Commands.cpp index e44366f2..ad122f97 100644 --- a/tests/src/Commands.cpp +++ b/tests/src/Commands.cpp @@ -4,7 +4,7 @@ #include "controllers/commands/CommandController.hpp" #include "controllers/commands/common/ChannelAction.hpp" #include "mocks/BaseApplication.hpp" -#include "mocks/Emotes.hpp" +#include "mocks/EmoteController.hpp" #include "mocks/Helix.hpp" #include "mocks/Logging.hpp" #include "mocks/TwitchIrcServer.hpp" @@ -45,7 +45,7 @@ public: return &this->commands; } - IEmotes *getEmotes() override + EmoteController *getEmotes() override { return &this->emotes; } @@ -59,7 +59,7 @@ public: AccountController accounts; CommandController commands; mock::MockTwitchIrcServer twitch; - mock::Emotes emotes; + mock::EmoteController emotes; }; } // namespace diff --git a/tests/src/Filters.cpp b/tests/src/Filters.cpp index 67cd48d2..7347f06d 100644 --- a/tests/src/Filters.cpp +++ b/tests/src/Filters.cpp @@ -7,7 +7,7 @@ #include "mocks/BaseApplication.hpp" #include "mocks/Channel.hpp" #include "mocks/ChatterinoBadges.hpp" -#include "mocks/Emotes.hpp" +#include "mocks/EmoteController.hpp" #include "mocks/EmptyApplication.hpp" #include "mocks/Logging.hpp" #include "mocks/TwitchIrcServer.hpp" @@ -34,7 +34,7 @@ public: { } - IEmotes *getEmotes() override + EmoteController *getEmotes() override { return &this->emotes; } @@ -81,7 +81,7 @@ public: mock::EmptyLogging logging; AccountController accounts; - mock::Emotes emotes; + mock::EmoteController emotes; mock::UserDataController userData; mock::MockTwitchIrcServer twitch; mock::ChatterinoBadges chatterinoBadges; diff --git a/tests/src/IgnoreController.cpp b/tests/src/IgnoreController.cpp index f3e061f5..fadd8c43 100644 --- a/tests/src/IgnoreController.cpp +++ b/tests/src/IgnoreController.cpp @@ -2,7 +2,8 @@ #include "controllers/accounts/AccountController.hpp" #include "mocks/BaseApplication.hpp" -#include "mocks/Emotes.hpp" +#include "mocks/EmoteController.hpp" +#include "providers/twitch/TwitchEmotes.hpp" #include "providers/twitch/TwitchIrc.hpp" #include "Test.hpp" @@ -15,7 +16,7 @@ class MockApplication : public mock::BaseApplication public: MockApplication() = default; - IEmotes *getEmotes() override + EmoteController *getEmotes() override { return &this->emotes; } @@ -25,7 +26,7 @@ public: return &this->accounts; } - mock::Emotes emotes; + mock::EmoteController emotes; AccountController accounts; }; diff --git a/tests/src/InputCompletion.cpp b/tests/src/InputCompletion.cpp index 1d3f8a5f..69441cca 100644 --- a/tests/src/InputCompletion.cpp +++ b/tests/src/InputCompletion.cpp @@ -8,11 +8,10 @@ #include "messages/Emote.hpp" #include "mocks/BaseApplication.hpp" #include "mocks/Channel.hpp" -#include "mocks/Emotes.hpp" +#include "mocks/EmoteController.hpp" #include "mocks/Helix.hpp" #include "mocks/Logging.hpp" #include "mocks/TwitchIrcServer.hpp" -#include "singletons/Emotes.hpp" #include "singletons/Paths.hpp" #include "singletons/Settings.hpp" #include "Test.hpp" @@ -52,7 +51,7 @@ public: return &this->twitch; } - IEmotes *getEmotes() override + EmoteController *getEmotes() override { return &this->emotes; } @@ -80,7 +79,7 @@ public: mock::EmptyLogging logging; AccountController accounts; mock::MockTwitchIrcServer twitch; - mock::Emotes emotes; + mock::EmoteController emotes; BttvEmotes bttvEmotes; FfzEmotes ffzEmotes; SeventvEmotes seventvEmotes; diff --git a/tests/src/IrcMessageHandler.cpp b/tests/src/IrcMessageHandler.cpp index abfadbad..c6d9fa99 100644 --- a/tests/src/IrcMessageHandler.cpp +++ b/tests/src/IrcMessageHandler.cpp @@ -11,7 +11,7 @@ #include "mocks/BaseApplication.hpp" #include "mocks/ChatterinoBadges.hpp" #include "mocks/DisabledStreamerMode.hpp" -#include "mocks/Emotes.hpp" +#include "mocks/EmoteController.hpp" #include "mocks/LinkResolver.hpp" #include "mocks/Logging.hpp" #include "mocks/TwitchIrcServer.hpp" @@ -24,7 +24,6 @@ #include "providers/twitch/TwitchBadge.hpp" #include "providers/twitch/TwitchBadges.hpp" #include "providers/twitch/TwitchChannel.hpp" -#include "singletons/Emotes.hpp" #include "Test.hpp" #include "util/IrcHelpers.hpp" #include "util/VectorMessageSink.hpp" @@ -72,7 +71,7 @@ public: { } - IEmotes *getEmotes() override + EmoteController *getEmotes() override { return &this->emotes; } @@ -149,7 +148,7 @@ public: mock::EmptyLogging logging; AccountController accounts; - mock::Emotes emotes; + mock::EmoteController emotes; mock::UserDataController userData; mock::MockTwitchIrcServer twitch; mock::ChatterinoBadges chatterinoBadges; diff --git a/tests/src/MessageLayout.cpp b/tests/src/MessageLayout.cpp index 5c438be7..3a4b026a 100644 --- a/tests/src/MessageLayout.cpp +++ b/tests/src/MessageLayout.cpp @@ -6,7 +6,6 @@ #include "messages/MessageBuilder.hpp" #include "messages/MessageElement.hpp" #include "mocks/BaseApplication.hpp" -#include "singletons/Emotes.hpp" #include "singletons/Fonts.hpp" #include "singletons/Settings.hpp" #include "singletons/Theme.hpp" diff --git a/tests/src/ModerationAction.cpp b/tests/src/ModerationAction.cpp index b1c306c9..679518bf 100644 --- a/tests/src/ModerationAction.cpp +++ b/tests/src/ModerationAction.cpp @@ -2,7 +2,7 @@ #include "messages/Image.hpp" #include "mocks/BaseApplication.hpp" -#include "mocks/Emotes.hpp" +#include "mocks/EmoteController.hpp" #include "singletons/Resources.hpp" #include "Test.hpp" @@ -19,12 +19,12 @@ class MockApplication : public mock::BaseApplication public: MockApplication() = default; - IEmotes *getEmotes() override + EmoteController *getEmotes() override { return &this->emotes; } - mock::Emotes emotes; + mock::EmoteController emotes; }; class ModerationActionTest : public ::testing::Test diff --git a/tests/src/Plugins.cpp b/tests/src/Plugins.cpp index c26fbd36..5f8eb7eb 100644 --- a/tests/src/Plugins.cpp +++ b/tests/src/Plugins.cpp @@ -14,7 +14,7 @@ # include "messages/Message.hpp" # include "mocks/BaseApplication.hpp" # include "mocks/Channel.hpp" -# include "mocks/Emotes.hpp" +# include "mocks/EmoteController.hpp" # include "mocks/Logging.hpp" # include "mocks/TwitchIrcServer.hpp" # include "NetworkHelpers.hpp" @@ -92,7 +92,7 @@ public: return &this->commands; } - IEmotes *getEmotes() override + EmoteController *getEmotes() override { return &this->emotes; } @@ -110,7 +110,7 @@ public: PluginController plugins; mock::Logging logging; CommandController commands; - mock::Emotes emotes; + mock::EmoteController emotes; MockTwitch twitch; }; diff --git a/tests/src/SplitInput.cpp b/tests/src/SplitInput.cpp index 55705d10..f9c68fc2 100644 --- a/tests/src/SplitInput.cpp +++ b/tests/src/SplitInput.cpp @@ -6,7 +6,7 @@ #include "controllers/commands/CommandController.hpp" #include "controllers/hotkeys/HotkeyController.hpp" #include "mocks/BaseApplication.hpp" -#include "mocks/Emotes.hpp" +#include "mocks/EmoteController.hpp" #include "singletons/Fonts.hpp" #include "singletons/Paths.hpp" #include "singletons/Settings.hpp" @@ -54,7 +54,7 @@ public: return &this->commands; } - IEmotes *getEmotes() override + EmoteController *getEmotes() override { return &this->emotes; } @@ -63,7 +63,7 @@ public: WindowManager windowManager; AccountController accounts; CommandController commands; - mock::Emotes emotes; + mock::EmoteController emotes; }; class SplitInputTest diff --git a/tests/src/TwitchIrc.cpp b/tests/src/TwitchIrc.cpp index 8403e33a..8cdfdd50 100644 --- a/tests/src/TwitchIrc.cpp +++ b/tests/src/TwitchIrc.cpp @@ -1,8 +1,9 @@ #include "providers/twitch/TwitchIrc.hpp" #include "mocks/BaseApplication.hpp" -#include "mocks/Emotes.hpp" +#include "mocks/EmoteController.hpp" #include "providers/twitch/TwitchBadge.hpp" +#include "providers/twitch/TwitchEmotes.hpp" #include "Test.hpp" #include "util/IrcHelpers.hpp" @@ -15,12 +16,12 @@ class MockApplication : public mock::BaseApplication public: MockApplication() = default; - IEmotes *getEmotes() override + EmoteController *getEmotes() override { return &this->emotes; } - mock::Emotes emotes; + mock::EmoteController emotes; }; } // namespace