mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Buttons moved to ui/widgets/buttons module, BoxButton removed.
This commit is contained in:
parent
d4d1d438be
commit
807bebb3cf
133 changed files with 1300 additions and 1508 deletions
|
@ -83,18 +83,6 @@ attentionBoxButton: RoundButton(defaultBoxButton) {
|
|||
textBgOver: #fff0ed;
|
||||
}
|
||||
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) {
|
||||
font: font(boxFontSize);
|
||||
align: align(topleft);
|
||||
|
@ -290,13 +278,6 @@ btnNoHover: #777777;
|
|||
linkCropLimit: 360px;
|
||||
linkFont: normalFont;
|
||||
linkOverFont: font(fsize underline);
|
||||
btnDefLink: linkButton {
|
||||
color: btnYesColor;
|
||||
overColor: btnYesColor;
|
||||
downColor: btnYesHover;
|
||||
font: linkFont;
|
||||
overFont: linkOverFont;
|
||||
}
|
||||
|
||||
inpDefFont: font(17px);
|
||||
inpDefFlat: flatInput {
|
||||
|
@ -368,11 +349,6 @@ boxShadow: icon {{ "box_shadow", windowShadowFg }};
|
|||
boxShadowShift: 2px;
|
||||
|
||||
btnSelectSep: #e0e0e0;
|
||||
btnRedLink: linkButton(btnDefLink) {
|
||||
color: #d15948;
|
||||
overColor: #d15948;
|
||||
downColor: #db6352;
|
||||
}
|
||||
|
||||
countryRowHeight: 36px;
|
||||
countryRowNameFont: semiboldFont;
|
||||
|
@ -699,41 +675,6 @@ historyScroll: flatScroll(scrollDef) {
|
|||
}
|
||||
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";
|
||||
|
||||
unreadBarHeight: 32px;
|
||||
|
@ -798,25 +739,6 @@ connectionPasswordInputField: InputField(defaultInputField) {
|
|||
}
|
||||
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);
|
||||
emojiReplaceWidth: 52px;
|
||||
emojiReplaceHeight: 56px;
|
||||
|
|
|
@ -30,34 +30,6 @@ textStyle {
|
|||
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 {
|
||||
textColor: color;
|
||||
bgColor: color;
|
||||
|
|
|
@ -27,6 +27,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "autoupdater.h"
|
||||
#include "boxes/confirmbox.h"
|
||||
#include "application.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
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)
|
||||
|
@ -34,12 +36,12 @@ AboutBox::AboutBox() : AbstractBox(st::aboutWidth)
|
|||
, _text2(this, lang(lng_about_text_2), FlatLabel::InitType::Rich, st::aboutLabel, st::aboutTextStyle)
|
||||
, _text3(this,st::aboutLabel, st::aboutTextStyle)
|
||||
, _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(&_done, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
connect(_version, SIGNAL(clicked()), this, SLOT(onVersion()));
|
||||
connect(_done, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
|
||||
prepare();
|
||||
|
||||
|
@ -47,19 +49,19 @@ AboutBox::AboutBox() : AbstractBox(st::aboutWidth)
|
|||
}
|
||||
|
||||
void AboutBox::showAll() {
|
||||
_version.show();
|
||||
_text1.show();
|
||||
_text2.show();
|
||||
_text3.show();
|
||||
_done.show();
|
||||
_version->show();
|
||||
_text1->show();
|
||||
_text2->show();
|
||||
_text3->show();
|
||||
_done->show();
|
||||
}
|
||||
|
||||
void AboutBox::resizeEvent(QResizeEvent *e) {
|
||||
_version.moveToLeft(st::boxPadding.left(), titleHeight() + st::aboutVersionTop);
|
||||
_text1.moveToLeft(st::boxPadding.left(), titleHeight() + st::aboutTextTop);
|
||||
_text2.moveToLeft(st::boxPadding.left(), _text1.y() + _text1.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());
|
||||
_version->moveToLeft(st::boxPadding.left(), titleHeight() + st::aboutVersionTop);
|
||||
_text1->moveToLeft(st::boxPadding.left(), titleHeight() + st::aboutTextTop);
|
||||
_text2->moveToLeft(st::boxPadding.left(), _text1->y() + _text1->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());
|
||||
AbstractBox::resizeEvent(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "abstractbox.h"
|
||||
#include "ui/flatlabel.h"
|
||||
|
||||
namespace Ui {
|
||||
class RoundButton;
|
||||
class LinkButton;
|
||||
} // namespace Ui
|
||||
|
||||
class AboutBox : public AbstractBox {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -42,9 +47,11 @@ protected:
|
|||
void showAll() override;
|
||||
|
||||
private:
|
||||
LinkButton _version;
|
||||
FlatLabel _text1, _text2, _text3;
|
||||
BoxButton _done;
|
||||
ChildWidget<Ui::LinkButton> _version;
|
||||
ChildWidget<FlatLabel> _text1;
|
||||
ChildWidget<FlatLabel> _text2;
|
||||
ChildWidget<FlatLabel> _text3;
|
||||
ChildWidget<Ui::RoundButton> _done;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "styles/style_boxes.h"
|
||||
#include "localstorage.h"
|
||||
#include "lang.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "boxes/confirmbox.h"
|
||||
#include "boxes/photocropbox.h"
|
||||
#include "ui/filedialog.h"
|
||||
#include "ui/buttons/checkbox.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "apiwrap.h"
|
||||
|
@ -627,7 +628,7 @@ void SetupChannelBox::paintEvent(QPaintEvent *e) {
|
|||
QTextOption option(style::al_left);
|
||||
option.setWrapMode(QTextOption::WrapAnywhere);
|
||||
p.setFont(_linkOver ? st::boxTextFont->underline() : st::boxTextFont);
|
||||
p.setPen(st::btnDefLink.color);
|
||||
p.setPen(st::defaultLinkButton.color);
|
||||
p.drawText(_invitationLink, _channel->inviteLink(), option);
|
||||
if (!_goodTextLink.isEmpty() && a_goodOpacity.current() > 0) {
|
||||
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)
|
||||
, _description(this, st::newGroupDescription, lang(lng_create_group_description), _channel->about())
|
||||
, _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)
|
||||
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
|
||||
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());
|
||||
|
||||
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.setPen(st::contactsStatusFg);
|
||||
|
|
|
@ -30,6 +30,8 @@ class ConfirmBox;
|
|||
namespace Ui {
|
||||
class Checkbox;
|
||||
class Radiobutton;
|
||||
class LinkButton;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class AddContactBox : public AbstractBox, public RPCSender {
|
||||
|
@ -66,9 +68,9 @@ private:
|
|||
ChildWidget<InputField> _last;
|
||||
ChildWidget<PhoneInput> _phone;
|
||||
|
||||
ChildWidget<BoxButton> _save;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<BoxButton> _retry;
|
||||
ChildWidget<Ui::RoundButton> _save;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _retry;
|
||||
|
||||
bool _invertOrder;
|
||||
|
||||
|
@ -123,8 +125,8 @@ private:
|
|||
QImage _photoBig;
|
||||
QPixmap _photoSmall;
|
||||
|
||||
ChildWidget<BoxButton> _next;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _next;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
// channel creation
|
||||
int32 _creationRequestId;
|
||||
|
@ -190,8 +192,8 @@ private:
|
|||
QRect _invitationLink;
|
||||
bool _linkOver;
|
||||
|
||||
ChildWidget<BoxButton> _save;
|
||||
ChildWidget<BoxButton> _skip;
|
||||
ChildWidget<Ui::RoundButton> _save;
|
||||
ChildWidget<Ui::RoundButton> _skip;
|
||||
|
||||
bool _tooMuchUsernames = false;
|
||||
|
||||
|
@ -237,8 +239,8 @@ private:
|
|||
ChildWidget<InputField> _first;
|
||||
ChildWidget<InputField> _last;
|
||||
|
||||
ChildWidget<BoxButton> _save;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _save;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
bool _invertOrder = false;
|
||||
|
||||
|
@ -285,10 +287,10 @@ private:
|
|||
ChildWidget<InputArea> _description;
|
||||
ChildWidget<Ui::Checkbox> _sign;
|
||||
|
||||
ChildWidget<LinkButton> _publicLink;
|
||||
ChildWidget<Ui::LinkButton> _publicLink;
|
||||
|
||||
ChildWidget<BoxButton> _save;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _save;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
mtpRequestId _saveTitleRequestId = 0;
|
||||
mtpRequestId _saveDescriptionRequestId = 0;
|
||||
|
@ -337,7 +339,7 @@ private:
|
|||
int _revokeWidth = 0;
|
||||
|
||||
ChildWidget<FlatLabel> _aboutRevoke;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
base::lambda_unique<void()> _revokeCallback;
|
||||
mtpRequestId _revokeRequestId = 0;
|
||||
|
|
|
@ -26,7 +26,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "boxes/confirmbox.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui/buttons/checkbox.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
||||
AutoLockBox::AutoLockBox() :
|
||||
_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]);
|
||||
|
||||
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();
|
||||
_options.reserve(cnt);
|
||||
|
@ -47,14 +48,14 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) {
|
|||
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();
|
||||
}
|
||||
|
||||
void AutoLockBox::showAll() {
|
||||
_close.show();
|
||||
_close->show();
|
||||
for (int32 i = 0, l = _options.size(); i < l; ++i) {
|
||||
_options[i]->show();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Ui {
|
||||
class Radiobutton;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class AutoLockBox : public AbstractBox {
|
||||
|
@ -42,6 +43,6 @@ protected:
|
|||
|
||||
private:
|
||||
QVector<Ui::Radiobutton*> _options;
|
||||
BoxButton _close;
|
||||
ChildWidget<Ui::RoundButton> _close;
|
||||
|
||||
};
|
||||
|
|
|
@ -38,6 +38,14 @@ boxBlockTitleClose: IconButton(defaultIconButton) {
|
|||
iconOver: boxBlockTitleCloseIconOver;
|
||||
}
|
||||
|
||||
boxLinkButton: LinkButton {
|
||||
color: #0080c0;
|
||||
overColor: #0080c0;
|
||||
downColor: #0073ad;
|
||||
font: boxTextFont;
|
||||
overFont: font(boxFontSize underline);
|
||||
}
|
||||
|
||||
confirmInviteTitle: flatLabel(labelDefFlat) {
|
||||
font: font(16px semibold);
|
||||
align: align(center);
|
||||
|
@ -265,6 +273,11 @@ sessionTerminate: IconButton {
|
|||
iconPosition: point(3px, 3px);
|
||||
iconPositionDown: point(3px, 4px);
|
||||
}
|
||||
sessionTerminateAllButton: LinkButton(boxLinkButton) {
|
||||
color: #d15948;
|
||||
overColor: #d15948;
|
||||
downColor: #db6352;
|
||||
}
|
||||
|
||||
passcodeHeaderFont: font(19px);
|
||||
passcodeHeaderHeight: 80px;
|
||||
|
@ -309,3 +322,21 @@ themeWarningHeight: 150px;
|
|||
themeWarningShadow: boxShadow;
|
||||
themeWarningShadowShift: boxShadowShift;
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "mainwindow.h"
|
||||
#include "apiwrap.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 "localstorage.h"
|
||||
|
||||
|
@ -282,7 +283,7 @@ void MaxInviteBox::paintEvent(QPaintEvent *e) {
|
|||
QTextOption option(style::al_left);
|
||||
option.setWrapMode(QTextOption::WrapAnywhere);
|
||||
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);
|
||||
if (!_goodTextLink.isEmpty() && a_goodOpacity.current() > 0) {
|
||||
p.setOpacity(a_goodOpacity.current());
|
||||
|
|
|
@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Ui {
|
||||
class Checkbox;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class InformBox;
|
||||
|
@ -85,8 +86,8 @@ private:
|
|||
|
||||
QPoint _lastMousePos;
|
||||
|
||||
ChildWidget<BoxButton> _confirm;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _confirm;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
base::lambda_unique<void()> _confirmedCallback;
|
||||
|
||||
|
@ -164,7 +165,7 @@ private:
|
|||
void updateSelected(const QPoint &cursorGlobalPosition);
|
||||
void step_good(float64 ms, bool timer);
|
||||
|
||||
ChildWidget<BoxButton> _close;
|
||||
ChildWidget<Ui::RoundButton> _close;
|
||||
|
||||
Text _text;
|
||||
int32 _textWidth, _textHeight;
|
||||
|
@ -205,8 +206,8 @@ private:
|
|||
Text _text, _note;
|
||||
int32 _textWidth, _textHeight;
|
||||
|
||||
ChildWidget<BoxButton> _convert;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _convert;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
};
|
||||
|
||||
|
@ -234,8 +235,8 @@ private:
|
|||
ChildWidget<FlatLabel> _text;
|
||||
ChildWidget<Ui::Checkbox> _notify;
|
||||
|
||||
ChildWidget<BoxButton> _pin;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _pin;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
mtpRequestId _requestId = 0;
|
||||
|
||||
|
@ -265,8 +266,8 @@ private:
|
|||
ChildWidget<Ui::Checkbox> _reportSpam;
|
||||
ChildWidget<Ui::Checkbox> _deleteAll;
|
||||
|
||||
ChildWidget<BoxButton> _delete;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _delete;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
};
|
||||
|
||||
|
@ -298,11 +299,13 @@ protected:
|
|||
void showAll() override;
|
||||
|
||||
private:
|
||||
ChildWidget<FlatLabel> _title, _status;
|
||||
ChildWidget<FlatLabel> _title;
|
||||
ChildWidget<FlatLabel> _status;
|
||||
ImagePtr _photo;
|
||||
QVector<UserData*> _participants;
|
||||
|
||||
ChildWidget<BoxButton> _join, _cancel;
|
||||
ChildWidget<Ui::RoundButton> _join;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
int _userWidth = 0;
|
||||
|
||||
};
|
||||
|
|
|
@ -23,6 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "styles/style_boxes.h"
|
||||
#include "boxes/confirmbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "mainwidget.h"
|
||||
#include "lang.h"
|
||||
|
||||
|
@ -107,8 +108,8 @@ void ConfirmPhoneBox::launch() {
|
|||
|
||||
_code = new InputField(this, st::confirmPhoneCodeField, lang(lng_code_ph));
|
||||
|
||||
_send = new BoxButton(this, lang(lng_confirm_phone_send), st::defaultBoxButton);
|
||||
_cancel = new BoxButton(this, lang(lng_cancel), st::cancelBoxButton);
|
||||
_send.create(this, lang(lng_confirm_phone_send), st::defaultBoxButton);
|
||||
_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());
|
||||
|
||||
|
|
|
@ -24,6 +24,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
class FlatLabel;
|
||||
|
||||
namespace Ui {
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class ConfirmPhoneBox : public AbstractBox, public RPCSender {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -90,8 +94,8 @@ private:
|
|||
mtpRequestId _checkCodeRequestId = 0;
|
||||
|
||||
ChildWidget<FlatLabel> _about = { nullptr };
|
||||
ChildWidget<BoxButton> _send = { nullptr };
|
||||
ChildWidget<BoxButton> _cancel = { nullptr };
|
||||
ChildWidget<Ui::RoundButton> _send = { nullptr };
|
||||
ChildWidget<Ui::RoundButton> _cancel = { nullptr };
|
||||
ChildWidget<InputField> _code = { nullptr };
|
||||
|
||||
// Flag for not calling onTextChanged() recursively.
|
||||
|
|
|
@ -25,7 +25,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "localstorage.h"
|
||||
#include "mainwidget.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"
|
||||
|
||||
ConnectionBox::ConnectionBox() : AbstractBox(st::boxWidth)
|
||||
|
|
|
@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
namespace Ui {
|
||||
class Checkbox;
|
||||
class Radiobutton;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class ConnectionBox : public AbstractBox {
|
||||
|
@ -55,8 +56,8 @@ private:
|
|||
ChildWidget<Ui::Radiobutton> _tcpProxyRadio;
|
||||
ChildWidget<Ui::Checkbox> _tryIPv6;
|
||||
|
||||
ChildWidget<BoxButton> _save;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _save;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
};
|
||||
|
||||
|
@ -86,7 +87,7 @@ private:
|
|||
|
||||
int _sectionHeight;
|
||||
|
||||
ChildWidget<BoxButton> _save;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _save;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
};
|
||||
|
|
|
@ -30,8 +30,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "application.h"
|
||||
#include "ui/buttons/checkbox.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/filedialog.h"
|
||||
#include "ui/widgets/multi_select.h"
|
||||
#include "ui/effects/widget_slide_wrap.h"
|
||||
|
|
|
@ -31,6 +31,8 @@ class IndexedList;
|
|||
} // namespace Dialogs
|
||||
|
||||
namespace Ui {
|
||||
class RoundButton;
|
||||
class LinkButton;
|
||||
class Checkbox;
|
||||
class MultiSelect;
|
||||
template <typename Widget>
|
||||
|
@ -93,8 +95,8 @@ private:
|
|||
ChildWidget<Ui::WidgetSlideWrap<Ui::MultiSelect>> _select;
|
||||
ChildWidget<Ui::IconButton> _add = { nullptr };
|
||||
|
||||
ChildWidget<BoxButton> _next;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _next;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
MembersFilter _membersFilter;
|
||||
|
||||
ChildWidget<ScrollableBoxShadow> _topShadow;
|
||||
|
@ -300,7 +302,7 @@ private:
|
|||
int _byUsernameSel = -1;
|
||||
|
||||
QPoint _lastMousePos;
|
||||
ChildWidget<LinkButton> _addContactLnk;
|
||||
ChildWidget<Ui::LinkButton> _addContactLnk;
|
||||
|
||||
bool _saving = false;
|
||||
bool _allAdminsChecked = false;
|
||||
|
|
|
@ -24,8 +24,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "lang.h"
|
||||
#include "localstorage.h"
|
||||
#include "ui/filedialog.h"
|
||||
#include "ui/buttons/checkbox.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "pspecific.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
DownloadPathBox::DownloadPathBox() : AbstractBox()
|
||||
, _path(Global::DownloadPath())
|
||||
|
@ -33,7 +35,7 @@ DownloadPathBox::DownloadPathBox() : AbstractBox()
|
|||
, _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"))
|
||||
, _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)
|
||||
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Ui {
|
||||
class Radiobutton;
|
||||
class LinkButton;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class DownloadPathBox : public AbstractBox {
|
||||
|
@ -53,9 +55,9 @@ private:
|
|||
ChildWidget<Ui::Radiobutton> _default;
|
||||
ChildWidget<Ui::Radiobutton> _temp;
|
||||
ChildWidget<Ui::Radiobutton> _dir;
|
||||
ChildWidget<LinkButton> _pathLink;
|
||||
ChildWidget<Ui::LinkButton> _pathLink;
|
||||
|
||||
ChildWidget<BoxButton> _save;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _save;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
};
|
||||
|
|
|
@ -22,7 +22,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "boxes/languagebox.h"
|
||||
|
||||
#include "lang.h"
|
||||
#include "ui/buttons/checkbox.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "localstorage.h"
|
||||
#include "boxes/confirmbox.h"
|
||||
#include "mainwidget.h"
|
||||
|
@ -56,16 +57,16 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) {
|
|||
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();
|
||||
}
|
||||
|
||||
void LanguageBox::showAll() {
|
||||
_close.show();
|
||||
_close->show();
|
||||
for (int32 i = 0, l = _langs.size(); i < l; ++i) {
|
||||
_langs[i]->show();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Ui {
|
||||
class Radiobutton;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class LanguageBox : public AbstractBox {
|
||||
|
@ -45,6 +46,6 @@ protected:
|
|||
|
||||
private:
|
||||
QVector<Ui::Radiobutton*> _langs;
|
||||
BoxButton _close;
|
||||
ChildWidget<Ui::RoundButton> _close;
|
||||
|
||||
};
|
||||
|
|
|
@ -22,13 +22,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "boxes/localstoragebox.h"
|
||||
|
||||
#include "styles/style_boxes.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "localstorage.h"
|
||||
#include "ui/flatbutton.h"
|
||||
#include "lang.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
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) {
|
||||
connect(_clear, SIGNAL(clicked()), this, SLOT(onClear()));
|
||||
connect(_close, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
|
|
|
@ -22,8 +22,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "abstractbox.h"
|
||||
|
||||
class BoxButton;
|
||||
namespace Ui {
|
||||
class RoundButton;
|
||||
class LinkButton;
|
||||
} // namespace Ui
|
||||
|
||||
class LocalStorageBox : public AbstractBox {
|
||||
Q_OBJECT
|
||||
|
@ -53,8 +55,8 @@ private:
|
|||
};
|
||||
State _state = State::Normal;
|
||||
|
||||
ChildWidget<LinkButton> _clear;
|
||||
ChildWidget<BoxButton> _close;
|
||||
ChildWidget<Ui::LinkButton> _clear;
|
||||
ChildWidget<Ui::RoundButton> _close;
|
||||
|
||||
int _imagesCount = -1;
|
||||
int _audiosCount = -1;
|
||||
|
|
|
@ -28,7 +28,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "mainwindow.h"
|
||||
#include "boxes/contactsbox.h"
|
||||
#include "boxes/confirmbox.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "observer_peer.h"
|
||||
|
||||
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) {
|
||||
p.setFont((kickSel ? st::linkOverFont : st::linkFont)->f);
|
||||
if (kickDown) {
|
||||
p.setPen(st::btnDefLink.downColor->p);
|
||||
} else {
|
||||
p.setPen(st::btnDefLink.color->p);
|
||||
}
|
||||
p.setPen(kickDown ? st::defaultLinkButton.downColor : st::defaultLinkButton.color);
|
||||
p.drawTextRight(st::contactsPadding.right() + st::contactsCheckPosition.x(), st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, width(), _kickText, _kickWidth);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "boxes/notifications_box.h"
|
||||
|
||||
#include "lang.h"
|
||||
#include "ui/buttons/round_button.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/discrete_slider.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
|
|
|
@ -22,10 +22,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "abstractbox.h"
|
||||
|
||||
class BoxButton;
|
||||
class LinkButton;
|
||||
|
||||
namespace Ui {
|
||||
class RoundButton;
|
||||
class LinkButton;
|
||||
class DiscreteSlider;
|
||||
} // namespace Ui
|
||||
|
||||
|
@ -72,7 +71,7 @@ private:
|
|||
|
||||
int _oldCount;
|
||||
ChildWidget<Ui::DiscreteSlider> _countSlider;
|
||||
ChildWidget<BoxButton> _done;
|
||||
ChildWidget<Ui::RoundButton> _done;
|
||||
|
||||
QVector<SampleWidget*> _cornerSamples[4];
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "mainwindow.h"
|
||||
#include "localstorage.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
||||
PasscodeBox::PasscodeBox(bool turningOff) : AbstractBox(st::boxWidth)
|
||||
, _replacedBy(0)
|
||||
|
@ -82,114 +83,114 @@ void PasscodeBox::init() {
|
|||
_aboutHeight = _about.countHeight(st::boxWidth - st::boxPadding.left() * 1.5);
|
||||
textstyleRestore();
|
||||
if (_turningOff) {
|
||||
_oldPasscode.show();
|
||||
_oldPasscode->show();
|
||||
_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 {
|
||||
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
|
||||
if (has) {
|
||||
_oldPasscode.show();
|
||||
_oldPasscode->show();
|
||||
_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 {
|
||||
_oldPasscode.hide();
|
||||
_oldPasscode->hide();
|
||||
_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(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
connect(_saveButton, SIGNAL(clicked()), this, SLOT(onSave()));
|
||||
connect(_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
|
||||
connect(&_oldPasscode, SIGNAL(changed()), this, SLOT(onOldChanged()));
|
||||
connect(&_newPasscode, SIGNAL(changed()), this, SLOT(onNewChanged()));
|
||||
connect(&_reenterPasscode, SIGNAL(changed()), this, SLOT(onNewChanged()));
|
||||
connect(&_passwordHint, SIGNAL(changed()), this, SLOT(onNewChanged()));
|
||||
connect(&_recoverEmail, SIGNAL(changed()), this, SLOT(onEmailChanged()));
|
||||
connect(_oldPasscode, SIGNAL(changed()), this, SLOT(onOldChanged()));
|
||||
connect(_newPasscode, SIGNAL(changed()), this, SLOT(onNewChanged()));
|
||||
connect(_reenterPasscode, SIGNAL(changed()), this, SLOT(onNewChanged()));
|
||||
connect(_passwordHint, SIGNAL(changed()), this, SLOT(onNewChanged()));
|
||||
connect(_recoverEmail, SIGNAL(changed()), this, SLOT(onEmailChanged()));
|
||||
|
||||
connect(&_oldPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(&_newPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(&_reenterPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(&_passwordHint, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(&_recoverEmail, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(_oldPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(_newPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(_reenterPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(_passwordHint, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(_recoverEmail, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
|
||||
connect(&_recover, SIGNAL(clicked()), this, SLOT(onRecoverByEmail()));
|
||||
connect(_recover, SIGNAL(clicked()), this, SLOT(onRecoverByEmail()));
|
||||
}
|
||||
|
||||
void PasscodeBox::showAll() {
|
||||
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
|
||||
if (_turningOff) {
|
||||
_oldPasscode.show();
|
||||
_oldPasscode->show();
|
||||
if (_cloudPwd && _hasRecovery) {
|
||||
_recover.show();
|
||||
_recover->show();
|
||||
} else {
|
||||
_recover.hide();
|
||||
_recover->hide();
|
||||
}
|
||||
_newPasscode.hide();
|
||||
_reenterPasscode.hide();
|
||||
_passwordHint.hide();
|
||||
_recoverEmail.hide();
|
||||
_newPasscode->hide();
|
||||
_reenterPasscode->hide();
|
||||
_passwordHint->hide();
|
||||
_recoverEmail->hide();
|
||||
} else {
|
||||
if (has) {
|
||||
_oldPasscode.show();
|
||||
_oldPasscode->show();
|
||||
if (_cloudPwd && _hasRecovery) {
|
||||
_recover.show();
|
||||
_recover->show();
|
||||
} else {
|
||||
_recover.hide();
|
||||
_recover->hide();
|
||||
}
|
||||
} else {
|
||||
_oldPasscode.hide();
|
||||
_recover.hide();
|
||||
_oldPasscode->hide();
|
||||
_recover->hide();
|
||||
}
|
||||
_newPasscode.show();
|
||||
_reenterPasscode.show();
|
||||
_newPasscode->show();
|
||||
_reenterPasscode->show();
|
||||
if (_cloudPwd) {
|
||||
_passwordHint.show();
|
||||
_passwordHint->show();
|
||||
} else {
|
||||
_passwordHint.hide();
|
||||
_passwordHint->hide();
|
||||
}
|
||||
if (_cloudPwd && _curSalt.isEmpty()) {
|
||||
_recoverEmail.show();
|
||||
_recoverEmail->show();
|
||||
} else {
|
||||
_recoverEmail.hide();
|
||||
_recoverEmail->hide();
|
||||
}
|
||||
}
|
||||
_saveButton.show();
|
||||
_cancelButton.show();
|
||||
_saveButton->show();
|
||||
_cancelButton->show();
|
||||
AbstractBox::showAll();
|
||||
}
|
||||
|
||||
void PasscodeBox::onSubmit() {
|
||||
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
|
||||
if (_oldPasscode.hasFocus()) {
|
||||
if (_oldPasscode->hasFocus()) {
|
||||
if (_turningOff) {
|
||||
onSave();
|
||||
} else {
|
||||
_newPasscode.setFocus();
|
||||
_newPasscode->setFocus();
|
||||
}
|
||||
} else if (_newPasscode.hasFocus()) {
|
||||
_reenterPasscode.setFocus();
|
||||
} else if (_reenterPasscode.hasFocus()) {
|
||||
if (has && _oldPasscode.text().isEmpty()) {
|
||||
_oldPasscode.setFocus();
|
||||
_oldPasscode.showError();
|
||||
} else if (_newPasscode.text().isEmpty()) {
|
||||
_newPasscode.setFocus();
|
||||
_newPasscode.showError();
|
||||
} else if (_reenterPasscode.text().isEmpty()) {
|
||||
_reenterPasscode.showError();
|
||||
} else if (!_passwordHint.isHidden()) {
|
||||
_passwordHint.setFocus();
|
||||
} else if (_newPasscode->hasFocus()) {
|
||||
_reenterPasscode->setFocus();
|
||||
} else if (_reenterPasscode->hasFocus()) {
|
||||
if (has && _oldPasscode->text().isEmpty()) {
|
||||
_oldPasscode->setFocus();
|
||||
_oldPasscode->showError();
|
||||
} else if (_newPasscode->text().isEmpty()) {
|
||||
_newPasscode->setFocus();
|
||||
_newPasscode->showError();
|
||||
} else if (_reenterPasscode->text().isEmpty()) {
|
||||
_reenterPasscode->showError();
|
||||
} else if (!_passwordHint->isHidden()) {
|
||||
_passwordHint->setFocus();
|
||||
} else {
|
||||
onSave();
|
||||
}
|
||||
} else if (_passwordHint.hasFocus()) {
|
||||
if (_recoverEmail.isHidden()) {
|
||||
} else if (_passwordHint->hasFocus()) {
|
||||
if (_recoverEmail->isHidden()) {
|
||||
onSave();
|
||||
} else {
|
||||
_recoverEmail.setFocus();
|
||||
_recoverEmail->setFocus();
|
||||
}
|
||||
} else if (_recoverEmail.hasFocus()) {
|
||||
} else if (_recoverEmail->hasFocus()) {
|
||||
onSave();
|
||||
}
|
||||
}
|
||||
|
@ -203,27 +204,27 @@ void PasscodeBox::paintEvent(QPaintEvent *e) {
|
|||
textstyleSet(&st::usernameTextStyle);
|
||||
|
||||
int32 w = st::boxWidth - st::boxPadding.left() * 1.5;
|
||||
int32 abouty = (_passwordHint.isHidden() ? (_reenterPasscode.isHidden() ? (_oldPasscode.y() + (_hasRecovery && !_hintText.isEmpty() ? st::passcodeSkip : 0)) : _reenterPasscode.y()) + st::passcodeSkip : _passwordHint.y() + st::contactSkip) + _oldPasscode.height();
|
||||
int32 abouty = (_passwordHint->isHidden() ? (_reenterPasscode->isHidden() ? (_oldPasscode->y() + (_hasRecovery && !_hintText.isEmpty() ? st::passcodeSkip : 0)) : _reenterPasscode->y()) + st::passcodeSkip : _passwordHint->y() + st::contactSkip) + _oldPasscode->height();
|
||||
p.setPen(st::boxTextFg);
|
||||
_about.drawLeft(p, st::boxPadding.left(), abouty, w, width());
|
||||
|
||||
if (!_hintText.isEmpty() && _oldError.isEmpty()) {
|
||||
_hintText.drawLeftElided(p, st::boxPadding.left(), _oldPasscode.y() + _oldPasscode.height() + ((st::passcodeSkip - st::normalFont->height) / 2), w, width(), 1, style::al_topleft);
|
||||
_hintText.drawLeftElided(p, st::boxPadding.left(), _oldPasscode->y() + _oldPasscode->height() + ((st::passcodeSkip - st::normalFont->height) / 2), w, width(), 1, style::al_topleft);
|
||||
}
|
||||
|
||||
if (!_oldError.isEmpty()) {
|
||||
p.setPen(st::boxTextFgError);
|
||||
p.drawText(QRect(st::boxPadding.left(), _oldPasscode.y() + _oldPasscode.height(), w, st::passcodeSkip), _oldError, style::al_left);
|
||||
p.drawText(QRect(st::boxPadding.left(), _oldPasscode->y() + _oldPasscode->height(), w, st::passcodeSkip), _oldError, style::al_left);
|
||||
}
|
||||
|
||||
if (!_newError.isEmpty()) {
|
||||
p.setPen(st::boxTextFgError);
|
||||
p.drawText(QRect(st::boxPadding.left(), _reenterPasscode.y() + _reenterPasscode.height(), w, st::passcodeSkip), _newError, style::al_left);
|
||||
p.drawText(QRect(st::boxPadding.left(), _reenterPasscode->y() + _reenterPasscode->height(), w, st::passcodeSkip), _newError, style::al_left);
|
||||
}
|
||||
|
||||
if (!_emailError.isEmpty()) {
|
||||
p.setPen(st::boxTextFgError);
|
||||
p.drawText(QRect(st::boxPadding.left(), _recoverEmail.y() + _recoverEmail.height(), w, st::passcodeSkip), _emailError, style::al_left);
|
||||
p.drawText(QRect(st::boxPadding.left(), _recoverEmail->y() + _recoverEmail->height(), w, st::passcodeSkip), _emailError, style::al_left);
|
||||
}
|
||||
|
||||
textstyleRestore();
|
||||
|
@ -232,57 +233,57 @@ void PasscodeBox::paintEvent(QPaintEvent *e) {
|
|||
void PasscodeBox::resizeEvent(QResizeEvent *e) {
|
||||
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
|
||||
int32 w = st::boxWidth - st::boxPadding.left() - st::boxPadding.right();
|
||||
_oldPasscode.resize(w, _oldPasscode.height());
|
||||
_oldPasscode.moveToLeft(st::boxPadding.left(), titleHeight() + st::passcodePadding.top());
|
||||
_newPasscode.resize(w, _newPasscode.height());
|
||||
_newPasscode.moveToLeft(st::boxPadding.left(), _oldPasscode.y() + ((_turningOff || has) ? (_oldPasscode.height() + st::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0)) : 0));
|
||||
_reenterPasscode.resize(w, _reenterPasscode.height());
|
||||
_reenterPasscode.moveToLeft(st::boxPadding.left(), _newPasscode.y() + _newPasscode.height() + st::contactSkip);
|
||||
_passwordHint.resize(w, _passwordHint.height());
|
||||
_passwordHint.moveToLeft(st::boxPadding.left(), _reenterPasscode.y() + _reenterPasscode.height() + st::passcodeSkip);
|
||||
_recoverEmail.resize(w, _passwordHint.height());
|
||||
_recoverEmail.moveToLeft(st::boxPadding.left(), _passwordHint.y() + _passwordHint.height() + st::contactSkip + _aboutHeight + st::contactSkip);
|
||||
_oldPasscode->resize(w, _oldPasscode->height());
|
||||
_oldPasscode->moveToLeft(st::boxPadding.left(), titleHeight() + st::passcodePadding.top());
|
||||
_newPasscode->resize(w, _newPasscode->height());
|
||||
_newPasscode->moveToLeft(st::boxPadding.left(), _oldPasscode->y() + ((_turningOff || has) ? (_oldPasscode->height() + st::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0)) : 0));
|
||||
_reenterPasscode->resize(w, _reenterPasscode->height());
|
||||
_reenterPasscode->moveToLeft(st::boxPadding.left(), _newPasscode->y() + _newPasscode->height() + st::contactSkip);
|
||||
_passwordHint->resize(w, _passwordHint->height());
|
||||
_passwordHint->moveToLeft(st::boxPadding.left(), _reenterPasscode->y() + _reenterPasscode->height() + st::passcodeSkip);
|
||||
_recoverEmail->resize(w, _passwordHint->height());
|
||||
_recoverEmail->moveToLeft(st::boxPadding.left(), _passwordHint->y() + _passwordHint->height() + st::contactSkip + _aboutHeight + st::contactSkip);
|
||||
|
||||
if (!_recover.isHidden()) {
|
||||
_recover.moveToLeft(st::boxPadding.left(), _oldPasscode.y() + _oldPasscode.height() + (_hintText.isEmpty() ? ((st::passcodeSkip - _recover.height()) / 2) : st::passcodeSkip));
|
||||
if (!_recover->isHidden()) {
|
||||
_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());
|
||||
_cancelButton.moveToRight(st::boxButtonPadding.right() + _saveButton.width() + st::boxButtonPadding.left(), _saveButton.y());
|
||||
_saveButton->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _saveButton->height());
|
||||
_cancelButton->moveToRight(st::boxButtonPadding.right() + _saveButton->width() + st::boxButtonPadding.left(), _saveButton->y());
|
||||
|
||||
AbstractBox::resizeEvent(e);
|
||||
}
|
||||
|
||||
void PasscodeBox::doSetInnerFocus() {
|
||||
if (_skipEmailWarning && !_recoverEmail.isHidden()) {
|
||||
_recoverEmail.setFocus();
|
||||
} else if (_oldPasscode.isHidden()) {
|
||||
_newPasscode.setFocus();
|
||||
if (_skipEmailWarning && !_recoverEmail->isHidden()) {
|
||||
_recoverEmail->setFocus();
|
||||
} else if (_oldPasscode->isHidden()) {
|
||||
_newPasscode->setFocus();
|
||||
} else {
|
||||
_oldPasscode.setFocus();
|
||||
_oldPasscode->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void PasscodeBox::setPasswordDone(const MTPBool &result) {
|
||||
_setRequest = 0;
|
||||
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);
|
||||
}
|
||||
|
||||
bool PasscodeBox::setPasswordFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
if (_oldPasscode.isHidden()) return false;
|
||||
if (_oldPasscode->isHidden()) return false;
|
||||
|
||||
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
||||
_setRequest = 0;
|
||||
|
||||
_oldPasscode.selectAll();
|
||||
_oldPasscode.setFocus();
|
||||
_oldPasscode.showError();
|
||||
_oldPasscode->selectAll();
|
||||
_oldPasscode->setFocus();
|
||||
_oldPasscode->showError();
|
||||
_oldError = lang(lng_flood_error);
|
||||
if (_hasRecovery && _hintText.isEmpty()) {
|
||||
_recover.hide();
|
||||
_recover->hide();
|
||||
}
|
||||
update();
|
||||
return true;
|
||||
|
@ -293,15 +294,15 @@ bool PasscodeBox::setPasswordFail(const RPCError &error) {
|
|||
_setRequest = 0;
|
||||
QString err = error.type();
|
||||
if (err == qstr("PASSWORD_HASH_INVALID")) {
|
||||
if (_oldPasscode.isHidden()) {
|
||||
if (_oldPasscode->isHidden()) {
|
||||
emit reloadPassword();
|
||||
onClose();
|
||||
} else {
|
||||
onBadOldPasscode();
|
||||
}
|
||||
} else if (err == qstr("NEW_PASSWORD_BAD")) {
|
||||
_newPasscode.setFocus();
|
||||
_newPasscode.showError();
|
||||
_newPasscode->setFocus();
|
||||
_newPasscode->showError();
|
||||
_newError = lang(lng_cloud_password_bad);
|
||||
update();
|
||||
} else if (err == qstr("NEW_SALT_INVALID")) {
|
||||
|
@ -309,8 +310,8 @@ bool PasscodeBox::setPasswordFail(const RPCError &error) {
|
|||
onClose();
|
||||
} else if (err == qstr("EMAIL_INVALID")) {
|
||||
_emailError = lang(lng_cloud_password_bad_email);
|
||||
_recoverEmail.setFocus();
|
||||
_recoverEmail.showError();
|
||||
_recoverEmail->setFocus();
|
||||
_recoverEmail->showError();
|
||||
update();
|
||||
} else if (err == qstr("EMAIL_UNCONFIRMED")) {
|
||||
Ui::showLayer(new InformBox(lang(lng_cloud_password_almost)));
|
||||
|
@ -322,13 +323,13 @@ bool PasscodeBox::setPasswordFail(const RPCError &error) {
|
|||
void PasscodeBox::onSave(bool force) {
|
||||
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();
|
||||
if (!_cloudPwd && (_turningOff || has)) {
|
||||
if (!passcodeCanTry()) {
|
||||
_oldError = lang(lng_flood_error);
|
||||
_oldPasscode.setFocus();
|
||||
_oldPasscode.showError();
|
||||
_oldPasscode->setFocus();
|
||||
_oldPasscode->showError();
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
@ -344,37 +345,37 @@ void PasscodeBox::onSave(bool force) {
|
|||
}
|
||||
}
|
||||
if (!_turningOff && pwd.isEmpty()) {
|
||||
_newPasscode.setFocus();
|
||||
_newPasscode.showError();
|
||||
_newPasscode->setFocus();
|
||||
_newPasscode->showError();
|
||||
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
||||
return;
|
||||
}
|
||||
if (pwd != conf) {
|
||||
_reenterPasscode.selectAll();
|
||||
_reenterPasscode.setFocus();
|
||||
_reenterPasscode.showError();
|
||||
_reenterPasscode->selectAll();
|
||||
_reenterPasscode->setFocus();
|
||||
_reenterPasscode->showError();
|
||||
if (!conf.isEmpty()) {
|
||||
_newError = lang(_cloudPwd ? lng_cloud_password_differ : lng_passcode_differ);
|
||||
update();
|
||||
}
|
||||
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
||||
} else if (!_turningOff && has && old == pwd) {
|
||||
_newPasscode.setFocus();
|
||||
_newPasscode.showError();
|
||||
_newPasscode->setFocus();
|
||||
_newPasscode->showError();
|
||||
_newError = lang(_cloudPwd ? lng_cloud_password_is_same : lng_passcode_is_same);
|
||||
update();
|
||||
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
||||
} else if (_cloudPwd) {
|
||||
QString hint = _passwordHint.getLastText(), email = _recoverEmail.getLastText().trimmed();
|
||||
if (_cloudPwd && pwd == hint && !_passwordHint.isHidden() && !_newPasscode.isHidden()) {
|
||||
_newPasscode.setFocus();
|
||||
_newPasscode.showError();
|
||||
QString hint = _passwordHint->getLastText(), email = _recoverEmail->getLastText().trimmed();
|
||||
if (_cloudPwd && pwd == hint && !_passwordHint->isHidden() && !_newPasscode->isHidden()) {
|
||||
_newPasscode->setFocus();
|
||||
_newPasscode->showError();
|
||||
_newError = lang(lng_cloud_password_bad);
|
||||
update();
|
||||
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
||||
return;
|
||||
}
|
||||
if (!_recoverEmail.isHidden() && email.isEmpty() && !force) {
|
||||
if (!_recoverEmail->isHidden() && email.isEmpty() && !force) {
|
||||
_skipEmailWarning = true;
|
||||
_replacedBy = new ConfirmBox(lang(lng_cloud_password_about_recover), lang(lng_cloud_password_skip_email), st::attentionBoxButton);
|
||||
connect(_replacedBy, SIGNAL(confirmed()), this, SLOT(onForceNoMail()));
|
||||
|
@ -389,13 +390,13 @@ void PasscodeBox::onSave(bool force) {
|
|||
} else {
|
||||
hashSha256(newPasswordData.constData(), newPasswordData.size(), newPasswordHash.data());
|
||||
}
|
||||
QByteArray oldPasswordData = _oldPasscode.isHidden() ? QByteArray() : (_curSalt + old.toUtf8() + _curSalt);
|
||||
QByteArray oldPasswordHash = _oldPasscode.isHidden() ? QByteArray() : QByteArray(32, Qt::Uninitialized);
|
||||
if (!_oldPasscode.isHidden()) {
|
||||
QByteArray oldPasswordData = _oldPasscode->isHidden() ? QByteArray() : (_curSalt + old.toUtf8() + _curSalt);
|
||||
QByteArray oldPasswordHash = _oldPasscode->isHidden() ? QByteArray() : QByteArray(32, Qt::Uninitialized);
|
||||
if (!_oldPasscode->isHidden()) {
|
||||
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;
|
||||
if (_oldPasscode.isHidden() || _newPasscode.isHidden()) {
|
||||
if (_oldPasscode->isHidden() || _newPasscode->isHidden()) {
|
||||
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)));
|
||||
|
@ -410,12 +411,12 @@ void PasscodeBox::onSave(bool force) {
|
|||
}
|
||||
|
||||
void PasscodeBox::onBadOldPasscode() {
|
||||
_oldPasscode.selectAll();
|
||||
_oldPasscode.setFocus();
|
||||
_oldPasscode.showError();
|
||||
_oldPasscode->selectAll();
|
||||
_oldPasscode->setFocus();
|
||||
_oldPasscode->showError();
|
||||
_oldError = lang(_cloudPwd ? lng_cloud_password_wrong : lng_passcode_wrong);
|
||||
if (_hasRecovery && _hintText.isEmpty()) {
|
||||
_recover.hide();
|
||||
_recover->hide();
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
@ -424,7 +425,7 @@ void PasscodeBox::onOldChanged() {
|
|||
if (!_oldError.isEmpty()) {
|
||||
_oldError = QString();
|
||||
if (_hasRecovery && _hintText.isEmpty()) {
|
||||
_recover.show();
|
||||
_recover->show();
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
@ -498,21 +499,21 @@ RecoverBox::RecoverBox(const QString &pattern) : AbstractBox(st::boxWidth)
|
|||
, _recoverCode(this, st::defaultInputField, lang(lng_signin_code)) {
|
||||
setBlockTitle(true);
|
||||
|
||||
setMaxHeight(titleHeight() + st::passcodePadding.top() + st::passcodeSkip + _recoverCode.height() + st::passcodeSkip + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom());
|
||||
setMaxHeight(titleHeight() + st::passcodePadding.top() + st::passcodeSkip + _recoverCode->height() + st::passcodeSkip + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton->height() + st::boxButtonPadding.bottom());
|
||||
|
||||
connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSubmit()));
|
||||
connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
connect(_saveButton, SIGNAL(clicked()), this, SLOT(onSubmit()));
|
||||
connect(_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
|
||||
connect(&_recoverCode, SIGNAL(changed()), this, SLOT(onCodeChanged()));
|
||||
connect(&_recoverCode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(_recoverCode, SIGNAL(changed()), this, SLOT(onCodeChanged()));
|
||||
connect(_recoverCode, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
|
||||
prepare();
|
||||
}
|
||||
|
||||
void RecoverBox::showAll() {
|
||||
_recoverCode.show();
|
||||
_saveButton.show();
|
||||
_cancelButton.show();
|
||||
_recoverCode->show();
|
||||
_saveButton->show();
|
||||
_cancelButton->show();
|
||||
AbstractBox::showAll();
|
||||
}
|
||||
|
||||
|
@ -525,35 +526,35 @@ void RecoverBox::paintEvent(QPaintEvent *e) {
|
|||
p.setFont(st::normalFont);
|
||||
p.setPen(st::boxTextFg);
|
||||
int32 w = st::boxWidth - st::boxPadding.left() * 1.5;
|
||||
p.drawText(QRect(st::boxPadding.left(), _recoverCode.y() - st::passcodeSkip - st::passcodePadding.top(), w, st::passcodePadding.top() + st::passcodeSkip), _pattern, style::al_left);
|
||||
p.drawText(QRect(st::boxPadding.left(), _recoverCode->y() - st::passcodeSkip - st::passcodePadding.top(), w, st::passcodePadding.top() + st::passcodeSkip), _pattern, style::al_left);
|
||||
|
||||
if (!_error.isEmpty()) {
|
||||
p.setPen(st::boxTextFgError);
|
||||
p.drawText(QRect(st::boxPadding.left(), _recoverCode.y() + _recoverCode.height(), w, st::passcodeSkip), _error, style::al_left);
|
||||
p.drawText(QRect(st::boxPadding.left(), _recoverCode->y() + _recoverCode->height(), w, st::passcodeSkip), _error, style::al_left);
|
||||
}
|
||||
}
|
||||
|
||||
void RecoverBox::resizeEvent(QResizeEvent *e) {
|
||||
_recoverCode.resize(st::boxWidth - st::boxPadding.left() - st::boxPadding.right(), _recoverCode.height());
|
||||
_recoverCode.moveToLeft(st::boxPadding.left(), titleHeight() + st::passcodePadding.top() + st::passcodeSkip);
|
||||
_recoverCode->resize(st::boxWidth - st::boxPadding.left() - st::boxPadding.right(), _recoverCode->height());
|
||||
_recoverCode->moveToLeft(st::boxPadding.left(), titleHeight() + st::passcodePadding.top() + st::passcodeSkip);
|
||||
|
||||
_saveButton.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _saveButton.height());
|
||||
_cancelButton.moveToRight(st::boxButtonPadding.right() + _saveButton.width() + st::boxButtonPadding.left(), _saveButton.y());
|
||||
_saveButton->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _saveButton->height());
|
||||
_cancelButton->moveToRight(st::boxButtonPadding.right() + _saveButton->width() + st::boxButtonPadding.left(), _saveButton->y());
|
||||
|
||||
AbstractBox::resizeEvent(e);
|
||||
}
|
||||
|
||||
void RecoverBox::doSetInnerFocus() {
|
||||
_recoverCode.setFocus();
|
||||
_recoverCode->setFocus();
|
||||
}
|
||||
|
||||
void RecoverBox::onSubmit() {
|
||||
if (_submitRequest) return;
|
||||
|
||||
QString code = _recoverCode.getLastText().trimmed();
|
||||
QString code = _recoverCode->getLastText().trimmed();
|
||||
if (code.isEmpty()) {
|
||||
_recoverCode.setFocus();
|
||||
_recoverCode.showError();
|
||||
_recoverCode->setFocus();
|
||||
_recoverCode->showError();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -577,7 +578,7 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) {
|
|||
_submitRequest = 0;
|
||||
_error = lang(lng_flood_error);
|
||||
update();
|
||||
_recoverCode.showError();
|
||||
_recoverCode->showError();
|
||||
return true;
|
||||
}
|
||||
if (MTP::isDefaultHandledError(error)) return false;
|
||||
|
@ -599,9 +600,9 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) {
|
|||
} else if (err == qstr("CODE_INVALID")) {
|
||||
_error = lang(lng_signin_wrong_code);
|
||||
update();
|
||||
_recoverCode.selectAll();
|
||||
_recoverCode.setFocus();
|
||||
_recoverCode.showError();
|
||||
_recoverCode->selectAll();
|
||||
_recoverCode->setFocus();
|
||||
_recoverCode->showError();
|
||||
return true;
|
||||
}
|
||||
if (cDebug()) { // internal server error
|
||||
|
@ -610,6 +611,6 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) {
|
|||
_error = lang(lng_server_error);
|
||||
}
|
||||
update();
|
||||
_recoverCode.setFocus();
|
||||
_recoverCode->setFocus();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "abstractbox.h"
|
||||
|
||||
namespace Ui {
|
||||
class LinkButton;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class PasscodeBox : public AbstractBox, public RPCSender {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -74,10 +79,14 @@ private:
|
|||
QString _boxTitle;
|
||||
Text _about, _hintText;
|
||||
|
||||
BoxButton _saveButton, _cancelButton;
|
||||
PasswordField _oldPasscode, _newPasscode, _reenterPasscode;
|
||||
InputField _passwordHint, _recoverEmail;
|
||||
LinkButton _recover;
|
||||
ChildWidget<Ui::RoundButton> _saveButton;
|
||||
ChildWidget<Ui::RoundButton> _cancelButton;
|
||||
ChildWidget<PasswordField> _oldPasscode;
|
||||
ChildWidget<PasswordField> _newPasscode;
|
||||
ChildWidget<PasswordField> _reenterPasscode;
|
||||
ChildWidget<InputField> _passwordHint;
|
||||
ChildWidget<InputField> _recoverEmail;
|
||||
ChildWidget<Ui::LinkButton> _recover;
|
||||
|
||||
QString _oldError, _newError, _emailError;
|
||||
|
||||
|
@ -112,8 +121,9 @@ private:
|
|||
|
||||
QString _pattern;
|
||||
|
||||
BoxButton _saveButton, _cancelButton;
|
||||
InputField _recoverCode;
|
||||
ChildWidget<Ui::RoundButton> _saveButton;
|
||||
ChildWidget<Ui::RoundButton> _cancelButton;
|
||||
ChildWidget<InputField> _recoverCode;
|
||||
|
||||
QString _error;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "mainwidget.h"
|
||||
#include "photocropbox.h"
|
||||
#include "fileuploader.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
||||
PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer) : AbstractBox()
|
||||
, _downState(0)
|
||||
|
@ -54,8 +55,8 @@ void PhotoCropBox::init(const QImage &img, PeerData *peer) {
|
|||
_title = lang(lng_settings_crop_profile);
|
||||
}
|
||||
|
||||
connect(&_done, SIGNAL(clicked()), this, SLOT(onSend()));
|
||||
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
connect(_done, SIGNAL(clicked()), this, SLOT(onSend()));
|
||||
connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
if (peerToBareInt(_peerId)) {
|
||||
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();
|
||||
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) {
|
||||
|
@ -257,8 +258,8 @@ void PhotoCropBox::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
|
||||
void PhotoCropBox::resizeEvent(QResizeEvent *e) {
|
||||
_done.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done.height());
|
||||
_cancel.moveToRight(st::boxButtonPadding.right() + _done.width() + st::boxButtonPadding.left(), _done.y());
|
||||
_done->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done->height());
|
||||
_cancel->moveToRight(st::boxButtonPadding.right() + _done->width() + st::boxButtonPadding.left(), _done->y());
|
||||
AbstractBox::resizeEvent(e);
|
||||
}
|
||||
|
||||
|
@ -304,6 +305,6 @@ void PhotoCropBox::onReady(const QImage &tosend) {
|
|||
}
|
||||
|
||||
void PhotoCropBox::showAll() {
|
||||
_done.show();
|
||||
_cancel.show();
|
||||
_done->show();
|
||||
_cancel->show();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "abstractbox.h"
|
||||
|
||||
namespace Ui {
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class PhotoCropBox : public AbstractBox {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -56,7 +60,8 @@ private:
|
|||
int32 _thumbx, _thumby, _thumbw, _thumbh;
|
||||
int32 _cropx, _cropy, _cropw;
|
||||
int32 _fromposx, _fromposy, _fromcropx, _fromcropy, _fromcropw;
|
||||
BoxButton _done, _cancel;
|
||||
ChildWidget<Ui::RoundButton> _done;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
QImage _img;
|
||||
QPixmap _thumb;
|
||||
PeerId _peerId;
|
||||
|
|
|
@ -26,7 +26,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "mainwidget.h"
|
||||
#include "photosendbox.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"
|
||||
|
||||
PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxWideWidth)
|
||||
|
|
|
@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Ui {
|
||||
class Checkbox;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class PhotoSendBox : public AbstractBox {
|
||||
|
@ -60,8 +61,8 @@ private:
|
|||
bool _compressedFromSettings;
|
||||
ChildWidget<Ui::Checkbox> _compressed;
|
||||
|
||||
ChildWidget<BoxButton> _send;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _send;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
int32 _thumbx, _thumby, _thumbw, _thumbh;
|
||||
Text _name;
|
||||
|
@ -108,8 +109,8 @@ private:
|
|||
QPixmap _thumb;
|
||||
|
||||
ChildWidget<InputArea> _field = { nullptr };
|
||||
ChildWidget<BoxButton> _save;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _save;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
int32 _thumbx, _thumby, _thumbw, _thumbh;
|
||||
Text _name;
|
||||
|
|
|
@ -25,7 +25,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_profile.h"
|
||||
#include "boxes/confirmbox.h"
|
||||
#include "ui/buttons/checkbox.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
ReportBox::ReportBox(ChannelData *channel) : AbstractBox(st::boxWidth)
|
||||
|
|
|
@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Ui {
|
||||
class Radiobutton;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class ReportBox : public AbstractBox, public RPCSender {
|
||||
|
@ -60,7 +61,7 @@ private:
|
|||
ChildWidget<Ui::Radiobutton> _reasonOther;
|
||||
ChildWidget<InputArea> _reasonOtherText = { nullptr };
|
||||
|
||||
ChildWidget<BoxButton> _report, _cancel;
|
||||
ChildWidget<Ui::RoundButton> _report, _cancel;
|
||||
|
||||
enum Reason {
|
||||
ReasonSpam,
|
||||
|
|
|
@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "mainwindow.h"
|
||||
#include "countries.h"
|
||||
#include "boxes/confirmbox.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)
|
||||
|
@ -38,14 +38,14 @@ SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)
|
|||
, _shortPollRequest(0) {
|
||||
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(allTerminated()), this, SLOT(onAllTerminated()));
|
||||
connect(_inner, SIGNAL(terminateAll()), this, SLOT(onTerminateAll()));
|
||||
connect(App::wnd(), SIGNAL(newAuthorization()), this, SLOT(onNewAuthorization()));
|
||||
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);
|
||||
|
||||
prepare();
|
||||
|
@ -55,12 +55,12 @@ SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)
|
|||
|
||||
void SessionsBox::resizeEvent(QResizeEvent *e) {
|
||||
ScrollableBox::resizeEvent(e);
|
||||
_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());
|
||||
_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());
|
||||
}
|
||||
|
||||
void SessionsBox::showAll() {
|
||||
_done.show();
|
||||
_done->show();
|
||||
if (_loading) {
|
||||
scrollArea()->hide();
|
||||
_shadow.hide();
|
||||
|
@ -194,7 +194,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
|
|||
}
|
||||
}
|
||||
_inner->listUpdated();
|
||||
if (!_done.isHidden()) {
|
||||
if (!_done->isHidden()) {
|
||||
showAll();
|
||||
update();
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
|
|||
|
||||
void SessionsBox::onOneTerminated() {
|
||||
if (_list.isEmpty()) {
|
||||
if (!_done.isHidden()) {
|
||||
if (!_done->isHidden()) {
|
||||
showAll();
|
||||
update();
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ void SessionsBox::onOneTerminated() {
|
|||
void SessionsBox::onShortPollAuthorizations() {
|
||||
if (!_shortPollRequest) {
|
||||
_shortPollRequest = MTP::send(MTPaccount_GetAuthorizations(), rpcDone(&SessionsBox::gotAuthorizations));
|
||||
if (!_done.isHidden()) {
|
||||
if (!_done->isHidden()) {
|
||||
showAll();
|
||||
update();
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ void SessionsBox::onAllTerminated() {
|
|||
|
||||
void SessionsBox::onTerminateAll() {
|
||||
_loading = true;
|
||||
if (!_done.isHidden()) {
|
||||
if (!_done->isHidden()) {
|
||||
showAll();
|
||||
update();
|
||||
}
|
||||
|
@ -246,10 +246,10 @@ SessionsBox::Inner::Inner(QWidget *parent, SessionsBox::List *list, SessionsBox:
|
|||
, _list(list)
|
||||
, _current(current)
|
||||
, _terminating(0)
|
||||
, _terminateAll(this, lang(lng_sessions_terminate_all), st::redBoxLinkButton)
|
||||
, _terminateAll(this, lang(lng_sessions_terminate_all), st::sessionTerminateAllButton)
|
||||
, _terminateBox(0) {
|
||||
connect(&_terminateAll, SIGNAL(clicked()), this, SLOT(onTerminateAll()));
|
||||
_terminateAll.hide();
|
||||
connect(_terminateAll, SIGNAL(clicked()), this, SLOT(onTerminateAll()));
|
||||
_terminateAll->hide();
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ void SessionsBox::Inner::paintEvent(QPaintEvent *e) {
|
|||
|
||||
void SessionsBox::Inner::onTerminate() {
|
||||
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();
|
||||
|
||||
if (_terminateBox) _terminateBox->deleteLater();
|
||||
|
@ -399,14 +399,14 @@ bool SessionsBox::Inner::terminateAllFail(const RPCError &error) {
|
|||
}
|
||||
|
||||
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() {
|
||||
if (_list->isEmpty()) {
|
||||
_terminateAll.hide();
|
||||
_terminateAll->hide();
|
||||
} else {
|
||||
_terminateAll.show();
|
||||
_terminateAll->show();
|
||||
}
|
||||
for (TerminateButtons::iterator i = _terminateButtons.begin(), e = _terminateButtons.end(); i != e; ++i) {
|
||||
i.value()->move(0, -1);
|
||||
|
|
|
@ -27,6 +27,8 @@ class ConfirmBox;
|
|||
|
||||
namespace Ui {
|
||||
class IconButton;
|
||||
class LinkButton;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class SessionsBox : public ScrollableBox, public RPCSender {
|
||||
|
@ -68,7 +70,7 @@ private:
|
|||
class Inner;
|
||||
ChildWidget<Inner> _inner;
|
||||
ScrollableBoxShadow _shadow;
|
||||
BoxButton _done;
|
||||
ChildWidget<Ui::RoundButton> _done;
|
||||
|
||||
SingleTimer _shortPollTimer;
|
||||
mtpRequestId _shortPollRequest;
|
||||
|
@ -114,7 +116,7 @@ private:
|
|||
TerminateButtons _terminateButtons;
|
||||
|
||||
uint64 _terminating;
|
||||
LinkButton _terminateAll;
|
||||
ChildWidget<Ui::LinkButton> _terminateAll;
|
||||
ConfirmBox *_terminateBox;
|
||||
|
||||
};
|
||||
|
|
|
@ -35,6 +35,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "ui/toast/toast.h"
|
||||
#include "ui/widgets/multi_select.h"
|
||||
#include "history/history_media_types.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "boxes/contactsbox.h"
|
||||
|
||||
ShareBox::ShareBox(CopyCallback &©Callback, SubmitCallback &&submitCallback, FilterCallback &&filterCallback) : ItemListBox(st::boxScroll)
|
||||
|
|
|
@ -37,6 +37,7 @@ struct PeerUpdate;
|
|||
|
||||
namespace Ui {
|
||||
class MultiSelect;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
QString appendShareGameScoreUrl(const QString &url, const FullMsgId &fullId);
|
||||
|
@ -90,9 +91,9 @@ private:
|
|||
ChildWidget<Inner> _inner;
|
||||
ChildWidget<Ui::MultiSelect> _select;
|
||||
|
||||
ChildWidget<BoxButton> _copy;
|
||||
ChildWidget<BoxButton> _share;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _copy;
|
||||
ChildWidget<Ui::RoundButton> _share;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
ChildWidget<ScrollableBoxShadow> _topShadow;
|
||||
ChildWidget<ScrollableBoxShadow> _bottomShadow;
|
||||
|
|
|
@ -31,6 +31,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "dialogs/dialogs_layout.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_stickers.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -611,11 +612,8 @@ void StickersBox::Inner::paintRow(Painter &p, int32 index) {
|
|||
bool removeDown = removeSel && (index == _actionDown);
|
||||
|
||||
p.setFont(removeSel ? st::linkOverFont : st::linkFont);
|
||||
if (removeDown) {
|
||||
p.setPen(st::btnDefLink.downColor);
|
||||
} else {
|
||||
p.setPen(st::btnDefLink.color);
|
||||
}
|
||||
p.setPen(removeDown ? st::defaultLinkButton.downColor : st::defaultLinkButton.color);
|
||||
|
||||
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));
|
||||
p.drawTextRight(st::contactsPadding.right() + st::contactsCheckPosition.x(), st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, width(), remText, remWidth);
|
||||
|
|
|
@ -26,6 +26,7 @@ class ConfirmBox;
|
|||
|
||||
namespace Ui {
|
||||
class PlainShadow;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class StickersBox : public ItemListBox, public RPCSender {
|
||||
|
@ -81,8 +82,8 @@ private:
|
|||
|
||||
class Inner;
|
||||
ChildWidget<Inner> _inner;
|
||||
ChildWidget<BoxButton> _save = { nullptr };
|
||||
ChildWidget<BoxButton> _cancel = { nullptr };
|
||||
ChildWidget<Ui::RoundButton> _save = { nullptr };
|
||||
ChildWidget<Ui::RoundButton> _cancel = { nullptr };
|
||||
OrderedSet<mtpRequestId> _disenableRequests;
|
||||
mtpRequestId _reorderRequest = 0;
|
||||
ChildWidget<Ui::PlainShadow> _topShadow = { nullptr };
|
||||
|
|
|
@ -31,6 +31,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "dialogs/dialogs_layout.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_stickers.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
||||
StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll)
|
||||
, _inner(this, set)
|
||||
|
@ -42,12 +43,12 @@ StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::
|
|||
setMaxHeight(st::stickersMaxHeight);
|
||||
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(&_share, SIGNAL(clicked()), this, SLOT(onShareStickers()));
|
||||
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
connect(&_done, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
connect(_add, SIGNAL(clicked()), this, SLOT(onAddStickers()));
|
||||
connect(_share, SIGNAL(clicked()), this, SLOT(onShareStickers()));
|
||||
connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
connect(_done, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
|
||||
connect(_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons()));
|
||||
connect(scrollArea(), SIGNAL(scrolled()), this, SLOT(onScroll()));
|
||||
|
@ -81,7 +82,7 @@ void StickerSetBox::onShareStickers() {
|
|||
}
|
||||
|
||||
void StickerSetBox::onUpdateButtons() {
|
||||
if (!_cancel.isHidden() || !_done.isHidden()) {
|
||||
if (!_cancel->isHidden() || !_done->isHidden()) {
|
||||
showAll();
|
||||
}
|
||||
}
|
||||
|
@ -98,27 +99,27 @@ void StickerSetBox::showAll() {
|
|||
if (_inner->loaded()) {
|
||||
_shadow.show();
|
||||
if (_inner->notInstalled()) {
|
||||
_add.show();
|
||||
_cancel.show();
|
||||
_share.hide();
|
||||
_done.hide();
|
||||
_add->show();
|
||||
_cancel->show();
|
||||
_share->hide();
|
||||
_done->hide();
|
||||
} else if (_inner->official()) {
|
||||
_add.hide();
|
||||
_share.hide();
|
||||
_cancel.hide();
|
||||
_done.show();
|
||||
_add->hide();
|
||||
_share->hide();
|
||||
_cancel->hide();
|
||||
_done->show();
|
||||
} else {
|
||||
_share.show();
|
||||
_cancel.show();
|
||||
_add.hide();
|
||||
_done.hide();
|
||||
_share->show();
|
||||
_cancel->show();
|
||||
_add->hide();
|
||||
_done->hide();
|
||||
}
|
||||
} else {
|
||||
_shadow.hide();
|
||||
_add.hide();
|
||||
_share.hide();
|
||||
_cancel.show();
|
||||
_done.hide();
|
||||
_add->hide();
|
||||
_share->hide();
|
||||
_cancel->show();
|
||||
_done->hide();
|
||||
}
|
||||
resizeEvent(0);
|
||||
update();
|
||||
|
@ -134,16 +135,16 @@ void StickerSetBox::paintEvent(QPaintEvent *e) {
|
|||
void StickerSetBox::resizeEvent(QResizeEvent *e) {
|
||||
ScrollableBox::resizeEvent(e);
|
||||
_inner->resize(width(), _inner->height());
|
||||
_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());
|
||||
_share.moveToRight(st::boxButtonPadding.right(), _add.y());
|
||||
_done.moveToRight(st::boxButtonPadding.right(), _add.y());
|
||||
if (_add.isHidden() && _share.isHidden()) {
|
||||
_cancel.moveToRight(st::boxButtonPadding.right(), _add.y());
|
||||
} else if (_add.isHidden()) {
|
||||
_cancel.moveToRight(st::boxButtonPadding.right() + _share.width() + st::boxButtonPadding.left(), _add.y());
|
||||
_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());
|
||||
_share->moveToRight(st::boxButtonPadding.right(), _add->y());
|
||||
_done->moveToRight(st::boxButtonPadding.right(), _add->y());
|
||||
if (_add->isHidden() && _share->isHidden()) {
|
||||
_cancel->moveToRight(st::boxButtonPadding.right(), _add->y());
|
||||
} else if (_add->isHidden()) {
|
||||
_cancel->moveToRight(st::boxButtonPadding.right() + _share->width() + st::boxButtonPadding.left(), _add->y());
|
||||
} 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ class ConfirmBox;
|
|||
|
||||
namespace Ui {
|
||||
class PlainShadow;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class StickerSetBox : public ScrollableBox, public RPCSender {
|
||||
|
@ -59,7 +60,10 @@ private:
|
|||
class Inner;
|
||||
ChildWidget<Inner> _inner;
|
||||
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;
|
||||
|
||||
};
|
||||
|
|
|
@ -19,18 +19,20 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|||
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
#include "boxes/usernamebox.h"
|
||||
|
||||
#include "lang.h"
|
||||
#include "application.h"
|
||||
#include "usernamebox.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
UsernameBox::UsernameBox() : AbstractBox(st::boxWidth),
|
||||
_save(this, lang(lng_settings_save), st::defaultBoxButton),
|
||||
_cancel(this, lang(lng_cancel), st::cancelBoxButton),
|
||||
_username(this, st::defaultInputField, qsl("@username"), App::self()->username, false),
|
||||
_link(this, QString(), st::defaultBoxLinkButton),
|
||||
_link(this, QString(), st::boxLinkButton),
|
||||
_saveRequestId(0), _checkRequestId(0),
|
||||
_about(st::boxWidth - st::usernamePadding.left()) {
|
||||
setBlockTitle(true);
|
||||
|
@ -39,15 +41,15 @@ _about(st::boxWidth - st::usernamePadding.left()) {
|
|||
|
||||
textstyleSet(&st::usernameTextStyle);
|
||||
_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();
|
||||
|
||||
connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
|
||||
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
connect(&_username, SIGNAL(changed()), this, SLOT(onChanged()));
|
||||
connect(&_username, SIGNAL(submitted(bool)), this, SLOT(onSave()));
|
||||
connect(_save, SIGNAL(clicked()), this, SLOT(onSave()));
|
||||
connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
connect(_username, SIGNAL(changed()), this, SLOT(onChanged()));
|
||||
connect(_username, SIGNAL(submitted(bool)), this, SLOT(onSave()));
|
||||
|
||||
connect(&_link, SIGNAL(clicked()), this, SLOT(onLinkClick()));
|
||||
connect(_link, SIGNAL(clicked()), this, SLOT(onLinkClick()));
|
||||
|
||||
_checkTimer.setSingleShot(true);
|
||||
connect(&_checkTimer, SIGNAL(timeout()), this, SLOT(onCheck()));
|
||||
|
@ -56,16 +58,16 @@ _about(st::boxWidth - st::usernamePadding.left()) {
|
|||
}
|
||||
|
||||
void UsernameBox::showAll() {
|
||||
_username.show();
|
||||
_save.show();
|
||||
_cancel.show();
|
||||
_username->show();
|
||||
_save->show();
|
||||
_cancel->show();
|
||||
updateLinkText();
|
||||
|
||||
AbstractBox::showAll();
|
||||
}
|
||||
|
||||
void UsernameBox::doSetInnerFocus() {
|
||||
_username.setFocus();
|
||||
_username->setFocus();
|
||||
}
|
||||
|
||||
void UsernameBox::paintEvent(QPaintEvent *e) {
|
||||
|
@ -77,25 +79,25 @@ void UsernameBox::paintEvent(QPaintEvent *e) {
|
|||
p.setFont(st::boxTextFont);
|
||||
if (!_copiedTextLink.isEmpty()) {
|
||||
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()) {
|
||||
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()) {
|
||||
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 {
|
||||
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);
|
||||
textstyleSet(&st::usernameTextStyle);
|
||||
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();
|
||||
|
||||
int32 linky = _username.y() + _username.height() + st::usernameSkip + h + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2);
|
||||
if (_link.isHidden()) {
|
||||
int32 linky = _username->y() + _username->height() + st::usernameSkip + h + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2);
|
||||
if (_link->isHidden()) {
|
||||
p.drawTextLeft(st::usernamePadding.left(), linky, width(), lang(lng_username_link_willbe));
|
||||
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"));
|
||||
|
@ -105,17 +107,17 @@ void UsernameBox::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
|
||||
void UsernameBox::resizeEvent(QResizeEvent *e) {
|
||||
_username.resize(width() - st::usernamePadding.left() - st::usernamePadding.right(), _username.height());
|
||||
_username.moveToLeft(st::usernamePadding.left(), titleHeight() + st::usernamePadding.top());
|
||||
_username->resize(width() - st::usernamePadding.left() - st::usernamePadding.right(), _username->height());
|
||||
_username->moveToLeft(st::usernamePadding.left(), titleHeight() + st::usernamePadding.top());
|
||||
|
||||
textstyleSet(&st::usernameTextStyle);
|
||||
int32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw);
|
||||
textstyleRestore();
|
||||
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));
|
||||
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));
|
||||
|
||||
_save.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _save.height());
|
||||
_cancel.moveToRight(st::boxButtonPadding.right() + _save.width() + st::boxButtonPadding.left(), _save.y());
|
||||
_save->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _save->height());
|
||||
_cancel->moveToRight(st::boxButtonPadding.right() + _save->width() + st::boxButtonPadding.left(), _save->y());
|
||||
|
||||
AbstractBox::resizeEvent(e);
|
||||
}
|
||||
|
@ -199,21 +201,21 @@ bool UsernameBox::onUpdateFail(const RPCError &error) {
|
|||
onClose();
|
||||
return true;
|
||||
} else if (err == qstr("USERNAME_INVALID")) {
|
||||
_username.setFocus();
|
||||
_username.showError();
|
||||
_username->setFocus();
|
||||
_username->showError();
|
||||
_copiedTextLink = QString();
|
||||
_errorText = lang(lng_username_invalid);
|
||||
update();
|
||||
return true;
|
||||
} else if (err == qstr("USERNAME_OCCUPIED") || err == qstr("USERNAMES_UNAVAILABLE")) {
|
||||
_username.setFocus();
|
||||
_username.showError();
|
||||
_username->setFocus();
|
||||
_username->showError();
|
||||
_copiedTextLink = QString();
|
||||
_errorText = lang(lng_username_occupied);
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
_username.setFocus();
|
||||
_username->setFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -245,25 +247,25 @@ bool UsernameBox::onCheckFail(const RPCError &error) {
|
|||
}
|
||||
_goodText = QString();
|
||||
_copiedTextLink = QString();
|
||||
_username.setFocus();
|
||||
_username->setFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
QString UsernameBox::getName() const {
|
||||
return _username.text().replace('@', QString()).trimmed();
|
||||
return _username->text().replace('@', QString()).trimmed();
|
||||
}
|
||||
|
||||
void UsernameBox::updateLinkText() {
|
||||
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 (!_link.isHidden()) {
|
||||
_link.hide();
|
||||
if (!_link->isHidden()) {
|
||||
_link->hide();
|
||||
update();
|
||||
}
|
||||
} else {
|
||||
if (_link.isHidden()) {
|
||||
_link.show();
|
||||
if (_link->isHidden()) {
|
||||
_link->show();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "abstractbox.h"
|
||||
|
||||
namespace Ui {
|
||||
class RoundButton;
|
||||
class LinkButton;
|
||||
} // namespace Ui
|
||||
|
||||
class UsernameBox : public AbstractBox, public RPCSender {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -53,9 +58,10 @@ private:
|
|||
QString getName() const;
|
||||
void updateLinkText();
|
||||
|
||||
BoxButton _save, _cancel;
|
||||
UsernameInput _username;
|
||||
LinkButton _link;
|
||||
ChildWidget<Ui::RoundButton> _save;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
ChildWidget<UsernameInput> _username;
|
||||
ChildWidget<Ui::LinkButton> _link;
|
||||
|
||||
mtpRequestId _saveRequestId, _checkRequestId;
|
||||
QString _sentUsername, _checkUsername, _errorText, _goodText, _copiedTextLink;
|
||||
|
|
|
@ -162,7 +162,7 @@ historySendingInvertedIcon: icon {{ "dialogs_sending", #ffffffc8, point(5px, 5px
|
|||
historyViewsSendingIcon: icon {{ "dialogs_sending", #a0adb5, point(3px, 0px) }};
|
||||
historyViewsSendingInvertedIcon: icon {{ "dialogs_sending", #ffffffc8, point(3px, 0px) }};
|
||||
|
||||
dialogsUpdateButton: flatButton {
|
||||
dialogsUpdateButton: FlatButton {
|
||||
duration: 0;
|
||||
cursor: cursor(pointer);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "dialogs/dialogs_layout.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_stickers.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "data/data_drafts.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(peerPhotoChanged(PeerData*)), this, SLOT(onPeerPhotoChanged(PeerData*)));
|
||||
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()));
|
||||
_cancelSearchInPeer->hide();
|
||||
|
||||
|
@ -410,7 +410,7 @@ void DialogsInner::mousePressEvent(QMouseEvent *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);
|
||||
}
|
||||
|
||||
|
@ -1092,16 +1092,16 @@ void DialogsInner::refresh(bool toTop) {
|
|||
if (shownDialogs()->isEmpty()) {
|
||||
h = st::noContactsHeight;
|
||||
if (cContactsReceived()) {
|
||||
if (_addContactLnk.isHidden()) _addContactLnk.show();
|
||||
if (_addContactLnk->isHidden()) _addContactLnk->show();
|
||||
} else {
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
if (!_addContactLnk->isHidden()) _addContactLnk->hide();
|
||||
}
|
||||
} else {
|
||||
h = dialogsOffset() + shownDialogs()->size() * st::dialogsRowHeight;
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
if (!_addContactLnk->isHidden()) _addContactLnk->hide();
|
||||
}
|
||||
} else {
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
if (!_addContactLnk->isHidden()) _addContactLnk->hide();
|
||||
if (_state == FilteredState) {
|
||||
h = searchedOffset() + (_searchResults.count() * st::dialogsRowHeight) + ((_searchResults.isEmpty() && !_searchInPeer) ? -st::searchedBarHeight : 0);
|
||||
} else if (_state == SearchedState) {
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace Ui {
|
|||
class IconButton;
|
||||
class PopupMenu;
|
||||
class DropdownMenu;
|
||||
class FlatButton;
|
||||
class LinkButton;
|
||||
} // namespace Ui
|
||||
|
||||
enum DialogsSearchRequestType {
|
||||
|
@ -206,7 +208,7 @@ private:
|
|||
|
||||
void paintDialog(QPainter &p, Dialogs::Row *dialog);
|
||||
|
||||
LinkButton _addContactLnk;
|
||||
ChildWidget<Ui::LinkButton> _addContactLnk;
|
||||
ChildWidget<Ui::IconButton> _cancelSearchInPeer;
|
||||
|
||||
bool _overDelete = false;
|
||||
|
@ -335,7 +337,7 @@ private:
|
|||
ChildWidget<Ui::IconButton> _lockUnlock;
|
||||
ChildWidget<ScrollArea> _scroll;
|
||||
ChildWidget<DialogsInner> _inner;
|
||||
ChildWidget<FlatButton> _updateTelegram = { nullptr };
|
||||
ChildWidget<Ui::FlatButton> _updateTelegram = { nullptr };
|
||||
|
||||
Animation _a_show;
|
||||
QPixmap _cacheUnder, _cacheOver;
|
||||
|
|
|
@ -157,7 +157,7 @@ historyComposeFieldMaxHeight: 224px;
|
|||
historySendPadding: 9px;
|
||||
historySendRight: 2px;
|
||||
|
||||
historyComposeButton: flatButton {
|
||||
historyComposeButton: FlatButton {
|
||||
duration: 200;
|
||||
cursor: cursor(pointer);
|
||||
|
||||
|
@ -177,7 +177,7 @@ historyComposeButton: flatButton {
|
|||
font: semiboldFont;
|
||||
overFont: semiboldFont;
|
||||
}
|
||||
historyUnblock: flatButton(historyComposeButton) {
|
||||
historyUnblock: FlatButton(historyComposeButton) {
|
||||
color: #d15948;
|
||||
overColor: #d15948;
|
||||
}
|
||||
|
@ -307,3 +307,38 @@ topBarMenuToggle: IconButton(topBarSearch) {
|
|||
iconPosition: 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;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "ui/filedialog.h"
|
||||
#include "ui/toast/toast.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/dropdown_menu.h"
|
||||
#include "inline_bots/inline_bot_result.h"
|
||||
|
@ -2911,6 +2911,29 @@ HistoryHider::~HistoryHider() {
|
|||
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) {
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "localimageloader.h"
|
||||
#include "ui/effects/rect_shadow.h"
|
||||
#include "ui/widgets/tooltip.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "history/history_common.h"
|
||||
#include "history/field_autocomplete.h"
|
||||
#include "window/section_widget.h"
|
||||
|
@ -44,10 +43,14 @@ class PopupMenu;
|
|||
class IconButton;
|
||||
class HistoryDownButton;
|
||||
class EmojiButton;
|
||||
class FlatButton;
|
||||
class LinkButton;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class DragArea;
|
||||
class EmojiPan;
|
||||
class SilentToggle;
|
||||
|
||||
class HistoryWidget;
|
||||
class HistoryInner : public TWidget, public Ui::AbstractTooltipShower, private base::Subscriber {
|
||||
|
@ -350,9 +353,9 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
private:
|
||||
ChildWidget<FlatButton> _report;
|
||||
ChildWidget<FlatButton> _hide;
|
||||
ChildWidget<LinkButton> _clear;
|
||||
ChildWidget<Ui::FlatButton> _report;
|
||||
ChildWidget<Ui::FlatButton> _hide;
|
||||
ChildWidget<Ui::LinkButton> _clear;
|
||||
|
||||
};
|
||||
|
||||
|
@ -489,8 +492,8 @@ private:
|
|||
QString _shareUrl, _shareText;
|
||||
QString _botAndQuery;
|
||||
|
||||
ChildWidget<BoxButton> _send;
|
||||
ChildWidget<BoxButton> _cancel;
|
||||
ChildWidget<Ui::RoundButton> _send;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
PeerData *_offered = nullptr;
|
||||
|
||||
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);
|
||||
TextWithTags::Tags textTagsFromEntities(const EntitiesInText &entities);
|
||||
|
||||
|
@ -1099,10 +1079,10 @@ private:
|
|||
ReportSpamPanel _reportSpamPanel;
|
||||
|
||||
ChildWidget<Ui::IconButton> _send;
|
||||
ChildWidget<FlatButton> _unblock;
|
||||
ChildWidget<FlatButton> _botStart;
|
||||
ChildWidget<FlatButton> _joinChannel;
|
||||
ChildWidget<FlatButton> _muteUnmute;
|
||||
ChildWidget<Ui::FlatButton> _unblock;
|
||||
ChildWidget<Ui::FlatButton> _botStart;
|
||||
ChildWidget<Ui::FlatButton> _joinChannel;
|
||||
ChildWidget<Ui::FlatButton> _muteUnmute;
|
||||
mtpRequestId _unblockRequest = 0;
|
||||
mtpRequestId _reportSpamRequest = 0;
|
||||
ChildWidget<Ui::IconButton> _attachToggle;
|
||||
|
|
|
@ -43,6 +43,14 @@ introCountry: countryInput {
|
|||
align: align(left);
|
||||
}
|
||||
|
||||
introIcon: icon {{ "intro_logo", #008ed5 }};
|
||||
|
||||
introResetLink: LinkButton(defaultLinkButton) {
|
||||
color: #d15948;
|
||||
overColor: #d15948;
|
||||
downColor: #db6352;
|
||||
}
|
||||
|
||||
introBtnTop: 288px;
|
||||
introSkip: 25px;
|
||||
introFinishSkip: 15px;
|
||||
|
@ -51,7 +59,7 @@ introHeaderFont: font(24px);
|
|||
introHeaderSkip: 14px;
|
||||
introIconSkip: 50px;
|
||||
introFont: font(16px);
|
||||
introLink: linkButton(btnDefLink) {
|
||||
introLink: LinkButton(defaultLinkButton) {
|
||||
font: introFont;
|
||||
overFont: font(16px underline);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "application.h"
|
||||
#include "intro/introsignup.h"
|
||||
#include "intro/intropwdcheck.h"
|
||||
#include "ui/buttons/round_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "styles/style_intro.h"
|
||||
|
||||
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) {
|
||||
setGeometry(parent->innerRect());
|
||||
|
||||
_next->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
|
||||
connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitCode()));
|
||||
connect(_code, SIGNAL(changed()), this, SLOT(onInputChange()));
|
||||
connect(_callTimer, SIGNAL(timeout()), this, SLOT(onSendCall()));
|
||||
|
|
|
@ -20,13 +20,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QtWidgets/QWidget>
|
||||
#include "ui/flatbutton.h"
|
||||
#include "ui/flatinput.h"
|
||||
#include "intro/introwidget.h"
|
||||
|
||||
class FlatInput;
|
||||
|
||||
namespace Ui {
|
||||
class RoundButton;
|
||||
class LinkButton;
|
||||
} // namespace Ui
|
||||
|
||||
class CodeInput final : public FlatInput {
|
||||
|
@ -91,7 +91,7 @@ private:
|
|||
ChildWidget<Ui::RoundButton> _next;
|
||||
|
||||
Text _desc;
|
||||
ChildWidget<LinkButton> _noTelegramCode;
|
||||
ChildWidget<Ui::LinkButton> _noTelegramCode;
|
||||
mtpRequestId _noTelegramCodeRequestId;
|
||||
QRect _textRect;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "application.h"
|
||||
#include "intro/introcode.h"
|
||||
#include "styles/style_intro.h"
|
||||
#include "ui/buttons/round_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
||||
namespace {
|
||||
class SignUpClickHandler : public LeftButtonClickHandler {
|
||||
|
@ -56,7 +56,6 @@ IntroPhone::IntroPhone(IntroWidget *parent) : IntroStep(parent)
|
|||
setVisible(false);
|
||||
setGeometry(parent->innerRect());
|
||||
|
||||
_next->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
|
||||
connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitPhone()));
|
||||
connect(_phone, SIGNAL(voidBackspace(QKeyEvent*)), _code, SLOT(startErasing(QKeyEvent*)));
|
||||
connect(_country, SIGNAL(codeChanged(const QString &)), _code, SLOT(codeSelected(const QString &)));
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/flatbutton.h"
|
||||
#include "ui/countryinput.h"
|
||||
#include "ui/flatlabel.h"
|
||||
#include "intro/introwidget.h"
|
||||
|
|
|
@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "lang.h"
|
||||
#include "application.h"
|
||||
#include "intro/introsignup.h"
|
||||
#include "ui/buttons/round_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
||||
IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStep(parent)
|
||||
, a_errorAlpha(0)
|
||||
|
@ -40,12 +40,11 @@ IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStep(parent)
|
|||
, _codeField(this, st::inpIntroPassword, lang(lng_signin_code))
|
||||
, _toRecover(this, lang(lng_signin_recover))
|
||||
, _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) {
|
||||
setVisible(false);
|
||||
setGeometry(parent->innerRect());
|
||||
|
||||
_next->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
|
||||
connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitPwd()));
|
||||
connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));
|
||||
connect(_toRecover, SIGNAL(clicked()), this, SLOT(onToRecover()));
|
||||
|
|
|
@ -20,11 +20,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/flatinput.h"
|
||||
#include "intro/introwidget.h"
|
||||
|
||||
class FlatInput;
|
||||
|
||||
namespace Ui {
|
||||
class RoundButton;
|
||||
class LinkButton;
|
||||
} // namespace Ui
|
||||
|
||||
class IntroPwdCheck final : public IntroStep {
|
||||
|
@ -80,9 +82,9 @@ private:
|
|||
|
||||
ChildWidget<FlatInput> _pwdField;
|
||||
ChildWidget<FlatInput> _codeField;
|
||||
ChildWidget<LinkButton> _toRecover;
|
||||
ChildWidget<LinkButton> _toPassword;
|
||||
ChildWidget<LinkButton> _reset;
|
||||
ChildWidget<Ui::LinkButton> _toRecover;
|
||||
ChildWidget<Ui::LinkButton> _toPassword;
|
||||
ChildWidget<Ui::LinkButton> _reset;
|
||||
mtpRequestId _sentRequest = 0;
|
||||
|
||||
Text _hintText;
|
||||
|
|
|
@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "boxes/photocropbox.h"
|
||||
#include "lang.h"
|
||||
#include "application.h"
|
||||
#include "ui/buttons/round_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
||||
IntroSignup::IntroSignup(IntroWidget *parent) : IntroStep(parent)
|
||||
, a_errorAlpha(0)
|
||||
|
@ -42,7 +42,6 @@ IntroSignup::IntroSignup(IntroWidget *parent) : IntroStep(parent)
|
|||
setVisible(false);
|
||||
setGeometry(parent->innerRect());
|
||||
|
||||
_next->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
|
||||
connect(_next, SIGNAL(clicked()), this, SLOT(onSubmitName()));
|
||||
connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/flatbutton.h"
|
||||
#include "ui/flatinput.h"
|
||||
#include "intro/introwidget.h"
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "application.h"
|
||||
#include "intro/introphone.h"
|
||||
#include "langloaderplain.h"
|
||||
#include "ui/buttons/round_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
||||
IntroStart::IntroStart(IntroWidget *parent) : IntroStep(parent)
|
||||
, _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());
|
||||
|
||||
_next->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
|
||||
connect(_next, SIGNAL(clicked()), parent, SLOT(onStepSubmit()));
|
||||
|
||||
connect(_changeLang, SIGNAL(clicked()), parent, SLOT(onChangeLang()));
|
||||
|
@ -74,7 +73,7 @@ void IntroStart::paintEvent(QPaintEvent *e) {
|
|||
p.setPen(st::introHeaderFg);
|
||||
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) {
|
||||
|
|
|
@ -21,9 +21,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#pragma once
|
||||
|
||||
#include "intro/introwidget.h"
|
||||
#include "ui/flatlabel.h"
|
||||
|
||||
class FlatLabel;
|
||||
|
||||
namespace Ui {
|
||||
class LinkButton;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
|
@ -39,7 +41,7 @@ public:
|
|||
private:
|
||||
ChildWidget<FlatLabel> _intro;
|
||||
|
||||
ChildWidget<LinkButton> _changeLang;
|
||||
ChildWidget<Ui::LinkButton> _changeLang;
|
||||
|
||||
ChildWidget<Ui::RoundButton> _next;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "mainwindow.h"
|
||||
#include "application.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 "styles/style_intro.h"
|
||||
#include "autoupdater.h"
|
||||
|
|
|
@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Ui {
|
||||
class IconButton;
|
||||
class RoundButton;
|
||||
template <typename Widget>
|
||||
class WidgetFadeWrap;
|
||||
} // namespace Ui
|
||||
|
@ -152,8 +153,8 @@ private:
|
|||
QString _firstname, _lastname;
|
||||
|
||||
ChildWidget<Ui::WidgetFadeWrap<Ui::IconButton>> _back;
|
||||
ChildWidget<BoxButton> _settings;
|
||||
ChildWidget<BoxButton> _update = { nullptr };
|
||||
ChildWidget<Ui::RoundButton> _settings;
|
||||
ChildWidget<Ui::RoundButton> _update = { nullptr };
|
||||
|
||||
float64 _backFrom = 0.;
|
||||
float64 _backTo = 0.;
|
||||
|
|
|
@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "styles/style_dialogs.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 "window/section_memento.h"
|
||||
#include "window/section_widget.h"
|
||||
|
|
|
@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_window.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "core/zlib_help.h"
|
||||
#include "lang.h"
|
||||
#include "shortcuts.h"
|
||||
|
@ -52,7 +53,7 @@ ConnectingWidget::ConnectingWidget(QWidget *parent, const QString &text, const Q
|
|||
, _shadow(st::boxShadow)
|
||||
, _reconnect(this, QString()) {
|
||||
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) {
|
||||
|
@ -60,12 +61,12 @@ void ConnectingWidget::set(const QString &text, const QString &reconnect) {
|
|||
_textWidth = st::linkFont->width(_text) + st::linkFont->spacew;
|
||||
int32 _reconnectWidth = 0;
|
||||
if (reconnect.isEmpty()) {
|
||||
_reconnect.hide();
|
||||
_reconnect->hide();
|
||||
} else {
|
||||
_reconnect.setText(reconnect);
|
||||
_reconnect.show();
|
||||
_reconnect.move(st::connectingPadding.left() + _textWidth, st::boxShadow.height() + st::connectingPadding.top());
|
||||
_reconnectWidth = _reconnect.width();
|
||||
_reconnect->setText(reconnect);
|
||||
_reconnect->show();
|
||||
_reconnect->move(st::connectingPadding.left() + _textWidth, st::boxShadow.height() + st::connectingPadding.top());
|
||||
_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());
|
||||
update();
|
||||
|
|
|
@ -47,6 +47,10 @@ class WarningWidget;
|
|||
} // namespace Theme
|
||||
} // namespace Window
|
||||
|
||||
namespace Ui {
|
||||
class LinkButton;
|
||||
} // namespace Ui
|
||||
|
||||
class ConnectingWidget : public TWidget {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -64,7 +68,7 @@ private:
|
|||
Ui::RectShadow _shadow;
|
||||
QString _text;
|
||||
int32 _textWidth;
|
||||
LinkButton _reconnect;
|
||||
ChildWidget<Ui::LinkButton> _reconnect;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/button.h"
|
||||
#include "ui/abstract_button.h"
|
||||
#include "styles/style_media_player.h"
|
||||
|
||||
namespace Media {
|
||||
|
|
|
@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "ui/flatlabel.h"
|
||||
#include "ui/widgets/label_simple.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/view/media_clip_playback.h"
|
||||
#include "media/player/media_player_button.h"
|
||||
|
@ -38,7 +38,7 @@ namespace Player {
|
|||
|
||||
using State = PlayButtonLayout::State;
|
||||
|
||||
class CoverWidget::PlayButton : public Button {
|
||||
class CoverWidget::PlayButton : public Ui::AbstractButton {
|
||||
public:
|
||||
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(); }) {
|
||||
resize(st::mediaPlayerPanelButtonSize);
|
||||
setCursor(style::cur_pointer);
|
||||
|
|
|
@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "media/player/media_player_volume_controller.h"
|
||||
|
||||
#include "media/media_audio.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/media_slider.h"
|
||||
#include "styles/style_media_player.h"
|
||||
#include "styles/style_widgets.h"
|
||||
|
|
|
@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "ui/widgets/label_simple.h"
|
||||
#include "ui/widgets/filled_slider.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "media/media_audio.h"
|
||||
#include "media/view/media_clip_playback.h"
|
||||
#include "media/player/media_player_button.h"
|
||||
|
@ -39,7 +39,7 @@ namespace Player {
|
|||
|
||||
using State = PlayButtonLayout::State;
|
||||
|
||||
class Widget::PlayButton : public Button {
|
||||
class Widget::PlayButton : public Ui::AbstractButton {
|
||||
public:
|
||||
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(); }) {
|
||||
resize(st::mediaPlayerButtonSize);
|
||||
setCursor(style::cur_pointer);
|
||||
|
|
|
@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "ui/widgets/label_simple.h"
|
||||
#include "ui/widgets/media_slider.h"
|
||||
#include "ui/effects/widget_fade_wrap.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "media/media_audio.h"
|
||||
|
||||
namespace Media {
|
||||
|
|
|
@ -115,7 +115,7 @@ mediaviewFileExtPadding: 10px;
|
|||
mediaviewFileLinksTop: 57px;
|
||||
mediaviewFileIconSize: 80px;
|
||||
|
||||
mediaviewFileLink: linkButton(btnDefLink) {
|
||||
mediaviewFileLink: LinkButton(defaultLinkButton) {
|
||||
color: #4595d3;
|
||||
overColor: #4595d3;
|
||||
downColor: #4595d3;
|
||||
|
|
|
@ -27,6 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "application.h"
|
||||
#include "ui/filedialog.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "media/media_clip_reader.h"
|
||||
#include "media/view/media_clip_controller.h"
|
||||
#include "styles/style_mediaview.h"
|
||||
|
@ -130,9 +131,9 @@ MediaView::MediaView() : TWidget(App::wnd())
|
|||
_controlsHideTimer.setSingleShot(true);
|
||||
connect(&_controlsHideTimer, SIGNAL(timeout()), this, SLOT(onHideControls()));
|
||||
|
||||
connect(&_docDownload, SIGNAL(clicked()), this, SLOT(onDownload()));
|
||||
connect(&_docSaveAs, SIGNAL(clicked()), this, SLOT(onSaveAs()));
|
||||
connect(&_docCancel, SIGNAL(clicked()), this, SLOT(onSaveCancel()));
|
||||
connect(_docDownload, SIGNAL(clicked()), this, SLOT(onDownload()));
|
||||
connect(_docSaveAs, SIGNAL(clicked()), this, SLOT(onSaveAs()));
|
||||
connect(_docCancel, SIGNAL(clicked()), this, SLOT(onSaveCancel()));
|
||||
|
||||
_dropdown->setHiddenCallback([this] { dropdownHidden(); });
|
||||
}
|
||||
|
@ -237,7 +238,7 @@ void MediaView::stopGif() {
|
|||
|
||||
void MediaView::documentUpdated(DocumentData *doc) {
|
||||
if (_doc && _doc == doc && !fileShown()) {
|
||||
if ((_doc->loading() && _docCancel.isHidden()) || (!_doc->loading() && !_docCancel.isHidden())) {
|
||||
if ((_doc->loading() && _docCancel->isHidden()) || (!_doc->loading() && !_docCancel->isHidden())) {
|
||||
updateControls();
|
||||
} else if (_doc->loading()) {
|
||||
updateDocSize();
|
||||
|
@ -289,29 +290,29 @@ void MediaView::updateDocSize() {
|
|||
void MediaView::updateControls() {
|
||||
if (_doc && !fileShown()) {
|
||||
if (_doc->loading()) {
|
||||
_docDownload.hide();
|
||||
_docSaveAs.hide();
|
||||
_docCancel.moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
|
||||
_docCancel.show();
|
||||
_docDownload->hide();
|
||||
_docSaveAs->hide();
|
||||
_docCancel->moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
|
||||
_docCancel->show();
|
||||
} else {
|
||||
if (_doc->loaded(DocumentData::FilePathResolveChecked)) {
|
||||
_docDownload.hide();
|
||||
_docSaveAs.moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
|
||||
_docSaveAs.show();
|
||||
_docCancel.hide();
|
||||
_docDownload->hide();
|
||||
_docSaveAs->moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
|
||||
_docSaveAs->show();
|
||||
_docCancel->hide();
|
||||
} else {
|
||||
_docDownload.moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
|
||||
_docDownload.show();
|
||||
_docSaveAs.moveToLeft(_docRect.x() + 2.5 * st::mediaviewFilePadding + st::mediaviewFileIconSize + _docDownload.width(), _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
|
||||
_docSaveAs.show();
|
||||
_docCancel.hide();
|
||||
_docDownload->moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
|
||||
_docDownload->show();
|
||||
_docSaveAs->moveToLeft(_docRect.x() + 2.5 * st::mediaviewFilePadding + st::mediaviewFileIconSize + _docDownload->width(), _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
|
||||
_docSaveAs->show();
|
||||
_docCancel->hide();
|
||||
}
|
||||
}
|
||||
updateDocSize();
|
||||
} else {
|
||||
_docDownload.hide();
|
||||
_docSaveAs.hide();
|
||||
_docCancel.hide();
|
||||
_docDownload->hide();
|
||||
_docSaveAs->hide();
|
||||
_docCancel->hide();
|
||||
}
|
||||
radialStart();
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ class Controller;
|
|||
|
||||
namespace Ui {
|
||||
class PopupMenu;
|
||||
class LinkButton;
|
||||
} // namespace Ui
|
||||
|
||||
struct AudioPlaybackState;
|
||||
|
@ -242,7 +243,9 @@ private:
|
|||
int _docNameWidth = 0, _docSizeWidth = 0, _docExtWidth = 0;
|
||||
QRect _docRect, _docIconRect;
|
||||
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;
|
||||
Ui::RadialAnimation _radial;
|
||||
|
|
|
@ -29,7 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "ui/filedialog.h"
|
||||
#include "ui/widgets/popup_menu.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/window_theme.h"
|
||||
#include "lang.h"
|
||||
|
|
|
@ -26,7 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "mainwindow.h"
|
||||
#include "application.h"
|
||||
#include "ui/text/text.h"
|
||||
#include "ui/buttons/round_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "styles/style_boxes.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(submitted(bool)), this, SLOT(onSubmit()));
|
||||
|
||||
_submit->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
|
||||
_submit->setClickedCallback([this] { onSubmit(); });
|
||||
_logout->setClickedCallback([] { App::wnd()->onLogout(); });
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#pragma once
|
||||
|
||||
namespace Ui {
|
||||
class LinkButton;
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
|
@ -56,7 +57,7 @@ private:
|
|||
|
||||
ChildWidget<FlatInput> _passcode;
|
||||
ChildWidget<Ui::RoundButton> _submit;
|
||||
ChildWidget<LinkButton> _logout;
|
||||
ChildWidget<Ui::LinkButton> _logout;
|
||||
QString _error;
|
||||
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "stdafx.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 "styles/style_window.h"
|
||||
|
||||
|
|
|
@ -25,10 +25,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "styles/style_window.h"
|
||||
#include "profile/profile_cover_drop_area.h"
|
||||
#include "profile/profile_userpic_button.h"
|
||||
#include "ui/buttons/round_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/filedialog.h"
|
||||
#include "ui/flatlabel.h"
|
||||
#include "ui/flatbutton.h"
|
||||
#include "observer_peer.h"
|
||||
#include "boxes/confirmbox.h"
|
||||
#include "boxes/contactsbox.h"
|
||||
|
@ -354,7 +353,7 @@ void CoverWidget::refreshStatusText() {
|
|||
_statusText = lang(lng_settings_uploading_photo);
|
||||
_statusTextIsOnline = false;
|
||||
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()));
|
||||
_cancelPhotoUpload->show();
|
||||
_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) {
|
||||
auto &buttonStyle = _buttons.isEmpty() ? st::profilePrimaryButton : st::profileSecondaryButton;
|
||||
auto button = new Ui::RoundButton(this, text, buttonStyle);
|
||||
button->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
|
||||
connect(button, SIGNAL(clicked()), this, slot);
|
||||
button->show();
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "ui/filedialog.h"
|
||||
|
||||
class FlatLabel;
|
||||
class LinkButton;
|
||||
|
||||
namespace Ui {
|
||||
class RoundButton;
|
||||
class LinkButton;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Notify {
|
||||
|
@ -118,7 +118,7 @@ private:
|
|||
ChildWidget<CoverDropArea> _dropArea = { nullptr };
|
||||
|
||||
ChildWidget<FlatLabel> _name;
|
||||
ChildWidget<LinkButton> _cancelPhotoUpload = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _cancelPhotoUpload = { nullptr };
|
||||
|
||||
QPoint _statusPosition;
|
||||
QString _statusText;
|
||||
|
|
|
@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "styles/style_profile.h"
|
||||
#include "styles/style_window.h"
|
||||
#include "ui/buttons/round_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "lang.h"
|
||||
#include "mainwidget.h"
|
||||
#include "boxes/addcontactbox.h"
|
||||
|
@ -33,9 +33,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Profile {
|
||||
|
||||
class BackButton final : public Button, private base::Subscriber {
|
||||
class BackButton final : public Ui::AbstractButton, private base::Subscriber {
|
||||
public:
|
||||
BackButton(QWidget *parent) : Button(parent) {
|
||||
BackButton(QWidget *parent) : Ui::AbstractButton(parent) {
|
||||
setCursor(style::cur_pointer);
|
||||
|
||||
subscribe(Adaptive::Changed(), [this] { updateAdaptiveLayout(); });
|
||||
|
@ -58,8 +58,8 @@ protected:
|
|||
|
||||
Window::TopBarWidget::paintUnreadCounter(p, width());
|
||||
}
|
||||
void onStateChanged(int oldState, ButtonStateChangeSource source) override {
|
||||
if ((_state & Button::StateDown) && !(oldState & Button::StateDown)) {
|
||||
void onStateChanged(int oldState, StateChangeSource source) override {
|
||||
if ((_state & StateDown) && !(oldState & StateDown)) {
|
||||
emit clicked();
|
||||
}
|
||||
}
|
||||
|
@ -186,6 +186,7 @@ void FixedBar::addRightAction(RightActionType type, const QString &text, const c
|
|||
_rightActions[_currentAction].type = type;
|
||||
delete _rightActions[_currentAction].button;
|
||||
_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);
|
||||
bool showButton = !_animatingMode && (type != RightActionType::ShareContact || !_hideShareContactButton);
|
||||
_rightActions[_currentAction].button->setVisible(showButton);
|
||||
|
|
|
@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "styles/style_profile.h"
|
||||
#include "ui/buttons/left_outline_button.h"
|
||||
#include "ui/buttons/checkbox.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "boxes/confirmbox.h"
|
||||
#include "boxes/contactsbox.h"
|
||||
#include "observer_peer.h"
|
||||
|
|
|
@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
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);
|
||||
|
||||
processPeerPhoto();
|
||||
|
|
|
@ -20,6 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/abstract_button.h"
|
||||
#include "core/observer.h"
|
||||
|
||||
namespace Notify {
|
||||
|
@ -28,7 +29,7 @@ struct PeerUpdate;
|
|||
|
||||
namespace Profile {
|
||||
|
||||
class UserpicButton final : public Button, private base::Subscriber {
|
||||
class UserpicButton : public Ui::AbstractButton, private base::Subscriber {
|
||||
public:
|
||||
UserpicButton(QWidget *parent, PeerData *peer);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "boxes/aboutbox.h"
|
||||
#include "boxes/localstoragebox.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
||||
namespace Settings {
|
||||
|
||||
|
|
|
@ -49,14 +49,14 @@ private:
|
|||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
void supportGot(const MTPhelp_Support &support);
|
||||
|
||||
ChildWidget<LinkButton> _manageLocalStorage = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _manageLocalStorage = { nullptr };
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
ChildWidget<LabeledLink> _connectionType = { nullptr };
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
ChildWidget<LinkButton> _askQuestion = { nullptr };
|
||||
ChildWidget<LinkButton> _telegramFAQ = { nullptr };
|
||||
ChildWidget<LinkButton> _about = { nullptr };
|
||||
ChildWidget<LinkButton> _logOut = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _askQuestion = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _telegramFAQ = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _about = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _logOut = { nullptr };
|
||||
|
||||
mtpRequestId _supportGetRequest = 0;
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "mainwidget.h"
|
||||
#include "boxes/backgroundbox.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 "mainwindow.h"
|
||||
#include "window/window_theme.h"
|
||||
|
@ -34,8 +35,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
namespace Settings {
|
||||
|
||||
BackgroundRow::BackgroundRow(QWidget *parent) : TWidget(parent)
|
||||
, _chooseFromGallery(this, lang(lng_settings_bg_from_gallery), st::defaultBoxLinkButton)
|
||||
, _chooseFromFile(this, lang(lng_settings_bg_from_file), st::defaultBoxLinkButton)
|
||||
, _chooseFromGallery(this, lang(lng_settings_bg_from_gallery), st::boxLinkButton)
|
||||
, _chooseFromFile(this, lang(lng_settings_bg_from_file), st::boxLinkButton)
|
||||
, _radial(animation(this, &BackgroundRow::step_radial)) {
|
||||
updateImage();
|
||||
|
||||
|
|
|
@ -24,14 +24,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "ui/effects/radial_animation.h"
|
||||
#include "ui/filedialog.h"
|
||||
|
||||
class LinkButton;
|
||||
|
||||
namespace Ui {
|
||||
class Checkbox;
|
||||
template <typename Widget>
|
||||
class WidgetSlideWrap;
|
||||
} // namespace Ui;
|
||||
|
||||
namespace Settings {
|
||||
|
||||
class BackgroundRow : public TWidget {
|
||||
|
@ -60,8 +52,8 @@ private:
|
|||
void step_radial(uint64 ms, bool timer);
|
||||
|
||||
QPixmap _background;
|
||||
ChildWidget<LinkButton> _chooseFromGallery;
|
||||
ChildWidget<LinkButton> _chooseFromFile;
|
||||
ChildWidget<Ui::LinkButton> _chooseFromGallery;
|
||||
ChildWidget<Ui::LinkButton> _chooseFromFile;
|
||||
|
||||
Ui::RadialAnimation _radial;
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "settings/settings_block_widget.h"
|
||||
|
||||
#include "styles/style_settings.h"
|
||||
#include "ui/buttons/checkbox.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
||||
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) {
|
||||
child = new Ui::Checkbox(this, text, checked, st::defaultBoxCheckbox);
|
||||
child.create(this, text, checked, st::defaultBoxCheckbox);
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
void BlockWidget::createChildRow(ChildWidget<LinkButton> &child, style::margins &margin, const QString &text, const char *slot, const style::linkButton &st) {
|
||||
child = new LinkButton(this, text, st);
|
||||
void BlockWidget::createChildRow(ChildWidget<Ui::LinkButton> &child, style::margins &margin, const QString &text, const char *slot, const style::LinkButton &st) {
|
||||
child .create(this, text, st);
|
||||
connect(child, SIGNAL(clicked()), this, slot);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,10 +21,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#pragma once
|
||||
|
||||
#include "core/observer.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace Ui {
|
||||
class Checkbox;
|
||||
class Radiobutton;
|
||||
class LinkButton;
|
||||
template <typename Widget>
|
||||
class WidgetSlideWrap;
|
||||
} // 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::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 rowHeightUpdated();
|
||||
|
@ -107,7 +109,7 @@ private:
|
|||
!IsWidgetSlideWrap<Widget>::value &&
|
||||
!std_::is_same<Widget, Ui::Checkbox>::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>>
|
||||
void createChildRow(ChildWidget<Widget> &child, style::margins &margin, Args&&... args) {
|
||||
|
|
|
@ -24,7 +24,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "styles/style_settings.h"
|
||||
#include "lang.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 "localstorage.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)
|
||||
, _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);
|
||||
}
|
||||
|
||||
void LabeledLink::setLink(const QString &text) {
|
||||
_link.destroy();
|
||||
_link = new LinkButton(this, text);
|
||||
_link.create(this, text);
|
||||
}
|
||||
|
||||
int LabeledLink::naturalWidth() const {
|
||||
|
@ -159,7 +159,7 @@ void ChatSettingsWidget::createControls() {
|
|||
|
||||
addChildRow(_replaceEmoji, marginSub, lang(lng_settings_replace_emojis), SLOT(onReplaceEmoji()), cReplaceEmojis());
|
||||
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()) {
|
||||
_viewList->hideFast();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
void setLink(const QString &text);
|
||||
|
||||
LinkButton *link() {
|
||||
Ui::LinkButton *link() {
|
||||
return _link;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ protected:
|
|||
|
||||
private:
|
||||
ChildWidget<FlatLabel> _label;
|
||||
ChildWidget<LinkButton> _link;
|
||||
ChildWidget<Ui::LinkButton> _link;
|
||||
|
||||
};
|
||||
|
||||
|
@ -83,7 +83,7 @@ private:
|
|||
State _state = State::Empty;
|
||||
|
||||
ChildWidget<LabeledLink> _path;
|
||||
ChildWidget<LinkButton> _clear;
|
||||
ChildWidget<Ui::LinkButton> _clear;
|
||||
|
||||
};
|
||||
|
||||
|
@ -106,13 +106,13 @@ private:
|
|||
void createControls();
|
||||
|
||||
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::WidgetSlideWrap<DownloadPathState>> _downloadPath = { nullptr };
|
||||
ChildWidget<Ui::Radiobutton> _sendByEnter = { nullptr };
|
||||
ChildWidget<Ui::Radiobutton> _sendByCtrlEnter = { nullptr };
|
||||
ChildWidget<LinkButton> _automaticMediaDownloadSettings = { nullptr };
|
||||
ChildWidget<LinkButton> _manageStickerSets = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _automaticMediaDownloadSettings = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _manageStickerSets = { nullptr };
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "settings/settings_cover.h"
|
||||
|
||||
#include "ui/flatlabel.h"
|
||||
#include "ui/buttons/round_button.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "observer_peer.h"
|
||||
#include "lang.h"
|
||||
#include "application.h"
|
||||
|
@ -50,9 +49,7 @@ CoverWidget::CoverWidget(QWidget *parent, UserData *self) : BlockWidget(parent,
|
|||
_name->setSelectable(true);
|
||||
_name->setContextCopyText(lang(lng_profile_copy_fullname));
|
||||
|
||||
_setPhoto->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
|
||||
connect(_setPhoto, SIGNAL(clicked()), this, SLOT(onSetPhoto()));
|
||||
_editName->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
|
||||
connect(_editName, 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);
|
||||
_statusTextIsOnline = false;
|
||||
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()));
|
||||
_cancelPhotoUpload->show();
|
||||
_cancelPhotoUpload->moveToLeft(_statusPosition.x() + st::settingsStatusFont->width(_statusText) + st::settingsStatusFont->spacew, _statusPosition.y());
|
||||
|
|
|
@ -26,8 +26,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "settings/settings_block_widget.h"
|
||||
|
||||
class FlatLabel;
|
||||
class LinkButton;
|
||||
|
||||
namespace Ui {
|
||||
class RoundButton;
|
||||
class IconButton;
|
||||
|
@ -95,7 +93,7 @@ private:
|
|||
|
||||
ChildWidget<FlatLabel> _name;
|
||||
ChildWidget<Ui::IconButton> _editNameInline;
|
||||
ChildWidget<LinkButton> _cancelPhotoUpload = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _cancelPhotoUpload = { nullptr };
|
||||
|
||||
QPoint _statusPosition;
|
||||
QString _statusText;
|
||||
|
|
|
@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "styles/style_settings.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "mainwindow.h"
|
||||
#include "lang.h"
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "styles/style_settings.h"
|
||||
#include "lang.h"
|
||||
#include "ui/effects/widget_slide_wrap.h"
|
||||
#include "ui/flatbutton.h"
|
||||
#include "ui/buttons/checkbox.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "localstorage.h"
|
||||
#include "pspecific.h"
|
||||
#include "mainwindow.h"
|
||||
|
@ -168,7 +168,7 @@ void UpdateStateRow::onFailed() {
|
|||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
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()));
|
||||
subscribe(Global::RefChooseCustomLang(), [this]() { chooseCustomLang(); });
|
||||
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) {
|
||||
_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);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "settings/settings_block_widget.h"
|
||||
#include "ui/filedialog.h"
|
||||
|
||||
class LinkButton;
|
||||
|
||||
namespace Ui {
|
||||
class Checkbox;
|
||||
template <typename Widget>
|
||||
class WidgetSlideWrap;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Settings {
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
@ -73,8 +65,8 @@ private:
|
|||
void setState(State state, bool force = false);
|
||||
void setDownloadProgress(qint64 ready, qint64 total);
|
||||
|
||||
ChildWidget<LinkButton> _check;
|
||||
ChildWidget<LinkButton> _restart;
|
||||
ChildWidget<Ui::LinkButton> _check;
|
||||
ChildWidget<Ui::LinkButton> _restart;
|
||||
|
||||
State _state = State::None;
|
||||
QString _downloadText;
|
||||
|
@ -114,7 +106,7 @@ private:
|
|||
void chooseCustomLang();
|
||||
void notifyFileQueryUpdated(const FileDialog::QueryUpdate &update);
|
||||
|
||||
ChildWidget<LinkButton> _changeLanguage;
|
||||
ChildWidget<Ui::LinkButton> _changeLanguage;
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
ChildWidget<Ui::Checkbox> _updateAutomatically = { nullptr };
|
||||
ChildWidget<Ui::WidgetSlideWrap<UpdateStateRow>> _updateRow = { nullptr };
|
||||
|
|
|
@ -25,7 +25,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "lang.h"
|
||||
#include "localstorage.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 "window/notifications_manager.h"
|
||||
#include "boxes/notifications_box.h"
|
||||
|
|
|
@ -51,7 +51,7 @@ private:
|
|||
ChildWidget<Ui::Checkbox> _nativeNotifications = { nullptr };
|
||||
ChildWidget<Ui::Checkbox> _playSound = { 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
Loading…
Add table
Reference in a new issue