From 494254496efe6ed68c2570e1739f5adc6d6e3b17 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 8 Nov 2016 17:43:10 +0300 Subject: [PATCH] 10019003: Some compose area icons improved. Box headers redesigned. --- Telegram/Resources/basic.style | 9 ++- Telegram/Resources/colors.palette | 14 ++-- Telegram/Resources/icons/box_title_shadow.png | Bin 85 -> 85 bytes .../Resources/icons/box_title_shadow@2x.png | Bin 105 -> 107 bytes Telegram/Resources/icons/dropdown_shadow.png | Bin 128 -> 168 bytes .../Resources/icons/dropdown_shadow@2x.png | Bin 146 -> 240 bytes .../Resources/icons/send_control_save.png | Bin 0 -> 358 bytes .../Resources/icons/send_control_save@2x.png | Bin 0 -> 687 bytes .../icons/send_control_silent_off.png | Bin 518 -> 378 bytes .../icons/send_control_silent_off@2x.png | Bin 1029 -> 660 bytes .../icons/send_control_silent_on.png | Bin 685 -> 572 bytes .../icons/send_control_silent_on@2x.png | Bin 1487 -> 1051 bytes Telegram/Resources/sample.tdesktop-theme | 12 +-- Telegram/Resources/winrc/Telegram.rc | 8 +- Telegram/Resources/winrc/Updater.rc | 8 +- Telegram/SourceFiles/boxes/aboutbox.cpp | 12 ++- Telegram/SourceFiles/boxes/abstractbox.cpp | 72 ++++++++++-------- Telegram/SourceFiles/boxes/abstractbox.h | 33 ++++---- Telegram/SourceFiles/boxes/addcontactbox.cpp | 34 ++++----- Telegram/SourceFiles/boxes/autolockbox.cpp | 11 ++- Telegram/SourceFiles/boxes/backgroundbox.cpp | 4 +- Telegram/SourceFiles/boxes/boxes.style | 32 ++++---- Telegram/SourceFiles/boxes/confirmbox.cpp | 8 +- .../SourceFiles/boxes/confirmphonebox.cpp | 6 +- Telegram/SourceFiles/boxes/connectionbox.cpp | 17 ++--- Telegram/SourceFiles/boxes/contactsbox.cpp | 6 +- .../SourceFiles/boxes/downloadpathbox.cpp | 4 +- Telegram/SourceFiles/boxes/emojibox.cpp | 10 +-- Telegram/SourceFiles/boxes/languagebox.cpp | 4 +- .../SourceFiles/boxes/localstoragebox.cpp | 8 +- Telegram/SourceFiles/boxes/passcodebox.cpp | 16 ++-- Telegram/SourceFiles/boxes/report_box.cpp | 4 +- Telegram/SourceFiles/boxes/sessionsbox.cpp | 4 +- Telegram/SourceFiles/boxes/sharebox.cpp | 4 +- Telegram/SourceFiles/boxes/stickers_box.cpp | 8 +- Telegram/SourceFiles/boxes/stickersetbox.cpp | 4 +- Telegram/SourceFiles/boxes/usernamebox.cpp | 6 +- Telegram/SourceFiles/core/version.h | 2 +- Telegram/SourceFiles/history/history.style | 13 ++-- Telegram/SourceFiles/historywidget.cpp | 14 ++-- Telegram/SourceFiles/historywidget.h | 7 +- Telegram/SourceFiles/mainwindow.cpp | 1 + .../media/player/media_player.style | 2 +- Telegram/SourceFiles/settings/settings.style | 11 +-- .../settings/settings_fixed_bar.cpp | 2 +- .../SourceFiles/settings/settings_fixed_bar.h | 4 +- .../SourceFiles/settings/settings_widget.cpp | 9 +-- .../SourceFiles/settings/settings_widget.h | 4 +- .../SourceFiles/ui/buttons/icon_button.cpp | 3 + Telegram/SourceFiles/ui/countryinput.cpp | 6 +- .../SourceFiles/ui/widgets/multi_select.h | 4 +- Telegram/SourceFiles/ui/widgets/widgets.style | 7 +- Telegram/build/version | 2 +- 53 files changed, 223 insertions(+), 226 deletions(-) create mode 100644 Telegram/Resources/icons/send_control_save.png create mode 100644 Telegram/Resources/icons/send_control_save@2x.png diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index 58331cba58..7957db994a 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -1061,9 +1061,12 @@ infoButton: PeerAvatarButton { profileTopBarBackIconFg: #0290d7; profileTopBarBackIcon: icon {{ "title_back", profileTopBarBackIconFg }}; -historyReplyCancelIcon: icon {{ "box_button_close-invert", historyReplyBg }}; -boxSearchCancelIcon: icon {{ "box_button_close-invert", boxSearchBg }}; -settingsFixedBarCloseIcon: icon {{ "box_button_close-invert", settingsFixedBarBg }}; +historyReplyCancelIcon: icon {{ "box_button_close", historyReplyCancelFg }}; +historyReplyCancelIconOver: icon {{ "box_button_close", historyReplyCancelFgOver }}; +boxSearchCancelIcon: icon {{ "box_button_close", boxSearchCancelIconFg }}; +boxSearchCancelIconOver: icon {{ "box_button_close", boxSearchCancelIconFgOver }}; +boxBlockTitleCloseIcon: icon {{ "box_button_close", boxBlockTitleCloseFg }}; +boxBlockTitleCloseIconOver: icon {{ "box_button_close", boxBlockTitleCloseFgOver }}; notifyFadeRight: icon {{ "fade_horizontal", notificationBg }}; diff --git a/Telegram/Resources/colors.palette b/Telegram/Resources/colors.palette index c102bf3ef1..41f036e6bd 100644 --- a/Telegram/Resources/colors.palette +++ b/Telegram/Resources/colors.palette @@ -81,6 +81,12 @@ boxSearchBg: boxBg; boxSearchCancelIconFg: cancelIconFg; boxSearchCancelIconFgOver: cancelIconFgOver; +boxBlockTitleBg: boxBg; +boxBlockTitleFg: boxTitleFg; +boxBlockTitleAdditionalFg: #808080; +boxBlockTitleCloseFg: cancelIconFg; +boxBlockTitleCloseFgOver: cancelIconFgOver; + membersAboutLimitFg: windowSubTextFg; contactsBg: windowBg; @@ -91,10 +97,6 @@ photoCropFadeBg: #0000007f; photoCropPointFg: #ffffff7f; // settings -settingsFixedBarBg: boxBg; -settingsCloseFg: cancelIconFg; -settingsCloseFgOver: cancelIconFgOver; - notificationsBoxMonitorFg: windowTextFg; notificationSampleUserpicFg: windowActiveBg; @@ -173,8 +175,8 @@ historySendIconFg: windowActiveBg; historySendIconFgOver: windowActiveBg; historyPinnedBg: historyComposeAreaBg; historyReplyBg: historyComposeAreaBg; -historyReplyCancelIconFg: cancelIconFg; -historyReplyCancelIconFgOver: cancelIconFgOver; +historyReplyCancelFg: cancelIconFg; +historyReplyCancelFgOver: cancelIconFgOver; historyComposeButtonBg: historyComposeAreaBg; historyComposeButtonBgOver: #f5f5f5; diff --git a/Telegram/Resources/icons/box_title_shadow.png b/Telegram/Resources/icons/box_title_shadow.png index bba09b240d712d5e50cb65048156956e074db473..90ae5c049ebd7a4c9aa0a8707d07c3de693b0654 100644 GIT binary patch delta 46 zcmWFyouH!`5ES(5{Fi@!tJ&Dh%(ngK0fPUG&JJv@k9WGoF#v(5tDnm{r-UW|xc3nh delta 46 zcmWFyouH#BAS(Lz{DGrKzs_%*IrFDIGc)tydIk+WmSlrF-QO61z|+;wWt~$(69B~P B5#|5@ diff --git a/Telegram/Resources/icons/box_title_shadow@2x.png b/Telegram/Resources/icons/box_title_shadow@2x.png index 7d97eb59e7aaaa5ac8b018389343a449f9fcb6ae..bf3dee4cda57d90fab0a60282ba8cd78a2236207 100644 GIT binary patch delta 76 zcmd1Io}l7xW`-W`5$wnDZnbgzi*XP#P_%j-|p$({abX7 gapFwo#>Owd8MeCe>%Dty%f|o&p00i_>zopr0NipQCIA2c delta 74 zcmd1KoS@=r;OXKR!Z9=U)J9$gLkf4<$Jm~hDc29oe;=%*nr15Rnv^^ z`M>3-V{ff*DZ6=%>yKiE*fib)jpAA1$!Xck?mJ8}F!pFtnIY+M@8HZ!QO+(0?kZ;L z-gofq;P`ScF!aQkse2mV^{qN2k*vMBZ$?2{UG7=Vi7cKTzj*8RJs145T=>FwR_&WT S?=*l`GkCiCxvXun_z~gjqxx}WQ z-|Z9hF6ntOx9$>R3p{YtpGkq!^Txe>6Ixa&ac+~};2T@@z8+<3( a?q^hJV(FWHr7;I+B!j1`pUXO@geCw`L@IRv diff --git a/Telegram/Resources/icons/dropdown_shadow@2x.png b/Telegram/Resources/icons/dropdown_shadow@2x.png index 1931c7b11f2dd9ca5696bf63775026d9f503f2e8..c44d45270a6b7b788d369388af7aa7149bab2f69 100644 GIT binary patch literal 240 zcmV^-_)k!%{J6$3$#_BpXt5xM1H@$G}EdJa_82RJ)m3i=lew7s}4 z!3fz3Kma@vNAwTO5?Gf~1i-)}yiDlZ5RxOM?JdFV&H#*LB&C!xO*$PpV%D|R6pbm< zkv&FINJ{TrdhgO&8}M}GcyAsx?7FUac3Q~NS$ptpA=`{&x7PMRKWgD5IW7C(T-h({XUb5;>%Cj3%>VtG~BHEDAvKT<(k4v uNd->hW|bZKqSr5NHY%R+|G%@O1>-L+mf8u^9oGOYVeoYIb6Mw<&;$TcP%&fx diff --git a/Telegram/Resources/icons/send_control_save.png b/Telegram/Resources/icons/send_control_save.png new file mode 100644 index 0000000000000000000000000000000000000000..199ab2b0c0f84399f1a7c9728b21680f71bcb55f GIT binary patch literal 358 zcmV-s0h#`ZP)18992;)RW^oi6BhaW+lbb(*e_*rt2WS+Ei481f8pjI7%|M}Gu}C5i+-&a+ zcYeEGotMkEo$Z|Oeb2MA^L~smhQ4dHT4B50LKH=?zL3pkgGWVC)DPr&9zpK+JC@7k z|3HJm06`ECvMi(i`Fw`1>z}@W!8A=&RYjMs*DH#mpmSN4n9XK?1@gU7RTZ3b{I1jK zgz0qJCE4eQecvZYp68fMCSB+3wduMp(lo_rH0nI8Uk=KYxtuMPF#rGn07*qoM6N<$ EfyU#HSO|%OHYh?M4lYd&4i3?rTS!AwG&zW~HQgcHLKnf0AQBw3 z%?7omB1%L98!qG!<^4CvTfXH{%bOiIaKHW!zx#2{Jw!zKtG=W%Rc~p#YsuH+|6F-X2)(|z#R!6cQmMqmAGcyrpetsV1a+!(AWHQibG^6VDHmp`FZf|c92n2qFF&d4yyu4&$lF8)fe-<0G zxVVUVy$%47Wf|dc7#zoqjWL-_xW2w-V&d^Qc%C1xo*)RQR4QMJq*AF-?;1pem6a9T z-Q6)UhlhvXx;e^bv&>@EY87U)nHjd(Y-l!{%zQK&{T_x0w6?Z}hldAd(RRBHuh;t} z=yW>KZnv4a{r&x)4i3Wd@-k|*8ngJz%L}%*x8Fl>>2wC3?{>Qg27{AeK0rjhc}Nt+p{QX`adUHXQq2FLe|>j%7u{}m zY|QiXGyHzP5}3gtB7)!V$J5i(NKB{G!TS2TQW!Rfh~RKI&}cN67)g@g@pzQP3l002ovPDHLkV1oQyMrQy3 literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/send_control_silent_off.png b/Telegram/Resources/icons/send_control_silent_off.png index fd0a88d5ff223b8c99e4f318ca6542b63a8af011..8e25352d736fc04a8e85e19f547e25a874769b48 100644 GIT binary patch literal 378 zcmV-=0fqjFP)aDUkpRqbI2^no&RO$}D2mXwEyi)g^?F4VMP7M-=ZTi; Y0rVMdBpSFzD*ylh07*qoM6N<$f|Nt<8 literal 518 zcmV+h0{Q)kP)~#3^?Hyb3CH6R0MO}l9N&HFXEKw?004%=q2r@&w+jHs=kxxd?RFag+&TdO3PE8s)A zu0z*#Fbo4C0z*VtEEbf_W@$Q|(r7dyj^ke2{w?Zs#dFH7zV}T@elVUNrGir z_)A*^{I zwOXy7IxBUliviWU(;89hfmK~G`OBLrf!ZW}G67UH5JY9GBp5J4eniwHV* zaS5(X^4FTt8~DLlgv|NQZ)Tj1${>UQeX)LpUBIV`0KyhE0G{WOs;cO6xgguNk)kMw z=Xok#KqC}IfoJu4JsMtg0M6$#24I>daUbSEL0SN>(=rT0)aN%sNG6%EP$-~wyN&Ag z`pfGK!=U5whz^GXF;5~(DM=D677J|KxM?<9{~izo0s8&E=fa<*C<<^K7Y;xw zm4fwp{dVyWEtgA3CX>Me2!a5s)e0--e!qjJY0zvoK@>$`Sr%fk7^Kr_Xti1}nM_E#9+bX* z1*ibnwv7PbWmuL))Qbv$VHmF0bX_OzN9@n&5xHCrOw+`U!_(;m*=&}yA9;WW#CSXg u%d)_-EEtVOG>WJ9kuNAkr%>4XdVoKp0W-LW36?Pc0000|J6vodyMbgQknxrX65GsUdV+n3VkZ4z%5Q4Tr+pM+QqK%ut7STG|v`BK3LJ%bc zEs7EbLo9rj*AH}IVSyBi$Ky4x%Ixec@o#Q! z)( zb#+B+d#96=6B1jkR%#zLs3b|X5q+Z9*Vn(rf6>1fsqZux47Cw`qH@rNh6ZXMHK^Ha zCUK!qpe|6U`}=zmcXoDC`=~+N+uKQ;PN%60RO;^Tj>Li>Q2VGs`}+Dwe0Fw5U7%98 zx3?s2X=$PMQG=FmQ$C-kE>NlC<6{y#oz9xPRDG=cq~!5o z6BC+O)a7!Ke4;4ov-KvENpX;{*=(9Y0RS&9E=bOvo*wO69|#11Wmy0Kh(@EDp7?UD zuC9`JYHEtg^W{vk*({m4*Xz|~H30xSIyw{wX^JD?=NCsuM@gb=Hme(?JfhJk$sZ1f z)qxs~M$G5)BvBv`&>gh9yIZlUZEbC}gDx#Ckp%nu`?^EQBNB;_I=j2OwSoG4KE+IX zdwc5!%CfAY*38Td9jL?Mz?YX7Vw{_ss~e;|Mn*;yutP&bUxPL`H)AfBBZi%wow`HH zqx=`HBuVIUxjqJUI-NfTDUY?aH3h8S? zt?G6a3I*zSKgV&<+S*$6K7+vkrBX@p`yT+{9cV2wnM@!ELe)tz3CtEPY1ZT8;~0y@ zP!vT>r_-27Brq5ZBEvAck}@P)L}-GT`csw2|FVd6w8%6%Bh^i0y@Csj;PnInJ0000< KMNUMnLSTXjRsXaA literal 685 zcmV;e0#f~nP)dXv)*Vk97tE&qpg~MS0Ha0fOLnSdZGz7rc*BABm z^+j9sJdfk!=xEVZibkV&p2x?>2h-Ej0L;zJ6^7Q;)nR5_TwD|d=KJO4W$>YRo<}qq{RzFk zzQ)X`t*xyHn%_Ra)zwv?hb8Is^i=Kb?K(I((BR;p+S=OW`@V{q<2Z6%SCf;IIzKGShbO-)T|Zf@4|^RvR?uzcTFV`HOS*OlwK>gedu-QAtu-rm&O+N#^zTg}eS>c>ju zdngnll}Z8N`#u0qPfs|GQ}BEw63N9%zl?Z1&dbXSW=1xfE%gumTTHI~|7pJg6tt^= Tk_K-Y00000NkvXXu0mjfPZ3b2 diff --git a/Telegram/Resources/icons/send_control_silent_on@2x.png b/Telegram/Resources/icons/send_control_silent_on@2x.png index 58a7460a484eecf25f6a5f51172c8bf9b3c3ad09..810b0947009cfc2096dafdffdd312cc9f05bee93 100644 GIT binary patch literal 1051 zcmV+$1mydPP)?ue0go#y`~;DxC{1Zul+phclO@rEI1qyfqrl_)VhFj;~zk+ zLofh|L_&7Eos!8UB@zj;*=!_{NCfeM5W{A(;d5B6Rw2BE0eF3VWdP#wc*T9V97UxA zC@jlyTt$5viD9C~_s{+OfF>2Q60 z%^aJr;_~tm)6>({xdS^pJBUOg&}y{>=O-p6kV>VBF8=>vv)LdPi-iMNU0wapER{-O zVPTr?xBoZkJ!sqirCX-bjptrXd>2x~J?BnAD8yg!1^OZ^^?(gq$a&m&j#YHF- z3N$x2LnIPmaBvVyOG`LCJ^d0wB9T;n2j=JJ!Sg(0Xti3=*x1PAH#If=)pT-l62V}Q z(X`v`!rX!J@o|JgA;$3d_!v^Dw4|+i^w5uvZI4|jKWjN$F=ExNnA zONRKo6IWMP!T=Bv+S}XV^Z6Kvr>7^3jEs~7F*P;C=#7q!3Ijky*xue|41wQm!ra_k zNf2jeXL(v%TU){bTwGif1OR}yw>PY;tb7~5WHROHcsw5A0G^+p^UOZKW^+%F@1?uCZ&^eSIC7OeQZklgYqrHW$oSC=_{L<(dN!5exj!{{pjN994u_d_E|&{!ZEZ}xNF;*O>8u|BBErDH00Mykv-alZreGuZ zosVEu0Eh@OnG9~Xn_2((_=w@*;cwMY6M)?Da5x-{Ml2SCUazlzfZXx0SS-k9vw1q{ zbQ;Uc%fbR|Zf=$hkQ*kGiD?A0*(@v;i!gVfQ1Rse5E1lxJz}vKqv>!sif#mp0{E(U zA;ax!0GlSu%8-|t6jYisoY3U#2l;Ca4i9gRkV^Ye3bc6R>V;SIhc!>((I}jbeCs7@<%IFJ8PTv@0+l-Me=$ zCnhFnR6cz8z~<)Wy!!e}S62FbK3=$RA*0ikD_7FOsH)0%JkG_%MJ_EZrM2<<{lx+G z`Ft{HI#{pQtLu1vex6-jU97FGrNv^Q*=(lSY-U+m8J$iiJ3Bi$IXS8G@%em(g9d{^ z8Bhqpd-v|iwq3h+Q3xU1A3S(qxTB7a4xR7e!-or>`ktO1-3UB=`jh~8?bdExx%^TS5c8raUK~WR{fXn5=)vH(Y0u@3)Q52BGnl)>R2MPemWD<3Cbr={J zkg&II-Gblm&l&Xl_wN7zMNzPJt?`2~r?dXlsZ+Rn_pbc*csv*!9LyyImY0`hxxBpG zuwTxXlFOGb@4hdyCMHrEGElEU89V z%gZ2%ii!%nd-o3Y_4TX9nVFf9<%)_5!=Qk{^w8hmPm-*usgZSCwrt_l)RgYTX>D!I z8pr8$O54%V(clH=O9RwtKR--$0Iv?^5lupzn(Umjc?z+)xoy4 zwaNB7ckamg)H`q9pi@&*GGI$fi(ybrQ*TQo+0)ZQ0Nl21n;g+ZBEe0YHsuehZ6cC< z`SNAXkeYUPck5uaOLOW4y}P?RKhX8-*K>Y;UIsdO@?_qi0C@iVd6_v#a%5zL)z#IE z#bUCLojZ5t4w^a&Iqb}=+Su4AZ}>t827^J4jEqS5p`oGNKwDZ`bW^o||Nf$Y0$^oj zB^MVL<@!`rRrVu{2DxLH7>(`40sj10iVmKVu0j8FlnwqkMTCG;j&dy4w z;o;$;L#Aq9Utd~SRaLof-@f#q4u?Z7Y#{_ECMNz-NKHFCJ6C{e;&!{Goubi>j*i0R zasdEHA`*$<)vH&itgMvJhg1#xhx{f0-oAZ139r|S6`;9@!{I<# zSsA{3`I7OCP7-Fb8B0q``1tXo;n;q^A0Cefmo8nx{rmTS#mZNYA3wh863`?|BF~s> z-EMd4Yof69^7!%NRo8SR5-CP1D?Aqt4i097j7FohSSrect()); - st::boxBlueTitleShadow.fill(p, QRect(r.left(), 0, r.width(), height())); -} AbstractBox::AbstractBox(int w) : LayerWidget(App::wnd()->bodyWidget()) { setAttribute(Qt::WA_OpaquePaintEvent); - resize(w, 0); + resize((w > 0) ? w : st::boxWideWidth, 0); } void AbstractBox::prepare() { + raiseShadow(); showAll(); } @@ -53,12 +47,11 @@ void AbstractBox::keyPressEvent(QKeyEvent *e) { } void AbstractBox::resizeEvent(QResizeEvent *e) { - if (_blueClose) { - _blueClose->moveToRight(0, 0); + if (_blockClose) { + _blockClose->moveToRight(0, 0); } - if (_blueShadow) { - _blueShadow->moveToLeft(0, st::boxTitleHeight); - _blueShadow->resize(width(), st::boxBlueTitleShadow.height()); + if (_blockShadow) { + _blockShadow->setGeometry(0, st::boxBlockTitleHeight, width(), st::boxBlockTitleShadow.height()); } LayerWidget::resizeEvent(e); } @@ -75,21 +68,27 @@ bool AbstractBox::paint(QPainter &p) { return false; } -void AbstractBox::paintTitle(Painter &p, const QString &title, const QString &additional) { - p.setFont(st::boxTitleFont); - if (_blueTitle) { - p.fillRect(0, 0, width(), st::boxTitleHeight, st::boxBlueTitleBg); - p.setPen(st::boxBlueTitleFg); +int AbstractBox::titleHeight() const { + return _blockTitle ? st::boxBlockTitleHeight : st::boxTitleHeight; +} - int32 titleWidth = st::boxTitleFont->width(title); - p.drawTextLeft(st::boxBlueTitlePosition.x(), st::boxBlueTitlePosition.y(), width(), title, titleWidth); +void AbstractBox::paintTitle(Painter &p, const QString &title, const QString &additional) { + if (_blockTitle) { + p.fillRect(0, 0, width(), titleHeight(), st::boxBlockTitleBg); + + p.setFont(st::boxBlockTitleFont); + p.setPen(st::boxBlockTitleFg); + + auto titleWidth = st::boxBlockTitleFont->width(title); + p.drawTextLeft(st::boxBlockTitlePosition.x(), st::boxBlockTitlePosition.y(), width(), title, titleWidth); if (!additional.isEmpty()) { - p.setFont(st::boxTextFont); - p.setPen(st::boxBlueTitleAdditionalFg); - p.drawTextLeft(st::boxBlueTitlePosition.x() + titleWidth + st::boxBlueTitleAdditionalSkip, st::boxBlueTitlePosition.y(), width(), additional); + p.setFont(st::boxBlockTitleAdditionalFont); + p.setPen(st::boxBlockTitleAdditionalFg); + p.drawTextLeft(st::boxBlockTitlePosition.x() + titleWidth + st::boxBlockTitleAdditionalSkip, st::boxBlockTitlePosition.y(), width(), additional); } } else { + p.setFont(st::boxTitleFont); p.setPen(st::boxTitleFg); p.drawTextLeft(st::boxTitlePosition.x(), st::boxTitlePosition.y(), width(), title); } @@ -135,24 +134,27 @@ void AbstractBox::onClose() { emit closed(this); } -void AbstractBox::setBlueTitle(bool blue) { - _blueTitle = blue; - _blueShadow.create(this); - _blueClose.create(this, st::boxBlueClose); - _blueClose->setClickedCallback([this] { onClose(); }); +void AbstractBox::setBlockTitle(bool block) { + _blockTitle = block; + _blockShadow.create(this, st::boxBlockTitleShadow); + _blockClose.create(this, st::boxBlockTitleClose); + _blockClose->setClickedCallback([this] { onClose(); }); } void AbstractBox::raiseShadow() { - if (_blueShadow) { - _blueShadow->raise(); + if (_blockShadow) { + _blockShadow->raise(); } } +ScrollableBoxShadow::ScrollableBoxShadow(QWidget *parent) : Ui::PlainShadow(parent, st::boxScrollShadowBg) { +} + ScrollableBox::ScrollableBox(const style::flatScroll &scroll, int32 w) : AbstractBox(w) , _scroll(this, scroll) -, _topSkip(st::boxTitleHeight) +, _topSkip(st::boxBlockTitleHeight) , _bottomSkip(st::boxScrollSkip) { - setBlueTitle(true); + setBlockTitle(true); } void ScrollableBox::resizeEvent(QResizeEvent *e) { @@ -161,6 +163,8 @@ void ScrollableBox::resizeEvent(QResizeEvent *e) { } void ScrollableBox::init(TWidget *inner, int bottomSkip, int topSkip) { + if (bottomSkip < 0) bottomSkip = st::boxScrollSkip; + if (topSkip < 0) topSkip = st::boxBlockTitleHeight; _bottomSkip = bottomSkip; _topSkip = topSkip; _scroll->setOwnedWidget(inner); @@ -168,6 +172,8 @@ void ScrollableBox::init(TWidget *inner, int bottomSkip, int topSkip) { } void ScrollableBox::setScrollSkips(int bottomSkip, int topSkip) { + if (bottomSkip < 0) bottomSkip = st::boxScrollSkip; + if (topSkip < 0) topSkip = st::boxBlockTitleHeight; if (_topSkip != topSkip || _bottomSkip != bottomSkip) { _topSkip = topSkip; _bottomSkip = bottomSkip; diff --git a/Telegram/SourceFiles/boxes/abstractbox.h b/Telegram/SourceFiles/boxes/abstractbox.h index e140267c99..46733444f2 100644 --- a/Telegram/SourceFiles/boxes/abstractbox.h +++ b/Telegram/SourceFiles/boxes/abstractbox.h @@ -24,27 +24,21 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "ui/widgets/shadow.h" namespace Ui { -class MaskButton; +class IconButton; +class GradientShadow; } // namespace Ui -class BlueTitleShadow : public TWidget { -public: - BlueTitleShadow(QWidget *parent) : TWidget(parent) { - } - void paintEvent(QPaintEvent *e); -}; - class AbstractBox : public LayerWidget, protected base::Subscriber { Q_OBJECT public: - AbstractBox(int w = st::boxWideWidth); + AbstractBox(int w = 0); void parentResized() override; void showDone() override { showAll(); } - void setBlueTitle(bool blue); + void setBlockTitle(bool block); void raiseShadow(); public slots: @@ -57,6 +51,7 @@ protected: void prepare(); bool paint(QPainter &p); + int titleHeight() const; void paintTitle(Painter &p, const QString &title, const QString &additional = QString()); void setMaxHeight(int32 maxHeight); void resizeMaxHeight(int32 newWidth, int32 maxHeight); @@ -72,25 +67,25 @@ private: bool _closed = false; - bool _blueTitle = false; - ChildWidget _blueClose = { nullptr }; - ChildWidget _blueShadow = { nullptr }; + bool _blockTitle = false; + ChildWidget _blockClose = { nullptr }; + ChildWidget _blockShadow = { nullptr }; }; class ScrollableBoxShadow : public Ui::PlainShadow { public: - ScrollableBoxShadow(QWidget *parent) : Ui::PlainShadow(parent, st::boxScrollShadowBg) { - } + ScrollableBoxShadow(QWidget *parent); + }; class ScrollableBox : public AbstractBox { public: - ScrollableBox(const style::flatScroll &scroll, int w = st::boxWideWidth); + ScrollableBox(const style::flatScroll &scroll, int w = 0); protected: - void init(TWidget *inner, int bottomSkip = st::boxScrollSkip, int topSkip = st::boxTitleHeight); - void setScrollSkips(int bottomSkip = st::boxScrollSkip, int topSkip = st::boxTitleHeight); + void init(TWidget *inner, int bottomSkip = -1, int topSkip = -1); + void setScrollSkips(int bottomSkip = -1, int topSkip = -1); void resizeEvent(QResizeEvent *e) override; @@ -108,7 +103,7 @@ private: class ItemListBox : public ScrollableBox { public: - ItemListBox(const style::flatScroll &scroll, int32 w = st::boxWideWidth); + ItemListBox(const style::flatScroll &scroll, int32 w = 0); }; diff --git a/Telegram/SourceFiles/boxes/addcontactbox.cpp b/Telegram/SourceFiles/boxes/addcontactbox.cpp index 17bf2fea99..fedcb3376b 100644 --- a/Telegram/SourceFiles/boxes/addcontactbox.cpp +++ b/Telegram/SourceFiles/boxes/addcontactbox.cpp @@ -19,21 +19,21 @@ 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/addcontactbox.h" +#include "styles/style_boxes.h" +#include "styles/style_dialogs.h" +#include "lang.h" #include "application.h" -#include "addcontactbox.h" -#include "contactsbox.h" -#include "confirmbox.h" -#include "photocropbox.h" +#include "boxes/contactsbox.h" +#include "boxes/confirmbox.h" +#include "boxes/photocropbox.h" #include "ui/filedialog.h" #include "ui/buttons/checkbox.h" #include "mainwidget.h" #include "mainwindow.h" #include "apiwrap.h" #include "observer_peer.h" -#include "styles/style_boxes.h" -#include "styles/style_dialogs.h" AddContactBox::AddContactBox(QString fname, QString lname, QString phone) : AbstractBox(st::boxWidth) , _first(this, st::defaultInputField, lang(lng_signup_firstname), fname) @@ -73,7 +73,7 @@ void AddContactBox::initBox() { bool readyToAdd = !_phone->getLastText().isEmpty() && (!_first->getLastText().isEmpty() || !_last->getLastText().isEmpty()); _boxTitle = lang(readyToAdd ? lng_confirm_contact_data : lng_enter_contact_data); } - setMaxHeight(st::boxTitleHeight + st::contactPadding.top() + _first->height() + st::contactSkip + _last->height() + st::contactPhoneSkip + _phone->height() + st::contactPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _save->height() + st::boxButtonPadding.bottom()); + setMaxHeight(titleHeight() + st::contactPadding.top() + _first->height() + st::contactSkip + _last->height() + st::contactPhoneSkip + _phone->height() + st::contactPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _save->height() + st::boxButtonPadding.bottom()); _retry->hide(); connect(_save, SIGNAL(clicked()), this, SLOT(onSave())); @@ -115,8 +115,8 @@ void AddContactBox::paintEvent(QPaintEvent *e) { } else { p.setPen(st::boxTextFg); p.setFont(st::boxTextFont); - int32 h = height() - st::boxTitleHeight - st::contactPadding.top() - st::contactPadding.bottom() - st::boxPadding.bottom() - st::boxButtonPadding.top() - _retry->height() - st::boxButtonPadding.bottom(); - p.drawText(QRect(st::boxPadding.left(), st::boxTitleHeight + st::contactPadding.top(), width() - st::boxPadding.left() - st::boxPadding.right(), h), lng_contact_not_joined(lt_name, _sentName), style::al_topleft); + int32 h = height() - titleHeight() - st::contactPadding.top() - st::contactPadding.bottom() - st::boxPadding.bottom() - st::boxButtonPadding.top() - _retry->height() - st::boxButtonPadding.bottom(); + p.drawText(QRect(st::boxPadding.left(), titleHeight() + st::contactPadding.top(), width() - st::boxPadding.left() - st::boxPadding.right(), h), lng_contact_not_joined(lt_name, _sentName), style::al_topleft); } } @@ -125,11 +125,11 @@ void AddContactBox::resizeEvent(QResizeEvent *e) { _last->resize(_first->width(), _last->height()); _phone->resize(_first->width(), _last->height()); if (_invertOrder) { - _last->moveToLeft(st::boxPadding.left() + st::contactPadding.left(), st::boxTitleHeight + st::contactPadding.top()); + _last->moveToLeft(st::boxPadding.left() + st::contactPadding.left(), titleHeight() + st::contactPadding.top()); _first->moveToLeft(st::boxPadding.left() + st::contactPadding.left(), _last->y() + _last->height() + st::contactSkip); _phone->moveToLeft(st::boxPadding.left() + st::contactPadding.left(), _first->y() + _first->height() + st::contactPhoneSkip); } else { - _first->moveToLeft(st::boxPadding.left() + st::contactPadding.left(), st::boxTitleHeight + st::contactPadding.top()); + _first->moveToLeft(st::boxPadding.left() + st::contactPadding.left(), titleHeight() + st::contactPadding.top()); _last->moveToLeft(st::boxPadding.left() + st::contactPadding.left(), _first->y() + _first->height() + st::contactSkip); _phone->moveToLeft(st::boxPadding.left() + st::contactPadding.left(), _last->y() + _last->height() + st::contactPhoneSkip); } @@ -919,7 +919,7 @@ _invertOrder(!peer->isChat() && langFirstNameGoesSecond()) { _first->setMaxLength(MaxGroupChannelTitle); _last->setMaxLength(MaxGroupChannelTitle); - int32 h = st::boxTitleHeight + st::contactPadding.top() + _first->height(); + int32 h = titleHeight() + st::contactPadding.top() + _first->height(); if (_peer->isUser()) { _boxTitle = lang(_peer == App::self() ? lng_edit_self_title : lng_edit_contact_title); h += st::contactSkip + _last->height(); @@ -989,10 +989,10 @@ void EditNameTitleBox::resizeEvent(QResizeEvent *e) { _first->resize(width() - st::boxPadding.left() - st::newGroupInfoPadding.left() - st::boxPadding.right(), _first->height()); _last->resize(_first->size()); if (_invertOrder) { - _last->moveToLeft(st::boxPadding.left() + st::newGroupInfoPadding.left(), st::boxTitleHeight + st::contactPadding.top()); + _last->moveToLeft(st::boxPadding.left() + st::newGroupInfoPadding.left(), titleHeight() + st::contactPadding.top()); _first->moveToLeft(st::boxPadding.left() + st::newGroupInfoPadding.left(), _last->y() + _last->height() + st::contactSkip); } else { - _first->moveToLeft(st::boxPadding.left() + st::newGroupInfoPadding.left(), st::boxTitleHeight + st::contactPadding.top()); + _first->moveToLeft(st::boxPadding.left() + st::newGroupInfoPadding.left(), titleHeight() + st::contactPadding.top()); _last->moveToLeft(st::boxPadding.left() + st::newGroupInfoPadding.left(), _first->y() + _first->height() + st::contactSkip); } @@ -1161,7 +1161,7 @@ void EditChannelBox::onDescriptionResized() { } void EditChannelBox::updateMaxHeight() { - int32 h = st::boxTitleHeight + st::newGroupInfoPadding.top() + _title->height(); + int32 h = titleHeight() + st::newGroupInfoPadding.top() + _title->height(); h += st::newGroupDescriptionPadding.top() + _description->height() + st::newGroupDescriptionPadding.bottom(); if (!_channel->isMegagroup()) { h += st::newGroupPublicLinkPadding.top() + _sign->height() + st::newGroupPublicLinkPadding.bottom(); @@ -1175,7 +1175,7 @@ void EditChannelBox::updateMaxHeight() { void EditChannelBox::resizeEvent(QResizeEvent *e) { _title->resize(width() - st::boxPadding.left() - st::newGroupInfoPadding.left() - st::boxPadding.right(), _title->height()); - _title->moveToLeft(st::boxPadding.left() + st::newGroupInfoPadding.left(), st::boxTitleHeight + st::newGroupInfoPadding.top() + st::newGroupNamePosition.y()); + _title->moveToLeft(st::boxPadding.left() + st::newGroupInfoPadding.left(), titleHeight() + st::newGroupInfoPadding.top() + st::newGroupNamePosition.y()); _description->moveToLeft(st::boxPadding.left() + st::newGroupInfoPadding.left(), _title->y() + _title->height() + st::newGroupDescriptionPadding.top()); diff --git a/Telegram/SourceFiles/boxes/autolockbox.cpp b/Telegram/SourceFiles/boxes/autolockbox.cpp index b0fa448ce9..e6310cda0a 100644 --- a/Telegram/SourceFiles/boxes/autolockbox.cpp +++ b/Telegram/SourceFiles/boxes/autolockbox.cpp @@ -19,12 +19,11 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" +#include "boxes/autolockbox.h" + #include "lang.h" - #include "localstorage.h" - -#include "autolockbox.h" -#include "confirmbox.h" +#include "boxes/confirmbox.h" #include "mainwidget.h" #include "mainwindow.h" #include "ui/buttons/checkbox.h" @@ -36,9 +35,9 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) { int32 opts[] = { 60, 300, 3600, 18000 }, cnt = sizeof(opts) / sizeof(opts[0]); - resizeMaxHeight(st::langsWidth, st::boxTitleHeight + 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 = st::boxTitleHeight + st::boxOptionListPadding.top(); + int32 y = titleHeight() + st::boxOptionListPadding.top(); _options.reserve(cnt); for (int32 i = 0; i < cnt; ++i) { int32 v = opts[i]; diff --git a/Telegram/SourceFiles/boxes/backgroundbox.cpp b/Telegram/SourceFiles/boxes/backgroundbox.cpp index 70e1e1b0d9..30a0851b2e 100644 --- a/Telegram/SourceFiles/boxes/backgroundbox.cpp +++ b/Telegram/SourceFiles/boxes/backgroundbox.cpp @@ -19,9 +19,9 @@ 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/backgroundbox.h" -#include "backgroundbox.h" +#include "lang.h" #include "mainwidget.h" #include "mainwindow.h" #include "window/window_theme.h" diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style index 293dc5ed80..de9b5f4001 100644 --- a/Telegram/SourceFiles/boxes/boxes.style +++ b/Telegram/SourceFiles/boxes/boxes.style @@ -23,22 +23,19 @@ using "basic.style"; using "ui/widgets/widgets.style"; using "intro/intro.style"; -boxBlueTitleBg: #6393b5; -boxBlueTitleFg: #ffffff; -boxBlueTitleAdditionalFg: #dae9f5; -boxBlueTitleAdditionalSkip: 12px; -boxBlueTitlePosition: point(23px, 18px); -boxBlueTitleShadow: icon {{ "box_title_shadow", windowShadowFg }}; +boxBlockTitleHeight: 48px; +boxBlockTitlePosition: point(18px, 14px); +boxBlockTitleFont: font(boxFontSize semibold); +boxBlockTitleAdditionalSkip: 6px; +boxBlockTitleAdditionalFont: normalFont; +boxBlockTitleShadow: icon {{ "box_title_shadow", windowShadowFg }}; -boxBlueClose: MaskButton(defaultMaskButton) { - width: boxTitleHeight; - height: boxTitleHeight; +boxBlockTitleClose: IconButton(defaultIconButton) { + width: boxBlockTitleHeight; + height: boxBlockTitleHeight; - bg: boxBlueTitleBg; - iconBg: #c8e1f0; - iconBgOver: #ffffff; - - icon: icon {{ "box_button_close-invert", boxBlueTitleBg }}; + icon: boxBlockTitleCloseIcon; + iconOver: boxBlockTitleCloseIconOver; } confirmInviteTitle: flatLabel(labelDefFlat) { @@ -147,15 +144,12 @@ contactsMultiSelect: MultiSelect { fieldIcon: boxFieldSearchIcon; fieldIconSkip: 36px; - fieldCancel: MaskButton(defaultMaskButton) { + fieldCancel: IconButton { width: 41px; height: 48px; - bg: boxSearchBg; icon: boxSearchCancelIcon; - - iconBg: boxSearchCancelIconFg; - iconBgOver: boxSearchCancelIconFgOver; + iconOver: boxSearchCancelIconOver; iconPosition: point(8px, 18px); iconPositionDown: point(8px, 18px); diff --git a/Telegram/SourceFiles/boxes/confirmbox.cpp b/Telegram/SourceFiles/boxes/confirmbox.cpp index d907c745da..951fc3d153 100644 --- a/Telegram/SourceFiles/boxes/confirmbox.cpp +++ b/Telegram/SourceFiles/boxes/confirmbox.cpp @@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "stdafx.h" #include "boxes/confirmbox.h" +#include "styles/style_boxes.h" #include "lang.h" #include "mainwidget.h" #include "mainwindow.h" @@ -28,7 +29,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "application.h" #include "ui/buttons/checkbox.h" #include "core/click_handler_types.h" -#include "styles/style_boxes.h" #include "localstorage.h" TextParseOptions _confirmBoxTextOptions = { @@ -316,7 +316,7 @@ ConvertToSupergroupBox::ConvertToSupergroupBox(ChatData *chat) : AbstractBox(st: _note.setText(st::boxTextFont, lng_profile_convert_warning(lt_bold_start, textcmdStartSemibold(), lt_bold_end, textcmdStopSemibold()), _confirmBoxTextOptions); _textWidth = st::boxWideWidth - st::boxPadding.left() - st::boxButtonPadding.right(); _textHeight = _text.countHeight(_textWidth); - setMaxHeight(st::boxTitleHeight + _textHeight + st::boxPadding.bottom() + _note.countHeight(_textWidth) + st::boxButtonPadding.top() + _convert->height() + st::boxButtonPadding.bottom()); + setMaxHeight(titleHeight() + _textHeight + st::boxPadding.bottom() + _note.countHeight(_textWidth) + st::boxButtonPadding.top() + _convert->height() + st::boxButtonPadding.bottom()); textstyleRestore(); connect(_convert, SIGNAL(clicked()), this, SLOT(onConvert())); @@ -382,8 +382,8 @@ void ConvertToSupergroupBox::paintEvent(QPaintEvent *e) { // draw box title / text p.setPen(st::boxTextFg); textstyleSet(&st::boxTextStyle); - _text.drawLeft(p, st::boxPadding.left(), st::boxTitleHeight, _textWidth, width()); - _note.drawLeft(p, st::boxPadding.left(), st::boxTitleHeight + _textHeight + st::boxPadding.bottom(), _textWidth, width()); + _text.drawLeft(p, st::boxPadding.left(), titleHeight(), _textWidth, width()); + _note.drawLeft(p, st::boxPadding.left(), titleHeight() + _textHeight + st::boxPadding.bottom(), _textWidth, width()); textstyleRestore(); } diff --git a/Telegram/SourceFiles/boxes/confirmphonebox.cpp b/Telegram/SourceFiles/boxes/confirmphonebox.cpp index 7dc63ab2d4..23ca5c067c 100644 --- a/Telegram/SourceFiles/boxes/confirmphonebox.cpp +++ b/Telegram/SourceFiles/boxes/confirmphonebox.cpp @@ -93,7 +93,7 @@ void ConfirmPhoneBox::setCallStatus(const CallStatus &status) { } void ConfirmPhoneBox::launch() { - setBlueTitle(true); + setBlockTitle(true); _about = new FlatLabel(this, st::confirmPhoneAboutLabel); TextWithEntities aboutText; @@ -110,7 +110,7 @@ void ConfirmPhoneBox::launch() { _send = new BoxButton(this, lang(lng_confirm_phone_send), st::defaultBoxButton); _cancel = new BoxButton(this, lang(lng_cancel), st::cancelBoxButton); - setMaxHeight(st::boxTitleHeight + st::usernamePadding.top() + _code->height() + st::usernameSkip + _about->height() + st::usernameSkip + _send->height() + st::boxButtonPadding.bottom()); + setMaxHeight(titleHeight() + st::usernamePadding.top() + _code->height() + st::usernameSkip + _about->height() + st::usernameSkip + _send->height() + st::boxButtonPadding.bottom()); connect(_send, SIGNAL(clicked()), this, SLOT(onSendCode())); connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose())); @@ -289,7 +289,7 @@ QString ConfirmPhoneBox::getCallText() const { void ConfirmPhoneBox::resizeEvent(QResizeEvent *e) { _code->resize(width() - st::usernamePadding.left() - st::usernamePadding.right(), _code->height()); - _code->moveToLeft(st::usernamePadding.left(), st::boxTitleHeight + st::usernamePadding.top()); + _code->moveToLeft(st::usernamePadding.left(), titleHeight() + st::usernamePadding.top()); _about->moveToLeft(st::usernamePadding.left(), _code->y() + _code->height() + st::usernameSkip); diff --git a/Telegram/SourceFiles/boxes/connectionbox.cpp b/Telegram/SourceFiles/boxes/connectionbox.cpp index f4f65460eb..5fc825fbda 100644 --- a/Telegram/SourceFiles/boxes/connectionbox.cpp +++ b/Telegram/SourceFiles/boxes/connectionbox.cpp @@ -19,11 +19,10 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" +#include "boxes/connectionbox.h" + #include "lang.h" - #include "localstorage.h" - -#include "connectionbox.h" #include "mainwidget.h" #include "mainwindow.h" #include "ui/buttons/checkbox.h" @@ -62,7 +61,7 @@ void ConnectionBox::showAll() { _tcpProxyRadio->show(); _tryIPv6->show(); - int32 h = st::boxTitleHeight + st::boxOptionListPadding.top() + _autoRadio->height() + st::boxOptionListPadding.top() + _httpProxyRadio->height() + st::boxOptionListPadding.top() + _tcpProxyRadio->height() + st::boxOptionListPadding.top() + st::connectionIPv6Skip + _tryIPv6->height() + st::boxOptionListPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _save->height() + st::boxButtonPadding.bottom(); + int32 h = titleHeight() + st::boxOptionListPadding.top() + _autoRadio->height() + st::boxOptionListPadding.top() + _httpProxyRadio->height() + st::boxOptionListPadding.top() + _tcpProxyRadio->height() + st::boxOptionListPadding.top() + st::connectionIPv6Skip + _tryIPv6->height() + st::boxOptionListPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _save->height() + st::boxButtonPadding.bottom(); if (_httpProxyRadio->checked() || _tcpProxyRadio->checked()) { h += 2 * st::boxOptionListPadding.top() + 2 * _hostInput->height(); _hostInput->show(); @@ -97,7 +96,7 @@ void ConnectionBox::paintEvent(QPaintEvent *e) { } void ConnectionBox::resizeEvent(QResizeEvent *e) { - _autoRadio->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), st::boxTitleHeight + st::boxOptionListPadding.top()); + _autoRadio->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), titleHeight() + st::boxOptionListPadding.top()); _httpProxyRadio->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _autoRadio->y() + _autoRadio->height() + st::boxOptionListPadding.top()); int32 inputy = 0; @@ -221,7 +220,7 @@ AutoDownloadBox::AutoDownloadBox() : AbstractBox(st::boxWidth) , _gifPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadGif() & dbiadNoPrivate), st::defaultBoxCheckbox) , _gifGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadGif() & dbiadNoGroups), st::defaultBoxCheckbox) , _gifPlay(this, lang(lng_media_auto_play), cAutoPlayGif(), st::defaultBoxCheckbox) -, _sectionHeight(st::boxTitleHeight + 2 * (st::defaultBoxCheckbox.height + st::setLittleSkip)) +, _sectionHeight(titleHeight() + 2 * (st::defaultBoxCheckbox.height + st::setLittleSkip)) , _save(this, lang(lng_connection_save), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) { @@ -258,13 +257,13 @@ void AutoDownloadBox::paintEvent(QPaintEvent *e) { } void AutoDownloadBox::resizeEvent(QResizeEvent *e) { - _photoPrivate->moveToLeft(st::boxTitlePosition.x(), st::boxTitleHeight + st::setLittleSkip); + _photoPrivate->moveToLeft(st::boxTitlePosition.x(), titleHeight() + st::setLittleSkip); _photoGroups->moveToLeft(st::boxTitlePosition.x(), _photoPrivate->y() + _photoPrivate->height() + st::setLittleSkip); - _audioPrivate->moveToLeft(st::boxTitlePosition.x(), _sectionHeight + st::boxTitleHeight + st::setLittleSkip); + _audioPrivate->moveToLeft(st::boxTitlePosition.x(), _sectionHeight + titleHeight() + st::setLittleSkip); _audioGroups->moveToLeft(st::boxTitlePosition.x(), _audioPrivate->y() + _audioPrivate->height() + st::setLittleSkip); - _gifPrivate->moveToLeft(st::boxTitlePosition.x(), 2 * _sectionHeight + st::boxTitleHeight + st::setLittleSkip); + _gifPrivate->moveToLeft(st::boxTitlePosition.x(), 2 * _sectionHeight + titleHeight() + st::setLittleSkip); _gifGroups->moveToLeft(st::boxTitlePosition.x(), _gifPrivate->y() + _gifPrivate->height() + st::setLittleSkip); _gifPlay->moveToLeft(st::boxTitlePosition.x(), _gifGroups->y() + _gifGroups->height() + st::setLittleSkip); diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 704741cae5..20c59e3aa0 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -22,9 +22,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "boxes/contactsbox.h" #include "dialogs/dialogs_indexed_list.h" +#include "styles/style_boxes.h" #include "styles/style_dialogs.h" #include "styles/style_history.h" -#include "styles/style_boxes.h" #include "lang.h" #include "boxes/addcontactbox.h" #include "mainwidget.h" @@ -307,7 +307,7 @@ void ContactsBox::paintEvent(QPaintEvent *e) { } int ContactsBox::getTopScrollSkip() const { - auto result = st::boxTitleHeight; + auto result = titleHeight(); if (!_select->isHidden()) { result += _select->height(); } @@ -332,7 +332,7 @@ void ContactsBox::resizeEvent(QResizeEvent *e) { ItemListBox::resizeEvent(e); _select->resizeToWidth(width()); - _select->moveToLeft(0, st::boxTitleHeight); + _select->moveToLeft(0, titleHeight()); updateScrollSkips(); diff --git a/Telegram/SourceFiles/boxes/downloadpathbox.cpp b/Telegram/SourceFiles/boxes/downloadpathbox.cpp index b680a07b50..704c916de5 100644 --- a/Telegram/SourceFiles/boxes/downloadpathbox.cpp +++ b/Telegram/SourceFiles/boxes/downloadpathbox.cpp @@ -65,7 +65,7 @@ void DownloadPathBox::showAll() { _save->show(); _cancel->show(); - int32 h = st::boxTitleHeight + st::boxOptionListPadding.top() + _default->height() + st::boxOptionListPadding.top() + _temp->height() + st::boxOptionListPadding.top() + _dir->height(); + int32 h = titleHeight() + st::boxOptionListPadding.top() + _default->height() + st::boxOptionListPadding.top() + _temp->height() + st::boxOptionListPadding.top() + _dir->height(); if (_dir->checked()) h += st::downloadPathSkip + _pathLink->height(); h += st::boxOptionListPadding.bottom() + st::boxButtonPadding.top() + _save->height() + st::boxButtonPadding.bottom(); @@ -80,7 +80,7 @@ void DownloadPathBox::paintEvent(QPaintEvent *e) { } void DownloadPathBox::resizeEvent(QResizeEvent *e) { - _default->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), st::boxTitleHeight + st::boxOptionListPadding.top()); + _default->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), titleHeight() + st::boxOptionListPadding.top()); _temp->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _default->y() + _default->height() + st::boxOptionListPadding.top()); _dir->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _temp->y() + _temp->height() + st::boxOptionListPadding.top()); int32 inputx = st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultRadiobutton.textPosition.x(); diff --git a/Telegram/SourceFiles/boxes/emojibox.cpp b/Telegram/SourceFiles/boxes/emojibox.cpp index 2300aa5ba4..977638d038 100644 --- a/Telegram/SourceFiles/boxes/emojibox.cpp +++ b/Telegram/SourceFiles/boxes/emojibox.cpp @@ -19,9 +19,9 @@ 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/emojibox.h" -#include "emojibox.h" +#include "lang.h" #include "mainwidget.h" #include "mainwindow.h" @@ -72,13 +72,13 @@ namespace { } EmojiBox::EmojiBox() : _esize(EmojiSizes[EIndex + 1]) { - setBlueTitle(true); + setBlockTitle(true); fillBlocks(); _blockHeight = st::emojiReplaceInnerHeight; - resizeMaxHeight(_blocks[0].size() * st::emojiReplaceWidth + 2 * st::emojiReplacePadding, st::boxTitleHeight + st::emojiReplacePadding + _blocks.size() * st::emojiReplaceHeight + (st::emojiReplaceHeight - _blockHeight) + st::emojiReplacePadding); + resizeMaxHeight(_blocks[0].size() * st::emojiReplaceWidth + 2 * st::emojiReplacePadding, titleHeight() + st::emojiReplacePadding + _blocks.size() * st::emojiReplaceHeight + (st::emojiReplaceHeight - _blockHeight) + st::emojiReplacePadding); prepare(); } @@ -129,7 +129,7 @@ void EmojiBox::paintEvent(QPaintEvent *e) { p.setFont(st::emojiTextFont); p.setPen(st::boxTextFg); - int32 top = st::boxTitleHeight + st::emojiReplacePadding + (st::emojiReplaceHeight - _blockHeight) / 2; + int32 top = titleHeight() + st::emojiReplacePadding + (st::emojiReplaceHeight - _blockHeight) / 2; for (Blocks::const_iterator i = _blocks.cbegin(), e = _blocks.cend(); i != e; ++i) { int32 rowSize = i->size(), left = (width() - rowSize * st::emojiReplaceWidth) / 2; for (BlockRow::const_iterator j = i->cbegin(), en = i->cend(); j != en; ++j) { diff --git a/Telegram/SourceFiles/boxes/languagebox.cpp b/Telegram/SourceFiles/boxes/languagebox.cpp index 44674bf0bf..4795030f9e 100644 --- a/Telegram/SourceFiles/boxes/languagebox.cpp +++ b/Telegram/SourceFiles/boxes/languagebox.cpp @@ -34,7 +34,7 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) { bool haveTestLang = (cLang() == languageTest); - int32 y = st::boxTitleHeight + st::boxOptionListPadding.top(); + int32 y = titleHeight() + st::boxOptionListPadding.top(); _langs.reserve(languageCount + (haveTestLang ? 1 : 0)); if (haveTestLang) { _langs.push_back(new Ui::Radiobutton(this, qsl("lang"), languageTest, qsl("Custom Lang"), (cLang() == languageTest), st::langsButton)); @@ -56,7 +56,7 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) { connect(_langs.back(), SIGNAL(changed()), this, SLOT(onChange())); } - resizeMaxHeight(st::langsWidth, st::boxTitleHeight + (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())); diff --git a/Telegram/SourceFiles/boxes/localstoragebox.cpp b/Telegram/SourceFiles/boxes/localstoragebox.cpp index 23057c10aa..2c459fa579 100644 --- a/Telegram/SourceFiles/boxes/localstoragebox.cpp +++ b/Telegram/SourceFiles/boxes/localstoragebox.cpp @@ -21,10 +21,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "stdafx.h" #include "boxes/localstoragebox.h" +#include "styles/style_boxes.h" #include "localstorage.h" #include "ui/flatbutton.h" #include "lang.h" -#include "styles/style_boxes.h" #include "mainwindow.h" LocalStorageBox::LocalStorageBox() : AbstractBox() @@ -50,8 +50,8 @@ void LocalStorageBox::updateControls() { rowsHeight = st::linkFont->height + st::localStorageBoxSkip; } _clear->setVisible(_imagesCount > 0 || _audiosCount > 0); - setMaxHeight(st::boxTitleHeight + st::localStorageBoxSkip + rowsHeight + _clear->height() + st::boxButtonPadding.top() + _close->height() + st::boxButtonPadding.bottom()); - _clear->moveToLeft(st::boxPadding.left(), st::boxTitleHeight + st::localStorageBoxSkip + rowsHeight); + setMaxHeight(titleHeight() + st::localStorageBoxSkip + rowsHeight + _clear->height() + st::boxButtonPadding.top() + _close->height() + st::boxButtonPadding.bottom()); + _clear->moveToLeft(st::boxPadding.left(), titleHeight() + st::localStorageBoxSkip + rowsHeight); _close->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close->height()); update(); } @@ -83,7 +83,7 @@ void LocalStorageBox::paintEvent(QPaintEvent *e) { p.setFont(st::boxTextFont); p.setPen(st::windowTextFg); checkLocalStoredCounts(); - int top = st::boxTitleHeight + st::localStorageBoxSkip; + int top = titleHeight() + st::localStorageBoxSkip; if (_imagesCount > 0) { auto text = lng_settings_images_cached(lt_count, _imagesCount, lt_size, formatSizeText(Local::storageImagesSize() + Local::storageStickersSize() + Local::storageWebFilesSize())); p.drawTextLeft(st::boxPadding.left(), top, width(), text); diff --git a/Telegram/SourceFiles/boxes/passcodebox.cpp b/Telegram/SourceFiles/boxes/passcodebox.cpp index 6340da7fca..ab956eb0f4 100644 --- a/Telegram/SourceFiles/boxes/passcodebox.cpp +++ b/Telegram/SourceFiles/boxes/passcodebox.cpp @@ -75,7 +75,7 @@ PasscodeBox::PasscodeBox(const QByteArray &newSalt, const QByteArray &curSalt, b } void PasscodeBox::init() { - setBlueTitle(true); + setBlockTitle(true); textstyleSet(&st::usernameTextStyle); _about.setRichText(st::normalFont, lang(_cloudPwd ? lng_cloud_password_about : lng_passcode_about)); @@ -84,17 +84,17 @@ void PasscodeBox::init() { if (_turningOff) { _oldPasscode.show(); _boxTitle = lang(_cloudPwd ? lng_cloud_password_remove : lng_passcode_remove); - setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _oldPasscode.height() + st::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0) + _aboutHeight + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom()); + 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(); _boxTitle = lang(_cloudPwd ? lng_cloud_password_change : lng_passcode_change); - setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _oldPasscode.height() + st::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0) + _newPasscode.height() + st::contactSkip + _reenterPasscode.height() + st::passcodeSkip + (_cloudPwd ? _passwordHint.height() + st::contactSkip : 0) + _aboutHeight + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom()); + 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(); _boxTitle = lang(_cloudPwd ? lng_cloud_password_create : lng_passcode_create); - setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _newPasscode.height() + st::contactSkip + _reenterPasscode.height() + st::passcodeSkip + (_cloudPwd ? _passwordHint.height() + st::contactSkip : 0) + _aboutHeight + (_cloudPwd ? st::contactSkip + _recoverEmail.height() + st::passcodeSkip : st::passcodePadding.bottom()) + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom()); + 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()); } } @@ -233,7 +233,7 @@ 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(), st::boxTitleHeight + st::passcodePadding.top()); + _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()); @@ -496,9 +496,9 @@ RecoverBox::RecoverBox(const QString &pattern) : AbstractBox(st::boxWidth) , _saveButton(this, lang(lng_passcode_submit), st::defaultBoxButton) , _cancelButton(this, lang(lng_cancel), st::cancelBoxButton) , _recoverCode(this, st::defaultInputField, lang(lng_signin_code)) { - setBlueTitle(true); + setBlockTitle(true); - setMaxHeight(st::boxTitleHeight + 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())); @@ -535,7 +535,7 @@ void RecoverBox::paintEvent(QPaintEvent *e) { void RecoverBox::resizeEvent(QResizeEvent *e) { _recoverCode.resize(st::boxWidth - st::boxPadding.left() - st::boxPadding.right(), _recoverCode.height()); - _recoverCode.moveToLeft(st::boxPadding.left(), st::boxTitleHeight + st::passcodePadding.top() + st::passcodeSkip); + _recoverCode.moveToLeft(st::boxPadding.left(), titleHeight() + st::passcodePadding.top() + st::passcodeSkip); _saveButton.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _saveButton.height()); _cancelButton.moveToRight(st::boxButtonPadding.right() + _saveButton.width() + st::boxButtonPadding.left(), _saveButton.y()); diff --git a/Telegram/SourceFiles/boxes/report_box.cpp b/Telegram/SourceFiles/boxes/report_box.cpp index 9d09e825f6..8da5e09ac2 100644 --- a/Telegram/SourceFiles/boxes/report_box.cpp +++ b/Telegram/SourceFiles/boxes/report_box.cpp @@ -57,7 +57,7 @@ void ReportBox::paintEvent(QPaintEvent *e) { } void ReportBox::resizeEvent(QResizeEvent *e) { - _reasonSpam->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), st::boxTitleHeight + st::boxOptionListPadding.top()); + _reasonSpam->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), titleHeight() + st::boxOptionListPadding.top()); _reasonViolence->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonSpam->y() + _reasonSpam->height() + st::boxOptionListPadding.top()); _reasonPornography->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonViolence->y() + _reasonViolence->height() + st::boxOptionListPadding.top()); _reasonOther->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonPornography->y() + _reasonPornography->height() + st::boxOptionListPadding.top()); @@ -143,7 +143,7 @@ bool ReportBox::reportFail(const RPCError &error) { } void ReportBox::updateMaxHeight() { - int32 h = st::boxTitleHeight + 4 * (st::boxOptionListPadding.top() + _reasonSpam->height()) + st::boxButtonPadding.top() + _report->height() + st::boxButtonPadding.bottom(); + int32 h = titleHeight() + 4 * (st::boxOptionListPadding.top() + _reasonSpam->height()) + st::boxButtonPadding.top() + _report->height() + st::boxButtonPadding.bottom(); if (_reasonOtherText) { h += st::newGroupDescriptionPadding.top() + _reasonOtherText->height() + st::newGroupDescriptionPadding.bottom(); } diff --git a/Telegram/SourceFiles/boxes/sessionsbox.cpp b/Telegram/SourceFiles/boxes/sessionsbox.cpp index 747a45dc59..3898aecdd4 100644 --- a/Telegram/SourceFiles/boxes/sessionsbox.cpp +++ b/Telegram/SourceFiles/boxes/sessionsbox.cpp @@ -45,7 +45,7 @@ SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll) 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(), st::boxTitleHeight); + init(_inner, st::boxButtonPadding.bottom() + _done.height() + st::boxButtonPadding.top(), titleHeight()); _inner->resize(width(), st::noContactsHeight); prepare(); @@ -76,7 +76,7 @@ void SessionsBox::paintEvent(QPaintEvent *e) { if (paint(p)) return; paintTitle(p, lang(lng_sessions_other_header)); - p.translate(0, st::boxTitleHeight); + p.translate(0, titleHeight()); if (_loading) { p.setFont(st::noContactsFont->f); diff --git a/Telegram/SourceFiles/boxes/sharebox.cpp b/Telegram/SourceFiles/boxes/sharebox.cpp index 9365d8b119..6969a24b05 100644 --- a/Telegram/SourceFiles/boxes/sharebox.cpp +++ b/Telegram/SourceFiles/boxes/sharebox.cpp @@ -83,7 +83,7 @@ ShareBox::ShareBox(CopyCallback &©Callback, SubmitCallback &&submitCallback, } int ShareBox::getTopScrollSkip() const { - auto result = st::boxTitleHeight; + auto result = titleHeight(); if (!_select->isHidden()) { result += _select->height(); } @@ -186,7 +186,7 @@ void ShareBox::resizeEvent(QResizeEvent *e) { ItemListBox::resizeEvent(e); _select->resizeToWidth(width()); - _select->moveToLeft(0, st::boxTitleHeight); + _select->moveToLeft(0, titleHeight()); updateScrollSkips(); diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index 7bf031fd07..c0093b7ce7 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -188,7 +188,7 @@ void StickersBox::setup() { _aboutHeight = st::stickersReorderPadding.top() + _about.countHeight(_aboutWidth) + st::stickersReorderPadding.bottom(); _topShadow.create(this, st::contactsAboutShadow); } - ItemListBox::init(_inner, bottomSkip, st::boxTitleHeight + _aboutHeight); + ItemListBox::init(_inner, bottomSkip, titleHeight() + _aboutHeight); setMaxHeight(snap(countHeight(), int32(st::sessionsHeight), int32(st::boxMaxListHeight))); connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated())); @@ -244,7 +244,7 @@ int32 StickersBox::countHeight() const { if (_section == Section::Installed) { bottomSkip = st::boxButtonPadding.top() + _save->height() + st::boxButtonPadding.bottom(); } - return st::boxTitleHeight + _aboutHeight + _inner->height() + bottomSkip; + return titleHeight() + _aboutHeight + _inner->height() + bottomSkip; } void StickersBox::disenableDone(const MTPmessages_StickerSetInstallResult &result, mtpRequestId req) { @@ -306,7 +306,7 @@ void StickersBox::paintEvent(QPaintEvent *e) { return lang(lng_stickers_archived); })(); paintTitle(p, title); - p.translate(0, st::boxTitleHeight); + p.translate(0, titleHeight()); if (_aboutHeight > 0) { p.fillRect(0, 0, width(), _aboutHeight, st::contactsAboutBg); @@ -343,7 +343,7 @@ void StickersBox::resizeEvent(QResizeEvent *e) { _inner->setVisibleScrollbar((scrollArea()->scrollTopMax() > 0) ? (st::boxScroll.width - st::boxScroll.deltax) : 0); updateVisibleTopBottom(); if (_topShadow) { - _topShadow->setGeometry(0, st::boxTitleHeight + _aboutHeight, width(), st::lineWidth); + _topShadow->setGeometry(0, titleHeight() + _aboutHeight, width(), st::lineWidth); } if (_save) { _save->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _save->height()); diff --git a/Telegram/SourceFiles/boxes/stickersetbox.cpp b/Telegram/SourceFiles/boxes/stickersetbox.cpp index cc71ef5a80..831962c758 100644 --- a/Telegram/SourceFiles/boxes/stickersetbox.cpp +++ b/Telegram/SourceFiles/boxes/stickersetbox.cpp @@ -200,9 +200,9 @@ void StickerSetBox::Inner::gotSet(const MTPmessages_StickerSet &set) { } } if (d.vset.type() == mtpc_stickerSet) { - auto &s(d.vset.c_stickerSet()); + auto &s = d.vset.c_stickerSet(); _setTitle = stickerSetTitle(s); - _title = st::boxTitleFont->elided(_setTitle, width() - st::boxTitlePosition.x() - st::boxTitleHeight); + _title = st::boxBlockTitleFont->elided(_setTitle, width() - st::boxBlockTitlePosition.x() - st::boxBlockTitleHeight); _setShortName = qs(s.vshort_name); _setId = s.vid.v; _setAccess = s.vaccess_hash.v; diff --git a/Telegram/SourceFiles/boxes/usernamebox.cpp b/Telegram/SourceFiles/boxes/usernamebox.cpp index dea3b40561..aa4365cf66 100644 --- a/Telegram/SourceFiles/boxes/usernamebox.cpp +++ b/Telegram/SourceFiles/boxes/usernamebox.cpp @@ -33,13 +33,13 @@ _username(this, st::defaultInputField, qsl("@username"), App::self()->username, _link(this, QString(), st::defaultBoxLinkButton), _saveRequestId(0), _checkRequestId(0), _about(st::boxWidth - st::usernamePadding.left()) { - setBlueTitle(true); + setBlockTitle(true); _goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available); textstyleSet(&st::usernameTextStyle); _about.setRichText(st::boxTextFont, lang(lng_username_about)); - resizeMaxHeight(st::boxWidth, st::boxTitleHeight + st::usernamePadding.top() + _username.height() + st::usernameSkip + _about.countHeight(st::boxWidth - st::usernamePadding.left()) + 3 * st::usernameTextStyle.lineHeight + st::usernamePadding.bottom() + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom()); + 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())); @@ -106,7 +106,7 @@ 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(), st::boxTitleHeight + st::usernamePadding.top()); + _username.moveToLeft(st::usernamePadding.left(), titleHeight() + st::usernamePadding.top()); textstyleSet(&st::usernameTextStyle); int32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw); diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 2c472b8fb4..0afb5405b1 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "core/utils.h" -#define BETA_VERSION_MACRO (10019002ULL) +#define BETA_VERSION_MACRO (10019003ULL) constexpr int AppVersion = 10020; constexpr str_const AppVersionStr = "0.10.20"; diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index 8cccec7ab9..e5c4a6a06a 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -195,6 +195,9 @@ historySend: IconButton { iconPosition: point(11px, 11px); iconPositionDown: point(11px, 11px); } +historyEditSaveIcon: icon {{ "send_control_save", historySendIconFg, point(3px, 7px) }}; +historyEditSaveIconOver: icon {{ "send_control_save", historySendIconFgOver, point(3px, 7px) }}; + historyAttach: IconButton(historySend) { icon: icon {{ "send_control_attach", historyComposeIconFg }}; iconOver: icon {{ "send_control_attach", historyComposeIconFgOver }}; @@ -276,17 +279,17 @@ historyReplyIconPosition: point(13px, 13px); historyReplyIcon: icon {{ "history_action_reply", #6fa1d2 }}; historyForwardIcon: icon {{ "history_action_forward", #6fa1d2 }}; historyEditIcon: icon {{ "history_action_edit", #6fa1d2 }}; -historyReplyCancel: MaskButton(defaultMaskButton) { +historyReplyCancel: IconButton { width: 49px; height: 49px; - bg: historyReplyBg; icon: historyReplyCancelIcon; + iconOver: historyReplyCancelIconOver; - iconBg: historyReplyCancelIconFg; - iconBgOver: historyReplyCancelIconFgOver; + iconPosition: point(-1px, -1px); + iconPositionDown: point(-1px, -1px); } -historyInlineBotCancel: MaskButton(historyReplyCancel) { +historyInlineBotCancel: IconButton(historyReplyCancel) { height: 46px; } diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 4b1ef29607..bdb6ecee0d 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -2996,10 +2996,10 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) , _fieldAutocomplete(this) , _reportSpamPanel(this) , _send(this, st::historySend) -, _unblock(this, lang(lng_unblock_button), st::historyUnblock) -, _botStart(this, lang(lng_bot_start), st::historyComposeButton) -, _joinChannel(this, lang(lng_channel_join), st::historyComposeButton) -, _muteUnmute(this, lang(lng_channel_mute), st::historyComposeButton) +, _unblock(this, lang(lng_unblock_button).toUpper(), st::historyUnblock) +, _botStart(this, lang(lng_bot_start).toUpper(), st::historyComposeButton) +, _joinChannel(this, lang(lng_channel_join).toUpper(), st::historyComposeButton) +, _muteUnmute(this, lang(lng_channel_mute).toUpper(), st::historyComposeButton) , _attachToggle(this, st::historyAttach) , _attachEmoji(this, st::historyAttachEmoji) , _botKeyboardShow(this, st::historyBotKeyboardShow) @@ -6473,7 +6473,7 @@ void HistoryWidget::clearInlineBot() { void HistoryWidget::inlineBotChanged() { bool isInlineBot = _inlineBot && (_inlineBot != LookingUpInlineBot); if (isInlineBot && !_inlineBotCancel) { - _inlineBotCancel = std_::make_unique(this, st::historyInlineBotCancel); + _inlineBotCancel = std_::make_unique(this, st::historyInlineBotCancel); connect(_inlineBotCancel.get(), SIGNAL(clicked()), this, SLOT(onInlineBotCancel())); _inlineBotCancel->setGeometry(_send->geometry()); _attachEmoji->raise(); @@ -6514,14 +6514,14 @@ void HistoryWidget::onCheckFieldAutocomplete() { void HistoryWidget::updateFieldPlaceholder() { if (_editMsgId) { _field->setPlaceholder(lang(lng_edit_message_text)); -// _send->setText(lang(lng_settings_save)); + _send->setIcon(&st::historyEditSaveIcon, &st::historyEditSaveIconOver); } else { if (_inlineBot && _inlineBot != LookingUpInlineBot) { _field->setPlaceholder(_inlineBot->botInfo->inlinePlaceholder.mid(1), _inlineBot->username.size() + 2); } else { _field->setPlaceholder(lang((_history && _history->isChannel() && !_history->isMegagroup()) ? (_silent->checked() ? lng_broadcast_silent_ph : lng_broadcast_ph) : lng_message_ph)); } -// _send->setText(lang(lng_send_button)); + _send->setIcon(nullptr); } } diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 1af2d8003c..37df223587 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -42,7 +42,6 @@ class DropdownMenu; class PlainShadow; class PopupMenu; class IconButton; -class MaskButton; class HistoryDownButton; class EmojiButton; } // namespace Ui @@ -897,7 +896,7 @@ private: Text _replyEditMsgText; mutable SingleTimer _updateEditTimeLeftDisplay; - ChildWidget _fieldBarCancel; + ChildWidget _fieldBarCancel; void updateReplyEditTexts(bool force = false); struct PinnedBar { @@ -907,7 +906,7 @@ private: MsgId msgId = 0; HistoryItem *msg = nullptr; Text text; - ChildWidget cancel; + ChildWidget cancel; ChildWidget shadow; }; std_::unique_ptr _pinnedBar; @@ -1087,7 +1086,7 @@ private: UserData *_inlineBot = nullptr; QString _inlineBotUsername; mtpRequestId _inlineBotResolveRequestId = 0; - std_::unique_ptr _inlineBotCancel; + std_::unique_ptr _inlineBotCancel; void inlineBotResolveDone(const MTPcontacts_ResolvedPeer &result); bool inlineBotResolveFail(QString name, const RPCError &error); diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index 86984e5435..35e199cbff 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -559,6 +559,7 @@ void MainWindow::showConnecting(const QString &text, const QString &reconnect) { _connecting->set(text, reconnect); } else { _connecting.create(bodyWidget(), text, reconnect); + _connecting->show(); updateControlsGeometry(); fixOrder(); } diff --git a/Telegram/SourceFiles/media/player/media_player.style b/Telegram/SourceFiles/media/player/media_player.style index 41804f51e6..1211d3c34b 100644 --- a/Telegram/SourceFiles/media/player/media_player.style +++ b/Telegram/SourceFiles/media/player/media_player.style @@ -215,7 +215,7 @@ mediaPlayerScroll: flatScroll(solidScroll) { } mediaPlayerListHeightMax: 280px; mediaPlayerListMarginBottom: 10px; -mediaPlayerScrollShadow: icon {{ "playlist_shadow", #000000 }}; +mediaPlayerScrollShadow: icon {{ "playlist_shadow", windowShadowFg }}; mediaPlayerListMarginTop: 8px; mediaPlayerListIconFg: #ffffff; diff --git a/Telegram/SourceFiles/settings/settings.style b/Telegram/SourceFiles/settings/settings.style index 32ad78e0f3..071e2bb8e5 100644 --- a/Telegram/SourceFiles/settings/settings.style +++ b/Telegram/SourceFiles/settings/settings.style @@ -31,21 +31,12 @@ settingsMargin: 48px; settingsFixedBarHeight: 52px; settingsFixedBarFont: font(14px semibold); -settingsFixedBarFg: windowTextFg; settingsFixedBarTextLeft: 20px; settingsFixedBarTextTop: 16px; -settingsFixedBarClose: MaskButton(defaultMaskButton) { +settingsFixedBarClose: IconButton(boxBlockTitleClose) { width: settingsFixedBarHeight; height: settingsFixedBarHeight; - - bg: settingsFixedBarBg; - icon: settingsFixedBarCloseIcon; - - iconBg: settingsCloseFg; - iconBgOver: settingsCloseFgOver; } -settingsFixedBarShadowBg1: #00000021; -settingsFixedBarShadowBg2: #0000000b; settingsMarginTop: 34px; settingsPhotoSize: 112px; diff --git a/Telegram/SourceFiles/settings/settings_fixed_bar.cpp b/Telegram/SourceFiles/settings/settings_fixed_bar.cpp index 82c1cdad88..5954df433a 100644 --- a/Telegram/SourceFiles/settings/settings_fixed_bar.cpp +++ b/Telegram/SourceFiles/settings/settings_fixed_bar.cpp @@ -48,7 +48,7 @@ void FixedBar::resizeEvent(QResizeEvent *e) { void FixedBar::paintEvent(QPaintEvent *e) { Painter p(this); - p.fillRect(e->rect(), st::settingsFixedBarBg); + p.fillRect(e->rect(), st::boxBlockTitleBg); p.setFont(st::settingsFixedBarFont); p.setPen(st::windowTextFg); diff --git a/Telegram/SourceFiles/settings/settings_fixed_bar.h b/Telegram/SourceFiles/settings/settings_fixed_bar.h index 720da2b91c..7ebc87e3d8 100644 --- a/Telegram/SourceFiles/settings/settings_fixed_bar.h +++ b/Telegram/SourceFiles/settings/settings_fixed_bar.h @@ -21,7 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #pragma once namespace Ui { -class MaskButton; +class IconButton; } // namespace Ui namespace Settings { @@ -37,7 +37,7 @@ protected: int resizeGetHeight(int newWidth) override; private: - ChildWidget _close; + ChildWidget _close; }; diff --git a/Telegram/SourceFiles/settings/settings_widget.cpp b/Telegram/SourceFiles/settings/settings_widget.cpp index c3ae485e82..0c377d7209 100644 --- a/Telegram/SourceFiles/settings/settings_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_widget.cpp @@ -128,14 +128,12 @@ Widget::Widget(QWidget *parent) : LayerWidget(parent) , _scroll(this, st::setScroll) , _inner(this) , _fixedBar(this) -, _fixedBarShadow1(this, st::settingsFixedBarShadowBg1) -, _fixedBarShadow2(this, st::settingsFixedBarShadowBg2) { +, _fixedBarShadow(this, st::boxBlockTitleShadow) { _scroll->setOwnedWidget(_inner); setAttribute(Qt::WA_OpaquePaintEvent); _fixedBar->move(0, 0); - _fixedBarShadow1->move(0, _fixedBar->y() + st::settingsFixedBarHeight); - _fixedBarShadow2->move(0, _fixedBarShadow1->y() + st::lineWidth); + _fixedBarShadow->move(0, _fixedBar->y() + st::settingsFixedBarHeight); _scroll->move(0, st::settingsFixedBarHeight); connect(_inner, SIGNAL(heightUpdated()), this, SLOT(onInnerHeightUpdated())); @@ -211,8 +209,7 @@ void Widget::resizeEvent(QResizeEvent *e) { } _fixedBar->resizeToWidth(width()); - _fixedBarShadow1->resize(width(), st::lineWidth); - _fixedBarShadow2->resize(width(), st::lineWidth); + _fixedBarShadow->resize(width(), st::boxBlockTitleShadow.height()); QSize scrollSize(width(), height() - _fixedBar->height()); if (_scroll->size() != scrollSize) { diff --git a/Telegram/SourceFiles/settings/settings_widget.h b/Telegram/SourceFiles/settings/settings_widget.h index 06dde46d85..b32afaea4f 100644 --- a/Telegram/SourceFiles/settings/settings_widget.h +++ b/Telegram/SourceFiles/settings/settings_widget.h @@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "layerwidget.h" namespace Ui { -class PlainShadow; +class GradientShadow; } // namespace Ui namespace Settings { @@ -54,7 +54,7 @@ private: ChildWidget _scroll; ChildWidget _inner; ChildWidget _fixedBar; - ChildWidget _fixedBarShadow1, _fixedBarShadow2; + ChildWidget _fixedBarShadow; int _contentLeft = 0; diff --git a/Telegram/SourceFiles/ui/buttons/icon_button.cpp b/Telegram/SourceFiles/ui/buttons/icon_button.cpp index e5794fe684..f1003d0a13 100644 --- a/Telegram/SourceFiles/ui/buttons/icon_button.cpp +++ b/Telegram/SourceFiles/ui/buttons/icon_button.cpp @@ -60,6 +60,9 @@ void IconButton::paintEvent(QPaintEvent *e) { if (position.x() < 0) { position.setX((width() - icon->width()) / 2); } + if (position.y() < 0) { + position.setY((height() - icon->height()) / 2); + } icon->paint(p, position, width()); if (over > 0. && over < 1.) { auto iconOver = overIcon(); diff --git a/Telegram/SourceFiles/ui/countryinput.cpp b/Telegram/SourceFiles/ui/countryinput.cpp index 71ecb4bda0..e43b4eade5 100644 --- a/Telegram/SourceFiles/ui/countryinput.cpp +++ b/Telegram/SourceFiles/ui/countryinput.cpp @@ -201,7 +201,7 @@ CountrySelectBox::CountrySelectBox() : ItemListBox(st::countriesScroll, st::boxW , _topShadow(this) { _select->resizeToWidth(st::boxWidth); - ItemListBox::init(_inner, st::boxScrollSkip, st::boxTitleHeight + _select->height()); + ItemListBox::init(_inner, st::boxScrollSkip, titleHeight() + _select->height()); _select->setQueryChangedCallback([this](const QString &query) { onFilterUpdate(query); }); _select->setSubmittedCallback([this](bool) { onSubmit(); }); @@ -240,10 +240,10 @@ void CountrySelectBox::resizeEvent(QResizeEvent *e) { ItemListBox::resizeEvent(e); _select->resizeToWidth(width()); - _select->moveToLeft(0, st::boxTitleHeight); + _select->moveToLeft(0, titleHeight()); _inner->resizeToWidth(width()); - _topShadow.setGeometry(0, st::boxTitleHeight + _select->height(), width(), st::lineWidth); + _topShadow.setGeometry(0, titleHeight() + _select->height(), width(), st::lineWidth); } void CountrySelectBox::showAll() { diff --git a/Telegram/SourceFiles/ui/widgets/multi_select.h b/Telegram/SourceFiles/ui/widgets/multi_select.h index 423ea17978..9ac568ee63 100644 --- a/Telegram/SourceFiles/ui/widgets/multi_select.h +++ b/Telegram/SourceFiles/ui/widgets/multi_select.h @@ -26,7 +26,7 @@ class InputField; namespace Ui { -class MaskButton; +class IconButton; class MultiSelect : public TWidget { public: @@ -154,7 +154,7 @@ private: int _fieldTop = 0; int _fieldWidth = 0; ChildWidget _field; - ChildWidget _cancel; + ChildWidget _cancel; int _newHeight = 0; IntAnimation _height; diff --git a/Telegram/SourceFiles/ui/widgets/widgets.style b/Telegram/SourceFiles/ui/widgets/widgets.style index 2945416cd1..7a4fbebdf9 100644 --- a/Telegram/SourceFiles/ui/widgets/widgets.style +++ b/Telegram/SourceFiles/ui/widgets/widgets.style @@ -119,7 +119,7 @@ MultiSelect { fieldMinWidth: pixels; fieldIcon: icon; fieldIconSkip: pixels; - fieldCancel: MaskButton; + fieldCancel: IconButton; fieldCancelSkip: pixels; } @@ -181,6 +181,11 @@ defaultLabelSimple: LabelSimple { textFg: windowTextFg; } +defaultIconButton: IconButton { + iconPosition: point(-1px, -1px); + iconPositionDown: point(-1px, -1px); +} + defaultMaskButton: MaskButton { iconPosition: point(-1px, -1px); iconPositionDown: point(-1px, -1px); diff --git a/Telegram/build/version b/Telegram/build/version index 8301c82a1b..577f8e9c5d 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -3,4 +3,4 @@ AppVersionStrMajor 0.10 AppVersionStrSmall 0.10.20 AppVersionStr 0.10.20 AlphaChannel 0 -BetaVersion 10019002 +BetaVersion 10019003