From dc45edf172bf6ea2aa54dc88c37877044d33a936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABlle=20Braud?= Date: Thu, 23 Jan 2025 15:32:47 +0000 Subject: [PATCH] fix time zone \ + crop text when too large \ + muted icon sticker --- Linphone/tool/Utils.cpp | 14 ++++++++------ .../view/Control/Display/Call/CallListView.qml | 2 ++ Linphone/view/Control/Display/Sticker.qml | 17 ++++++++++------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Linphone/tool/Utils.cpp b/Linphone/tool/Utils.cpp index 5f01076db..a8f50dfc4 100644 --- a/Linphone/tool/Utils.cpp +++ b/Linphone/tool/Utils.cpp @@ -285,7 +285,9 @@ QString Utils::formatDate(const QDateTime &date, bool includeTime) { 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"; + QString format = date.date().year() == QDateTime::currentDateTime(date.timeZone()).date().year() + ? "dd MMMM" + : "dd MMMM yyyy"; dateDay = App::getInstance()->getLocale().toString(date.date(), format); } if (!includeTime) return dateDay; @@ -305,7 +307,7 @@ QString Utils::formatDateElapsedTime(const QDateTime &date) { // if (M > 0) return QString::number(M) + " months"; // auto w = floor(seconds / 604800); // if (w > 0) return QString::number(w) + " week"; - auto dateSec = date.secsTo(QDateTime::currentDateTime()); + auto dateSec = date.secsTo(QDateTime::currentDateTime(date.timeZone())); auto d = floor(dateSec / 86400); if (d > 7) { @@ -413,7 +415,7 @@ QString Utils::generateSavedFilename(const QString &from, const QString &to) { return QString(str).replace(regexp, ""); }; return QStringLiteral("%1_%2_%3") - .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")) + .arg(QDateTime::currentDateTime(QTimeZone::systemTimeZone()).toString("yyyy-MM-dd_hh-mm-ss")) .arg(escape(from)) .arg(escape(to)); } @@ -1263,7 +1265,7 @@ QString Utils::toDateMonthAndYearString(const QDateTime &date) { bool Utils::isCurrentDay(QDateTime date) { auto dateDayNum = date.date().day(); - auto currentDate = QDateTime::currentDateTime(); + auto currentDate = QDateTime::currentDateTime(date.timeZone()); auto currentDayNum = currentDate.date().day(); auto daysTo = date.daysTo(currentDate); return (dateDayNum == currentDayNum && daysTo == 0); @@ -1289,11 +1291,11 @@ bool Utils::dateisInMonth(const QDate &a, int month, int year) { QDateTime Utils::createDateTime(const QDate &date, int hour, int min) { QTime time(hour, min); - return QDateTime(date, time); + return QDateTime(date, time, QTimeZone::systemTimeZone()); } QDateTime Utils::getCurrentDateTime() { - return QDateTime::currentDateTime(); + return QDateTime::currentDateTime(QTimeZone::systemTimeZone()); } QDateTime Utils::getCurrentDateTimeUtc() { diff --git a/Linphone/view/Control/Display/Call/CallListView.qml b/Linphone/view/Control/Display/Call/CallListView.qml index 0dfcf3503..6e25405ed 100644 --- a/Linphone/view/Control/Display/Call/CallListView.qml +++ b/Linphone/view/Control/Display/Call/CallListView.qml @@ -43,6 +43,8 @@ ListView { ? modelData.core.conference.core.subject : remoteNameObj ? remoteNameObj.value : "" font.pixelSize: 14 * DefaultStyle.dp + Layout.fillWidth: true + maximumLineCount: 1 } Text { id: callStateText diff --git a/Linphone/view/Control/Display/Sticker.qml b/Linphone/view/Control/Display/Sticker.qml index 22154b731..1c44a0c19 100644 --- a/Linphone/view/Control/Display/Sticker.qml +++ b/Linphone/view/Control/Display/Sticker.qml @@ -280,17 +280,20 @@ Item { height: 18 * DefaultStyle.dp spacing: 0 - CheckableButton { + Rectangle { id: muteIcon - icon.source: AppIcons.microphoneSlash Layout.preferredWidth: Math.min(mainItem.width / 16, 20 * DefaultStyle.dp) Layout.preferredHeight: Math.min(mainItem.width / 16, 20 * DefaultStyle.dp) visible: mainItem.mutedStatus - icon.width: Math.min(mainItem.width / 16, 20 * DefaultStyle.dp) - icon.height: Math.min(mainItem.width / 16, 20 * DefaultStyle.dp) - enabled: false - contentImageColor: DefaultStyle.main2_500main - backgroundColor: DefaultStyle.grey_0 + color: DefaultStyle.grey_0 + radius: width /2 + EffectImage { + anchors.centerIn: parent + imageWidth: Math.min(mainItem.width / 16, 20 * DefaultStyle.dp) + imageHeight: Math.min(mainItem.width / 16, 20 * DefaultStyle.dp) + imageSource: AppIcons.microphoneSlash + colorizationColor: DefaultStyle.main2_500main + } } } }