2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add a distinct forum icon in chats list.

This commit is contained in:
John Preston
2022-10-25 16:40:54 +04:00
parent 76330eaaa6
commit 97d8aa0a0d
8 changed files with 38 additions and 19 deletions

View File

@@ -340,7 +340,9 @@ void PaintRow(
} else if (from) {
if (const auto chatTypeIcon = ChatTypeIcon(from, context)) {
chatTypeIcon->paint(p, rectForName.topLeft(), context.width);
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
rectForName.setLeft(rectForName.left()
+ chatTypeIcon->width()
+ st::dialogsChatTypeSkip);
}
}
auto texttop = context.st->textTop;
@@ -739,19 +741,7 @@ void PaintUnreadBadge(QPainter &p, const QRect &rect, const UnreadBadgeStyle &st
const style::icon *ChatTypeIcon(
not_null<PeerData*> peer,
const PaintContext &context) {
if (peer->isChat() || peer->isMegagroup()) {
return &(context.active
? st::dialogsChatIconActive
: context.selected
? st::dialogsChatIconOver
: st::dialogsChatIcon);
} else if (peer->isChannel()) {
return &(context.active
? st::dialogsChannelIconActive
: context.selected
? st::dialogsChannelIconOver
: st::dialogsChannelIcon);
} else if (const auto user = peer->asUser()) {
if (const auto user = peer->asUser()) {
if (ShowUserBotIcon(user)) {
return &(context.active
? st::dialogsBotIconActive
@@ -759,6 +749,24 @@ const style::icon *ChatTypeIcon(
? st::dialogsBotIconOver
: st::dialogsBotIcon);
}
} else if (peer->isBroadcast()) {
return &(context.active
? st::dialogsChannelIconActive
: context.selected
? st::dialogsChannelIconOver
: st::dialogsChannelIcon);
} else if (peer->isForum()) {
return &(context.active
? st::dialogsForumIconActive
: context.selected
? st::dialogsForumIconOver
: st::dialogsForumIcon);
} else {
return &(context.active
? st::dialogsChatIconActive
: context.selected
? st::dialogsChatIconOver
: st::dialogsChatIcon);
}
return nullptr;
}