mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
parent
355b80680d
commit
24471fc2d0
1 changed files with 6 additions and 4 deletions
|
@ -25,6 +25,7 @@ QString getEmoteLink(const QString &id, const QString &emoteScale)
|
||||||
|
|
||||||
QString cleanUpCode(const QString &dirtyEmoteCode)
|
QString cleanUpCode(const QString &dirtyEmoteCode)
|
||||||
{
|
{
|
||||||
|
QString cleanCode = dirtyEmoteCode;
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static QMap<QString, QString> emoteNameReplacements{
|
static QMap<QString, QString> emoteNameReplacements{
|
||||||
{"[oO](_|\\.)[oO]", "O_o"}, {"\\>\\;\\(", ">("}, {"\\<\\;3", "<3"},
|
{"[oO](_|\\.)[oO]", "O_o"}, {"\\>\\;\\(", ">("}, {"\\<\\;3", "<3"},
|
||||||
|
@ -37,10 +38,13 @@ QString cleanUpCode(const QString &dirtyEmoteCode)
|
||||||
|
|
||||||
auto it = emoteNameReplacements.find(dirtyEmoteCode);
|
auto it = emoteNameReplacements.find(dirtyEmoteCode);
|
||||||
if (it != emoteNameReplacements.end()) {
|
if (it != emoteNameReplacements.end()) {
|
||||||
return it.value();
|
cleanCode = it.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
return dirtyEmoteCode;
|
cleanCode.replace("<", "<");
|
||||||
|
cleanCode.replace(">", ">");
|
||||||
|
|
||||||
|
return cleanCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadSetData(std::shared_ptr<TwitchEmotes::EmoteSet> emoteSet)
|
void loadSetData(std::shared_ptr<TwitchEmotes::EmoteSet> emoteSet)
|
||||||
|
@ -121,8 +125,6 @@ util::EmoteData TwitchEmotes::getEmoteById(const QString &id, const QString &emo
|
||||||
return _twitchEmoteFromCache.getOrAdd(id, [&emoteName, &_emoteName, &id] {
|
return _twitchEmoteFromCache.getOrAdd(id, [&emoteName, &_emoteName, &id] {
|
||||||
util::EmoteData newEmoteData;
|
util::EmoteData newEmoteData;
|
||||||
auto cleanCode = cleanUpCode(emoteName);
|
auto cleanCode = cleanUpCode(emoteName);
|
||||||
cleanCode.replace("<", "<");
|
|
||||||
cleanCode.replace(">", ">");
|
|
||||||
newEmoteData.image1x = new messages::Image(getEmoteLink(id, "1.0"), 1, emoteName,
|
newEmoteData.image1x = new messages::Image(getEmoteLink(id, "1.0"), 1, emoteName,
|
||||||
_emoteName + "<br/>Twitch Emote 1x");
|
_emoteName + "<br/>Twitch Emote 1x");
|
||||||
newEmoteData.image1x->setCopyString(cleanCode);
|
newEmoteData.image1x->setCopyString(cleanCode);
|
||||||
|
|
Loading…
Reference in a new issue