mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improved display of unread badges in dialogs list with narrowed mode.
This commit is contained in:
parent
bf07b832f0
commit
eb821c1f36
1 changed files with 18 additions and 6 deletions
|
@ -140,8 +140,9 @@ int PaintBadges(
|
||||||
BadgesState badgesState,
|
BadgesState badgesState,
|
||||||
int right,
|
int right,
|
||||||
int top,
|
int top,
|
||||||
bool displayPinnedIcon = false,
|
bool displayPinnedIcon,
|
||||||
int pinnedIconTop = 0) {
|
int pinnedIconTop,
|
||||||
|
bool narrow) {
|
||||||
auto initial = right;
|
auto initial = right;
|
||||||
if (const auto used = PaintRightButton(p, context)) {
|
if (const auto used = PaintRightButton(p, context)) {
|
||||||
return used - st::dialogsUnreadPadding;
|
return used - st::dialogsUnreadPadding;
|
||||||
|
@ -175,9 +176,16 @@ int PaintBadges(
|
||||||
st.active = context.active;
|
st.active = context.active;
|
||||||
st.selected = context.selected;
|
st.selected = context.selected;
|
||||||
st.muted = badgesState.unreadMuted;
|
st.muted = badgesState.unreadMuted;
|
||||||
const auto counter = (badgesState.unreadCounter > 0)
|
const auto counter = (badgesState.unreadCounter <= 0)
|
||||||
|
? QString()
|
||||||
|
: !narrow
|
||||||
? QString::number(badgesState.unreadCounter)
|
? QString::number(badgesState.unreadCounter)
|
||||||
: QString();
|
: ((badgesState.mention || badgesState.reaction)
|
||||||
|
&& (badgesState.unreadCounter > 999))
|
||||||
|
? (u"99+"_q)
|
||||||
|
: (badgesState.unreadCounter > 999999)
|
||||||
|
? (u"99999+"_q)
|
||||||
|
: QString::number(badgesState.unreadCounter);
|
||||||
const auto badge = PaintUnreadBadge(p, counter, right, top, st);
|
const auto badge = PaintUnreadBadge(p, counter, right, top, st);
|
||||||
right -= badge.width() + st.padding;
|
right -= badge.width() + st.padding;
|
||||||
} else if (displayPinnedIcon) {
|
} else if (displayPinnedIcon) {
|
||||||
|
@ -241,7 +249,10 @@ void PaintNarrowCounter(
|
||||||
context,
|
context,
|
||||||
badgesState,
|
badgesState,
|
||||||
context.st->padding.left() + context.st->photoSize,
|
context.st->padding.left() + context.st->photoSize,
|
||||||
top);
|
top,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PaintWideCounter(
|
int PaintWideCounter(
|
||||||
|
@ -262,7 +273,8 @@ int PaintWideCounter(
|
||||||
context.width - context.st->padding.right(),
|
context.width - context.st->padding.right(),
|
||||||
top,
|
top,
|
||||||
displayPinnedIcon,
|
displayPinnedIcon,
|
||||||
texttop);
|
texttop,
|
||||||
|
false);
|
||||||
return availableWidth - used;
|
return availableWidth - used;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue