Update API scheme on layer 206.

This commit is contained in:
John Preston
2025-06-23 18:10:07 +04:00
parent dc19f2e76c
commit 0fa50f1951
57 changed files with 556 additions and 348 deletions

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.);
}

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;