2020-09-30 11:32:02 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
|
2022-05-10 14:22:28 +00:00
|
|
|
inline constexpr auto FileStatusSizeReady = 0xFFFFFFF0LL;
|
|
|
|
inline constexpr auto FileStatusSizeLoaded = 0xFFFFFFF1LL;
|
|
|
|
inline constexpr auto FileStatusSizeFailed = 0xFFFFFFF2LL;
|
2020-09-30 11:32:02 +00:00
|
|
|
|
|
|
|
[[nodiscard]] QString FormatSizeText(qint64 size);
|
|
|
|
[[nodiscard]] QString FormatDownloadText(qint64 ready, qint64 total);
|
2020-11-17 03:38:39 +00:00
|
|
|
[[nodiscard]] QString FormatProgressText(qint64 ready, qint64 total);
|
2021-10-07 05:37:42 +00:00
|
|
|
[[nodiscard]] QString FormatDateTime(
|
|
|
|
QDateTime date,
|
|
|
|
QString dateFormat,
|
|
|
|
QString timeFormat);
|
2020-09-30 11:32:02 +00:00
|
|
|
[[nodiscard]] QString FormatDurationText(qint64 duration);
|
|
|
|
[[nodiscard]] QString FormatDurationWords(qint64 duration);
|
2022-09-10 04:19:26 +00:00
|
|
|
[[nodiscard]] QString FormatDurationWordsSlowmode(qint64 duration);
|
2020-09-30 11:32:02 +00:00
|
|
|
[[nodiscard]] QString FormatDurationAndSizeText(qint64 duration, qint64 size);
|
|
|
|
[[nodiscard]] QString FormatGifAndSizeText(qint64 size);
|
|
|
|
[[nodiscard]] QString FormatPlayedText(qint64 played, qint64 duration);
|
2021-07-08 19:15:11 +00:00
|
|
|
[[nodiscard]] QString FormatImageSizeText(const QSize &size);
|
2021-08-29 16:32:20 +00:00
|
|
|
[[nodiscard]] QString FormatPhone(const QString &phone);
|
2022-03-31 12:59:35 +00:00
|
|
|
[[nodiscard]] QString FormatTTL(float64 ttl);
|
2022-11-27 14:54:24 +00:00
|
|
|
[[nodiscard]] QString FormatTTLAfter(float64 ttl);
|
2022-03-28 20:12:38 +00:00
|
|
|
[[nodiscard]] QString FormatTTLTiny(float64 ttl);
|
2022-04-01 16:07:17 +00:00
|
|
|
[[nodiscard]] QString FormatMuteFor(float64 sec);
|
2022-03-30 19:57:36 +00:00
|
|
|
[[nodiscard]] QString FormatMuteForTiny(float64 sec);
|
2022-05-09 16:24:34 +00:00
|
|
|
[[nodiscard]] QString FormatResetCloudPasswordIn(float64 sec);
|
2020-09-30 11:32:02 +00:00
|
|
|
|
2021-04-01 09:27:39 +00:00
|
|
|
struct CurrencyRule {
|
|
|
|
const char *international = "";
|
|
|
|
char thousands = ',';
|
|
|
|
char decimal = '.';
|
|
|
|
bool left = true;
|
|
|
|
bool space = false;
|
|
|
|
int exponent = 2;
|
|
|
|
bool stripDotZero = false;
|
|
|
|
};
|
|
|
|
|
2020-09-30 11:32:02 +00:00
|
|
|
[[nodiscard]] QString FillAmountAndCurrency(
|
2021-03-23 16:06:59 +00:00
|
|
|
int64 amount,
|
2021-04-02 11:46:48 +00:00
|
|
|
const QString ¤cy,
|
|
|
|
bool forceStripDotZero = false);
|
2021-04-01 09:27:39 +00:00
|
|
|
[[nodiscard]] CurrencyRule LookupCurrencyRule(const QString ¤cy);
|
|
|
|
[[nodiscard]] QString FormatWithSeparators(
|
|
|
|
double amount,
|
|
|
|
int precision,
|
|
|
|
char decimal,
|
|
|
|
char thousands);
|
2020-09-30 11:32:02 +00:00
|
|
|
|
|
|
|
} // namespace Ui
|