change date format in chat list #LINQT-2320
Verify local video direction to activate camera #LINQT-2328
This commit is contained in:
parent
e9f04a8aaf
commit
7e9e3e6f55
5 changed files with 20 additions and 6 deletions
|
|
@ -111,7 +111,8 @@ CallCore::CallCore(const std::shared_ptr<linphone::Call> &call) : QObject(nullpt
|
||||||
auto videoDirection = callParams->getVideoDirection();
|
auto videoDirection = callParams->getVideoDirection();
|
||||||
mLocalVideoEnabled =
|
mLocalVideoEnabled =
|
||||||
videoDirection == linphone::MediaDirection::SendOnly || videoDirection == linphone::MediaDirection::SendRecv;
|
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();
|
auto remoteParams = call->getRemoteParams();
|
||||||
videoDirection = remoteParams ? remoteParams->getVideoDirection() : linphone::MediaDirection::Inactive;
|
videoDirection = remoteParams ? remoteParams->getVideoDirection() : linphone::MediaDirection::Inactive;
|
||||||
mRemoteVideoEnabled =
|
mRemoteVideoEnabled =
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ void CallModel::accept(bool withVideo) {
|
||||||
activateLocalVideo(params, withVideo);
|
activateLocalVideo(params, withVideo);
|
||||||
mMonitor->acceptWithParams(params);
|
mMonitor->acceptWithParams(params);
|
||||||
emit localVideoEnabledChanged(withVideo);
|
emit localVideoEnabledChanged(withVideo);
|
||||||
emit cameraEnabledChanged(params->cameraEnabled());
|
emit cameraEnabledChanged(withVideo && params->cameraEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallModel::decline() {
|
void CallModel::decline() {
|
||||||
|
|
@ -460,9 +460,11 @@ void CallModel::onStateChanged(const std::shared_ptr<linphone::Call> &call,
|
||||||
auto videoDirection = params->getVideoDirection();
|
auto videoDirection = params->getVideoDirection();
|
||||||
auto remoteVideoDirection = call->getRemoteParams()->getVideoDirection();
|
auto remoteVideoDirection = call->getRemoteParams()->getVideoDirection();
|
||||||
lInfo() << log().arg("Camera enabled changed") << params->cameraEnabled();
|
lInfo() << log().arg("Camera enabled changed") << params->cameraEnabled();
|
||||||
emit cameraEnabledChanged(params->cameraEnabled());
|
|
||||||
emit localVideoEnabledChanged(videoDirection == linphone::MediaDirection::SendOnly ||
|
emit localVideoEnabledChanged(videoDirection == linphone::MediaDirection::SendOnly ||
|
||||||
videoDirection == linphone::MediaDirection::SendRecv);
|
videoDirection == linphone::MediaDirection::SendRecv);
|
||||||
|
emit cameraEnabledChanged((videoDirection == linphone::MediaDirection::SendOnly ||
|
||||||
|
videoDirection == linphone::MediaDirection::SendRecv) &&
|
||||||
|
params->cameraEnabled());
|
||||||
emit remoteVideoEnabledChanged(remoteVideoDirection == linphone::MediaDirection::SendOnly ||
|
emit remoteVideoEnabledChanged(remoteVideoDirection == linphone::MediaDirection::SendOnly ||
|
||||||
remoteVideoDirection == linphone::MediaDirection::SendRecv);
|
remoteVideoDirection == linphone::MediaDirection::SendRecv);
|
||||||
updateConferenceVideoLayout();
|
updateConferenceVideoLayout();
|
||||||
|
|
|
||||||
|
|
@ -1397,6 +1397,11 @@ bool Utils::isCurrentMonth(QDate date) {
|
||||||
return date.month() == currentDate.month() && date.year() == currentDate.year();
|
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) {
|
bool Utils::datesAreEqual(const QDate &a, const QDate &b) {
|
||||||
return a.month() == b.month() && a.year() == b.year() && a.day() == b.day();
|
return a.month() == b.month() && a.year() == b.year() && a.day() == b.day();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,7 @@ public:
|
||||||
Q_INVOKABLE static bool isCurrentDay(QDateTime date);
|
Q_INVOKABLE static bool isCurrentDay(QDateTime date);
|
||||||
Q_INVOKABLE static bool isCurrentDay(QDate date);
|
Q_INVOKABLE static bool isCurrentDay(QDate date);
|
||||||
Q_INVOKABLE static bool isCurrentMonth(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 datesAreEqual(const QDate &a, const QDate &b);
|
||||||
Q_INVOKABLE static bool dateisInMonth(const QDate &a, int month, int year);
|
Q_INVOKABLE static bool dateisInMonth(const QDate &a, int month, int year);
|
||||||
Q_INVOKABLE static QDateTime createDateTime(const QDate &date, int hour, int min);
|
Q_INVOKABLE static QDateTime createDateTime(const QDate &date, int hour, int min);
|
||||||
|
|
@ -246,9 +247,13 @@ public:
|
||||||
static QUrl getRegistrationStateIcon(LinphoneEnums::RegistrationState state);
|
static QUrl getRegistrationStateIcon(LinphoneEnums::RegistrationState state);
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#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
|
#else
|
||||||
static std::string getNativeString(const QString &s){ return s.toStdString(); }
|
static std::string getNativeString(const QString &s) {
|
||||||
|
return s.toStdString();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,8 @@ ListView {
|
||||||
Item{Layout.fillWidth: true}
|
Item{Layout.fillWidth: true}
|
||||||
Text {
|
Text {
|
||||||
color: DefaultStyle.main2_500_main
|
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 {
|
font {
|
||||||
pixelSize: Typography.p3.pixelSize
|
pixelSize: Typography.p3.pixelSize
|
||||||
weight: Typography.p3.weight
|
weight: Typography.p3.weight
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue