From c3c9ba7e51e7e0e302b60c75109c2fb0593785a1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 22 Feb 2018 16:50:56 +0300 Subject: [PATCH] Add feed icons. --- Telegram/Resources/icons/dialogs_feed.png | Bin 0 -> 328 bytes Telegram/Resources/icons/dialogs_feed@2x.png | Bin 0 -> 626 bytes Telegram/Resources/icons/info_feed.png | Bin 0 -> 748 bytes Telegram/Resources/icons/info_feed@2x.png | Bin 0 -> 1628 bytes Telegram/SourceFiles/dialogs/dialogs.style | 3 ++ .../dialogs/dialogs_inner_widget.cpp | 2 +- .../SourceFiles/dialogs/dialogs_layout.cpp | 41 +++++++++++++----- Telegram/SourceFiles/dialogs/dialogs_layout.h | 10 ++++- .../info/feed/info_feed_channels.cpp | 4 +- Telegram/SourceFiles/info/info.style | 35 ++++++++++----- .../window/notifications_manager_default.cpp | 2 +- 11 files changed, 71 insertions(+), 26 deletions(-) create mode 100644 Telegram/Resources/icons/dialogs_feed.png create mode 100644 Telegram/Resources/icons/dialogs_feed@2x.png create mode 100644 Telegram/Resources/icons/info_feed.png create mode 100644 Telegram/Resources/icons/info_feed@2x.png diff --git a/Telegram/Resources/icons/dialogs_feed.png b/Telegram/Resources/icons/dialogs_feed.png new file mode 100644 index 0000000000000000000000000000000000000000..967e0edc9f0243924b2850ba24aeac2fc27f9374 GIT binary patch literal 328 zcmV-O0k{5%P)BMfgV>})s3EQ?g91Z{+kH`0<-+OPj8;ivPNel*qzG1uF zzRZ?o;rl*mngY;uT@QGkN7r>UO~Yt3`rI6bVc+054wBgK_W*1*8x%zmRaFs15t2xf z1b{e>k;HPj1R&3I)V3`ERaGGg-}eDHpU+5QHk$!(y)#Ql?A5!XKc2KzvnN#llV@N<_p`uu&^*l4gns z7FI?b!8Zq$mEv-}IrpeBm%Cw#HGA#v>^XZg0;Lqo<&u1Se319|cOuI&X*Qdr)oPK| zYDNAza3a?0HA#7-XU{3{*LZz>h1cu-|KQ(Iuh*g1>n{U~q6m#f1FO{v zNs{pN^n`xDe-b{M&EWU@FM;zf1wnwr;lT6rGxq!a(F3B<=y!L2{$z{Af<~ip6rRmy z&%rMnMko}*X0zeo@p$}r4W$&r;SlY18>v(ZE|=?M7dD#>lgWgG2Lgf1wxZYT;o;!{ zDwT>WFq_R7jYf=rKA-d3a&r6tI-L%5I^EIESF07{t=H>6+vD+g442Er!Gpmd=k@t~ ze>`fn8fLQ@k|g2fdu7FYsx7*FZ|K66jx3{nJVa*1E0hLOHgD(~f+}_?Y-n+Xy zY`0s+=ka*XuUj}A#%{Oc?)>WNit!Z+1;$e>7Qf%)NF>5_{`mOFc$`irlizGMxW2yr z^{>ceGEfu+)9DnMOa`JT9tz9lGE>;=^_V>u1cCdvxZQ4$bUMv-l}IEGg<7qa8|eN0 zJ=1kIn`QE`SPVo_6b`H?%GrBNCX-BFk|ZWytJR<)7euvMWwhOHXS6KKj5ZpLM3v9y zIZ!T_V|2IMWwgm;V)S4zVD!z+4LJ;NI-MRJ9w7vxC^DZ)Dg8G83ED&yff+2*k^lez M07*qoM6N<$f}PYXK>z>% literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/info_feed.png b/Telegram/Resources/icons/info_feed.png new file mode 100644 index 0000000000000000000000000000000000000000..ffa8e853b393cacb69674b726f11b824cd7d8d3d GIT binary patch literal 748 zcmVGJYY&(F_og`in~RgFf2d_GSmlff9%^w~e?=3+D&WpHqiiHQl; z*VoBrv-rLr!jwuSW@cvo9>7=K*Vo7D>MDJ3C`xVFBB=kwkxgKNlAl00cpR<2a!mADQ@r-SPblxUS3G z+#HgKL?Rp=9Rc9`KBJ?fNMdhqFWjQvJSUoq(P)&hu`zabb|@B$A;`hO0mc|C%Oac2 zhM6$N(ACw&!@~mrnM|gA88F7MwY5bM1R=zS9UqxkSy@36Yinx&NEwU_&-rin(->1=NFfuaIUI0mKZf*iltyZyZ8)FRRav6Z>>1iZ|)@*ES zw0u{~&v7c1lIMByJWr`qD!hMue5_)zsCYcC#l=OvzrQP+%}SEe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}C#^%kNC-35)7sifdF*yOwIV2rg5u)h^ael(K|w(QhK7cygPWe7MnORV|j*52Mu zd7Mrsm5)Rs%-!L~j~^*dd3pK&55VDY#C^LP2n678I8^KE>+321hYug92Pi=hn3pO$ zcI=?Gar^ddDqmk;uNi>mpT}J;7s=1hXFku*&nGUIOSSI$_3LD2X6AcbR8&NqPUrU+ z0D1cKDOIz5`*tes>+7T9va+&Y>V2^^1K6`?k7};Ex>_|iJ3CA6-@i|NR#jC+#V=pJ zq+*A|LB;Rhy`$pw>(?jjHIcadLE_1iCse#`+cqj57#N^pQ530obaa%8i;Igj_o5lV zkH#{^nM8)gYt)t?}$w?}<*=z~-_akY#c!;8?dJz;wF=4IM zYNcv?J|C4gnM_nZ91c@?qtVE$6k3l%GXV16N+3xR!r?H&;V>jgO1J{VhF-6y4nUS= z#Qf-pT;r-2iW80Pt>rw=w{DH^5sN0K6OE at$zUZP7K`s?0U!m0000paintUserpicLeft(p, x, y, fullWidth, size); }; - const auto icon = nullptr; + const auto icon = Dialogs::Layout::FeedTypeIcon(feed, false, false); paintSearchInFilter(p, paintUserpic, top, fullWidth, icon, text); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp index aea5a1847c..dba8821bc9 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp @@ -61,9 +61,9 @@ inline constexpr bool is_flag_type(Flag) { return true; } template void paintRow( Painter &p, - const RippleRow *row, + not_null row, not_null entry, - History *history, + Dialogs::Key chat, PeerData *from, HistoryItem *item, const Data::Draft *draft, @@ -124,6 +124,7 @@ void paintRow( return; } + const auto history = chat.history(); auto namewidth = fullWidth - nameleft - st::dialogsPadding.x(); auto rectForName = QRect( nameleft, @@ -132,10 +133,15 @@ void paintRow( st::msgNameFont->height); if (from && !(flags & Flag::FeedSearchResult)) { - if (auto chatTypeIcon = ChatTypeIcon(from, active, selected)) { + if (const auto chatTypeIcon = ChatTypeIcon(from, active, selected)) { chatTypeIcon->paint(p, rectForName.topLeft(), fullWidth); rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip); } + } else if (const auto feed = chat.feed()) { + if (const auto feedTypeIcon = FeedTypeIcon(feed, active, selected)) { + feedTypeIcon->paint(p, rectForName.topLeft(), fullWidth); + rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip); + } } auto texttop = st::dialogsPadding.y() + st::msgNameFont->height @@ -287,17 +293,32 @@ QImage colorizeCircleHalf(UnreadBadgeSizeData *data, int size, int half, int xof } // namepsace -const style::icon *ChatTypeIcon(PeerData *peer, bool active, bool selected) { - if (!peer) { - return nullptr; - } else if (peer->isChat() || peer->isMegagroup()) { - return &(active ? st::dialogsChatIconActive : (selected ? st::dialogsChatIconOver : st::dialogsChatIcon)); +const style::icon *ChatTypeIcon( + not_null peer, + bool active, + bool selected) { + if (peer->isChat() || peer->isMegagroup()) { + return &(active + ? st::dialogsChatIconActive + : (selected ? st::dialogsChatIconOver : st::dialogsChatIcon)); } else if (peer->isChannel()) { - return &(active ? st::dialogsChannelIconActive : (selected ? st::dialogsChannelIconOver : st::dialogsChannelIcon)); + return &(active + ? st::dialogsChannelIconActive + : (selected + ? st::dialogsChannelIconOver + : st::dialogsChannelIcon)); } return nullptr; } +const style::icon *FeedTypeIcon( + not_null feed, + bool active, + bool selected) { + return &(active ? st::dialogsFeedIconActive + : (selected ? st::dialogsFeedIconOver : st::dialogsFeedIcon)); +} + void paintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st) { Assert(rect.height() == st.size); @@ -511,7 +532,7 @@ void RowPainter::paint( p, row, entry, - history, + row->key(), from, item, cloudDraft, diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.h b/Telegram/SourceFiles/dialogs/dialogs_layout.h index c26348440f..dc67d6d73a 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.h +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.h @@ -7,6 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once +namespace Data { +class Feed; +} // namespace Data + namespace Dialogs { class Row; @@ -15,7 +19,11 @@ class FakeRow; namespace Layout { const style::icon *ChatTypeIcon( - PeerData *peer, + not_null peer, + bool active, + bool selected); +const style::icon *FeedTypeIcon( + not_null feed, bool active, bool selected); diff --git a/Telegram/SourceFiles/info/feed/info_feed_channels.cpp b/Telegram/SourceFiles/info/feed/info_feed_channels.cpp index 8fd15113a2..7a6d79fe2d 100644 --- a/Telegram/SourceFiles/info/feed/info_feed_channels.cpp +++ b/Telegram/SourceFiles/info/feed/info_feed_channels.cpp @@ -95,14 +95,14 @@ void Channels::setupHeader() { object_ptr( parent, - st::infoIconMembers, + st::infoIconFeed, st::infoIconPosition); _titleWrap = Ui::CreateChild(parent); _title = setupTitle(); _addChannel = Ui::CreateChild( _openChannels, - st::infoMembersAddMember); + st::infoChannelsAddChannel); _search = Ui::CreateChild( _openChannels, st::infoMembersSearch); diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style index c1c6c7c72e..e7cf9f4b4d 100644 --- a/Telegram/SourceFiles/info/info.style +++ b/Telegram/SourceFiles/info/info.style @@ -332,6 +332,7 @@ infoIconInformation: icon {{ "info_information", infoIconFg }}; infoIconMembers: icon {{ "info_members", infoIconFg }}; infoIconNotifications: icon {{ "info_notifications", infoIconFg }}; infoIconActions: icon {{ "info_actions", infoIconFg }}; +infoIconFeed: icon {{ "info_feed", infoIconFg }}; infoIconMediaPhoto: icon {{ "info_media_photo", infoIconFg }}; infoIconMediaVideo: icon {{ "info_media_video", infoIconFg }}; infoIconMediaFile: icon {{ "info_media_file", infoIconFg }}; @@ -495,6 +496,11 @@ infoMembersCancelSearch: CrossButton { } infoMembersSearchTop: 15px; +infoChannelsAddChannel: IconButton(infoMembersButton) { + icon: icon {{ "settings_edit_name", menuIconFg, point(9px, 9px) }}; + iconOver: icon {{ "settings_edit_name", menuIconFgOver, point(9px, 9px) }}; +} + infoMembersCreatorIcon: icon {{ "profile_admin_star", profileAdminStartFg, @@ -535,18 +541,25 @@ infoMediaMargin: margins(0px, 6px, 0px, 2px); infoMediaMinGridSize: 90px; infoCommonGroupsMargin: margins(0px, 13px, 0px, 2px); +infoCommonGroupsListItem: PeerListItem(defaultPeerListItem) { + height: 52px; + photoSize: 40px; + photoPosition: point(16px, 6px); + namePosition: point(71px, 15px); + nameStyle: TextStyle(defaultTextStyle) { + font: font(14px semibold); + linkFont: font(14px semibold); + linkFontOver: font(14px semibold); + } + statusPosition: point(79px, 31px); +} infoCommonGroupsList: PeerList(infoMembersList) { - item: PeerListItem(defaultPeerListItem) { - height: 52px; - photoSize: 40px; - photoPosition: point(16px, 6px); - namePosition: point(71px, 15px); - nameStyle: TextStyle(defaultTextStyle) { - font: font(14px semibold); - linkFont: font(14px semibold); - linkFontOver: font(14px semibold); - } - statusPosition: point(79px, 31px); + item: infoCommonGroupsListItem; +} +infoChannelsList: PeerList(infoCommonGroupsList) { + item: PeerListItem(infoCommonGroupsListItem) { + photoPosition: point(18px, 6px); + namePosition: point(79px, 15px); } } diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index ef9183cee7..069fea089f 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -651,7 +651,7 @@ void Notification::updateNotifyDisplay() { QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height); if (!options.hideNameAndPhoto) { - if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(_history->peer, false, false)) { + if (const auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(_history->peer, false, false)) { chatTypeIcon->paint(p, rectForName.topLeft(), w); rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip); }