From 6336df2bd6ec8c140cb891fa42b7114d9112645c Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 21 May 2024 05:22:27 +0300 Subject: [PATCH] Slightly improved code style for decimal counts. --- .../view/reactions/history_view_reactions_tabs.cpp | 13 +++++++------ .../statistics/widgets/point_details_widget.cpp | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_tabs.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_tabs.cpp index c3b5848cc..f3b23804f 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_tabs.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_tabs.cpp @@ -7,13 +7,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/reactions/history_view_reactions_tabs.h" -#include "ui/rp_widget.h" -#include "ui/abstract_button.h" -#include "ui/painter.h" -#include "ui/controls/who_reacted_context_action.h" #include "data/data_message_reaction_id.h" -#include "styles/style_widgets.h" +#include "lang/lang_tag.h" +#include "ui/abstract_button.h" +#include "ui/controls/who_reacted_context_action.h" +#include "ui/painter.h" +#include "ui/rp_widget.h" #include "styles/style_chat.h" +#include "styles/style_widgets.h" namespace HistoryView::Reactions { namespace { @@ -35,7 +36,7 @@ not_null CreateTab( bool selected = false; }; const auto stm = &st.item; - const auto text = QString("%L1").arg(count); + const auto text = Lang::FormatCountDecimal(count); const auto font = st::semiboldFont; const auto textWidth = font->width(text); const auto result = Ui::CreateChild(parent.get()); diff --git a/Telegram/SourceFiles/statistics/widgets/point_details_widget.cpp b/Telegram/SourceFiles/statistics/widgets/point_details_widget.cpp index 50d56fec5..305010866 100644 --- a/Telegram/SourceFiles/statistics/widgets/point_details_widget.cpp +++ b/Telegram/SourceFiles/statistics/widgets/point_details_widget.cpp @@ -81,7 +81,7 @@ void PaintDetails( line.name); auto value = Ui::Text::String( st::statisticsDetailsPopupStyle, - QString("%L1").arg(absoluteValue)); + Lang::FormatCountDecimal(absoluteValue)); const auto nameWidth = name.maxWidth(); const auto valueWidth = value.maxWidth(); @@ -177,7 +177,7 @@ PointDetailsWidget::PointDetailsWidget( const auto calculatedWidth = [&]{ const auto maxValueText = Ui::Text::String( _textStyle, - QString("%L1").arg(maxAbsoluteValue)); + Lang::FormatCountDecimal(maxAbsoluteValue)); const auto maxValueTextWidth = maxValueText.maxWidth(); auto maxNameTextWidth = 0; @@ -284,7 +284,7 @@ void PointDetailsWidget::setXIndex(int xIndex) { textLine.name.setText(_textStyle, dataLine.name); textLine.value.setText( _textStyle, - QString("%L1").arg(dataLine.y[xIndex])); + Lang::FormatCountDecimal(dataLine.y[xIndex])); hasPositiveValues |= (dataLine.y[xIndex] > 0); textLine.valueColor = QColor(dataLine.color); if (_chartData.currencyRate) {