Show faved stickers in StickersListWidget.

This commit is contained in:
John Preston 2017-08-02 18:19:11 +03:00
parent 667eb288d7
commit 134bc13169
24 changed files with 30 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 777 B

After

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

After

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 546 B

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 968 B

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

After

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 B

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 817 B

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 546 B

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -103,7 +103,7 @@ stickersRowDuration: 200;
stickersSettings: icon {{ "emoji_settings", emojiIconFg }};
stickersTrending: icon {{ "emoji_trending", emojiIconFg }};
stickersTrendingActive: icon {{ "emoji_trending", emojiIconFgActive }};
stickersFaved: icon {{ "emoji_faved", emojiIconFg }};
stickersSettingsUnreadSize: 17px;
stickersSettingsUnreadPosition: point(4px, 5px);
@ -137,7 +137,7 @@ emojiCategory: IconButton {
width: 42px;
height: 46px;
iconPosition: point(11px, 12px);
iconPosition: point(10px, 11px);
}
emojiCategoryRecent: IconButton(emojiCategory) { icon: emojiRecent; }
emojiCategoryPeople: IconButton(emojiCategory) { icon: emojiPeople; }

View File

@ -208,13 +208,15 @@ void StickersListWidget::Footer::paintEvent(QPaintEvent *e) {
p.drawPixmapLeft(x + (st::emojiCategory.width - icon.pixw) / 2, _iconsTop + (st::emojiCategory.height - icon.pixh) / 2, width(), pix);
} else {
auto getSpecialSetIcon = [](uint64 setId, bool active) {
auto getSpecialSetIcon = [](uint64 setId) {
if (setId == Stickers::FeaturedSetId) {
return active ? &st::stickersTrendingActive : &st::stickersTrending;
return &st::stickersTrending;
} else if (setId == Stickers::FavedSetId) {
return &st::stickersFaved;
}
return active ? &st::emojiRecentActive : &st::emojiRecent;
return &st::emojiRecent;
};
getSpecialSetIcon(icon.setId, false)->paint(p, x + st::emojiCategory.iconPosition.x(), _iconsTop + st::emojiCategory.iconPosition.y(), width());
getSpecialSetIcon(icon.setId)->paint(p, x + st::emojiCategory.iconPosition.x(), _iconsTop + st::emojiCategory.iconPosition.y(), width());
if (icon.setId == Stickers::FeaturedSetId) {
paintFeaturedStickerSetsBadge(p, x);
}
@ -1189,27 +1191,29 @@ void StickersListWidget::fillIcons(QList<StickerIcon> &icons) {
icons.push_back(StickerIcon(Stickers::FeaturedSetId));
}
if (!_mySets.isEmpty()) {
int i = 0;
if (_mySets[0].id == Stickers::RecentSetId) {
++i;
icons.push_back(StickerIcon(Stickers::RecentSetId));
}
for (int l = _mySets.size(); i < l; ++i) {
auto s = _mySets[i].pack[0];
int32 availw = st::emojiCategory.width - 2 * st::stickerIconPadding, availh = st::emojiCategory.height - 2 * st::stickerIconPadding;
int32 thumbw = s->thumb->width(), thumbh = s->thumb->height(), pixw = 1, pixh = 1;
if (availw * thumbh > availh * thumbw) {
pixh = availh;
pixw = (pixh * thumbw) / thumbh;
} else {
pixw = availw;
pixh = thumbw ? ((pixw * thumbh) / thumbw) : 1;
}
if (pixw < 1) pixw = 1;
if (pixh < 1) pixh = 1;
icons.push_back(StickerIcon(_mySets[i].id, s, pixw, pixh));
auto i = 0;
if (i != _mySets.size() && _mySets[i].id == Stickers::RecentSetId) {
++i;
icons.push_back(StickerIcon(Stickers::RecentSetId));
}
if (i != _mySets.size() && _mySets[i].id == Stickers::FavedSetId) {
++i;
icons.push_back(StickerIcon(Stickers::FavedSetId));
}
for (auto l = _mySets.size(); i != l; ++i) {
auto s = _mySets[i].pack[0];
auto availw = st::emojiCategory.width - 2 * st::stickerIconPadding, availh = st::emojiCategory.height - 2 * st::stickerIconPadding;
auto thumbw = s->thumb->width(), thumbh = s->thumb->height(), pixw = 1, pixh = 1;
if (availw * thumbh > availh * thumbw) {
pixh = availh;
pixw = (pixh * thumbw) / thumbh;
} else {
pixw = availw;
pixh = thumbw ? ((pixw * thumbh) / thumbw) : 1;
}
if (pixw < 1) pixw = 1;
if (pixh < 1) pixh = 1;
icons.push_back(StickerIcon(_mySets[i].id, s, pixw, pixh));
}
if (!Global::FeaturedStickerSetsUnreadCount() && !_featuredSets.isEmpty()) {