From 22b3e80717bc73d28fa20c6366f58e4bd5e08405 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Wed, 10 Apr 2024 10:27:37 +0200 Subject: [PATCH] Local Address, meeting dates, carshes on meeting and dial-out. --- CMakeLists.txt | 20 +++++------ Linphone/core/account/AccountCore.cpp | 1 + Linphone/core/call/CallCore.cpp | 5 +++ Linphone/core/call/CallCore.hpp | 3 ++ Linphone/core/camera/CameraGui.cpp | 3 ++ .../core/conference/ConferenceInfoCore.cpp | 33 +++++++++++-------- .../core/conference/ConferenceInfoCore.hpp | 2 +- .../participant/ParticipantDeviceCore.cpp | 1 + Linphone/model/call/CallModel.cpp | 2 ++ Linphone/model/core/CoreModel.cpp | 2 +- .../participant/ParticipantDeviceModel.cpp | 7 +++- Linphone/view/Item/Contact/Sticker.qml | 8 ++--- Linphone/view/Item/Meeting/MeetingList.qml | 9 +++-- Linphone/view/Layout/Call/GridLayout.qml | 11 ++++--- Linphone/view/Page/Main/CallPage.qml | 10 +++++- external/linphone-sdk | 2 +- 16 files changed, 74 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5db99cf5..9d8c6685f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,7 @@ endif() set(CMAKE_INSTALL_PREFIX "${APPLICATION_OUTPUT_DIR}") if( APPLE ) + set(LINPHONEAPP_MACOS_ARCHS "x86_64" CACHE STRING "MacOS architectures to build: comma-separated list of values in [arm64, x86_64]") set(LINPHONESDK_BUILD_TYPE "Default")#Using Mac will remove all SDK targets. set(ENABLE_FAT_BINARY "ON") # Disable XCFrameworks as it is not supported. @@ -66,15 +67,11 @@ if( APPLE ) set(CMAKE_INSTALL_DATAROOTDIR "${APPLICATION_NAME}.app/Contents/Resources/share") if( NOT CMAKE_OSX_DEPLOYMENT_TARGET) - set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")#Qt: 'path' is unavailable: introduced in macOS 10.15 - endif() - if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64")# TODO: add universal build - set(LINPHONESDK_MACOS_ARCHS "x86_64" CACHE STRING "MacOS architectures to build for: comma-separated list of values in [x86_64]") - else() - set(LINPHONESDK_MACOS_ARCHS "x86_64" CACHE STRING "MacOS architectures to build for: comma-separated list of values in [x86_64]") + #set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")#Qt: 'path' is unavailable: introduced in macOS 10.15 + set(CMAKE_OSX_DEPLOYMENT_TARGET "12.3")#ScreenSharing: 'SCStreamConfiguration' has been introduced in macOS 12.3 endif() + set(LINPHONESDK_MACOS_ARCHS ${LINPHONEAPP_MACOS_ARCHS}) set(CMAKE_OSX_ARCHITECTURES ${LINPHONESDK_MACOS_ARCHS} CACHE STRING "") - set(CMAKE_SYSTEM_PROCESSOR "x86_64") elseif(WIN32) set(LINPHONESDK_BUILD_TYPE "Default") else() @@ -186,12 +183,11 @@ set(ENABLE_CSHARP_WRAPPER OFF CACHE BOOL "Build the CSharp wrapper for Liblinpho set(ENABLE_THEORA OFF) set(ENABLE_QT_GL ${ENABLE_VIDEO}) -# Qt5.13 because of Spitview -#find_package(Qt5 5.13 COMPONENTS Core REQUIRED) +find_package(Qt6 REQUIRED COMPONENTS Core) -#if(NOT Qt5_FOUND) -# message(FATAL_ERROR "Minimum supported Qt5 version is 5.13!") -#endif() +if(NOT Qt6_FOUND) + message(FATAL_ERROR "Minimum supported Qt6!") +endif() set(LINPHONEAPP_BUILD_TYPE "Default" CACHE STRING "Type of build") set_property(CACHE LINPHONEAPP_BUILD_TYPE PROPERTY STRINGS "Default" "Macos" "Normal") diff --git a/Linphone/core/account/AccountCore.cpp b/Linphone/core/account/AccountCore.cpp index f423e3d91..c4022f5d4 100644 --- a/Linphone/core/account/AccountCore.cpp +++ b/Linphone/core/account/AccountCore.cpp @@ -125,6 +125,7 @@ void AccountCore::setUnreadNotifications(int unread) { void AccountCore::onRegistrationStateChanged(const std::shared_ptr &account, linphone::RegistrationState state, const std::string &message) { + qDebug() << log().arg(Q_FUNC_INFO) << (int)state; mRegistrationState = LinphoneEnums::fromLinphone(state); emit registrationStateChanged(Utils::coreStringToAppString(message)); } diff --git a/Linphone/core/call/CallCore.cpp b/Linphone/core/call/CallCore.cpp index 27d3a1df8..cf5541fc1 100644 --- a/Linphone/core/call/CallCore.cpp +++ b/Linphone/core/call/CallCore.cpp @@ -59,6 +59,7 @@ CallCore::CallCore(const std::shared_ptr &call) : QObject(nullpt videoDirection == linphone::MediaDirection::SendOnly || videoDirection == linphone::MediaDirection::SendRecv; mState = LinphoneEnums::fromLinphone(call->getState()); mPeerAddress = Utils::coreStringToAppString(call->getRemoteAddress()->asStringUriOnly()); + mLocalAddress = Utils::coreStringToAppString(call->getCallLog()->getLocalAddress()->asStringUriOnly()); mStatus = LinphoneEnums::fromLinphone(call->getCallLog()->getStatus()); mTransferState = LinphoneEnums::fromLinphone(call->getTransferState()); auto token = Utils::coreStringToAppString(mCallModel->getAuthenticationToken()); @@ -271,6 +272,10 @@ QString CallCore::getPeerAddress() const { return mPeerAddress; } +QString CallCore::getLocalAddress() const { + return mLocalAddress; +} + LinphoneEnums::CallStatus CallCore::getStatus() const { return mStatus; } diff --git a/Linphone/core/call/CallCore.hpp b/Linphone/core/call/CallCore.hpp index ff3cf7822..a5d1d366c 100644 --- a/Linphone/core/call/CallCore.hpp +++ b/Linphone/core/call/CallCore.hpp @@ -44,6 +44,7 @@ class CallCore : public QObject, public AbstractObject { Q_PROPERTY(bool cameraEnabled READ getCameraEnabled WRITE lSetCameraEnabled NOTIFY cameraEnabledChanged) Q_PROPERTY(bool paused READ getPaused WRITE lSetPaused NOTIFY pausedChanged) Q_PROPERTY(QString peerAddress READ getPeerAddress CONSTANT) + Q_PROPERTY(QString localAddress READ getLocalAddress CONSTANT) Q_PROPERTY(bool isSecured READ isSecured NOTIFY securityUpdated) Q_PROPERTY(bool isConference READ isConference NOTIFY conferenceChanged) Q_PROPERTY(LinphoneEnums::MediaEncryption encryption READ getEncryption NOTIFY securityUpdated) @@ -72,6 +73,7 @@ public: void setSelf(QSharedPointer me); QString getPeerAddress() const; + QString getLocalAddress() const; LinphoneEnums::CallStatus getStatus() const; void setStatus(LinphoneEnums::CallStatus status); @@ -222,6 +224,7 @@ private: QString mLastErrorMessage; QString mPeerAddress; + QString mLocalAddress; bool mIsSecured; bool mIsConference = false; int mDuration = 0; diff --git a/Linphone/core/camera/CameraGui.cpp b/Linphone/core/camera/CameraGui.cpp index fdd1bf343..ecce5741d 100644 --- a/Linphone/core/camera/CameraGui.cpp +++ b/Linphone/core/camera/CameraGui.cpp @@ -87,6 +87,9 @@ QQuickFramebufferObject::Renderer *CameraGui::createRenderer(bool resetWindowId) } else { renderer = (QQuickFramebufferObject::Renderer *)call->createNativeVideoWindowId(); if (renderer) call->setNativeVideoWindowId(renderer); + else { + renderer = (QQuickFramebufferObject::Renderer *)call->createNativeVideoWindowId(); + } } } }; diff --git a/Linphone/core/conference/ConferenceInfoCore.cpp b/Linphone/core/conference/ConferenceInfoCore.cpp index e9c060266..8a5639ac5 100644 --- a/Linphone/core/conference/ConferenceInfoCore.cpp +++ b/Linphone/core/conference/ConferenceInfoCore.cpp @@ -45,12 +45,14 @@ ConferenceInfoCore::ConferenceInfoCore(std::shared_ptr QTimeZone::systemTimeZone())); // Always return system timezone because this info is not stored in database. connect(this, &ConferenceInfoCore::dateTimeChanged, [this] { - setDuration(mDateTime.secsTo(mEndDateTime) / 60.0); - setIsScheduled(mDateTime != QDateTime::currentDateTime()); + setDuration(mDateTime.isValid() ? mDateTime.secsTo(mEndDateTime) / 60.0 : 60); + setIsScheduled(mDateTime.isValid()); }); connect(this, &ConferenceInfoCore::endDateTimeChanged, - [this] { setDuration(mDateTime.secsTo(mEndDateTime) / 60.0); }); - connect(this, &ConferenceInfoCore::durationChanged, [this] { setEndDateTime(mDateTime.addSecs(mDuration * 60)); }); + [this] { setDuration(mDateTime.isValid() ? mDateTime.secsTo(mEndDateTime) / 60.0 : 60); }); + connect(this, &ConferenceInfoCore::durationChanged, [this] { + if (mDateTime.isValid()) setEndDateTime(mDateTime.addSecs(mDuration * 60)); + }); if (conferenceInfo) { mustBeInLinphoneThread(getClassName()); @@ -68,6 +70,7 @@ ConferenceInfoCore::ConferenceInfoCore(std::shared_ptr mDateTime = QDateTime::fromMSecsSinceEpoch(conferenceInfo->getDateTime() * 1000, Qt::LocalTime); mDuration = conferenceInfo->getDuration(); mEndDateTime = mDateTime.addSecs(mDuration * 60); + mIsScheduled = mDateTime.isValid(); mOrganizerAddress = Utils::coreStringToAppString(conferenceInfo->getOrganizer()->asStringUriOnly()); mOrganizerName = Utils::coreStringToAppString(conferenceInfo->getOrganizer()->getDisplayName()); if (mOrganizerName.isEmpty()) { @@ -93,8 +96,10 @@ ConferenceInfoCore::ConferenceInfoCore(std::shared_ptr } mConferenceInfoState = LinphoneEnums::fromLinphone(conferenceInfo->getState()); } else { - mDateTime = QDateTime(); - mEndDateTime = mDateTime; + mDateTime = QDateTime::currentDateTime(); + mIsScheduled = true; + mDuration = 60; + mEndDateTime = mDateTime.addSecs(mDuration * 60); App::postModelSync([this]() { auto defaultAccount = CoreModel::getInstance()->getCore()->getDefaultAccount(); if (defaultAccount) { @@ -471,9 +476,6 @@ LinphoneEnums::ConferenceSchedulerState ConferenceInfoCore::getConferenceSchedul // Datetime is in Custom (Locale/UTC/System). Convert into UTC for conference info void ConferenceInfoCore::setIsScheduled(const bool &on) { - if (!on) setDateTime(QDateTime()); - else mDateTime = QDateTime::currentDateTime(); - qDebug() << "set d ate time valid" << mDateTime.isValid(); if (mIsScheduled != on) { mIsScheduled = on; emit isScheduledChanged(); @@ -527,10 +529,13 @@ void ConferenceInfoCore::writeFromModel(const std::shared_ptr model) { mustBeInLinphoneThread(getClassName() + "::writeIntoModel()"); - model->setDateTime(mDateTime); + model->setDateTime(mIsScheduled ? mDateTime : QDateTime()); model->setDuration(mDuration); model->setSubject(mSubject); - model->setOrganizer(mOrganizerAddress); + if (!mOrganizerAddress.isEmpty()) { + model->setOrganizer(mOrganizerAddress); + qDebug() << "Use of " << mOrganizerAddress; + } else qDebug() << "Use of " << model->getOrganizerAddress(); model->setDescription(mDescription); std::list> participantInfos; for (auto &p : mParticipants) { @@ -570,8 +575,8 @@ void ConferenceInfoCore::save() { if (!linphoneConf->getOrganizer()) linphoneConf->setOrganizer(cleanedClonedAddress); if (mOrganizerAddress.isEmpty()) mOrganizerAddress = Utils::coreStringToAppString(accountAddress->asStringUriOnly()); - } - } + } else qCritical() << "No contact address"; + } else qCritical() << "No default account"; mConferenceInfoModel = Utils::makeQObject_ptr(linphoneConf); // mConferenceInfoModel->createConferenceScheduler(); auto confSchedulerModel = mConferenceInfoModel->getConferenceScheduler(); @@ -643,4 +648,4 @@ void ConferenceInfoCore::onInvitationsSent(const std::list &cal void CallModel::onStateChanged(const std::shared_ptr &call, linphone::Call::State state, const std::string &message) { + qDebug() << "CallModel::onStateChanged" << (int)state; if (state == linphone::Call::State::StreamsRunning) { // After UpdatedByRemote, video direction could be changed. auto params = call->getRemoteParams(); @@ -371,6 +372,7 @@ void CallModel::onStateChanged(const std::shared_ptr &call, } void CallModel::onStatusChanged(const std::shared_ptr &call, linphone::Call::Status status) { + qDebug() << "CallModel::onStatusChanged" << (int)status; emit statusChanged(status); } diff --git a/Linphone/model/core/CoreModel.cpp b/Linphone/model/core/CoreModel.cpp index c328d4a15..1b46b1170 100644 --- a/Linphone/model/core/CoreModel.cpp +++ b/Linphone/model/core/CoreModel.cpp @@ -92,7 +92,7 @@ void CoreModel::start() { mCore->start(); setPathAfterStart(); mCore->enableFriendListSubscription(true); - auto videoPolicy = mCore->getVideoActivationPolicy(); + auto videoPolicy = mCore->getVideoActivationPolicy()->clone(); videoPolicy->setAutomaticallyAccept(true); videoPolicy->setAutomaticallyInitiate(false); mCore->setVideoActivationPolicy(videoPolicy); diff --git a/Linphone/model/participant/ParticipantDeviceModel.cpp b/Linphone/model/participant/ParticipantDeviceModel.cpp index 14a84f68a..f3d0fd1b7 100644 --- a/Linphone/model/participant/ParticipantDeviceModel.cpp +++ b/Linphone/model/participant/ParticipantDeviceModel.cpp @@ -106,17 +106,22 @@ void ParticipantDeviceModel::onIsMuted(const std::shared_ptr &participantDevice, linphone::ParticipantDevice::State state) { + qDebug() << log().arg(Q_FUNC_INFO) << participantDevice->getAddress()->asStringUriOnly() << (int)state; emit stateChanged(LinphoneEnums::fromLinphone(state)); } void ParticipantDeviceModel::onStreamCapabilityChanged( const std::shared_ptr &participantDevice, linphone::MediaDirection direction, linphone::StreamType streamType) { + qDebug() << log().arg(Q_FUNC_INFO) << participantDevice->getAddress()->asStringUriOnly() << (int)direction + << (int)streamType; emit streamCapabilityChanged(streamType); } void ParticipantDeviceModel::onStreamAvailabilityChanged( const std::shared_ptr &participantDevice, bool available, linphone::StreamType streamType) { + qDebug() << log().arg(Q_FUNC_INFO) << participantDevice->getAddress()->asStringUriOnly() << available + << (int)streamType; emit streamAvailabilityChanged(streamType); -} \ No newline at end of file +} diff --git a/Linphone/view/Item/Contact/Sticker.qml b/Linphone/view/Item/Contact/Sticker.qml index 995f28587..7dace22af 100644 --- a/Linphone/view/Item/Contact/Sticker.qml +++ b/Linphone/view/Item/Contact/Sticker.qml @@ -21,8 +21,8 @@ Item { property bool displayBorder : participantDevice && participantDevice.core.isSpeaking || false property color color: DefaultStyle.grey_600 property int radius: 15 * DefaultStyle.dp - property var peerAddressObj: previewEnabled - ? UtilsCpp.getDisplayName(account.core.identityAddress) + property var peerAddressObj: previewEnabled && (call || account) + ? UtilsCpp.getDisplayName(account ? account.core.identityAddress : call.core.localAddress) : participantDevice && participantDevice.core ? UtilsCpp.getDisplayName(participantDevice.core.address) : !previewEnabled && call && call.core @@ -30,9 +30,9 @@ Item { : null property string peerAddress:peerAddressObj ? peerAddressObj.value : "" - onPeerAddressChanged: console.log("TOTO " +qmlName + " => " +peerAddress) property var identityAddress: account ? UtilsCpp.getDisplayName(account.core.identityAddress) : null - property bool cameraEnabled: previewEnabled || participantDevice && participantDevice.core.videoEnabled + property bool cameraEnabled: (previewEnabled && call && call.core.cameraEnabled) + || (!previewEnabled && participantDevice && participantDevice.core.videoEnabled) property string qmlName Rectangle { diff --git a/Linphone/view/Item/Meeting/MeetingList.qml b/Linphone/view/Item/Meeting/MeetingList.qml index cea0e488b..f5336e96e 100644 --- a/Linphone/view/Item/Meeting/MeetingList.qml +++ b/Linphone/view/Item/Meeting/MeetingList.qml @@ -40,6 +40,7 @@ ListView { bottomPadding: 16 * DefaultStyle.dp text: section height: 29 * DefaultStyle.dp + topPadding + bottomPadding + wrapMode: Text.NoWrap font { pixelSize: 20 * DefaultStyle.dp weight: 800 * DefaultStyle.dp @@ -81,12 +82,11 @@ ListView { spacing: 0 //anchors.leftMargin: 45 * DefaultStyle.dp Text { - //Layout.preferredWidth: 32 * DefaultStyle.dp Layout.preferredHeight: 19 * DefaultStyle.dp - Layout.fillWidth: true - // opacity: (!previousItem || !previousDateTime.startsWith(displayName[0])) ? 1 : 0 - text: day + text: day.substring(0,3) + '.' color: DefaultStyle.main2_500main + wrapMode: Text.NoWrap + elide: Text.ElideNone font { pixelSize: 14 * DefaultStyle.dp weight: 400 * DefaultStyle.dp @@ -95,7 +95,6 @@ ListView { } Rectangle { id: dayNum - //Layout.preferredWidth: Math.max(32 * DefaultStyle.dp, dayNumText.width+17*DefaultStyle.dp) Layout.fillWidth: true Layout.preferredHeight: width Layout.alignment: Qt.AlignCenter diff --git a/Linphone/view/Layout/Call/GridLayout.qml b/Linphone/view/Layout/Call/GridLayout.qml index 55dceb361..f1e535ad1 100644 --- a/Linphone/view/Layout/Call/GridLayout.qml +++ b/Linphone/view/Layout/Call/GridLayout.qml @@ -19,12 +19,12 @@ Mosaic { property ParticipantDeviceProxy participantDevices : ParticipantDeviceProxy { id: allDevices qmlName: "G" - Component.onCompleted: console.log("Loaded : " +allDevices) + Component.onCompleted: console.log("Loaded : " +allDevices + " = " +allDevices.count) } - model: participantDevices + model: grid.call.core.isConference ? participantDevices: [0,1] delegate: Item{ id: avatarCell - property ParticipantDeviceGui currentDevice: gridModel.participantDevices.getAt(index) + property ParticipantDeviceGui currentDevice: grid.call.core.isConference ? gridModel.participantDevices.getAt(index) : null onCurrentDeviceChanged: { if(index < 0) cameraView.enabled = false // this is a delegate destruction. We need to stop camera before Qt change its currentDevice (and then, let CameraView to delete wrong renderer) } @@ -37,9 +37,10 @@ Mosaic { visible: mainItem.callState != LinphoneEnums.CallState.End && mainItem.callState != LinphoneEnums.CallState.Released anchors.fill: parent qmlName: 'G_'+index - + call: !grid.call.core.isConference ? grid.call : null + participantDevice: avatarCell.currentDevice - Component.onCompleted: console.log(qmlName + " is " +modelData.core.address) + Component.onCompleted: console.log(qmlName + " is " +(call ? call.core.peerAddress : currentDevice ? currentDevice.core.address : 'addr_NotDefined')) } /* Sticker{ diff --git a/Linphone/view/Page/Main/CallPage.qml b/Linphone/view/Page/Main/CallPage.qml index 47647f8cc..efdae2404 100644 --- a/Linphone/view/Page/Main/CallPage.qml +++ b/Linphone/view/Page/Main/CallPage.qml @@ -15,6 +15,12 @@ AbstractMainPage { signal listViewUpdated() property ConferenceInfoGui confInfoGui + property AccountProxy accounts: AccountProxy{id: accountProxy} + property AccountGui account: accountProxy.defaultAccount + property var state: account && account.core.registrationState || 0 + onStateChanged: console.log(state) + property bool isRegistered: account ? account.core.registrationState == LinphoneEnums.RegistrationState.Ok : false + onIsRegisteredChanged: console.log(isRegistered) Connections { enabled: confInfoGui @@ -404,7 +410,9 @@ AbstractMainPage { onValidateRequested: { if (groupName.length === 0) { UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Un nom doit être donné à l'appel de groupe"), false) - } else { + } if(!mainItem.isRegistered) { + UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Vous n'etes pas connecté"), false) + }else { mainItem.confInfoGui.core.subject = groupName mainItem.confInfoGui.core.isScheduled = false mainItem.confInfoGui.core.addParticipants(selectedParticipants) diff --git a/external/linphone-sdk b/external/linphone-sdk index 1f9db257f..6c146121c 160000 --- a/external/linphone-sdk +++ b/external/linphone-sdk @@ -1 +1 @@ -Subproject commit 1f9db257fe224ea6d9b067e69ee6b9f72102e129 +Subproject commit 6c146121c0c717c566e5c1ba3aa1a5167df5732f