2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Closed beta 10019014: New input fields design and animations.

This commit is contained in:
John Preston
2016-12-09 21:56:01 +03:00
parent 2d48cde27a
commit 90234cb7a0
51 changed files with 1068 additions and 940 deletions

View File

@@ -239,9 +239,7 @@ void AddContactBox::onRetry() {
_retry->hide();
resizeEvent(0);
_first->setText(QString());
_first->updatePlaceholder();
_last->setText(QString());
_last->updatePlaceholder();
_phone->clearText();
_phone->setDisabled(false);
_first->setFocus();
@@ -274,13 +272,11 @@ GroupInfoBox::GroupInfoBox(CreatingGroupType creating, bool fromTypeChoose) : Ab
connect(_next, SIGNAL(clicked()), this, SLOT(onNext()));
connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
_photo->setClickedCallback([this] {
App::CallDelayed(st::defaultActiveButton.ripple.hideDuration, base::lambda_guarded(this, [this] {
auto imgExtensions = cImgExtensions();
auto filter = qsl("Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;") + filedialogAllFilesFilter();
_setPhotoFileQueryId = FileDialog::queryReadFile(lang(lng_choose_image), filter);
}));
});
_photo->setClickedCallback(App::LambdaDelayed(st::defaultActiveButton.ripple.hideDuration, this, [this] {
auto imgExtensions = cImgExtensions();
auto filter = qsl("Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;") + filedialogAllFilesFilter();
_setPhotoFileQueryId = FileDialog::queryReadFile(lang(lng_choose_image), filter);
}));
subscribe(FileDialog::QueryDone(), [this](const FileDialog::QueryUpdate &update) {
notifyFileQueryUpdated(update);
});
@@ -433,7 +429,7 @@ SetupChannelBox::SetupChannelBox(ChannelData *channel, bool existing) : Abstract
, _aboutPublicWidth(width() - st::boxPadding.left() - st::boxButtonPadding.right() - st::newGroupPadding.left() - st::defaultBoxCheckbox.textPosition.x())
, _aboutPublic(st::normalFont, lang(channel->isMegagroup() ? lng_create_public_group_about : lng_create_public_channel_about), _defaultOptions, _aboutPublicWidth)
, _aboutPrivate(st::normalFont, lang(channel->isMegagroup() ? lng_create_private_group_about : lng_create_private_channel_about), _defaultOptions, _aboutPublicWidth)
, _link(this, st::defaultInputField, QString(), channel->username, true)
, _link(this, st::setupChannelLink, QString(), channel->username, true)
, _linkOver(false)
, _save(this, lang(lng_settings_save), st::defaultBoxButton)
, _skip(this, lang(existing ? lng_cancel : lng_create_group_skip), st::cancelBoxButton) {

View File

@@ -97,6 +97,7 @@ boxLinkButton: LinkButton {
}
boxOptionListPadding: margins(2px, 20px, 2px, 2px);
boxOptionInputSkip: 6px;
boxVerticalMargin: 10px;
boxWidth: 320px;
@@ -146,7 +147,7 @@ boxPhotoTitleFont: font(16px semibold);
boxPhotoTitlePosition: point(28px, 26px);
boxPhotoPadding: margins(28px, 28px, 28px, 0px);
boxPhotoCompressedSkip: 20px;
boxPhotoCaptionSkip: 22px;
boxPhotoCaptionSkip: 8px;
boxPhotoTextFg: #808080;
cropPointSize: 10px;
@@ -202,7 +203,7 @@ aboutRevokePublicLabel: FlatLabel(defaultFlatLabel) {
contactUserIcon: icon {{ "add_contact_user", #999999 }};
contactPhoneIcon: icon {{ "add_contact_phone", #999999 }};
contactIconTop: 10px;
contactIconTop: 28px;
contactsAddIconAbove: icon {{ "contacts_add", activeButtonFg, point(18px, 18px) }};
contactsAdd: TwoIconButton {
@@ -222,8 +223,8 @@ contactsAdd: TwoIconButton {
}
contactsAddPosition: point(14px, 8px);
contactPadding: margins(49px, 22px, 0px, 6px);
contactSkip: 13px;
contactPadding: margins(49px, 2px, 0px, 6px);
contactSkip: 6px;
contactPhoneSkip: 30px;
contactsPhotoSize: 42px;
@@ -283,13 +284,16 @@ contactsMultiSelect: MultiSelect {
placeholderFg: #999999;
placeholderFgActive: #aaaaaa;
placeholderFgError: #aaaaaa;
placeholderMargins: margins(2px, 0px, 2px, 0px);
placeholderScale: 0.;
placeholderFont: normalFont;
border: 0px;
borderActive: 0px;
borderError: 0px;
height: 32px;
heightMin: 32px;
font: normalFont;
}
@@ -406,20 +410,23 @@ sessionTerminateAllButton: LinkButton(boxLinkButton) {
passcodeHeaderFont: font(19px);
passcodeHeaderHeight: 80px;
passcodeInput: introPhone;
passcodeInput: InputField(introPhone) {
textMargins: margins(1px, 27px, 1px, 6px);
}
passcodeSubmit: RoundButton(introNextButton) {
width: 225px;
}
passcodeSubmitSkip: 40px;
passcodePadding: margins(0px, 22px, 0px, 3px);
passcodeSkip: 31px;
passcodePadding: margins(0px, 6px, 0px, 13px);
passcodeTextLine: 28px;
passcodeSkip: 21px;
newGroupAboutFg: #808080;
newGroupPadding: margins(4px, 6px, 4px, 3px);
newGroupSkip: 17px;
newGroupSkip: 27px;
newGroupInfoPadding: margins(0px, -4px, 0px, 1px);
newGroupLinkPadding: margins(4px, 27px, 4px, 12px);
newGroupLinkPadding: margins(4px, 27px, 4px, 21px);
newGroupLinkTop: 3px;
newGroupLinkFont: font(16px);
@@ -428,12 +435,17 @@ newGroupPhotoIcon: icon {{ "new_chat_photo", #ffffff }};
newGroupPhotoIconPosition: point(23px, 25px);
newGroupPhotoDuration: 150;
newGroupNamePosition: point(27px, 20px);
newGroupNamePosition: point(27px, 5px);
newGroupDescriptionPadding: margins(0px, 23px, 0px, 14px);
newGroupDescription: InputArea(defaultInputArea) {
textMargins: margins(1px, 6px, 1px, 4px);
heightMax: 115px;
newGroupDescriptionPadding: margins(0px, 13px, 0px, 4px);
newGroupDescription: InputField(defaultInputField) {
textMargins: margins(1px, 26px, 1px, 4px);
heightMax: 135px;
}
setupChannelLink: InputField(defaultInputField) {
textMargins: margins(0px, 6px, 0px, 4px);
heightMin: 32px;
}
newGroupPublicLinkPadding: margins(0px, 20px, 0px, 5px);
@@ -463,14 +475,14 @@ aboutTextStyle: TextStyle(defaultTextStyle) {
lineHeight: 22px;
}
editTextArea: InputArea(defaultInputArea) {
textMargins: margins(1px, 6px, 1px, 4px);
heightMax: 256px;
editTextArea: InputField(defaultInputField) {
textMargins: margins(1px, 26px, 1px, 4px);
heightMax: 276px;
}
confirmCaptionArea: InputArea(defaultInputArea) {
textMargins: margins(1px, 6px, 1px, 4px);
heightMax: 56px;
confirmCaptionArea: InputField(defaultInputField) {
textMargins: margins(1px, 26px, 1px, 4px);
heightMax: 78px;
}
confirmBg: windowBgOver;
confirmMaxHeight: 245px;
@@ -501,3 +513,12 @@ backgroundScroll: FlatScroll(boxScroll) {
deltat: 10px;
deltab: 0px;
}
usernamePadding: margins(23px, 6px, 21px, 12px);
usernameSkip: 49px;
usernameTextStyle: TextStyle(defaultTextStyle) {
lineHeight: 20px;
}
usernameDefaultFg: #777777;
downloadPathSkip: 10px;

View File

@@ -61,7 +61,7 @@ ConnectionBox::ConnectionBox() : AbstractBox(st::boxWidth, lang(lng_connection_h
void ConnectionBox::updateControlsVisibility() {
int32 h = titleHeight() + st::boxOptionListPadding.top() + _autoRadio->heightNoMargins() + st::boxOptionListPadding.top() + _httpProxyRadio->heightNoMargins() + st::boxOptionListPadding.top() + _tcpProxyRadio->heightNoMargins() + st::boxOptionListPadding.top() + st::connectionIPv6Skip + _tryIPv6->heightNoMargins() + st::boxOptionListPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _save->height() + st::boxButtonPadding.bottom();
if (_httpProxyRadio->checked() || _tcpProxyRadio->checked()) {
h += 2 * st::boxOptionListPadding.top() + 2 * _hostInput->height();
h += 2 * st::boxOptionInputSkip + 2 * _hostInput->height();
_hostInput->show();
_portInput->show();
_userInput->show();
@@ -89,19 +89,19 @@ void ConnectionBox::resizeEvent(QResizeEvent *e) {
int32 inputy = 0;
if (_httpProxyRadio->checked()) {
inputy = _httpProxyRadio->bottomNoMargins() + st::boxOptionListPadding.top();
_tcpProxyRadio->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), inputy + st::boxOptionListPadding.top() + 2 * _hostInput->height() + st::boxOptionListPadding.top());
inputy = _httpProxyRadio->bottomNoMargins() + st::boxOptionInputSkip;
_tcpProxyRadio->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), inputy + st::boxOptionInputSkip + 2 * _hostInput->height() + st::boxOptionListPadding.top());
} else {
_tcpProxyRadio->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _httpProxyRadio->bottomNoMargins() + st::boxOptionListPadding.top());
if (_tcpProxyRadio->checked()) {
inputy = _tcpProxyRadio->bottomNoMargins() + st::boxOptionListPadding.top();
inputy = _tcpProxyRadio->bottomNoMargins() + st::boxOptionInputSkip;
}
}
if (inputy) {
_hostInput->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultBoxCheckbox.textPosition.x() - st::defaultInputField.textMargins.left(), inputy);
_portInput->moveToRight(st::boxPadding.right(), inputy);
_userInput->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultBoxCheckbox.textPosition.x() - st::defaultInputField.textMargins.left(), _hostInput->y() + _hostInput->height() + st::boxOptionListPadding.top());
_userInput->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultBoxCheckbox.textPosition.x() - st::defaultInputField.textMargins.left(), _hostInput->y() + _hostInput->height() + st::boxOptionInputSkip);
_passwordInput->moveToRight(st::boxPadding.right(), _userInput->y());
}
@@ -120,7 +120,6 @@ void ConnectionBox::onChange() {
_hostInput->setFocus();
if (_httpProxyRadio->checked() && !_portInput->getLastText().toInt()) {
_portInput->setText(qsl("80"));
_portInput->updatePlaceholder();
}
}
update();

View File

@@ -75,13 +75,13 @@ void PasscodeBox::init() {
if (_turningOff) {
_oldPasscode->show();
setTitleText(lang(_cloudPwd ? lng_cloud_password_remove : lng_passcode_remove));
setMaxHeight(titleHeight() + 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());
setMaxHeight(titleHeight() + st::passcodePadding.top() + _oldPasscode->height() + st::passcodeTextLine + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeTextLine : 0) + _aboutHeight + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton->height() + st::boxButtonPadding.bottom());
} else {
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
if (has) {
_oldPasscode->show();
setTitleText(lang(_cloudPwd ? lng_cloud_password_change : lng_passcode_change));
setMaxHeight(titleHeight() + 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());
setMaxHeight(titleHeight() + st::passcodePadding.top() + _oldPasscode->height() + st::passcodeTextLine + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeTextLine : 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();
setTitleText(lang(_cloudPwd ? lng_cloud_password_create : lng_passcode_create));
@@ -160,27 +160,27 @@ void PasscodeBox::paintEvent(QPaintEvent *e) {
textstyleSet(&st::usernameTextStyle);
int32 w = st::boxWidth - st::boxPadding.left() * 1.5;
int32 abouty = (_passwordHint->isHidden() ? (_reenterPasscode->isHidden() ? (_oldPasscode->y() + (_hasRecovery && !_hintText.isEmpty() ? st::passcodeSkip : 0)) : _reenterPasscode->y()) + st::passcodeSkip : _passwordHint->y() + st::contactSkip) + _oldPasscode->height();
int32 abouty = (_passwordHint->isHidden() ? (_reenterPasscode->isHidden() ? (_oldPasscode->y() + (_hasRecovery && !_hintText.isEmpty() ? st::passcodeTextLine : 0)) : _reenterPasscode->y()) + st::passcodeSkip : _passwordHint->y() + st::contactSkip) + _oldPasscode->height() + st::passcodePadding.bottom();
p.setPen(st::boxTextFg);
_about.drawLeft(p, st::boxPadding.left(), abouty, w, width());
if (!_hintText.isEmpty() && _oldError.isEmpty()) {
_hintText.drawLeftElided(p, st::boxPadding.left(), _oldPasscode->y() + _oldPasscode->height() + ((st::passcodeSkip - st::normalFont->height) / 2), w, width(), 1, style::al_topleft);
_hintText.drawLeftElided(p, st::boxPadding.left(), _oldPasscode->y() + _oldPasscode->height() + ((st::passcodeTextLine - st::normalFont->height) / 2), w, width(), 1, style::al_topleft);
}
if (!_oldError.isEmpty()) {
p.setPen(st::boxTextFgError);
p.drawText(QRect(st::boxPadding.left(), _oldPasscode->y() + _oldPasscode->height(), w, st::passcodeSkip), _oldError, style::al_left);
p.drawText(QRect(st::boxPadding.left(), _oldPasscode->y() + _oldPasscode->height(), w, st::passcodeTextLine), _oldError, style::al_left);
}
if (!_newError.isEmpty()) {
p.setPen(st::boxTextFgError);
p.drawText(QRect(st::boxPadding.left(), _reenterPasscode->y() + _reenterPasscode->height(), w, st::passcodeSkip), _newError, style::al_left);
p.drawText(QRect(st::boxPadding.left(), _reenterPasscode->y() + _reenterPasscode->height(), w, st::passcodeTextLine), _newError, style::al_left);
}
if (!_emailError.isEmpty()) {
p.setPen(st::boxTextFgError);
p.drawText(QRect(st::boxPadding.left(), _recoverEmail->y() + _recoverEmail->height(), w, st::passcodeSkip), _emailError, style::al_left);
p.drawText(QRect(st::boxPadding.left(), _recoverEmail->y() + _recoverEmail->height(), w, st::passcodeTextLine), _emailError, style::al_left);
}
textstyleRestore();
@@ -192,7 +192,7 @@ void PasscodeBox::resizeEvent(QResizeEvent *e) {
_oldPasscode->resize(w, _oldPasscode->height());
_oldPasscode->moveToLeft(st::boxPadding.left(), titleHeight() + st::passcodePadding.top());
_newPasscode->resize(w, _newPasscode->height());
_newPasscode->moveToLeft(st::boxPadding.left(), _oldPasscode->y() + ((_turningOff || has) ? (_oldPasscode->height() + st::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0)) : 0));
_newPasscode->moveToLeft(st::boxPadding.left(), _oldPasscode->y() + ((_turningOff || has) ? (_oldPasscode->height() + st::passcodeTextLine + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeTextLine : 0)) : 0));
_reenterPasscode->resize(w, _reenterPasscode->height());
_reenterPasscode->moveToLeft(st::boxPadding.left(), _newPasscode->y() + _newPasscode->height() + st::contactSkip);
_passwordHint->resize(w, _passwordHint->height());
@@ -201,7 +201,7 @@ void PasscodeBox::resizeEvent(QResizeEvent *e) {
_recoverEmail->moveToLeft(st::boxPadding.left(), _passwordHint->y() + _passwordHint->height() + st::contactSkip + _aboutHeight + st::contactSkip);
if (!_recover->isHidden()) {
_recover->moveToLeft(st::boxPadding.left(), _oldPasscode->y() + _oldPasscode->height() + (_hintText.isEmpty() ? ((st::passcodeSkip - _recover->height()) / 2) : st::passcodeSkip));
_recover->moveToLeft(st::boxPadding.left(), _oldPasscode->y() + _oldPasscode->height() + (_hintText.isEmpty() ? ((st::passcodeTextLine - _recover->height()) / 2) : st::passcodeTextLine));
}
_saveButton->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _saveButton->height());
@@ -455,7 +455,7 @@ RecoverBox::RecoverBox(const QString &pattern) : AbstractBox(st::boxWidth, lang(
, _recoverCode(this, st::defaultInputField, lang(lng_signin_code)) {
setBlockTitle(true);
setMaxHeight(titleHeight() + st::passcodePadding.top() + st::passcodeSkip + _recoverCode->height() + st::passcodeSkip + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton->height() + st::boxButtonPadding.bottom());
setMaxHeight(titleHeight() + st::passcodePadding.top() + st::passcodePadding.bottom() + st::passcodeTextLine + _recoverCode->height() + st::passcodeTextLine + st::boxButtonPadding.top() + _saveButton->height() + st::boxButtonPadding.bottom());
connect(_saveButton, SIGNAL(clicked()), this, SLOT(onSubmit()));
connect(_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
@@ -474,17 +474,17 @@ void RecoverBox::paintEvent(QPaintEvent *e) {
p.setFont(st::normalFont);
p.setPen(st::boxTextFg);
int32 w = st::boxWidth - st::boxPadding.left() * 1.5;
p.drawText(QRect(st::boxPadding.left(), _recoverCode->y() - st::passcodeSkip - st::passcodePadding.top(), w, st::passcodePadding.top() + st::passcodeSkip), _pattern, style::al_left);
p.drawText(QRect(st::boxPadding.left(), _recoverCode->y() - st::passcodeTextLine - st::passcodePadding.top(), w, st::passcodePadding.top() + st::passcodeTextLine), _pattern, style::al_left);
if (!_error.isEmpty()) {
p.setPen(st::boxTextFgError);
p.drawText(QRect(st::boxPadding.left(), _recoverCode->y() + _recoverCode->height(), w, st::passcodeSkip), _error, style::al_left);
p.drawText(QRect(st::boxPadding.left(), _recoverCode->y() + _recoverCode->height(), w, st::passcodeTextLine), _error, style::al_left);
}
}
void RecoverBox::resizeEvent(QResizeEvent *e) {
_recoverCode->resize(st::boxWidth - st::boxPadding.left() - st::boxPadding.right(), _recoverCode->height());
_recoverCode->moveToLeft(st::boxPadding.left(), titleHeight() + st::passcodePadding.top() + st::passcodeSkip);
_recoverCode->moveToLeft(st::boxPadding.left(), titleHeight() + st::passcodePadding.top() + st::passcodePadding.bottom() + st::passcodeTextLine);
_saveButton->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _saveButton->height());
_cancelButton->moveToRight(st::boxButtonPadding.right() + _saveButton->width() + st::boxButtonPadding.left(), _saveButton->y());

View File

@@ -71,7 +71,7 @@ void ReportBox::onChange() {
if (!_reasonOtherText) {
_reasonOtherText.create(this, st::profileReportReasonOther, lang(lng_report_reason_description));
_reasonOtherText->show();
_reasonOtherText->setCtrlEnterSubmit(Ui::CtrlEnterSubmitBoth);
_reasonOtherText->setCtrlEnterSubmit(Ui::CtrlEnterSubmit::Both);
_reasonOtherText->setMaxLength(MaxPhotoCaption);
_reasonOtherText->resize(width() - (st::boxPadding.left() + st::boxOptionListPadding.left() + st::boxPadding.right()), _reasonOtherText->height());

View File

@@ -157,7 +157,7 @@ void SendFilesBox::setup() {
}
if (_caption) {
_caption->setMaxLength(MaxPhotoCaption);
_caption->setCtrlEnterSubmit(Ui::CtrlEnterSubmitBoth);
_caption->setCtrlEnterSubmit(Ui::CtrlEnterSubmit::Both);
connect(_caption, SIGNAL(resized()), this, SLOT(onCaptionResized()));
connect(_caption, SIGNAL(submitted(bool)), this, SLOT(onSend(bool)));
connect(_caption, SIGNAL(cancelled()), this, SLOT(onClose()));
@@ -484,13 +484,13 @@ EditCaptionBox::EditCaptionBox(HistoryItem *msg) : AbstractBox(st::boxWideWidth)
if (_animated || _photo || _doc) {
_field.create(this, st::confirmCaptionArea, lang(lng_photo_caption), caption);
_field->setMaxLength(MaxPhotoCaption);
_field->setCtrlEnterSubmit(Ui::CtrlEnterSubmitBoth);
_field->setCtrlEnterSubmit(Ui::CtrlEnterSubmit::Both);
} else {
auto original = msg->originalText();
QString text = textApplyEntities(original.text, original.entities);
_field.create(this, st::editTextArea, lang(lng_photo_caption), text);
// _field->setMaxLength(MaxMessageSize); // entities can make text in input field larger but still valid
_field->setCtrlEnterSubmit(cCtrlEnter() ? Ui::CtrlEnterSubmitCtrlEnter : Ui::CtrlEnterSubmitEnter);
_field->setCtrlEnterSubmit(cCtrlEnter() ? Ui::CtrlEnterSubmit::CtrlEnter : Ui::CtrlEnterSubmit::Enter);
}
updateBoxSize();
connect(_field, SIGNAL(submitted(bool)), this, SLOT(onSave(bool)));
@@ -547,7 +547,7 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
auto icon = &st::historyFileInPlay;
icon->paintInCenter(p, inner);
}

View File

@@ -29,13 +29,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/widgets/input_fields.h"
#include "styles/style_boxes.h"
UsernameBox::UsernameBox() : AbstractBox(st::boxWidth, lang(lng_username_title)),
_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::boxLinkButton),
_saveRequestId(0), _checkRequestId(0),
_about(st::boxWidth - st::usernamePadding.left()) {
UsernameBox::UsernameBox() : AbstractBox(st::boxWidth, lang(lng_username_title))
, _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::boxLinkButton)
, _about(st::boxWidth - st::usernamePadding.left()) {
setBlockTitle(true);
_goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available);

View File

@@ -63,7 +63,8 @@ private:
ChildWidget<Ui::UsernameInput> _username;
ChildWidget<Ui::LinkButton> _link;
mtpRequestId _saveRequestId, _checkRequestId;
mtpRequestId _saveRequestId = 0;
mtpRequestId _checkRequestId = 0;
QString _sentUsername, _checkUsername, _errorText, _goodText, _copiedTextLink;
Text _about;