refactor: merge emote element flags (#6511)

This commit is contained in:
nerix
2025-09-30 19:07:25 +02:00
committed by GitHub
parent f6a820cff0
commit 3f05edc071
35 changed files with 131 additions and 174 deletions
+1
View File
@@ -13,6 +13,7 @@
- Dev: Fix the WinGet release workflow. (#6497) - Dev: Fix the WinGet release workflow. (#6497)
- Dev: Correct handling of eventsubs without any account. (#6503) - Dev: Correct handling of eventsubs without any account. (#6503)
- Dev: Removed dependency to Qt5 Compatibility module by updating libcommuni. (#6500) - Dev: Removed dependency to Qt5 Compatibility module by updating libcommuni. (#6500)
- Dev: Merged emote element flags from different providers into two. (#6511)
## 2.5.4 ## 2.5.4
+3 -14
View File
@@ -376,22 +376,11 @@ c2.MessageElementFlag = {
Text = 0, Text = 0,
Username = 0, Username = 0,
Timestamp = 0, Timestamp = 0,
TwitchEmoteImage = 0, EmoteImage = 0,
TwitchEmoteText = 0, EmoteText = 0,
TwitchEmote = 0, Emote = 0,
BttvEmoteImage = 0,
BttvEmoteText = 0,
BttvEmote = 0,
ChannelPointReward = 0, ChannelPointReward = 0,
ChannelPointRewardImage = 0, ChannelPointRewardImage = 0,
FfzEmoteImage = 0,
FfzEmoteText = 0,
FfzEmote = 0,
SevenTVEmoteImage = 0,
SevenTVEmoteText = 0,
SevenTVEmote = 0,
EmoteImages = 0,
EmoteText = 0,
BitsStatic = 0, BitsStatic = 0,
BitsAnimated = 0, BitsAnimated = 0,
BadgeSharedChannel = 0, BadgeSharedChannel = 0,
@@ -116,25 +116,21 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
auto it = accemotes->find({words[i]}); auto it = accemotes->find({words[i]});
if (it != accemotes->end()) if (it != accemotes->end())
{ {
b.emplace<EmoteElement>(it->second, b.emplace<EmoteElement>(it->second, MessageElementFlag::Emote);
MessageElementFlag::TwitchEmote);
continue; continue;
} }
} // Twitch emote } // Twitch emote
{ // bttv/ffz emote { // bttv/ffz emote
if ((emote = bttvemotes->emote({words[i]}))) emote = bttvemotes->emote({words[i]});
if (!emote)
{ {
flags = MessageElementFlag::BttvEmote; emote = ffzemotes->emote({words[i]});
}
else if ((emote = ffzemotes->emote({words[i]})))
{
flags = MessageElementFlag::FfzEmote;
} }
// TODO: Load 7tv global emotes // TODO: Load 7tv global emotes
if (emote) if (emote)
{ {
b.emplace<EmoteElement>(*emote, flags); b.emplace<EmoteElement>(*emote, MessageElementFlag::Emote);
continue; continue;
} }
} // bttv/ffz emote } // bttv/ffz emote
+20 -17
View File
@@ -416,8 +416,7 @@ EmotePtr makeSharedChatBadge(const QString &sourceName,
}); });
} }
std::tuple<std::optional<EmotePtr>, MessageElementFlags> parseEmote( EmotePtr parseEmote(TwitchChannel *twitchChannel, const EmoteName &name)
TwitchChannel *twitchChannel, const EmoteName &name)
{ {
// Emote order: // Emote order:
// - FrankerFaceZ Channel // - FrankerFaceZ Channel
@@ -440,19 +439,19 @@ std::tuple<std::optional<EmotePtr>, MessageElementFlags> parseEmote(
emote = twitchChannel->ffzEmote(name); emote = twitchChannel->ffzEmote(name);
if (emote) if (emote)
{ {
return {emote, MessageElementFlag::FfzEmote}; return *emote;
} }
emote = twitchChannel->bttvEmote(name); emote = twitchChannel->bttvEmote(name);
if (emote) if (emote)
{ {
return {emote, MessageElementFlag::BttvEmote}; return *emote;
} }
emote = twitchChannel->seventvEmote(name); emote = twitchChannel->seventvEmote(name);
if (emote) if (emote)
{ {
return {emote, MessageElementFlag::SevenTVEmote}; return *emote;
} }
} }
@@ -461,22 +460,22 @@ std::tuple<std::optional<EmotePtr>, MessageElementFlags> parseEmote(
emote = globalFfzEmotes->emote(name); emote = globalFfzEmotes->emote(name);
if (emote) if (emote)
{ {
return {emote, MessageElementFlag::FfzEmote}; return *emote;
} }
emote = globalBttvEmotes->emote(name); emote = globalBttvEmotes->emote(name);
if (emote) if (emote)
{ {
return {emote, MessageElementFlag::BttvEmote}; return *emote;
} }
emote = globalSeventvEmotes->globalEmote(name); emote = globalSeventvEmotes->globalEmote(name);
if (emote) if (emote)
{ {
return {emote, MessageElementFlag::SevenTVEmote}; return *emote;
} }
return {{}, {}}; return {};
} }
} // namespace } // namespace
@@ -2211,14 +2210,14 @@ void MessageBuilder::appendUsername(const QVariantMap &tags,
Outcome MessageBuilder::tryAppendEmote(TwitchChannel *twitchChannel, Outcome MessageBuilder::tryAppendEmote(TwitchChannel *twitchChannel,
const EmoteName &name) const EmoteName &name)
{ {
auto [emote, flags] = parseEmote(twitchChannel, name); auto emote = parseEmote(twitchChannel, name);
if (!emote) if (!emote)
{ {
return Failure; return Failure;
} }
if ((*emote)->zeroWidth && getSettings()->enableZeroWidthEmotes && if (emote->zeroWidth && getSettings()->enableZeroWidthEmotes &&
!this->isEmpty()) !this->isEmpty())
{ {
// Attempt to merge current zero-width emote into any previous emotes // Attempt to merge current zero-width emote into any previous emotes
@@ -2231,9 +2230,12 @@ Outcome MessageBuilder::tryAppendEmote(TwitchChannel *twitchChannel,
auto baseEmoteElement = this->releaseBack(); auto baseEmoteElement = this->releaseBack();
std::vector<LayeredEmoteElement::Emote> layers = { std::vector<LayeredEmoteElement::Emote> layers = {
{baseEmote, baseEmoteElement->getFlags()}, {*emote, flags}}; {baseEmote, baseEmoteElement->getFlags()},
{emote, MessageElementFlag::Emote},
};
this->emplace<LayeredEmoteElement>( this->emplace<LayeredEmoteElement>(
std::move(layers), baseEmoteElement->getFlags() | flags, std::move(layers),
baseEmoteElement->getFlags() | MessageElementFlag::Emote,
this->textColor_); this->textColor_);
return Success; return Success;
} }
@@ -2241,15 +2243,16 @@ Outcome MessageBuilder::tryAppendEmote(TwitchChannel *twitchChannel,
auto *asLayered = dynamic_cast<LayeredEmoteElement *>(&this->back()); auto *asLayered = dynamic_cast<LayeredEmoteElement *>(&this->back());
if (asLayered) if (asLayered)
{ {
asLayered->addEmoteLayer({*emote, flags}); asLayered->addEmoteLayer({emote, MessageElementFlag::Emote});
asLayered->addFlags(flags); asLayered->addFlags(MessageElementFlag::Emote);
return Success; return Success;
} }
// No emote to merge with, just show as regular emote // No emote to merge with, just show as regular emote
} }
this->emplace<EmoteElement>(*emote, flags, this->textColor_); this->emplace<EmoteElement>(emote, MessageElementFlag::Emote,
this->textColor_);
return Success; return Success;
} }
@@ -2278,7 +2281,7 @@ void MessageBuilder::addWords(
{ {
// This emote exists right at the start of the word! // This emote exists right at the start of the word!
this->emplace<EmoteElement>(currentTwitchEmote.ptr, this->emplace<EmoteElement>(currentTwitchEmote.ptr,
MessageElementFlag::TwitchEmote, MessageElementFlag::Emote,
this->textColor_); this->textColor_);
auto len = currentTwitchEmote.name.string.length(); auto len = currentTwitchEmote.name.string.length();
+2 -2
View File
@@ -200,7 +200,7 @@ void EmoteElement::addToContainer(MessageLayoutContainer &container,
return; return;
} }
if (ctx.flags.has(MessageElementFlag::EmoteImages)) if (ctx.flags.has(MessageElementFlag::EmoteImage))
{ {
auto image = auto image =
this->emote_->images.getImageOrLoaded(container.getImageScale()); this->emote_->images.getImageOrLoaded(container.getImageScale());
@@ -286,7 +286,7 @@ void LayeredEmoteElement::addToContainer(MessageLayoutContainer &container,
{ {
if (ctx.flags.hasAny(this->getFlags())) if (ctx.flags.hasAny(this->getFlags()))
{ {
if (ctx.flags.has(MessageElementFlag::EmoteImages)) if (ctx.flags.has(MessageElementFlag::EmoteImage))
{ {
auto images = this->getLoadedImages(container.getImageScale()); auto images = this->getLoadedImages(container.getImageScale());
if (images.empty()) if (images.empty())
+10 -23
View File
@@ -40,29 +40,18 @@ enum class MessageElementFlag : int64_t {
Username = (1LL << 2), Username = (1LL << 2),
Timestamp = (1LL << 3), Timestamp = (1LL << 3),
TwitchEmoteImage = (1LL << 4), EmoteImage = (1LL << 4),
TwitchEmoteText = (1LL << 5), EmoteText = (1LL << 5),
TwitchEmote = TwitchEmoteImage | TwitchEmoteText, Emote = EmoteImage | EmoteText,
BttvEmoteImage = (1LL << 6), // unused: (1LL << 6),
BttvEmoteText = (1LL << 7), // unused: (1LL << 7),
BttvEmote = BttvEmoteImage | BttvEmoteText,
ChannelPointReward = (1LL << 8), ChannelPointReward = (1LL << 8),
ChannelPointRewardImage = ChannelPointReward | TwitchEmoteImage, ChannelPointRewardImage = ChannelPointReward | EmoteImage,
FfzEmoteImage = (1LL << 9), // unused: (1LL << 9),
FfzEmoteText = (1LL << 10), // unused: (1LL << 10),
FfzEmote = FfzEmoteImage | FfzEmoteText,
SevenTVEmoteImage = (1LL << 34),
SevenTVEmoteText = (1LL << 35),
SevenTVEmote = SevenTVEmoteImage | SevenTVEmoteText,
EmoteImages =
TwitchEmoteImage | BttvEmoteImage | FfzEmoteImage | SevenTVEmoteImage,
EmoteText =
TwitchEmoteText | BttvEmoteText | FfzEmoteText | SevenTVEmoteText,
BitsStatic = (1LL << 11), BitsStatic = (1LL << 11),
BitsAnimated = (1LL << 12), BitsAnimated = (1LL << 12),
@@ -158,11 +147,9 @@ enum class MessageElementFlag : int64_t {
// for the reply button element // for the reply button element
ReplyButton = (1LL << 33), ReplyButton = (1LL << 33),
// (1LL << 34) through (1LL << 36) are occupied by // (1LL << 36) is occupied by BadgeSevenTV
// SevenTVEmoteImage, SevenTVEmoteText, and BadgeSevenTV,
Default = Timestamp | Badges | Username | BitsStatic | FfzEmoteImage | Default = Timestamp | Badges | Username | BitsStatic | EmoteImage |
BttvEmoteImage | SevenTVEmoteImage | TwitchEmoteImage |
BitsAmount | Text | AlwaysShow, BitsAmount | Text | AlwaysShow,
}; };
using MessageElementFlags = FlagsEnum<MessageElementFlag>; using MessageElementFlags = FlagsEnum<MessageElementFlag>;
@@ -179,7 +179,7 @@ void MessageLayoutContainer::breakLine()
bool isCompactEmote = bool isCompactEmote =
!this->flags_.has(MessageFlag::DisableCompactEmotes) && !this->flags_.has(MessageFlag::DisableCompactEmotes) &&
element->getCreator().getFlags().has( element->getCreator().getFlags().has(
MessageElementFlag::EmoteImages); MessageElementFlag::EmoteImage);
qreal yExtra = 0; qreal yExtra = 0;
if (isCompactEmote) if (isCompactEmote)
@@ -635,7 +635,7 @@ void MessageLayoutContainer::addElement(MessageLayoutElement *element,
} }
// Returns true if the last element was an emote image // Returns true if the last element was an emote image
return lastElement->getFlags().has(MessageElementFlag::EmoteImages); return lastElement->getFlags().has(MessageElementFlag::EmoteImage);
}; };
bool isRTLElement = element->getText().isRightToLeft(); bool isRTLElement = element->getText().isRightToLeft();
@@ -670,7 +670,7 @@ void MessageLayoutContainer::addElement(MessageLayoutElement *element,
// compact emote offset // compact emote offset
bool isCompactEmote = bool isCompactEmote =
!this->flags_.has(MessageFlag::DisableCompactEmotes) && !this->flags_.has(MessageFlag::DisableCompactEmotes) &&
element->getCreator().getFlags().has(MessageElementFlag::EmoteImages); element->getCreator().getFlags().has(MessageElementFlag::EmoteImage);
if (isCompactEmote) if (isCompactEmote)
{ {
@@ -686,13 +686,13 @@ void MessageLayoutContainer::addElement(MessageLayoutElement *element,
if (element->getCreator().getFlags().has( if (element->getCreator().getFlags().has(
MessageElementFlag::ChannelPointReward) && MessageElementFlag::ChannelPointReward) &&
element->getCreator().getFlags().hasNone( element->getCreator().getFlags().hasNone(
{MessageElementFlag::TwitchEmoteImage})) {MessageElementFlag::EmoteImage}))
{ {
yOffset -= (MARGIN.top() * this->scale_); yOffset -= (MARGIN.top() * this->scale_);
} }
if (getSettings()->removeSpacesBetweenEmotes && if (getSettings()->removeSpacesBetweenEmotes &&
element->getFlags().hasAny({MessageElementFlag::EmoteImages}) && element->getFlags().hasAny({MessageElementFlag::EmoteImage}) &&
shouldRemoveSpaceBetweenEmotes()) shouldRemoveSpaceBetweenEmotes())
{ {
// Move cursor one 'space width' to the left (right in case of RTL) to combine hug the previous emote // Move cursor one 'space width' to the left (right in case of RTL) to combine hug the previous emote
+1 -1
View File
@@ -209,7 +209,7 @@ void WindowManager::updateWordTypeMask()
// emotes // emotes
if (settings->enableEmoteImages) if (settings->enableEmoteImages)
{ {
flags.set(MEF::EmoteImages); flags.set(MEF::EmoteImage);
} }
flags.set(MEF::EmoteText); flags.set(MEF::EmoteText);
flags.set(MEF::EmojiText); flags.set(MEF::EmojiText);
+26 -39
View File
@@ -44,8 +44,7 @@ auto makeTitleMessage(const QString &title)
return builder.release(); return builder.release();
} }
auto makeEmoteMessage(std::vector<EmotePtr> emotes, auto makeEmoteMessage(std::vector<EmotePtr> emotes)
const MessageElementFlag &emoteFlag)
{ {
MessageBuilder builder; MessageBuilder builder;
builder->flags.set(MessageFlag::Centered); builder->flags.set(MessageFlag::Centered);
@@ -66,15 +65,15 @@ auto makeEmoteMessage(std::vector<EmotePtr> emotes,
{ {
builder builder
.emplace<EmoteElement>( .emplace<EmoteElement>(
emote, emote, MessageElementFlags{MessageElementFlag::AlwaysShow,
MessageElementFlags{MessageElementFlag::AlwaysShow, emoteFlag}) MessageElementFlag::Emote})
->setLink(Link(Link::InsertText, emote->name.string)); ->setLink(Link(Link::InsertText, emote->name.string));
} }
return builder.release(); return builder.release();
} }
auto makeEmoteMessage(const EmoteMap &map, const MessageElementFlag &emoteFlag) auto makeEmoteMessage(const EmoteMap &map)
{ {
if (map.empty()) if (map.empty())
{ {
@@ -93,7 +92,7 @@ auto makeEmoteMessage(const EmoteMap &map, const MessageElementFlag &emoteFlag)
{ {
vec.emplace_back(ptr); vec.emplace_back(ptr);
} }
return makeEmoteMessage(std::move(vec), emoteFlag); return makeEmoteMessage(std::move(vec));
} }
auto makeEmojiMessage(const std::vector<EmojiPtr> &emojiMap) auto makeEmojiMessage(const std::vector<EmojiPtr> &emojiMap)
@@ -116,13 +115,11 @@ auto makeEmojiMessage(const std::vector<EmojiPtr> &emojiMap)
return builder.release(); return builder.release();
} }
void addEmotes(Channel &channel, auto &&emotes, const QString &title, void addEmotes(Channel &channel, auto &&emotes, const QString &title)
const MessageElementFlag &emoteFlag)
{ {
channel.addMessage(makeTitleMessage(title), MessageContext::Original); channel.addMessage(makeTitleMessage(title), MessageContext::Original);
channel.addMessage( channel.addMessage(makeEmoteMessage(std::forward<decltype(emotes)>(emotes)),
makeEmoteMessage(std::forward<decltype(emotes)>(emotes), emoteFlag), MessageContext::Original);
MessageContext::Original);
} }
void addTwitchEmoteSets(const std::shared_ptr<const EmoteMap> &local, void addTwitchEmoteSets(const std::shared_ptr<const EmoteMap> &local,
@@ -133,8 +130,7 @@ void addTwitchEmoteSets(const std::shared_ptr<const EmoteMap> &local,
{ {
if (!local->empty()) if (!local->empty())
{ {
addEmotes(subChannel, *local, channelName % u" (Follower)", addEmotes(subChannel, *local, channelName % u" (Follower)");
MessageElementFlag::TwitchEmote);
} }
std::vector< std::vector<
@@ -146,8 +142,7 @@ void addTwitchEmoteSets(const std::shared_ptr<const EmoteMap> &local,
if (set.owner->id == currentChannelID) if (set.owner->id == currentChannelID)
{ {
// Put current channel emotes at the top // Put current channel emotes at the top
addEmotes(subChannel, set.emotes, set.title(), addEmotes(subChannel, set.emotes, set.title());
MessageElementFlag::TwitchEmote);
} }
else else
{ {
@@ -162,7 +157,7 @@ void addTwitchEmoteSets(const std::shared_ptr<const EmoteMap> &local,
for (const auto &[title, set] : sortedSets) for (const auto &[title, set] : sortedSets)
{ {
addEmotes(set.get().isSubLike ? subChannel : globalChannel, addEmotes(set.get().isSubLike ? subChannel : globalChannel,
set.get().emotes, title, MessageElementFlag::TwitchEmote); set.get().emotes, title);
} }
} }
@@ -269,7 +264,7 @@ EmotePopup::EmotePopup(QWidget *parent)
view->setOverrideFlags(MessageElementFlags{ view->setOverrideFlags(MessageElementFlags{
MessageElementFlag::Default, MessageElementFlag::AlwaysShow, MessageElementFlag::Default, MessageElementFlag::AlwaysShow,
MessageElementFlag::EmoteImages}); MessageElementFlag::EmoteImage});
view->setEnableScrollingToBottom(false); view->setEnableScrollingToBottom(false);
// We can safely ignore this signal connection since the ChannelView is deleted // We can safely ignore this signal connection since the ChannelView is deleted
// either when the notebook is deleted, or when our main layout is deleted. // either when the notebook is deleted, or when our main layout is deleted.
@@ -457,34 +452,34 @@ void EmotePopup::reloadEmotes()
if (Settings::instance().enableBTTVChannelEmotes) if (Settings::instance().enableBTTVChannelEmotes)
{ {
addEmotes(*channelChannel, *this->twitchChannel_->bttvEmotes(), addEmotes(*channelChannel, *this->twitchChannel_->bttvEmotes(),
"BetterTTV", MessageElementFlag::BttvEmote); "BetterTTV");
} }
if (Settings::instance().enableFFZChannelEmotes) if (Settings::instance().enableFFZChannelEmotes)
{ {
addEmotes(*channelChannel, *this->twitchChannel_->ffzEmotes(), addEmotes(*channelChannel, *this->twitchChannel_->ffzEmotes(),
"FrankerFaceZ", MessageElementFlag::FfzEmote); "FrankerFaceZ");
} }
if (Settings::instance().enableSevenTVChannelEmotes) if (Settings::instance().enableSevenTVChannelEmotes)
{ {
addEmotes(*channelChannel, *this->twitchChannel_->seventvEmotes(), addEmotes(*channelChannel, *this->twitchChannel_->seventvEmotes(),
"7TV", MessageElementFlag::SevenTVEmote); "7TV");
} }
} }
// global // global
if (Settings::instance().enableBTTVGlobalEmotes) if (Settings::instance().enableBTTVGlobalEmotes)
{ {
addEmotes(*globalChannel, *getApp()->getBttvEmotes()->emotes(), addEmotes(*globalChannel, *getApp()->getBttvEmotes()->emotes(),
"BetterTTV", MessageElementFlag::BttvEmote); "BetterTTV");
} }
if (Settings::instance().enableFFZGlobalEmotes) if (Settings::instance().enableFFZGlobalEmotes)
{ {
addEmotes(*globalChannel, *getApp()->getFfzEmotes()->emotes(), addEmotes(*globalChannel, *getApp()->getFfzEmotes()->emotes(),
"FrankerFaceZ", MessageElementFlag::FfzEmote); "FrankerFaceZ");
} }
if (Settings::instance().enableSevenTVGlobalEmotes) if (Settings::instance().enableSevenTVGlobalEmotes)
{ {
addEmotes(*globalChannel, *getApp()->getSeventvEmotes()->globalEmotes(), addEmotes(*globalChannel, *getApp()->getSeventvEmotes()->globalEmotes(),
"7TV", MessageElementFlag::SevenTVEmote); "7TV");
} }
if (subChannel->getMessageSnapshot().size() == 0) if (subChannel->getMessageSnapshot().size() == 0)
@@ -524,8 +519,7 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
if (!local.empty()) if (!local.empty())
{ {
addEmotes(*searchChannel, local, addEmotes(*searchChannel, local,
this->twitchChannel_->getName() % u" (Follower)", this->twitchChannel_->getName() % u" (Follower)");
MessageElementFlag::TwitchEmote);
} }
for (const auto &[_id, set] : for (const auto &[_id, set] :
@@ -534,8 +528,7 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
auto filtered = filterEmoteVec(searchText, set.emotes); auto filtered = filterEmoteVec(searchText, set.emotes);
if (!filtered.empty()) if (!filtered.empty())
{ {
addEmotes(*searchChannel, std::move(filtered), set.title(), addEmotes(*searchChannel, std::move(filtered), set.title());
MessageElementFlag::TwitchEmote);
} }
} }
} }
@@ -550,18 +543,15 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
// global // global
if (!bttvGlobalEmotes.empty()) if (!bttvGlobalEmotes.empty())
{ {
addEmotes(*searchChannel, bttvGlobalEmotes, "BetterTTV (Global)", addEmotes(*searchChannel, bttvGlobalEmotes, "BetterTTV (Global)");
MessageElementFlag::BttvEmote);
} }
if (!ffzGlobalEmotes.empty()) if (!ffzGlobalEmotes.empty())
{ {
addEmotes(*searchChannel, ffzGlobalEmotes, "FrankerFaceZ (Global)", addEmotes(*searchChannel, ffzGlobalEmotes, "FrankerFaceZ (Global)");
MessageElementFlag::FfzEmote);
} }
if (!seventvGlobalEmotes.empty()) if (!seventvGlobalEmotes.empty())
{ {
addEmotes(*searchChannel, seventvGlobalEmotes, "7TV (Global)", addEmotes(*searchChannel, seventvGlobalEmotes, "7TV (Global)");
MessageElementFlag::SevenTVEmote);
} }
if (this->twitchChannel_ == nullptr) if (this->twitchChannel_ == nullptr)
@@ -579,18 +569,15 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
// channel // channel
if (!bttvChannelEmotes.empty()) if (!bttvChannelEmotes.empty())
{ {
addEmotes(*searchChannel, bttvChannelEmotes, "BetterTTV (Channel)", addEmotes(*searchChannel, bttvChannelEmotes, "BetterTTV (Channel)");
MessageElementFlag::BttvEmote);
} }
if (!ffzChannelEmotes.empty()) if (!ffzChannelEmotes.empty())
{ {
addEmotes(*searchChannel, ffzChannelEmotes, "FrankerFaceZ (Channel)", addEmotes(*searchChannel, ffzChannelEmotes, "FrankerFaceZ (Channel)");
MessageElementFlag::FfzEmote);
} }
if (!seventvChannelEmotes.empty()) if (!seventvChannelEmotes.empty())
{ {
addEmotes(*searchChannel, seventvChannelEmotes, "7TV (Channel)", addEmotes(*searchChannel, seventvChannelEmotes, "7TV (Channel)");
MessageElementFlag::SevenTVEmote);
} }
} }
+1 -1
View File
@@ -155,7 +155,7 @@ void addImageContextMenuItems(QMenu *menu,
// Emote actions // Emote actions
if (creatorFlags.hasAny( if (creatorFlags.hasAny(
{MessageElementFlag::EmoteImages, MessageElementFlag::EmojiImage})) {MessageElementFlag::EmoteImage, MessageElementFlag::EmojiImage}))
{ {
if (const auto *emoteElement = if (const auto *emoteElement =
dynamic_cast<const EmoteElement *>(&creator)) dynamic_cast<const EmoteElement *>(&creator))
@@ -139,7 +139,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -107,7 +107,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa Tooltip" "tooltip": "Kappa Tooltip"
}, },
"flags": "BttvEmoteImage|BttvEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -107,7 +107,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa Tooltip" "tooltip": "Kappa Tooltip"
}, },
"flags": "BttvEmoteImage|BttvEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -139,7 +139,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -175,7 +175,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
+1 -1
View File
@@ -107,7 +107,7 @@
"name": "Keepo", "name": "Keepo",
"tooltip": "Keepo<br>Twitch Emote" "tooltip": "Keepo<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -107,7 +107,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -126,7 +126,7 @@
"name": "Keepo", "name": "Keepo",
"tooltip": "Keepo<br>Twitch Emote" "tooltip": "Keepo<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -145,7 +145,7 @@
"name": "PogChamp", "name": "PogChamp",
"tooltip": "PogChamp<br>Twitch Emote" "tooltip": "PogChamp<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
+11 -11
View File
@@ -89,7 +89,7 @@
"name": "BTTVEmote", "name": "BTTVEmote",
"tooltip": "BTTVEmote Tooltip" "tooltip": "BTTVEmote Tooltip"
}, },
"flags": "BttvEmoteImage|BttvEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -108,7 +108,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -130,7 +130,7 @@
"name": "7TVEmote", "name": "7TVEmote",
"tooltip": "7TVEmote Tooltip" "tooltip": "7TVEmote Tooltip"
}, },
"flags": "SevenTVEmoteImage|SevenTVEmoteText" "flags": "EmoteImage|EmoteText"
}, },
{ {
"emote": { "emote": {
@@ -145,7 +145,7 @@
"tooltip": "7TVEmote0w Tooltip", "tooltip": "7TVEmote0w Tooltip",
"zeroWidth": true "zeroWidth": true
}, },
"flags": "SevenTVEmoteImage|SevenTVEmoteText" "flags": "EmoteImage|EmoteText"
}, },
{ {
"emote": { "emote": {
@@ -160,10 +160,10 @@
"tooltip": "7TVEmote0w Tooltip", "tooltip": "7TVEmote0w Tooltip",
"zeroWidth": true "zeroWidth": true
}, },
"flags": "SevenTVEmoteImage|SevenTVEmoteText" "flags": "EmoteImage|EmoteText"
} }
], ],
"flags": "SevenTVEmoteImage|SevenTVEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -236,7 +236,7 @@
"name": "PogChamp", "name": "PogChamp",
"tooltip": "PogChamp<br>Twitch Emote" "tooltip": "PogChamp<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -256,7 +256,7 @@
"name": "7TVGlobal", "name": "7TVGlobal",
"tooltip": "7TVGlobal Tooltip" "tooltip": "7TVGlobal Tooltip"
}, },
"flags": "SevenTVEmoteImage|SevenTVEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -275,7 +275,7 @@
"name": "Keepo", "name": "Keepo",
"tooltip": "Keepo<br>Twitch Emote" "tooltip": "Keepo<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -294,7 +294,7 @@
"name": "FFZEmote", "name": "FFZEmote",
"tooltip": "FFZEmote Tooltip" "tooltip": "FFZEmote Tooltip"
}, },
"flags": "FfzEmoteImage|FfzEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -313,7 +313,7 @@
"name": "FFZGlobal", "name": "FFZGlobal",
"tooltip": "FFZGlobal Tooltip" "tooltip": "FFZGlobal Tooltip"
}, },
"flags": "FfzEmoteImage|FfzEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -106,7 +106,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -157,7 +157,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -87,7 +87,7 @@
"name": "f", "name": "f",
"tooltip": "f<br>Twitch Emote" "tooltip": "f<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -87,7 +87,7 @@
"name": "fo", "name": "fo",
"tooltip": "fo<br>Twitch Emote" "tooltip": "fo<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -109,7 +109,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -89,7 +89,7 @@
"name": "PogChamp", "name": "PogChamp",
"tooltip": "PogChamp<br>Twitch Emote" "tooltip": "PogChamp<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -123,7 +123,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -157,7 +157,7 @@
"name": "Keepo", "name": "Keepo",
"tooltip": "Keepo<br>Twitch Emote" "tooltip": "Keepo<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -197,7 +197,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -233,7 +233,7 @@
"name": "MyCoolTwitchEmote", "name": "MyCoolTwitchEmote",
"tooltip": "MyCoolTwitchEmote Tooltip" "tooltip": "MyCoolTwitchEmote Tooltip"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
+2 -2
View File
@@ -114,7 +114,7 @@
"name": "Kreygasm", "name": "Kreygasm",
"tooltip": "Kreygasm<br>Twitch Emote" "tooltip": "Kreygasm<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -148,7 +148,7 @@
"name": "Kreygasm", "name": "Kreygasm",
"tooltip": "Kreygasm<br>Twitch Emote" "tooltip": "Kreygasm<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -87,7 +87,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa Tooltip" "tooltip": "Kappa Tooltip"
}, },
"flags": "BttvEmoteImage|BttvEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -89,7 +89,7 @@
"name": "BTTVGlobal", "name": "BTTVGlobal",
"tooltip": "BTTVGlobal Tooltip" "tooltip": "BTTVGlobal Tooltip"
}, },
"flags": "BttvEmoteImage|BttvEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -123,7 +123,7 @@
"name": ":)", "name": ":)",
"tooltip": ":)<br>Twitch Emote" "tooltip": ":)<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -164,7 +164,7 @@
"name": "Keepo", "name": "Keepo",
"tooltip": "Keepo<br>Twitch Emote" "tooltip": "Keepo<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -183,7 +183,7 @@
"name": "FFZEmote", "name": "FFZEmote",
"tooltip": "FFZEmote Tooltip" "tooltip": "FFZEmote Tooltip"
}, },
"flags": "FfzEmoteImage|FfzEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -105,7 +105,7 @@
] ]
}, },
{ {
"flags": "TwitchEmoteImage|ChannelPointReward", "flags": "EmoteImage|ChannelPointReward",
"image": "https://chatterino.com/reward1x.png", "image": "https://chatterino.com/reward1x.png",
"link": { "link": {
"type": "None", "type": "None",
@@ -85,7 +85,7 @@
] ]
}, },
{ {
"flags": "TwitchEmoteImage|ChannelPointReward", "flags": "EmoteImage|ChannelPointReward",
"image": "https://chatterino.com/reward1x.png", "image": "https://chatterino.com/reward1x.png",
"link": { "link": {
"type": "None", "type": "None",
@@ -71,7 +71,7 @@
] ]
}, },
{ {
"flags": "TwitchEmoteImage|ChannelPointReward", "flags": "EmoteImage|ChannelPointReward",
"image": "https://chatterino.com/reward1x.png", "image": "https://chatterino.com/reward1x.png",
"link": { "link": {
"type": "None", "type": "None",
@@ -90,7 +90,7 @@
"name": "7TVEmote", "name": "7TVEmote",
"tooltip": "7TVEmote Tooltip" "tooltip": "7TVEmote Tooltip"
}, },
"flags": "SevenTVEmoteImage|SevenTVEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -109,7 +109,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -145,7 +145,7 @@
"name": "7TVEmote", "name": "7TVEmote",
"tooltip": "7TVEmote Tooltip" "tooltip": "7TVEmote Tooltip"
}, },
"flags": "SevenTVEmoteImage|SevenTVEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -107,7 +107,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -141,7 +141,7 @@
"name": "BTTVGlobal", "name": "BTTVGlobal",
"tooltip": "BTTVGlobal Tooltip" "tooltip": "BTTVGlobal Tooltip"
}, },
"flags": "BttvEmoteImage|BttvEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -176,7 +176,7 @@
"name": "7TVGlobal", "name": "7TVGlobal",
"tooltip": "7TVGlobal Tooltip" "tooltip": "7TVGlobal Tooltip"
}, },
"flags": "SevenTVEmoteImage|SevenTVEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -210,7 +210,7 @@
"name": "FFZGlobal", "name": "FFZGlobal",
"tooltip": "FFZGlobal Tooltip" "tooltip": "FFZGlobal Tooltip"
}, },
"flags": "FfzEmoteImage|FfzEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -229,7 +229,7 @@
"name": "BTTVTwitchDev", "name": "BTTVTwitchDev",
"tooltip": "BTTVTwitchDev Tooltip" "tooltip": "BTTVTwitchDev Tooltip"
}, },
"flags": "BttvEmoteImage|BttvEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -249,7 +249,7 @@
"name": "7TVTwitchDev", "name": "7TVTwitchDev",
"tooltip": "7TVTwitchDev Tooltip" "tooltip": "7TVTwitchDev Tooltip"
}, },
"flags": "SevenTVEmoteImage|SevenTVEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -268,7 +268,7 @@
"name": "FFZTwitchDev", "name": "FFZTwitchDev",
"tooltip": "FFZTwitchDev Tooltip" "tooltip": "FFZTwitchDev Tooltip"
}, },
"flags": "FfzEmoteImage|FfzEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -109,7 +109,7 @@
"name": "Kappa", "name": "Kappa",
"tooltip": "Kappa<br>Twitch Emote" "tooltip": "Kappa<br>Twitch Emote"
}, },
"flags": "TwitchEmoteImage|TwitchEmoteText", "flags": "EmoteImage|EmoteText",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
@@ -2,7 +2,7 @@
"input": [ "input": [
"msg = {elements={", "msg = {elements={",
" { type = 'linebreak' },", " { type = 'linebreak' },",
" { type = 'linebreak', flags = c2.MessageElementFlag.BttvEmoteImage },", " { type = 'linebreak', flags = c2.MessageElementFlag.EmoteImage },",
" { type = 'linebreak', tooltip = 't' },", " { type = 'linebreak', tooltip = 't' },",
" { type = 'linebreak', trailing_space = false },", " { type = 'linebreak', trailing_space = false },",
"}}" "}}"
@@ -27,7 +27,7 @@
"type": "LinebreakElement" "type": "LinebreakElement"
}, },
{ {
"flags": "BttvEmoteImage", "flags": "EmoteImage",
"link": { "link": {
"type": "None", "type": "None",
"value": "" "value": ""
+2 -2
View File
@@ -78,7 +78,7 @@ std::vector<std::shared_ptr<MessageElement>> makeElements(const QString &text)
.baseName = {}, .baseName = {},
}); });
elements.emplace_back(std::make_shared<EmoteElement>( elements.emplace_back(std::make_shared<EmoteElement>(
emote, MessageElementFlag::TwitchEmote)); emote, MessageElementFlag::Emote));
continue; continue;
} }
@@ -114,7 +114,7 @@ TEST_P(MessageLayoutContainerTest, RtlReordering)
{ {
MessageElementFlag::Text, MessageElementFlag::Text,
MessageElementFlag::Username, MessageElementFlag::Username,
MessageElementFlag::TwitchEmote, MessageElementFlag::Emote,
}, },
.width = 10000, .width = 10000,
.scale = 1.0F, .scale = 1.0F,
+2 -8
View File
@@ -899,27 +899,21 @@ TEST_F(PluginTest, MessageElementFlag)
"BitsAmount=0x200000," "BitsAmount=0x200000,"
"BitsAnimated=0x1000," "BitsAnimated=0x1000,"
"BitsStatic=0x800," "BitsStatic=0x800,"
"BttvEmoteImage=0x40,"
"BttvEmoteText=0x80,"
"ChannelName=0x100000," "ChannelName=0x100000,"
"ChannelPointReward=0x100," "ChannelPointReward=0x100,"
"Collapsed=0x4000000," "Collapsed=0x4000000,"
"EmojiImage=0x800000," "EmojiImage=0x800000,"
"EmojiText=0x1000000," "EmojiText=0x1000000,"
"FfzEmoteImage=0x200," "EmoteImage=0x10,"
"FfzEmoteText=0x400," "EmoteText=0x20,"
"LowercaseLinks=0x20000000," "LowercaseLinks=0x20000000,"
"Mention=0x8000000," "Mention=0x8000000,"
"Misc=0x1," "Misc=0x1,"
"ModeratorTools=0x400000," "ModeratorTools=0x400000,"
"RepliedMessage=0x100000000," "RepliedMessage=0x100000000,"
"ReplyButton=0x200000000," "ReplyButton=0x200000000,"
"SevenTVEmoteImage=0x400000000,"
"SevenTVEmoteText=0x800000000,"
"Text=0x2," "Text=0x2,"
"Timestamp=0x8," "Timestamp=0x8,"
"TwitchEmoteImage=0x10,"
"TwitchEmoteText=0x20,"
"Username=0x4"; "Username=0x4";
std::string got = (*lua)["out"]; std::string got = (*lua)["out"];