mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-20 06:21:00 +00:00
boxes animations pause mtp
This commit is contained in:
parent
f12f21b16b
commit
48756111a9
@ -190,8 +190,8 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
|
||||
connect(this, SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
|
||||
#endif
|
||||
connect(this, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onAppStateChanged(Qt::ApplicationState)));
|
||||
//connect(&writeUserConfigTimer, SIGNAL(timeout()), this, SLOT(onWriteUserConfig()));
|
||||
//writeUserConfigTimer.setSingleShot(true);
|
||||
|
||||
connect(&_mtpUnpauseTimer, SIGNAL(timeout()), this, SLOT(doMtpUnpause()));
|
||||
|
||||
connect(&killDownloadSessionsTimer, SIGNAL(timeout()), this, SLOT(killDownloadSessions()));
|
||||
|
||||
@ -296,8 +296,13 @@ void Application::cancelPhotoUpdate(const PeerId &peer) {
|
||||
}
|
||||
}
|
||||
|
||||
void Application::mtpPause() {
|
||||
MTP::pause();
|
||||
_mtpUnpauseTimer.start(1000);
|
||||
}
|
||||
|
||||
void Application::mtpUnpause() {
|
||||
QTimer::singleShot(1, this, SLOT(doMtpUnpause()));
|
||||
_mtpUnpauseTimer.start(1);
|
||||
}
|
||||
|
||||
void Application::doMtpUnpause() {
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
bool isPhotoUpdating(const PeerId &peer);
|
||||
void cancelPhotoUpdate(const PeerId &peer);
|
||||
|
||||
void mtpPause();
|
||||
void mtpUnpause();
|
||||
|
||||
void selfPhotoCleared(const MTPUserProfilePhoto &result);
|
||||
@ -165,7 +166,7 @@ private:
|
||||
UpdateDownloader *updateDownloader;
|
||||
#endif
|
||||
|
||||
QTimer writeUserConfigTimer;
|
||||
SingleTimer _mtpUnpauseTimer;
|
||||
|
||||
Translator *_translator;
|
||||
|
||||
|
@ -1573,7 +1573,7 @@ void DialogsWidget::dialogsToUp() {
|
||||
}
|
||||
|
||||
void DialogsWidget::animShow(const QPixmap &bgAnimCache) {
|
||||
MTP::pause();
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
|
||||
_bgAnimCache = bgAnimCache;
|
||||
_animCache = myGrab(this, rect());
|
||||
|
@ -3993,7 +3993,7 @@ HistoryItem *HistoryWidget::atTopImportantMsg(int32 &bottomUnderScrollTop) const
|
||||
}
|
||||
|
||||
void HistoryWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTopBarCache, bool back) {
|
||||
MTP::pause();
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
|
||||
_bgAnimCache = bgAnimCache;
|
||||
_bgAnimTopBarCache = bgAnimTopBarCache;
|
||||
|
@ -145,7 +145,7 @@ bool IntroWidget::createNext() {
|
||||
}
|
||||
|
||||
void IntroWidget::prepareMove() {
|
||||
MTP::pause();
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
|
||||
if (cacheForHide.isNull() || cacheForHideInd != current) makeHideCache();
|
||||
|
||||
@ -200,7 +200,7 @@ void IntroWidget::makeShowCache(int stage) {
|
||||
}
|
||||
|
||||
void IntroWidget::animShow(const QPixmap &bgAnimCache, bool back) {
|
||||
MTP::pause();
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
|
||||
_bgAnimCache = bgAnimCache;
|
||||
|
||||
|
@ -30,6 +30,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
||||
BackgroundWidget::BackgroundWidget(QWidget *parent, LayeredWidget *w) : QWidget(parent), w(w),
|
||||
aBackground(0), aBackgroundFunc(anim::easeOutCirc), hiding(false), shadow(st::boxShadow) {
|
||||
w->setParent(this);
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
setGeometry(0, 0, App::wnd()->width(), App::wnd()->height());
|
||||
aBackground.start(1);
|
||||
anim::start(this);
|
||||
@ -62,7 +63,7 @@ void BackgroundWidget::paintEvent(QPaintEvent *e) {
|
||||
|
||||
void BackgroundWidget::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Escape) {
|
||||
startHide();
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,6 +92,8 @@ bool BackgroundWidget::onInnerClose() {
|
||||
|
||||
void BackgroundWidget::startHide() {
|
||||
if (hiding) return;
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
|
||||
hiding = true;
|
||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||
aBackground.start(0);
|
||||
@ -146,6 +149,7 @@ bool BackgroundWidget::animStep(float64 ms) {
|
||||
}
|
||||
anim::stop(this);
|
||||
res = false;
|
||||
if (App::app()) App::app()->mtpUnpause();
|
||||
} else {
|
||||
aBackground.update(dt, aBackgroundFunc);
|
||||
}
|
||||
|
@ -2705,7 +2705,7 @@ void MainWidget::historyCleared(History *hist) {
|
||||
}
|
||||
|
||||
void MainWidget::animShow(const QPixmap &bgAnimCache, bool back) {
|
||||
MTP::pause();
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
|
||||
_bgAnimCache = bgAnimCache;
|
||||
|
||||
|
@ -2781,7 +2781,7 @@ void OverviewWidget::fastShow(bool back, int32 lastScrollTop) {
|
||||
}
|
||||
|
||||
void OverviewWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTopBarCache, bool back, int32 lastScrollTop) {
|
||||
MTP::pause();
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
|
||||
stopGif();
|
||||
_bgAnimCache = bgAnimCache;
|
||||
|
@ -112,7 +112,7 @@ void PasscodeWidget::onChanged() {
|
||||
}
|
||||
|
||||
void PasscodeWidget::animShow(const QPixmap &bgAnimCache, bool back) {
|
||||
MTP::pause();
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
|
||||
_bgAnimCache = bgAnimCache;
|
||||
|
||||
|
@ -1616,7 +1616,7 @@ int32 ProfileWidget::lastScrollTop() const {
|
||||
}
|
||||
|
||||
void ProfileWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTopBarCache, bool back, int32 lastScrollTop) {
|
||||
MTP::pause();
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
|
||||
stopGif();
|
||||
_bgAnimCache = bgAnimCache;
|
||||
|
@ -1768,7 +1768,7 @@ void SettingsWidget::onParentResize(const QSize &newSize) {
|
||||
}
|
||||
|
||||
void SettingsWidget::animShow(const QPixmap &bgAnimCache, bool back) {
|
||||
MTP::pause();
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
|
||||
_bgAnimCache = bgAnimCache;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user