mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
refactor: Move Emotes to Application (#5120)
This commit is contained in:
parent
65d3e73c5d
commit
5628605de4
|
@ -112,6 +112,7 @@
|
||||||
- Dev: Refactored the Image Uploader feature. (#4971)
|
- Dev: Refactored the Image Uploader feature. (#4971)
|
||||||
- Dev: Refactored the SplitOverlay code. (#5082)
|
- Dev: Refactored the SplitOverlay code. (#5082)
|
||||||
- Dev: Refactored the TwitchBadges structure, making it less of a singleton. (#5096)
|
- Dev: Refactored the TwitchBadges structure, making it less of a singleton. (#5096)
|
||||||
|
- Dev: Refactored emotes out of TwitchIrcServer. (#5120)
|
||||||
- Dev: Refactored the ChatterinoBadges structure, making it less of a singleton. (#5103)
|
- Dev: Refactored the ChatterinoBadges structure, making it less of a singleton. (#5103)
|
||||||
- Dev: Refactored the ColorProvider class a bit. (#5112)
|
- Dev: Refactored the ColorProvider class a bit. (#5112)
|
||||||
- Dev: Moved the Network files to their own folder. (#5089)
|
- Dev: Moved the Network files to their own folder. (#5089)
|
||||||
|
|
|
@ -191,6 +191,27 @@ public:
|
||||||
return this->updates_;
|
return this->updates_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BttvEmotes *getBttvEmotes() override
|
||||||
|
{
|
||||||
|
assert(false && "EmptyApplication::getBttvEmotes was called without "
|
||||||
|
"being initialized");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
FfzEmotes *getFfzEmotes() override
|
||||||
|
{
|
||||||
|
assert(false && "EmptyApplication::getFfzEmotes was called without "
|
||||||
|
"being initialized");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
SeventvEmotes *getSeventvEmotes() override
|
||||||
|
{
|
||||||
|
assert(false && "EmptyApplication::getSeventvEmotes was called without "
|
||||||
|
"being initialized");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Paths paths_;
|
Paths paths_;
|
||||||
Args args_;
|
Args args_;
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "mocks/Channel.hpp"
|
#include "mocks/Channel.hpp"
|
||||||
|
#include "providers/bttv/BttvEmotes.hpp"
|
||||||
|
#include "providers/ffz/FfzEmotes.hpp"
|
||||||
|
#include "providers/seventv/SeventvEmotes.hpp"
|
||||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||||
|
|
||||||
namespace chatterino::mock {
|
namespace chatterino::mock {
|
||||||
|
@ -16,29 +19,11 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const BttvEmotes &getBttvEmotes() const override
|
|
||||||
{
|
|
||||||
return this->bttv;
|
|
||||||
}
|
|
||||||
|
|
||||||
const FfzEmotes &getFfzEmotes() const override
|
|
||||||
{
|
|
||||||
return this->ffz;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SeventvEmotes &getSeventvEmotes() const override
|
|
||||||
{
|
|
||||||
return this->seventv;
|
|
||||||
}
|
|
||||||
|
|
||||||
const IndirectChannel &getWatchingChannel() const override
|
const IndirectChannel &getWatchingChannel() const override
|
||||||
{
|
{
|
||||||
return this->watchingChannel;
|
return this->watchingChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
BttvEmotes bttv;
|
|
||||||
FfzEmotes ffz;
|
|
||||||
SeventvEmotes seventv;
|
|
||||||
ChannelPtr watchingChannelInner;
|
ChannelPtr watchingChannelInner;
|
||||||
IndirectChannel watchingChannel;
|
IndirectChannel watchingChannel;
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,7 +11,10 @@
|
||||||
#include "controllers/ignores/IgnoreController.hpp"
|
#include "controllers/ignores/IgnoreController.hpp"
|
||||||
#include "controllers/notifications/NotificationController.hpp"
|
#include "controllers/notifications/NotificationController.hpp"
|
||||||
#include "controllers/sound/ISoundController.hpp"
|
#include "controllers/sound/ISoundController.hpp"
|
||||||
|
#include "providers/bttv/BttvEmotes.hpp"
|
||||||
|
#include "providers/ffz/FfzEmotes.hpp"
|
||||||
#include "providers/seventv/SeventvAPI.hpp"
|
#include "providers/seventv/SeventvAPI.hpp"
|
||||||
|
#include "providers/seventv/SeventvEmotes.hpp"
|
||||||
#include "providers/twitch/TwitchBadges.hpp"
|
#include "providers/twitch/TwitchBadges.hpp"
|
||||||
#include "singletons/ImageUploader.hpp"
|
#include "singletons/ImageUploader.hpp"
|
||||||
#ifdef CHATTERINO_HAVE_PLUGINS
|
#ifdef CHATTERINO_HAVE_PLUGINS
|
||||||
|
@ -135,6 +138,9 @@ Application::Application(Settings &_settings, const Paths &paths,
|
||||||
, twitchPubSub(new PubSub(TWITCH_PUBSUB_URL))
|
, twitchPubSub(new PubSub(TWITCH_PUBSUB_URL))
|
||||||
, twitchBadges(new TwitchBadges)
|
, twitchBadges(new TwitchBadges)
|
||||||
, chatterinoBadges(new ChatterinoBadges)
|
, chatterinoBadges(new ChatterinoBadges)
|
||||||
|
, bttvEmotes(new BttvEmotes)
|
||||||
|
, ffzEmotes(new FfzEmotes)
|
||||||
|
, seventvEmotes(new SeventvEmotes)
|
||||||
, logging(new Logging(_settings))
|
, logging(new Logging(_settings))
|
||||||
#ifdef CHATTERINO_HAVE_PLUGINS
|
#ifdef CHATTERINO_HAVE_PLUGINS
|
||||||
, plugins(&this->emplace(new PluginController(paths)))
|
, plugins(&this->emplace(new PluginController(paths)))
|
||||||
|
@ -157,6 +163,9 @@ void Application::fakeDtor()
|
||||||
this->twitchPubSub.reset();
|
this->twitchPubSub.reset();
|
||||||
this->twitchBadges.reset();
|
this->twitchBadges.reset();
|
||||||
this->chatterinoBadges.reset();
|
this->chatterinoBadges.reset();
|
||||||
|
this->bttvEmotes.reset();
|
||||||
|
this->ffzEmotes.reset();
|
||||||
|
this->seventvEmotes.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::initialize(Settings &settings, const Paths &paths)
|
void Application::initialize(Settings &settings, const Paths &paths)
|
||||||
|
@ -481,6 +490,30 @@ Logging *Application::getChatLogger()
|
||||||
return this->logging.get();
|
return this->logging.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BttvEmotes *Application::getBttvEmotes()
|
||||||
|
{
|
||||||
|
assertInGuiThread();
|
||||||
|
assert(this->bttvEmotes);
|
||||||
|
|
||||||
|
return this->bttvEmotes.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
FfzEmotes *Application::getFfzEmotes()
|
||||||
|
{
|
||||||
|
assertInGuiThread();
|
||||||
|
assert(this->ffzEmotes);
|
||||||
|
|
||||||
|
return this->ffzEmotes.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
SeventvEmotes *Application::getSeventvEmotes()
|
||||||
|
{
|
||||||
|
assertInGuiThread();
|
||||||
|
assert(this->seventvEmotes);
|
||||||
|
|
||||||
|
return this->seventvEmotes.get();
|
||||||
|
}
|
||||||
|
|
||||||
void Application::save()
|
void Application::save()
|
||||||
{
|
{
|
||||||
for (auto &singleton : this->singletons_)
|
for (auto &singleton : this->singletons_)
|
||||||
|
|
|
@ -51,6 +51,9 @@ class SeventvBadges;
|
||||||
class ImageUploader;
|
class ImageUploader;
|
||||||
class SeventvAPI;
|
class SeventvAPI;
|
||||||
class CrashHandler;
|
class CrashHandler;
|
||||||
|
class BttvEmotes;
|
||||||
|
class FfzEmotes;
|
||||||
|
class SeventvEmotes;
|
||||||
|
|
||||||
class IApplication
|
class IApplication
|
||||||
{
|
{
|
||||||
|
@ -89,6 +92,9 @@ public:
|
||||||
virtual PluginController *getPlugins() = 0;
|
virtual PluginController *getPlugins() = 0;
|
||||||
#endif
|
#endif
|
||||||
virtual Updates &getUpdates() = 0;
|
virtual Updates &getUpdates() = 0;
|
||||||
|
virtual BttvEmotes *getBttvEmotes() = 0;
|
||||||
|
virtual FfzEmotes *getFfzEmotes() = 0;
|
||||||
|
virtual SeventvEmotes *getSeventvEmotes() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Application : public IApplication
|
class Application : public IApplication
|
||||||
|
@ -152,6 +158,9 @@ private:
|
||||||
std::unique_ptr<PubSub> twitchPubSub;
|
std::unique_ptr<PubSub> twitchPubSub;
|
||||||
std::unique_ptr<TwitchBadges> twitchBadges;
|
std::unique_ptr<TwitchBadges> twitchBadges;
|
||||||
std::unique_ptr<ChatterinoBadges> chatterinoBadges;
|
std::unique_ptr<ChatterinoBadges> chatterinoBadges;
|
||||||
|
std::unique_ptr<BttvEmotes> bttvEmotes;
|
||||||
|
std::unique_ptr<FfzEmotes> ffzEmotes;
|
||||||
|
std::unique_ptr<SeventvEmotes> seventvEmotes;
|
||||||
const std::unique_ptr<Logging> logging;
|
const std::unique_ptr<Logging> logging;
|
||||||
#ifdef CHATTERINO_HAVE_PLUGINS
|
#ifdef CHATTERINO_HAVE_PLUGINS
|
||||||
PluginController *const plugins{};
|
PluginController *const plugins{};
|
||||||
|
@ -199,6 +208,10 @@ public:
|
||||||
return this->updates;
|
return this->updates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BttvEmotes *getBttvEmotes() override;
|
||||||
|
FfzEmotes *getFfzEmotes() override;
|
||||||
|
SeventvEmotes *getSeventvEmotes() override;
|
||||||
|
|
||||||
pajlada::Signals::NoArgSignal streamerModeChanged;
|
pajlada::Signals::NoArgSignal streamerModeChanged;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "messages/MessageBuilder.hpp"
|
#include "messages/MessageBuilder.hpp"
|
||||||
#include "messages/MessageElement.hpp"
|
#include "messages/MessageElement.hpp"
|
||||||
|
#include "providers/bttv/BttvEmotes.hpp"
|
||||||
|
#include "providers/ffz/FfzEmotes.hpp"
|
||||||
#include "providers/irc/IrcChannel2.hpp"
|
#include "providers/irc/IrcChannel2.hpp"
|
||||||
#include "providers/irc/IrcServer.hpp"
|
#include "providers/irc/IrcServer.hpp"
|
||||||
#include "providers/twitch/api/Helix.hpp"
|
#include "providers/twitch/api/Helix.hpp"
|
||||||
|
@ -105,8 +107,8 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
|
||||||
|
|
||||||
const auto &acc = app->getAccounts()->twitch.getCurrent();
|
const auto &acc = app->getAccounts()->twitch.getCurrent();
|
||||||
const auto &accemotes = *acc->accessEmotes();
|
const auto &accemotes = *acc->accessEmotes();
|
||||||
const auto &bttvemotes = app->twitch->getBttvEmotes();
|
const auto *bttvemotes = app->getBttvEmotes();
|
||||||
const auto &ffzemotes = app->twitch->getFfzEmotes();
|
const auto *ffzemotes = app->getFfzEmotes();
|
||||||
auto flags = MessageElementFlags();
|
auto flags = MessageElementFlags();
|
||||||
auto emote = std::optional<EmotePtr>{};
|
auto emote = std::optional<EmotePtr>{};
|
||||||
for (int i = 2; i < words.length(); i++)
|
for (int i = 2; i < words.length(); i++)
|
||||||
|
@ -122,14 +124,15 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
|
||||||
} // Twitch emote
|
} // Twitch emote
|
||||||
|
|
||||||
{ // bttv/ffz emote
|
{ // bttv/ffz emote
|
||||||
if ((emote = bttvemotes.emote({words[i]})))
|
if ((emote = bttvemotes->emote({words[i]})))
|
||||||
{
|
{
|
||||||
flags = MessageElementFlag::BttvEmote;
|
flags = MessageElementFlag::BttvEmote;
|
||||||
}
|
}
|
||||||
else if ((emote = ffzemotes.emote({words[i]})))
|
else if ((emote = ffzemotes->emote({words[i]})))
|
||||||
{
|
{
|
||||||
flags = MessageElementFlag::FfzEmote;
|
flags = MessageElementFlag::FfzEmote;
|
||||||
}
|
}
|
||||||
|
// TODO: Load 7tv global emotes
|
||||||
if (emote)
|
if (emote)
|
||||||
{
|
{
|
||||||
b.emplace<EmoteElement>(*emote, flags);
|
b.emplace<EmoteElement>(*emote, flags);
|
||||||
|
|
|
@ -3,7 +3,10 @@
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "controllers/accounts/AccountController.hpp"
|
#include "controllers/accounts/AccountController.hpp"
|
||||||
#include "controllers/completion/sources/Helpers.hpp"
|
#include "controllers/completion/sources/Helpers.hpp"
|
||||||
|
#include "providers/bttv/BttvEmotes.hpp"
|
||||||
#include "providers/emoji/Emojis.hpp"
|
#include "providers/emoji/Emojis.hpp"
|
||||||
|
#include "providers/ffz/FfzEmotes.hpp"
|
||||||
|
#include "providers/seventv/SeventvEmotes.hpp"
|
||||||
#include "providers/twitch/TwitchAccount.hpp"
|
#include "providers/twitch/TwitchAccount.hpp"
|
||||||
#include "providers/twitch/TwitchChannel.hpp"
|
#include "providers/twitch/TwitchChannel.hpp"
|
||||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||||
|
@ -127,15 +130,15 @@ void EmoteSource::initializeFromChannel(const Channel *channel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto bttvG = app->getTwitch()->getBttvEmotes().emotes())
|
if (auto bttvG = app->getBttvEmotes()->emotes())
|
||||||
{
|
{
|
||||||
addEmotes(emotes, *bttvG, "Global BetterTTV");
|
addEmotes(emotes, *bttvG, "Global BetterTTV");
|
||||||
}
|
}
|
||||||
if (auto ffzG = app->getTwitch()->getFfzEmotes().emotes())
|
if (auto ffzG = app->getFfzEmotes()->emotes())
|
||||||
{
|
{
|
||||||
addEmotes(emotes, *ffzG, "Global FrankerFaceZ");
|
addEmotes(emotes, *ffzG, "Global FrankerFaceZ");
|
||||||
}
|
}
|
||||||
if (auto seventvG = app->getTwitch()->getSeventvEmotes().globalEmotes())
|
if (auto seventvG = app->getSeventvEmotes()->globalEmotes())
|
||||||
{
|
{
|
||||||
addEmotes(emotes, *seventvG, "Global 7TV");
|
addEmotes(emotes, *seventvG, "Global 7TV");
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "providers/bttv/BttvEmotes.hpp"
|
#include "providers/bttv/BttvEmotes.hpp"
|
||||||
#include "providers/bttv/BttvLiveUpdates.hpp"
|
#include "providers/bttv/BttvLiveUpdates.hpp"
|
||||||
#include "providers/bttv/liveupdates/BttvLiveUpdateMessages.hpp"
|
#include "providers/bttv/liveupdates/BttvLiveUpdateMessages.hpp"
|
||||||
|
#include "providers/ffz/FfzEmotes.hpp"
|
||||||
#include "providers/recentmessages/Api.hpp"
|
#include "providers/recentmessages/Api.hpp"
|
||||||
#include "providers/seventv/eventapi/Dispatch.hpp"
|
#include "providers/seventv/eventapi/Dispatch.hpp"
|
||||||
#include "providers/seventv/SeventvAPI.hpp"
|
#include "providers/seventv/SeventvAPI.hpp"
|
||||||
|
|
|
@ -7,8 +7,11 @@
|
||||||
#include "controllers/accounts/AccountController.hpp"
|
#include "controllers/accounts/AccountController.hpp"
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "messages/MessageBuilder.hpp"
|
#include "messages/MessageBuilder.hpp"
|
||||||
|
#include "providers/bttv/BttvEmotes.hpp"
|
||||||
#include "providers/bttv/BttvLiveUpdates.hpp"
|
#include "providers/bttv/BttvLiveUpdates.hpp"
|
||||||
|
#include "providers/ffz/FfzEmotes.hpp"
|
||||||
#include "providers/seventv/eventapi/Subscription.hpp"
|
#include "providers/seventv/eventapi/Subscription.hpp"
|
||||||
|
#include "providers/seventv/SeventvEmotes.hpp"
|
||||||
#include "providers/seventv/SeventvEventAPI.hpp"
|
#include "providers/seventv/SeventvEventAPI.hpp"
|
||||||
#include "providers/twitch/api/Helix.hpp"
|
#include "providers/twitch/api/Helix.hpp"
|
||||||
#include "providers/twitch/ChannelPointReward.hpp"
|
#include "providers/twitch/ChannelPointReward.hpp"
|
||||||
|
@ -517,19 +520,6 @@ void TwitchIrcServer::onReplySendRequested(TwitchChannel *channel,
|
||||||
sent = true;
|
sent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BttvEmotes &TwitchIrcServer::getBttvEmotes() const
|
|
||||||
{
|
|
||||||
return this->bttv;
|
|
||||||
}
|
|
||||||
const FfzEmotes &TwitchIrcServer::getFfzEmotes() const
|
|
||||||
{
|
|
||||||
return this->ffz;
|
|
||||||
}
|
|
||||||
const SeventvEmotes &TwitchIrcServer::getSeventvEmotes() const
|
|
||||||
{
|
|
||||||
return this->seventv_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const IndirectChannel &TwitchIrcServer::getWatchingChannel() const
|
const IndirectChannel &TwitchIrcServer::getWatchingChannel() const
|
||||||
{
|
{
|
||||||
return this->watchingChannel;
|
return this->watchingChannel;
|
||||||
|
@ -537,7 +527,7 @@ const IndirectChannel &TwitchIrcServer::getWatchingChannel() const
|
||||||
|
|
||||||
void TwitchIrcServer::reloadBTTVGlobalEmotes()
|
void TwitchIrcServer::reloadBTTVGlobalEmotes()
|
||||||
{
|
{
|
||||||
this->bttv.loadEmotes();
|
getIApp()->getBttvEmotes()->loadEmotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwitchIrcServer::reloadAllBTTVChannelEmotes()
|
void TwitchIrcServer::reloadAllBTTVChannelEmotes()
|
||||||
|
@ -552,7 +542,7 @@ void TwitchIrcServer::reloadAllBTTVChannelEmotes()
|
||||||
|
|
||||||
void TwitchIrcServer::reloadFFZGlobalEmotes()
|
void TwitchIrcServer::reloadFFZGlobalEmotes()
|
||||||
{
|
{
|
||||||
this->ffz.loadEmotes();
|
getIApp()->getFfzEmotes()->loadEmotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwitchIrcServer::reloadAllFFZChannelEmotes()
|
void TwitchIrcServer::reloadAllFFZChannelEmotes()
|
||||||
|
@ -567,7 +557,7 @@ void TwitchIrcServer::reloadAllFFZChannelEmotes()
|
||||||
|
|
||||||
void TwitchIrcServer::reloadSevenTVGlobalEmotes()
|
void TwitchIrcServer::reloadSevenTVGlobalEmotes()
|
||||||
{
|
{
|
||||||
this->seventv_.loadGlobalEmotes();
|
getIApp()->getSeventvEmotes()->loadGlobalEmotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwitchIrcServer::reloadAllSevenTVChannelEmotes()
|
void TwitchIrcServer::reloadAllSevenTVChannelEmotes()
|
||||||
|
|
|
@ -3,10 +3,7 @@
|
||||||
#include "common/Atomic.hpp"
|
#include "common/Atomic.hpp"
|
||||||
#include "common/Channel.hpp"
|
#include "common/Channel.hpp"
|
||||||
#include "common/Singleton.hpp"
|
#include "common/Singleton.hpp"
|
||||||
#include "providers/bttv/BttvEmotes.hpp"
|
|
||||||
#include "providers/ffz/FfzEmotes.hpp"
|
|
||||||
#include "providers/irc/AbstractIrcServer.hpp"
|
#include "providers/irc/AbstractIrcServer.hpp"
|
||||||
#include "providers/seventv/SeventvEmotes.hpp"
|
|
||||||
|
|
||||||
#include <pajlada/signals/signalholder.hpp>
|
#include <pajlada/signals/signalholder.hpp>
|
||||||
|
|
||||||
|
@ -21,15 +18,15 @@ class Paths;
|
||||||
class TwitchChannel;
|
class TwitchChannel;
|
||||||
class BttvLiveUpdates;
|
class BttvLiveUpdates;
|
||||||
class SeventvEventAPI;
|
class SeventvEventAPI;
|
||||||
|
class BttvEmotes;
|
||||||
|
class FfzEmotes;
|
||||||
|
class SeventvEmotes;
|
||||||
|
|
||||||
class ITwitchIrcServer
|
class ITwitchIrcServer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~ITwitchIrcServer() = default;
|
virtual ~ITwitchIrcServer() = default;
|
||||||
|
|
||||||
virtual const BttvEmotes &getBttvEmotes() const = 0;
|
|
||||||
virtual const FfzEmotes &getFfzEmotes() const = 0;
|
|
||||||
virtual const SeventvEmotes &getSeventvEmotes() const = 0;
|
|
||||||
virtual const IndirectChannel &getWatchingChannel() const = 0;
|
virtual const IndirectChannel &getWatchingChannel() const = 0;
|
||||||
|
|
||||||
// Update this interface with TwitchIrcServer methods as needed
|
// Update this interface with TwitchIrcServer methods as needed
|
||||||
|
@ -82,9 +79,6 @@ public:
|
||||||
std::unique_ptr<BttvLiveUpdates> bttvLiveUpdates;
|
std::unique_ptr<BttvLiveUpdates> bttvLiveUpdates;
|
||||||
std::unique_ptr<SeventvEventAPI> seventvEventAPI;
|
std::unique_ptr<SeventvEventAPI> seventvEventAPI;
|
||||||
|
|
||||||
const BttvEmotes &getBttvEmotes() const override;
|
|
||||||
const FfzEmotes &getFfzEmotes() const override;
|
|
||||||
const SeventvEmotes &getSeventvEmotes() const override;
|
|
||||||
const IndirectChannel &getWatchingChannel() const override;
|
const IndirectChannel &getWatchingChannel() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -116,10 +110,6 @@ private:
|
||||||
std::chrono::steady_clock::time_point lastErrorTimeSpeed_;
|
std::chrono::steady_clock::time_point lastErrorTimeSpeed_;
|
||||||
std::chrono::steady_clock::time_point lastErrorTimeAmount_;
|
std::chrono::steady_clock::time_point lastErrorTimeAmount_;
|
||||||
|
|
||||||
BttvEmotes bttv;
|
|
||||||
FfzEmotes ffz;
|
|
||||||
SeventvEmotes seventv_;
|
|
||||||
|
|
||||||
pajlada::Signals::SignalHolder signalHolder_;
|
pajlada::Signals::SignalHolder signalHolder_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,13 @@
|
||||||
#include "messages/Image.hpp"
|
#include "messages/Image.hpp"
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "messages/MessageThread.hpp"
|
#include "messages/MessageThread.hpp"
|
||||||
|
#include "providers/bttv/BttvEmotes.hpp"
|
||||||
#include "providers/chatterino/ChatterinoBadges.hpp"
|
#include "providers/chatterino/ChatterinoBadges.hpp"
|
||||||
#include "providers/colors/ColorProvider.hpp"
|
#include "providers/colors/ColorProvider.hpp"
|
||||||
#include "providers/ffz/FfzBadges.hpp"
|
#include "providers/ffz/FfzBadges.hpp"
|
||||||
|
#include "providers/ffz/FfzEmotes.hpp"
|
||||||
#include "providers/seventv/SeventvBadges.hpp"
|
#include "providers/seventv/SeventvBadges.hpp"
|
||||||
|
#include "providers/seventv/SeventvEmotes.hpp"
|
||||||
#include "providers/twitch/api/Helix.hpp"
|
#include "providers/twitch/api/Helix.hpp"
|
||||||
#include "providers/twitch/ChannelPointReward.hpp"
|
#include "providers/twitch/ChannelPointReward.hpp"
|
||||||
#include "providers/twitch/PubSubActions.hpp"
|
#include "providers/twitch/PubSubActions.hpp"
|
||||||
|
@ -1140,9 +1143,9 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
|
||||||
{
|
{
|
||||||
auto *app = getIApp();
|
auto *app = getIApp();
|
||||||
|
|
||||||
const auto &globalBttvEmotes = app->getTwitch()->getBttvEmotes();
|
const auto *globalBttvEmotes = app->getBttvEmotes();
|
||||||
const auto &globalFfzEmotes = app->getTwitch()->getFfzEmotes();
|
const auto *globalFfzEmotes = app->getFfzEmotes();
|
||||||
const auto &globalSeventvEmotes = app->getTwitch()->getSeventvEmotes();
|
const auto *globalSeventvEmotes = app->getSeventvEmotes();
|
||||||
|
|
||||||
auto flags = MessageElementFlags();
|
auto flags = MessageElementFlags();
|
||||||
auto emote = std::optional<EmotePtr>{};
|
auto emote = std::optional<EmotePtr>{};
|
||||||
|
@ -1170,16 +1173,16 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
|
||||||
flags = MessageElementFlag::SevenTVEmote;
|
flags = MessageElementFlag::SevenTVEmote;
|
||||||
zeroWidth = emote.value()->zeroWidth;
|
zeroWidth = emote.value()->zeroWidth;
|
||||||
}
|
}
|
||||||
else if ((emote = globalFfzEmotes.emote(name)))
|
else if ((emote = globalFfzEmotes->emote(name)))
|
||||||
{
|
{
|
||||||
flags = MessageElementFlag::FfzEmote;
|
flags = MessageElementFlag::FfzEmote;
|
||||||
}
|
}
|
||||||
else if ((emote = globalBttvEmotes.emote(name)))
|
else if ((emote = globalBttvEmotes->emote(name)))
|
||||||
{
|
{
|
||||||
flags = MessageElementFlag::BttvEmote;
|
flags = MessageElementFlag::BttvEmote;
|
||||||
zeroWidth = zeroWidthEmotes.contains(name.string);
|
zeroWidth = zeroWidthEmotes.contains(name.string);
|
||||||
}
|
}
|
||||||
else if ((emote = globalSeventvEmotes.globalEmote(name)))
|
else if ((emote = globalSeventvEmotes->globalEmote(name)))
|
||||||
{
|
{
|
||||||
flags = MessageElementFlag::SevenTVEmote;
|
flags = MessageElementFlag::SevenTVEmote;
|
||||||
zeroWidth = emote.value()->zeroWidth;
|
zeroWidth = emote.value()->zeroWidth;
|
||||||
|
|
|
@ -9,9 +9,11 @@
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "messages/MessageBuilder.hpp"
|
#include "messages/MessageBuilder.hpp"
|
||||||
#include "messages/MessageElement.hpp"
|
#include "messages/MessageElement.hpp"
|
||||||
|
#include "providers/bttv/BttvEmotes.hpp"
|
||||||
|
#include "providers/ffz/FfzEmotes.hpp"
|
||||||
|
#include "providers/seventv/SeventvEmotes.hpp"
|
||||||
#include "providers/twitch/TwitchAccount.hpp"
|
#include "providers/twitch/TwitchAccount.hpp"
|
||||||
#include "providers/twitch/TwitchChannel.hpp"
|
#include "providers/twitch/TwitchChannel.hpp"
|
||||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
|
||||||
#include "singletons/Emotes.hpp"
|
#include "singletons/Emotes.hpp"
|
||||||
#include "singletons/Settings.hpp"
|
#include "singletons/Settings.hpp"
|
||||||
#include "singletons/WindowManager.hpp"
|
#include "singletons/WindowManager.hpp"
|
||||||
|
@ -404,19 +406,18 @@ void EmotePopup::loadChannel(ChannelPtr channel)
|
||||||
// global
|
// global
|
||||||
if (Settings::instance().enableBTTVGlobalEmotes)
|
if (Settings::instance().enableBTTVGlobalEmotes)
|
||||||
{
|
{
|
||||||
addEmotes(*globalChannel, *getApp()->twitch->getBttvEmotes().emotes(),
|
addEmotes(*globalChannel, *getApp()->getBttvEmotes()->emotes(),
|
||||||
"BetterTTV", MessageElementFlag::BttvEmote);
|
"BetterTTV", MessageElementFlag::BttvEmote);
|
||||||
}
|
}
|
||||||
if (Settings::instance().enableFFZGlobalEmotes)
|
if (Settings::instance().enableFFZGlobalEmotes)
|
||||||
{
|
{
|
||||||
addEmotes(*globalChannel, *getApp()->twitch->getFfzEmotes().emotes(),
|
addEmotes(*globalChannel, *getApp()->getFfzEmotes()->emotes(),
|
||||||
"FrankerFaceZ", MessageElementFlag::FfzEmote);
|
"FrankerFaceZ", MessageElementFlag::FfzEmote);
|
||||||
}
|
}
|
||||||
if (Settings::instance().enableSevenTVGlobalEmotes)
|
if (Settings::instance().enableSevenTVGlobalEmotes)
|
||||||
{
|
{
|
||||||
addEmotes(*globalChannel,
|
addEmotes(*globalChannel, *getApp()->getSeventvEmotes()->globalEmotes(),
|
||||||
*getApp()->twitch->getSeventvEmotes().globalEmotes(), "7TV",
|
"7TV", MessageElementFlag::SevenTVEmote);
|
||||||
MessageElementFlag::SevenTVEmote);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// channel
|
// channel
|
||||||
|
@ -495,11 +496,11 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bttvGlobalEmotes =
|
auto bttvGlobalEmotes =
|
||||||
filterEmoteMap(searchText, getApp()->twitch->getBttvEmotes().emotes());
|
filterEmoteMap(searchText, getIApp()->getBttvEmotes()->emotes());
|
||||||
auto ffzGlobalEmotes =
|
auto ffzGlobalEmotes =
|
||||||
filterEmoteMap(searchText, getApp()->twitch->getFfzEmotes().emotes());
|
filterEmoteMap(searchText, getIApp()->getFfzEmotes()->emotes());
|
||||||
auto seventvGlobalEmotes = filterEmoteMap(
|
auto seventvGlobalEmotes = filterEmoteMap(
|
||||||
searchText, getApp()->twitch->getSeventvEmotes().globalEmotes());
|
searchText, getIApp()->getSeventvEmotes()->globalEmotes());
|
||||||
|
|
||||||
// twitch
|
// twitch
|
||||||
addTwitchEmoteSets(twitchGlobalEmotes, *searchChannel, *searchChannel,
|
addTwitchEmoteSets(twitchGlobalEmotes, *searchChannel, *searchChannel,
|
||||||
|
|
|
@ -49,9 +49,27 @@ public:
|
||||||
return &this->emotes;
|
return &this->emotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BttvEmotes *getBttvEmotes() override
|
||||||
|
{
|
||||||
|
return &this->bttvEmotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
FfzEmotes *getFfzEmotes() override
|
||||||
|
{
|
||||||
|
return &this->ffzEmotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
SeventvEmotes *getSeventvEmotes() override
|
||||||
|
{
|
||||||
|
return &this->seventvEmotes;
|
||||||
|
}
|
||||||
|
|
||||||
AccountController accounts;
|
AccountController accounts;
|
||||||
mock::MockTwitchIrcServer twitch;
|
mock::MockTwitchIrcServer twitch;
|
||||||
Emotes emotes;
|
Emotes emotes;
|
||||||
|
BttvEmotes bttvEmotes;
|
||||||
|
FfzEmotes ffzEmotes;
|
||||||
|
SeventvEmotes seventvEmotes;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -154,18 +172,18 @@ private:
|
||||||
addEmote(*bttvEmotes, ":-)");
|
addEmote(*bttvEmotes, ":-)");
|
||||||
addEmote(*bttvEmotes, "B-)");
|
addEmote(*bttvEmotes, "B-)");
|
||||||
addEmote(*bttvEmotes, "Clap");
|
addEmote(*bttvEmotes, "Clap");
|
||||||
this->mockApplication->twitch.bttv.setEmotes(std::move(bttvEmotes));
|
this->mockApplication->bttvEmotes.setEmotes(std::move(bttvEmotes));
|
||||||
|
|
||||||
auto ffzEmotes = std::make_shared<EmoteMap>();
|
auto ffzEmotes = std::make_shared<EmoteMap>();
|
||||||
addEmote(*ffzEmotes, "LilZ");
|
addEmote(*ffzEmotes, "LilZ");
|
||||||
addEmote(*ffzEmotes, "ManChicken");
|
addEmote(*ffzEmotes, "ManChicken");
|
||||||
addEmote(*ffzEmotes, "CatBag");
|
addEmote(*ffzEmotes, "CatBag");
|
||||||
this->mockApplication->twitch.ffz.setEmotes(std::move(ffzEmotes));
|
this->mockApplication->ffzEmotes.setEmotes(std::move(ffzEmotes));
|
||||||
|
|
||||||
auto seventvEmotes = std::make_shared<EmoteMap>();
|
auto seventvEmotes = std::make_shared<EmoteMap>();
|
||||||
addEmote(*seventvEmotes, "Clap");
|
addEmote(*seventvEmotes, "Clap");
|
||||||
addEmote(*seventvEmotes, "Clap2");
|
addEmote(*seventvEmotes, "Clap2");
|
||||||
this->mockApplication->twitch.seventv.setGlobalEmotes(
|
this->mockApplication->seventvEmotes.setGlobalEmotes(
|
||||||
std::move(seventvEmotes));
|
std::move(seventvEmotes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,21 @@ public:
|
||||||
return &this->highlights;
|
return &this->highlights;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BttvEmotes *getBttvEmotes() override
|
||||||
|
{
|
||||||
|
return &this->bttvEmotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
FfzEmotes *getFfzEmotes() override
|
||||||
|
{
|
||||||
|
return &this->ffzEmotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
SeventvEmotes *getSeventvEmotes() override
|
||||||
|
{
|
||||||
|
return &this->seventvEmotes;
|
||||||
|
}
|
||||||
|
|
||||||
AccountController accounts;
|
AccountController accounts;
|
||||||
Emotes emotes;
|
Emotes emotes;
|
||||||
mock::UserDataController userData;
|
mock::UserDataController userData;
|
||||||
|
@ -78,6 +93,9 @@ public:
|
||||||
FfzBadges ffzBadges;
|
FfzBadges ffzBadges;
|
||||||
SeventvBadges seventvBadges;
|
SeventvBadges seventvBadges;
|
||||||
HighlightController highlights;
|
HighlightController highlights;
|
||||||
|
BttvEmotes bttvEmotes;
|
||||||
|
FfzEmotes ffzEmotes;
|
||||||
|
SeventvEmotes seventvEmotes;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in a new issue