change date format in chat list #LINQT-2320

Verify local video direction to activate camera #LINQT-2328
This commit is contained in:
Gaelle Braud 2026-01-09 17:38:42 +01:00
parent e9f04a8aaf
commit 7e9e3e6f55
5 changed files with 20 additions and 6 deletions

View file

@ -111,7 +111,8 @@ CallCore::CallCore(const std::shared_ptr<linphone::Call> &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 =

View file

@ -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<linphone::Call> &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();

View file

@ -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();
}

View file

@ -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:

View file

@ -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