changed to 80 max column
This commit is contained in:
@@ -14,13 +14,16 @@ TwitchEmotes::TwitchEmotes()
|
||||
|
||||
// id is used for lookup
|
||||
// emoteName is used for giving a name to the emote in case it doesn't exist
|
||||
EmotePtr TwitchEmotes::getOrCreateEmote(const EmoteId &id, const EmoteName &name_)
|
||||
EmotePtr TwitchEmotes::getOrCreateEmote(const EmoteId &id,
|
||||
const EmoteName &name_)
|
||||
{
|
||||
static QMap<QString, QString> replacements{
|
||||
{"[oO](_|\\.)[oO]", "O_o"}, {"\\>\\;\\(", ">("}, {"\\<\\;3", "<3"},
|
||||
{"\\:-?(o|O)", ":O"}, {"\\:-?(p|P)", ":P"}, {"\\:-?[\\\\/]", ":/"},
|
||||
{"\\:-?[z|Z|\\|]", ":Z"}, {"\\:-?\\(", ":("}, {"\\:-?\\)", ":)"},
|
||||
{"\\:-?D", ":D"}, {"\\;-?(p|P)", ";P"}, {"\\;-?\\)", ";)"},
|
||||
{"[oO](_|\\.)[oO]", "O_o"}, {"\\>\\;\\(", ">("},
|
||||
{"\\<\\;3", "<3"}, {"\\:-?(o|O)", ":O"},
|
||||
{"\\:-?(p|P)", ":P"}, {"\\:-?[\\\\/]", ":/"},
|
||||
{"\\:-?[z|Z|\\|]", ":Z"}, {"\\:-?\\(", ":("},
|
||||
{"\\:-?\\)", ":)"}, {"\\:-?D", ":D"},
|
||||
{"\\;-?(p|P)", ";P"}, {"\\;-?\\)", ";)"},
|
||||
{"R-?\\)", "R)"}, {"B-?\\)", "B)"},
|
||||
};
|
||||
|
||||
@@ -42,14 +45,14 @@ EmotePtr TwitchEmotes::getOrCreateEmote(const EmoteId &id, const EmoteName &name
|
||||
auto shared = (*cache)[id].lock();
|
||||
|
||||
if (!shared) {
|
||||
(*cache)[id] = shared =
|
||||
std::make_shared<Emote>(Emote{EmoteName{name},
|
||||
ImageSet{
|
||||
Image::fromUrl(getEmoteLink(id, "1.0"), 1),
|
||||
Image::fromUrl(getEmoteLink(id, "2.0"), 0.5),
|
||||
Image::fromUrl(getEmoteLink(id, "3.0"), 0.25),
|
||||
},
|
||||
Tooltip{name}, Url{}});
|
||||
(*cache)[id] = shared = std::make_shared<Emote>(
|
||||
Emote{EmoteName{name},
|
||||
ImageSet{
|
||||
Image::fromUrl(getEmoteLink(id, "1.0"), 1),
|
||||
Image::fromUrl(getEmoteLink(id, "2.0"), 0.5),
|
||||
Image::fromUrl(getEmoteLink(id, "3.0"), 0.25),
|
||||
},
|
||||
Tooltip{name}, Url{}});
|
||||
}
|
||||
|
||||
return shared;
|
||||
@@ -57,8 +60,9 @@ EmotePtr TwitchEmotes::getOrCreateEmote(const EmoteId &id, const EmoteName &name
|
||||
|
||||
Url TwitchEmotes::getEmoteLink(const EmoteId &id, const QString &emoteScale)
|
||||
{
|
||||
return {
|
||||
QString(TWITCH_EMOTE_TEMPLATE).replace("{id}", id.string).replace("{scale}", emoteScale)};
|
||||
return {QString(TWITCH_EMOTE_TEMPLATE)
|
||||
.replace("{id}", id.string)
|
||||
.replace("{scale}", emoteScale)};
|
||||
}
|
||||
|
||||
AccessGuard<std::unordered_map<EmoteName, EmotePtr>> TwitchEmotes::accessAll()
|
||||
|
||||
Reference in New Issue
Block a user