diff --git a/Telegram/Resources/icons/dialogs_feed.png b/Telegram/Resources/icons/dialogs_feed.png new file mode 100644 index 0000000000..967e0edc9f Binary files /dev/null and b/Telegram/Resources/icons/dialogs_feed.png differ diff --git a/Telegram/Resources/icons/dialogs_feed@2x.png b/Telegram/Resources/icons/dialogs_feed@2x.png new file mode 100644 index 0000000000..c95642786e Binary files /dev/null and b/Telegram/Resources/icons/dialogs_feed@2x.png differ diff --git a/Telegram/Resources/icons/info_feed.png b/Telegram/Resources/icons/info_feed.png new file mode 100644 index 0000000000..ffa8e853b3 Binary files /dev/null and b/Telegram/Resources/icons/info_feed.png differ diff --git a/Telegram/Resources/icons/info_feed@2x.png b/Telegram/Resources/icons/info_feed@2x.png new file mode 100644 index 0000000000..7750fd3a04 Binary files /dev/null and b/Telegram/Resources/icons/info_feed@2x.png differ diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style index f8e1f1640b..1922f5cad1 100644 --- a/Telegram/SourceFiles/dialogs/dialogs.style +++ b/Telegram/SourceFiles/dialogs/dialogs.style @@ -139,6 +139,9 @@ dialogsChatIconActive: icon {{ "dialogs_chat", dialogsChatIconFgActive, point(1p dialogsChannelIcon: icon {{ "dialogs_channel", dialogsChatIconFg, point(3px, 4px) }}; dialogsChannelIconOver: icon {{ "dialogs_channel", dialogsChatIconFgOver, point(3px, 4px) }}; dialogsChannelIconActive: icon {{ "dialogs_channel", dialogsChatIconFgActive, point(3px, 4px) }}; +dialogsFeedIcon: icon {{ "dialogs_feed", dialogsChatIconFg, point(4px, 4px) }}; +dialogsFeedIconOver: icon {{ "dialogs_feed", dialogsChatIconFgOver, point(4px, 4px) }}; +dialogsFeedIconActive: icon {{ "dialogs_feed", dialogsChatIconFgActive, point(4px, 4px) }}; dialogsSendStateSkip: 20px; dialogsSendingIcon: icon {{ "dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }}; diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index f5e4b5d90b..1608e0cab8 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -659,7 +659,7 @@ void DialogsInner::paintSearchInFeed( const auto paintUserpic = [&](Painter &p, int x, int y, int size) { feed->paintUserpicLeft(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); }