예제 #1
0
ConvertToSupergroupBox::ConvertToSupergroupBox(ChatData *chat) : AbstractBox(st::boxWideWidth)
    , _chat(chat)
    , _text(100)
    , _note(100)
    , _convert(this, lang(lng_profile_convert_confirm), st::defaultBoxButton)
    , _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
    QStringList text;
    text.push_back(lang(lng_profile_convert_feature1));
    text.push_back(lang(lng_profile_convert_feature2));
    text.push_back(lang(lng_profile_convert_feature3));
    text.push_back(lang(lng_profile_convert_feature4));

    textstyleSet(&st::boxTextStyle);
    _text.setText(st::boxTextFont, text.join('\n'), _confirmBoxTextOptions);
    _note.setText(st::boxTextFont, lng_profile_convert_warning(lt_bold_start, textcmdStartSemibold(), lt_bold_end, textcmdStopSemibold()), _confirmBoxTextOptions);
    _textWidth = st::boxWideWidth - st::boxPadding.left() - st::boxButtonPadding.right();
    _textHeight = _text.countHeight(_textWidth);
    setMaxHeight(st::boxTitleHeight + _textHeight + st::boxPadding.bottom() + _note.countHeight(_textWidth) + st::boxButtonPadding.top() + _convert.height() + st::boxButtonPadding.bottom());
    textstyleRestore();

    connect(&_convert, SIGNAL(clicked()), this, SLOT(onConvert()));
    connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));

    prepare();
}
예제 #2
0
void ChangePhoneBox::EnterCode::prepare() {
	setTitle(langFactory(lng_change_phone_title));

	auto descriptionText = lng_change_phone_code_description(lt_phone, textcmdStartSemibold() + App::formatPhone(_phone) + textcmdStopSemibold());
	auto description = object_ptr<Ui::FlatLabel>(this, descriptionText, Ui::FlatLabel::InitType::Rich, st::changePhoneLabel);
	description->moveToLeft(st::boxPadding.left(), 0);

	auto phoneValue = QString();
	_code.create(this, st::defaultInputField, langFactory(lng_change_phone_code_title), phoneValue);
	_code->setAutoSubmit(_codeLength, [=] { submit(); });
	_code->setChangedCallback([=] { hideError(); });

	_code->resize(st::boxWidth - 2 * st::boxPadding.left(), _code->height());
	_code->moveToLeft(st::boxPadding.left(), description->bottomNoMargins());
	connect(_code, &Ui::InputField::submitted, [=] { submit(); });

	setDimensions(st::boxWidth, countHeight());

	if (_callTimeout > 0) {
		_call.setStatus({ SentCodeCall::State::Waiting, _callTimeout });
		updateCall();
	}

	addButton(langFactory(lng_change_phone_new_submit), [=] { submit(); });
	addButton(langFactory(lng_cancel), [=] { closeBox(); });
}