Show type icons before names in messages (except channel posts)
This commit is contained in:
parent
b42a73aebc
commit
310a81b482
6 changed files with 48 additions and 1 deletions
BIN
Telegram/Resources/icons/dialogs/dialogs_sponsored.png
Normal file
BIN
Telegram/Resources/icons/dialogs/dialogs_sponsored.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2 KiB |
BIN
Telegram/Resources/icons/dialogs/dialogs_sponsored@2x.png
Normal file
BIN
Telegram/Resources/icons/dialogs/dialogs_sponsored@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
Telegram/Resources/icons/dialogs/dialogs_sponsored@3x.png
Normal file
BIN
Telegram/Resources/icons/dialogs/dialogs_sponsored@3x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
|
|
@ -860,6 +860,42 @@ void Message::paintFromName(
|
|||
availableWidth -= st::msgPadding.right() + rightWidth;
|
||||
}
|
||||
|
||||
const auto chatTypeIcon = [&]() -> const style::icon * {
|
||||
if (const auto sponsored = displayedSponsorBadge()) {
|
||||
return context.selected()
|
||||
? &st::msgNameSponsoredIconSelected
|
||||
: &st::msgNameSponsoredIcon;
|
||||
} else if (!item->isPost()) {
|
||||
const auto from = item->displayFrom();
|
||||
if (from->isChat() || from->isMegagroup()) {
|
||||
return context.selected()
|
||||
? &st::msgNameChatIconSelected
|
||||
: &st::msgNameChatIcon;
|
||||
} else if (from->isChannel()) {
|
||||
return context.selected()
|
||||
? &st::msgNameChannelIconSelected
|
||||
: &st::msgNameChannelIcon;
|
||||
} else if (const auto user = from->asUser()) {
|
||||
if (user->isInaccessible()) {
|
||||
return context.selected()
|
||||
? &st::msgNameDeletedIconSelected
|
||||
: &st::msgNameDeletedIcon;
|
||||
} else if (user->isBot() && !user->isSupport() && !user->isRepliesChat()) {
|
||||
return context.selected()
|
||||
? &st::msgNameBotIconSelected
|
||||
: &st::msgNameBotIcon;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}();
|
||||
|
||||
if (chatTypeIcon) {
|
||||
chatTypeIcon->paint(p, QPoint(availableLeft, trect.top()), availableWidth);
|
||||
availableLeft += st::dialogsChatTypeSkip;
|
||||
availableWidth -= st::dialogsChatTypeSkip;
|
||||
}
|
||||
|
||||
p.setFont(st::msgNameFont);
|
||||
const auto stm = context.messageStyle();
|
||||
|
||||
|
|
|
|||
|
|
@ -974,3 +974,14 @@ sendAsButton: SendAsButton {
|
|||
}
|
||||
duration: 150;
|
||||
}
|
||||
|
||||
msgNameChatIcon: icon {{ "dialogs/dialogs_chat", ktgMessageNameIconFg, point(1px, 4px) }};
|
||||
msgNameChatIconSelected: icon {{ "dialogs/dialogs_chat", ktgMessageNameIconFgSelected, point(1px, 4px) }};
|
||||
msgNameChannelIcon: icon {{ "dialogs/dialogs_channel", ktgMessageNameIconFg, point(3px, 4px) }};
|
||||
msgNameChannelIconSelected: icon {{ "dialogs/dialogs_channel", ktgMessageNameIconFgSelected, point(3px, 4px) }};
|
||||
msgNameBotIcon: icon {{ "dialogs/dialogs_bot", ktgMessageNameIconFg, point(1px, 3px) }};
|
||||
msgNameBotIconSelected: icon {{ "dialogs/dialogs_bot", ktgMessageNameIconFgSelected, point(1px, 3px) }};
|
||||
msgNameDeletedIcon: icon {{ "dialogs/dialogs_deleted", ktgMessageNameIconFg, point(1px, 4px) }};
|
||||
msgNameDeletedIconSelected: icon {{ "dialogs/dialogs_deleted", ktgMessageNameIconFgSelected, point(1px, 4px) }};
|
||||
msgNameSponsoredIcon: icon {{ "dialogs/dialogs_sponsored", ktgMessageNameIconFg, point(1px, 4px) }};
|
||||
msgNameSponsoredIconSelected: icon {{ "dialogs/dialogs_sponsored", ktgMessageNameIconFgSelected, point(1px, 4px) }};
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit d9274f06bddccf0e5f4deabe641bafdd3b453c3f
|
||||
Subproject commit f8f407004b139a1cd882c538f00e8a87b5e65b9a
|
||||
Loading…
Add table
Reference in a new issue