mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
Call history date formatting adjustments (today, yesterday, etc ...)
This commit is contained in:
parent
536a67652d
commit
a1ff962d1d
2 changed files with 8 additions and 3 deletions
|
|
@ -259,8 +259,13 @@ QString Utils::formatElapsedTime(int seconds, bool dotsSeparator) {
|
|||
}
|
||||
|
||||
QString Utils::formatDate(const QDateTime &date, bool includeTime) {
|
||||
QString format = date.date().year() == QDateTime::currentDateTime().date().year() ? "dd MMMM" : "dd MMMM yyyy";
|
||||
auto dateDay = tr(date.date().toString(format).toLocal8Bit().data());
|
||||
QString dateDay;
|
||||
if (date.date() == QDate::currentDate()) dateDay = tr("Aujourd'hui");
|
||||
else if (date.date() == QDate::currentDate().addDays(-1)) dateDay = tr("Hier");
|
||||
else {
|
||||
QString format = date.date().year() == QDateTime::currentDateTime().date().year() ? "dd MMMM" : "dd MMMM yyyy";
|
||||
auto dateDay = tr(date.date().toString(format).toLocal8Bit().data());
|
||||
}
|
||||
if (!includeTime) return dateDay;
|
||||
|
||||
auto time = date.time().toString("hh:mm");
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ AbstractMainPage {
|
|||
}
|
||||
Text {
|
||||
// text: modelData.core.date
|
||||
text: UtilsCpp.formatDateElapsedTime(modelData.core.date)
|
||||
text: UtilsCpp.formatDate(modelData.core.date, true)
|
||||
font {
|
||||
pixelSize: 12 * DefaultStyle.dp
|
||||
weight: 300 * DefaultStyle.dp
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue