refactor: turn Emotes into EmoteController (#6516)

* refactor: turn `Emotes` into `EmoteController`

* changelog

* why does clang-format do this???

* nit: remove unused include from EmoteController.hpp

---------

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2025-10-04 12:05:27 +02:00
committed by GitHub
parent 2bf617f37a
commit c5b0669812
33 changed files with 158 additions and 154 deletions
@@ -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"
@@ -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"
@@ -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 {
@@ -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<TwitchEmotes>())
, emojis_(std::make_unique<Emojis>())
, gifTimer_(std::make_unique<GIFTimer>())
{
}
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
@@ -0,0 +1,31 @@
#pragma once
#include <memory>
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> twitchEmotes_;
std::unique_ptr<Emojis> emojis_;
std::unique_ptr<GIFTimer> gifTimer_;
};
} // namespace chatterino