mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Several crashes fixed.
This commit is contained in:
@@ -35,45 +35,18 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "application.h"
|
||||
#include "ui/text/text.h"
|
||||
|
||||
namespace {
|
||||
IntroWidget *signalEmitOn = 0;
|
||||
QString countryForReg;
|
||||
void gotNearestDC(const MTPNearestDc &result) {
|
||||
const auto &nearest(result.c_nearestDc());
|
||||
DEBUG_LOG(("Got nearest dc, country: %1, nearest: %2, this: %3").arg(nearest.vcountry.c_string().v.c_str()).arg(nearest.vnearest_dc.v).arg(nearest.vthis_dc.v));
|
||||
MTP::setdc(result.c_nearestDc().vnearest_dc.v, true);
|
||||
if (countryForReg != nearest.vcountry.c_string().v.c_str()) {
|
||||
countryForReg = nearest.vcountry.c_string().v.c_str();
|
||||
emit signalEmitOn->countryChanged();
|
||||
}
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
Sandbox::startUpdateCheck();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
IntroWidget::IntroWidget(QWidget *parent) : TWidget(parent)
|
||||
, _langChangeTo(0)
|
||||
, _a_stage(animation(this, &IntroWidget::step_stage))
|
||||
, _cacheHideIndex(0)
|
||||
, _cacheShowIndex(0)
|
||||
, _a_show(animation(this, &IntroWidget::step_show))
|
||||
, _callStatus({ CallDisabled, 0 })
|
||||
, _registered(false)
|
||||
, _hasRecovery(false)
|
||||
, _codeByTelegram(false)
|
||||
, _back(this, st::setClose)
|
||||
, _backFrom(0)
|
||||
, _backTo(0) {
|
||||
, _back(this, st::setClose) {
|
||||
setGeometry(QRect(0, st::titleHeight, App::wnd()->width(), App::wnd()->height() - st::titleHeight));
|
||||
|
||||
connect(&_back, SIGNAL(clicked()), this, SLOT(onBack()));
|
||||
_back.hide();
|
||||
|
||||
countryForReg = psCurrentCountry();
|
||||
_countryForReg = psCurrentCountry();
|
||||
|
||||
MTP::send(MTPhelp_GetNearestDc(), rpcDone(gotNearestDC));
|
||||
signalEmitOn = this;
|
||||
MTP::send(MTPhelp_GetNearestDc(), rpcDone(&IntroWidget::gotNearestDC));
|
||||
|
||||
_stepHistory.push_back(new IntroStart(this));
|
||||
_back.raise();
|
||||
@@ -86,6 +59,10 @@ IntroWidget::IntroWidget(QWidget *parent) : TWidget(parent)
|
||||
cSetPasswordRecovered(false);
|
||||
|
||||
_back.move(st::setClosePos.x(), st::setClosePos.y());
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
Sandbox::startUpdateCheck();
|
||||
#endif
|
||||
}
|
||||
|
||||
void IntroWidget::langChangeTo(int32 langId) {
|
||||
@@ -173,6 +150,16 @@ void IntroWidget::pushStep(IntroStep *step, MoveType type) {
|
||||
historyMove(type);
|
||||
}
|
||||
|
||||
void IntroWidget::gotNearestDC(const MTPNearestDc &result) {
|
||||
const auto &nearest(result.c_nearestDc());
|
||||
DEBUG_LOG(("Got nearest dc, country: %1, nearest: %2, this: %3").arg(nearest.vcountry.c_string().v.c_str()).arg(nearest.vnearest_dc.v).arg(nearest.vthis_dc.v));
|
||||
MTP::setdc(result.c_nearestDc().vnearest_dc.v, true);
|
||||
if (_countryForReg != nearest.vcountry.c_string().v.c_str()) {
|
||||
_countryForReg = nearest.vcountry.c_string().v.c_str();
|
||||
emit countryChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap IntroWidget::grabStep(int skip) {
|
||||
return myGrab(step(skip), QRect(st::introSlideShift, 0, st::introSize.width(), st::introSize.height()));
|
||||
}
|
||||
@@ -297,7 +284,7 @@ QRect IntroWidget::innerRect() const {
|
||||
}
|
||||
|
||||
QString IntroWidget::currentCountry() const {
|
||||
return countryForReg;
|
||||
return _countryForReg;
|
||||
}
|
||||
|
||||
void IntroWidget::setPhone(const QString &phone, const QString &phone_hash, bool registered) {
|
||||
|
@@ -20,8 +20,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "mtproto/rpc_sender.h"
|
||||
|
||||
class IntroStep;
|
||||
class IntroWidget final : public TWidget {
|
||||
class IntroWidget : public TWidget, public RPCSender {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@@ -99,11 +101,12 @@ private:
|
||||
|
||||
QPixmap grabStep(int skip = 0);
|
||||
|
||||
int _langChangeTo;
|
||||
int _langChangeTo = 0;
|
||||
|
||||
Animation _a_stage;
|
||||
QPixmap _cacheHide, _cacheShow;
|
||||
int _cacheHideIndex, _cacheShowIndex;
|
||||
int _cacheHideIndex = 0;
|
||||
int _cacheShowIndex = 0;
|
||||
anim::ivalue a_coordHide, a_coordShow;
|
||||
anim::fvalue a_opacityHide, a_opacityShow;
|
||||
|
||||
@@ -125,20 +128,26 @@ private:
|
||||
void historyMove(MoveType type);
|
||||
void pushStep(IntroStep *step, MoveType type);
|
||||
|
||||
void gotNearestDC(const MTPNearestDc &dc);
|
||||
|
||||
QString _countryForReg;
|
||||
|
||||
QString _phone, _phone_hash;
|
||||
CallStatus _callStatus;
|
||||
bool _registered;
|
||||
CallStatus _callStatus = { CallDisabled, 0 };
|
||||
bool _registered = false;
|
||||
|
||||
QString _code;
|
||||
|
||||
QByteArray _pwdSalt;
|
||||
bool _hasRecovery, _codeByTelegram;
|
||||
bool _hasRecovery = false;
|
||||
bool _codeByTelegram = false;
|
||||
QString _pwdHint;
|
||||
|
||||
QString _firstname, _lastname;
|
||||
|
||||
IconedButton _back;
|
||||
float64 _backFrom, _backTo;
|
||||
float64 _backFrom = 0.;
|
||||
float64 _backTo = 0.;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user