mirror of https://github.com/procxx/kepka.git
Display only mention badge if one unread message.
This commit is contained in:
parent
a8df4453ff
commit
d4814c5cb0
|
@ -296,7 +296,17 @@ void RowPainter::paint(Painter &p, const Row *row, int fullWidth, bool active, b
|
||||||
auto availableWidth = namewidth;
|
auto availableWidth = namewidth;
|
||||||
auto texttop = st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip;
|
auto texttop = st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip;
|
||||||
auto hadOneBadge = false;
|
auto hadOneBadge = false;
|
||||||
if (unreadCount) {
|
auto displayUnreadCounter = (unreadCount != 0);
|
||||||
|
auto displayMentionBadge = history->hasUnreadMentions();
|
||||||
|
auto displayPinnedIcon = !displayUnreadCounter && history->isPinnedDialog();
|
||||||
|
if (displayMentionBadge
|
||||||
|
&& unreadCount == 1
|
||||||
|
&& item
|
||||||
|
&& item->isMediaUnread()
|
||||||
|
&& item->mentionsMe()) {
|
||||||
|
displayUnreadCounter = false;
|
||||||
|
}
|
||||||
|
if (displayUnreadCounter) {
|
||||||
auto counter = QString::number(unreadCount);
|
auto counter = QString::number(unreadCount);
|
||||||
auto mutedCounter = history->mute();
|
auto mutedCounter = history->mute();
|
||||||
auto unreadRight = fullWidth - st::dialogsPadding.x();
|
auto unreadRight = fullWidth - st::dialogsPadding.x();
|
||||||
|
@ -310,14 +320,14 @@ void RowPainter::paint(Painter &p, const Row *row, int fullWidth, bool active, b
|
||||||
availableWidth -= unreadWidth + st.padding;
|
availableWidth -= unreadWidth + st.padding;
|
||||||
|
|
||||||
hadOneBadge = true;
|
hadOneBadge = true;
|
||||||
} else if (history->isPinnedDialog()) {
|
} else if (displayPinnedIcon) {
|
||||||
auto &icon = (active ? st::dialogsPinnedIconActive : (selected ? st::dialogsPinnedIconOver : st::dialogsPinnedIcon));
|
auto &icon = (active ? st::dialogsPinnedIconActive : (selected ? st::dialogsPinnedIconOver : st::dialogsPinnedIcon));
|
||||||
icon.paint(p, fullWidth - st::dialogsPadding.x() - icon.width(), texttop, fullWidth);
|
icon.paint(p, fullWidth - st::dialogsPadding.x() - icon.width(), texttop, fullWidth);
|
||||||
availableWidth -= icon.width() + st::dialogsUnreadPadding;
|
availableWidth -= icon.width() + st::dialogsUnreadPadding;
|
||||||
|
|
||||||
hadOneBadge = true;
|
hadOneBadge = true;
|
||||||
}
|
}
|
||||||
if (history->hasUnreadMentions()) {
|
if (displayMentionBadge) {
|
||||||
auto counter = qsl("@");
|
auto counter = qsl("@");
|
||||||
auto unreadRight = fullWidth - st::dialogsPadding.x() - (namewidth - availableWidth);
|
auto unreadRight = fullWidth - st::dialogsPadding.x() - (namewidth - availableWidth);
|
||||||
auto unreadTop = texttop + st::dialogsTextFont->ascent - st::dialogsUnreadFont->ascent - (st::dialogsUnreadHeight - st::dialogsUnreadFont->height) / 2;
|
auto unreadTop = texttop + st::dialogsTextFont->ascent - st::dialogsUnreadFont->ascent - (st::dialogsUnreadHeight - st::dialogsUnreadFont->height) / 2;
|
||||||
|
|
Loading…
Reference in New Issue