Correct "Emote Link" for BTTV Global and Channel emotes

This commit is contained in:
Rasmus Karlsson 2019-12-31 21:21:53 +01:00
parent 845c8fa638
commit f02988b657

View file

@ -13,6 +13,9 @@
namespace chatterino { namespace chatterino {
namespace { namespace {
QString emoteLinkFormat("https://betterttv.com/emotes/%1");
Url getEmoteLink(QString urlTemplate, const EmoteId &id, Url getEmoteLink(QString urlTemplate, const EmoteId &id,
const QString &emoteScale) const QString &emoteScale)
{ {
@ -47,13 +50,14 @@ namespace {
auto name = auto name =
EmoteName{jsonEmote.toObject().value("code").toString()}; EmoteName{jsonEmote.toObject().value("code").toString()};
auto emote = Emote( auto emote = Emote({
{name, name,
ImageSet{Image::fromUrl(getEmoteLinkV3(id, "1x"), 1), ImageSet{Image::fromUrl(getEmoteLinkV3(id, "1x"), 1),
Image::fromUrl(getEmoteLinkV3(id, "2x"), 0.5), Image::fromUrl(getEmoteLinkV3(id, "2x"), 0.5),
Image::fromUrl(getEmoteLinkV3(id, "3x"), 0.25)}, Image::fromUrl(getEmoteLinkV3(id, "3x"), 0.25)},
Tooltip{name.string + "<br />Global BetterTTV Emote"}, Tooltip{name.string + "<br />Global BetterTTV Emote"},
Url{"https://manage.betterttv.net/emotes/" + id.string}}); Url{emoteLinkFormat.arg(id.string)},
});
emotes[name] = emotes[name] =
cachedOrMakeEmotePtr(std::move(emote), currentEmotes); cachedOrMakeEmotePtr(std::move(emote), currentEmotes);
@ -75,15 +79,16 @@ namespace {
auto name = EmoteName{jsonEmote.value("code").toString()}; auto name = EmoteName{jsonEmote.value("code").toString()};
// emoteObject.value("imageType").toString(); // emoteObject.value("imageType").toString();
auto emote = Emote( auto emote = Emote({
{name, name,
ImageSet{ ImageSet{
Image::fromUrl(getEmoteLinkV3(id, "1x"), 1), Image::fromUrl(getEmoteLinkV3(id, "1x"), 1),
Image::fromUrl(getEmoteLinkV3(id, "2x"), 0.5), Image::fromUrl(getEmoteLinkV3(id, "2x"), 0.5),
Image::fromUrl(getEmoteLinkV3(id, "3x"), 0.25), Image::fromUrl(getEmoteLinkV3(id, "3x"), 0.25),
}, },
Tooltip{name.string + "<br />Channel BetterTTV Emote"}, Tooltip{name.string + "<br />Channel BetterTTV Emote"},
Url{"https://manage.betterttv.net/emotes/" + id.string}}); Url{emoteLinkFormat.arg(id.string)},
});
emotes[name] = cachedOrMake(std::move(emote), id); emotes[name] = cachedOrMake(std::move(emote), id);
} }