@@ -78,8 +78,7 @@ using namespace chatterino;
78
78
79
79
constexpr int SCROLLBAR_PADDING = 8 ;
80
80
81
- void addEmoteContextMenuItems (QMenu *menu, const Emote &emote,
82
- MessageElementFlags creatorFlags)
81
+ void addEmoteContextMenuItems (QMenu *menu, const Emote &emote, QStringView kind)
83
82
{
84
83
auto *openAction = menu->addAction (" &Open" );
85
84
auto *openMenu = new QMenu (menu);
@@ -116,31 +115,19 @@ void addEmoteContextMenuItems(QMenu *menu, const Emote &emote,
116
115
addImageLink (emote.images .getImage3 ());
117
116
118
117
// Copy and open emote page link
119
- auto addPageLink = [&](const QString &name) {
118
+ if (!emote.homePage .string .isEmpty ())
119
+ {
120
120
copyMenu->addSeparator ();
121
121
openMenu->addSeparator ();
122
122
123
- copyMenu->addAction (" Copy " + name + " &emote link" ,
123
+ copyMenu->addAction (u " Copy & " % kind % u" link" ,
124
124
[url = emote.homePage ] {
125
125
crossPlatformCopy (url.string );
126
126
});
127
- openMenu->addAction (" Open " + name + " &emote link" ,
127
+ openMenu->addAction (u " Open & " % kind % u" link" ,
128
128
[url = emote.homePage ] {
129
129
QDesktopServices::openUrl (QUrl (url.string ));
130
130
});
131
- };
132
-
133
- if (creatorFlags.has (MessageElementFlag::BttvEmote))
134
- {
135
- addPageLink (" BTTV" );
136
- }
137
- else if (creatorFlags.has (MessageElementFlag::FfzEmote))
138
- {
139
- addPageLink (" FFZ" );
140
- }
141
- else if (creatorFlags.has (MessageElementFlag::SevenTVEmote))
142
- {
143
- addPageLink (" 7TV" );
144
131
}
145
132
}
146
133
@@ -161,8 +148,7 @@ void addImageContextMenuItems(QMenu *menu,
161
148
if (const auto *badgeElement =
162
149
dynamic_cast <const BadgeElement *>(&creator))
163
150
{
164
- addEmoteContextMenuItems (menu, *badgeElement->getEmote (),
165
- creatorFlags);
151
+ addEmoteContextMenuItems (menu, *badgeElement->getEmote (), u" badge" );
166
152
}
167
153
}
168
154
@@ -173,8 +159,7 @@ void addImageContextMenuItems(QMenu *menu,
173
159
if (const auto *emoteElement =
174
160
dynamic_cast <const EmoteElement *>(&creator))
175
161
{
176
- addEmoteContextMenuItems (menu, *emoteElement->getEmote (),
177
- creatorFlags);
162
+ addEmoteContextMenuItems (menu, *emoteElement->getEmote (), u" emote" );
178
163
}
179
164
else if (const auto *layeredElement =
180
165
dynamic_cast <const LayeredEmoteElement *>(&creator))
@@ -185,7 +170,7 @@ void addImageContextMenuItems(QMenu *menu,
185
170
auto *emoteAction = menu->addAction (emote.ptr ->name .string );
186
171
auto *emoteMenu = new QMenu (menu);
187
172
emoteAction->setMenu (emoteMenu);
188
- addEmoteContextMenuItems (emoteMenu, *emote.ptr , emote. flags );
173
+ addEmoteContextMenuItems (emoteMenu, *emote.ptr , u" emote" );
189
174
}
190
175
}
191
176
}
0 commit comments