Compare commits

...

4 commits

Author SHA1 Message Date
Rasmus Karlsson
1acbb78f33
Merge remote-tracking branch 'origin/master' into fix/conversion-warnings 2024-10-27 13:14:49 +01:00
Rasmus Karlsson
6d6541d0b5
nit: remove old comment 2024-10-27 13:14:41 +01:00
nerix
74a385dfee
fix: escape 7TV emote names (#5677) 2024-10-27 12:56:37 +01:00
pajlada
f66bc37368
fix: use static version of 7tv badges (#5674) 2024-10-24 10:26:20 +02:00
5 changed files with 38 additions and 14 deletions

View file

@ -54,6 +54,7 @@
- Bugfix: Fixed event emotes not showing up in autocomplete and popups. (#5239, #5580, #5582, #5632) - Bugfix: Fixed event emotes not showing up in autocomplete and popups. (#5239, #5580, #5582, #5632)
- Bugfix: Fixed tab visibility being controllable in the emote popup. (#5530) - Bugfix: Fixed tab visibility being controllable in the emote popup. (#5530)
- Bugfix: Fixed account switch not being saved if no other settings were changed. (#5558) - Bugfix: Fixed account switch not being saved if no other settings were changed. (#5558)
- Bugfix: Fixed 7TV badges being inadvertently animated. (#5674)
- Bugfix: Fixed some tooltips not being readable. (#5578) - Bugfix: Fixed some tooltips not being readable. (#5578)
- Bugfix: Fixed log files being locked longer than needed. (#5592) - Bugfix: Fixed log files being locked longer than needed. (#5592)
- Bugfix: Fixed global badges not showing in anonymous mode. (#5599) - Bugfix: Fixed global badges not showing in anonymous mode. (#5599)
@ -61,6 +62,7 @@
- Bugfix: Fixed incorrect message being disabled in some cases upon approving or denying an automod caught message. (#5611) - Bugfix: Fixed incorrect message being disabled in some cases upon approving or denying an automod caught message. (#5611)
- Bugfix: Fixed double-click selection not working when clicking outside a message. (#5617) - Bugfix: Fixed double-click selection not working when clicking outside a message. (#5617)
- Bugfix: Fixed emotes starting with ":" not tab-completing. (#5603) - Bugfix: Fixed emotes starting with ":" not tab-completing. (#5603)
- Bugfix: Fixed 7TV emotes messing with Qt's HTML. (#5677)
- Dev: Update Windows build from Qt 6.5.0 to Qt 6.7.1. (#5420) - Dev: Update Windows build from Qt 6.5.0 to Qt 6.7.1. (#5420)
- Dev: Update vcpkg build Qt from 6.5.0 to 6.7.0, boost from 1.83.0 to 1.85.0, openssl from 3.1.3 to 3.3.0. (#5422) - Dev: Update vcpkg build Qt from 6.5.0 to 6.7.0, boost from 1.83.0 to 1.85.0, openssl from 3.1.3 to 3.3.0. (#5422)
- Dev: Unsingletonize `ISoundController`. (#5462) - Dev: Unsingletonize `ISoundController`. (#5462)

View file

@ -59,7 +59,7 @@ void SeventvBadges::registerBadge(const QJsonObject &badgeJson)
auto emote = Emote{ auto emote = Emote{
.name = EmoteName{}, .name = EmoteName{},
.images = SeventvEmotes::createImageSet(badgeJson), .images = SeventvEmotes::createImageSet(badgeJson, true),
.tooltip = Tooltip{badgeJson["tooltip"].toString()}, .tooltip = Tooltip{badgeJson["tooltip"].toString()},
.homePage = Url{}, .homePage = Url{},
.id = EmoteId{badgeID}, .id = EmoteId{badgeID},

View file

@ -79,7 +79,8 @@ bool isZeroWidthRecommended(const QJsonObject &emoteData)
Tooltip createTooltip(const QString &name, const QString &author, bool isGlobal) Tooltip createTooltip(const QString &name, const QString &author, bool isGlobal)
{ {
return Tooltip{QString("%1<br>%2 7TV Emote<br>By: %3") return Tooltip{QString("%1<br>%2 7TV Emote<br>By: %3")
.arg(name, isGlobal ? "Global" : "Channel", .arg(name.toHtmlEscaped(),
isGlobal ? "Global" : "Channel",
author.isEmpty() ? "<deleted>" : author)}; author.isEmpty() ? "<deleted>" : author)};
} }
@ -87,7 +88,8 @@ Tooltip createAliasedTooltip(const QString &name, const QString &baseName,
const QString &author, bool isGlobal) const QString &author, bool isGlobal)
{ {
return Tooltip{QString("%1<br>Alias of %2<br>%3 7TV Emote<br>By: %4") return Tooltip{QString("%1<br>Alias of %2<br>%3 7TV Emote<br>By: %4")
.arg(name, baseName, isGlobal ? "Global" : "Channel", .arg(name.toHtmlEscaped(), baseName.toHtmlEscaped(),
isGlobal ? "Global" : "Channel",
author.isEmpty() ? "<deleted>" : author)}; author.isEmpty() ? "<deleted>" : author)};
} }
@ -106,12 +108,18 @@ CreateEmoteResult createEmote(const QJsonObject &activeEmote,
? createAliasedTooltip(emoteName.string, baseEmoteName.string, ? createAliasedTooltip(emoteName.string, baseEmoteName.string,
author.string, isGlobal) author.string, isGlobal)
: createTooltip(emoteName.string, author.string, isGlobal); : createTooltip(emoteName.string, author.string, isGlobal);
auto imageSet = SeventvEmotes::createImageSet(emoteData); auto imageSet = SeventvEmotes::createImageSet(emoteData, false);
auto emote = auto emote = Emote({
Emote({emoteName, imageSet, tooltip, emoteName,
Url{EMOTE_LINK_FORMAT.arg(emoteId.string)}, zeroWidth, emoteId, imageSet,
author, makeConditionedOptional(aliasedName, baseEmoteName)}); tooltip,
Url{EMOTE_LINK_FORMAT.arg(emoteId.string)},
zeroWidth,
emoteId,
author,
makeConditionedOptional(aliasedName, baseEmoteName),
});
return {emote, emoteId, emoteName, !emote.images.getImage1()->isEmpty()}; return {emote, emoteId, emoteName, !emote.images.getImage1()->isEmpty()};
} }
@ -427,7 +435,8 @@ void SeventvEmotes::getEmoteSet(
}); });
} }
ImageSet SeventvEmotes::createImageSet(const QJsonObject &emoteData) ImageSet SeventvEmotes::createImageSet(const QJsonObject &emoteData,
bool useStatic)
{ {
auto host = emoteData["host"].toObject(); auto host = emoteData["host"].toObject();
// "//cdn.7tv[...]" // "//cdn.7tv[...]"
@ -463,9 +472,21 @@ ImageSet SeventvEmotes::createImageSet(const QJsonObject &emoteData)
baseWidth = width; baseWidth = width;
} }
auto image = Image::fromUrl( auto name = [&] {
{QString("https:%1/%2").arg(baseUrl, file["name"].toString())}, if (useStatic)
scale, {static_cast<int>(width), file["height"].toInt(16)}); {
auto staticName = file["static_name"].toString();
if (!staticName.isEmpty())
{
return staticName;
}
}
return file["name"].toString();
}();
auto image =
Image::fromUrl({QString("https:%1/%2").arg(baseUrl, name)}, scale,
{static_cast<int>(width), file["height"].toInt(16)});
sizes.at(nextSize) = image; sizes.at(nextSize) = image;
nextSize++; nextSize++;

View file

@ -153,8 +153,10 @@ public:
* Creates an image set from a 7TV emote or badge. * Creates an image set from a 7TV emote or badge.
* *
* @param emoteData { host: { files: [], url } } * @param emoteData { host: { files: [], url } }
* @param useStatic use static version if possible
*/ */
static ImageSet createImageSet(const QJsonObject &emoteData); static ImageSet createImageSet(const QJsonObject &emoteData,
bool useStatic);
private: private:
Atomic<std::shared_ptr<const EmoteMap>> global_; Atomic<std::shared_ptr<const EmoteMap>> global_;

View file

@ -241,7 +241,6 @@ LimitedQueueSnapshot<MessagePtr> SearchPopup::buildSnapshot()
const LimitedQueueSnapshot<MessagePtr> &snapshot = const LimitedQueueSnapshot<MessagePtr> &snapshot =
sharedView.channel()->getMessageSnapshot(); sharedView.channel()->getMessageSnapshot();
// TODO: implement iterator on LimitedQueueSnapshot?
for (const auto &message : snapshot) for (const auto &message : snapshot)
{ {
if (filterSet && !filterSet->filter(message, sharedView.channel())) if (filterSet && !filterSet->filter(message, sharedView.channel()))