Add feed icons.
This commit is contained in:
parent
a1be63f890
commit
c3c9ba7e51
Binary file not shown.
After Width: | Height: | Size: 328 B |
Binary file not shown.
After Width: | Height: | Size: 626 B |
Binary file not shown.
After Width: | Height: | Size: 748 B |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -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) }};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,9 +61,9 @@ inline constexpr bool is_flag_type(Flag) { return true; }
|
|||
template <typename PaintItemCallback, typename PaintCounterCallback>
|
||||
void paintRow(
|
||||
Painter &p,
|
||||
const RippleRow *row,
|
||||
not_null<const RippleRow*> row,
|
||||
not_null<Entry*> 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<PeerData*> 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<Data::Feed*> 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,
|
||||
|
|
|
@ -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<PeerData*> peer,
|
||||
bool active,
|
||||
bool selected);
|
||||
const style::icon *FeedTypeIcon(
|
||||
not_null<Data::Feed*> feed,
|
||||
bool active,
|
||||
bool selected);
|
||||
|
||||
|
|
|
@ -95,14 +95,14 @@ void Channels::setupHeader() {
|
|||
|
||||
object_ptr<Profile::FloatingIcon>(
|
||||
parent,
|
||||
st::infoIconMembers,
|
||||
st::infoIconFeed,
|
||||
st::infoIconPosition);
|
||||
|
||||
_titleWrap = Ui::CreateChild<Ui::RpWidget>(parent);
|
||||
_title = setupTitle();
|
||||
_addChannel = Ui::CreateChild<Ui::IconButton>(
|
||||
_openChannels,
|
||||
st::infoMembersAddMember);
|
||||
st::infoChannelsAddChannel);
|
||||
_search = Ui::CreateChild<Ui::IconButton>(
|
||||
_openChannels,
|
||||
st::infoMembersSearch);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue