2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

cTimeFormat/cDateFormat -> QLocale::ShortFormat

This allows to use platform-specific formatting functions
This commit is contained in:
Ilya Fedin
2022-12-15 13:47:56 +04:00
committed by John Preston
parent 9633f93690
commit 66093f0cb5
25 changed files with 46 additions and 73 deletions

View File

@@ -442,13 +442,13 @@ QString OnlineText(TimeId online, TimeId now) {
const auto nowFull = base::unixtime::parse(now);
const auto locale = QLocale();
if (onlineFull.date() == nowFull.date()) {
const auto onlineTime = locale.toString(onlineFull.time(), cTimeFormat());
const auto onlineTime = locale.toString(onlineFull.time(), QLocale::ShortFormat);
return tr::lng_status_lastseen_today(tr::now, lt_time, onlineTime);
} else if (onlineFull.date().addDays(1) == nowFull.date()) {
const auto onlineTime = locale.toString(onlineFull.time(), cTimeFormat());
const auto onlineTime = locale.toString(onlineFull.time(), QLocale::ShortFormat);
return tr::lng_status_lastseen_yesterday(tr::now, lt_time, onlineTime);
}
const auto date = locale.toString(onlineFull.date(), cDateFormat());
const auto date = locale.toString(onlineFull.date(), QLocale::ShortFormat);
return tr::lng_status_lastseen_date(tr::now, lt_date, date);
}
@@ -469,14 +469,14 @@ QString OnlineTextFull(not_null<UserData*> user, TimeId now) {
const auto nowFull = base::unixtime::parse(now);
const auto locale = QLocale();
if (onlineFull.date() == nowFull.date()) {
const auto onlineTime = locale.toString(onlineFull.time(), cTimeFormat());
const auto onlineTime = locale.toString(onlineFull.time(), QLocale::ShortFormat);
return tr::lng_status_lastseen_today(tr::now, lt_time, onlineTime);
} else if (onlineFull.date().addDays(1) == nowFull.date()) {
const auto onlineTime = locale.toString(onlineFull.time(), cTimeFormat());
const auto onlineTime = locale.toString(onlineFull.time(), QLocale::ShortFormat);
return tr::lng_status_lastseen_yesterday(tr::now, lt_time, onlineTime);
}
const auto date = locale.toString(onlineFull.date(), cDateFormat());
const auto time = locale.toString(onlineFull.time(), cTimeFormat());
const auto date = locale.toString(onlineFull.date(), QLocale::ShortFormat);
const auto time = locale.toString(onlineFull.time(), QLocale::ShortFormat);
return tr::lng_status_lastseen_date_time(tr::now, lt_date, date, lt_time, time);
}