diff --git a/CHANGELOG.md b/CHANGELOG.md index 75096b5d9..948ed0eb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unversioned +- Bugfix: Added missing Copy/Open link context menu entries to emotes in Emote Picker. (#2670) - Bugfix: Fixed visual glitch with smooth scrolling. (#2084) ## 2.3.0 diff --git a/src/widgets/dialogs/EmotePopup.cpp b/src/widgets/dialogs/EmotePopup.cpp index 812bbadb1..90bb80c60 100644 --- a/src/widgets/dialogs/EmotePopup.cpp +++ b/src/widgets/dialogs/EmotePopup.cpp @@ -27,35 +27,36 @@ namespace { builder->flags.set(MessageFlag::Centered); return builder.release(); } - auto makeEmoteMessage(const EmoteMap &map) + auto makeEmoteMessage(const EmoteMap &map, + const MessageElementFlag &emoteFlag) { MessageBuilder builder; builder->flags.set(MessageFlag::Centered); builder->flags.set(MessageFlag::DisableCompactEmotes); - if (!map.empty()) - { - std::vector> vec(map.begin(), - map.end()); - std::sort(vec.begin(), vec.end(), - [](const std::pair &l, - const std::pair &r) { - return CompletionModel::compareStrings( - l.first.string, r.first.string); - }); - for (const auto &emote : vec) - { - builder - .emplace(emote.second, - MessageElementFlag::AlwaysShow) - ->setLink(Link(Link::InsertText, emote.first.string)); - } - } - else + if (map.empty()) { builder.emplace("no emotes available", MessageElementFlag::Text, MessageColor::System); + return builder.release(); + } + + std::vector> vec(map.begin(), map.end()); + std::sort(vec.begin(), vec.end(), + [](const std::pair &l, + const std::pair &r) { + return CompletionModel::compareStrings(l.first.string, + r.first.string); + }); + for (const auto &emote : vec) + { + builder + .emplace( + emote.second, + MessageElementFlags{MessageElementFlag::AlwaysShow, + emoteFlag}) + ->setLink(Link(Link::InsertText, emote.first.string)); } return builder.release(); @@ -92,7 +93,8 @@ namespace { .emplace( getApp()->emotes->twitch.getOrCreateEmote(emote.id, emote.name), - MessageElementFlag::AlwaysShow) + MessageElementFlags{MessageElementFlag::AlwaysShow, + MessageElementFlag::TwitchEmote}) ->setLink(Link(Link::InsertText, emote.name.string)); } @@ -206,9 +208,10 @@ void EmotePopup::loadChannel(ChannelPtr _channel) return; auto addEmotes = [&](Channel &channel, const EmoteMap &map, - const QString &title) { + const QString &title, + const MessageElementFlag &emoteFlag) { channel.addMessage(makeTitleMessage(title)); - channel.addMessage(makeEmoteMessage(map)); + channel.addMessage(makeEmoteMessage(map, emoteFlag)); }; auto subChannel = std::make_shared("", Channel::Type::None); @@ -222,13 +225,15 @@ void EmotePopup::loadChannel(ChannelPtr _channel) // global addEmotes(*globalChannel, *twitchChannel->globalBttv().emotes(), - "BetterTTV"); + "BetterTTV", MessageElementFlag::BttvEmote); addEmotes(*globalChannel, *twitchChannel->globalFfz().emotes(), - "FrankerFaceZ"); + "FrankerFaceZ", MessageElementFlag::FfzEmote); // channel - addEmotes(*channelChannel, *twitchChannel->bttvEmotes(), "BetterTTV"); - addEmotes(*channelChannel, *twitchChannel->ffzEmotes(), "FrankerFaceZ"); + addEmotes(*channelChannel, *twitchChannel->bttvEmotes(), "BetterTTV", + MessageElementFlag::BttvEmote); + addEmotes(*channelChannel, *twitchChannel->ffzEmotes(), "FrankerFaceZ", + MessageElementFlag::FfzEmote); this->globalEmotesView_->setChannel(globalChannel); this->subEmotesView_->setChannel(subChannel); @@ -259,7 +264,10 @@ void EmotePopup::loadEmojis() emojis.each([&builder](const auto &key, const auto &value) { builder - .emplace(value->emote, MessageElementFlag::AlwaysShow) + .emplace( + value->emote, + MessageElementFlags{MessageElementFlag::AlwaysShow, + MessageElementFlag::EmojiAll}) ->setLink( Link(Link::Type::InsertText, ":" + value->shortCodes[0] + ":")); });