Improve child list closing.

This commit is contained in:
John Preston 2022-12-06 14:12:43 +04:00
parent 6bd2be0aee
commit a1de77e8d2
3 changed files with 10 additions and 4 deletions

View File

@ -2102,6 +2102,7 @@ void InnerWidget::refreshShownList() {
: session().data().chatsList(_openedFolder)->indexed();
if (_shownList != list) {
_shownList = list;
_shownList->updateHeights(_narrowRatio);
}
}

View File

@ -787,6 +787,7 @@ void Widget::changeOpenedSubsection(
oldContentCache = grabForFolderSlideAnimation();
}
_showAnimation = nullptr;
destroyChildListCanvas();
change();
refreshTopBars();
updateControlsVisibility(true);
@ -807,6 +808,11 @@ void Widget::changeOpenedSubsection(
}
}
void Widget::destroyChildListCanvas() {
_childListShown = 0.;
_hideChildListCanvas = nullptr;
}
void Widget::changeOpenedFolder(Data::Folder *folder, anim::type animated) {
if (_openedFolder == folder) {
return;
@ -1987,8 +1993,7 @@ void Widget::openChildList(
const auto animated = !_childList
&& (params.animated == anim::type::normal);
if (animated) {
_childListShown = 0.;
_hideChildListCanvas = nullptr;
destroyChildListCanvas();
slide.oldContentCache = Ui::GrabWidget(
this,
QRect(_narrowWidth, 0, width() - _narrowWidth, height()));
@ -2086,8 +2091,7 @@ void Widget::closeChildList(anim::type animated) {
_hideChildListCanvas->update();
});
animation->setFinishedCallback([=] {
_childListShown = 0.;
_hideChildListCanvas = nullptr;
destroyChildListCanvas();
});
animation->setPixmaps(oldContentCache, newContentCache);
animation->start();

View File

@ -182,6 +182,7 @@ private:
void changeOpenedFolder(Data::Folder *folder, anim::type animated);
void changeOpenedForum(Data::Forum *forum, anim::type animated);
void hideChildList();
void destroyChildListCanvas();
[[nodiscard]] QPixmap grabForFolderSlideAnimation();
void startSlideAnimation(
QPixmap oldContentCache,