Buttons moved to ui/widgets/buttons module, BoxButton removed.

This commit is contained in:
John Preston 2016-11-11 16:46:04 +03:00
parent d4d1d438be
commit 807bebb3cf
133 changed files with 1300 additions and 1508 deletions

View file

@ -83,18 +83,6 @@ attentionBoxButton: RoundButton(defaultBoxButton) {
textBgOver: #fff0ed; textBgOver: #fff0ed;
} }
boxButtonPadding: margins(12px, 16px, 22px, 16px); boxButtonPadding: margins(12px, 16px, 22px, 16px);
defaultBoxLinkButton: linkButton {
color: #0080c0;
overColor: #0080c0;
downColor: #0073ad;
font: boxTextFont;
overFont: font(boxFontSize underline);
}
redBoxLinkButton: linkButton(defaultBoxLinkButton) {
color: #d15948;
overColor: #d15948;
downColor: #db6352;
}
boxLabel: flatLabel(labelDefFlat) { boxLabel: flatLabel(labelDefFlat) {
font: font(boxFontSize); font: font(boxFontSize);
align: align(topleft); align: align(topleft);
@ -290,13 +278,6 @@ btnNoHover: #777777;
linkCropLimit: 360px; linkCropLimit: 360px;
linkFont: normalFont; linkFont: normalFont;
linkOverFont: font(fsize underline); linkOverFont: font(fsize underline);
btnDefLink: linkButton {
color: btnYesColor;
overColor: btnYesColor;
downColor: btnYesHover;
font: linkFont;
overFont: linkOverFont;
}
inpDefFont: font(17px); inpDefFont: font(17px);
inpDefFlat: flatInput { inpDefFlat: flatInput {
@ -368,11 +349,6 @@ boxShadow: icon {{ "box_shadow", windowShadowFg }};
boxShadowShift: 2px; boxShadowShift: 2px;
btnSelectSep: #e0e0e0; btnSelectSep: #e0e0e0;
btnRedLink: linkButton(btnDefLink) {
color: #d15948;
overColor: #d15948;
downColor: #db6352;
}
countryRowHeight: 36px; countryRowHeight: 36px;
countryRowNameFont: semiboldFont; countryRowNameFont: semiboldFont;
@ -699,41 +675,6 @@ historyScroll: flatScroll(scrollDef) {
} }
textRectMargins: margins(-2px, -1px, -2px, -1px); textRectMargins: margins(-2px, -1px, -2px, -1px);
reportSpamHide: flatButton {
duration: 200;
cursor: cursor(pointer);
color: btnYesColor;
overColor: btnYesHover;
bgColor: transparent;
overBgColor: transparent;
width: -40px;
height: 46px;
textTop: 15px;
overTextTop: 15px;
downTextTop: 16px;
font: font(fsize);
overFont: font(fsize underline);
}
reportSpamButton: flatButton(reportSpamHide) {
textTop: 6px;
overTextTop: 6px;
downTextTop: 7px;
width: -50px;
height: 30px;
bgColor: #888888;
overBgColor: #7b7b7b;
}
reportSpamSeparator: 30px;
reportSpamBg: #fffffff0;
reportSpamFg: #000000;
newMsgSound: ":/gui/art/newmsg.wav"; newMsgSound: ":/gui/art/newmsg.wav";
unreadBarHeight: 32px; unreadBarHeight: 32px;
@ -798,25 +739,6 @@ connectionPasswordInputField: InputField(defaultInputField) {
} }
connectionIPv6Skip: 11px; connectionIPv6Skip: 11px;
aboutIcon: icon {{ "intro_logo", #008ed5 }};
aboutWidth: 390px;
aboutVersionTop: -3px;
aboutVersionLink: linkButton(btnDefLink) {
color: #999999;
overColor: #999999;
downColor: #999999;
}
aboutTextTop: 34px;
aboutSkip: 14px;
aboutLabel: flatLabel(labelDefFlat) {
font: normalFont;
width: 330px;
align: align(topleft);
}
aboutTextStyle: textStyle(defaultTextStyle) {
lineHeight: 22px;
}
emojiTextFont: font(15px); emojiTextFont: font(15px);
emojiReplaceWidth: 52px; emojiReplaceWidth: 52px;
emojiReplaceHeight: 56px; emojiReplaceHeight: 56px;

View file

@ -30,34 +30,6 @@ textStyle {
lineHeight: pixels; lineHeight: pixels;
} }
linkButton {
color: color;
overColor: color;
downColor: color;
font: font;
overFont: font;
}
flatButton {
color: color;
overColor: color;
bgColor: color;
overBgColor: color;
width: pixels;
height: pixels;
textTop: pixels;
overTextTop: pixels;
downTextTop: pixels;
font: font;
overFont: font;
duration: int;
cursor: cursor;
}
flatInput { flatInput {
textColor: color; textColor: color;
bgColor: color; bgColor: color;

View file

@ -27,6 +27,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "autoupdater.h" #include "autoupdater.h"
#include "boxes/confirmbox.h" #include "boxes/confirmbox.h"
#include "application.h" #include "application.h"
#include "ui/widgets/buttons.h"
#include "styles/style_boxes.h"
AboutBox::AboutBox() : AbstractBox(st::aboutWidth) AboutBox::AboutBox() : AbstractBox(st::aboutWidth)
, _version(this, lng_about_version(lt_version, QString::fromLatin1(AppVersionStr.c_str()) + (cAlphaVersion() ? " alpha" : "") + (cBetaVersion() ? qsl(" beta %1").arg(cBetaVersion()) : QString())), st::aboutVersionLink) , _version(this, lng_about_version(lt_version, QString::fromLatin1(AppVersionStr.c_str()) + (cAlphaVersion() ? " alpha" : "") + (cBetaVersion() ? qsl(" beta %1").arg(cBetaVersion()) : QString())), st::aboutVersionLink)
@ -34,12 +36,12 @@ AboutBox::AboutBox() : AbstractBox(st::aboutWidth)
, _text2(this, lang(lng_about_text_2), FlatLabel::InitType::Rich, st::aboutLabel, st::aboutTextStyle) , _text2(this, lang(lng_about_text_2), FlatLabel::InitType::Rich, st::aboutLabel, st::aboutTextStyle)
, _text3(this,st::aboutLabel, st::aboutTextStyle) , _text3(this,st::aboutLabel, st::aboutTextStyle)
, _done(this, lang(lng_close), st::defaultBoxButton) { , _done(this, lang(lng_close), st::defaultBoxButton) {
_text3.setRichText(lng_about_text_3(lt_faq_open, qsl("[a href=\"%1\"]").arg(telegramFaqLink()), lt_faq_close, qsl("[/a]"))); _text3->setRichText(lng_about_text_3(lt_faq_open, qsl("[a href=\"%1\"]").arg(telegramFaqLink()), lt_faq_close, qsl("[/a]")));
setMaxHeight(titleHeight() + st::aboutTextTop + _text1.height() + st::aboutSkip + _text2.height() + st::aboutSkip + _text3.height() + st::boxButtonPadding.top() + _done.height() + st::boxButtonPadding.bottom()); setMaxHeight(titleHeight() + st::aboutTextTop + _text1->height() + st::aboutSkip + _text2->height() + st::aboutSkip + _text3->height() + st::boxButtonPadding.top() + _done->height() + st::boxButtonPadding.bottom());
connect(&_version, SIGNAL(clicked()), this, SLOT(onVersion())); connect(_version, SIGNAL(clicked()), this, SLOT(onVersion()));
connect(&_done, SIGNAL(clicked()), this, SLOT(onClose())); connect(_done, SIGNAL(clicked()), this, SLOT(onClose()));
prepare(); prepare();
@ -47,19 +49,19 @@ AboutBox::AboutBox() : AbstractBox(st::aboutWidth)
} }
void AboutBox::showAll() { void AboutBox::showAll() {
_version.show(); _version->show();
_text1.show(); _text1->show();
_text2.show(); _text2->show();
_text3.show(); _text3->show();
_done.show(); _done->show();
} }
void AboutBox::resizeEvent(QResizeEvent *e) { void AboutBox::resizeEvent(QResizeEvent *e) {
_version.moveToLeft(st::boxPadding.left(), titleHeight() + st::aboutVersionTop); _version->moveToLeft(st::boxPadding.left(), titleHeight() + st::aboutVersionTop);
_text1.moveToLeft(st::boxPadding.left(), titleHeight() + st::aboutTextTop); _text1->moveToLeft(st::boxPadding.left(), titleHeight() + st::aboutTextTop);
_text2.moveToLeft(st::boxPadding.left(), _text1.y() + _text1.height() + st::aboutSkip); _text2->moveToLeft(st::boxPadding.left(), _text1->y() + _text1->height() + st::aboutSkip);
_text3.moveToLeft(st::boxPadding.left(), _text2.y() + _text2.height() + st::aboutSkip); _text3->moveToLeft(st::boxPadding.left(), _text2->y() + _text2->height() + st::aboutSkip);
_done.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done.height()); _done->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done->height());
AbstractBox::resizeEvent(e); AbstractBox::resizeEvent(e);
} }

View file

@ -23,6 +23,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "abstractbox.h" #include "abstractbox.h"
#include "ui/flatlabel.h" #include "ui/flatlabel.h"
namespace Ui {
class RoundButton;
class LinkButton;
} // namespace Ui
class AboutBox : public AbstractBox { class AboutBox : public AbstractBox {
Q_OBJECT Q_OBJECT
@ -42,9 +47,11 @@ protected:
void showAll() override; void showAll() override;
private: private:
LinkButton _version; ChildWidget<Ui::LinkButton> _version;
FlatLabel _text1, _text2, _text3; ChildWidget<FlatLabel> _text1;
BoxButton _done; ChildWidget<FlatLabel> _text2;
ChildWidget<FlatLabel> _text3;
ChildWidget<Ui::RoundButton> _done;
}; };

View file

@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "localstorage.h" #include "localstorage.h"
#include "lang.h" #include "lang.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "mainwindow.h" #include "mainwindow.h"

View file

@ -29,7 +29,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/confirmbox.h" #include "boxes/confirmbox.h"
#include "boxes/photocropbox.h" #include "boxes/photocropbox.h"
#include "ui/filedialog.h" #include "ui/filedialog.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "apiwrap.h" #include "apiwrap.h"
@ -627,7 +628,7 @@ void SetupChannelBox::paintEvent(QPaintEvent *e) {
QTextOption option(style::al_left); QTextOption option(style::al_left);
option.setWrapMode(QTextOption::WrapAnywhere); option.setWrapMode(QTextOption::WrapAnywhere);
p.setFont(_linkOver ? st::boxTextFont->underline() : st::boxTextFont); p.setFont(_linkOver ? st::boxTextFont->underline() : st::boxTextFont);
p.setPen(st::btnDefLink.color); p.setPen(st::defaultLinkButton.color);
p.drawText(_invitationLink, _channel->inviteLink(), option); p.drawText(_invitationLink, _channel->inviteLink(), option);
if (!_goodTextLink.isEmpty() && a_goodOpacity.current() > 0) { if (!_goodTextLink.isEmpty() && a_goodOpacity.current() > 0) {
p.setOpacity(a_goodOpacity.current()); p.setOpacity(a_goodOpacity.current());
@ -1085,7 +1086,7 @@ EditChannelBox::EditChannelBox(ChannelData *channel) : AbstractBox()
, _title(this, st::defaultInputField, lang(lng_dlg_new_channel_name), _channel->name) , _title(this, st::defaultInputField, lang(lng_dlg_new_channel_name), _channel->name)
, _description(this, st::newGroupDescription, lang(lng_create_group_description), _channel->about()) , _description(this, st::newGroupDescription, lang(lng_create_group_description), _channel->about())
, _sign(this, lang(lng_edit_sign_messages), channel->addsSignature(), st::defaultBoxCheckbox) , _sign(this, lang(lng_edit_sign_messages), channel->addsSignature(), st::defaultBoxCheckbox)
, _publicLink(this, lang(channel->isPublic() ? lng_profile_edit_public_link : lng_profile_create_public_link), st::defaultBoxLinkButton) , _publicLink(this, lang(channel->isPublic() ? lng_profile_edit_public_link : lng_profile_create_public_link), st::boxLinkButton)
, _save(this, lang(lng_settings_save), st::defaultBoxButton) , _save(this, lang(lng_settings_save), st::defaultBoxButton)
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) { , _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
connect(App::main(), SIGNAL(peerNameChanged(PeerData*,const PeerData::Names&,const PeerData::NameFirstChars&)), this, SLOT(peerUpdated(PeerData*))); connect(App::main(), SIGNAL(peerNameChanged(PeerData*,const PeerData::Names&,const PeerData::NameFirstChars&)), this, SLOT(peerUpdated(PeerData*)));
@ -1404,7 +1405,7 @@ void RevokePublicLinkBox::paintChat(Painter &p, const ChatRow &row, bool selecte
row.name.drawLeftElided(p, namex, st::contactsPadding.top() + st::contactsNameTop, namew, width()); row.name.drawLeftElided(p, namex, st::contactsPadding.top() + st::contactsNameTop, namew, width());
p.setFont(selected ? st::linkOverFont : st::linkFont); p.setFont(selected ? st::linkOverFont : st::linkFont);
p.setPen(pressed ? st::btnDefLink.downColor : st::btnDefLink.color->p); p.setPen(pressed ? st::defaultLinkButton.downColor : st::defaultLinkButton.color);
p.drawTextRight(st::contactsPadding.right() + st::contactsCheckPosition.x(), st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, width(), lang(lng_channels_too_much_public_revoke), _revokeWidth); p.drawTextRight(st::contactsPadding.right() + st::contactsCheckPosition.x(), st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, width(), lang(lng_channels_too_much_public_revoke), _revokeWidth);
p.setPen(st::contactsStatusFg); p.setPen(st::contactsStatusFg);

View file

@ -30,6 +30,8 @@ class ConfirmBox;
namespace Ui { namespace Ui {
class Checkbox; class Checkbox;
class Radiobutton; class Radiobutton;
class LinkButton;
class RoundButton;
} // namespace Ui } // namespace Ui
class AddContactBox : public AbstractBox, public RPCSender { class AddContactBox : public AbstractBox, public RPCSender {
@ -66,9 +68,9 @@ private:
ChildWidget<InputField> _last; ChildWidget<InputField> _last;
ChildWidget<PhoneInput> _phone; ChildWidget<PhoneInput> _phone;
ChildWidget<BoxButton> _save; ChildWidget<Ui::RoundButton> _save;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
ChildWidget<BoxButton> _retry; ChildWidget<Ui::RoundButton> _retry;
bool _invertOrder; bool _invertOrder;
@ -123,8 +125,8 @@ private:
QImage _photoBig; QImage _photoBig;
QPixmap _photoSmall; QPixmap _photoSmall;
ChildWidget<BoxButton> _next; ChildWidget<Ui::RoundButton> _next;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
// channel creation // channel creation
int32 _creationRequestId; int32 _creationRequestId;
@ -190,8 +192,8 @@ private:
QRect _invitationLink; QRect _invitationLink;
bool _linkOver; bool _linkOver;
ChildWidget<BoxButton> _save; ChildWidget<Ui::RoundButton> _save;
ChildWidget<BoxButton> _skip; ChildWidget<Ui::RoundButton> _skip;
bool _tooMuchUsernames = false; bool _tooMuchUsernames = false;
@ -237,8 +239,8 @@ private:
ChildWidget<InputField> _first; ChildWidget<InputField> _first;
ChildWidget<InputField> _last; ChildWidget<InputField> _last;
ChildWidget<BoxButton> _save; ChildWidget<Ui::RoundButton> _save;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
bool _invertOrder = false; bool _invertOrder = false;
@ -285,10 +287,10 @@ private:
ChildWidget<InputArea> _description; ChildWidget<InputArea> _description;
ChildWidget<Ui::Checkbox> _sign; ChildWidget<Ui::Checkbox> _sign;
ChildWidget<LinkButton> _publicLink; ChildWidget<Ui::LinkButton> _publicLink;
ChildWidget<BoxButton> _save; ChildWidget<Ui::RoundButton> _save;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
mtpRequestId _saveTitleRequestId = 0; mtpRequestId _saveTitleRequestId = 0;
mtpRequestId _saveDescriptionRequestId = 0; mtpRequestId _saveDescriptionRequestId = 0;
@ -337,7 +339,7 @@ private:
int _revokeWidth = 0; int _revokeWidth = 0;
ChildWidget<FlatLabel> _aboutRevoke; ChildWidget<FlatLabel> _aboutRevoke;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
base::lambda_unique<void()> _revokeCallback; base::lambda_unique<void()> _revokeCallback;
mtpRequestId _revokeRequestId = 0; mtpRequestId _revokeRequestId = 0;

View file

@ -26,7 +26,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/confirmbox.h" #include "boxes/confirmbox.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
AutoLockBox::AutoLockBox() : AutoLockBox::AutoLockBox() :
_close(this, lang(lng_box_ok), st::defaultBoxButton) { _close(this, lang(lng_box_ok), st::defaultBoxButton) {
@ -35,7 +36,7 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) {
int32 opts[] = { 60, 300, 3600, 18000 }, cnt = sizeof(opts) / sizeof(opts[0]); int32 opts[] = { 60, 300, 3600, 18000 }, cnt = sizeof(opts) / sizeof(opts[0]);
resizeMaxHeight(st::langsWidth, titleHeight() + cnt * (st::boxOptionListPadding.top() + st::langsButton.height) + st::boxOptionListPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _close.height() + st::boxButtonPadding.bottom()); resizeMaxHeight(st::langsWidth, titleHeight() + cnt * (st::boxOptionListPadding.top() + st::langsButton.height) + st::boxOptionListPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _close->height() + st::boxButtonPadding.bottom());
int32 y = titleHeight() + st::boxOptionListPadding.top(); int32 y = titleHeight() + st::boxOptionListPadding.top();
_options.reserve(cnt); _options.reserve(cnt);
@ -47,14 +48,14 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) {
connect(_options.back(), SIGNAL(changed()), this, SLOT(onChange())); connect(_options.back(), SIGNAL(changed()), this, SLOT(onChange()));
} }
connect(&_close, SIGNAL(clicked()), this, SLOT(onClose())); connect(_close, SIGNAL(clicked()), this, SLOT(onClose()));
_close.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close.height()); _close->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close->height());
prepare(); prepare();
} }
void AutoLockBox::showAll() { void AutoLockBox::showAll() {
_close.show(); _close->show();
for (int32 i = 0, l = _options.size(); i < l; ++i) { for (int32 i = 0, l = _options.size(); i < l; ++i) {
_options[i]->show(); _options[i]->show();
} }

View file

@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Ui { namespace Ui {
class Radiobutton; class Radiobutton;
class RoundButton;
} // namespace Ui } // namespace Ui
class AutoLockBox : public AbstractBox { class AutoLockBox : public AbstractBox {
@ -42,6 +43,6 @@ protected:
private: private:
QVector<Ui::Radiobutton*> _options; QVector<Ui::Radiobutton*> _options;
BoxButton _close; ChildWidget<Ui::RoundButton> _close;
}; };

View file

@ -38,6 +38,14 @@ boxBlockTitleClose: IconButton(defaultIconButton) {
iconOver: boxBlockTitleCloseIconOver; iconOver: boxBlockTitleCloseIconOver;
} }
boxLinkButton: LinkButton {
color: #0080c0;
overColor: #0080c0;
downColor: #0073ad;
font: boxTextFont;
overFont: font(boxFontSize underline);
}
confirmInviteTitle: flatLabel(labelDefFlat) { confirmInviteTitle: flatLabel(labelDefFlat) {
font: font(16px semibold); font: font(16px semibold);
align: align(center); align: align(center);
@ -265,6 +273,11 @@ sessionTerminate: IconButton {
iconPosition: point(3px, 3px); iconPosition: point(3px, 3px);
iconPositionDown: point(3px, 4px); iconPositionDown: point(3px, 4px);
} }
sessionTerminateAllButton: LinkButton(boxLinkButton) {
color: #d15948;
overColor: #d15948;
downColor: #db6352;
}
passcodeHeaderFont: font(19px); passcodeHeaderFont: font(19px);
passcodeHeaderHeight: 80px; passcodeHeaderHeight: 80px;
@ -309,3 +322,21 @@ themeWarningHeight: 150px;
themeWarningShadow: boxShadow; themeWarningShadow: boxShadow;
themeWarningShadowShift: boxShadowShift; themeWarningShadowShift: boxShadowShift;
themeWarningTextTop: 60px; themeWarningTextTop: 60px;
aboutWidth: 390px;
aboutVersionTop: -3px;
aboutVersionLink: LinkButton(defaultLinkButton) {
color: #999999;
overColor: #999999;
downColor: #999999;
}
aboutTextTop: 34px;
aboutSkip: 14px;
aboutLabel: flatLabel(labelDefFlat) {
font: normalFont;
width: 330px;
align: align(topleft);
}
aboutTextStyle: textStyle(defaultTextStyle) {
lineHeight: 22px;
}

View file

@ -27,7 +27,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwindow.h" #include "mainwindow.h"
#include "apiwrap.h" #include "apiwrap.h"
#include "application.h" #include "application.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "core/click_handler_types.h" #include "core/click_handler_types.h"
#include "localstorage.h" #include "localstorage.h"
@ -282,7 +283,7 @@ void MaxInviteBox::paintEvent(QPaintEvent *e) {
QTextOption option(style::al_left); QTextOption option(style::al_left);
option.setWrapMode(QTextOption::WrapAnywhere); option.setWrapMode(QTextOption::WrapAnywhere);
p.setFont(_linkOver ? st::defaultInputField.font->underline() : st::defaultInputField.font); p.setFont(_linkOver ? st::defaultInputField.font->underline() : st::defaultInputField.font);
p.setPen(st::btnDefLink.color); p.setPen(st::defaultLinkButton.color);
p.drawText(_invitationLink, _link, option); p.drawText(_invitationLink, _link, option);
if (!_goodTextLink.isEmpty() && a_goodOpacity.current() > 0) { if (!_goodTextLink.isEmpty() && a_goodOpacity.current() > 0) {
p.setOpacity(a_goodOpacity.current()); p.setOpacity(a_goodOpacity.current());

View file

@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Ui { namespace Ui {
class Checkbox; class Checkbox;
class RoundButton;
} // namespace Ui } // namespace Ui
class InformBox; class InformBox;
@ -85,8 +86,8 @@ private:
QPoint _lastMousePos; QPoint _lastMousePos;
ChildWidget<BoxButton> _confirm; ChildWidget<Ui::RoundButton> _confirm;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
base::lambda_unique<void()> _confirmedCallback; base::lambda_unique<void()> _confirmedCallback;
@ -164,7 +165,7 @@ private:
void updateSelected(const QPoint &cursorGlobalPosition); void updateSelected(const QPoint &cursorGlobalPosition);
void step_good(float64 ms, bool timer); void step_good(float64 ms, bool timer);
ChildWidget<BoxButton> _close; ChildWidget<Ui::RoundButton> _close;
Text _text; Text _text;
int32 _textWidth, _textHeight; int32 _textWidth, _textHeight;
@ -205,8 +206,8 @@ private:
Text _text, _note; Text _text, _note;
int32 _textWidth, _textHeight; int32 _textWidth, _textHeight;
ChildWidget<BoxButton> _convert; ChildWidget<Ui::RoundButton> _convert;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
}; };
@ -234,8 +235,8 @@ private:
ChildWidget<FlatLabel> _text; ChildWidget<FlatLabel> _text;
ChildWidget<Ui::Checkbox> _notify; ChildWidget<Ui::Checkbox> _notify;
ChildWidget<BoxButton> _pin; ChildWidget<Ui::RoundButton> _pin;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
mtpRequestId _requestId = 0; mtpRequestId _requestId = 0;
@ -265,8 +266,8 @@ private:
ChildWidget<Ui::Checkbox> _reportSpam; ChildWidget<Ui::Checkbox> _reportSpam;
ChildWidget<Ui::Checkbox> _deleteAll; ChildWidget<Ui::Checkbox> _deleteAll;
ChildWidget<BoxButton> _delete; ChildWidget<Ui::RoundButton> _delete;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
}; };
@ -298,11 +299,13 @@ protected:
void showAll() override; void showAll() override;
private: private:
ChildWidget<FlatLabel> _title, _status; ChildWidget<FlatLabel> _title;
ChildWidget<FlatLabel> _status;
ImagePtr _photo; ImagePtr _photo;
QVector<UserData*> _participants; QVector<UserData*> _participants;
ChildWidget<BoxButton> _join, _cancel; ChildWidget<Ui::RoundButton> _join;
ChildWidget<Ui::RoundButton> _cancel;
int _userWidth = 0; int _userWidth = 0;
}; };

View file

@ -23,6 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "boxes/confirmbox.h" #include "boxes/confirmbox.h"
#include "ui/widgets/buttons.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "lang.h" #include "lang.h"
@ -107,8 +108,8 @@ void ConfirmPhoneBox::launch() {
_code = new InputField(this, st::confirmPhoneCodeField, lang(lng_code_ph)); _code = new InputField(this, st::confirmPhoneCodeField, lang(lng_code_ph));
_send = new BoxButton(this, lang(lng_confirm_phone_send), st::defaultBoxButton); _send.create(this, lang(lng_confirm_phone_send), st::defaultBoxButton);
_cancel = new BoxButton(this, lang(lng_cancel), st::cancelBoxButton); _cancel.create(this, lang(lng_cancel), st::cancelBoxButton);
setMaxHeight(titleHeight() + st::usernamePadding.top() + _code->height() + st::usernameSkip + _about->height() + st::usernameSkip + _send->height() + st::boxButtonPadding.bottom()); setMaxHeight(titleHeight() + st::usernamePadding.top() + _code->height() + st::usernameSkip + _about->height() + st::usernameSkip + _send->height() + st::boxButtonPadding.bottom());

View file

@ -24,6 +24,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
class FlatLabel; class FlatLabel;
namespace Ui {
class RoundButton;
} // namespace Ui
class ConfirmPhoneBox : public AbstractBox, public RPCSender { class ConfirmPhoneBox : public AbstractBox, public RPCSender {
Q_OBJECT Q_OBJECT
@ -90,8 +94,8 @@ private:
mtpRequestId _checkCodeRequestId = 0; mtpRequestId _checkCodeRequestId = 0;
ChildWidget<FlatLabel> _about = { nullptr }; ChildWidget<FlatLabel> _about = { nullptr };
ChildWidget<BoxButton> _send = { nullptr }; ChildWidget<Ui::RoundButton> _send = { nullptr };
ChildWidget<BoxButton> _cancel = { nullptr }; ChildWidget<Ui::RoundButton> _cancel = { nullptr };
ChildWidget<InputField> _code = { nullptr }; ChildWidget<InputField> _code = { nullptr };
// Flag for not calling onTextChanged() recursively. // Flag for not calling onTextChanged() recursively.

View file

@ -25,7 +25,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "localstorage.h" #include "localstorage.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "history/history_location_manager.h" #include "history/history_location_manager.h"
ConnectionBox::ConnectionBox() : AbstractBox(st::boxWidth) ConnectionBox::ConnectionBox() : AbstractBox(st::boxWidth)

View file

@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Ui { namespace Ui {
class Checkbox; class Checkbox;
class Radiobutton; class Radiobutton;
class RoundButton;
} // namespace Ui } // namespace Ui
class ConnectionBox : public AbstractBox { class ConnectionBox : public AbstractBox {
@ -55,8 +56,8 @@ private:
ChildWidget<Ui::Radiobutton> _tcpProxyRadio; ChildWidget<Ui::Radiobutton> _tcpProxyRadio;
ChildWidget<Ui::Checkbox> _tryIPv6; ChildWidget<Ui::Checkbox> _tryIPv6;
ChildWidget<BoxButton> _save; ChildWidget<Ui::RoundButton> _save;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
}; };
@ -86,7 +87,7 @@ private:
int _sectionHeight; int _sectionHeight;
ChildWidget<BoxButton> _save; ChildWidget<Ui::RoundButton> _save;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
}; };

View file

@ -30,8 +30,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwidget.h" #include "mainwidget.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "application.h" #include "application.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "ui/filedialog.h" #include "ui/filedialog.h"
#include "ui/widgets/multi_select.h" #include "ui/widgets/multi_select.h"
#include "ui/effects/widget_slide_wrap.h" #include "ui/effects/widget_slide_wrap.h"

View file

@ -31,6 +31,8 @@ class IndexedList;
} // namespace Dialogs } // namespace Dialogs
namespace Ui { namespace Ui {
class RoundButton;
class LinkButton;
class Checkbox; class Checkbox;
class MultiSelect; class MultiSelect;
template <typename Widget> template <typename Widget>
@ -93,8 +95,8 @@ private:
ChildWidget<Ui::WidgetSlideWrap<Ui::MultiSelect>> _select; ChildWidget<Ui::WidgetSlideWrap<Ui::MultiSelect>> _select;
ChildWidget<Ui::IconButton> _add = { nullptr }; ChildWidget<Ui::IconButton> _add = { nullptr };
ChildWidget<BoxButton> _next; ChildWidget<Ui::RoundButton> _next;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
MembersFilter _membersFilter; MembersFilter _membersFilter;
ChildWidget<ScrollableBoxShadow> _topShadow; ChildWidget<ScrollableBoxShadow> _topShadow;
@ -300,7 +302,7 @@ private:
int _byUsernameSel = -1; int _byUsernameSel = -1;
QPoint _lastMousePos; QPoint _lastMousePos;
ChildWidget<LinkButton> _addContactLnk; ChildWidget<Ui::LinkButton> _addContactLnk;
bool _saving = false; bool _saving = false;
bool _allAdminsChecked = false; bool _allAdminsChecked = false;

View file

@ -24,8 +24,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "lang.h" #include "lang.h"
#include "localstorage.h" #include "localstorage.h"
#include "ui/filedialog.h" #include "ui/filedialog.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "pspecific.h" #include "pspecific.h"
#include "styles/style_boxes.h"
DownloadPathBox::DownloadPathBox() : AbstractBox() DownloadPathBox::DownloadPathBox() : AbstractBox()
, _path(Global::DownloadPath()) , _path(Global::DownloadPath())
@ -33,7 +35,7 @@ DownloadPathBox::DownloadPathBox() : AbstractBox()
, _default(this, qsl("dir_type"), 0, lang(lng_download_path_default_radio), _path.isEmpty()) , _default(this, qsl("dir_type"), 0, lang(lng_download_path_default_radio), _path.isEmpty())
, _temp(this, qsl("dir_type"), 1, lang(lng_download_path_temp_radio), _path == qsl("tmp")) , _temp(this, qsl("dir_type"), 1, lang(lng_download_path_temp_radio), _path == qsl("tmp"))
, _dir(this, qsl("dir_type"), 2, lang(lng_download_path_dir_radio), !_path.isEmpty() && _path != qsl("tmp")) , _dir(this, qsl("dir_type"), 2, lang(lng_download_path_dir_radio), !_path.isEmpty() && _path != qsl("tmp"))
, _pathLink(this, QString(), st::defaultBoxLinkButton) , _pathLink(this, QString(), st::boxLinkButton)
, _save(this, lang(lng_connection_save), st::defaultBoxButton) , _save(this, lang(lng_connection_save), st::defaultBoxButton)
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) { , _cancel(this, lang(lng_cancel), st::cancelBoxButton) {

View file

@ -25,6 +25,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Ui { namespace Ui {
class Radiobutton; class Radiobutton;
class LinkButton;
class RoundButton;
} // namespace Ui } // namespace Ui
class DownloadPathBox : public AbstractBox { class DownloadPathBox : public AbstractBox {
@ -53,9 +55,9 @@ private:
ChildWidget<Ui::Radiobutton> _default; ChildWidget<Ui::Radiobutton> _default;
ChildWidget<Ui::Radiobutton> _temp; ChildWidget<Ui::Radiobutton> _temp;
ChildWidget<Ui::Radiobutton> _dir; ChildWidget<Ui::Radiobutton> _dir;
ChildWidget<LinkButton> _pathLink; ChildWidget<Ui::LinkButton> _pathLink;
ChildWidget<BoxButton> _save; ChildWidget<Ui::RoundButton> _save;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
}; };

View file

@ -22,7 +22,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/languagebox.h" #include "boxes/languagebox.h"
#include "lang.h" #include "lang.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "localstorage.h" #include "localstorage.h"
#include "boxes/confirmbox.h" #include "boxes/confirmbox.h"
#include "mainwidget.h" #include "mainwidget.h"
@ -56,16 +57,16 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) {
connect(_langs.back(), SIGNAL(changed()), this, SLOT(onChange())); connect(_langs.back(), SIGNAL(changed()), this, SLOT(onChange()));
} }
resizeMaxHeight(st::langsWidth, titleHeight() + (languageCount + (haveTestLang ? 1 : 0)) * (st::boxOptionListPadding.top() + st::langsButton.height) + st::boxOptionListPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _close.height() + st::boxButtonPadding.bottom()); resizeMaxHeight(st::langsWidth, titleHeight() + (languageCount + (haveTestLang ? 1 : 0)) * (st::boxOptionListPadding.top() + st::langsButton.height) + st::boxOptionListPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _close->height() + st::boxButtonPadding.bottom());
connect(&_close, SIGNAL(clicked()), this, SLOT(onClose())); connect(_close, SIGNAL(clicked()), this, SLOT(onClose()));
_close.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close.height()); _close->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close->height());
prepare(); prepare();
} }
void LanguageBox::showAll() { void LanguageBox::showAll() {
_close.show(); _close->show();
for (int32 i = 0, l = _langs.size(); i < l; ++i) { for (int32 i = 0, l = _langs.size(); i < l; ++i) {
_langs[i]->show(); _langs[i]->show();
} }

View file

@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Ui { namespace Ui {
class Radiobutton; class Radiobutton;
class RoundButton;
} // namespace Ui } // namespace Ui
class LanguageBox : public AbstractBox { class LanguageBox : public AbstractBox {
@ -45,6 +46,6 @@ protected:
private: private:
QVector<Ui::Radiobutton*> _langs; QVector<Ui::Radiobutton*> _langs;
BoxButton _close; ChildWidget<Ui::RoundButton> _close;
}; };

View file

@ -22,13 +22,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/localstoragebox.h" #include "boxes/localstoragebox.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "ui/widgets/buttons.h"
#include "localstorage.h" #include "localstorage.h"
#include "ui/flatbutton.h"
#include "lang.h" #include "lang.h"
#include "mainwindow.h" #include "mainwindow.h"
LocalStorageBox::LocalStorageBox() : AbstractBox() LocalStorageBox::LocalStorageBox() : AbstractBox()
, _clear(this, lang(lng_local_storage_clear), st::defaultBoxLinkButton) , _clear(this, lang(lng_local_storage_clear), st::boxLinkButton)
, _close(this, lang(lng_box_ok), st::defaultBoxButton) { , _close(this, lang(lng_box_ok), st::defaultBoxButton) {
connect(_clear, SIGNAL(clicked()), this, SLOT(onClear())); connect(_clear, SIGNAL(clicked()), this, SLOT(onClear()));
connect(_close, SIGNAL(clicked()), this, SLOT(onClose())); connect(_close, SIGNAL(clicked()), this, SLOT(onClose()));

View file

@ -22,8 +22,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "abstractbox.h" #include "abstractbox.h"
class BoxButton; namespace Ui {
class RoundButton;
class LinkButton; class LinkButton;
} // namespace Ui
class LocalStorageBox : public AbstractBox { class LocalStorageBox : public AbstractBox {
Q_OBJECT Q_OBJECT
@ -53,8 +55,8 @@ private:
}; };
State _state = State::Normal; State _state = State::Normal;
ChildWidget<LinkButton> _clear; ChildWidget<Ui::LinkButton> _clear;
ChildWidget<BoxButton> _close; ChildWidget<Ui::RoundButton> _close;
int _imagesCount = -1; int _imagesCount = -1;
int _audiosCount = -1; int _audiosCount = -1;

View file

@ -28,7 +28,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwindow.h" #include "mainwindow.h"
#include "boxes/contactsbox.h" #include "boxes/contactsbox.h"
#include "boxes/confirmbox.h" #include "boxes/confirmbox.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "observer_peer.h" #include "observer_peer.h"
MembersBox::MembersBox(ChannelData *channel, MembersFilter filter) : ItemListBox(st::boxScroll) MembersBox::MembersBox(ChannelData *channel, MembersFilter filter) : ItemListBox(st::boxScroll)
@ -248,11 +248,7 @@ void MembersBox::Inner::paintDialog(Painter &p, PeerData *peer, MemberData *data
if (data->canKick) { if (data->canKick) {
p.setFont((kickSel ? st::linkOverFont : st::linkFont)->f); p.setFont((kickSel ? st::linkOverFont : st::linkFont)->f);
if (kickDown) { p.setPen(kickDown ? st::defaultLinkButton.downColor : st::defaultLinkButton.color);
p.setPen(st::btnDefLink.downColor->p);
} else {
p.setPen(st::btnDefLink.color->p);
}
p.drawTextRight(st::contactsPadding.right() + st::contactsCheckPosition.x(), st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, width(), _kickText, _kickWidth); p.drawTextRight(st::contactsPadding.right() + st::contactsCheckPosition.x(), st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, width(), _kickText, _kickWidth);
} }

View file

@ -22,8 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/notifications_box.h" #include "boxes/notifications_box.h"
#include "lang.h" #include "lang.h"
#include "ui/buttons/round_button.h" #include "ui/widgets/buttons.h"
#include "ui/buttons/icon_button.h"
#include "ui/widgets/discrete_slider.h" #include "ui/widgets/discrete_slider.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_dialogs.h" #include "styles/style_dialogs.h"

View file

@ -22,10 +22,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "abstractbox.h" #include "abstractbox.h"
class BoxButton;
class LinkButton;
namespace Ui { namespace Ui {
class RoundButton;
class LinkButton;
class DiscreteSlider; class DiscreteSlider;
} // namespace Ui } // namespace Ui
@ -72,7 +71,7 @@ private:
int _oldCount; int _oldCount;
ChildWidget<Ui::DiscreteSlider> _countSlider; ChildWidget<Ui::DiscreteSlider> _countSlider;
ChildWidget<BoxButton> _done; ChildWidget<Ui::RoundButton> _done;
QVector<SampleWidget*> _cornerSamples[4]; QVector<SampleWidget*> _cornerSamples[4];

View file

@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwindow.h" #include "mainwindow.h"
#include "localstorage.h" #include "localstorage.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "ui/widgets/buttons.h"
PasscodeBox::PasscodeBox(bool turningOff) : AbstractBox(st::boxWidth) PasscodeBox::PasscodeBox(bool turningOff) : AbstractBox(st::boxWidth)
, _replacedBy(0) , _replacedBy(0)
@ -82,114 +83,114 @@ void PasscodeBox::init() {
_aboutHeight = _about.countHeight(st::boxWidth - st::boxPadding.left() * 1.5); _aboutHeight = _about.countHeight(st::boxWidth - st::boxPadding.left() * 1.5);
textstyleRestore(); textstyleRestore();
if (_turningOff) { if (_turningOff) {
_oldPasscode.show(); _oldPasscode->show();
_boxTitle = lang(_cloudPwd ? lng_cloud_password_remove : lng_passcode_remove); _boxTitle = 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::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0) + _aboutHeight + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton->height() + st::boxButtonPadding.bottom());
} else { } else {
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode(); bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
if (has) { if (has) {
_oldPasscode.show(); _oldPasscode->show();
_boxTitle = lang(_cloudPwd ? lng_cloud_password_change : lng_passcode_change); _boxTitle = 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::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 { } else {
_oldPasscode.hide(); _oldPasscode->hide();
_boxTitle = lang(_cloudPwd ? lng_cloud_password_create : lng_passcode_create); _boxTitle = lang(_cloudPwd ? lng_cloud_password_create : lng_passcode_create);
setMaxHeight(titleHeight() + 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()); setMaxHeight(titleHeight() + 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(_saveButton, SIGNAL(clicked()), this, SLOT(onSave()));
connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose())); connect(_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
connect(&_oldPasscode, SIGNAL(changed()), this, SLOT(onOldChanged())); connect(_oldPasscode, SIGNAL(changed()), this, SLOT(onOldChanged()));
connect(&_newPasscode, SIGNAL(changed()), this, SLOT(onNewChanged())); connect(_newPasscode, SIGNAL(changed()), this, SLOT(onNewChanged()));
connect(&_reenterPasscode, SIGNAL(changed()), this, SLOT(onNewChanged())); connect(_reenterPasscode, SIGNAL(changed()), this, SLOT(onNewChanged()));
connect(&_passwordHint, SIGNAL(changed()), this, SLOT(onNewChanged())); connect(_passwordHint, SIGNAL(changed()), this, SLOT(onNewChanged()));
connect(&_recoverEmail, SIGNAL(changed()), this, SLOT(onEmailChanged())); connect(_recoverEmail, SIGNAL(changed()), this, SLOT(onEmailChanged()));
connect(&_oldPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(_oldPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
connect(&_newPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(_newPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
connect(&_reenterPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(_reenterPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
connect(&_passwordHint, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(_passwordHint, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
connect(&_recoverEmail, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(_recoverEmail, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
connect(&_recover, SIGNAL(clicked()), this, SLOT(onRecoverByEmail())); connect(_recover, SIGNAL(clicked()), this, SLOT(onRecoverByEmail()));
} }
void PasscodeBox::showAll() { void PasscodeBox::showAll() {
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode(); bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
if (_turningOff) { if (_turningOff) {
_oldPasscode.show(); _oldPasscode->show();
if (_cloudPwd && _hasRecovery) { if (_cloudPwd && _hasRecovery) {
_recover.show(); _recover->show();
} else { } else {
_recover.hide(); _recover->hide();
} }
_newPasscode.hide(); _newPasscode->hide();
_reenterPasscode.hide(); _reenterPasscode->hide();
_passwordHint.hide(); _passwordHint->hide();
_recoverEmail.hide(); _recoverEmail->hide();
} else { } else {
if (has) { if (has) {
_oldPasscode.show(); _oldPasscode->show();
if (_cloudPwd && _hasRecovery) { if (_cloudPwd && _hasRecovery) {
_recover.show(); _recover->show();
} else { } else {
_recover.hide(); _recover->hide();
} }
} else { } else {
_oldPasscode.hide(); _oldPasscode->hide();
_recover.hide(); _recover->hide();
} }
_newPasscode.show(); _newPasscode->show();
_reenterPasscode.show(); _reenterPasscode->show();
if (_cloudPwd) { if (_cloudPwd) {
_passwordHint.show(); _passwordHint->show();
} else { } else {
_passwordHint.hide(); _passwordHint->hide();
} }
if (_cloudPwd && _curSalt.isEmpty()) { if (_cloudPwd && _curSalt.isEmpty()) {
_recoverEmail.show(); _recoverEmail->show();
} else { } else {
_recoverEmail.hide(); _recoverEmail->hide();
} }
} }
_saveButton.show(); _saveButton->show();
_cancelButton.show(); _cancelButton->show();
AbstractBox::showAll(); AbstractBox::showAll();
} }
void PasscodeBox::onSubmit() { void PasscodeBox::onSubmit() {
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode(); bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
if (_oldPasscode.hasFocus()) { if (_oldPasscode->hasFocus()) {
if (_turningOff) { if (_turningOff) {
onSave(); onSave();
} else { } else {
_newPasscode.setFocus(); _newPasscode->setFocus();
} }
} else if (_newPasscode.hasFocus()) { } else if (_newPasscode->hasFocus()) {
_reenterPasscode.setFocus(); _reenterPasscode->setFocus();
} else if (_reenterPasscode.hasFocus()) { } else if (_reenterPasscode->hasFocus()) {
if (has && _oldPasscode.text().isEmpty()) { if (has && _oldPasscode->text().isEmpty()) {
_oldPasscode.setFocus(); _oldPasscode->setFocus();
_oldPasscode.showError(); _oldPasscode->showError();
} else if (_newPasscode.text().isEmpty()) { } else if (_newPasscode->text().isEmpty()) {
_newPasscode.setFocus(); _newPasscode->setFocus();
_newPasscode.showError(); _newPasscode->showError();
} else if (_reenterPasscode.text().isEmpty()) { } else if (_reenterPasscode->text().isEmpty()) {
_reenterPasscode.showError(); _reenterPasscode->showError();
} else if (!_passwordHint.isHidden()) { } else if (!_passwordHint->isHidden()) {
_passwordHint.setFocus(); _passwordHint->setFocus();
} else { } else {
onSave(); onSave();
} }
} else if (_passwordHint.hasFocus()) { } else if (_passwordHint->hasFocus()) {
if (_recoverEmail.isHidden()) { if (_recoverEmail->isHidden()) {
onSave(); onSave();
} else { } else {
_recoverEmail.setFocus(); _recoverEmail->setFocus();
} }
} else if (_recoverEmail.hasFocus()) { } else if (_recoverEmail->hasFocus()) {
onSave(); onSave();
} }
} }
@ -203,27 +204,27 @@ void PasscodeBox::paintEvent(QPaintEvent *e) {
textstyleSet(&st::usernameTextStyle); textstyleSet(&st::usernameTextStyle);
int32 w = st::boxWidth - st::boxPadding.left() * 1.5; 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::passcodeSkip : 0)) : _reenterPasscode->y()) + st::passcodeSkip : _passwordHint->y() + st::contactSkip) + _oldPasscode->height();
p.setPen(st::boxTextFg); p.setPen(st::boxTextFg);
_about.drawLeft(p, st::boxPadding.left(), abouty, w, width()); _about.drawLeft(p, st::boxPadding.left(), abouty, w, width());
if (!_hintText.isEmpty() && _oldError.isEmpty()) { 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::passcodeSkip - st::normalFont->height) / 2), w, width(), 1, style::al_topleft);
} }
if (!_oldError.isEmpty()) { if (!_oldError.isEmpty()) {
p.setPen(st::boxTextFgError); 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::passcodeSkip), _oldError, style::al_left);
} }
if (!_newError.isEmpty()) { if (!_newError.isEmpty()) {
p.setPen(st::boxTextFgError); 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::passcodeSkip), _newError, style::al_left);
} }
if (!_emailError.isEmpty()) { if (!_emailError.isEmpty()) {
p.setPen(st::boxTextFgError); 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::passcodeSkip), _emailError, style::al_left);
} }
textstyleRestore(); textstyleRestore();
@ -232,57 +233,57 @@ void PasscodeBox::paintEvent(QPaintEvent *e) {
void PasscodeBox::resizeEvent(QResizeEvent *e) { void PasscodeBox::resizeEvent(QResizeEvent *e) {
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode(); bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
int32 w = st::boxWidth - st::boxPadding.left() - st::boxPadding.right(); int32 w = st::boxWidth - st::boxPadding.left() - st::boxPadding.right();
_oldPasscode.resize(w, _oldPasscode.height()); _oldPasscode->resize(w, _oldPasscode->height());
_oldPasscode.moveToLeft(st::boxPadding.left(), titleHeight() + st::passcodePadding.top()); _oldPasscode->moveToLeft(st::boxPadding.left(), titleHeight() + st::passcodePadding.top());
_newPasscode.resize(w, _newPasscode.height()); _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::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0)) : 0));
_reenterPasscode.resize(w, _reenterPasscode.height()); _reenterPasscode->resize(w, _reenterPasscode->height());
_reenterPasscode.moveToLeft(st::boxPadding.left(), _newPasscode.y() + _newPasscode.height() + st::contactSkip); _reenterPasscode->moveToLeft(st::boxPadding.left(), _newPasscode->y() + _newPasscode->height() + st::contactSkip);
_passwordHint.resize(w, _passwordHint.height()); _passwordHint->resize(w, _passwordHint->height());
_passwordHint.moveToLeft(st::boxPadding.left(), _reenterPasscode.y() + _reenterPasscode.height() + st::passcodeSkip); _passwordHint->moveToLeft(st::boxPadding.left(), _reenterPasscode->y() + _reenterPasscode->height() + st::passcodeSkip);
_recoverEmail.resize(w, _passwordHint.height()); _recoverEmail->resize(w, _passwordHint->height());
_recoverEmail.moveToLeft(st::boxPadding.left(), _passwordHint.y() + _passwordHint.height() + st::contactSkip + _aboutHeight + st::contactSkip); _recoverEmail->moveToLeft(st::boxPadding.left(), _passwordHint->y() + _passwordHint->height() + st::contactSkip + _aboutHeight + st::contactSkip);
if (!_recover.isHidden()) { 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::passcodeSkip - _recover->height()) / 2) : st::passcodeSkip));
} }
_saveButton.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _saveButton.height()); _saveButton->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _saveButton->height());
_cancelButton.moveToRight(st::boxButtonPadding.right() + _saveButton.width() + st::boxButtonPadding.left(), _saveButton.y()); _cancelButton->moveToRight(st::boxButtonPadding.right() + _saveButton->width() + st::boxButtonPadding.left(), _saveButton->y());
AbstractBox::resizeEvent(e); AbstractBox::resizeEvent(e);
} }
void PasscodeBox::doSetInnerFocus() { void PasscodeBox::doSetInnerFocus() {
if (_skipEmailWarning && !_recoverEmail.isHidden()) { if (_skipEmailWarning && !_recoverEmail->isHidden()) {
_recoverEmail.setFocus(); _recoverEmail->setFocus();
} else if (_oldPasscode.isHidden()) { } else if (_oldPasscode->isHidden()) {
_newPasscode.setFocus(); _newPasscode->setFocus();
} else { } else {
_oldPasscode.setFocus(); _oldPasscode->setFocus();
} }
} }
void PasscodeBox::setPasswordDone(const MTPBool &result) { void PasscodeBox::setPasswordDone(const MTPBool &result) {
_setRequest = 0; _setRequest = 0;
emit reloadPassword(); emit reloadPassword();
ConfirmBox *box = new InformBox(lang(_reenterPasscode.isHidden() ? lng_cloud_password_removed : (_oldPasscode.isHidden() ? lng_cloud_password_was_set : lng_cloud_password_updated))); ConfirmBox *box = new InformBox(lang(_reenterPasscode->isHidden() ? lng_cloud_password_removed : (_oldPasscode->isHidden() ? lng_cloud_password_was_set : lng_cloud_password_updated)));
Ui::showLayer(box); Ui::showLayer(box);
} }
bool PasscodeBox::setPasswordFail(const RPCError &error) { bool PasscodeBox::setPasswordFail(const RPCError &error) {
if (MTP::isFloodError(error)) { if (MTP::isFloodError(error)) {
if (_oldPasscode.isHidden()) return false; if (_oldPasscode->isHidden()) return false;
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose(); if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
_setRequest = 0; _setRequest = 0;
_oldPasscode.selectAll(); _oldPasscode->selectAll();
_oldPasscode.setFocus(); _oldPasscode->setFocus();
_oldPasscode.showError(); _oldPasscode->showError();
_oldError = lang(lng_flood_error); _oldError = lang(lng_flood_error);
if (_hasRecovery && _hintText.isEmpty()) { if (_hasRecovery && _hintText.isEmpty()) {
_recover.hide(); _recover->hide();
} }
update(); update();
return true; return true;
@ -293,15 +294,15 @@ bool PasscodeBox::setPasswordFail(const RPCError &error) {
_setRequest = 0; _setRequest = 0;
QString err = error.type(); QString err = error.type();
if (err == qstr("PASSWORD_HASH_INVALID")) { if (err == qstr("PASSWORD_HASH_INVALID")) {
if (_oldPasscode.isHidden()) { if (_oldPasscode->isHidden()) {
emit reloadPassword(); emit reloadPassword();
onClose(); onClose();
} else { } else {
onBadOldPasscode(); onBadOldPasscode();
} }
} else if (err == qstr("NEW_PASSWORD_BAD")) { } else if (err == qstr("NEW_PASSWORD_BAD")) {
_newPasscode.setFocus(); _newPasscode->setFocus();
_newPasscode.showError(); _newPasscode->showError();
_newError = lang(lng_cloud_password_bad); _newError = lang(lng_cloud_password_bad);
update(); update();
} else if (err == qstr("NEW_SALT_INVALID")) { } else if (err == qstr("NEW_SALT_INVALID")) {
@ -309,8 +310,8 @@ bool PasscodeBox::setPasswordFail(const RPCError &error) {
onClose(); onClose();
} else if (err == qstr("EMAIL_INVALID")) { } else if (err == qstr("EMAIL_INVALID")) {
_emailError = lang(lng_cloud_password_bad_email); _emailError = lang(lng_cloud_password_bad_email);
_recoverEmail.setFocus(); _recoverEmail->setFocus();
_recoverEmail.showError(); _recoverEmail->showError();
update(); update();
} else if (err == qstr("EMAIL_UNCONFIRMED")) { } else if (err == qstr("EMAIL_UNCONFIRMED")) {
Ui::showLayer(new InformBox(lang(lng_cloud_password_almost))); Ui::showLayer(new InformBox(lang(lng_cloud_password_almost)));
@ -322,13 +323,13 @@ bool PasscodeBox::setPasswordFail(const RPCError &error) {
void PasscodeBox::onSave(bool force) { void PasscodeBox::onSave(bool force) {
if (_setRequest) return; if (_setRequest) return;
QString old = _oldPasscode.text(), pwd = _newPasscode.text(), conf = _reenterPasscode.text(); QString old = _oldPasscode->text(), pwd = _newPasscode->text(), conf = _reenterPasscode->text();
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode(); bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
if (!_cloudPwd && (_turningOff || has)) { if (!_cloudPwd && (_turningOff || has)) {
if (!passcodeCanTry()) { if (!passcodeCanTry()) {
_oldError = lang(lng_flood_error); _oldError = lang(lng_flood_error);
_oldPasscode.setFocus(); _oldPasscode->setFocus();
_oldPasscode.showError(); _oldPasscode->showError();
update(); update();
return; return;
} }
@ -344,37 +345,37 @@ void PasscodeBox::onSave(bool force) {
} }
} }
if (!_turningOff && pwd.isEmpty()) { if (!_turningOff && pwd.isEmpty()) {
_newPasscode.setFocus(); _newPasscode->setFocus();
_newPasscode.showError(); _newPasscode->showError();
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose(); if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
return; return;
} }
if (pwd != conf) { if (pwd != conf) {
_reenterPasscode.selectAll(); _reenterPasscode->selectAll();
_reenterPasscode.setFocus(); _reenterPasscode->setFocus();
_reenterPasscode.showError(); _reenterPasscode->showError();
if (!conf.isEmpty()) { if (!conf.isEmpty()) {
_newError = lang(_cloudPwd ? lng_cloud_password_differ : lng_passcode_differ); _newError = lang(_cloudPwd ? lng_cloud_password_differ : lng_passcode_differ);
update(); update();
} }
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose(); if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
} else if (!_turningOff && has && old == pwd) { } else if (!_turningOff && has && old == pwd) {
_newPasscode.setFocus(); _newPasscode->setFocus();
_newPasscode.showError(); _newPasscode->showError();
_newError = lang(_cloudPwd ? lng_cloud_password_is_same : lng_passcode_is_same); _newError = lang(_cloudPwd ? lng_cloud_password_is_same : lng_passcode_is_same);
update(); update();
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose(); if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
} else if (_cloudPwd) { } else if (_cloudPwd) {
QString hint = _passwordHint.getLastText(), email = _recoverEmail.getLastText().trimmed(); QString hint = _passwordHint->getLastText(), email = _recoverEmail->getLastText().trimmed();
if (_cloudPwd && pwd == hint && !_passwordHint.isHidden() && !_newPasscode.isHidden()) { if (_cloudPwd && pwd == hint && !_passwordHint->isHidden() && !_newPasscode->isHidden()) {
_newPasscode.setFocus(); _newPasscode->setFocus();
_newPasscode.showError(); _newPasscode->showError();
_newError = lang(lng_cloud_password_bad); _newError = lang(lng_cloud_password_bad);
update(); update();
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose(); if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
return; return;
} }
if (!_recoverEmail.isHidden() && email.isEmpty() && !force) { if (!_recoverEmail->isHidden() && email.isEmpty() && !force) {
_skipEmailWarning = true; _skipEmailWarning = true;
_replacedBy = new ConfirmBox(lang(lng_cloud_password_about_recover), lang(lng_cloud_password_skip_email), st::attentionBoxButton); _replacedBy = new ConfirmBox(lang(lng_cloud_password_about_recover), lang(lng_cloud_password_skip_email), st::attentionBoxButton);
connect(_replacedBy, SIGNAL(confirmed()), this, SLOT(onForceNoMail())); connect(_replacedBy, SIGNAL(confirmed()), this, SLOT(onForceNoMail()));
@ -389,13 +390,13 @@ void PasscodeBox::onSave(bool force) {
} else { } else {
hashSha256(newPasswordData.constData(), newPasswordData.size(), newPasswordHash.data()); hashSha256(newPasswordData.constData(), newPasswordData.size(), newPasswordHash.data());
} }
QByteArray oldPasswordData = _oldPasscode.isHidden() ? QByteArray() : (_curSalt + old.toUtf8() + _curSalt); QByteArray oldPasswordData = _oldPasscode->isHidden() ? QByteArray() : (_curSalt + old.toUtf8() + _curSalt);
QByteArray oldPasswordHash = _oldPasscode.isHidden() ? QByteArray() : QByteArray(32, Qt::Uninitialized); QByteArray oldPasswordHash = _oldPasscode->isHidden() ? QByteArray() : QByteArray(32, Qt::Uninitialized);
if (!_oldPasscode.isHidden()) { if (!_oldPasscode->isHidden()) {
hashSha256(oldPasswordData.constData(), oldPasswordData.size(), oldPasswordHash.data()); hashSha256(oldPasswordData.constData(), oldPasswordData.size(), oldPasswordHash.data());
} }
MTPDaccount_passwordInputSettings::Flags flags = MTPDaccount_passwordInputSettings::Flag::f_new_salt | MTPDaccount_passwordInputSettings::Flag::f_new_password_hash | MTPDaccount_passwordInputSettings::Flag::f_hint; MTPDaccount_passwordInputSettings::Flags flags = MTPDaccount_passwordInputSettings::Flag::f_new_salt | MTPDaccount_passwordInputSettings::Flag::f_new_password_hash | MTPDaccount_passwordInputSettings::Flag::f_hint;
if (_oldPasscode.isHidden() || _newPasscode.isHidden()) { if (_oldPasscode->isHidden() || _newPasscode->isHidden()) {
flags |= MTPDaccount_passwordInputSettings::Flag::f_email; flags |= MTPDaccount_passwordInputSettings::Flag::f_email;
} }
MTPaccount_PasswordInputSettings settings(MTP_account_passwordInputSettings(MTP_flags(flags), MTP_bytes(_newSalt), MTP_bytes(newPasswordHash), MTP_string(hint), MTP_string(email))); MTPaccount_PasswordInputSettings settings(MTP_account_passwordInputSettings(MTP_flags(flags), MTP_bytes(_newSalt), MTP_bytes(newPasswordHash), MTP_string(hint), MTP_string(email)));
@ -410,12 +411,12 @@ void PasscodeBox::onSave(bool force) {
} }
void PasscodeBox::onBadOldPasscode() { void PasscodeBox::onBadOldPasscode() {
_oldPasscode.selectAll(); _oldPasscode->selectAll();
_oldPasscode.setFocus(); _oldPasscode->setFocus();
_oldPasscode.showError(); _oldPasscode->showError();
_oldError = lang(_cloudPwd ? lng_cloud_password_wrong : lng_passcode_wrong); _oldError = lang(_cloudPwd ? lng_cloud_password_wrong : lng_passcode_wrong);
if (_hasRecovery && _hintText.isEmpty()) { if (_hasRecovery && _hintText.isEmpty()) {
_recover.hide(); _recover->hide();
} }
update(); update();
} }
@ -424,7 +425,7 @@ void PasscodeBox::onOldChanged() {
if (!_oldError.isEmpty()) { if (!_oldError.isEmpty()) {
_oldError = QString(); _oldError = QString();
if (_hasRecovery && _hintText.isEmpty()) { if (_hasRecovery && _hintText.isEmpty()) {
_recover.show(); _recover->show();
} }
update(); update();
} }
@ -498,21 +499,21 @@ RecoverBox::RecoverBox(const QString &pattern) : AbstractBox(st::boxWidth)
, _recoverCode(this, st::defaultInputField, lang(lng_signin_code)) { , _recoverCode(this, st::defaultInputField, lang(lng_signin_code)) {
setBlockTitle(true); 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::passcodeSkip + _recoverCode->height() + st::passcodeSkip + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton->height() + st::boxButtonPadding.bottom());
connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSubmit())); connect(_saveButton, SIGNAL(clicked()), this, SLOT(onSubmit()));
connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose())); connect(_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
connect(&_recoverCode, SIGNAL(changed()), this, SLOT(onCodeChanged())); connect(_recoverCode, SIGNAL(changed()), this, SLOT(onCodeChanged()));
connect(&_recoverCode, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(_recoverCode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
prepare(); prepare();
} }
void RecoverBox::showAll() { void RecoverBox::showAll() {
_recoverCode.show(); _recoverCode->show();
_saveButton.show(); _saveButton->show();
_cancelButton.show(); _cancelButton->show();
AbstractBox::showAll(); AbstractBox::showAll();
} }
@ -525,35 +526,35 @@ void RecoverBox::paintEvent(QPaintEvent *e) {
p.setFont(st::normalFont); p.setFont(st::normalFont);
p.setPen(st::boxTextFg); p.setPen(st::boxTextFg);
int32 w = st::boxWidth - st::boxPadding.left() * 1.5; 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::passcodeSkip - st::passcodePadding.top(), w, st::passcodePadding.top() + st::passcodeSkip), _pattern, style::al_left);
if (!_error.isEmpty()) { if (!_error.isEmpty()) {
p.setPen(st::boxTextFgError); 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::passcodeSkip), _error, style::al_left);
} }
} }
void RecoverBox::resizeEvent(QResizeEvent *e) { void RecoverBox::resizeEvent(QResizeEvent *e) {
_recoverCode.resize(st::boxWidth - st::boxPadding.left() - st::boxPadding.right(), _recoverCode.height()); _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::passcodeSkip);
_saveButton.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _saveButton.height()); _saveButton->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _saveButton->height());
_cancelButton.moveToRight(st::boxButtonPadding.right() + _saveButton.width() + st::boxButtonPadding.left(), _saveButton.y()); _cancelButton->moveToRight(st::boxButtonPadding.right() + _saveButton->width() + st::boxButtonPadding.left(), _saveButton->y());
AbstractBox::resizeEvent(e); AbstractBox::resizeEvent(e);
} }
void RecoverBox::doSetInnerFocus() { void RecoverBox::doSetInnerFocus() {
_recoverCode.setFocus(); _recoverCode->setFocus();
} }
void RecoverBox::onSubmit() { void RecoverBox::onSubmit() {
if (_submitRequest) return; if (_submitRequest) return;
QString code = _recoverCode.getLastText().trimmed(); QString code = _recoverCode->getLastText().trimmed();
if (code.isEmpty()) { if (code.isEmpty()) {
_recoverCode.setFocus(); _recoverCode->setFocus();
_recoverCode.showError(); _recoverCode->showError();
return; return;
} }
@ -577,7 +578,7 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) {
_submitRequest = 0; _submitRequest = 0;
_error = lang(lng_flood_error); _error = lang(lng_flood_error);
update(); update();
_recoverCode.showError(); _recoverCode->showError();
return true; return true;
} }
if (MTP::isDefaultHandledError(error)) return false; if (MTP::isDefaultHandledError(error)) return false;
@ -599,9 +600,9 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) {
} else if (err == qstr("CODE_INVALID")) { } else if (err == qstr("CODE_INVALID")) {
_error = lang(lng_signin_wrong_code); _error = lang(lng_signin_wrong_code);
update(); update();
_recoverCode.selectAll(); _recoverCode->selectAll();
_recoverCode.setFocus(); _recoverCode->setFocus();
_recoverCode.showError(); _recoverCode->showError();
return true; return true;
} }
if (cDebug()) { // internal server error if (cDebug()) { // internal server error
@ -610,6 +611,6 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) {
_error = lang(lng_server_error); _error = lang(lng_server_error);
} }
update(); update();
_recoverCode.setFocus(); _recoverCode->setFocus();
return false; return false;
} }

