mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fix: show correct scale factor of images (#5201)
This commit is contained in:
parent
0f42df78be
commit
4315c43eac
2 changed files with 21 additions and 13 deletions
|
@ -39,6 +39,7 @@
|
|||
- Minor: Updated to Emoji v15.1. Google emojis are now used as the fallback instead of Twitter emojis. (#5182)
|
||||
- Minor: Allow theming of tab live and rerun indicators. (#5188)
|
||||
- Minor: Added a fallback theme field to custom themes that will be used in case the custom theme does not contain a color Chatterino needs. If no fallback theme is specified, we'll pull the color from the included Dark or Light theme. (#5198)
|
||||
- Minor: Image links now reflect the scale of their image instead of an internal label. (#5201)
|
||||
- Bugfix: Fixed an issue where certain emojis did not send to Twitch chat correctly. (#4840)
|
||||
- Bugfix: Fixed capitalized channel names in log inclusion list not being logged. (#4848)
|
||||
- Bugfix: Trimmed custom streamlink paths on all platforms making sure you don't accidentally add spaces at the beginning or end of its path. (#4834)
|
||||
|
|
|
@ -87,24 +87,31 @@ void addEmoteContextMenuItems(QMenu *menu, const Emote &emote,
|
|||
auto *copyMenu = new QMenu(menu);
|
||||
copyAction->setMenu(copyMenu);
|
||||
|
||||
// Add copy and open links for 1x, 2x, 3x
|
||||
auto addImageLink = [&](const ImagePtr &image, char scale) {
|
||||
// Scale of the smallest image
|
||||
std::optional<qreal> baseScale;
|
||||
// Add copy and open links for images
|
||||
auto addImageLink = [&](const ImagePtr &image) {
|
||||
if (!image->isEmpty())
|
||||
{
|
||||
copyMenu->addAction("&" + QString(scale) + "x link",
|
||||
[url = image->url()] {
|
||||
crossPlatformCopy(url.string);
|
||||
});
|
||||
openMenu->addAction("&" + QString(scale) + "x link",
|
||||
[url = image->url()] {
|
||||
QDesktopServices::openUrl(QUrl(url.string));
|
||||
});
|
||||
if (!baseScale)
|
||||
{
|
||||
baseScale = image->scale();
|
||||
}
|
||||
|
||||
auto factor =
|
||||
QString::number(static_cast<int>(*baseScale / image->scale()));
|
||||
copyMenu->addAction("&" + factor + "x link", [url = image->url()] {
|
||||
crossPlatformCopy(url.string);
|
||||
});
|
||||
openMenu->addAction("&" + factor + "x link", [url = image->url()] {
|
||||
QDesktopServices::openUrl(QUrl(url.string));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
addImageLink(emote.images.getImage1(), '1');
|
||||
addImageLink(emote.images.getImage2(), '2');
|
||||
addImageLink(emote.images.getImage3(), '3');
|
||||
addImageLink(emote.images.getImage1());
|
||||
addImageLink(emote.images.getImage2());
|
||||
addImageLink(emote.images.getImage3());
|
||||
|
||||
// Copy and open emote page link
|
||||
auto addPageLink = [&](const QString &name) {
|
||||
|
|
Loading…
Reference in a new issue