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

Use emoji/stickers/gifs slider in EmojiPan.

Also rename EmojiTabs to EmojiSections.
This commit is contained in:
John Preston
2017-03-28 15:30:38 +03:00
parent 3d846fcd49
commit 1540f6f528
23 changed files with 1466 additions and 1424 deletions

View File

@@ -386,38 +386,40 @@ void StickersBox::switchTab() {
newTab = &_archived;
requestArchivedSets();
}
if (_tab != newTab) {
if (_tab == &_installed) {
_localOrder = _tab->widget()->getFullOrder();
_localRemoved = _tab->widget()->getRemovedSets();
}
auto wasCache = grabContentCache();
auto wasIndex = _tab->index();
_tab->saveScrollTop();
auto widget = takeInnerWidget<Inner>();
widget->setParent(this);
widget->hide();
_tab->returnWidget(std::move(widget));
_tab = newTab;
_section = newSection;
setInnerWidget(_tab->takeWidget(), getTopSkip());
_tabs->raise();
_unreadBadge->raise();
_tab->widget()->show();
rebuildList();
onScrollToY(_tab->getScrollTop());
auto nowCache = grabContentCache();
auto nowIndex = _tab->index();
_slideAnimation = std::make_unique<Ui::SlideAnimation>();
_slideAnimation->setSnapshots(std::move(wasCache), std::move(nowCache));
auto slideLeft = wasIndex > nowIndex;
_slideAnimation->start(slideLeft, [this] { update(); }, st::slideDuration);
setInnerVisible(false);
setFocus();
update();
if (_tab == newTab) {
return;
}
if (_tab == &_installed) {
_localOrder = _tab->widget()->getFullOrder();
_localRemoved = _tab->widget()->getRemovedSets();
}
auto wasCache = grabContentCache();
auto wasIndex = _tab->index();
_tab->saveScrollTop();
auto widget = takeInnerWidget<Inner>();
widget->setParent(this);
widget->hide();
_tab->returnWidget(std::move(widget));
_tab = newTab;
_section = newSection;
setInnerWidget(_tab->takeWidget(), getTopSkip());
_tabs->raise();
_unreadBadge->raise();
_tab->widget()->show();
rebuildList();
onScrollToY(_tab->getScrollTop());
auto nowCache = grabContentCache();
auto nowIndex = _tab->index();
_slideAnimation = std::make_unique<Ui::SlideAnimation>();
_slideAnimation->setSnapshots(std::move(wasCache), std::move(nowCache));
auto slideLeft = wasIndex > nowIndex;
_slideAnimation->start(slideLeft, [this] { update(); }, st::slideDuration);
setInnerVisible(false);
setFocus();
update();
}
QPixmap StickersBox::grabContentCache() {