Show small unread mark for non-opened topics.

This commit is contained in:
John Preston 2022-11-15 19:49:14 +04:00
parent ce631436bf
commit bb106b07af
3 changed files with 29 additions and 1 deletions

View file

@ -750,6 +750,7 @@ Dialogs::BadgesState ForumTopic::chatListBadgesState() const {
if (!result.unread && _replies->inboxReadTillId() < 2) {
result.unread = channel()->amIn()
&& (_lastKnownServerMessageId > history()->inboxReadTillId());
result.unreadMuted = muted();
}
return result;
}

View file

@ -20,6 +20,7 @@ DialogRow {
topicsSkip: pixels;
topicsSkipBig: pixels;
topicsHeight: pixels;
unreadMarkDiameter: pixels;
}
ForumTopicIcon {
@ -474,6 +475,7 @@ forumTopicRow: DialogRow(defaultDialogRow) {
nameTop: 7px;
textLeft: 68px;
textTop: 29px;
unreadMarkDiameter: 8px;
}
forumTopicIconPosition: point(2px, 0px);
editTopicTitleMargin: margins(70px, 2px, 22px, 18px);

View file

@ -112,7 +112,32 @@ int PaintBadges(
bool displayPinnedIcon = false,
int pinnedIconTop = 0) {
auto initial = right;
if (badgesState.unread) {
if (badgesState.unread
&& !badgesState.unreadCounter
&& context.st->unreadMarkDiameter > 0) {
const auto d = context.st->unreadMarkDiameter;
UnreadBadgeStyle st;
PainterHighQualityEnabler hq(p);
const auto rect = QRect(
right - st.size + (st.size - d) / 2,
top + (st.size - d) / 2,
d,
d);
p.setPen(Qt::NoPen);
p.setBrush(badgesState.unreadMuted
? (context.active
? st::dialogsUnreadBgMutedActive
: context.selected
? st::dialogsUnreadBgMutedOver
: st::dialogsUnreadBgMuted)
: (context.active
? st::dialogsUnreadBgActive
: context.selected
? st::dialogsUnreadBgOver
: st::dialogsUnreadBg));
p.drawEllipse(rect);
right -= st.size + st.padding;
} else if (badgesState.unread) {
UnreadBadgeStyle st;
st.active = context.active;
st.selected = context.selected;