mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
refactor: make Application::emotes private (#5109)
This commit is contained in:
parent
36931fac62
commit
97702e0a1f
|
@ -128,11 +128,7 @@ public:
|
||||||
private:
|
private:
|
||||||
Theme *const themes{};
|
Theme *const themes{};
|
||||||
Fonts *const fonts{};
|
Fonts *const fonts{};
|
||||||
|
|
||||||
public:
|
|
||||||
Emotes *const emotes{};
|
Emotes *const emotes{};
|
||||||
|
|
||||||
private:
|
|
||||||
AccountController *const accounts{};
|
AccountController *const accounts{};
|
||||||
HotkeyController *const hotkeys{};
|
HotkeyController *const hotkeys{};
|
||||||
WindowManager *const windows{};
|
WindowManager *const windows{};
|
||||||
|
|
|
@ -476,7 +476,8 @@ CommandModel *CommandController::createModel(QObject *parent)
|
||||||
QString CommandController::execCommand(const QString &textNoEmoji,
|
QString CommandController::execCommand(const QString &textNoEmoji,
|
||||||
ChannelPtr channel, bool dryRun)
|
ChannelPtr channel, bool dryRun)
|
||||||
{
|
{
|
||||||
QString text = getApp()->emotes->emojis.replaceShortCodes(textNoEmoji);
|
QString text =
|
||||||
|
getIApp()->getEmotes()->getEmojis()->replaceShortCodes(textNoEmoji);
|
||||||
QStringList words = text.split(' ', Qt::SkipEmptyParts);
|
QStringList words = text.split(' ', Qt::SkipEmptyParts);
|
||||||
|
|
||||||
if (words.length() == 0)
|
if (words.length() == 0)
|
||||||
|
@ -491,7 +492,7 @@ QString CommandController::execCommand(const QString &textNoEmoji,
|
||||||
const auto it = this->userCommands_.find(commandName);
|
const auto it = this->userCommands_.find(commandName);
|
||||||
if (it != this->userCommands_.end())
|
if (it != this->userCommands_.end())
|
||||||
{
|
{
|
||||||
text = getApp()->emotes->emojis.replaceShortCodes(
|
text = getIApp()->getEmotes()->getEmojis()->replaceShortCodes(
|
||||||
this->execCustomCommand(words, it.value(), dryRun, channel));
|
this->execCustomCommand(words, it.value(), dryRun, channel));
|
||||||
|
|
||||||
words = text.split(' ', Qt::SkipEmptyParts);
|
words = text.split(' ', Qt::SkipEmptyParts);
|
||||||
|
|
|
@ -137,7 +137,7 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
|
||||||
}
|
}
|
||||||
} // bttv/ffz emote
|
} // bttv/ffz emote
|
||||||
{ // emoji/text
|
{ // emoji/text
|
||||||
for (auto &variant : app->emotes->emojis.parse(words[i]))
|
for (auto &variant : app->getEmotes()->getEmojis()->parse(words[i]))
|
||||||
{
|
{
|
||||||
constexpr const static struct {
|
constexpr const static struct {
|
||||||
void operator()(EmotePtr emote, MessageBuilder &b) const
|
void operator()(EmotePtr emote, MessageBuilder &b) const
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace detail {
|
||||||
DebugCount::increase("animated images");
|
DebugCount::increase("animated images");
|
||||||
|
|
||||||
this->gifTimerConnection_ =
|
this->gifTimerConnection_ =
|
||||||
getApp()->emotes->gifTimer.signal.connect([this] {
|
getIApp()->getEmotes()->getGIFTimer().signal.connect([this] {
|
||||||
this->advance();
|
this->advance();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -814,7 +814,7 @@ void MessageBuilder::addIrcWord(const QString &text, const QColor &color,
|
||||||
bool addSpace)
|
bool addSpace)
|
||||||
{
|
{
|
||||||
this->textColor_ = color;
|
this->textColor_ = color;
|
||||||
for (auto &variant : getApp()->emotes->emojis.parse(text))
|
for (auto &variant : getIApp()->getEmotes()->getEmojis()->parse(text))
|
||||||
{
|
{
|
||||||
boost::apply_visitor(
|
boost::apply_visitor(
|
||||||
[&](auto &&arg) {
|
[&](auto &&arg) {
|
||||||
|
|
|
@ -685,7 +685,8 @@ void SingleLineTextElement::addToContainer(MessageLayoutContainer &container,
|
||||||
currentText += ' ';
|
currentText += ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &parsedWord : app->emotes->emojis.parse(word.text))
|
for (const auto &parsedWord :
|
||||||
|
app->getEmotes()->getEmojis()->parse(word.text))
|
||||||
{
|
{
|
||||||
if (parsedWord.type() == typeid(QString))
|
if (parsedWord.type() == typeid(QString))
|
||||||
{
|
{
|
||||||
|
|
|
@ -325,8 +325,10 @@ void TwitchAccount::loadUserstateEmotes(std::weak_ptr<Channel> weakChannel)
|
||||||
|
|
||||||
emoteSet->emotes.push_back(TwitchEmote{id, code});
|
emoteSet->emotes.push_back(TwitchEmote{id, code});
|
||||||
|
|
||||||
auto emote =
|
auto emote = getIApp()
|
||||||
getApp()->emotes->twitch.getOrCreateEmote(id, code);
|
->getEmotes()
|
||||||
|
->getTwitchEmotes()
|
||||||
|
->getOrCreateEmote(id, code);
|
||||||
|
|
||||||
// Follower emotes can be only used in their origin channel
|
// Follower emotes can be only used in their origin channel
|
||||||
// unless the user is subscribed, then they can be used anywhere.
|
// unless the user is subscribed, then they can be used anywhere.
|
||||||
|
|
|
@ -576,7 +576,8 @@ void TwitchChannel::roomIdChanged()
|
||||||
QString TwitchChannel::prepareMessage(const QString &message) const
|
QString TwitchChannel::prepareMessage(const QString &message) const
|
||||||
{
|
{
|
||||||
auto *app = getApp();
|
auto *app = getApp();
|
||||||
QString parsedMessage = app->emotes->emojis.replaceShortCodes(message);
|
QString parsedMessage =
|
||||||
|
app->getEmotes()->getEmojis()->replaceShortCodes(message);
|
||||||
|
|
||||||
parsedMessage = parsedMessage.simplified();
|
parsedMessage = parsedMessage.simplified();
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,8 @@ void addTwitchEmoteSets(
|
||||||
{
|
{
|
||||||
builder
|
builder
|
||||||
.emplace<EmoteElement>(
|
.emplace<EmoteElement>(
|
||||||
getApp()->emotes->twitch.getOrCreateEmote(emote.id,
|
getIApp()->getEmotes()->getTwitchEmotes()->getOrCreateEmote(
|
||||||
emote.name),
|
emote.id, emote.name),
|
||||||
MessageElementFlags{MessageElementFlag::AlwaysShow,
|
MessageElementFlags{MessageElementFlag::AlwaysShow,
|
||||||
MessageElementFlag::TwitchEmote})
|
MessageElementFlag::TwitchEmote})
|
||||||
->setLink(Link(Link::InsertText, emote.name.string));
|
->setLink(Link(Link::InsertText, emote.name.string));
|
||||||
|
|
Loading…
Reference in a new issue