View file

@ -22,6 +22,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "abstractbox.h" #include "abstractbox.h"
namespace Ui {
class LinkButton;
class RoundButton;
} // namespace Ui
class PasscodeBox : public AbstractBox, public RPCSender { class PasscodeBox : public AbstractBox, public RPCSender {
Q_OBJECT Q_OBJECT
@ -74,10 +79,14 @@ private:
QString _boxTitle; QString _boxTitle;
Text _about, _hintText; Text _about, _hintText;
BoxButton _saveButton, _cancelButton; ChildWidget<Ui::RoundButton> _saveButton;
PasswordField _oldPasscode, _newPasscode, _reenterPasscode; ChildWidget<Ui::RoundButton> _cancelButton;
InputField _passwordHint, _recoverEmail; ChildWidget<PasswordField> _oldPasscode;
LinkButton _recover; ChildWidget<PasswordField> _newPasscode;
ChildWidget<PasswordField> _reenterPasscode;
ChildWidget<InputField> _passwordHint;
ChildWidget<InputField> _recoverEmail;
ChildWidget<Ui::LinkButton> _recover;
QString _oldError, _newError, _emailError; QString _oldError, _newError, _emailError;
@ -112,8 +121,9 @@ private:
QString _pattern; QString _pattern;
BoxButton _saveButton, _cancelButton; ChildWidget<Ui::RoundButton> _saveButton;
InputField _recoverCode; ChildWidget<Ui::RoundButton> _cancelButton;
ChildWidget<InputField> _recoverCode;
QString _error; QString _error;

View file

@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwidget.h" #include "mainwidget.h"
#include "photocropbox.h" #include "photocropbox.h"
#include "fileuploader.h" #include "fileuploader.h"
#include "ui/widgets/buttons.h"
PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer) : AbstractBox() PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer) : AbstractBox()
, _downState(0) , _downState(0)
@ -54,8 +55,8 @@ void PhotoCropBox::init(const QImage &img, PeerData *peer) {
_title = lang(lng_settings_crop_profile); _title = lang(lng_settings_crop_profile);
} }
connect(&_done, SIGNAL(clicked()), this, SLOT(onSend())); connect(_done, SIGNAL(clicked()), this, SLOT(onSend()));
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose())); connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
if (peerToBareInt(_peerId)) { if (peerToBareInt(_peerId)) {
connect(this, SIGNAL(ready(const QImage&)), this, SLOT(onReady(const QImage&))); connect(this, SIGNAL(ready(const QImage&)), this, SLOT(onReady(const QImage&)));
} }
@ -77,7 +78,7 @@ void PhotoCropBox::init(const QImage &img, PeerData *peer) {
_thumby = st::boxPhotoPadding.top(); _thumby = st::boxPhotoPadding.top();
setMouseTracking(true); setMouseTracking(true);
resizeMaxHeight(st::boxWideWidth, st::boxPhotoPadding.top() + _thumbh + st::boxPhotoPadding.bottom() + st::boxTextFont->height + st::cropSkip + st::boxButtonPadding.top() + _done.height() + st::boxButtonPadding.bottom()); resizeMaxHeight(st::boxWideWidth, st::boxPhotoPadding.top() + _thumbh + st::boxPhotoPadding.bottom() + st::boxTextFont->height + st::cropSkip + st::boxButtonPadding.top() + _done->height() + st::boxButtonPadding.bottom());
} }
void PhotoCropBox::mousePressEvent(QMouseEvent *e) { void PhotoCropBox::mousePressEvent(QMouseEvent *e) {
@ -257,8 +258,8 @@ void PhotoCropBox::paintEvent(QPaintEvent *e) {
} }
void PhotoCropBox::resizeEvent(QResizeEvent *e) { void PhotoCropBox::resizeEvent(QResizeEvent *e) {
_done.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done.height()); _done->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done->height());
_cancel.moveToRight(st::boxButtonPadding.right() + _done.width() + st::boxButtonPadding.left(), _done.y()); _cancel->moveToRight(st::boxButtonPadding.right() + _done->width() + st::boxButtonPadding.left(), _done->y());
AbstractBox::resizeEvent(e); AbstractBox::resizeEvent(e);
} }
@ -304,6 +305,6 @@ void PhotoCropBox::onReady(const QImage &tosend) {
} }
void PhotoCropBox::showAll() { void PhotoCropBox::showAll() {
_done.show(); _done->show();
_cancel.show(); _cancel->show();
} }

