From a1a845dbf1e8138e04e1648dd52b1ac25edec216 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 15 Sep 2020 14:47:42 +0300 Subject: [PATCH] Improve Replies chat design. --- Telegram/Resources/icons/replies_userpic.png | Bin 0 -> 441 bytes .../Resources/icons/replies_userpic@2x.png | Bin 0 -> 909 bytes .../Resources/icons/replies_userpic@3x.png | Bin 0 -> 1499 bytes Telegram/Resources/langs/lang.strings | 2 +- Telegram/SourceFiles/dialogs/dialogs.style | 1 + Telegram/SourceFiles/ui/empty_userpic.cpp | 79 +++++------------- 6 files changed, 21 insertions(+), 61 deletions(-) create mode 100644 Telegram/Resources/icons/replies_userpic.png create mode 100644 Telegram/Resources/icons/replies_userpic@2x.png create mode 100644 Telegram/Resources/icons/replies_userpic@3x.png diff --git a/Telegram/Resources/icons/replies_userpic.png b/Telegram/Resources/icons/replies_userpic.png new file mode 100644 index 0000000000000000000000000000000000000000..88d5e84192d66b842c61ba0a9cbdd18149a8be3f GIT binary patch literal 441 zcmeAS@N?(olHy`uVBq!ia0vp^dLYcf1|-9GYMTQomUKs7M+SzC{oH>NSs54@3p`yM zLo!(3PIp|@Y#`vUT(9K)rQ#RYoGTdKKNMv7m>_pVct?QaWuKLF9aS59Sa#XMV$lB?dmK{*WzUtdfc{XPHAzL&H3UL ztGE`Oc)8)fpICYOo5kz0x8}}1bm7CBk32K(I4SQjtFQgAIkV+hHFLDyuM55GEyp@9 zA7FOAd_bQemp@MAX!h3%9YwL_mGiC|@T_`YJ$0Gp_H%E&mge4Of3@$u*opexeUDe1 z+VteW?Z)Ds{g0Jx4)2k*s5^5->ii}jQ{TncN^8$Do^IRWaHF~SfuZ=r{sXhVbDe8+ z|Lp#N{k7~I=K6+YX_i02drrnZ6?*XggWB%HryG=QX1QhTmH+?i*Uksq(`#QI%hx&0 zR4CINC#C2q^t%1`&(NO@S4(AmF0gTe~DWM4f%*M!% literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/replies_userpic@2x.png b/Telegram/Resources/icons/replies_userpic@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..a9d00481fbfa804e016e2644d6561fde776dd3ad GIT binary patch literal 909 zcmeAS@N?(olHy`uVBq!ia0vp^F(Ayr1|%Q9zZ3zaSkfJR9T^xl_H+M9WMyDrcJXv^ z45?szd&@TOlY;=;gQwaP1e&Hzi)PSeUH(8UriuB&r3*m?Tr4sS7lS?q2Pi1sI;+>j z!8-fQ^E3NiA6c);?Q+ccS>mSb!_#^Uuf4tF!1UjtG~$__LqUPIz?=sOj0Kiu76%V9 zJt%rp(A3O&;OUKrEbQD3r#BwvH|C$4?_aZ<{pMfa)7Rg-$(2t~lt2G` z^W7Y?GOM|_>h|Zq{#rHR`}g^Ii4*4gCvA;tEfIZgH`lMsK;lNxP8nf4n;%b$1Q#nX zJ^#Ej*F-Atg7$aUhGFt*#Zz^o+UcXZh`f!z- z?M}I%)ZdFc_r{%<<7*G8s6Y9mgVpBIf#k)@JAc0}VfeC`P0U8E>eh!x`F;OPDs)Qh zm#OFe>-%!P`MAS(;mliM93LcJw6eP|7XDLr`Qu&H#n+5Do9ypC-Rpckio@lD`iJtv z-PeN5o9Y?;fg)!-Kd=<^zdN3@J?7`Oj?2lrpPtgXern@E#ry5n2kzwX*?f%gQuP#{rBJX=lfmC)_3&M7vZZhnz`qK>fUccOMWz+N_lebdH9o$`)}~K zAHJRPM&I;r@sssGT4$SxN}C3+I>f6vbBYMR(hj9%DxwEfy}Arp!jDW@qO`-s)3EJ9 z*NjOaEYmeKj|s#G22bjGAf$R!qDec+D@ZVA(Gm&g0#_eTttRg&BFP-NSs55uCwaO! zhEy=Vy=$wl6DV{15iZhKfKRKz z?I?b}g_|b#2Ax(&K$pCd@w2e`n_zmB#HX z4NR<>j0-#r16f3PJUAI#yE>H?Bsh36XaxC)FtRcSF*!_3TEw9tF+qr-OGMb!;b6lQ zhJYnAG?=*9masG^9d!{5Fi=os5YbfYYG`7lhf#muOyStId-vTVM_Qz%q>9qh)AQ=< z_XnHp-SU=4-XrGq`iBn_>x+sW+51ULOYhsifB&`Hu|@l@NuPZ2V#WU5yMJdqIscu} z`()y^%F3^;liHuep8oNpVy^Y}ExD`Tp3G@GlAD{mv$3)9PIAeLWG%l1(*ig z-OSU1`8C!maekG(uroC;`B#90&{F=zYnJ%jtk>mMx%f-}R@c8*4~)uwD|Fr}4-5~J z5}V-ie)|jU9BFP3t(TjfKy~n@)z1DC=uD`$k@0&Mk@=c_s zrbRi;59@xknRmvVIX-8d6RZ3C`f6^hJHO4m^|{Zzhhq1F0=H-8RTqX^~k` zm$%Khv$*6C?|H`4j~*pm?%QZ__zq{-TsPaw^qu-v9vfp>Txt)1+dwkrF zm1nsZFLY@;XSR?8AN ze}DeOunFtw)z$31_&(Q}bK%mCrR&$9fB*LF$p|)f_O;0y`BhVOUd>CbtCQ16ed`r` zXLHNp2}Wzzu4P=Rqp|W`Li+kn8e1$GA_;0SeeM_{Cv^NmoGUr z?lY>Y>O8dSHmVKxQ`I%^4fNmK>-&^NT!U?$#mL)6!PQ|LFX=!f)Fc6fHaP&}-d4<-J!H&ZvFAahvg#)vNy1+e%J3 zbS$baIpVm3=9{JYdLFV~x&CSUciy+o`{>YlCI?!PC{xWt~$(69CgVhid=; literal 0 HcmV?d00001 diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 52e1bcdf3..0ac70fd9f 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1357,7 +1357,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_comments_open_count#one" = "{count} comment"; "lng_comments_open_count#other" = "{count} comments"; "lng_comments_open_none" = "Leave a comment"; -"lng_replies_view_original" = "View reply"; +"lng_replies_view_original" = "View in chat"; "lng_replies_messages" = "Replies"; "lng_archived_name" = "Archived chats"; diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style index 8ec8e0fff..a9dcfc89d 100644 --- a/Telegram/SourceFiles/dialogs/dialogs.style +++ b/Telegram/SourceFiles/dialogs/dialogs.style @@ -191,6 +191,7 @@ dialogsBotIconActive: icon {{ "dialogs_bot", dialogsChatIconFgActive, point(1px, //dialogsFeedIconOver: icon {{ "dialogs_feed", dialogsChatIconFgOver, point(4px, 4px) }}; //dialogsFeedIconActive: icon {{ "dialogs_feed", dialogsChatIconFgActive, point(4px, 4px) }}; dialogsArchiveUserpic: icon {{ "archive_userpic", historyPeerUserpicFg }}; +dialogsRepliesUserpic: icon {{ "replies_userpic", historyPeerUserpicFg }}; dialogsSendStateSkip: 20px; dialogsSendingIcon: icon {{ "dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }}; diff --git a/Telegram/SourceFiles/ui/empty_userpic.cpp b/Telegram/SourceFiles/ui/empty_userpic.cpp index 8db3cf24f..ba07e0cc2 100644 --- a/Telegram/SourceFiles/ui/empty_userpic.cpp +++ b/Telegram/SourceFiles/ui/empty_userpic.cpp @@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/animation_value.h" #include "app.h" #include "styles/style_history.h" +#include "styles/style_dialogs.h" namespace Ui { namespace { @@ -98,66 +99,24 @@ void PaintRepliesMessagesInner( int size, const style::color &bg, const style::color &fg) { - // |<---width--->| - // - // X --- - // XX | - // X X | - // X XXXXXXX | - // X XX height - // X XXXXX X | - // X X XXX X | - // XX XXX | - // X X --- - - const auto thinkness = std::round(size * 0.055); - const auto increment = int(thinkness) % 2 + (size % 2); - const auto width = std::round(size * 0.2) * 2 + increment; - const auto arrow = std::round(width * 27. / 57.); - const auto height = 2 * arrow; - const auto tail = std::round(height / 5.); - const auto add = std::round(size * 0.064); - - const auto left = x + (size - width) / 2; - const auto top = y + (size - height) / 2; - const auto right = left + width; - const auto bottom = top + height; - const auto middle = (left + arrow); - const auto half = (top + bottom) / 2; - const auto tailtop = half - tail; - const auto tailbottom = half + tail; - const auto starttop = (top + tailtop) / 2; - - const auto bottomcsize = (bottom - tailbottom); - const auto bottomc1x = middle + bottomcsize; - const auto bottomc1y = tailbottom; - const auto bottomc2x = right - bottomcsize / 1.42; - const auto bottomc2y = bottom - bottomcsize / 1.42; - - const auto topcsize = (bottom - tailbottom) * 1.5; - const auto topc1x = middle + topcsize; - const auto topc1y = tailtop; - const auto topc2x = right; - const auto topc2y = bottom - topcsize; - - p.setBrush(Qt::NoBrush); - auto pen = fg->p; - pen.setWidthF(thinkness); - pen.setCapStyle(Qt::FlatCap); - - { - pen.setJoinStyle(Qt::MiterJoin); - p.setPen(pen); - QPainterPath path; - path.moveTo(middle, starttop); - path.lineTo(middle, top); - path.lineTo(left, half); - path.lineTo(middle, bottom); - path.lineTo(middle, tailbottom); - path.cubicTo(bottomc1x, bottomc1y, bottomc2x, bottomc2y, right, bottom); - path.cubicTo(topc2x, topc2y, topc1x, topc1y, middle, tailtop); - path.lineTo(middle, starttop); - p.drawPath(path); + if (size == st::dialogsPhotoSize) { + const auto rect = QRect{ x, y, size, size }; + st::dialogsRepliesUserpic.paintInCenter( + p, + rect, + fg->c); + } else { + p.save(); + const auto ratio = size / float64(st::dialogsPhotoSize); + p.translate(x + size / 2., y + size / 2.); + p.scale(ratio, ratio); + const auto skip = st::dialogsPhotoSize; + const auto rect = QRect{ -skip, -skip, 2 * skip, 2 * skip }; + st::dialogsRepliesUserpic.paintInCenter( + p, + rect, + fg->c); + p.restore(); } }