2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Support thumb_document_id in emoji sets.

This commit is contained in:
John Preston
2022-07-13 18:05:29 +03:00
parent 64f25a6dae
commit a821c3c31d
9 changed files with 49 additions and 15 deletions

View File

@@ -1159,6 +1159,7 @@ void EmojiListWidget::refreshCustom() {
return true;
}();
if (valid) {
i->thumbnailDocument = it->second->lookupThumbnailDocument();
_custom.push_back(std::move(*i));
continue;
}
@@ -1198,6 +1199,7 @@ void EmojiListWidget::refreshCustom() {
_custom.push_back({
.id = setId,
.set = it->second.get(),
.thumbnailDocument = it->second->lookupThumbnailDocument(),
.title = it->second->title,
.list = std::move(set),
});
@@ -1223,7 +1225,7 @@ std::vector<StickerIcon> EmojiListWidget::fillIcons() {
}
for (const auto &custom : _custom) {
const auto set = custom.set;
const auto s = custom.list[0].document;
const auto s = custom.thumbnailDocument;
const auto availw = st::stickerIconWidth - 2 * st::stickerIconPadding;
const auto availh = st::emojiFooterHeight - 2 * st::stickerIconPadding;
const auto size = set->hasThumbnail()

View File

@@ -110,6 +110,7 @@ private:
struct CustomSet {
uint64 id = 0;
not_null<Data::StickersSet*> set;
DocumentData *thumbnailDocument = nullptr;
QString title;
std::vector<CustomOne> list;
std::unique_ptr<Ui::RippleAnimation> ripple;

View File

@@ -99,6 +99,7 @@ struct StickersListWidget::Set {
uint64 id = 0;
Data::StickersSet *set = nullptr;
DocumentData *thumbnailDocument = nullptr;
Data::StickersSetFlags flags;
QString title;
QString shortName;
@@ -2087,6 +2088,7 @@ bool StickersListWidget::appendSet(
set->count,
externalLayout,
std::move(elements));
to.back().thumbnailDocument = set->lookupThumbnailDocument();
if (!externalLayout && _premiumsIndex >= 0 && session().premium()) {
for (const auto &sticker : to.back().stickers) {
const auto document = sticker.document;
@@ -2380,7 +2382,7 @@ std::vector<StickerIcon> StickersListWidget::fillIcons() {
}
const auto set = _mySets[i].set;
Assert(set != nullptr);
const auto s = _mySets[i].stickers[0].document;
const auto s = _mySets[i].thumbnailDocument;
const auto availw = st::stickerIconWidth - 2 * st::stickerIconPadding;
const auto availh = st::emojiFooterHeight - 2 * st::stickerIconPadding;
const auto size = set->hasThumbnail()