mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix repetitive phone formatting.
This commit is contained in:
parent
529eb4e954
commit
8982a49192
2 changed files with 3 additions and 2 deletions
|
@ -381,13 +381,14 @@ QString FormatImageSizeText(const QSize &size) {
|
||||||
+ QString::number(size.height());
|
+ QString::number(size.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FormatPhone(const QString &phone) {
|
QString FormatPhone(QString phone) {
|
||||||
if (phone.isEmpty()) {
|
if (phone.isEmpty()) {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
if (phone.at(0) == '0') {
|
if (phone.at(0) == '0') {
|
||||||
return phone;
|
return phone;
|
||||||
}
|
}
|
||||||
|
phone = phone.remove(QChar::Space);
|
||||||
return Countries::Instance().format({
|
return Countries::Instance().format({
|
||||||
.phone = (phone.at(0) == '+') ? phone.mid(1) : phone,
|
.phone = (phone.at(0) == '+') ? phone.mid(1) : phone,
|
||||||
}).formatted;
|
}).formatted;
|
||||||
|
|
|
@ -24,7 +24,7 @@ inline constexpr auto FileStatusSizeFailed = 0xFFFFFFF2LL;
|
||||||
[[nodiscard]] QString FormatGifAndSizeText(qint64 size);
|
[[nodiscard]] QString FormatGifAndSizeText(qint64 size);
|
||||||
[[nodiscard]] QString FormatPlayedText(qint64 played, qint64 duration);
|
[[nodiscard]] QString FormatPlayedText(qint64 played, qint64 duration);
|
||||||
[[nodiscard]] QString FormatImageSizeText(const QSize &size);
|
[[nodiscard]] QString FormatImageSizeText(const QSize &size);
|
||||||
[[nodiscard]] QString FormatPhone(const QString &phone);
|
[[nodiscard]] QString FormatPhone(QString phone);
|
||||||
[[nodiscard]] QString FormatTTL(float64 ttl);
|
[[nodiscard]] QString FormatTTL(float64 ttl);
|
||||||
[[nodiscard]] QString FormatTTLAfter(float64 ttl);
|
[[nodiscard]] QString FormatTTLAfter(float64 ttl);
|
||||||
[[nodiscard]] QString FormatTTLTiny(float64 ttl);
|
[[nodiscard]] QString FormatTTLTiny(float64 ttl);
|
||||||
|
|
Loading…
Add table
Reference in a new issue