void Window::setupMain(bool anim, const MTPUser *self) { Local::readRecentStickers(); QPixmap bg = anim ? myGrab(this, QRect(0, st::titleHeight, width(), height() - st::titleHeight)) : QPixmap(); clearWidgets(); main = new MainWidget(this); main->move(0, st::titleHeight); if (anim) { main->animShow(bg); } else { main->activate(); } if (self) { main->start(*self); } else { MTP::send(MTPusers_GetUsers(MTP_vector<MTPInputUser>(1, MTP_inputUserSelf())), main->rpcDone(&MainWidget::startFull)); } title->resizeEvent(0); fixOrder(); updateTitleStatus(); _mediaView = new MediaView(); }
void Window::updateTitleStatus() { int32 state = MTP::dcstate(); if (state == MTProtoConnection::Connecting || state == MTProtoConnection::Disconnected || (state < 0 && state > -600)) { if (main || getms() > 5000 || _connecting) { showConnecting(lang(lng_connecting)); } } else if (state < 0) { showConnecting(lang(lng_reconnecting).arg((-state) / 1000), lang(lng_reconnecting_try_now)); QTimer::singleShot((-state) % 1000, this, SLOT(updateTitleStatus())); } else { hideConnecting(); } }
void Window::setupIntro(bool anim) { if (intro && (intro->animating() || intro->isVisible()) && !main) return; QPixmap bg = myGrab(this, QRect(0, st::titleHeight, width(), height() - st::titleHeight)); clearWidgets(); intro = new IntroWidget(this); intro->move(0, st::titleHeight); if (anim) { intro->animShow(bg); } fixOrder(); updateTitleStatus(); }
void Window::setupMain(bool anim) { QPixmap bg = myGrab(this, QRect(0, st::titleHeight, width(), height() - st::titleHeight)); clearWidgets(); main = new MainWidget(this); main->move(0, st::titleHeight); if (anim) { main->animShow(bg); } else { MTP::send(MTPusers_GetUsers(MTP_vector<MTPInputUser>(QVector<MTPInputUser>(1, MTP_inputUserSelf()))), main->rpcDone(&MainWidget::startFull)); main->activate(); } fixOrder(); updateTitleStatus(); }
void Window::setupIntro(bool anim) { cSetContactsReceived(false); if (intro && (intro->animating() || intro->isVisible()) && !main) return; QPixmap bg = anim ? myGrab(this, QRect(0, st::titleHeight, width(), height() - st::titleHeight)) : QPixmap(); clearWidgets(); intro = new IntroWidget(this); intro->move(0, st::titleHeight); if (anim) { intro->animShow(bg); } fixOrder(); updateTitleStatus(); _delayedServiceMsgs.clear(); if (_serviceHistoryRequest) { MTP::cancel(_serviceHistoryRequest); _serviceHistoryRequest = 0; } }
void Window::mtpStateChanged(int32 dc, int32 state) { if (dc == MTP::maindc()) { updateTitleStatus(); if (settings) settings->updateConnectionType(); } }