View file

@ -22,6 +22,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "abstractbox.h" #include "abstractbox.h"
namespace Ui {
class RoundButton;
} // namespace Ui
class PhotoCropBox : public AbstractBox { class PhotoCropBox : public AbstractBox {
Q_OBJECT Q_OBJECT
@ -56,7 +60,8 @@ private:
int32 _thumbx, _thumby, _thumbw, _thumbh; int32 _thumbx, _thumby, _thumbw, _thumbh;
int32 _cropx, _cropy, _cropw; int32 _cropx, _cropy, _cropw;
int32 _fromposx, _fromposy, _fromcropx, _fromcropy, _fromcropw; int32 _fromposx, _fromposy, _fromcropx, _fromcropy, _fromcropw;
BoxButton _done, _cancel; ChildWidget<Ui::RoundButton> _done;
ChildWidget<Ui::RoundButton> _cancel;
QImage _img; QImage _img;
QPixmap _thumb; QPixmap _thumb;
PeerId _peerId; PeerId _peerId;

View file

@ -26,7 +26,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwidget.h" #include "mainwidget.h"
#include "photosendbox.h" #include "photosendbox.h"
#include "history/history_media_types.h" #include "history/history_media_types.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "styles/style_history.h" #include "styles/style_history.h"
PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxWideWidth) PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxWideWidth)

