mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-21 00:23:56 +08:00
Moved out common big unread counter formatting logic to single place.
This commit is contained in:
@@ -44,6 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/unread_badge.h"
|
||||
#include "ui/unread_badge_paint.h"
|
||||
#include "ui/unread_counter_format.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_widgets.h"
|
||||
#include "styles/style_window.h"
|
||||
@@ -180,16 +181,10 @@ int PaintBadges(
|
||||
st.active = context.active;
|
||||
st.selected = context.selected;
|
||||
st.muted = badgesState.unreadMuted;
|
||||
const auto counter = (badgesState.unreadCounter <= 0)
|
||||
? QString()
|
||||
: !narrow
|
||||
? QString::number(badgesState.unreadCounter)
|
||||
: ((badgesState.mention || badgesState.reaction)
|
||||
&& (badgesState.unreadCounter > 999))
|
||||
? (u"99+"_q)
|
||||
: (badgesState.unreadCounter > 999999)
|
||||
? (u"99999+"_q)
|
||||
: QString::number(badgesState.unreadCounter);
|
||||
const auto counter = FormatUnreadCounter(
|
||||
badgesState.unreadCounter,
|
||||
badgesState.mention || badgesState.reaction,
|
||||
narrow);
|
||||
const auto badge = PaintUnreadBadge(p, counter, right, top, st);
|
||||
right -= badge.width() + st.padding;
|
||||
} else if (const auto used = PaintRightButton(p, context)) {
|
||||
|
||||
Reference in New Issue
Block a user