コード例 #1
0
ファイル: introphone.cpp プロジェクト: GRIM2D/tdesktop
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(&country, SIGNAL(selectClosed()), this, SLOT(onSelectClose()));
	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, _signup.rect());

	if (!country.onChooseCountry(intro()->currentCountry())) {
		country.onChooseCountry(qsl("US"));
	}
	changed = false;
}
コード例 #2
0
ファイル: countryinput.cpp プロジェクト: HoTaeWang/tdesktop
void CountryInput::onFinishCountry() {
	if (_select) {
		_select->hide();
		_select->deleteLater();
		_select = 0;
		emit selectClosed();
	}
}
コード例 #3
0
ファイル: countryinput.cpp プロジェクト: HoTaeWang/tdesktop
void CountryInput::onChooseCode(const QString &code) {
	if (_select) {
		_select->hide();
		_select->deleteLater();
		_select = 0;
		emit selectClosed();
	}
	if (code.length()) {
		CountriesByCode::const_iterator i = countriesByCode.constFind(code);
		if (i != countriesByCode.cend()) {
			const CountryInfo *info = *i;
			lastValidISO = info->iso2;
			setText(QString::fromUtf8(info->name));
		} else {
			setText(lang(lng_bad_country_code));
		}
	} else {
		setText(lang(lng_country_code));
	}
	update();
}