diff --git a/Linphone/core/call/CallCore.cpp b/Linphone/core/call/CallCore.cpp index c27edab1..864b54ac 100644 --- a/Linphone/core/call/CallCore.cpp +++ b/Linphone/core/call/CallCore.cpp @@ -111,7 +111,8 @@ CallCore::CallCore(const std::shared_ptr &call) : QObject(nullpt auto videoDirection = callParams->getVideoDirection(); mLocalVideoEnabled = videoDirection == linphone::MediaDirection::SendOnly || videoDirection == linphone::MediaDirection::SendRecv; - mCameraEnabled = callParams->cameraEnabled(); + mCameraEnabled = mLocalVideoEnabled && callParams->cameraEnabled(); + qDebug() << "create call with camera enabled" << mLocalVideoEnabled << callParams->cameraEnabled(); auto remoteParams = call->getRemoteParams(); videoDirection = remoteParams ? remoteParams->getVideoDirection() : linphone::MediaDirection::Inactive; mRemoteVideoEnabled = diff --git a/Linphone/model/call/CallModel.cpp b/Linphone/model/call/CallModel.cpp index bd04d40a..67219948 100644 --- a/Linphone/model/call/CallModel.cpp +++ b/Linphone/model/call/CallModel.cpp @@ -69,7 +69,7 @@ void CallModel::accept(bool withVideo) { activateLocalVideo(params, withVideo); mMonitor->acceptWithParams(params); emit localVideoEnabledChanged(withVideo); - emit cameraEnabledChanged(params->cameraEnabled()); + emit cameraEnabledChanged(withVideo && params->cameraEnabled()); } void CallModel::decline() { @@ -460,9 +460,11 @@ void CallModel::onStateChanged(const std::shared_ptr &call, auto videoDirection = params->getVideoDirection(); auto remoteVideoDirection = call->getRemoteParams()->getVideoDirection(); lInfo() << log().arg("Camera enabled changed") << params->cameraEnabled(); - emit cameraEnabledChanged(params->cameraEnabled()); emit localVideoEnabledChanged(videoDirection == linphone::MediaDirection::SendOnly || videoDirection == linphone::MediaDirection::SendRecv); + emit cameraEnabledChanged((videoDirection == linphone::MediaDirection::SendOnly || + videoDirection == linphone::MediaDirection::SendRecv) && + params->cameraEnabled()); emit remoteVideoEnabledChanged(remoteVideoDirection == linphone::MediaDirection::SendOnly || remoteVideoDirection == linphone::MediaDirection::SendRecv); updateConferenceVideoLayout(); diff --git a/Linphone/tool/Utils.cpp b/Linphone/tool/Utils.cpp index fa08093b..b62ec8dd 100644 --- a/Linphone/tool/Utils.cpp +++ b/Linphone/tool/Utils.cpp @@ -1397,6 +1397,11 @@ bool Utils::isCurrentMonth(QDate date) { return date.month() == currentDate.month() && date.year() == currentDate.year(); } +bool Utils::isCurrentYear(QDate date) { + auto currentDate = QDate::currentDate(); + return date.year() == currentDate.year(); +} + bool Utils::datesAreEqual(const QDate &a, const QDate &b) { return a.month() == b.month() && a.year() == b.year() && a.day() == b.day(); } diff --git a/Linphone/tool/Utils.hpp b/Linphone/tool/Utils.hpp index 9bbdff6d..460a1b96 100644 --- a/Linphone/tool/Utils.hpp +++ b/Linphone/tool/Utils.hpp @@ -117,6 +117,7 @@ public: Q_INVOKABLE static bool isCurrentDay(QDateTime date); Q_INVOKABLE static bool isCurrentDay(QDate date); Q_INVOKABLE static bool isCurrentMonth(QDate date); + Q_INVOKABLE static bool isCurrentYear(QDate date); Q_INVOKABLE static bool datesAreEqual(const QDate &a, const QDate &b); Q_INVOKABLE static bool dateisInMonth(const QDate &a, int month, int year); Q_INVOKABLE static QDateTime createDateTime(const QDate &date, int hour, int min); @@ -246,9 +247,13 @@ public: static QUrl getRegistrationStateIcon(LinphoneEnums::RegistrationState state); #ifdef Q_OS_WINDOWS - static inline std::wstring getNativeString(const QString &s){ return s.toStdWString(); } + static inline std::wstring getNativeString(const QString &s) { + return s.toStdWString(); + } #else - static std::string getNativeString(const QString &s){ return s.toStdString(); } + static std::string getNativeString(const QString &s) { + return s.toStdString(); + } #endif private: diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index c54f965d..60b7bd21 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -276,7 +276,8 @@ ListView { Item{Layout.fillWidth: true} Text { color: DefaultStyle.main2_500_main - text: modelData ? UtilsCpp.formatDate(modelData.core.lastUpdatedTime, true, false) : "" + property string format: modelData && UtilsCpp.isCurrentYear(modelData.core.lastUpdatedTime) ? "dd/MM" : "dd/MM/yy" + text: modelData ? UtilsCpp.formatDate(modelData.core.lastUpdatedTime, true, false, format) : "" font { pixelSize: Typography.p3.pixelSize weight: Typography.p3.weight