mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show all .webp as stickers.
Allow opening stickers not from stickerpacks in media viewer.
This commit is contained in:
parent
dcebefe2bb
commit
8ec60e0321
3 changed files with 16 additions and 6 deletions
|
@ -168,3 +168,12 @@ TimeId DateFromMessage(const MTPmessage &message) {
|
||||||
return message.vdate().v;
|
return message.vdate().v;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GoodStickerDimensions(int width, int height) {
|
||||||
|
// Show all .webp (except very large ones) as stickers,
|
||||||
|
// allow to open them in media viewer to see details.
|
||||||
|
constexpr auto kLargetsStickerSide = 2560;
|
||||||
|
return (width > 0)
|
||||||
|
&& (height > 0)
|
||||||
|
&& (width * height <= kLargetsStickerSide * kLargetsStickerSide);
|
||||||
|
}
|
||||||
|
|
|
@ -325,12 +325,7 @@ enum DocumentType {
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr auto kStickerSideSize = 512;
|
inline constexpr auto kStickerSideSize = 512;
|
||||||
|
[[nodiscard]] bool GoodStickerDimensions(int width, int height);
|
||||||
[[nodiscard]] inline bool GoodStickerDimensions(int width, int height) {
|
|
||||||
return (width > 0 && width <= kStickerSideSize)
|
|
||||||
&& (height > 0 && height <= kStickerSideSize)
|
|
||||||
&& (width == kStickerSideSize || height == kStickerSideSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
using MediaKey = QPair<uint64, uint64>;
|
using MediaKey = QPair<uint64, uint64>;
|
||||||
|
|
||||||
|
|
|
@ -273,6 +273,12 @@ void Sticker::refreshLink() {
|
||||||
_link = std::make_shared<LambdaClickHandler>([document = _data] {
|
_link = std::make_shared<LambdaClickHandler>([document = _data] {
|
||||||
StickerSetBox::Show(App::wnd()->sessionController(), document);
|
StickerSetBox::Show(App::wnd()->sessionController(), document);
|
||||||
});
|
});
|
||||||
|
} else if (sticker
|
||||||
|
&& !_parent->data()->isSending()
|
||||||
|
&& !_parent->data()->hasFailed()) {
|
||||||
|
_link = std::make_shared<DocumentOpenClickHandler>(
|
||||||
|
_data,
|
||||||
|
_parent->data()->fullId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue