2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Use Window::SlideAnimation in all widgets.

This commit is contained in:
John Preston
2022-12-01 14:14:35 +04:00
parent eed706f917
commit b561705528
14 changed files with 217 additions and 302 deletions

View File

@@ -103,10 +103,11 @@ void Controller::showAccount(
_sessionController = session
? std::make_unique<SessionController>(session, this)
: nullptr;
setupSideBar();
auto oldContentCache = _widget.grabForSlideAnimation();
_widget.updateWindowIcon();
if (session) {
setupMain(singlePeerShowAtMsgId);
setupSideBar();
setupMain(singlePeerShowAtMsgId, std::move(oldContentCache));
session->updates().isIdleValue(
) | rpl::filter([=](bool idle) {
@@ -125,7 +126,8 @@ void Controller::showAccount(
session->updates().updateOnline(crl::now());
} else {
setupIntro();
sideBarChanged();
setupIntro(std::move(oldContentCache));
_widget.updateGlobalMenu();
}
@@ -138,13 +140,11 @@ PeerData *Controller::singlePeer() const {
}
void Controller::setupSideBar() {
Expects(_sessionController != nullptr);
if (!isPrimary()) {
return;
}
if (!_sessionController) {
sideBarChanged();
return;
}
_sessionController->filtersMenuChanged(
) | rpl::start_with_next([=] {
sideBarChanged();
@@ -283,16 +283,19 @@ void Controller::clearPasscodeLock() {
}
}
void Controller::setupIntro() {
_widget.setupIntro(Core::App().domain().maybeLastOrSomeAuthedAccount()
void Controller::setupIntro(QPixmap oldContentCache) {
const auto point = Core::App().domain().maybeLastOrSomeAuthedAccount()
? Intro::EnterPoint::Qr
: Intro::EnterPoint::Start);
: Intro::EnterPoint::Start;
_widget.setupIntro(point, std::move(oldContentCache));
}
void Controller::setupMain(MsgId singlePeerShowAtMsgId) {
void Controller::setupMain(
MsgId singlePeerShowAtMsgId,
QPixmap oldContentCache) {
Expects(_sessionController != nullptr);
_widget.setupMain(singlePeerShowAtMsgId);
_widget.setupMain(singlePeerShowAtMsgId, std::move(oldContentCache));
if (const auto id = Ui::Emoji::NeedToSwitchBackToId()) {
Ui::Emoji::LoadAndSwitchTo(&_sessionController->session(), id);