Пример #1
0
UsernameBox::UsernameBox() : AbstractBox(st::boxWidth),
_save(this, lang(lng_settings_save), st::defaultBoxButton),
_cancel(this, lang(lng_cancel), st::cancelBoxButton),
_username(this, st::defaultInputField, qsl("@username"), App::self()->username, false),
_link(this, QString(), st::defaultBoxLinkButton),
_saveRequestId(0), _checkRequestId(0),
_about(st::boxWidth - st::usernamePadding.left()) {
	setBlueTitle(true);

	_goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available);

	textstyleSet(&st::usernameTextStyle);
	_about.setRichText(st::boxTextFont, lang(lng_username_about));
	resizeMaxHeight(st::boxWidth, st::boxTitleHeight + st::usernamePadding.top() + _username.height() + st::usernameSkip + _about.countHeight(st::boxWidth - st::usernamePadding.left()) + 3 * st::usernameTextStyle.lineHeight + st::usernamePadding.bottom() + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom());
	textstyleRestore();

	connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
	connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
	connect(&_username, SIGNAL(changed()), this, SLOT(onChanged()));
	connect(&_username, SIGNAL(submitted(bool)), this, SLOT(onSave()));

	connect(&_link, SIGNAL(clicked()), this, SLOT(onLinkClick()));

	_checkTimer.setSingleShot(true);
	connect(&_checkTimer, SIGNAL(timeout()), this, SLOT(onCheck()));

	prepare();
}
Пример #2
0
void PasscodeBox::init() {
	setBlueTitle(true);

	textstyleSet(&st::usernameTextStyle);
	_about.setRichText(st::normalFont, lang(_cloudPwd ? lng_cloud_password_about : lng_passcode_about));
	_aboutHeight = _about.countHeight(st::boxWidth - st::boxPadding.left() * 1.5);
	textstyleRestore();
	if (_turningOff) {
		_oldPasscode.show();
		_boxTitle = lang(_cloudPwd ? lng_cloud_password_remove : lng_passcode_remove);
		setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _oldPasscode.height() + st::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0) + _aboutHeight + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom());
	} else {
		bool has = _cloudPwd ? (!_curSalt.isEmpty()) : cHasPasscode();
		if (has) {
			_oldPasscode.show();
			_boxTitle = lang(_cloudPwd ? lng_cloud_password_change : lng_passcode_change);
			setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _oldPasscode.height() + st::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0) + _newPasscode.height() + st::contactSkip + _reenterPasscode.height() + st::passcodeSkip + (_cloudPwd ? _passwordHint.height() + st::contactSkip : 0) + _aboutHeight + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom());
		} else {
			_oldPasscode.hide();
			_boxTitle = lang(_cloudPwd ? lng_cloud_password_create : lng_passcode_create);
			setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _newPasscode.height() + st::contactSkip + _reenterPasscode.height() + st::passcodeSkip + (_cloudPwd ? _passwordHint.height() + st::contactSkip : 0) + _aboutHeight + (_cloudPwd ? st::contactSkip + _recoverEmail.height() + st::passcodeSkip : st::passcodePadding.bottom()) + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom());
		}
	}

	connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave()));
	connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));

	connect(&_oldPasscode, SIGNAL(changed()), this, SLOT(onOldChanged()));
	connect(&_newPasscode, SIGNAL(changed()), this, SLOT(onNewChanged()));
	connect(&_reenterPasscode, SIGNAL(changed()), this, SLOT(onNewChanged()));
	connect(&_passwordHint, SIGNAL(changed()), this, SLOT(onNewChanged()));
	connect(&_recoverEmail, SIGNAL(changed()), this, SLOT(onEmailChanged()));

	connect(&_oldPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
	connect(&_newPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
	connect(&_reenterPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
	connect(&_passwordHint, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
	connect(&_recoverEmail, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));

	connect(&_recover, SIGNAL(clicked()), this, SLOT(onRecoverByEmail()));
}
Пример #3
0
ScrollableBox::ScrollableBox(const style::flatScroll &scroll, int32 w) : AbstractBox(w),
_scroll(this, scroll), _innerPtr(0), _topSkip(st::boxTitleHeight), _bottomSkip(st::boxScrollSkip) {
	setBlueTitle(true);
}