From f6c8504af059d33508e6db49916a258df0710d68 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Sun, 11 Sep 2022 03:55:40 +0300 Subject: [PATCH] [Improvement] Chat icon before message author name --- .../icons/dialogs/dialogs_sponsored.png | Bin 0 -> 2051 bytes .../icons/dialogs/dialogs_sponsored@2x.png | Bin 0 -> 2142 bytes .../icons/dialogs/dialogs_sponsored@3x.png | Bin 0 -> 2131 bytes .../history/view/history_view_message.cpp | 192 ++++++++++++- Telegram/SourceFiles/ui/chat/chat.style | 67 +++++ Telegram/SourceFiles/ui/chat/chat_style.cpp | 66 +++++ Telegram/SourceFiles/ui/chat/chat_style.h | 264 ++++++++++++++++++ 7 files changed, 587 insertions(+), 2 deletions(-) create mode 100644 Telegram/Resources/icons/dialogs/dialogs_sponsored.png create mode 100644 Telegram/Resources/icons/dialogs/dialogs_sponsored@2x.png create mode 100644 Telegram/Resources/icons/dialogs/dialogs_sponsored@3x.png diff --git a/Telegram/Resources/icons/dialogs/dialogs_sponsored.png b/Telegram/Resources/icons/dialogs/dialogs_sponsored.png new file mode 100644 index 0000000000000000000000000000000000000000..e7d5764e39fd0128af398112ec210bf7a139d069 GIT binary patch literal 2051 zcmb_de~1)S9G^9-b4^gZNW?#;G3vx-=gp6u-5GAZuHCC!XwUUre?iH;dGls>xSb!) z%--&4S;!eCgcTvCrgfl!h=_kkT%v|>MMgme3Pt@PQIK$;L`Z?X*T|Xp`Flw||RI#+HUxggSV5 z8AUzxp;_1*Y|g!)BFBnB-O+HYX1N4SQQbW?7ouSt&>Ak9c8Zz$iYQoWSu*&MegJ z>AM1u(&lpQ7&B_Itab=L=o=wvGz&5#+AoZ{m>a~tQ}Gb)8zC}RhS|7k+QTq#yn^GD zTaC)MB-811*cgTG+GN_gQ}tI(TZ1z&z$qr2XL-Q#NJfQ+*H4s$*8ql1ho5pAh zD)1~XutK5$NRMSTem9i3Mu!3XPq20&G$?G*$u#8bCv`BEc5hTF)e(8Z1v|4OQucQIa)T z<9Wo&5b10}kpvbZ0kS#|ks%?%rU;>->mE`2O`mjcwE2mw$J?4uWs|PkLWL-_dx}9} zpRvv~hs_!4F{jAQ_0G$Etz10IAfw+!D7D}X% zdR#(m5+n>#x1^|unjq^2YGwa#^}H$yDlfLId!Oo?#X%)#7ctpEIp+TJnVUNsLR!85a&u<;xMR&aX zo-r9Jz^6FYhKfHt*I+wp%xgtrwPMklr`u!L8_g#^0 zMyMT~Uz|DjRnLVVwyn4s>5gvL@aFZd%Yu=8=XFR=Ozk)cmPDw@gzd1I%Gd!lVeFK?O&kpVS3uow_=>Px# literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/dialogs/dialogs_sponsored@2x.png b/Telegram/Resources/icons/dialogs/dialogs_sponsored@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..cc7a92fce2fc6b7030011f1c3a491dbddbad65ac GIT binary patch literal 2142 zcmb_ee{2&~9KSIk8w7)F0x=^wk3Sr+>;3GtchHfs!Zx97u*MBA>brNZ?XmXmxVx?0 z5`rv(L8hoEq7KabV=-tTV3f=mC36H7;*aphz=Y`3h$vG~hzc?BUDsAnKtgQN-n)07 z_xXIjKkmJ5ZCX(`b@Dxv34)l~P#<1}uO$A?D4BqNeG5v<@TJtMU+oaY6g-|%Rz$qi zJBuJD_36=8w>7d{fo94FG*d;sOv=J&f>^jHV*%KPTvA1G-3U=X557;4x)!2Z{1G-{ z)uM!6-({obt`$+()dppaT2xIg%qW;3gpQc1&6G9fC#pJ~S#PL^ecE{mCt==z zy72fK0i4=Mq@ZzKFR4^P!f}^$;4pFtxh~p?c3Oy8g&ecphGY0pen`Ulb)8Z~=*q2@uLE3JQJ}ST<$~;0W9b`q8R#_3yDhE~CFUv6~sKEda0(rJZTgR^&NM6nA zxzaGBD5;Xlagde()aZaL@-%=vpfwJ_mz1Qx`V6NnR`W=(fZsdsgv2Z zPyqDWJw!pT&Pbzj)B1JtaZAd%_2~q{q&F%4xVmG;+%&LJO&sU$R{D#%k$(qt+}u6O zLDsK9fd--|(wbj{xDtUF&RbBB1(lby7|ciiZ}*%c@Cqm7TlY5I=aK^xz=$KfgEG|Z z$8&4lIc_u`&kf(N|1}=Q+dIcwjrnI6W}jWP&*E}sr|{CXTtvhMhxd zu;O6zuDd!*p6)-p?yVm#b)9qh7a#P^l(rwckU8Ept!CPV8HZzU-n)H&<^3zmFOBRv zGf;JGxF;Am{PtLXCd74599Xk|WOxht_1KxOItFKNuUlEZ`U87l`Lo}?UOr>nk?!3? z6?YVMSKN1s?YX@5$exQ={=B?l*TBZRGbcy(_MbSrY;M(u->2h2Vq^KlbH80NiYnhA omY?W(wenp3Ym58NH(o4Wd*!1S4r#sp-amkbB`d=F7C+Mc7q9Qr7XSbN literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/dialogs/dialogs_sponsored@3x.png b/Telegram/Resources/icons/dialogs/dialogs_sponsored@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..9d0596611a6acbeac64a4d6fbdfde37ae84836d9 GIT binary patch literal 2131 zcmb_d3v3ic7+#>i0JI~?gRxS#7p*ecJ`a^ z|GxkKcV<+RAxL2d(79C7u+?0M$@8jY>`rqGorgHBA*RX=NH=Ox zy4tib?eqFsD9AoKpm+tpBrD1^TI7Ww#|JqOe+P5XFUa)F_$))8M>57wc1RY770w$ zNqH5TrbZ0g0S3g8aEKwcy}FK6ECnPG_X{i^5G6Js$N@I!1CWg)q{Iaz1VjZF*N07* zaf|D&@9%SDLc;NPR3DE(5Fy9{qy&jg8LahAtEe**Yq#jglOwmFtgJ~fcMnAKH< z2&3$e`{RNDSwDb?4Jfk60w@9&2>>Q!$U~rrZbRpLM6J_pQoZ)VCo&H|P#7h3I^Py5 zfNr~o80gj+Bc?E|UnU>d6uGcI+ky${Rf^vq-8K_W7Ff8dndI(T`ir}gejBu1T|F;A z-iM&X0$G+>IGF2RY5BD<8`VpBnP$tqZyMOlw+>n z&$V@DztEzeD}G=9s~^tYJNsLW`)3#C-(9rNl5*y!$mZ=1OQ!~TD4jdlAgQv*siO5- z3n^+qVJbPQuX26OHMBy^v1|@3l@Few`XeS zK1msgNameChat1IconSelected(), + st->msgNameChat2IconSelected(), + st->msgNameChat3IconSelected(), + st->msgNameChat4IconSelected(), + st->msgNameChat5IconSelected(), + st->msgNameChat6IconSelected(), + st->msgNameChat7IconSelected(), + st->msgNameChat8IconSelected(), + }; + return icons[Data::DecideColorIndex(peerId)]; + } else { + const style::icon icons[] = { + st->msgNameChat1Icon(), + st->msgNameChat2Icon(), + st->msgNameChat3Icon(), + st->msgNameChat4Icon(), + st->msgNameChat5Icon(), + st->msgNameChat6Icon(), + st->msgNameChat7Icon(), + st->msgNameChat8Icon(), + }; + return icons[Data::DecideColorIndex(peerId)]; + } +} + +style::icon FromChannelIcon( + const Ui::ChatPaintContext &context, + PeerId peerId) { + const auto st = context.st; + if (context.selected()) { + const style::icon icons[] = { + st->msgNameChannel1IconSelected(), + st->msgNameChannel2IconSelected(), + st->msgNameChannel3IconSelected(), + st->msgNameChannel4IconSelected(), + st->msgNameChannel5IconSelected(), + st->msgNameChannel6IconSelected(), + st->msgNameChannel7IconSelected(), + st->msgNameChannel8IconSelected(), + }; + return icons[Data::DecideColorIndex(peerId)]; + } else { + const style::icon icons[] = { + st->msgNameChannel1Icon(), + st->msgNameChannel2Icon(), + st->msgNameChannel3Icon(), + st->msgNameChannel4Icon(), + st->msgNameChannel5Icon(), + st->msgNameChannel6Icon(), + st->msgNameChannel7Icon(), + st->msgNameChannel8Icon(), + }; + return icons[Data::DecideColorIndex(peerId)]; + } +} + +style::icon FromDeletedIcon( + const Ui::ChatPaintContext &context, + PeerId peerId) { + const auto st = context.st; + if (context.selected()) { + const style::icon icons[] = { + st->msgNameDeleted1IconSelected(), + st->msgNameDeleted2IconSelected(), + st->msgNameDeleted3IconSelected(), + st->msgNameDeleted4IconSelected(), + st->msgNameDeleted5IconSelected(), + st->msgNameDeleted6IconSelected(), + st->msgNameDeleted7IconSelected(), + st->msgNameDeleted8IconSelected(), + }; + return icons[Data::DecideColorIndex(peerId)]; + } else { + const style::icon icons[] = { + st->msgNameDeleted1Icon(), + st->msgNameDeleted2Icon(), + st->msgNameDeleted3Icon(), + st->msgNameDeleted4Icon(), + st->msgNameDeleted5Icon(), + st->msgNameDeleted6Icon(), + st->msgNameDeleted7Icon(), + st->msgNameDeleted8Icon(), + }; + return icons[Data::DecideColorIndex(peerId)]; + } +} + +style::icon FromBotIcon( + const Ui::ChatPaintContext &context, + PeerId peerId) { + const auto st = context.st; + if (context.selected()) { + const style::icon icons[] = { + st->msgNameBot1IconSelected(), + st->msgNameBot2IconSelected(), + st->msgNameBot3IconSelected(), + st->msgNameBot4IconSelected(), + st->msgNameBot5IconSelected(), + st->msgNameBot6IconSelected(), + st->msgNameBot7IconSelected(), + st->msgNameBot8IconSelected(), + }; + return icons[Data::DecideColorIndex(peerId)]; + } else { + const style::icon icons[] = { + st->msgNameBot1Icon(), + st->msgNameBot2Icon(), + st->msgNameBot3Icon(), + st->msgNameBot4Icon(), + st->msgNameBot5Icon(), + st->msgNameBot6Icon(), + st->msgNameBot7Icon(), + st->msgNameBot8Icon(), + }; + return icons[Data::DecideColorIndex(peerId)]; + } +} + struct Message::CommentsButton { std::unique_ptr ripple; std::vector userpics; @@ -776,6 +900,25 @@ QSize Message::performCountOptimalSize() { } else if (replyWidth) { namew += st::msgPadding.right() + replyWidth; } + const auto hasChatTypeIcon = [&]() { + if (item->isSponsored()) { + return true; + } else if (!item->isPost() && item->displayFrom()) { + const auto from = item->displayFrom(); + if (from->isChat() || from->isMegagroup() || from->isChannel()) { + return true; + } else if (const auto user = from->asUser()) { + if (user->isInaccessible() + || (user->isBot() && !user->isSupport() && !user->isRepliesChat())) { + return true; + } + } + } + return false; + }(); + if (hasChatTypeIcon) { + namew += st::dialogsChatTypeSkip; + } accumulate_max(maxWidth, namew); } else if (via && !displayForwardedFrom()) { accumulate_max(maxWidth, st::msgPadding.left() + via->maxWidth + st::msgPadding.right()); @@ -1406,6 +1549,34 @@ void Message::paintFromName( availableWidth -= st::msgPadding.right() + rightWidth; } + const auto chatTypeIcon = [&]() -> std::optional { + if (item->isSponsored()) { + return context.selected() + ? context.st->msgNameSponsoredIconSelected() + : context.st->msgNameSponsoredIcon(); + } else if (!item->isPost() && item->displayFrom()) { + const auto from = item->displayFrom(); + if (from->isChat() || from->isMegagroup()) { + return FromChatIcon(context, from->id); + } else if (from->isChannel()) { + return FromChannelIcon(context, from->id); + } else if (const auto user = from->asUser()) { + if (user->isInaccessible()) { + return FromDeletedIcon(context, from->id); + } else if (user->isBot() && !user->isSupport() && !user->isRepliesChat()) { + return FromBotIcon(context, from->id); + } + } + } + return {}; + }(); + + if (chatTypeIcon) { + chatTypeIcon->paint(p, QPoint(availableLeft, trect.top()), availableWidth); + availableLeft += chatTypeIcon->width() + st::dialogsChatTypeSkip; + availableWidth -= chatTypeIcon->width() + st::dialogsChatTypeSkip; + } + const auto stm = context.messageStyle(); const auto from = item->displayFrom(); const auto info = from ? nullptr : item->displayHiddenSenderInfo(); @@ -2332,10 +2503,27 @@ bool Message::getStateFromName( if (point.y() >= trect.top() && point.y() < trect.top() + st::msgNameFont->height) { auto availableLeft = trect.left(); auto availableWidth = trect.width(); + const auto item = data(); + const auto hasChatTypeIcon = [&]() { + if (item->isSponsored()) { + return true; + } else if (!item->isPost() && item->displayFrom()) { + const auto from = item->displayFrom(); + if (from->isChat() || from->isMegagroup() || from->isChannel()) { + return true; + } else if (const auto user = from->asUser()) { + if (user->isInaccessible() + || (user->isBot() && !user->isSupport() && !user->isRepliesChat())) { + return true; + } + } + } + return false; + }(); if (replyWidth) { availableWidth -= st::msgPadding.right() + replyWidth; } - const auto item = data(); + const auto chatIconWidth = (hasChatTypeIcon) ? st::dialogsChatTypeSkip : 0; const auto from = item->displayFrom(); const auto nameText = [&]() -> const Ui::Text::String * { if (from) { @@ -2349,7 +2537,7 @@ bool Message::getStateFromName( }(); if (point.x() >= availableLeft && point.x() < availableLeft + availableWidth - && point.x() < availableLeft + nameText->maxWidth()) { + && point.x() < availableLeft + nameText->maxWidth() + chatIconWidth) { outResult->link = fromLink(); return true; } diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index e50e4e7cf..e9d2b53f6 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -1042,3 +1042,70 @@ chatSimilarSkip: 12px; premiumRequiredWidth: 186px; premiumRequiredIcon: icon{{ "chat/large_lockedchat", msgServiceFg }}; premiumRequiredCircle: 60px; + +msgNameChat1Icon: icon {{ "dialogs/dialogs_chat", ktgMessageName1IconFg, point(1px, 4px) }}; +msgNameChat1IconSelected: icon {{ "dialogs/dialogs_chat", ktgMessageName1IconFgSelected, point(1px, 4px) }}; +msgNameChat2Icon: icon {{ "dialogs/dialogs_chat", ktgMessageName2IconFg, point(1px, 4px) }}; +msgNameChat2IconSelected: icon {{ "dialogs/dialogs_chat", ktgMessageName2IconFgSelected, point(1px, 4px) }}; +msgNameChat3Icon: icon {{ "dialogs/dialogs_chat", ktgMessageName3IconFg, point(1px, 4px) }}; +msgNameChat3IconSelected: icon {{ "dialogs/dialogs_chat", ktgMessageName3IconFgSelected, point(1px, 4px) }}; +msgNameChat4Icon: icon {{ "dialogs/dialogs_chat", ktgMessageName4IconFg, point(1px, 4px) }}; +msgNameChat4IconSelected: icon {{ "dialogs/dialogs_chat", ktgMessageName4IconFgSelected, point(1px, 4px) }}; +msgNameChat5Icon: icon {{ "dialogs/dialogs_chat", ktgMessageName5IconFg, point(1px, 4px) }}; +msgNameChat5IconSelected: icon {{ "dialogs/dialogs_chat", ktgMessageName5IconFgSelected, point(1px, 4px) }}; +msgNameChat6Icon: icon {{ "dialogs/dialogs_chat", ktgMessageName6IconFg, point(1px, 4px) }}; +msgNameChat6IconSelected: icon {{ "dialogs/dialogs_chat", ktgMessageName6IconFgSelected, point(1px, 4px) }}; +msgNameChat7Icon: icon {{ "dialogs/dialogs_chat", ktgMessageName7IconFg, point(1px, 4px) }}; +msgNameChat7IconSelected: icon {{ "dialogs/dialogs_chat", ktgMessageName7IconFgSelected, point(1px, 4px) }}; +msgNameChat8Icon: icon {{ "dialogs/dialogs_chat", ktgMessageName8IconFg, point(1px, 4px) }}; +msgNameChat8IconSelected: icon {{ "dialogs/dialogs_chat", ktgMessageName8IconFgSelected, point(1px, 4px) }}; +msgNameChannel1Icon: icon {{ "dialogs/dialogs_channel", ktgMessageName1IconFg, point(3px, 4px) }}; +msgNameChannel1IconSelected: icon {{ "dialogs/dialogs_channel", ktgMessageName1IconFgSelected, point(3px, 4px) }}; +msgNameChannel2Icon: icon {{ "dialogs/dialogs_channel", ktgMessageName2IconFg, point(3px, 4px) }}; +msgNameChannel2IconSelected: icon {{ "dialogs/dialogs_channel", ktgMessageName2IconFgSelected, point(3px, 4px) }}; +msgNameChannel3Icon: icon {{ "dialogs/dialogs_channel", ktgMessageName3IconFg, point(3px, 4px) }}; +msgNameChannel3IconSelected: icon {{ "dialogs/dialogs_channel", ktgMessageName3IconFgSelected, point(3px, 4px) }}; +msgNameChannel4Icon: icon {{ "dialogs/dialogs_channel", ktgMessageName4IconFg, point(3px, 4px) }}; +msgNameChannel4IconSelected: icon {{ "dialogs/dialogs_channel", ktgMessageName4IconFgSelected, point(3px, 4px) }}; +msgNameChannel5Icon: icon {{ "dialogs/dialogs_channel", ktgMessageName5IconFg, point(3px, 4px) }}; +msgNameChannel5IconSelected: icon {{ "dialogs/dialogs_channel", ktgMessageName5IconFgSelected, point(3px, 4px) }}; +msgNameChannel6Icon: icon {{ "dialogs/dialogs_channel", ktgMessageName6IconFg, point(3px, 4px) }}; +msgNameChannel6IconSelected: icon {{ "dialogs/dialogs_channel", ktgMessageName6IconFgSelected, point(3px, 4px) }}; +msgNameChannel7Icon: icon {{ "dialogs/dialogs_channel", ktgMessageName7IconFg, point(3px, 4px) }}; +msgNameChannel7IconSelected: icon {{ "dialogs/dialogs_channel", ktgMessageName7IconFgSelected, point(3px, 4px) }}; +msgNameChannel8Icon: icon {{ "dialogs/dialogs_channel", ktgMessageName8IconFg, point(3px, 4px) }}; +msgNameChannel8IconSelected: icon {{ "dialogs/dialogs_channel", ktgMessageName8IconFgSelected, point(3px, 4px) }}; +msgNameBot1Icon: icon {{ "dialogs/dialogs_bot", ktgMessageName1IconFg, point(1px, 3px) }}; +msgNameBot1IconSelected: icon {{ "dialogs/dialogs_bot", ktgMessageName1IconFgSelected, point(1px, 3px) }}; +msgNameBot2Icon: icon {{ "dialogs/dialogs_bot", ktgMessageName2IconFg, point(1px, 3px) }}; +msgNameBot2IconSelected: icon {{ "dialogs/dialogs_bot", ktgMessageName2IconFgSelected, point(1px, 3px) }}; +msgNameBot3Icon: icon {{ "dialogs/dialogs_bot", ktgMessageName3IconFg, point(1px, 3px) }}; +msgNameBot3IconSelected: icon {{ "dialogs/dialogs_bot", ktgMessageName3IconFgSelected, point(1px, 3px) }}; +msgNameBot4Icon: icon {{ "dialogs/dialogs_bot", ktgMessageName4IconFg, point(1px, 3px) }}; +msgNameBot4IconSelected: icon {{ "dialogs/dialogs_bot", ktgMessageName4IconFgSelected, point(1px, 3px) }}; +msgNameBot5Icon: icon {{ "dialogs/dialogs_bot", ktgMessageName5IconFg, point(1px, 3px) }}; +msgNameBot5IconSelected: icon {{ "dialogs/dialogs_bot", ktgMessageName5IconFgSelected, point(1px, 3px) }}; +msgNameBot6Icon: icon {{ "dialogs/dialogs_bot", ktgMessageName6IconFg, point(1px, 3px) }}; +msgNameBot6IconSelected: icon {{ "dialogs/dialogs_bot", ktgMessageName6IconFgSelected, point(1px, 3px) }}; +msgNameBot7Icon: icon {{ "dialogs/dialogs_bot", ktgMessageName7IconFg, point(1px, 3px) }}; +msgNameBot7IconSelected: icon {{ "dialogs/dialogs_bot", ktgMessageName7IconFgSelected, point(1px, 3px) }}; +msgNameBot8Icon: icon {{ "dialogs/dialogs_bot", ktgMessageName8IconFg, point(1px, 3px) }}; +msgNameBot8IconSelected: icon {{ "dialogs/dialogs_bot", ktgMessageName8IconFgSelected, point(1px, 3px) }}; +msgNameDeleted1Icon: icon {{ "dialogs/dialogs_deleted", ktgMessageName1IconFg, point(1px, 4px) }}; +msgNameDeleted1IconSelected: icon {{ "dialogs/dialogs_deleted", ktgMessageName1IconFgSelected, point(1px, 4px) }}; +msgNameDeleted2Icon: icon {{ "dialogs/dialogs_deleted", ktgMessageName2IconFg, point(1px, 4px) }}; +msgNameDeleted2IconSelected: icon {{ "dialogs/dialogs_deleted", ktgMessageName2IconFgSelected, point(1px, 4px) }}; +msgNameDeleted3Icon: icon {{ "dialogs/dialogs_deleted", ktgMessageName3IconFg, point(1px, 4px) }}; +msgNameDeleted3IconSelected: icon {{ "dialogs/dialogs_deleted", ktgMessageName3IconFgSelected, point(1px, 4px) }}; +msgNameDeleted4Icon: icon {{ "dialogs/dialogs_deleted", ktgMessageName4IconFg, point(1px, 4px) }}; +msgNameDeleted4IconSelected: icon {{ "dialogs/dialogs_deleted", ktgMessageName4IconFgSelected, point(1px, 4px) }}; +msgNameDeleted5Icon: icon {{ "dialogs/dialogs_deleted", ktgMessageName5IconFg, point(1px, 4px) }}; +msgNameDeleted5IconSelected: icon {{ "dialogs/dialogs_deleted", ktgMessageName5IconFgSelected, point(1px, 4px) }}; +msgNameDeleted6Icon: icon {{ "dialogs/dialogs_deleted", ktgMessageName6IconFg, point(1px, 4px) }}; +msgNameDeleted6IconSelected: icon {{ "dialogs/dialogs_deleted", ktgMessageName6IconFgSelected, point(1px, 4px) }}; +msgNameDeleted7Icon: icon {{ "dialogs/dialogs_deleted", ktgMessageName7IconFg, point(1px, 4px) }}; +msgNameDeleted7IconSelected: icon {{ "dialogs/dialogs_deleted", ktgMessageName7IconFgSelected, point(1px, 4px) }}; +msgNameDeleted8Icon: icon {{ "dialogs/dialogs_deleted", ktgMessageName8IconFg, point(1px, 4px) }}; +msgNameDeleted8IconSelected: icon {{ "dialogs/dialogs_deleted", ktgMessageName8IconFgSelected, point(1px, 4px) }}; +msgNameSponsoredIcon: icon {{ "dialogs/dialogs_sponsored", ktgMessageNameSponsoredIconFg, point(1px, 4px) }}; +msgNameSponsoredIconSelected: icon {{ "dialogs/dialogs_sponsored", ktgMessageNameSponsoredIconFgSelected, point(1px, 4px) }}; diff --git a/Telegram/SourceFiles/ui/chat/chat_style.cpp b/Telegram/SourceFiles/ui/chat/chat_style.cpp index 88f5ddd38..87611fc21 100644 --- a/Telegram/SourceFiles/ui/chat/chat_style.cpp +++ b/Telegram/SourceFiles/ui/chat/chat_style.cpp @@ -198,6 +198,72 @@ ChatStyle::ChatStyle(rpl::producer colorIndices) { make(_videoIcon, st::videoIcon); make(_historyPollChoiceRight, st::historyPollChoiceRight); make(_historyPollChoiceWrong, st::historyPollChoiceWrong); + make(_msgNameChat1Icon, st::msgNameChat1Icon); + make(_msgNameChat1IconSelected, st::msgNameChat1IconSelected); + make(_msgNameChat2Icon, st::msgNameChat2Icon); + make(_msgNameChat2IconSelected, st::msgNameChat2IconSelected); + make(_msgNameChat3Icon, st::msgNameChat3Icon); + make(_msgNameChat3IconSelected, st::msgNameChat3IconSelected); + make(_msgNameChat4Icon, st::msgNameChat4Icon); + make(_msgNameChat4IconSelected, st::msgNameChat4IconSelected); + make(_msgNameChat5Icon, st::msgNameChat5Icon); + make(_msgNameChat5IconSelected, st::msgNameChat5IconSelected); + make(_msgNameChat6Icon, st::msgNameChat6Icon); + make(_msgNameChat6IconSelected, st::msgNameChat6IconSelected); + make(_msgNameChat7Icon, st::msgNameChat7Icon); + make(_msgNameChat7IconSelected, st::msgNameChat7IconSelected); + make(_msgNameChat8Icon, st::msgNameChat8Icon); + make(_msgNameChat8IconSelected, st::msgNameChat8IconSelected); + make(_msgNameChannel1Icon, st::msgNameChannel1Icon); + make(_msgNameChannel1IconSelected, st::msgNameChannel1IconSelected); + make(_msgNameChannel2Icon, st::msgNameChannel2Icon); + make(_msgNameChannel2IconSelected, st::msgNameChannel2IconSelected); + make(_msgNameChannel3Icon, st::msgNameChannel3Icon); + make(_msgNameChannel3IconSelected, st::msgNameChannel3IconSelected); + make(_msgNameChannel4Icon, st::msgNameChannel4Icon); + make(_msgNameChannel4IconSelected, st::msgNameChannel4IconSelected); + make(_msgNameChannel5Icon, st::msgNameChannel5Icon); + make(_msgNameChannel5IconSelected, st::msgNameChannel5IconSelected); + make(_msgNameChannel6Icon, st::msgNameChannel6Icon); + make(_msgNameChannel6IconSelected, st::msgNameChannel6IconSelected); + make(_msgNameChannel7Icon, st::msgNameChannel7Icon); + make(_msgNameChannel7IconSelected, st::msgNameChannel7IconSelected); + make(_msgNameChannel8Icon, st::msgNameChannel8Icon); + make(_msgNameChannel8IconSelected, st::msgNameChannel8IconSelected); + make(_msgNameBot1Icon, st::msgNameBot1Icon); + make(_msgNameBot1IconSelected, st::msgNameBot1IconSelected); + make(_msgNameBot2Icon, st::msgNameBot2Icon); + make(_msgNameBot2IconSelected, st::msgNameBot2IconSelected); + make(_msgNameBot3Icon, st::msgNameBot3Icon); + make(_msgNameBot3IconSelected, st::msgNameBot3IconSelected); + make(_msgNameBot4Icon, st::msgNameBot4Icon); + make(_msgNameBot4IconSelected, st::msgNameBot4IconSelected); + make(_msgNameBot5Icon, st::msgNameBot5Icon); + make(_msgNameBot5IconSelected, st::msgNameBot5IconSelected); + make(_msgNameBot6Icon, st::msgNameBot6Icon); + make(_msgNameBot6IconSelected, st::msgNameBot6IconSelected); + make(_msgNameBot7Icon, st::msgNameBot7Icon); + make(_msgNameBot7IconSelected, st::msgNameBot7IconSelected); + make(_msgNameBot8Icon, st::msgNameBot8Icon); + make(_msgNameBot8IconSelected, st::msgNameBot8IconSelected); + make(_msgNameDeleted1Icon, st::msgNameDeleted1Icon); + make(_msgNameDeleted1IconSelected, st::msgNameDeleted1IconSelected); + make(_msgNameDeleted2Icon, st::msgNameDeleted2Icon); + make(_msgNameDeleted2IconSelected, st::msgNameDeleted2IconSelected); + make(_msgNameDeleted3Icon, st::msgNameDeleted3Icon); + make(_msgNameDeleted3IconSelected, st::msgNameDeleted3IconSelected); + make(_msgNameDeleted4Icon, st::msgNameDeleted4Icon); + make(_msgNameDeleted4IconSelected, st::msgNameDeleted4IconSelected); + make(_msgNameDeleted5Icon, st::msgNameDeleted5Icon); + make(_msgNameDeleted5IconSelected, st::msgNameDeleted5IconSelected); + make(_msgNameDeleted6Icon, st::msgNameDeleted6Icon); + make(_msgNameDeleted6IconSelected, st::msgNameDeleted6IconSelected); + make(_msgNameDeleted7Icon, st::msgNameDeleted7Icon); + make(_msgNameDeleted7IconSelected, st::msgNameDeleted7IconSelected); + make(_msgNameDeleted8Icon, st::msgNameDeleted8Icon); + make(_msgNameDeleted8IconSelected, st::msgNameDeleted8IconSelected); + make(_msgNameSponsoredIcon, st::msgNameSponsoredIcon); + make(_msgNameSponsoredIconSelected, st::msgNameSponsoredIconSelected); make( &MessageStyle::msgBg, st::msgInBg, diff --git a/Telegram/SourceFiles/ui/chat/chat_style.h b/Telegram/SourceFiles/ui/chat/chat_style.h index dca47f0f8..2e3640766 100644 --- a/Telegram/SourceFiles/ui/chat/chat_style.h +++ b/Telegram/SourceFiles/ui/chat/chat_style.h @@ -415,6 +415,204 @@ public: [[nodiscard]] const style::icon &historyPollChoiceWrong() const { return _historyPollChoiceWrong; } + [[nodiscard]] const style::icon &msgNameChat1Icon() const { + return _msgNameChat1Icon; + } + [[nodiscard]] const style::icon &msgNameChat1IconSelected() const { + return _msgNameChat1IconSelected; + } + [[nodiscard]] const style::icon &msgNameChat2Icon() const { + return _msgNameChat2Icon; + } + [[nodiscard]] const style::icon &msgNameChat2IconSelected() const { + return _msgNameChat2IconSelected; + } + [[nodiscard]] const style::icon &msgNameChat3Icon() const { + return _msgNameChat3Icon; + } + [[nodiscard]] const style::icon &msgNameChat3IconSelected() const { + return _msgNameChat3IconSelected; + } + [[nodiscard]] const style::icon &msgNameChat4Icon() const { + return _msgNameChat4Icon; + } + [[nodiscard]] const style::icon &msgNameChat4IconSelected() const { + return _msgNameChat4IconSelected; + } + [[nodiscard]] const style::icon &msgNameChat5Icon() const { + return _msgNameChat5Icon; + } + [[nodiscard]] const style::icon &msgNameChat5IconSelected() const { + return _msgNameChat5IconSelected; + } + [[nodiscard]] const style::icon &msgNameChat6Icon() const { + return _msgNameChat6Icon; + } + [[nodiscard]] const style::icon &msgNameChat6IconSelected() const { + return _msgNameChat6IconSelected; + } + [[nodiscard]] const style::icon &msgNameChat7Icon() const { + return _msgNameChat7Icon; + } + [[nodiscard]] const style::icon &msgNameChat7IconSelected() const { + return _msgNameChat7IconSelected; + } + [[nodiscard]] const style::icon &msgNameChat8Icon() const { + return _msgNameChat8Icon; + } + [[nodiscard]] const style::icon &msgNameChat8IconSelected() const { + return _msgNameChat8IconSelected; + } + [[nodiscard]] const style::icon &msgNameChannel1Icon() const { + return _msgNameChannel1Icon; + } + [[nodiscard]] const style::icon &msgNameChannel1IconSelected() const { + return _msgNameChannel1IconSelected; + } + [[nodiscard]] const style::icon &msgNameChannel2Icon() const { + return _msgNameChannel2Icon; + } + [[nodiscard]] const style::icon &msgNameChannel2IconSelected() const { + return _msgNameChannel2IconSelected; + } + [[nodiscard]] const style::icon &msgNameChannel3Icon() const { + return _msgNameChannel3Icon; + } + [[nodiscard]] const style::icon &msgNameChannel3IconSelected() const { + return _msgNameChannel3IconSelected; + } + [[nodiscard]] const style::icon &msgNameChannel4Icon() const { + return _msgNameChannel4Icon; + } + [[nodiscard]] const style::icon &msgNameChannel4IconSelected() const { + return _msgNameChannel4IconSelected; + } + [[nodiscard]] const style::icon &msgNameChannel5Icon() const { + return _msgNameChannel5Icon; + } + [[nodiscard]] const style::icon &msgNameChannel5IconSelected() const { + return _msgNameChannel5IconSelected; + } + [[nodiscard]] const style::icon &msgNameChannel6Icon() const { + return _msgNameChannel6Icon; + } + [[nodiscard]] const style::icon &msgNameChannel6IconSelected() const { + return _msgNameChannel6IconSelected; + } + [[nodiscard]] const style::icon &msgNameChannel7Icon() const { + return _msgNameChannel7Icon; + } + [[nodiscard]] const style::icon &msgNameChannel7IconSelected() const { + return _msgNameChannel7IconSelected; + } + [[nodiscard]] const style::icon &msgNameChannel8Icon() const { + return _msgNameChannel8Icon; + } + [[nodiscard]] const style::icon &msgNameChannel8IconSelected() const { + return _msgNameChannel8IconSelected; + } + [[nodiscard]] const style::icon &msgNameBot1Icon() const { + return _msgNameBot1Icon; + } + [[nodiscard]] const style::icon &msgNameBot1IconSelected() const { + return _msgNameBot1IconSelected; + } + [[nodiscard]] const style::icon &msgNameBot2Icon() const { + return _msgNameBot2Icon; + } + [[nodiscard]] const style::icon &msgNameBot2IconSelected() const { + return _msgNameBot2IconSelected; + } + [[nodiscard]] const style::icon &msgNameBot3Icon() const { + return _msgNameBot3Icon; + } + [[nodiscard]] const style::icon &msgNameBot3IconSelected() const { + return _msgNameBot3IconSelected; + } + [[nodiscard]] const style::icon &msgNameBot4Icon() const { + return _msgNameBot4Icon; + } + [[nodiscard]] const style::icon &msgNameBot4IconSelected() const { + return _msgNameBot4IconSelected; + } + [[nodiscard]] const style::icon &msgNameBot5Icon() const { + return _msgNameBot5Icon; + } + [[nodiscard]] const style::icon &msgNameBot5IconSelected() const { + return _msgNameBot5IconSelected; + } + [[nodiscard]] const style::icon &msgNameBot6Icon() const { + return _msgNameBot6Icon; + } + [[nodiscard]] const style::icon &msgNameBot6IconSelected() const { + return _msgNameBot6IconSelected; + } + [[nodiscard]] const style::icon &msgNameBot7Icon() const { + return _msgNameBot7Icon; + } + [[nodiscard]] const style::icon &msgNameBot7IconSelected() const { + return _msgNameBot7IconSelected; + } + [[nodiscard]] const style::icon &msgNameBot8Icon() const { + return _msgNameBot8Icon; + } + [[nodiscard]] const style::icon &msgNameBot8IconSelected() const { + return _msgNameBot8IconSelected; + } + [[nodiscard]] const style::icon &msgNameDeleted1Icon() const { + return _msgNameDeleted1Icon; + } + [[nodiscard]] const style::icon &msgNameDeleted1IconSelected() const { + return _msgNameDeleted1IconSelected; + } + [[nodiscard]] const style::icon &msgNameDeleted2Icon() const { + return _msgNameDeleted2Icon; + } + [[nodiscard]] const style::icon &msgNameDeleted2IconSelected() const { + return _msgNameDeleted2IconSelected; + } + [[nodiscard]] const style::icon &msgNameDeleted3Icon() const { + return _msgNameDeleted3Icon; + } + [[nodiscard]] const style::icon &msgNameDeleted3IconSelected() const { + return _msgNameDeleted3IconSelected; + } + [[nodiscard]] const style::icon &msgNameDeleted4Icon() const { + return _msgNameDeleted4Icon; + } + [[nodiscard]] const style::icon &msgNameDeleted4IconSelected() const { + return _msgNameDeleted4IconSelected; + } + [[nodiscard]] const style::icon &msgNameDeleted5Icon() const { + return _msgNameDeleted5Icon; + } + [[nodiscard]] const style::icon &msgNameDeleted5IconSelected() const { + return _msgNameDeleted5IconSelected; + } + [[nodiscard]] const style::icon &msgNameDeleted6Icon() const { + return _msgNameDeleted6Icon; + } + [[nodiscard]] const style::icon &msgNameDeleted6IconSelected() const { + return _msgNameDeleted6IconSelected; + } + [[nodiscard]] const style::icon &msgNameDeleted7Icon() const { + return _msgNameDeleted7Icon; + } + [[nodiscard]] const style::icon &msgNameDeleted7IconSelected() const { + return _msgNameDeleted7IconSelected; + } + [[nodiscard]] const style::icon &msgNameDeleted8Icon() const { + return _msgNameDeleted8Icon; + } + [[nodiscard]] const style::icon &msgNameDeleted8IconSelected() const { + return _msgNameDeleted8IconSelected; + } + [[nodiscard]] const style::icon &msgNameSponsoredIcon() const { + return _msgNameSponsoredIcon; + } + [[nodiscard]] const style::icon &msgNameSponsoredIconSelected() const { + return _msgNameSponsoredIconSelected; + } private: using ColoredQuotePaintCaches = std::array< @@ -529,6 +727,72 @@ private: style::icon _videoIcon = { Qt::Uninitialized }; style::icon _historyPollChoiceRight = { Qt::Uninitialized }; style::icon _historyPollChoiceWrong = { Qt::Uninitialized }; + style::icon _msgNameChat1Icon = { Qt::Uninitialized }; + style::icon _msgNameChat1IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChat2Icon = { Qt::Uninitialized }; + style::icon _msgNameChat2IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChat3Icon = { Qt::Uninitialized }; + style::icon _msgNameChat3IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChat4Icon = { Qt::Uninitialized }; + style::icon _msgNameChat4IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChat5Icon = { Qt::Uninitialized }; + style::icon _msgNameChat5IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChat6Icon = { Qt::Uninitialized }; + style::icon _msgNameChat6IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChat7Icon = { Qt::Uninitialized }; + style::icon _msgNameChat7IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChat8Icon = { Qt::Uninitialized }; + style::icon _msgNameChat8IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChannel1Icon = { Qt::Uninitialized }; + style::icon _msgNameChannel1IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChannel2Icon = { Qt::Uninitialized }; + style::icon _msgNameChannel2IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChannel3Icon = { Qt::Uninitialized }; + style::icon _msgNameChannel3IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChannel4Icon = { Qt::Uninitialized }; + style::icon _msgNameChannel4IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChannel5Icon = { Qt::Uninitialized }; + style::icon _msgNameChannel5IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChannel6Icon = { Qt::Uninitialized }; + style::icon _msgNameChannel6IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChannel7Icon = { Qt::Uninitialized }; + style::icon _msgNameChannel7IconSelected = { Qt::Uninitialized }; + style::icon _msgNameChannel8Icon = { Qt::Uninitialized }; + style::icon _msgNameChannel8IconSelected = { Qt::Uninitialized }; + style::icon _msgNameBot1Icon = { Qt::Uninitialized }; + style::icon _msgNameBot1IconSelected = { Qt::Uninitialized }; + style::icon _msgNameBot2Icon = { Qt::Uninitialized }; + style::icon _msgNameBot2IconSelected = { Qt::Uninitialized }; + style::icon _msgNameBot3Icon = { Qt::Uninitialized }; + style::icon _msgNameBot3IconSelected = { Qt::Uninitialized }; + style::icon _msgNameBot4Icon = { Qt::Uninitialized }; + style::icon _msgNameBot4IconSelected = { Qt::Uninitialized }; + style::icon _msgNameBot5Icon = { Qt::Uninitialized }; + style::icon _msgNameBot5IconSelected = { Qt::Uninitialized }; + style::icon _msgNameBot6Icon = { Qt::Uninitialized }; + style::icon _msgNameBot6IconSelected = { Qt::Uninitialized }; + style::icon _msgNameBot7Icon = { Qt::Uninitialized }; + style::icon _msgNameBot7IconSelected = { Qt::Uninitialized }; + style::icon _msgNameBot8Icon = { Qt::Uninitialized }; + style::icon _msgNameBot8IconSelected = { Qt::Uninitialized }; + style::icon _msgNameDeleted1Icon = { Qt::Uninitialized }; + style::icon _msgNameDeleted1IconSelected = { Qt::Uninitialized }; + style::icon _msgNameDeleted2Icon = { Qt::Uninitialized }; + style::icon _msgNameDeleted2IconSelected = { Qt::Uninitialized }; + style::icon _msgNameDeleted3Icon = { Qt::Uninitialized }; + style::icon _msgNameDeleted3IconSelected = { Qt::Uninitialized }; + style::icon _msgNameDeleted4Icon = { Qt::Uninitialized }; + style::icon _msgNameDeleted4IconSelected = { Qt::Uninitialized }; + style::icon _msgNameDeleted5Icon = { Qt::Uninitialized }; + style::icon _msgNameDeleted5IconSelected = { Qt::Uninitialized }; + style::icon _msgNameDeleted6Icon = { Qt::Uninitialized }; + style::icon _msgNameDeleted6IconSelected = { Qt::Uninitialized }; + style::icon _msgNameDeleted7Icon = { Qt::Uninitialized }; + style::icon _msgNameDeleted7IconSelected = { Qt::Uninitialized }; + style::icon _msgNameDeleted8Icon = { Qt::Uninitialized }; + style::icon _msgNameDeleted8IconSelected = { Qt::Uninitialized }; + style::icon _msgNameSponsoredIcon = { Qt::Uninitialized }; + style::icon _msgNameSponsoredIconSelected = { Qt::Uninitialized }; ColorIndicesCompressed _colorIndices;