Run main menu hide animation on account switch.

This commit is contained in:
John Preston 2020-06-29 16:11:34 +04:00
parent 1757dd856b
commit 5f9dae1b72
3 changed files with 16 additions and 6 deletions

View file

@ -196,7 +196,6 @@ void MainWindow::finishFirstShow() {
} }
void MainWindow::clearWidgetsHook() { void MainWindow::clearWidgetsHook() {
destroyLayer();
_mediaPreview.destroy(); _mediaPreview.destroy();
_main.destroy(); _main.destroy();
_intro.destroy(); _intro.destroy();
@ -284,10 +283,17 @@ void MainWindow::setupIntro(Intro::EnterPoint point) {
void MainWindow::setupMain() { void MainWindow::setupMain() {
Expects(account().sessionExists()); Expects(account().sessionExists());
auto animated = (_intro || _passcodeLock); const auto animated = (_intro || _passcodeLock);
auto bg = animated ? grabInner() : QPixmap(); const auto bg = animated ? grabInner() : QPixmap();
const auto weak = (_main && _layer)
? Ui::MakeWeak(_layer.get())
: nullptr;
if (weak) {
Assert(!animated);
_layer->hideAllAnimatedPrepare();
} else {
destroyLayer(); destroyLayer();
}
auto created = object_ptr<MainWidget>(bodyWidget(), sessionController()); auto created = object_ptr<MainWidget>(bodyWidget(), sessionController());
clearWidgets(); clearWidgets();
_main = std::move(created); _main = std::move(created);
@ -304,6 +310,9 @@ void MainWindow::setupMain() {
Core::App().checkStartUrl(); Core::App().checkStartUrl();
} }
fixOrder(); fixOrder();
if (const auto strong = weak.data()) {
strong->hideAllAnimatedRun();
}
} }
void MainWindow::showSettings() { void MainWindow::showSettings() {

View file

@ -45,6 +45,7 @@ Controller::Controller()
Controller::~Controller() { Controller::~Controller() {
// We want to delete all widgets before the _sessionController. // We want to delete all widgets before the _sessionController.
_widget.ui_hideSettingsAndLayer(anim::type::instant);
_widget.clearWidgets(); _widget.clearWidgets();
} }

@ -1 +1 @@
Subproject commit 2a0d189ee22d8573bd4f9f0971ef1aa27a12f02d Subproject commit d6e7aa6f63febb6f7fd6e0a80a469fb86dc17e6e