View file

@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Ui { namespace Ui {
class Checkbox; class Checkbox;
class RoundButton;
} // namespace Ui } // namespace Ui
class PhotoSendBox : public AbstractBox { class PhotoSendBox : public AbstractBox {
@ -60,8 +61,8 @@ private:
bool _compressedFromSettings; bool _compressedFromSettings;
ChildWidget<Ui::Checkbox> _compressed; ChildWidget<Ui::Checkbox> _compressed;
ChildWidget<BoxButton> _send; ChildWidget<Ui::RoundButton> _send;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
int32 _thumbx, _thumby, _thumbw, _thumbh; int32 _thumbx, _thumby, _thumbw, _thumbh;
Text _name; Text _name;
@ -108,8 +109,8 @@ private:
QPixmap _thumb; QPixmap _thumb;
ChildWidget<InputArea> _field = { nullptr }; ChildWidget<InputArea> _field = { nullptr };
ChildWidget<BoxButton> _save; ChildWidget<Ui::RoundButton> _save;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
int32 _thumbx, _thumby, _thumbw, _thumbh; int32 _thumbx, _thumby, _thumbw, _thumbh;
Text _name; Text _name;

View file

@ -25,7 +25,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_profile.h" #include "styles/style_profile.h"
#include "boxes/confirmbox.h" #include "boxes/confirmbox.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "mainwindow.h" #include "mainwindow.h"
ReportBox::ReportBox(ChannelData *channel) : AbstractBox(st::boxWidth) ReportBox::ReportBox(ChannelData *channel) : AbstractBox(st::boxWidth)

View file

@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Ui { namespace Ui {
class Radiobutton; class Radiobutton;
class RoundButton;
} // namespace Ui } // namespace Ui
class ReportBox : public AbstractBox, public RPCSender { class ReportBox : public AbstractBox, public RPCSender {
@ -60,7 +61,7 @@ private:
ChildWidget<Ui::Radiobutton> _reasonOther; ChildWidget<Ui::Radiobutton> _reasonOther;
ChildWidget<InputArea> _reasonOtherText = { nullptr }; ChildWidget<InputArea> _reasonOtherText = { nullptr };
ChildWidget<BoxButton> _report, _cancel; ChildWidget<Ui::RoundButton> _report, _cancel;
enum Reason { enum Reason {
ReasonSpam, ReasonSpam,

View file

@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwindow.h" #include "mainwindow.h"
#include "countries.h" #include "countries.h"
#include "boxes/confirmbox.h" #include "boxes/confirmbox.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll) SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)
@ -38,14 +38,14 @@ SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)
, _shortPollRequest(0) { , _shortPollRequest(0) {
setMaxHeight(st::sessionsHeight); setMaxHeight(st::sessionsHeight);
connect(&_done, SIGNAL(clicked()), this, SLOT(onClose())); connect(_done, SIGNAL(clicked()), this, SLOT(onClose()));
connect(_inner, SIGNAL(oneTerminated()), this, SLOT(onOneTerminated())); connect(_inner, SIGNAL(oneTerminated()), this, SLOT(onOneTerminated()));
connect(_inner, SIGNAL(allTerminated()), this, SLOT(onAllTerminated())); connect(_inner, SIGNAL(allTerminated()), this, SLOT(onAllTerminated()));
connect(_inner, SIGNAL(terminateAll()), this, SLOT(onTerminateAll())); connect(_inner, SIGNAL(terminateAll()), this, SLOT(onTerminateAll()));
connect(App::wnd(), SIGNAL(newAuthorization()), this, SLOT(onNewAuthorization())); connect(App::wnd(), SIGNAL(newAuthorization()), this, SLOT(onNewAuthorization()));
connect(&_shortPollTimer, SIGNAL(timeout()), this, SLOT(onShortPollAuthorizations())); connect(&_shortPollTimer, SIGNAL(timeout()), this, SLOT(onShortPollAuthorizations()));
init(_inner, st::boxButtonPadding.bottom() + _done.height() + st::boxButtonPadding.top(), titleHeight()); init(_inner, st::boxButtonPadding.bottom() + _done->height() + st::boxButtonPadding.top(), titleHeight());
_inner->resize(width(), st::noContactsHeight); _inner->resize(width(), st::noContactsHeight);
prepare(); prepare();
@ -55,12 +55,12 @@ SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)
void SessionsBox::resizeEvent(QResizeEvent *e) { void SessionsBox::resizeEvent(QResizeEvent *e) {
ScrollableBox::resizeEvent(e); ScrollableBox::resizeEvent(e);
_shadow.setGeometry(0, height() - st::boxButtonPadding.bottom() - _done.height() - st::boxButtonPadding.top() - st::lineWidth, width(), st::lineWidth); _shadow.setGeometry(0, height() - st::boxButtonPadding.bottom() - _done->height() - st::boxButtonPadding.top() - st::lineWidth, width(), st::lineWidth);
_done.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done.height()); _done->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done->height());
} }
void SessionsBox::showAll() { void SessionsBox::showAll() {
_done.show(); _done->show();
if (_loading) { if (_loading) {
scrollArea()->hide(); scrollArea()->hide();
_shadow.hide(); _shadow.hide();
@ -194,7 +194,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
} }
} }
_inner->listUpdated(); _inner->listUpdated();
if (!_done.isHidden()) { if (!_done->isHidden()) {
showAll(); showAll();
update(); update();
} }
@ -204,7 +204,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
void SessionsBox::onOneTerminated() { void SessionsBox::onOneTerminated() {
if (_list.isEmpty()) { if (_list.isEmpty()) {
if (!_done.isHidden()) { if (!_done->isHidden()) {
showAll(); showAll();
update(); update();
} }
@ -214,7 +214,7 @@ void SessionsBox::onOneTerminated() {
void SessionsBox::onShortPollAuthorizations() { void SessionsBox::onShortPollAuthorizations() {
if (!_shortPollRequest) { if (!_shortPollRequest) {
_shortPollRequest = MTP::send(MTPaccount_GetAuthorizations(), rpcDone(&SessionsBox::gotAuthorizations)); _shortPollRequest = MTP::send(MTPaccount_GetAuthorizations(), rpcDone(&SessionsBox::gotAuthorizations));
if (!_done.isHidden()) { if (!_done->isHidden()) {
showAll(); showAll();
update(); update();
} }
@ -236,7 +236,7 @@ void SessionsBox::onAllTerminated() {
void SessionsBox::onTerminateAll() { void SessionsBox::onTerminateAll() {
_loading = true; _loading = true;
if (!_done.isHidden()) { if (!_done->isHidden()) {
showAll(); showAll();
update(); update();
} }
@ -246,10 +246,10 @@ SessionsBox::Inner::Inner(QWidget *parent, SessionsBox::List *list, SessionsBox:
, _list(list) , _list(list)
, _current(current) , _current(current)
, _terminating(0) , _terminating(0)
, _terminateAll(this, lang(lng_sessions_terminate_all), st::redBoxLinkButton) , _terminateAll(this, lang(lng_sessions_terminate_all), st::sessionTerminateAllButton)
, _terminateBox(0) { , _terminateBox(0) {
connect(&_terminateAll, SIGNAL(clicked()), this, SLOT(onTerminateAll())); connect(_terminateAll, SIGNAL(clicked()), this, SLOT(onTerminateAll()));
_terminateAll.hide(); _terminateAll->hide();
setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_OpaquePaintEvent);
} }
@ -320,7 +320,7 @@ void SessionsBox::Inner::paintEvent(QPaintEvent *e) {
void SessionsBox::Inner::onTerminate() { void SessionsBox::Inner::onTerminate() {
for (TerminateButtons::iterator i = _terminateButtons.begin(), e = _terminateButtons.end(); i != e; ++i) { for (TerminateButtons::iterator i = _terminateButtons.begin(), e = _terminateButtons.end(); i != e; ++i) {
if (i.value()->getState() & Button::StateOver) { if (i.value()->getState() & Ui::AbstractButton::StateOver) {
_terminating = i.key(); _terminating = i.key();
if (_terminateBox) _terminateBox->deleteLater(); if (_terminateBox) _terminateBox->deleteLater();
@ -399,14 +399,14 @@ bool SessionsBox::Inner::terminateAllFail(const RPCError &error) {
} }
void SessionsBox::Inner::resizeEvent(QResizeEvent *e) { void SessionsBox::Inner::resizeEvent(QResizeEvent *e) {
_terminateAll.moveToLeft(st::sessionPadding.left(), st::sessionCurrentPadding.top() + st::sessionHeight + st::sessionCurrentPadding.bottom()); _terminateAll->moveToLeft(st::sessionPadding.left(), st::sessionCurrentPadding.top() + st::sessionHeight + st::sessionCurrentPadding.bottom());
} }
void SessionsBox::Inner::listUpdated() { void SessionsBox::Inner::listUpdated() {
if (_list->isEmpty()) { if (_list->isEmpty()) {
_terminateAll.hide(); _terminateAll->hide();
} else { } else {
_terminateAll.show(); _terminateAll->show();
} }
for (TerminateButtons::iterator i = _terminateButtons.begin(), e = _terminateButtons.end(); i != e; ++i) { for (TerminateButtons::iterator i = _terminateButtons.begin(), e = _terminateButtons.end(); i != e; ++i) {
i.value()->move(0, -1); i.value()->move(0, -1);

View file

@ -27,6 +27,8 @@ class ConfirmBox;
namespace Ui { namespace Ui {
class IconButton; class IconButton;
class LinkButton;
class RoundButton;
} // namespace Ui } // namespace Ui
class SessionsBox : public ScrollableBox, public RPCSender { class SessionsBox : public ScrollableBox, public RPCSender {
@ -68,7 +70,7 @@ private:
class Inner; class Inner;
ChildWidget<Inner> _inner; ChildWidget<Inner> _inner;
ScrollableBoxShadow _shadow; ScrollableBoxShadow _shadow;
BoxButton _done; ChildWidget<Ui::RoundButton> _done;
SingleTimer _shortPollTimer; SingleTimer _shortPollTimer;
mtpRequestId _shortPollRequest; mtpRequestId _shortPollRequest;
@ -114,7 +116,7 @@ private:
TerminateButtons _terminateButtons; TerminateButtons _terminateButtons;
uint64 _terminating; uint64 _terminating;
LinkButton _terminateAll; ChildWidget<Ui::LinkButton> _terminateAll;
ConfirmBox *_terminateBox; ConfirmBox *_terminateBox;
}; };

View file

@ -35,6 +35,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/toast/toast.h" #include "ui/toast/toast.h"
#include "ui/widgets/multi_select.h" #include "ui/widgets/multi_select.h"
#include "history/history_media_types.h" #include "history/history_media_types.h"
#include "ui/widgets/buttons.h"
#include "boxes/contactsbox.h" #include "boxes/contactsbox.h"
ShareBox::ShareBox(CopyCallback &&copyCallback, SubmitCallback &&submitCallback, FilterCallback &&filterCallback) : ItemListBox(st::boxScroll) ShareBox::ShareBox(CopyCallback &&copyCallback, SubmitCallback &&submitCallback, FilterCallback &&filterCallback) : ItemListBox(st::boxScroll)

View file

@ -37,6 +37,7 @@ struct PeerUpdate;
namespace Ui { namespace Ui {
class MultiSelect; class MultiSelect;
class RoundButton;
} // namespace Ui } // namespace Ui
QString appendShareGameScoreUrl(const QString &url, const FullMsgId &fullId); QString appendShareGameScoreUrl(const QString &url, const FullMsgId &fullId);
@ -90,9 +91,9 @@ private:
ChildWidget<Inner> _inner; ChildWidget<Inner> _inner;
ChildWidget<Ui::MultiSelect> _select; ChildWidget<Ui::MultiSelect> _select;
ChildWidget<BoxButton> _copy; ChildWidget<Ui::RoundButton> _copy;
ChildWidget<BoxButton> _share; ChildWidget<Ui::RoundButton> _share;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
ChildWidget<ScrollableBoxShadow> _topShadow; ChildWidget<ScrollableBoxShadow> _topShadow;
ChildWidget<ScrollableBoxShadow> _bottomShadow; ChildWidget<ScrollableBoxShadow> _bottomShadow;

View file

@ -31,6 +31,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "dialogs/dialogs_layout.h" #include "dialogs/dialogs_layout.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_stickers.h" #include "styles/style_stickers.h"
#include "ui/widgets/buttons.h"
namespace { namespace {
@ -611,11 +612,8 @@ void StickersBox::Inner::paintRow(Painter &p, int32 index) {
bool removeDown = removeSel && (index == _actionDown); bool removeDown = removeSel && (index == _actionDown);
p.setFont(removeSel ? st::linkOverFont : st::linkFont); p.setFont(removeSel ? st::linkOverFont : st::linkFont);
if (removeDown) { p.setPen(removeDown ? st::defaultLinkButton.downColor : st::defaultLinkButton.color);
p.setPen(st::btnDefLink.downColor);
} else {
p.setPen(st::btnDefLink.color);
}
int32 remWidth = s->recent ? _clearWidth : (s->disabled ? (s->official ? _restoreWidth : _returnWidth) : _removeWidth); int32 remWidth = s->recent ? _clearWidth : (s->disabled ? (s->official ? _restoreWidth : _returnWidth) : _removeWidth);
QString remText = lang(s->recent ? lng_stickers_clear_recent : (s->disabled ? (s->official ? lng_stickers_restore : lng_stickers_return) : lng_stickers_remove)); QString remText = lang(s->recent ? lng_stickers_clear_recent : (s->disabled ? (s->official ? lng_stickers_restore : lng_stickers_return) : lng_stickers_remove));
p.drawTextRight(st::contactsPadding.right() + st::contactsCheckPosition.x(), st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, width(), remText, remWidth); p.drawTextRight(st::contactsPadding.right() + st::contactsCheckPosition.x(), st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, width(), remText, remWidth);

View file

@ -26,6 +26,7 @@ class ConfirmBox;
namespace Ui { namespace Ui {
class PlainShadow; class PlainShadow;
class RoundButton;
} // namespace Ui } // namespace Ui
class StickersBox : public ItemListBox, public RPCSender { class StickersBox : public ItemListBox, public RPCSender {
@ -81,8 +82,8 @@ private:
class Inner; class Inner;
ChildWidget<Inner> _inner; ChildWidget<Inner> _inner;
ChildWidget<BoxButton> _save = { nullptr }; ChildWidget<Ui::RoundButton> _save = { nullptr };
ChildWidget<BoxButton> _cancel = { nullptr }; ChildWidget<Ui::RoundButton> _cancel = { nullptr };
OrderedSet<mtpRequestId> _disenableRequests; OrderedSet<mtpRequestId> _disenableRequests;
mtpRequestId _reorderRequest = 0; mtpRequestId _reorderRequest = 0;
ChildWidget<Ui::PlainShadow> _topShadow = { nullptr }; ChildWidget<Ui::PlainShadow> _topShadow = { nullptr };

View file

@ -31,6 +31,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "dialogs/dialogs_layout.h" #include "dialogs/dialogs_layout.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_stickers.h" #include "styles/style_stickers.h"
#include "ui/widgets/buttons.h"
StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll) StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll)
, _inner(this, set) , _inner(this, set)
@ -42,12 +43,12 @@ StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::
setMaxHeight(st::stickersMaxHeight); setMaxHeight(st::stickersMaxHeight);
connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated())); connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated()));
init(_inner, st::boxButtonPadding.bottom() + _cancel.height() + st::boxButtonPadding.top()); init(_inner, st::boxButtonPadding.bottom() + _cancel->height() + st::boxButtonPadding.top());
connect(&_add, SIGNAL(clicked()), this, SLOT(onAddStickers())); connect(_add, SIGNAL(clicked()), this, SLOT(onAddStickers()));
connect(&_share, SIGNAL(clicked()), this, SLOT(onShareStickers())); connect(_share, SIGNAL(clicked()), this, SLOT(onShareStickers()));
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose())); connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
connect(&_done, SIGNAL(clicked()), this, SLOT(onClose())); connect(_done, SIGNAL(clicked()), this, SLOT(onClose()));
connect(_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons())); connect(_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons()));
connect(scrollArea(), SIGNAL(scrolled()), this, SLOT(onScroll())); connect(scrollArea(), SIGNAL(scrolled()), this, SLOT(onScroll()));
@ -81,7 +82,7 @@ void StickerSetBox::onShareStickers() {
} }
void StickerSetBox::onUpdateButtons() { void StickerSetBox::onUpdateButtons() {
if (!_cancel.isHidden() || !_done.isHidden()) { if (!_cancel->isHidden() || !_done->isHidden()) {
showAll(); showAll();
} }
} }
@ -98,27 +99,27 @@ void StickerSetBox::showAll() {
if (_inner->loaded()) { if (_inner->loaded()) {
_shadow.show(); _shadow.show();
if (_inner->notInstalled()) { if (_inner->notInstalled()) {
_add.show(); _add->show();
_cancel.show(); _cancel->show();
_share.hide(); _share->hide();
_done.hide(); _done->hide();
} else if (_inner->official()) { } else if (_inner->official()) {
_add.hide(); _add->hide();
_share.hide(); _share->hide();
_cancel.hide(); _cancel->hide();
_done.show(); _done->show();
} else { } else {
_share.show(); _share->show();
_cancel.show(); _cancel->show();
_add.hide(); _add->hide();
_done.hide(); _done->hide();
} }
} else { } else {
_shadow.hide(); _shadow.hide();
_add.hide(); _add->hide();
_share.hide(); _share->hide();
_cancel.show(); _cancel->show();
_done.hide(); _done->hide();
} }
resizeEvent(0); resizeEvent(0);
update(); update();
@ -134,16 +135,16 @@ void StickerSetBox::paintEvent(QPaintEvent *e) {
void StickerSetBox::resizeEvent(QResizeEvent *e) { void StickerSetBox::resizeEvent(QResizeEvent *e) {
ScrollableBox::resizeEvent(e); ScrollableBox::resizeEvent(e);
_inner->resize(width(), _inner->height()); _inner->resize(width(), _inner->height());
_shadow.setGeometry(0, height() - st::boxButtonPadding.bottom() - _cancel.height() - st::boxButtonPadding.top() - st::lineWidth, width(), st::lineWidth); _shadow.setGeometry(0, height() - st::boxButtonPadding.bottom() - _cancel->height() - st::boxButtonPadding.top() - st::lineWidth, width(), st::lineWidth);
_add.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _add.height()); _add->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _add->height());
_share.moveToRight(st::boxButtonPadding.right(), _add.y()); _share->moveToRight(st::boxButtonPadding.right(), _add->y());
_done.moveToRight(st::boxButtonPadding.right(), _add.y()); _done->moveToRight(st::boxButtonPadding.right(), _add->y());
if (_add.isHidden() && _share.isHidden()) { if (_add->isHidden() && _share->isHidden()) {
_cancel.moveToRight(st::boxButtonPadding.right(), _add.y()); _cancel->moveToRight(st::boxButtonPadding.right(), _add->y());
} else if (_add.isHidden()) { } else if (_add->isHidden()) {
_cancel.moveToRight(st::boxButtonPadding.right() + _share.width() + st::boxButtonPadding.left(), _add.y()); _cancel->moveToRight(st::boxButtonPadding.right() + _share->width() + st::boxButtonPadding.left(), _add->y());
} else { } else {
_cancel.moveToRight(st::boxButtonPadding.right() + _add.width() + st::boxButtonPadding.left(), _add.y()); _cancel->moveToRight(st::boxButtonPadding.right() + _add->width() + st::boxButtonPadding.left(), _add->y());
} }
} }

View file

@ -27,6 +27,7 @@ class ConfirmBox;
namespace Ui { namespace Ui {
class PlainShadow; class PlainShadow;
class RoundButton;
} // namespace Ui } // namespace Ui
class StickerSetBox : public ScrollableBox, public RPCSender { class StickerSetBox : public ScrollableBox, public RPCSender {
@ -59,7 +60,10 @@ private:
class Inner; class Inner;
ChildWidget<Inner> _inner; ChildWidget<Inner> _inner;
ScrollableBoxShadow _shadow; ScrollableBoxShadow _shadow;
BoxButton _add, _share, _cancel, _done; ChildWidget<Ui::RoundButton> _add;
ChildWidget<Ui::RoundButton> _share;
ChildWidget<Ui::RoundButton> _cancel;
ChildWidget<Ui::RoundButton> _done;
QString _title; QString _title;
}; };

View file

@ -19,18 +19,20 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "boxes/usernamebox.h"
#include "lang.h"
#include "application.h" #include "application.h"
#include "usernamebox.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "ui/widgets/buttons.h"
#include "styles/style_boxes.h"
UsernameBox::UsernameBox() : AbstractBox(st::boxWidth), UsernameBox::UsernameBox() : AbstractBox(st::boxWidth),
_save(this, lang(lng_settings_save), st::defaultBoxButton), _save(this, lang(lng_settings_save), st::defaultBoxButton),
_cancel(this, lang(lng_cancel), st::cancelBoxButton), _cancel(this, lang(lng_cancel), st::cancelBoxButton),
_username(this, st::defaultInputField, qsl("@username"), App::self()->username, false), _username(this, st::defaultInputField, qsl("@username"), App::self()->username, false),
_link(this, QString(), st::defaultBoxLinkButton), _link(this, QString(), st::boxLinkButton),
_saveRequestId(0), _checkRequestId(0), _saveRequestId(0), _checkRequestId(0),
_about(st::boxWidth - st::usernamePadding.left()) { _about(st::boxWidth - st::usernamePadding.left()) {
setBlockTitle(true); setBlockTitle(true);
@ -39,15 +41,15 @@ _about(st::boxWidth - st::usernamePadding.left()) {
textstyleSet(&st::usernameTextStyle); textstyleSet(&st::usernameTextStyle);
_about.setRichText(st::boxTextFont, lang(lng_username_about)); _about.setRichText(st::boxTextFont, lang(lng_username_about));
resizeMaxHeight(st::boxWidth, titleHeight() + 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()); resizeMaxHeight(st::boxWidth, titleHeight() + 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(); textstyleRestore();
connect(&_save, SIGNAL(clicked()), this, SLOT(onSave())); connect(_save, SIGNAL(clicked()), this, SLOT(onSave()));
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose())); connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
connect(&_username, SIGNAL(changed()), this, SLOT(onChanged())); connect(_username, SIGNAL(changed()), this, SLOT(onChanged()));
connect(&_username, SIGNAL(submitted(bool)), this, SLOT(onSave())); connect(_username, SIGNAL(submitted(bool)), this, SLOT(onSave()));
connect(&_link, SIGNAL(clicked()), this, SLOT(onLinkClick())); connect(_link, SIGNAL(clicked()), this, SLOT(onLinkClick()));
_checkTimer.setSingleShot(true); _checkTimer.setSingleShot(true);
connect(&_checkTimer, SIGNAL(timeout()), this, SLOT(onCheck())); connect(&_checkTimer, SIGNAL(timeout()), this, SLOT(onCheck()));
@ -56,16 +58,16 @@ _about(st::boxWidth - st::usernamePadding.left()) {
} }
void UsernameBox::showAll() { void UsernameBox::showAll() {
_username.show(); _username->show();
_save.show(); _save->show();
_cancel.show(); _cancel->show();
updateLinkText(); updateLinkText();
AbstractBox::showAll(); AbstractBox::showAll();
} }
void UsernameBox::doSetInnerFocus() { void UsernameBox::doSetInnerFocus() {
_username.setFocus(); _username->setFocus();
} }
void UsernameBox::paintEvent(QPaintEvent *e) { void UsernameBox::paintEvent(QPaintEvent *e) {
@ -77,25 +79,25 @@ void UsernameBox::paintEvent(QPaintEvent *e) {
p.setFont(st::boxTextFont); p.setFont(st::boxTextFont);
if (!_copiedTextLink.isEmpty()) { if (!_copiedTextLink.isEmpty()) {
p.setPen(st::usernameDefaultFg); p.setPen(st::usernameDefaultFg);
p.drawTextLeft(st::usernamePadding.left(), _username.y() + _username.height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), _copiedTextLink); p.drawTextLeft(st::usernamePadding.left(), _username->y() + _username->height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), _copiedTextLink);
} else if (!_errorText.isEmpty()) { } else if (!_errorText.isEmpty()) {
p.setPen(st::boxTextFgError); p.setPen(st::boxTextFgError);
p.drawTextLeft(st::usernamePadding.left(), _username.y() + _username.height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), _errorText); p.drawTextLeft(st::usernamePadding.left(), _username->y() + _username->height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), _errorText);
} else if (!_goodText.isEmpty()) { } else if (!_goodText.isEmpty()) {
p.setPen(st::boxTextFgGood); p.setPen(st::boxTextFgGood);
p.drawTextLeft(st::usernamePadding.left(), _username.y() + _username.height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), _goodText); p.drawTextLeft(st::usernamePadding.left(), _username->y() + _username->height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), _goodText);
} else { } else {
p.setPen(st::usernameDefaultFg); p.setPen(st::usernameDefaultFg);
p.drawTextLeft(st::usernamePadding.left(), _username.y() + _username.height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), lang(lng_username_choose)); p.drawTextLeft(st::usernamePadding.left(), _username->y() + _username->height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), lang(lng_username_choose));
} }
p.setPen(st::boxTextFg); p.setPen(st::boxTextFg);
textstyleSet(&st::usernameTextStyle); textstyleSet(&st::usernameTextStyle);
int32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw); int32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw);
_about.drawLeft(p, st::usernamePadding.left(), _username.y() + _username.height() + st::usernameSkip, availw, width()); _about.drawLeft(p, st::usernamePadding.left(), _username->y() + _username->height() + st::usernameSkip, availw, width());
textstyleRestore(); textstyleRestore();
int32 linky = _username.y() + _username.height() + st::usernameSkip + h + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2); int32 linky = _username->y() + _username->height() + st::usernameSkip + h + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2);
if (_link.isHidden()) { if (_link->isHidden()) {
p.drawTextLeft(st::usernamePadding.left(), linky, width(), lang(lng_username_link_willbe)); p.drawTextLeft(st::usernamePadding.left(), linky, width(), lang(lng_username_link_willbe));
p.setPen(st::usernameDefaultFg); p.setPen(st::usernameDefaultFg);
p.drawTextLeft(st::usernamePadding.left(), linky + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2), width(), qsl("https://telegram.me/username")); p.drawTextLeft(st::usernamePadding.left(), linky + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2), width(), qsl("https://telegram.me/username"));
@ -105,17 +107,17 @@ void UsernameBox::paintEvent(QPaintEvent *e) {
} }
void UsernameBox::resizeEvent(QResizeEvent *e) { void UsernameBox::resizeEvent(QResizeEvent *e) {
_username.resize(width() - st::usernamePadding.left() - st::usernamePadding.right(), _username.height()); _username->resize(width() - st::usernamePadding.left() - st::usernamePadding.right(), _username->height());
_username.moveToLeft(st::usernamePadding.left(), titleHeight() + st::usernamePadding.top()); _username->moveToLeft(st::usernamePadding.left(), titleHeight() + st::usernamePadding.top());
textstyleSet(&st::usernameTextStyle); textstyleSet(&st::usernameTextStyle);
int32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw); int32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw);
textstyleRestore(); textstyleRestore();
int32 linky = _username.y() + _username.height() + st::usernameSkip + h + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2); int32 linky = _username->y() + _username->height() + st::usernameSkip + h + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2);
_link.moveToLeft(st::usernamePadding.left(), linky + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2)); _link->moveToLeft(st::usernamePadding.left(), linky + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2));
_save.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _save.height()); _save->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _save->height());
_cancel.moveToRight(st::boxButtonPadding.right() + _save.width() + st::boxButtonPadding.left(), _save.y()); _cancel->moveToRight(st::boxButtonPadding.right() + _save->width() + st::boxButtonPadding.left(), _save->y());
AbstractBox::resizeEvent(e); AbstractBox::resizeEvent(e);
} }
@ -199,21 +201,21 @@ bool UsernameBox::onUpdateFail(const RPCError &error) {
onClose(); onClose();
return true; return true;
} else if (err == qstr("USERNAME_INVALID")) { } else if (err == qstr("USERNAME_INVALID")) {
_username.setFocus(); _username->setFocus();
_username.showError(); _username->showError();
_copiedTextLink = QString(); _copiedTextLink = QString();
_errorText = lang(lng_username_invalid); _errorText = lang(lng_username_invalid);
update(); update();
return true; return true;
} else if (err == qstr("USERNAME_OCCUPIED") || err == qstr("USERNAMES_UNAVAILABLE")) { } else if (err == qstr("USERNAME_OCCUPIED") || err == qstr("USERNAMES_UNAVAILABLE")) {
_username.setFocus(); _username->setFocus();
_username.showError(); _username->showError();
_copiedTextLink = QString(); _copiedTextLink = QString();
_errorText = lang(lng_username_occupied); _errorText = lang(lng_username_occupied);
update(); update();
return true; return true;
} }
_username.setFocus(); _username->setFocus();
return true; return true;
} }
@ -245,25 +247,25 @@ bool UsernameBox::onCheckFail(const RPCError &error) {
} }
_goodText = QString(); _goodText = QString();
_copiedTextLink = QString(); _copiedTextLink = QString();
_username.setFocus(); _username->setFocus();
return true; return true;
} }
QString UsernameBox::getName() const { QString UsernameBox::getName() const {
return _username.text().replace('@', QString()).trimmed(); return _username->text().replace('@', QString()).trimmed();
} }
void UsernameBox::updateLinkText() { void UsernameBox::updateLinkText() {
QString uname = getName(); QString uname = getName();
_link.setText(st::boxTextFont->elided(qsl("https://telegram.me/") + uname, st::boxWidth - st::usernamePadding.left() - st::usernamePadding.right())); _link->setText(st::boxTextFont->elided(qsl("https://telegram.me/") + uname, st::boxWidth - st::usernamePadding.left() - st::usernamePadding.right()));
if (uname.isEmpty()) { if (uname.isEmpty()) {
if (!_link.isHidden()) { if (!_link->isHidden()) {
_link.hide(); _link->hide();
update(); update();
} }
} else { } else {
if (_link.isHidden()) { if (_link->isHidden()) {
_link.show(); _link->show();
update(); update();
} }
} }

View file

@ -22,6 +22,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "abstractbox.h" #include "abstractbox.h"
namespace Ui {
class RoundButton;
class LinkButton;
} // namespace Ui
class UsernameBox : public AbstractBox, public RPCSender { class UsernameBox : public AbstractBox, public RPCSender {
Q_OBJECT Q_OBJECT
@ -53,9 +58,10 @@ private:
QString getName() const; QString getName() const;
void updateLinkText(); void updateLinkText();
BoxButton _save, _cancel; ChildWidget<Ui::RoundButton> _save;
UsernameInput _username; ChildWidget<Ui::RoundButton> _cancel;
LinkButton _link; ChildWidget<UsernameInput> _username;
ChildWidget<Ui::LinkButton> _link;
mtpRequestId _saveRequestId, _checkRequestId; mtpRequestId _saveRequestId, _checkRequestId;
QString _sentUsername, _checkUsername, _errorText, _goodText, _copiedTextLink; QString _sentUsername, _checkUsername, _errorText, _goodText, _copiedTextLink;

View file

@ -162,7 +162,7 @@ historySendingInvertedIcon: icon {{ "dialogs_sending", #ffffffc8, point(5px, 5px
historyViewsSendingIcon: icon {{ "dialogs_sending", #a0adb5, point(3px, 0px) }}; historyViewsSendingIcon: icon {{ "dialogs_sending", #a0adb5, point(3px, 0px) }};
historyViewsSendingInvertedIcon: icon {{ "dialogs_sending", #ffffffc8, point(3px, 0px) }}; historyViewsSendingInvertedIcon: icon {{ "dialogs_sending", #ffffffc8, point(3px, 0px) }};
dialogsUpdateButton: flatButton { dialogsUpdateButton: FlatButton {
duration: 0; duration: 0;
cursor: cursor(pointer); cursor: cursor(pointer);

View file

@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "dialogs/dialogs_layout.h" #include "dialogs/dialogs_layout.h"
#include "styles/style_dialogs.h" #include "styles/style_dialogs.h"
#include "styles/style_stickers.h" #include "styles/style_stickers.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/popup_menu.h" #include "ui/widgets/popup_menu.h"
#include "data/data_drafts.h" #include "data/data_drafts.h"
#include "lang.h" #include "lang.h"
@ -54,7 +54,7 @@ DialogsInner::DialogsInner(QWidget *parent, QWidget *main) : SplittedWidget(pare
connect(main, SIGNAL(peerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)), this, SLOT(onPeerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&))); connect(main, SIGNAL(peerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)), this, SLOT(onPeerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)));
connect(main, SIGNAL(peerPhotoChanged(PeerData*)), this, SLOT(onPeerPhotoChanged(PeerData*))); connect(main, SIGNAL(peerPhotoChanged(PeerData*)), this, SLOT(onPeerPhotoChanged(PeerData*)));
connect(main, SIGNAL(dialogRowReplaced(Dialogs::Row*,Dialogs::Row*)), this, SLOT(onDialogRowReplaced(Dialogs::Row*,Dialogs::Row*))); connect(main, SIGNAL(dialogRowReplaced(Dialogs::Row*,Dialogs::Row*)), this, SLOT(onDialogRowReplaced(Dialogs::Row*,Dialogs::Row*)));
connect(&_addContactLnk, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact())); connect(_addContactLnk, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact()));
connect(_cancelSearchInPeer, SIGNAL(clicked()), this, SIGNAL(cancelSearchInPeer())); connect(_cancelSearchInPeer, SIGNAL(clicked()), this, SIGNAL(cancelSearchInPeer()));
_cancelSearchInPeer->hide(); _cancelSearchInPeer->hide();
@ -410,7 +410,7 @@ void DialogsInner::mousePressEvent(QMouseEvent *e) {
} }
void DialogsInner::resizeEvent(QResizeEvent *e) { void DialogsInner::resizeEvent(QResizeEvent *e) {
_addContactLnk.move((width() - _addContactLnk.width()) / 2, (st::noContactsHeight + st::noContactsFont->height) / 2); _addContactLnk->move((width() - _addContactLnk->width()) / 2, (st::noContactsHeight + st::noContactsFont->height) / 2);
_cancelSearchInPeer->move(width() - st::dialogsPadding.x() - st::dialogsCancelSearch.width, (st::dialogsRowHeight - st::dialogsCancelSearch.height) / 2); _cancelSearchInPeer->move(width() - st::dialogsPadding.x() - st::dialogsCancelSearch.width, (st::dialogsRowHeight - st::dialogsCancelSearch.height) / 2);
} }
@ -1092,16 +1092,16 @@ void DialogsInner::refresh(bool toTop) {
if (shownDialogs()->isEmpty()) { if (shownDialogs()->isEmpty()) {
h = st::noContactsHeight; h = st::noContactsHeight;
if (cContactsReceived()) { if (cContactsReceived()) {
if (_addContactLnk.isHidden()) _addContactLnk.show(); if (_addContactLnk->isHidden()) _addContactLnk->show();
} else { } else {
if (!_addContactLnk.isHidden()) _addContactLnk.hide(); if (!_addContactLnk->isHidden()) _addContactLnk->hide();
} }
} else { } else {
h = dialogsOffset() + shownDialogs()->size() * st::dialogsRowHeight; h = dialogsOffset() + shownDialogs()->size() * st::dialogsRowHeight;
if (!_addContactLnk.isHidden()) _addContactLnk.hide(); if (!_addContactLnk->isHidden()) _addContactLnk->hide();
} }
} else { } else {
if (!_addContactLnk.isHidden()) _addContactLnk.hide(); if (!_addContactLnk->isHidden()) _addContactLnk->hide();
if (_state == FilteredState) { if (_state == FilteredState) {
h = searchedOffset() + (_searchResults.count() * st::dialogsRowHeight) + ((_searchResults.isEmpty() && !_searchInPeer) ? -st::searchedBarHeight : 0); h = searchedOffset() + (_searchResults.count() * st::dialogsRowHeight) + ((_searchResults.isEmpty() && !_searchInPeer) ? -st::searchedBarHeight : 0);
} else if (_state == SearchedState) { } else if (_state == SearchedState) {

View file

@ -32,6 +32,8 @@ namespace Ui {
class IconButton; class IconButton;
class PopupMenu; class PopupMenu;
class DropdownMenu; class DropdownMenu;
class FlatButton;
class LinkButton;
} // namespace Ui } // namespace Ui
enum DialogsSearchRequestType { enum DialogsSearchRequestType {
@ -206,7 +208,7 @@ private:
void paintDialog(QPainter &p, Dialogs::Row *dialog); void paintDialog(QPainter &p, Dialogs::Row *dialog);
LinkButton _addContactLnk; ChildWidget<Ui::LinkButton> _addContactLnk;
ChildWidget<Ui::IconButton> _cancelSearchInPeer; ChildWidget<Ui::IconButton> _cancelSearchInPeer;
bool _overDelete = false; bool _overDelete = false;
@ -335,7 +337,7 @@ private:
ChildWidget<Ui::IconButton> _lockUnlock; ChildWidget<Ui::IconButton> _lockUnlock;
ChildWidget<ScrollArea> _scroll; ChildWidget<ScrollArea> _scroll;
ChildWidget<DialogsInner> _inner; ChildWidget<DialogsInner> _inner;
ChildWidget<FlatButton> _updateTelegram = { nullptr }; ChildWidget<Ui::FlatButton> _updateTelegram = { nullptr };
Animation _a_show; Animation _a_show;
QPixmap _cacheUnder, _cacheOver; QPixmap _cacheUnder, _cacheOver;

View file

@ -157,7 +157,7 @@ historyComposeFieldMaxHeight: 224px;
historySendPadding: 9px; historySendPadding: 9px;
historySendRight: 2px; historySendRight: 2px;
historyComposeButton: flatButton { historyComposeButton: FlatButton {
duration: 200; duration: 200;
cursor: cursor(pointer); cursor: cursor(pointer);
@ -177,7 +177,7 @@ historyComposeButton: flatButton {
font: semiboldFont; font: semiboldFont;
overFont: semiboldFont; overFont: semiboldFont;
} }
historyUnblock: flatButton(historyComposeButton) { historyUnblock: FlatButton(historyComposeButton) {
color: #d15948; color: #d15948;
overColor: #d15948; overColor: #d15948;
} }
@ -307,3 +307,38 @@ topBarMenuToggle: IconButton(topBarSearch) {
iconPosition: point(18px, 17px); iconPosition: point(18px, 17px);
iconPositionDown: point(18px, 17px); iconPositionDown: point(18px, 17px);
} }
reportSpamHide: FlatButton {
duration: 200;
cursor: cursor(pointer);
color: btnYesColor;
overColor: btnYesHover;
bgColor: transparent;
overBgColor: transparent;
width: -40px;
height: 46px;
textTop: 15px;
overTextTop: 15px;
downTextTop: 16px;
font: font(fsize);
overFont: font(fsize underline);
}
reportSpamButton: FlatButton(reportSpamHide) {
textTop: 6px;
overTextTop: 6px;
downTextTop: 7px;
width: -50px;
height: 30px;
bgColor: #888888;
overBgColor: #7b7b7b;
}
reportSpamSeparator: 30px;
reportSpamBg: #fffffff0;
reportSpamFg: #000000;

View file

@ -29,7 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/filedialog.h" #include "ui/filedialog.h"
#include "ui/toast/toast.h" #include "ui/toast/toast.h"
#include "ui/buttons/history_down_button.h" #include "ui/buttons/history_down_button.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/inner_dropdown.h" #include "ui/widgets/inner_dropdown.h"
#include "ui/widgets/dropdown_menu.h" #include "ui/widgets/dropdown_menu.h"
#include "inline_bots/inline_bot_result.h" #include "inline_bots/inline_bot_result.h"
@ -2911,6 +2911,29 @@ HistoryHider::~HistoryHider() {
parent()->noHider(this); parent()->noHider(this);
} }
class SilentToggle : public Ui::IconButton, public Ui::AbstractTooltipShower {
public:
SilentToggle(QWidget *parent);
void setChecked(bool checked);
bool checked() const {
return _checked;
}
// AbstractTooltipShower interface
QString tooltipText() const override;
QPoint tooltipPos() const override;
protected:
void mouseMoveEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void leaveEvent(QEvent *e) override;
private:
bool _checked = false;
};
SilentToggle::SilentToggle(QWidget *parent) : IconButton(parent, st::historySilentToggle) { SilentToggle::SilentToggle(QWidget *parent) : IconButton(parent, st::historySilentToggle) {
setMouseTracking(true); setMouseTracking(true);
} }

View file

@ -23,7 +23,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "localimageloader.h" #include "localimageloader.h"
#include "ui/effects/rect_shadow.h" #include "ui/effects/rect_shadow.h"
#include "ui/widgets/tooltip.h" #include "ui/widgets/tooltip.h"
#include "ui/buttons/icon_button.h"
#include "history/history_common.h" #include "history/history_common.h"
#include "history/field_autocomplete.h" #include "history/field_autocomplete.h"
#include "window/section_widget.h" #include "window/section_widget.h"
@ -44,10 +43,14 @@ class PopupMenu;
class IconButton; class IconButton;
class HistoryDownButton; class HistoryDownButton;
class EmojiButton; class EmojiButton;
class FlatButton;
class LinkButton;
class RoundButton;
} // namespace Ui } // namespace Ui
class DragArea; class DragArea;
class EmojiPan; class EmojiPan;
class SilentToggle;
class HistoryWidget; class HistoryWidget;
class HistoryInner : public TWidget, public Ui::AbstractTooltipShower, private base::Subscriber { class HistoryInner : public TWidget, public Ui::AbstractTooltipShower, private base::Subscriber {
@ -350,9 +353,9 @@ protected:
void paintEvent(QPaintEvent *e) override; void paintEvent(QPaintEvent *e) override;
private: private:
ChildWidget<FlatButton> _report; ChildWidget<Ui::FlatButton> _report;
ChildWidget<FlatButton> _hide; ChildWidget<Ui::FlatButton> _hide;
ChildWidget<LinkButton> _clear; ChildWidget<Ui::LinkButton> _clear;
}; };
@ -489,8 +492,8 @@ private:
QString _shareUrl, _shareText; QString _shareUrl, _shareText;
QString _botAndQuery; QString _botAndQuery;
ChildWidget<BoxButton> _send; ChildWidget<Ui::RoundButton> _send;
ChildWidget<BoxButton> _cancel; ChildWidget<Ui::RoundButton> _cancel;
PeerData *_offered = nullptr; PeerData *_offered = nullptr;
anim::fvalue a_opacity; anim::fvalue a_opacity;
@ -511,29 +514,6 @@ private:
}; };
class SilentToggle : public Ui::IconButton, public Ui::AbstractTooltipShower {
public:
SilentToggle(QWidget *parent);
void setChecked(bool checked);
bool checked() const {
return _checked;
}
// AbstractTooltipShower interface
QString tooltipText() const override;
QPoint tooltipPos() const override;
protected:
void mouseMoveEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void leaveEvent(QEvent *e) override;
private:
bool _checked = false;
};
EntitiesInText entitiesFromTextTags(const TextWithTags::Tags &tags); EntitiesInText entitiesFromTextTags(const TextWithTags::Tags &tags);
TextWithTags::Tags textTagsFromEntities(const EntitiesInText &entities); TextWithTags::Tags textTagsFromEntities(const EntitiesInText &entities);
@ -1099,10 +1079,10 @@ private:
ReportSpamPanel _reportSpamPanel; ReportSpamPanel _reportSpamPanel;
ChildWidget<Ui::IconButton> _send; ChildWidget<Ui::IconButton> _send;
ChildWidget<FlatButton> _unblock; ChildWidget<Ui::FlatButton> _unblock;
ChildWidget<FlatButton> _botStart; ChildWidget<Ui::FlatButton> _botStart;
ChildWidget<FlatButton> _joinChannel; ChildWidget<Ui::FlatButton> _joinChannel;
ChildWidget<FlatButton> _muteUnmute; ChildWidget<Ui::FlatButton> _muteUnmute;
mtpRequestId _unblockRequest = 0; mtpRequestId _unblockRequest = 0;
mtpRequestId _reportSpamRequest = 0; mtpRequestId _reportSpamRequest = 0;
ChildWidget<Ui::IconButton> _attachToggle; ChildWidget<Ui::IconButton> _attachToggle;

View file

@ -43,6 +43,14 @@ introCountry: countryInput {
align: align(left); align: align(left);
} }
introIcon: icon {{ "intro_logo", #008ed5 }};
introResetLink: LinkButton(defaultLinkButton) {
color: #d15948;
overColor: #d15948;
downColor: #db6352;
}
introBtnTop: 288px; introBtnTop: 288px;
introSkip: 25px; introSkip: 25px;
introFinishSkip: 15px; introFinishSkip: 15px;
@ -51,7 +59,7 @@ introHeaderFont: font(24px);
introHeaderSkip: 14px; introHeaderSkip: 14px;
introIconSkip: 50px; introIconSkip: 50px;
introFont: font(16px); introFont: font(16px);
introLink: linkButton(btnDefLink) { introLink: LinkButton(defaultLinkButton) {
font: introFont; font: introFont;
overFont: font(16px underline); overFont: font(16px underline);
} }

View file

@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "application.h" #include "application.h"
#include "intro/introsignup.h" #include "intro/introsignup.h"
#include "intro/intropwdcheck.h" #include "intro/intropwdcheck.h"
#include "ui/buttons/round_button.h" #include "ui/widgets/buttons.h"
#include "styles/style_intro.h" #include "styles/style_intro.h"
CodeInput::CodeInput(QWidget *parent, const style::flatInput &st, const QString &ph) : FlatInput(parent, st, ph) { CodeInput::CodeInput(QWidget *parent, const style::flatInput &st, const QString &ph) : FlatInput(parent, st, ph) {
@ -86,7 +86,6 @@ IntroCode::IntroCode(IntroWidget *parent) : IntroStep(parent)
, _checkRequest(this) { , _checkRequest(this) {
setGeometry(parent->innerRect()); setGeometry(parent->innerRect());
_next->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitCode())); connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitCode()));
connect(_code, SIGNAL(changed()), this, SLOT(onInputChange())); connect(_code, SIGNAL(changed()), this, SLOT(onInputChange()));
connect(_callTimer, SIGNAL(timeout()), this, SLOT(onSendCall())); connect(_callTimer, SIGNAL(timeout()), this, SLOT(onSendCall()));

View file

@ -20,13 +20,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
#include <QtWidgets/QWidget>
#include "ui/flatbutton.h"
#include "ui/flatinput.h"
#include "intro/introwidget.h" #include "intro/introwidget.h"
class FlatInput;
namespace Ui { namespace Ui {
class RoundButton; class RoundButton;
class LinkButton;
} // namespace Ui } // namespace Ui
class CodeInput final : public FlatInput { class CodeInput final : public FlatInput {
@ -91,7 +91,7 @@ private:
ChildWidget<Ui::RoundButton> _next; ChildWidget<Ui::RoundButton> _next;
Text _desc; Text _desc;
ChildWidget<LinkButton> _noTelegramCode; ChildWidget<Ui::LinkButton> _noTelegramCode;
mtpRequestId _noTelegramCodeRequestId; mtpRequestId _noTelegramCodeRequestId;
QRect _textRect; QRect _textRect;

View file

@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "application.h" #include "application.h"
#include "intro/introcode.h" #include "intro/introcode.h"
#include "styles/style_intro.h" #include "styles/style_intro.h"
#include "ui/buttons/round_button.h" #include "ui/widgets/buttons.h"
namespace { namespace {
class SignUpClickHandler : public LeftButtonClickHandler { class SignUpClickHandler : public LeftButtonClickHandler {
@ -56,7 +56,6 @@ IntroPhone::IntroPhone(IntroWidget *parent) : IntroStep(parent)
setVisible(false); setVisible(false);
setGeometry(parent->innerRect()); setGeometry(parent->innerRect());
_next->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitPhone())); connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitPhone()));
connect(_phone, SIGNAL(voidBackspace(QKeyEvent*)), _code, SLOT(startErasing(QKeyEvent*))); connect(_phone, SIGNAL(voidBackspace(QKeyEvent*)), _code, SLOT(startErasing(QKeyEvent*)));
connect(_country, SIGNAL(codeChanged(const QString &)), _code, SLOT(codeSelected(const QString &))); connect(_country, SIGNAL(codeChanged(const QString &)), _code, SLOT(codeSelected(const QString &)));

View file

@ -20,7 +20,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
#include "ui/flatbutton.h"
#include "ui/countryinput.h" #include "ui/countryinput.h"
#include "ui/flatlabel.h" #include "ui/flatlabel.h"
#include "intro/introwidget.h" #include "intro/introwidget.h"

View file

@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "lang.h" #include "lang.h"
#include "application.h" #include "application.h"
#include "intro/introsignup.h" #include "intro/introsignup.h"
#include "ui/buttons/round_button.h" #include "ui/widgets/buttons.h"
IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStep(parent) IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStep(parent)
, a_errorAlpha(0) , a_errorAlpha(0)
@ -40,12 +40,11 @@ IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStep(parent)
, _codeField(this, st::inpIntroPassword, lang(lng_signin_code)) , _codeField(this, st::inpIntroPassword, lang(lng_signin_code))
, _toRecover(this, lang(lng_signin_recover)) , _toRecover(this, lang(lng_signin_recover))
, _toPassword(this, lang(lng_signin_try_password)) , _toPassword(this, lang(lng_signin_try_password))
, _reset(this, lang(lng_signin_reset_account), st::btnRedLink) , _reset(this, lang(lng_signin_reset_account), st::introResetLink)
, _checkRequest(this) { , _checkRequest(this) {
setVisible(false); setVisible(false);
setGeometry(parent->innerRect()); setGeometry(parent->innerRect());
_next->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitPwd())); connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitPwd()));
connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest())); connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));
connect(_toRecover, SIGNAL(clicked()), this, SLOT(onToRecover())); connect(_toRecover, SIGNAL(clicked()), this, SLOT(onToRecover()));

View file

@ -20,11 +20,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
#include "ui/flatinput.h"
#include "intro/introwidget.h" #include "intro/introwidget.h"
class FlatInput;
namespace Ui { namespace Ui {
class RoundButton; class RoundButton;
class LinkButton;
} // namespace Ui } // namespace Ui
class IntroPwdCheck final : public IntroStep { class IntroPwdCheck final : public IntroStep {
@ -80,9 +82,9 @@ private:
ChildWidget<FlatInput> _pwdField; ChildWidget<FlatInput> _pwdField;
ChildWidget<FlatInput> _codeField; ChildWidget<FlatInput> _codeField;
ChildWidget<LinkButton> _toRecover; ChildWidget<Ui::LinkButton> _toRecover;
ChildWidget<LinkButton> _toPassword; ChildWidget<Ui::LinkButton> _toPassword;
ChildWidget<LinkButton> _reset; ChildWidget<Ui::LinkButton> _reset;
mtpRequestId _sentRequest = 0; mtpRequestId _sentRequest = 0;
Text _hintText; Text _hintText;

View file

@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/photocropbox.h" #include "boxes/photocropbox.h"
#include "lang.h" #include "lang.h"
#include "application.h" #include "application.h"
#include "ui/buttons/round_button.h" #include "ui/widgets/buttons.h"
IntroSignup::IntroSignup(IntroWidget *parent) : IntroStep(parent) IntroSignup::IntroSignup(IntroWidget *parent) : IntroStep(parent)
, a_errorAlpha(0) , a_errorAlpha(0)
@ -42,7 +42,6 @@ IntroSignup::IntroSignup(IntroWidget *parent) : IntroStep(parent)
setVisible(false); setVisible(false);
setGeometry(parent->innerRect()); setGeometry(parent->innerRect());
_next->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitName())); connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitName()));
connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest())); connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));

View file

@ -20,7 +20,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
#include "ui/flatbutton.h"
#include "ui/flatinput.h" #include "ui/flatinput.h"
#include "intro/introwidget.h" #include "intro/introwidget.h"

View file

@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "application.h" #include "application.h"
#include "intro/introphone.h" #include "intro/introphone.h"
#include "langloaderplain.h" #include "langloaderplain.h"
#include "ui/buttons/round_button.h" #include "ui/widgets/buttons.h"
IntroStart::IntroStart(IntroWidget *parent) : IntroStep(parent) IntroStart::IntroStart(IntroWidget *parent) : IntroStep(parent)
, _intro(this, lang(lng_intro), FlatLabel::InitType::Rich, st::introLabel, st::introLabelTextStyle) , _intro(this, lang(lng_intro), FlatLabel::InitType::Rich, st::introLabel, st::introLabelTextStyle)
@ -53,7 +53,6 @@ IntroStart::IntroStart(IntroWidget *parent) : IntroStep(parent)
setGeometry(parent->innerRect()); setGeometry(parent->innerRect());
_next->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
connect(_next, SIGNAL(clicked()), parent, SLOT(onStepSubmit())); connect(_next, SIGNAL(clicked()), parent, SLOT(onStepSubmit()));
connect(_changeLang, SIGNAL(clicked()), parent, SLOT(onChangeLang())); connect(_changeLang, SIGNAL(clicked()), parent, SLOT(onChangeLang()));
@ -74,7 +73,7 @@ void IntroStart::paintEvent(QPaintEvent *e) {
p.setPen(st::introHeaderFg); p.setPen(st::introHeaderFg);
p.drawText((width() - _headerWidth) / 2, hy, qsl("Telegram Desktop")); p.drawText((width() - _headerWidth) / 2, hy, qsl("Telegram Desktop"));
st::aboutIcon.paint(p, QPoint((width() - st::aboutIcon.width()) / 2, hy - st::introIconSkip - st::aboutIcon.height()), width()); st::introIcon.paint(p, QPoint((width() - st::introIcon.width()) / 2, hy - st::introIconSkip - st::introIcon.height()), width());
} }
void IntroStart::resizeEvent(QResizeEvent *e) { void IntroStart::resizeEvent(QResizeEvent *e) {

View file

@ -21,9 +21,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#pragma once #pragma once
#include "intro/introwidget.h" #include "intro/introwidget.h"
#include "ui/flatlabel.h"
class FlatLabel;
namespace Ui { namespace Ui {
class LinkButton;
class RoundButton; class RoundButton;
} // namespace Ui } // namespace Ui
@ -39,7 +41,7 @@ public:
private: private:
ChildWidget<FlatLabel> _intro; ChildWidget<FlatLabel> _intro;
ChildWidget<LinkButton> _changeLang; ChildWidget<Ui::LinkButton> _changeLang;
ChildWidget<Ui::RoundButton> _next; ChildWidget<Ui::RoundButton> _next;

View file

@ -32,7 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwindow.h" #include "mainwindow.h"
#include "application.h" #include "application.h"
#include "ui/text/text.h" #include "ui/text/text.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "ui/effects/widget_fade_wrap.h" #include "ui/effects/widget_fade_wrap.h"
#include "styles/style_intro.h" #include "styles/style_intro.h"
#include "autoupdater.h" #include "autoupdater.h"

View file

@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Ui { namespace Ui {
class IconButton; class IconButton;
class RoundButton;
template <typename Widget> template <typename Widget>
class WidgetFadeWrap; class WidgetFadeWrap;
} // namespace Ui } // namespace Ui
@ -152,8 +153,8 @@ private:
QString _firstname, _lastname; QString _firstname, _lastname;
ChildWidget<Ui::WidgetFadeWrap<Ui::IconButton>> _back; ChildWidget<Ui::WidgetFadeWrap<Ui::IconButton>> _back;
ChildWidget<BoxButton> _settings; ChildWidget<Ui::RoundButton> _settings;
ChildWidget<BoxButton> _update = { nullptr }; ChildWidget<Ui::RoundButton> _update = { nullptr };
float64 _backFrom = 0.; float64 _backFrom = 0.;
float64 _backTo = 0.; float64 _backTo = 0.;

View file

@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_dialogs.h" #include "styles/style_dialogs.h"
#include "ui/buttons/peer_avatar_button.h" #include "ui/buttons/peer_avatar_button.h"
#include "ui/buttons/round_button.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/shadow.h" #include "ui/widgets/shadow.h"
#include "window/section_memento.h" #include "window/section_memento.h"
#include "window/section_widget.h" #include "window/section_widget.h"

View file

@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_dialogs.h" #include "styles/style_dialogs.h"
#include "styles/style_window.h" #include "styles/style_window.h"
#include "ui/widgets/popup_menu.h" #include "ui/widgets/popup_menu.h"
#include "ui/widgets/buttons.h"
#include "core/zlib_help.h" #include "core/zlib_help.h"
#include "lang.h" #include "lang.h"
#include "shortcuts.h" #include "shortcuts.h"
@ -52,7 +53,7 @@ ConnectingWidget::ConnectingWidget(QWidget *parent, const QString &text, const Q
, _shadow(st::boxShadow) , _shadow(st::boxShadow)
, _reconnect(this, QString()) { , _reconnect(this, QString()) {
set(text, reconnect); set(text, reconnect);
connect(&_reconnect, SIGNAL(clicked()), this, SLOT(onReconnect())); connect(_reconnect, SIGNAL(clicked()), this, SLOT(onReconnect()));
} }
void ConnectingWidget::set(const QString &text, const QString &reconnect) { void ConnectingWidget::set(const QString &text, const QString &reconnect) {
@ -60,12 +61,12 @@ void ConnectingWidget::set(const QString &text, const QString &reconnect) {
_textWidth = st::linkFont->width(_text) + st::linkFont->spacew; _textWidth = st::linkFont->width(_text) + st::linkFont->spacew;
int32 _reconnectWidth = 0; int32 _reconnectWidth = 0;
if (reconnect.isEmpty()) { if (reconnect.isEmpty()) {
_reconnect.hide(); _reconnect->hide();
} else { } else {
_reconnect.setText(reconnect); _reconnect->setText(reconnect);
_reconnect.show(); _reconnect->show();
_reconnect.move(st::connectingPadding.left() + _textWidth, st::boxShadow.height() + st::connectingPadding.top()); _reconnect->move(st::connectingPadding.left() + _textWidth, st::boxShadow.height() + st::connectingPadding.top());
_reconnectWidth = _reconnect.width(); _reconnectWidth = _reconnect->width();
} }
resize(st::connectingPadding.left() + _textWidth + _reconnectWidth + st::connectingPadding.right() + st::boxShadow.width(), st::boxShadow.height() + st::connectingPadding.top() + st::linkFont->height + st::connectingPadding.bottom()); resize(st::connectingPadding.left() + _textWidth + _reconnectWidth + st::connectingPadding.right() + st::boxShadow.width(), st::boxShadow.height() + st::connectingPadding.top() + st::linkFont->height + st::connectingPadding.bottom());
update(); update();

View file

@ -47,6 +47,10 @@ class WarningWidget;
} // namespace Theme } // namespace Theme
} // namespace Window } // namespace Window
namespace Ui {
class LinkButton;
} // namespace Ui
class ConnectingWidget : public TWidget { class ConnectingWidget : public TWidget {
Q_OBJECT Q_OBJECT
@ -64,7 +68,7 @@ private:
Ui::RectShadow _shadow; Ui::RectShadow _shadow;
QString _text; QString _text;
int32 _textWidth; int32 _textWidth;
LinkButton _reconnect; ChildWidget<Ui::LinkButton> _reconnect;
}; };

View file

@ -20,7 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
#include "ui/button.h" #include "ui/abstract_button.h"
#include "styles/style_media_player.h" #include "styles/style_media_player.h"
namespace Media { namespace Media {

View file

@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/flatlabel.h" #include "ui/flatlabel.h"
#include "ui/widgets/label_simple.h" #include "ui/widgets/label_simple.h"
#include "ui/widgets/media_slider.h" #include "ui/widgets/media_slider.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "media/media_audio.h" #include "media/media_audio.h"
#include "media/view/media_clip_playback.h" #include "media/view/media_clip_playback.h"
#include "media/player/media_player_button.h" #include "media/player/media_player_button.h"
@ -38,7 +38,7 @@ namespace Player {
using State = PlayButtonLayout::State; using State = PlayButtonLayout::State;
class CoverWidget::PlayButton : public Button { class CoverWidget::PlayButton : public Ui::AbstractButton {
public: public:
PlayButton(QWidget *parent); PlayButton(QWidget *parent);
@ -57,7 +57,7 @@ private:
}; };
CoverWidget::PlayButton::PlayButton(QWidget *parent) : Button(parent) CoverWidget::PlayButton::PlayButton(QWidget *parent) : Ui::AbstractButton(parent)
, _layout(st::mediaPlayerPanelButton, [this] { update(); }) { , _layout(st::mediaPlayerPanelButton, [this] { update(); }) {
resize(st::mediaPlayerPanelButtonSize); resize(st::mediaPlayerPanelButtonSize);
setCursor(style::cur_pointer); setCursor(style::cur_pointer);

View file

@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "media/player/media_player_volume_controller.h" #include "media/player/media_player_volume_controller.h"
#include "media/media_audio.h" #include "media/media_audio.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/media_slider.h" #include "ui/widgets/media_slider.h"
#include "styles/style_media_player.h" #include "styles/style_media_player.h"
#include "styles/style_widgets.h" #include "styles/style_widgets.h"

View file

@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/widgets/label_simple.h" #include "ui/widgets/label_simple.h"
#include "ui/widgets/filled_slider.h" #include "ui/widgets/filled_slider.h"
#include "ui/widgets/shadow.h" #include "ui/widgets/shadow.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "media/media_audio.h" #include "media/media_audio.h"
#include "media/view/media_clip_playback.h" #include "media/view/media_clip_playback.h"
#include "media/player/media_player_button.h" #include "media/player/media_player_button.h"
@ -39,7 +39,7 @@ namespace Player {
using State = PlayButtonLayout::State; using State = PlayButtonLayout::State;
class Widget::PlayButton : public Button { class Widget::PlayButton : public Ui::AbstractButton {
public: public:
PlayButton(QWidget *parent); PlayButton(QWidget *parent);
@ -58,7 +58,7 @@ private:
}; };
Widget::PlayButton::PlayButton(QWidget *parent) : Button(parent) Widget::PlayButton::PlayButton(QWidget *parent) : Ui::AbstractButton(parent)
, _layout(st::mediaPlayerButton, [this] { update(); }) { , _layout(st::mediaPlayerButton, [this] { update(); }) {
resize(st::mediaPlayerButtonSize); resize(st::mediaPlayerButtonSize);
setCursor(style::cur_pointer); setCursor(style::cur_pointer);

View file

@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/widgets/label_simple.h" #include "ui/widgets/label_simple.h"
#include "ui/widgets/media_slider.h" #include "ui/widgets/media_slider.h"
#include "ui/effects/widget_fade_wrap.h" #include "ui/effects/widget_fade_wrap.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "media/media_audio.h" #include "media/media_audio.h"
namespace Media { namespace Media {

View file

@ -115,7 +115,7 @@ mediaviewFileExtPadding: 10px;
mediaviewFileLinksTop: 57px; mediaviewFileLinksTop: 57px;
mediaviewFileIconSize: 80px; mediaviewFileIconSize: 80px;
mediaviewFileLink: linkButton(btnDefLink) { mediaviewFileLink: LinkButton(defaultLinkButton) {
color: #4595d3; color: #4595d3;
overColor: #4595d3; overColor: #4595d3;
downColor: #4595d3; downColor: #4595d3;

View file

@ -27,6 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "application.h" #include "application.h"
#include "ui/filedialog.h" #include "ui/filedialog.h"
#include "ui/widgets/popup_menu.h" #include "ui/widgets/popup_menu.h"
#include "ui/widgets/buttons.h"
#include "media/media_clip_reader.h" #include "media/media_clip_reader.h"
#include "media/view/media_clip_controller.h" #include "media/view/media_clip_controller.h"
#include "styles/style_mediaview.h" #include "styles/style_mediaview.h"
@ -130,9 +131,9 @@ MediaView::MediaView() : TWidget(App::wnd())
_controlsHideTimer.setSingleShot(true); _controlsHideTimer.setSingleShot(true);
connect(&_controlsHideTimer, SIGNAL(timeout()), this, SLOT(onHideControls())); connect(&_controlsHideTimer, SIGNAL(timeout()), this, SLOT(onHideControls()));
connect(&_docDownload, SIGNAL(clicked()), this, SLOT(onDownload())); connect(_docDownload, SIGNAL(clicked()), this, SLOT(onDownload()));
connect(&_docSaveAs, SIGNAL(clicked()), this, SLOT(onSaveAs())); connect(_docSaveAs, SIGNAL(clicked()), this, SLOT(onSaveAs()));
connect(&_docCancel, SIGNAL(clicked()), this, SLOT(onSaveCancel())); connect(_docCancel, SIGNAL(clicked()), this, SLOT(onSaveCancel()));
_dropdown->setHiddenCallback([this] { dropdownHidden(); }); _dropdown->setHiddenCallback([this] { dropdownHidden(); });
} }
@ -237,7 +238,7 @@ void MediaView::stopGif() {
void MediaView::documentUpdated(DocumentData *doc) { void MediaView::documentUpdated(DocumentData *doc) {
if (_doc && _doc == doc && !fileShown()) { if (_doc && _doc == doc && !fileShown()) {
if ((_doc->loading() && _docCancel.isHidden()) || (!_doc->loading() && !_docCancel.isHidden())) { if ((_doc->loading() && _docCancel->isHidden()) || (!_doc->loading() && !_docCancel->isHidden())) {
updateControls(); updateControls();
} else if (_doc->loading()) { } else if (_doc->loading()) {
updateDocSize(); updateDocSize();
@ -289,29 +290,29 @@ void MediaView::updateDocSize() {
void MediaView::updateControls() { void MediaView::updateControls() {
if (_doc && !fileShown()) { if (_doc && !fileShown()) {
if (_doc->loading()) { if (_doc->loading()) {
_docDownload.hide(); _docDownload->hide();
_docSaveAs.hide(); _docSaveAs->hide();
_docCancel.moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop); _docCancel->moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
_docCancel.show(); _docCancel->show();
} else { } else {
if (_doc->loaded(DocumentData::FilePathResolveChecked)) { if (_doc->loaded(DocumentData::FilePathResolveChecked)) {
_docDownload.hide(); _docDownload->hide();
_docSaveAs.moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop); _docSaveAs->moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
_docSaveAs.show(); _docSaveAs->show();
_docCancel.hide(); _docCancel->hide();
} else { } else {
_docDownload.moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop); _docDownload->moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
_docDownload.show(); _docDownload->show();
_docSaveAs.moveToLeft(_docRect.x() + 2.5 * st::mediaviewFilePadding + st::mediaviewFileIconSize + _docDownload.width(), _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop); _docSaveAs->moveToLeft(_docRect.x() + 2.5 * st::mediaviewFilePadding + st::mediaviewFileIconSize + _docDownload->width(), _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
_docSaveAs.show(); _docSaveAs->show();
_docCancel.hide(); _docCancel->hide();
} }
} }
updateDocSize(); updateDocSize();
} else { } else {
_docDownload.hide(); _docDownload->hide();
_docSaveAs.hide(); _docSaveAs->hide();
_docCancel.hide(); _docCancel->hide();
} }
radialStart(); radialStart();

View file

@ -31,6 +31,7 @@ class Controller;
namespace Ui { namespace Ui {
class PopupMenu; class PopupMenu;
class LinkButton;
} // namespace Ui } // namespace Ui
struct AudioPlaybackState; struct AudioPlaybackState;
@ -242,7 +243,9 @@ private:
int _docNameWidth = 0, _docSizeWidth = 0, _docExtWidth = 0; int _docNameWidth = 0, _docSizeWidth = 0, _docExtWidth = 0;
QRect _docRect, _docIconRect; QRect _docRect, _docIconRect;
int _docThumbx = 0, _docThumby = 0, _docThumbw = 0; int _docThumbx = 0, _docThumby = 0, _docThumbw = 0;
LinkButton _docDownload, _docSaveAs, _docCancel; ChildWidget<Ui::LinkButton> _docDownload;
ChildWidget<Ui::LinkButton> _docSaveAs;
ChildWidget<Ui::LinkButton> _docCancel;
QRect _photoRadialRect; QRect _photoRadialRect;
Ui::RadialAnimation _radial; Ui::RadialAnimation _radial;

View file

@ -29,7 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/filedialog.h" #include "ui/filedialog.h"
#include "ui/widgets/popup_menu.h" #include "ui/widgets/popup_menu.h"
#include "ui/widgets/tooltip.h" #include "ui/widgets/tooltip.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "window/top_bar_widget.h" #include "window/top_bar_widget.h"
#include "window/window_theme.h" #include "window/window_theme.h"
#include "lang.h" #include "lang.h"

View file

@ -26,7 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwindow.h" #include "mainwindow.h"
#include "application.h" #include "application.h"
#include "ui/text/text.h" #include "ui/text/text.h"
#include "ui/buttons/round_button.h" #include "ui/widgets/buttons.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "window/slide_animation.h" #include "window/slide_animation.h"
@ -39,7 +39,6 @@ PasscodeWidget::PasscodeWidget(QWidget *parent) : TWidget(parent)
connect(_passcode, SIGNAL(changed()), this, SLOT(onChanged())); connect(_passcode, SIGNAL(changed()), this, SLOT(onChanged()));
connect(_passcode, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(_passcode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
_submit->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
_submit->setClickedCallback([this] { onSubmit(); }); _submit->setClickedCallback([this] { onSubmit(); });
_logout->setClickedCallback([] { App::wnd()->onLogout(); }); _logout->setClickedCallback([] { App::wnd()->onLogout(); });

View file

@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#pragma once #pragma once
namespace Ui { namespace Ui {
class LinkButton;
class RoundButton; class RoundButton;
} // namespace Ui } // namespace Ui
@ -56,7 +57,7 @@ private:
ChildWidget<FlatInput> _passcode; ChildWidget<FlatInput> _passcode;
ChildWidget<Ui::RoundButton> _submit; ChildWidget<Ui::RoundButton> _submit;
ChildWidget<LinkButton> _logout; ChildWidget<Ui::LinkButton> _logout;
QString _error; QString _error;
}; };

View file

@ -21,7 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "stdafx.h" #include "stdafx.h"
#include "platform/win/window_title_win.h" #include "platform/win/window_title_win.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/shadow.h" #include "ui/widgets/shadow.h"
#include "styles/style_window.h" #include "styles/style_window.h"

View file

@ -25,10 +25,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_window.h" #include "styles/style_window.h"
#include "profile/profile_cover_drop_area.h" #include "profile/profile_cover_drop_area.h"
#include "profile/profile_userpic_button.h" #include "profile/profile_userpic_button.h"
#include "ui/buttons/round_button.h" #include "ui/widgets/buttons.h"
#include "ui/filedialog.h" #include "ui/filedialog.h"
#include "ui/flatlabel.h" #include "ui/flatlabel.h"
#include "ui/flatbutton.h"
#include "observer_peer.h" #include "observer_peer.h"
#include "boxes/confirmbox.h" #include "boxes/confirmbox.h"
#include "boxes/contactsbox.h" #include "boxes/contactsbox.h"
@ -354,7 +353,7 @@ void CoverWidget::refreshStatusText() {
_statusText = lang(lng_settings_uploading_photo); _statusText = lang(lng_settings_uploading_photo);
_statusTextIsOnline = false; _statusTextIsOnline = false;
if (!_cancelPhotoUpload) { if (!_cancelPhotoUpload) {
_cancelPhotoUpload = new LinkButton(this, lang(lng_cancel), st::btnDefLink); _cancelPhotoUpload.create(this, lang(lng_cancel), st::defaultLinkButton);
connect(_cancelPhotoUpload, SIGNAL(clicked()), this, SLOT(onCancelPhotoUpload())); connect(_cancelPhotoUpload, SIGNAL(clicked()), this, SLOT(onCancelPhotoUpload()));
_cancelPhotoUpload->show(); _cancelPhotoUpload->show();
_cancelPhotoUpload->moveToLeft(_statusPosition.x() + st::profileStatusFont->width(_statusText) + st::profileStatusFont->spacew, _statusPosition.y()); _cancelPhotoUpload->moveToLeft(_statusPosition.x() + st::profileStatusFont->width(_statusText) + st::profileStatusFont->spacew, _statusPosition.y());
@ -455,7 +454,6 @@ void CoverWidget::clearButtons() {
void CoverWidget::addButton(const QString &text, const char *slot, const style::RoundButton *replacementStyle) { void CoverWidget::addButton(const QString &text, const char *slot, const style::RoundButton *replacementStyle) {
auto &buttonStyle = _buttons.isEmpty() ? st::profilePrimaryButton : st::profileSecondaryButton; auto &buttonStyle = _buttons.isEmpty() ? st::profilePrimaryButton : st::profileSecondaryButton;
auto button = new Ui::RoundButton(this, text, buttonStyle); auto button = new Ui::RoundButton(this, text, buttonStyle);
button->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
connect(button, SIGNAL(clicked()), this, slot); connect(button, SIGNAL(clicked()), this, slot);
button->show(); button->show();

View file

@ -24,10 +24,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/filedialog.h" #include "ui/filedialog.h"
class FlatLabel; class FlatLabel;
class LinkButton;
namespace Ui { namespace Ui {
class RoundButton; class RoundButton;
class LinkButton;
} // namespace Ui } // namespace Ui
namespace Notify { namespace Notify {
@ -118,7 +118,7 @@ private:
ChildWidget<CoverDropArea> _dropArea = { nullptr }; ChildWidget<CoverDropArea> _dropArea = { nullptr };
ChildWidget<FlatLabel> _name; ChildWidget<FlatLabel> _name;
ChildWidget<LinkButton> _cancelPhotoUpload = { nullptr }; ChildWidget<Ui::LinkButton> _cancelPhotoUpload = { nullptr };
QPoint _statusPosition; QPoint _statusPosition;
QString _statusText; QString _statusText;

View file

@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_profile.h" #include "styles/style_profile.h"
#include "styles/style_window.h" #include "styles/style_window.h"
#include "ui/buttons/round_button.h" #include "ui/widgets/buttons.h"
#include "lang.h" #include "lang.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "boxes/addcontactbox.h" #include "boxes/addcontactbox.h"
@ -33,9 +33,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Profile { namespace Profile {
class BackButton final : public Button, private base::Subscriber { class BackButton final : public Ui::AbstractButton, private base::Subscriber {
public: public:
BackButton(QWidget *parent) : Button(parent) { BackButton(QWidget *parent) : Ui::AbstractButton(parent) {
setCursor(style::cur_pointer); setCursor(style::cur_pointer);
subscribe(Adaptive::Changed(), [this] { updateAdaptiveLayout(); }); subscribe(Adaptive::Changed(), [this] { updateAdaptiveLayout(); });
@ -58,8 +58,8 @@ protected:
Window::TopBarWidget::paintUnreadCounter(p, width()); Window::TopBarWidget::paintUnreadCounter(p, width());
} }
void onStateChanged(int oldState, ButtonStateChangeSource source) override { void onStateChanged(int oldState, StateChangeSource source) override {
if ((_state & Button::StateDown) && !(oldState & Button::StateDown)) { if ((_state & StateDown) && !(oldState & StateDown)) {
emit clicked(); emit clicked();
} }
} }
@ -186,6 +186,7 @@ void FixedBar::addRightAction(RightActionType type, const QString &text, const c
_rightActions[_currentAction].type = type; _rightActions[_currentAction].type = type;
delete _rightActions[_currentAction].button; delete _rightActions[_currentAction].button;
_rightActions[_currentAction].button = new Ui::RoundButton(this, text, st::profileFixedBarButton); _rightActions[_currentAction].button = new Ui::RoundButton(this, text, st::profileFixedBarButton);
_rightActions[_currentAction].button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
connect(_rightActions[_currentAction].button, SIGNAL(clicked()), this, slot); connect(_rightActions[_currentAction].button, SIGNAL(clicked()), this, slot);
bool showButton = !_animatingMode && (type != RightActionType::ShareContact || !_hideShareContactButton); bool showButton = !_animatingMode && (type != RightActionType::ShareContact || !_hideShareContactButton);
_rightActions[_currentAction].button->setVisible(showButton); _rightActions[_currentAction].button->setVisible(showButton);

View file

@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_profile.h" #include "styles/style_profile.h"
#include "ui/buttons/left_outline_button.h" #include "ui/buttons/left_outline_button.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "boxes/confirmbox.h" #include "boxes/confirmbox.h"
#include "boxes/contactsbox.h" #include "boxes/contactsbox.h"
#include "observer_peer.h" #include "observer_peer.h"

View file

@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Profile { namespace Profile {
UserpicButton::UserpicButton(QWidget *parent, PeerData *peer) : Button(parent), _peer(peer) { UserpicButton::UserpicButton(QWidget *parent, PeerData *peer) : AbstractButton(parent), _peer(peer) {
resize(st::profilePhotoSize, st::profilePhotoSize); resize(st::profilePhotoSize, st::profilePhotoSize);
processPeerPhoto(); processPeerPhoto();

View file

@ -20,6 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
#include "ui/abstract_button.h"
#include "core/observer.h" #include "core/observer.h"
namespace Notify { namespace Notify {
@ -28,7 +29,7 @@ struct PeerUpdate;
namespace Profile { namespace Profile {
class UserpicButton final : public Button, private base::Subscriber { class UserpicButton : public Ui::AbstractButton, private base::Subscriber {
public: public:
UserpicButton(QWidget *parent, PeerData *peer); UserpicButton(QWidget *parent, PeerData *peer);

View file

@ -28,6 +28,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/aboutbox.h" #include "boxes/aboutbox.h"
#include "boxes/localstoragebox.h" #include "boxes/localstoragebox.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "ui/widgets/buttons.h"
namespace Settings { namespace Settings {

View file

@ -49,14 +49,14 @@ private:
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY #endif // !TDESKTOP_DISABLE_NETWORK_PROXY
void supportGot(const MTPhelp_Support &support); void supportGot(const MTPhelp_Support &support);
ChildWidget<LinkButton> _manageLocalStorage = { nullptr }; ChildWidget<Ui::LinkButton> _manageLocalStorage = { nullptr };
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY #ifndef TDESKTOP_DISABLE_NETWORK_PROXY
ChildWidget<LabeledLink> _connectionType = { nullptr }; ChildWidget<LabeledLink> _connectionType = { nullptr };
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY #endif // !TDESKTOP_DISABLE_NETWORK_PROXY
ChildWidget<LinkButton> _askQuestion = { nullptr }; ChildWidget<Ui::LinkButton> _askQuestion = { nullptr };
ChildWidget<LinkButton> _telegramFAQ = { nullptr }; ChildWidget<Ui::LinkButton> _telegramFAQ = { nullptr };
ChildWidget<LinkButton> _about = { nullptr }; ChildWidget<Ui::LinkButton> _about = { nullptr };
ChildWidget<LinkButton> _logOut = { nullptr }; ChildWidget<Ui::LinkButton> _logOut = { nullptr };
mtpRequestId _supportGetRequest = 0; mtpRequestId _supportGetRequest = 0;

View file

@ -26,7 +26,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwidget.h" #include "mainwidget.h"
#include "boxes/backgroundbox.h" #include "boxes/backgroundbox.h"
#include "ui/effects/widget_slide_wrap.h" #include "ui/effects/widget_slide_wrap.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "localstorage.h" #include "localstorage.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "window/window_theme.h" #include "window/window_theme.h"
@ -34,8 +35,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Settings { namespace Settings {
BackgroundRow::BackgroundRow(QWidget *parent) : TWidget(parent) BackgroundRow::BackgroundRow(QWidget *parent) : TWidget(parent)
, _chooseFromGallery(this, lang(lng_settings_bg_from_gallery), st::defaultBoxLinkButton) , _chooseFromGallery(this, lang(lng_settings_bg_from_gallery), st::boxLinkButton)
, _chooseFromFile(this, lang(lng_settings_bg_from_file), st::defaultBoxLinkButton) , _chooseFromFile(this, lang(lng_settings_bg_from_file), st::boxLinkButton)
, _radial(animation(this, &BackgroundRow::step_radial)) { , _radial(animation(this, &BackgroundRow::step_radial)) {
updateImage(); updateImage();

View file

@ -24,14 +24,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/effects/radial_animation.h" #include "ui/effects/radial_animation.h"
#include "ui/filedialog.h" #include "ui/filedialog.h"
class LinkButton;
namespace Ui {
class Checkbox;
template <typename Widget>
class WidgetSlideWrap;
} // namespace Ui;
namespace Settings { namespace Settings {
class BackgroundRow : public TWidget { class BackgroundRow : public TWidget {
@ -60,8 +52,8 @@ private:
void step_radial(uint64 ms, bool timer); void step_radial(uint64 ms, bool timer);
QPixmap _background; QPixmap _background;
ChildWidget<LinkButton> _chooseFromGallery; ChildWidget<Ui::LinkButton> _chooseFromGallery;
ChildWidget<LinkButton> _chooseFromFile; ChildWidget<Ui::LinkButton> _chooseFromFile;
Ui::RadialAnimation _radial; Ui::RadialAnimation _radial;

View file

@ -22,7 +22,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "settings/settings_block_widget.h" #include "settings/settings_block_widget.h"
#include "styles/style_settings.h" #include "styles/style_settings.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
namespace Settings { namespace Settings {
@ -85,17 +86,17 @@ void BlockWidget::rowHeightUpdated() {
} }
void BlockWidget::createChildRow(ChildWidget<Ui::Checkbox> &child, style::margins &margin, const QString &text, const char *slot, bool checked) { void BlockWidget::createChildRow(ChildWidget<Ui::Checkbox> &child, style::margins &margin, const QString &text, const char *slot, bool checked) {
child = new Ui::Checkbox(this, text, checked, st::defaultBoxCheckbox); child.create(this, text, checked, st::defaultBoxCheckbox);
connect(child, SIGNAL(changed()), this, slot); connect(child, SIGNAL(changed()), this, slot);
} }
void BlockWidget::createChildRow(ChildWidget<Ui::Radiobutton> &child, style::margins &margin, const QString &group, int value, const QString &text, const char *slot, bool checked) { void BlockWidget::createChildRow(ChildWidget<Ui::Radiobutton> &child, style::margins &margin, const QString &group, int value, const QString &text, const char *slot, bool checked) {
child = new Ui::Radiobutton(this, group, value, text, checked, st::defaultRadiobutton); child .create(this, group, value, text, checked, st::defaultRadiobutton);
connect(child, SIGNAL(changed()), this, slot); connect(child, SIGNAL(changed()), this, slot);
} }
void BlockWidget::createChildRow(ChildWidget<LinkButton> &child, style::margins &margin, const QString &text, const char *slot, const style::linkButton &st) { void BlockWidget::createChildRow(ChildWidget<Ui::LinkButton> &child, style::margins &margin, const QString &text, const char *slot, const style::LinkButton &st) {
child = new LinkButton(this, text, st); child .create(this, text, st);
connect(child, SIGNAL(clicked()), this, slot); connect(child, SIGNAL(clicked()), this, slot);
} }

View file

@ -21,10 +21,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#pragma once #pragma once
#include "core/observer.h" #include "core/observer.h"
#include "styles/style_boxes.h"
namespace Ui { namespace Ui {
class Checkbox; class Checkbox;
class Radiobutton; class Radiobutton;
class LinkButton;
template <typename Widget> template <typename Widget>
class WidgetSlideWrap; class WidgetSlideWrap;
} // namespace Ui } // namespace Ui
@ -88,7 +90,7 @@ private:
} }
void createChildRow(ChildWidget<Ui::Checkbox> &child, style::margins &margin, const QString &text, const char *slot, bool checked); void createChildRow(ChildWidget<Ui::Checkbox> &child, style::margins &margin, const QString &text, const char *slot, bool checked);
void createChildRow(ChildWidget<Ui::Radiobutton> &child, style::margins &margin, const QString &group, int value, const QString &text, const char *slot, bool checked); void createChildRow(ChildWidget<Ui::Radiobutton> &child, style::margins &margin, const QString &group, int value, const QString &text, const char *slot, bool checked);
void createChildRow(ChildWidget<LinkButton> &child, style::margins &margin, const QString &text, const char *slot, const style::linkButton &st = st::defaultBoxLinkButton); void createChildRow(ChildWidget<Ui::LinkButton> &child, style::margins &margin, const QString &text, const char *slot, const style::LinkButton &st = st::boxLinkButton);
void addCreatedRow(TWidget *child, const style::margins &margin); void addCreatedRow(TWidget *child, const style::margins &margin);
void rowHeightUpdated(); void rowHeightUpdated();
@ -107,7 +109,7 @@ private:
!IsWidgetSlideWrap<Widget>::value && !IsWidgetSlideWrap<Widget>::value &&
!std_::is_same<Widget, Ui::Checkbox>::value && !std_::is_same<Widget, Ui::Checkbox>::value &&
!std_::is_same<Widget, Ui::Radiobutton>::value && !std_::is_same<Widget, Ui::Radiobutton>::value &&
!std_::is_same<Widget, LinkButton>::value>; !std_::is_same<Widget, Ui::LinkButton>::value>;
template <typename Widget, typename... Args, typename = NotImplementedYet<Widget>> template <typename Widget, typename... Args, typename = NotImplementedYet<Widget>>
void createChildRow(ChildWidget<Widget> &child, style::margins &margin, Args&&... args) { void createChildRow(ChildWidget<Widget> &child, style::margins &margin, Args&&... args) {

View file

@ -24,7 +24,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_settings.h" #include "styles/style_settings.h"
#include "lang.h" #include "lang.h"
#include "ui/effects/widget_slide_wrap.h" #include "ui/effects/widget_slide_wrap.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "ui/flatlabel.h" #include "ui/flatlabel.h"
#include "localstorage.h" #include "localstorage.h"
#include "mainwidget.h" #include "mainwidget.h"
@ -39,13 +40,12 @@ namespace Settings {
LabeledLink::LabeledLink(QWidget *parent, const QString &label, const QString &text, Type type, const char *slot) : TWidget(parent) LabeledLink::LabeledLink(QWidget *parent, const QString &label, const QString &text, Type type, const char *slot) : TWidget(parent)
, _label(this, label, FlatLabel::InitType::Simple, (type == Type::Primary) ? st::settingsPrimaryLabel : st::labelDefFlat) , _label(this, label, FlatLabel::InitType::Simple, (type == Type::Primary) ? st::settingsPrimaryLabel : st::labelDefFlat)
, _link(this, text, (type == Type::Primary) ? st::defaultBoxLinkButton : st::btnDefLink) { , _link(this, text, (type == Type::Primary) ? st::boxLinkButton : st::defaultLinkButton) {
connect(_link, SIGNAL(clicked()), parent, slot); connect(_link, SIGNAL(clicked()), parent, slot);
} }
void LabeledLink::setLink(const QString &text) { void LabeledLink::setLink(const QString &text) {
_link.destroy(); _link.create(this, text);
_link = new LinkButton(this, text);
} }
int LabeledLink::naturalWidth() const { int LabeledLink::naturalWidth() const {
@ -159,7 +159,7 @@ void ChatSettingsWidget::createControls() {
addChildRow(_replaceEmoji, marginSub, lang(lng_settings_replace_emojis), SLOT(onReplaceEmoji()), cReplaceEmojis()); addChildRow(_replaceEmoji, marginSub, lang(lng_settings_replace_emojis), SLOT(onReplaceEmoji()), cReplaceEmojis());
style::margins marginList(st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip); style::margins marginList(st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
addChildRow(_viewList, marginList, slidedPadding, lang(lng_settings_view_emojis), SLOT(onViewList()), st::btnDefLink); addChildRow(_viewList, marginList, slidedPadding, lang(lng_settings_view_emojis), SLOT(onViewList()), st::defaultLinkButton);
if (!cReplaceEmojis()) { if (!cReplaceEmojis()) {
_viewList->hideFast(); _viewList->hideFast();
} }

View file

@ -36,7 +36,7 @@ public:
void setLink(const QString &text); void setLink(const QString &text);
LinkButton *link() { Ui::LinkButton *link() {
return _link; return _link;
} }
@ -47,7 +47,7 @@ protected:
private: private:
ChildWidget<FlatLabel> _label; ChildWidget<FlatLabel> _label;
ChildWidget<LinkButton> _link; ChildWidget<Ui::LinkButton> _link;
}; };
@ -83,7 +83,7 @@ private:
State _state = State::Empty; State _state = State::Empty;
ChildWidget<LabeledLink> _path; ChildWidget<LabeledLink> _path;
ChildWidget<LinkButton> _clear; ChildWidget<Ui::LinkButton> _clear;
}; };
@ -106,13 +106,13 @@ private:
void createControls(); void createControls();
ChildWidget<Ui::Checkbox> _replaceEmoji = { nullptr }; ChildWidget<Ui::Checkbox> _replaceEmoji = { nullptr };
ChildWidget<Ui::WidgetSlideWrap<LinkButton>> _viewList = { nullptr }; ChildWidget<Ui::WidgetSlideWrap<Ui::LinkButton>> _viewList = { nullptr };
ChildWidget<Ui::Checkbox> _dontAskDownloadPath = { nullptr }; ChildWidget<Ui::Checkbox> _dontAskDownloadPath = { nullptr };
ChildWidget<Ui::WidgetSlideWrap<DownloadPathState>> _downloadPath = { nullptr }; ChildWidget<Ui::WidgetSlideWrap<DownloadPathState>> _downloadPath = { nullptr };
ChildWidget<Ui::Radiobutton> _sendByEnter = { nullptr }; ChildWidget<Ui::Radiobutton> _sendByEnter = { nullptr };
ChildWidget<Ui::Radiobutton> _sendByCtrlEnter = { nullptr }; ChildWidget<Ui::Radiobutton> _sendByCtrlEnter = { nullptr };
ChildWidget<LinkButton> _automaticMediaDownloadSettings = { nullptr }; ChildWidget<Ui::LinkButton> _automaticMediaDownloadSettings = { nullptr };
ChildWidget<LinkButton> _manageStickerSets = { nullptr }; ChildWidget<Ui::LinkButton> _manageStickerSets = { nullptr };
}; };

View file

@ -22,8 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "settings/settings_cover.h" #include "settings/settings_cover.h"
#include "ui/flatlabel.h" #include "ui/flatlabel.h"
#include "ui/buttons/round_button.h" #include "ui/widgets/buttons.h"
#include "ui/buttons/icon_button.h"
#include "observer_peer.h" #include "observer_peer.h"
#include "lang.h" #include "lang.h"
#include "application.h" #include "application.h"
@ -50,9 +49,7 @@ CoverWidget::CoverWidget(QWidget *parent, UserData *self) : BlockWidget(parent,
_name->setSelectable(true); _name->setSelectable(true);
_name->setContextCopyText(lang(lng_profile_copy_fullname)); _name->setContextCopyText(lang(lng_profile_copy_fullname));
_setPhoto->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
connect(_setPhoto, SIGNAL(clicked()), this, SLOT(onSetPhoto())); connect(_setPhoto, SIGNAL(clicked()), this, SLOT(onSetPhoto()));
_editName->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
connect(_editName, SIGNAL(clicked()), this, SLOT(onEditName())); connect(_editName, SIGNAL(clicked()), this, SLOT(onEditName()));
connect(_editNameInline, SIGNAL(clicked()), this, SLOT(onEditName())); connect(_editNameInline, SIGNAL(clicked()), this, SLOT(onEditName()));
@ -280,7 +277,7 @@ void CoverWidget::refreshStatusText() {
_statusText = lang(lng_settings_uploading_photo); _statusText = lang(lng_settings_uploading_photo);
_statusTextIsOnline = false; _statusTextIsOnline = false;
if (!_cancelPhotoUpload) { if (!_cancelPhotoUpload) {
_cancelPhotoUpload = new LinkButton(this, lang(lng_cancel), st::btnDefLink); _cancelPhotoUpload.create(this, lang(lng_cancel), st::defaultLinkButton);
connect(_cancelPhotoUpload, SIGNAL(clicked()), this, SLOT(onCancelPhotoUpload())); connect(_cancelPhotoUpload, SIGNAL(clicked()), this, SLOT(onCancelPhotoUpload()));
_cancelPhotoUpload->show(); _cancelPhotoUpload->show();
_cancelPhotoUpload->moveToLeft(_statusPosition.x() + st::settingsStatusFont->width(_statusText) + st::settingsStatusFont->spacew, _statusPosition.y()); _cancelPhotoUpload->moveToLeft(_statusPosition.x() + st::settingsStatusFont->width(_statusText) + st::settingsStatusFont->spacew, _statusPosition.y());

View file

@ -26,8 +26,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "settings/settings_block_widget.h" #include "settings/settings_block_widget.h"
class FlatLabel; class FlatLabel;
class LinkButton;
namespace Ui { namespace Ui {
class RoundButton; class RoundButton;
class IconButton; class IconButton;
@ -95,7 +93,7 @@ private:
ChildWidget<FlatLabel> _name; ChildWidget<FlatLabel> _name;
ChildWidget<Ui::IconButton> _editNameInline; ChildWidget<Ui::IconButton> _editNameInline;
ChildWidget<LinkButton> _cancelPhotoUpload = { nullptr }; ChildWidget<Ui::LinkButton> _cancelPhotoUpload = { nullptr };
QPoint _statusPosition; QPoint _statusPosition;
QString _statusText; QString _statusText;

View file

@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_settings.h" #include "styles/style_settings.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "ui/buttons/icon_button.h" #include "ui/widgets/buttons.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "lang.h" #include "lang.h"

View file

@ -24,8 +24,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_settings.h" #include "styles/style_settings.h"
#include "lang.h" #include "lang.h"
#include "ui/effects/widget_slide_wrap.h" #include "ui/effects/widget_slide_wrap.h"
#include "ui/flatbutton.h" #include "ui/widgets/checkbox.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/buttons.h"
#include "localstorage.h" #include "localstorage.h"
#include "pspecific.h" #include "pspecific.h"
#include "mainwindow.h" #include "mainwindow.h"
@ -168,7 +168,7 @@ void UpdateStateRow::onFailed() {
#endif // !TDESKTOP_DISABLE_AUTOUPDATE #endif // !TDESKTOP_DISABLE_AUTOUPDATE
GeneralWidget::GeneralWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_general)) GeneralWidget::GeneralWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_general))
, _changeLanguage(this, lang(lng_settings_change_lang), st::defaultBoxLinkButton) { , _changeLanguage(this, lang(lng_settings_change_lang), st::boxLinkButton) {
connect(_changeLanguage, SIGNAL(clicked()), this, SLOT(onChangeLanguage())); connect(_changeLanguage, SIGNAL(clicked()), this, SLOT(onChangeLanguage()));
subscribe(Global::RefChooseCustomLang(), [this]() { chooseCustomLang(); }); subscribe(Global::RefChooseCustomLang(), [this]() { chooseCustomLang(); });
subscribe(FileDialog::QueryDone(), [this](const FileDialog::QueryUpdate &update) { subscribe(FileDialog::QueryDone(), [this](const FileDialog::QueryUpdate &update) {
@ -178,7 +178,7 @@ GeneralWidget::GeneralWidget(QWidget *parent, UserData *self) : BlockWidget(pare
} }
int GeneralWidget::resizeGetHeight(int newWidth) { int GeneralWidget::resizeGetHeight(int newWidth) {
_changeLanguage->moveToRight(contentLeft(), st::settingsBlockMarginTop + st::settingsBlockTitleTop + st::settingsBlockTitleFont->ascent - st::btnDefLink.font->ascent, newWidth); _changeLanguage->moveToRight(contentLeft(), st::settingsBlockMarginTop + st::settingsBlockTitleTop + st::settingsBlockTitleFont->ascent - st::defaultLinkButton.font->ascent, newWidth);
return BlockWidget::resizeGetHeight(newWidth); return BlockWidget::resizeGetHeight(newWidth);
} }

View file

@ -23,14 +23,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "settings/settings_block_widget.h" #include "settings/settings_block_widget.h"
#include "ui/filedialog.h" #include "ui/filedialog.h"
class LinkButton;
namespace Ui {
class Checkbox;
template <typename Widget>
class WidgetSlideWrap;
} // namespace Ui
namespace Settings { namespace Settings {
#ifndef TDESKTOP_DISABLE_AUTOUPDATE #ifndef TDESKTOP_DISABLE_AUTOUPDATE
@ -73,8 +65,8 @@ private:
void setState(State state, bool force = false); void setState(State state, bool force = false);
void setDownloadProgress(qint64 ready, qint64 total); void setDownloadProgress(qint64 ready, qint64 total);
ChildWidget<LinkButton> _check; ChildWidget<Ui::LinkButton> _check;
ChildWidget<LinkButton> _restart; ChildWidget<Ui::LinkButton> _restart;
State _state = State::None; State _state = State::None;
QString _downloadText; QString _downloadText;
@ -114,7 +106,7 @@ private:
void chooseCustomLang(); void chooseCustomLang();
void notifyFileQueryUpdated(const FileDialog::QueryUpdate &update); void notifyFileQueryUpdated(const FileDialog::QueryUpdate &update);
ChildWidget<LinkButton> _changeLanguage; ChildWidget<Ui::LinkButton> _changeLanguage;
#ifndef TDESKTOP_DISABLE_AUTOUPDATE #ifndef TDESKTOP_DISABLE_AUTOUPDATE
ChildWidget<Ui::Checkbox> _updateAutomatically = { nullptr }; ChildWidget<Ui::Checkbox> _updateAutomatically = { nullptr };
ChildWidget<Ui::WidgetSlideWrap<UpdateStateRow>> _updateRow = { nullptr }; ChildWidget<Ui::WidgetSlideWrap<UpdateStateRow>> _updateRow = { nullptr };

View file

@ -25,7 +25,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "lang.h" #include "lang.h"
#include "localstorage.h" #include "localstorage.h"
#include "ui/effects/widget_slide_wrap.h" #include "ui/effects/widget_slide_wrap.h"
#include "ui/buttons/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "window/notifications_manager.h" #include "window/notifications_manager.h"
#include "boxes/notifications_box.h" #include "boxes/notifications_box.h"

View file

@ -51,7 +51,7 @@ private:
ChildWidget<Ui::Checkbox> _nativeNotifications = { nullptr }; ChildWidget<Ui::Checkbox> _nativeNotifications = { nullptr };
ChildWidget<Ui::Checkbox> _playSound = { nullptr }; ChildWidget<Ui::Checkbox> _playSound = { nullptr };
ChildWidget<Ui::Checkbox> _includeMuted = { nullptr }; ChildWidget<Ui::Checkbox> _includeMuted = { nullptr };
ChildWidget<Ui::WidgetSlideWrap<LinkButton>> _advanced = { nullptr }; ChildWidget<Ui::WidgetSlideWrap<Ui::LinkButton>> _advanced = { nullptr };
}; };

Some files were not shown because too many files have changed in this diff Show more