Merge tag 'v5.16.2' into dev

This commit is contained in:
AlexeyZavar
2025-07-07 01:23:20 +03:00
458 changed files with 23605 additions and 5958 deletions
+5 -5
View File
@@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "lang/lang_tag.h"
#include "core/stars_amount.h"
#include "core/credits_amount.h"
#include "lang/lang_keys.h"
#include "ui/text/text.h"
#include "base/qt/qt_common_adapters.h"
@@ -952,18 +952,18 @@ QString FormatExactCountDecimal(float64 number) {
return QLocale().toString(number, 'f', QLocale::FloatingPointShortest);
}
ShortenedCount FormatStarsAmountToShort(StarsAmount amount) {
ShortenedCount FormatCreditsAmountToShort(CreditsAmount amount) {
const auto attempt = FormatCountToShort(amount.whole());
return attempt.shortened ? attempt : ShortenedCount{
.string = FormatStarsAmountDecimal(amount),
.string = FormatCreditsAmountDecimal(amount),
};
}
QString FormatStarsAmountDecimal(StarsAmount amount) {
QString FormatCreditsAmountDecimal(CreditsAmount amount) {
return FormatExactCountDecimal(amount.value());
}
QString FormatStarsAmountRounded(StarsAmount amount) {
QString FormatCreditsAmountRounded(CreditsAmount amount) {
const auto value = amount.value();
return FormatExactCountDecimal(base::SafeRound(value * 100.) / 100.);
}
+5 -4
View File
@@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
class StarsAmount;
class CreditsAmount;
enum lngtag_count : int;
@@ -29,9 +29,10 @@ struct ShortenedCount {
[[nodiscard]] ShortenedCount FormatCountToShort(int64 number);
[[nodiscard]] QString FormatCountDecimal(int64 number);
[[nodiscard]] QString FormatExactCountDecimal(float64 number);
[[nodiscard]] ShortenedCount FormatStarsAmountToShort(StarsAmount amount);
[[nodiscard]] QString FormatStarsAmountDecimal(StarsAmount amount);
[[nodiscard]] QString FormatStarsAmountRounded(StarsAmount amount);
[[nodiscard]] ShortenedCount FormatCreditsAmountToShort(
CreditsAmount amount);
[[nodiscard]] QString FormatCreditsAmountDecimal(CreditsAmount amount);
[[nodiscard]] QString FormatCreditsAmountRounded(CreditsAmount amount);
struct PluralResult {
int keyShift = 0;