From ec6e46dae716f8dd167df1616c80ef3824266bf1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 26 Oct 2016 15:24:21 +0300 Subject: [PATCH] Some more icons moved from sprite. --- Telegram/Resources/basic.style | 42 +++++++++--------- .../{box_search_icon.png => box_search.png} | Bin ...x_search_icon@2x.png => box_search@2x.png} | Bin .../Resources/icons/inline_button_switch.png | Bin 0 -> 228 bytes .../icons/inline_button_switch@2x.png | Bin 0 -> 341 bytes .../Resources/icons/inline_button_url.png | Bin 0 -> 146 bytes .../Resources/icons/inline_button_url@2x.png | Bin 0 -> 234 bytes .../Resources/icons/intro_back_button.png | Bin 269 -> 0 bytes .../Resources/icons/intro_back_button@2x.png | Bin 447 -> 0 bytes Telegram/Resources/icons/title_next.png | Bin 0 -> 154 bytes Telegram/Resources/icons/title_next@2x.png | Bin 0 -> 261 bytes Telegram/Resources/icons/title_previous.png | Bin 0 -> 148 bytes .../Resources/icons/title_previous@2x.png | Bin 0 -> 264 bytes Telegram/Resources/icons/title_search.png | Bin 0 -> 416 bytes Telegram/Resources/icons/title_search@2x.png | Bin 0 -> 850 bytes .../Resources/icons/topbar_back_arrow.png | Bin 209 -> 0 bytes .../Resources/icons/topbar_back_arrow@2x.png | Bin 344 -> 0 bytes Telegram/SourceFiles/boxes/boxes.style | 2 +- Telegram/SourceFiles/history/history_item.cpp | 8 ++-- Telegram/SourceFiles/history/history_item.h | 6 +-- .../SourceFiles/history/history_message.cpp | 30 ++++++------- .../SourceFiles/history/history_message.h | 2 +- Telegram/SourceFiles/historywidget.cpp | 22 ++++----- Telegram/SourceFiles/historywidget.h | 2 +- Telegram/SourceFiles/overviewwidget.cpp | 8 ++-- Telegram/SourceFiles/profile/profile.style | 4 +- Telegram/SourceFiles/ui/popupmenu.h | 2 +- .../SourceFiles/window/top_bar_widget.cpp | 5 ++- Telegram/SourceFiles/window/top_bar_widget.h | 3 +- 29 files changed, 67 insertions(+), 69 deletions(-) rename Telegram/Resources/icons/{box_search_icon.png => box_search.png} (100%) rename Telegram/Resources/icons/{box_search_icon@2x.png => box_search@2x.png} (100%) create mode 100644 Telegram/Resources/icons/inline_button_switch.png create mode 100644 Telegram/Resources/icons/inline_button_switch@2x.png create mode 100644 Telegram/Resources/icons/inline_button_url.png create mode 100644 Telegram/Resources/icons/inline_button_url@2x.png delete mode 100644 Telegram/Resources/icons/intro_back_button.png delete mode 100644 Telegram/Resources/icons/intro_back_button@2x.png create mode 100644 Telegram/Resources/icons/title_next.png create mode 100644 Telegram/Resources/icons/title_next@2x.png create mode 100644 Telegram/Resources/icons/title_previous.png create mode 100644 Telegram/Resources/icons/title_previous@2x.png create mode 100644 Telegram/Resources/icons/title_search.png create mode 100644 Telegram/Resources/icons/title_search@2x.png delete mode 100644 Telegram/Resources/icons/topbar_back_arrow.png delete mode 100644 Telegram/Resources/icons/topbar_back_arrow@2x.png diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index 8b3d643401..9040e248ed 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -346,7 +346,7 @@ versionColor: #777; shadowColor: rgba(0, 0, 0, 24); shadowToggleDuration: 200; -slideDuration: 2400; +slideDuration: 240; slideShift: 100px; slideFadeOut: 0.3; slideShadow: icon {{ "slide_shadow", #000000 }}; @@ -704,7 +704,7 @@ introBackButton: IconButton { icon: icon { { size(40px, 40px), #eeeeee }, - { "intro_back_button", #969696, point(12px, 12px) }, + { "title_previous", #969696, point(12px, 12px) }, }; iconPosition: point(0px, 0px); downIconPosition: point(0px, 0px); @@ -727,12 +727,13 @@ noContactsHeight: 100px; noContactsFont: font(fsize); noContactsColor: #777; +fieldSearchIcon: icon {{ "box_search", #aaaaaa, point(10px, 9px) }}; dlgFilter: flatInput(inpDefGray) { font: font(fsize); bgColor: #f2f2f2; phColor: #949494; phFocusColor: #a4a4a4; - icon: icon {{ "box_search_icon", #aaaaaa, point(10px, 9px) }}; + icon: fieldSearchIcon; width: 240px; height: 34px; @@ -742,29 +743,26 @@ dlgFilter: flatInput(inpDefGray) { topBarHeight: 54px; topBarBG: white; topBarDuration: 200; -topBarForwardPadding: margins(17px, 8px, 39px, 8px); +topBarForward: icon {{ "title_next", #a3a3a3 }}; +topBarBackward: icon {{ "title_previous", #a3a3a3 }}; topBarForwardAlpha: 0.6; -topBarForwardImg: sprite(31px, 104px, 9px, 16px); -topBarBackwardImg: sprite(22px, 104px, 9px, 16px); -topBarBackPadding: margins(15px, 7px, 9px, 7px); +topBarBack: icon {{ "title_previous", #259fd8 }}; topBarBackAlpha: 0.8; -topBarBackImg: sprite(65px, 112px, 9px, 16px); topBarBackColor: #005faf; topBarBackFont: font(16px); -topBarSearch: iconedButton(btnDefIconed) { - bgColor: transparent; - overBgColor: transparent; +topBarArrowPadding: margins(39px, 8px, 17px, 8px); +topBarSearch: IconButton { + width: 44px; + height: topBarHeight; - icon: sprite(84px, 374px, 18px, 18px); - iconPos: point(13px, 18px); - downIcon: sprite(84px, 374px, 18px, 18px); - downIconPos: point(13px, 18px); + icon: icon {{ "title_search", #000000 }}; + iconPosition: point(13px, 18px); + downIconPosition: point(13px, 18px); opacity: 0.22; overOpacity: 0.36; - width: 44px; - height: topBarHeight; + duration: 150; } topBarMinPadding: 5px; topBarButton: RoundButton { @@ -864,10 +862,8 @@ msgBotKbDuration: 200; msgBotKbFont: semiboldFont; msgBotKbOverOpacity: 0.1; msgBotKbIconPadding: 2px; -msgBotKbUrlIcon: sprite(188px, 338px, 10px, 10px); -//msgBotKbRequestPhoneIcon: msgBotKbUrlIcon; -//msgBotKbRequestLocationIcon: msgBotKbUrlIcon; -msgBotKbSwitchPmIcon: sprite(188px, 348px, 10px, 10px); +msgBotKbUrlIcon: icon {{ "inline_button_url", #ffffff }}; +msgBotKbSwitchPmIcon: icon {{ "inline_button_switch", #ffffff }}; msgBotKbButton: botKeyboardButton { margin: 5px; padding: 10px; @@ -1980,3 +1976,7 @@ infoButton: PeerAvatarButton { size: topBarHeight; photoSize: 42px; } + +// forward declaration for single "title_previous" usage. +profileTopBarBackIconFg: #0290d7; +profileTopBarBackIcon: icon {{ "title_previous", profileTopBarBackIconFg }}; diff --git a/Telegram/Resources/icons/box_search_icon.png b/Telegram/Resources/icons/box_search.png similarity index 100% rename from Telegram/Resources/icons/box_search_icon.png rename to Telegram/Resources/icons/box_search.png diff --git a/Telegram/Resources/icons/box_search_icon@2x.png b/Telegram/Resources/icons/box_search@2x.png similarity index 100% rename from Telegram/Resources/icons/box_search_icon@2x.png rename to Telegram/Resources/icons/box_search@2x.png diff --git a/Telegram/Resources/icons/inline_button_switch.png b/Telegram/Resources/icons/inline_button_switch.png new file mode 100644 index 0000000000000000000000000000000000000000..04c85851218d788bc5d03d29c9491899b89260d6 GIT binary patch literal 228 zcmV@1>!m+%N_JcHmB>^(%vx5cvluKU3>k2f>CM?{3< zD5YSn#Z{-Pz&Qs1bY1t~m?R0lIOl#FjWL*}2}hcy*^N?4jN^zW`o702iXs|@fwb22 zL%d%~AU02NWe7aUu)#tVM9?P;I&vV3a3?am3D$8;Y)3z-t;|W9%eI eDNz)~t?)Mt5WHbe3qxc80000sX8JHj^l_ZioOd1Kp2MK1trkyAb?lTmjkD1!gIuNd<|4p z6~6DIs;V9K0zJmEEQ1i@6k11;BnK>j*xn&$1!0Kj$K$CE9~`UrCzXFHUm?t~C%+ZK7ABTduOiF3}k8=~v_rl9LO zFvg%L%D;=v7~8KL=NtgAEDJo(lfIPO?RH#S6b1UehhZ4fr?(owKFhL%rfJf*{4{`l nQc9(No816D`E6|5ma4l0a5Nu}7WTkI00000NkvXXu0mjftc{Yq literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/inline_button_url.png b/Telegram/Resources/icons/inline_button_url.png new file mode 100644 index 0000000000000000000000000000000000000000..986d15cdadfa9b1ad13c1fc6a0d06800dcf541c1 GIT binary patch literal 146 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4MS8k8hDc29yWoOade8N*DQf$6PGMWswb%S1oA#<1 u3uX!iUA6AvaQgaeo0U>s$!gQuAB=8I3v#MlJkJ0vVeoYIb6Mw<&;$U(6EIN# literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/inline_button_url@2x.png b/Telegram/Resources/icons/inline_button_url@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..0b364c03cc9fd1a06624c87a0280f1be2a68206b GIT binary patch literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqEUF3yS?(Ivv)UI&&!b)Ho;eTragfx+}}VSJ;`u i*Js9ihwNI>$J|Pu?zZ|hk;j3KXYh3Ob6Mw<&;$Uzgj^Q@ literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/intro_back_button.png b/Telegram/Resources/icons/intro_back_button.png deleted file mode 100644 index 77727aed8c396759e90804ebf5866aa0a97d2945..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 269 zcmV+o0rLKdP)4n>5#AZ9Y*_kd8 z5uQ*K1)8S0tGmfrmSNv_06##Bq#yo(;M0doadaI$a6p97-ue9>)=37(TglCBrZnvQi41^GA!F zF8Id(R)a%`_>?@;4WzX`(#O%?(6Ru5&&C7jaie T7E*OM00000NkvXXu0mjfPLXNc diff --git a/Telegram/Resources/icons/intro_back_button@2x.png b/Telegram/Resources/icons/intro_back_button@2x.png deleted file mode 100644 index 73d38306dd8df4802c516b99b593600da355a1fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 447 zcmV;w0YLtVP)KUFcc}bo32;h`xf)Q1A)z0D@DOLZPd>&@Qf-bPxpLzf<52 z$*o4cxd;9!Cf^@(l9Lb-VJSsXgrX?m`~H-E%fJtZ1EiDyfTAeidEVa{2*VI{UE^m6 zA+XtO);ACY0bZ{cbdhD*$Npb5BN$_JyWMEF+iBaSl%vM6nz`@$csw53nFGM}dR;FE zJkLX(=SH{?V%=RJgfPPMJfE@yrW?qz%m}~V?^Dl!X$I0XHNwlX1Y^u5pT>Q7xm=9! zs;UqKfmJe(GLR&R5nk6d!Z5Uje>M=uF@|B#!ljhh@Aq@yzZ>A3qwjkyylEOlQ8X8B zHgG&1(KL+~-gO-~=S#rN2A~w7 pHIDTkP;&Y-Q*!z^RkC@We*^2F(oIASqM!f(002ovPDHLkV1m7i$J_t_ diff --git a/Telegram/Resources/icons/title_next.png b/Telegram/Resources/icons/title_next.png new file mode 100644 index 0000000000000000000000000000000000000000..62fd6f27605b6d7ca7877d1b6bd744cc5607beed GIT binary patch literal 154 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`iJmTwAr`$`C!gj#V8G+-+xCIs zR=t$&lDN;Aw>Y-5#j8~OkQQ8MXB@1;>acnH$v_27Preiph8+_^O%%VkG2WbB&QU3M ziSbEosPU5TQ8fbpw+2WhW%e$0)|y}RbLO4$eGD^0Qezu;#peMnWAJqKb6Mw<&;$Vc CCN&}e literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/title_next@2x.png b/Telegram/Resources/icons/title_next@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..04dd1b4c6e16596db2944a67389acdd20234c85e GIT binary patch literal 261 zcmV+g0s8)lP)h|niHA?{6ZK-^aw zBi7c=5V5>@tPtw}Bg7uy3c<`8#6DmXVFMV5*4h`M_x^Lv^fG!P{(lKVH(}^!7t-TQRsCX+K_~{WT8!Icw3%x_AEXJc>kKI_CV;*=_|sxumFIZiuQj>#T8i500000 LNkvXXu0mjf>z-%A literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/title_previous.png b/Telegram/Resources/icons/title_previous.png new file mode 100644 index 0000000000000000000000000000000000000000..0cc9212f4a4d607f60f95bb0037001f0df535f84 GIT binary patch literal 148 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`(Vi}jAr`$`FCXM&P~>sBxWRQv z!^{1%GBa#mv-vFIn)k#$pl9aHGU*17Q+F4Cj?wW{$vz;(e1iF;1sm5#d5vSn7dp}x w2)^FT{raA0pZvy7n;#yoPaYbq^)NZdEc-k)HYfDj5uh~;p00i_>zopr0I^av^#A|> literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/title_previous@2x.png b/Telegram/Resources/icons/title_previous@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..71efbcf01844ea9368d9684f945f08140bc3b788 GIT binary patch literal 264 zcmV+j0r&oiP)=?N0igIA02sFez;PSEA+85F z#dQG3_-}x7d=6k{>Aic#$AC@oF`%{f6|c3Ti zf&iryd7krpJ}veUO4HOLNs>4pv{)=G_7(HrrK+j`D2l@S{_;Erpss5-)O8&IaU6Rg zr4#^t-@Bo4903T!&5P>m3Bxb|kY(BD9vuz`i|uwh=JPpW7!t=ZMNwF!EK7HfwAQq3 z3t+KNQ*;;FiF#xn}YhxadNACAK<2cfF9aUA4rm6d1Q%cb^4FJX%wAS8F?>OI) zrfGhIAWA8&*X#cwB1G>_7-J;MGP&Ju-tK&wKVQ*AM1GBki2MamSMa^j=aAz70000< KMNUMnLSTaa$G#Q- literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/title_search@2x.png b/Telegram/Resources/icons/title_search@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..12e04f843ba70c249a3a2059fbb15050a80ea439 GIT binary patch literal 850 zcmV-Y1FigtP)7-ByF zIv74cG4cO~_waFhtK7oV=Rdg#r`+@J@1AqoR3akKkcvj5w7R-Vi9~|t=H_T>YKn-6 z+U+*kwoRsK(&_0b-QV8}`C-tNN~O?fG$5**n;WdGtn~Bs527dv%H^^!h+D_U#~2$M z`!_(LPzaV~4Gh!O-Q67~CntvkQWWJwn6tAptgWqKW@ZMXqoW80g9wMiNT<`NR4RCT zd-H_ysFXNRsZ`=jo6RO-u~^^S#l=NDJUn=|Zy=y#GRc|MYBi{;Dtw^v@o`*STyQ?F zK^HSKO_QsPADCV!ccpG`Z~X!3y3U;{9*_Hm>205TrWO_!#DNNh0+U>=RtJXZu1clC zc<%4-gNP6y0WB{tGx5pEiAdU~a(g5aiTB@qPt$6(nA1cek)bOT4u=`f=jUhfmN|~Y zB+IfqG*B=YWIQ{aj(E!g0ikWaBuSF@y+o2GaS*ZV%Hm-+%WV!1?)k?!{;r#=rv|i^VvK(B9r2WAqV}A6b@#P$=YeKYuU)plKS4#iHkDsfbFYl2>K=1Gzsty6PQt z_tW>8Ow&X%ne5jQ??3YSyr*d{m*e*8x{iE4kE^RIJUu<(_4O5wWHNMcaKK&vE@5+X^Sv@#TU-C7GTk*oM09j?M1eqnBuS#f!^1DHz-N;F cko_3_0>+P3l(lMUV*mgE07*qoM6N<$f-L-(#Q*>R literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/topbar_back_arrow.png b/Telegram/Resources/icons/topbar_back_arrow.png deleted file mode 100644 index ab084438e09f9a9e51e5d6608fcb2150f0fe0cb2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 209 zcmV;?051QDP)sWr5VDCUcs(^uTSHudF5>YeeMypNr7;HYJ(75+ z5ylwB7&XuHS^H3!ripFa04Sv}jw9*--jKDHecu5{DKQMgwS#cZoxrjz-vDyXaU2H# zF~(m&LLmeIYOPpnn|AambbuttonSkip() + _rows.size() * _st->buttonHeight(); } -void ReplyKeyboard::paint(Painter &p, const QRect &clip) const { +void ReplyKeyboard::paint(Painter &p, int outerWidth, const QRect &clip) const { t_assert(_st != nullptr); t_assert(_width > 0); @@ -234,7 +234,7 @@ void ReplyKeyboard::paint(Painter &p, const QRect &clip) const { // just ignore the buttons that didn't layout well if (rect.x() + rect.width() > _width) break; - _st->paintButton(p, button); + _st->paintButton(p, outerWidth, button); } } } @@ -317,12 +317,12 @@ void ReplyKeyboard::clearSelection() { _a_selected.stop(); } -void ReplyKeyboard::Style::paintButton(Painter &p, const ReplyKeyboard::Button &button) const { +void ReplyKeyboard::Style::paintButton(Painter &p, int outerWidth, const ReplyKeyboard::Button &button) const { const QRect &rect = button.rect; bool pressed = ClickHandler::showAsPressed(button.link); paintButtonBg(p, rect, pressed, button.howMuchOver); - paintButtonIcon(p, rect, button.type); + paintButtonIcon(p, rect, outerWidth, button.type); if (button.type == HistoryMessageReplyMarkup::Button::Type::Callback || button.type == HistoryMessageReplyMarkup::Button::Type::Game) { if (auto data = button.link->getButton()) { diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index c445d2b480..0c61b2a87b 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -303,14 +303,14 @@ public: protected: virtual void paintButtonBg(Painter &p, const QRect &rect, bool pressed, float64 howMuchOver) const = 0; - virtual void paintButtonIcon(Painter &p, const QRect &rect, HistoryMessageReplyMarkup::Button::Type type) const = 0; + virtual void paintButtonIcon(Painter &p, const QRect &rect, int outerWidth, HistoryMessageReplyMarkup::Button::Type type) const = 0; virtual void paintButtonLoading(Painter &p, const QRect &rect) const = 0; virtual int minButtonWidth(HistoryMessageReplyMarkup::Button::Type type) const = 0; private: const style::botKeyboardButton *_st; - void paintButton(Painter &p, const ReplyKeyboard::Button &button) const; + void paintButton(Painter &p, int outerWidth, const ReplyKeyboard::Button &button) const; friend class ReplyKeyboard; }; @@ -328,7 +328,7 @@ public: int naturalWidth() const; int naturalHeight() const; - void paint(Painter &p, const QRect &clip) const; + void paint(Painter &p, int outerWidth, const QRect &clip) const; ClickHandlerPtr getState(int x, int y) const; void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active); diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 7e7779f0d0..80c9c2d0df 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -323,18 +323,18 @@ void HistoryMessage::KeyboardStyle::paintButtonBg(Painter &p, const QRect &rect, } } -void HistoryMessage::KeyboardStyle::paintButtonIcon(Painter &p, const QRect &rect, HistoryMessageReplyMarkup::Button::Type type) const { +void HistoryMessage::KeyboardStyle::paintButtonIcon(Painter &p, const QRect &rect, int outerWidth, HistoryMessageReplyMarkup::Button::Type type) const { using Button = HistoryMessageReplyMarkup::Button; - style::sprite sprite; - switch (type) { - case Button::Type::Url: sprite = st::msgBotKbUrlIcon; break; - // case Button::Type::RequestPhone: sprite = st::msgBotKbRequestPhoneIcon; break; - // case Button::Type::RequestLocation: sprite = st::msgBotKbRequestLocationIcon; break; - case Button::Type::SwitchInlineSame: - case Button::Type::SwitchInline: sprite = st::msgBotKbSwitchPmIcon; break; - } - if (!sprite.isEmpty()) { - p.drawSprite(rect.x() + rect.width() - sprite.pxWidth() - st::msgBotKbIconPadding, rect.y() + st::msgBotKbIconPadding, sprite); + auto getIcon = [](Button::Type type) -> const style::icon* { + switch (type) { + case Button::Type::Url: return &st::msgBotKbUrlIcon; + case Button::Type::SwitchInlineSame: + case Button::Type::SwitchInline: return &st::msgBotKbSwitchPmIcon; + } + return nullptr; + }; + if (auto icon = getIcon(type)) { + icon->paint(p, rect.x() + rect.width() - icon->width() - st::msgBotKbIconPadding, rect.y() + st::msgBotKbIconPadding, outerWidth); } } @@ -347,11 +347,9 @@ int HistoryMessage::KeyboardStyle::minButtonWidth(HistoryMessageReplyMarkup::But using Button = HistoryMessageReplyMarkup::Button; int result = 2 * buttonPadding(), iconWidth = 0; switch (type) { - case Button::Type::Url: iconWidth = st::msgBotKbUrlIcon.pxWidth(); break; - //case Button::Type::RequestPhone: iconWidth = st::msgBotKbRequestPhoneIcon.pxWidth(); break; - //case Button::Type::RequestLocation: iconWidth = st::msgBotKbRequestLocationIcon.pxWidth(); break; + case Button::Type::Url: iconWidth = st::msgBotKbUrlIcon.width(); break; case Button::Type::SwitchInlineSame: - case Button::Type::SwitchInline: iconWidth = st::msgBotKbSwitchPmIcon.pxWidth(); break; + case Button::Type::SwitchInline: iconWidth = st::msgBotKbSwitchPmIcon.width(); break; case Button::Type::Callback: case Button::Type::Game: iconWidth = st::historySendingInvertedIcon.width(); break; } @@ -1280,7 +1278,7 @@ void HistoryMessage::draw(Painter &p, const QRect &r, TextSelection selection, u height -= h; int top = height + st::msgBotKbButton.margin - marginBottom(); p.translate(left, top); - keyboard->paint(p, r.translated(-left, -top)); + keyboard->paint(p, width, r.translated(-left, -top)); p.translate(-left, -top); } diff --git a/Telegram/SourceFiles/history/history_message.h b/Telegram/SourceFiles/history/history_message.h index 86058657d6..500c3d9574 100644 --- a/Telegram/SourceFiles/history/history_message.h +++ b/Telegram/SourceFiles/history/history_message.h @@ -214,7 +214,7 @@ private: protected: void paintButtonBg(Painter &p, const QRect &rect, bool down, float64 howMuchOver) const override; - void paintButtonIcon(Painter &p, const QRect &rect, HistoryMessageReplyMarkup::Button::Type type) const override; + void paintButtonIcon(Painter &p, const QRect &rect, int outerWidth, HistoryMessageReplyMarkup::Button::Type type) const override; void paintButtonLoading(Painter &p, const QRect &rect) const override; int minButtonWidth(HistoryMessageReplyMarkup::Button::Type type) const override; diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index ea4c7ae73d..0473b6fcfb 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -2430,7 +2430,7 @@ void BotKeyboard::paintEvent(QPaintEvent *e) { if (_impl) { int x = rtl() ? st::botKbScroll.width : _st->margin; p.translate(x, st::botKbScroll.deltat); - _impl->paint(p, clip.translated(-x, -st::botKbScroll.deltat)); + _impl->paint(p, width(), clip.translated(-x, -st::botKbScroll.deltat)); } } @@ -2460,7 +2460,7 @@ void BotKeyboard::Style::paintButtonBg(Painter &p, const QRect &rect, bool down, } } -void BotKeyboard::Style::paintButtonIcon(Painter &p, const QRect &rect, HistoryMessageReplyMarkup::Button::Type type) const { +void BotKeyboard::Style::paintButtonIcon(Painter &p, const QRect &rect, int outerWidth, HistoryMessageReplyMarkup::Button::Type type) const { // Buttons with icons should not appear here. } @@ -6259,16 +6259,16 @@ void HistoryWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) { if (!_history) return; - int32 increaseLeft = (Adaptive::OneColumn() || !App::main()->stackIsEmpty()) ? (st::topBarForwardPadding.right() - st::topBarForwardPadding.left()) : 0; + int increaseLeft = (Adaptive::OneColumn() || !App::main()->stackIsEmpty()) ? (st::topBarArrowPadding.left() - st::topBarArrowPadding.right()) : 0; decreaseWidth += increaseLeft; - QRect rectForName(st::topBarForwardPadding.left() + increaseLeft, st::topBarForwardPadding.top(), width() - decreaseWidth - st::topBarForwardPadding.left() - st::topBarForwardPadding.right(), st::msgNameFont->height); + QRect rectForName(st::topBarArrowPadding.right() + increaseLeft, st::topBarArrowPadding.top(), width() - decreaseWidth - st::topBarArrowPadding.left() - st::topBarArrowPadding.right(), st::msgNameFont->height); p.setFont(st::dialogsTextFont); if (_history->typing.isEmpty() && _history->sendActions.isEmpty()) { p.setPen(_titlePeerTextOnline ? st::titleStatusActiveFg : st::titleStatusFg); - p.drawText(rectForName.x(), st::topBarHeight - st::topBarForwardPadding.bottom() - st::dialogsTextFont->height + st::dialogsTextFont->ascent, _titlePeerText); + p.drawText(rectForName.x(), st::topBarHeight - st::topBarArrowPadding.bottom() - st::dialogsTextFont->height + st::dialogsTextFont->ascent, _titlePeerText); } else { p.setPen(st::titleTypingFg); - _history->typingText.drawElided(p, rectForName.x(), st::topBarHeight - st::topBarForwardPadding.bottom() - st::dialogsTextFont->height, rectForName.width()); + _history->typingText.drawElided(p, rectForName.x(), st::topBarHeight - st::topBarArrowPadding.bottom() - st::dialogsTextFont->height, rectForName.width()); } p.setPen(st::dialogsNameFg); @@ -6276,17 +6276,17 @@ void HistoryWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) { if (Adaptive::OneColumn() || !App::main()->stackIsEmpty()) { p.setOpacity(st::topBarForwardAlpha + (1 - st::topBarForwardAlpha) * over); - p.drawSprite(QPoint((st::topBarForwardPadding.right() - st::topBarBackwardImg.pxWidth()) / 2, (st::topBarHeight - st::topBarBackwardImg.pxHeight()) / 2), st::topBarBackwardImg); + st::topBarBackward.paint(p, (st::topBarArrowPadding.left() - st::topBarBackward.width()) / 2, (st::topBarHeight - st::topBarBackward.height()) / 2, width()); } else { p.setOpacity(st::topBarForwardAlpha + (1 - st::topBarForwardAlpha) * over); - p.drawSprite(QPoint(width() - (st::topBarForwardPadding.right() + st::topBarForwardImg.pxWidth()) / 2, (st::topBarHeight - st::topBarForwardImg.pxHeight()) / 2), st::topBarForwardImg); + st::topBarForward.paint(p, width() - (st::topBarArrowPadding.left() + st::topBarForward.width()) / 2, (st::topBarHeight - st::topBarForward.height()) / 2, width()); } } QRect HistoryWidget::getMembersShowAreaGeometry() const { - int increaseLeft = (Adaptive::OneColumn() || !App::main()->stackIsEmpty()) ? (st::topBarForwardPadding.right() - st::topBarForwardPadding.left()) : 0; - int membersTextLeft = st::topBarForwardPadding.left() + increaseLeft; - int membersTextTop = st::topBarHeight - st::topBarForwardPadding.bottom() - st::dialogsTextFont->height; + int increaseLeft = (Adaptive::OneColumn() || !App::main()->stackIsEmpty()) ? (st::topBarArrowPadding.left() - st::topBarArrowPadding.right()) : 0; + int membersTextLeft = st::topBarArrowPadding.right() + increaseLeft; + int membersTextTop = st::topBarHeight - st::topBarArrowPadding.bottom() - st::dialogsTextFont->height; int membersTextWidth = _titlePeerTextWidth; int membersTextHeight = st::topBarHeight - membersTextTop; diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 2a5532db5e..f9906c92dd 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -423,7 +423,7 @@ private: protected: void paintButtonBg(Painter &p, const QRect &rect, bool down, float64 howMuchOver) const override; - void paintButtonIcon(Painter &p, const QRect &rect, HistoryMessageReplyMarkup::Button::Type type) const override; + void paintButtonIcon(Painter &p, const QRect &rect, int outerWidth, HistoryMessageReplyMarkup::Button::Type type) const override; void paintButtonLoading(Painter &p, const QRect &rect) const override; int minButtonWidth(HistoryMessageReplyMarkup::Button::Type type) const override; diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index 473ed6efa3..c1a2ba9b69 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -1982,10 +1982,10 @@ void OverviewWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) return; } p.setOpacity(st::topBarBackAlpha + (1 - st::topBarBackAlpha) * over); - p.drawSprite(QPoint(st::topBarBackPadding.left(), (st::topBarHeight - st::topBarBackImg.pxHeight()) / 2), st::topBarBackImg); - p.setFont(st::topBarBackFont->f); - p.setPen(st::topBarBackColor->p); - p.drawText(st::topBarBackPadding.left() + st::topBarBackImg.pxWidth() + st::topBarBackPadding.right(), (st::topBarHeight - st::topBarBackFont->height) / 2 + st::topBarBackFont->ascent, _header); + st::topBarBack.paint(p, (st::topBarArrowPadding.left() - st::topBarBack.width()) / 2, (st::topBarHeight - st::topBarBack.height()) / 2, width()); + p.setFont(st::topBarBackFont); + p.setPen(st::topBarBackColor); + p.drawText(st::topBarArrowPadding.left(), (st::topBarHeight - st::topBarBackFont->height) / 2 + st::topBarBackFont->ascent, _header); } void OverviewWidget::topBarClick() { diff --git a/Telegram/SourceFiles/profile/profile.style b/Telegram/SourceFiles/profile/profile.style index 45ede8414e..b9f1409596 100644 --- a/Telegram/SourceFiles/profile/profile.style +++ b/Telegram/SourceFiles/profile/profile.style @@ -24,9 +24,7 @@ using "basic_types.style"; profileBg: windowBg; profileTopBarHeight: topBarHeight; -profileTopBarBackIconFg: #0290d7; -profileTopBarBackIcon: icon {{ "topbar_back_arrow", profileTopBarBackIconFg }}; -profileTopBarBackIconPosition: point(15px, 20px); +profileTopBarBackIconPosition: point(12px, 20px); profileTopBarBackFont: font(14px); profileTopBarBackFg: #1485c2; profileTopBarBackPosition: point(32px, 17px); diff --git a/Telegram/SourceFiles/ui/popupmenu.h b/Telegram/SourceFiles/ui/popupmenu.h index aa4dc29e62..4413ec5439 100644 --- a/Telegram/SourceFiles/ui/popupmenu.h +++ b/Telegram/SourceFiles/ui/popupmenu.h @@ -51,7 +51,7 @@ protected: void focusOutEvent(QFocusEvent *e) override; void hideEvent(QHideEvent *e) override; -public slots: +private slots: void actionChanged(); private: diff --git a/Telegram/SourceFiles/window/top_bar_widget.cpp b/Telegram/SourceFiles/window/top_bar_widget.cpp index bb2f68d20e..703adf37a9 100644 --- a/Telegram/SourceFiles/window/top_bar_widget.cpp +++ b/Telegram/SourceFiles/window/top_bar_widget.cpp @@ -28,6 +28,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "lang.h" #include "ui/buttons/peer_avatar_button.h" #include "ui/buttons/round_button.h" +#include "ui/buttons/icon_button.h" #include "ui/flatbutton.h" namespace Window { @@ -144,7 +145,7 @@ void TopBarWidget::paintEvent(QPaintEvent *e) { int decreaseWidth = 0; if (!_info->isHidden()) { decreaseWidth += _info->width(); - decreaseWidth -= st::topBarForwardPadding.right(); + decreaseWidth -= st::topBarArrowPadding.left(); } if (!_search->isHidden()) { decreaseWidth += _search->width(); @@ -181,7 +182,7 @@ void TopBarWidget::resizeEvent(QResizeEvent *e) { if (!_info->isHidden()) _info->move(r -= _info->width(), 0); if (!_mediaType->isHidden()) _mediaType->move(r -= _mediaType->width(), 0); - _search->move(width() - (_info->isHidden() ? st::topBarForwardPadding.right() : _info->width()) - _search->width(), 0); + _search->move(width() - (_info->isHidden() ? st::topBarArrowPadding.left() : _info->width()) - _search->width(), 0); } void TopBarWidget::startAnim() { diff --git a/Telegram/SourceFiles/window/top_bar_widget.h b/Telegram/SourceFiles/window/top_bar_widget.h index f9206d1214..df5f6a41a1 100644 --- a/Telegram/SourceFiles/window/top_bar_widget.h +++ b/Telegram/SourceFiles/window/top_bar_widget.h @@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org namespace Ui { class PeerAvatarButton; class RoundButton; +class IconButton; } // namespace Ui class IconedButton; @@ -87,7 +88,7 @@ private: ChildWidget _info; ChildWidget _mediaType; - ChildWidget _search; + ChildWidget _search; ChildWidget _membersShowArea = { nullptr }; };