From adb25d65c2776903d52d21acad083817922d4740 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 10 Feb 2022 13:08:39 +0300 Subject: [PATCH] Use shortened count for unread badges in main menu. --- Telegram/SourceFiles/window/window_main_menu.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index d2e93dc525..6a7ba2d907 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -188,13 +188,11 @@ void AddUnreadBadge( ) | rpl::start_with_next([=](UnreadBadge badge) { state->st.muted = badge.muted; state->count = badge.count; - if (!badge.count) { + if (!state->count) { state->widget.hide(); return; } - state->string = (state->count > 99) - ? "99+" - : QString::number(state->count); + state->string = Lang::FormatCountToShort(state->count).string; state->widget.resize(CountUnreadBadgeSize(state->string, state->st)); if (state->widget.isHidden()) { state->widget.show(); @@ -535,10 +533,8 @@ QString MainMenu::ToggleAccountsButton::computeUnreadBadge() const { const auto state = OtherAccountsUnreadStateCurrent(); return state.allMuted ? QString() - : (state.count > 99) - ? u"99+"_q : (state.count > 0) - ? QString::number(state.count) + ? Lang::FormatCountToShort(state.count).string : QString(); }