Esempio n. 1
0
IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent),
    errorAlpha(0), changed(false),
	next(this, lang(lng_intro_next), st::btnIntroNext),
	country(this, st::introCountry),
	phone(this, st::inpIntroPhone), code(this, st::inpIntroCountryCode),
	_signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), st::introErrLabel, st::introErrLabelTextStyle),
    _showSignup(false) {
	setVisible(false);
	setGeometry(parent->innerRect());

	connect(&next, SIGNAL(stateChanged(int, ButtonStateChangeSource)), parent, SLOT(onDoneStateChanged(int, ButtonStateChangeSource)));
	connect(&next, SIGNAL(clicked()), this, SLOT(onSubmitPhone()));
	connect(&phone, SIGNAL(voidBackspace(QKeyEvent*)), &code, SLOT(startErasing(QKeyEvent*)));
	connect(&country, SIGNAL(codeChanged(const QString &)), &code, SLOT(codeSelected(const QString &)));
	connect(&code, SIGNAL(codeChanged(const QString &)), &country, SLOT(onChooseCode(const QString &)));
	connect(&code, SIGNAL(codeChanged(const QString &)), &phone, SLOT(onChooseCode(const QString &)));
	connect(&country, SIGNAL(codeChanged(const QString &)), &phone, SLOT(onChooseCode(const QString &)));
	connect(&code, SIGNAL(addedToNumber(const QString &)), &phone, SLOT(addedToNumber(const QString &)));
	connect(&phone, SIGNAL(changed()), this, SLOT(onInputChange()));
	connect(&code, SIGNAL(changed()), this, SLOT(onInputChange()));
	connect(intro(), SIGNAL(countryChanged()), this, SLOT(countryChanged()));
	connect(&checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));

	_signup.setLink(1, TextLinkPtr(new SignUpLink(this)));
	_signup.hide();

	_signupCache = myGrab(&_signup);

	if (!country.onChooseCountry(intro()->currentCountry())) {
		country.onChooseCountry(qsl("US"));
	}
	changed = false;
}
Esempio n. 2
0
IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStage(parent),
errorAlpha(0),
_next(this, lang(lng_intro_submit), st::btnIntroNext),
_salt(parent->getPwdSalt()),
_hasRecovery(parent->getHasRecovery()),
_hint(parent->getPwdHint()),
_pwdField(this, st::inpIntroPassword, lang(lng_signin_password)),
_codeField(this, st::inpIntroPassword, lang(lng_signin_code)),
_toRecover(this, lang(lng_signin_recover)),
_toPassword(this, lang(lng_signin_try_password)),
_reset(this, lang(lng_signin_reset_account), st::btnRedLink),
sentRequest(0) {
	setVisible(false);
	setGeometry(parent->innerRect());

	connect(&_next, SIGNAL(clicked()), this, SLOT(onSubmitPwd()));
	connect(&checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));
	connect(&_toRecover, SIGNAL(clicked()), this, SLOT(onToRecover()));
	connect(&_toPassword, SIGNAL(clicked()), this, SLOT(onToPassword()));
	connect(&_pwdField, SIGNAL(changed()), this, SLOT(onInputChange()));
	connect(&_codeField, SIGNAL(changed()), this, SLOT(onInputChange()));
	connect(&_reset, SIGNAL(clicked()), this, SLOT(onReset()));

	_pwdField.setEchoMode(QLineEdit::Password);

	if (!_hint.isEmpty()) {
		_hintText.setText(st::introFont, lng_signin_hint(lt_password_hint, _hint));
	}
	_codeField.hide();
	_toPassword.hide();
	_toRecover.show();
	_reset.hide();

	setMouseTracking(true);
}
Esempio n. 3
0
PhoneWidget::PhoneWidget(QWidget *parent, Widget::Data *data) : Step(parent, data)
, _country(this, st::introCountry)
, _code(this, st::introCountryCode)
, _phone(this, st::introPhone)
, _checkRequest(this) {
	connect(_phone, SIGNAL(voidBackspace(QKeyEvent*)), _code, SLOT(startErasing(QKeyEvent*)));
	connect(_country, SIGNAL(codeChanged(const QString &)), _code, SLOT(codeSelected(const QString &)));
	connect(_code, SIGNAL(codeChanged(const QString &)), _country, SLOT(onChooseCode(const QString &)));
	connect(_code, SIGNAL(codeChanged(const QString &)), _phone, SLOT(onChooseCode(const QString &)));
	connect(_country, SIGNAL(codeChanged(const QString &)), _phone, SLOT(onChooseCode(const QString &)));
	connect(_code, SIGNAL(addedToNumber(const QString &)), _phone, SLOT(addedToNumber(const QString &)));
	connect(_phone, SIGNAL(changed()), this, SLOT(onInputChange()));
	connect(_code, SIGNAL(changed()), this, SLOT(onInputChange()));
	connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));

	setTitleText(langFactory(lng_phone_title));
	setDescriptionText(langFactory(lng_phone_desc));
	subscribe(getData()->updated, [this] { countryChanged(); });
	setErrorCentered(true);

	if (!_country->onChooseCountry(getData()->country)) {
		_country->onChooseCountry(qsl("US"));
	}
	_changed = false;

	Messenger::Instance().destroyStaleAuthorizationKeys();
}
Esempio n. 4
0
IntroCode::IntroCode(IntroWidget *parent) : IntroStage(parent), errorAlpha(0),
	next(this, lang(lng_intro_next), st::btnIntroNext),
	code(this, st::inpIntroCode, lang(lng_code_ph)), waitTillCall(intro()->getCallTimeout()) {
	setVisible(false);
	setGeometry(parent->innerRect());

	connect(&next, SIGNAL(stateChanged(int, ButtonStateChangeSource)), parent, SLOT(onDoneStateChanged(int, ButtonStateChangeSource)));
	connect(&next, SIGNAL(clicked()), this, SLOT(onSubmitCode()));
	connect(&code, SIGNAL(changed()), this, SLOT(onInputChange()));
	connect(&callTimer, SIGNAL(timeout()), this, SLOT(onSendCall()));
	connect(&checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));
}
Esempio n. 5
0
IntroSignup::IntroSignup(IntroWidget *parent) : IntroStage(parent),
	errorAlpha(0), a_photo(0),
    next(this, lang(lng_intro_finish), st::btnIntroFinish), 
	first(this, st::inpIntroName, lang(lng_signup_firstname)),
	last(this, st::inpIntroName, lang(lng_signup_lastname)) {
	setVisible(false);
	setGeometry(parent->innerRect());

	connect(&next, SIGNAL(clicked()), this, SLOT(onSubmitName()));
	connect(&checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));

	setMouseTracking(true);
}
Esempio n. 6
0
CodeWidget::CodeWidget(QWidget *parent, Widget::Data *data) : Step(parent, data)
, _noTelegramCode(this, lang(lng_code_no_telegram), st::introLink)
, _code(this, st::introCode, langFactory(lng_code_ph))
, _callTimer(this)
, _callStatus(getData()->callStatus)
, _callTimeout(getData()->callTimeout)
, _callLabel(this, st::introDescription)
, _checkRequest(this) {
	subscribe(Lang::Current().updated(), [this] { refreshLang(); });

	connect(_code, SIGNAL(changed()), this, SLOT(onInputChange()));
	connect(_callTimer, SIGNAL(timeout()), this, SLOT(onSendCall()));
	connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));
	connect(_noTelegramCode, SIGNAL(clicked()), this, SLOT(onNoTelegramCode()));

	_code->setDigitsCountMax(getData()->codeLength);
	setErrorBelowLink(true);

	setTitleText([text = App::formatPhone(getData()->phone)] { return text; });
	updateDescText();
}
Esempio n. 7
0
IntroSignup::IntroSignup(IntroWidget *parent) : IntroStep(parent)
, a_errorAlpha(0)
, a_photoOver(0)
, _a_error(animation(this, &IntroSignup::step_error))
, _a_photo(animation(this, &IntroSignup::step_photo))
, next(this, lang(lng_intro_finish), st::btnIntroNext)
, first(this, st::inpIntroName, lang(lng_signup_firstname))
, last(this, st::inpIntroName, lang(lng_signup_lastname))
, sentRequest(0)
, _invertOrder(langFirstNameGoesSecond()) {
	setVisible(false);
	setGeometry(parent->innerRect());

	connect(&next, SIGNAL(clicked()), this, SLOT(onSubmitName()));
	connect(&checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));

	if (_invertOrder) {
		setTabOrder(&last, &first);
	}

	setMouseTracking(true);
}