From 3fedc31812bbf6d85146f044607419064bb23420 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Tue, 11 Jul 2023 16:59:42 +0200 Subject: [PATCH] The feature of connecting multi devices on the same account is not supported by the video conference. - Part fix previews for this case. Fix download text for outgoing files after the restart of the application. Update SDK to 5.2.88 --- CHANGELOG.md | 2 +- .../ParticipantDeviceListModel.cpp | 2 +- .../participant/ParticipantDeviceModel.cpp | 24 +++++++++++++++++-- .../participant/ParticipantDeviceModel.hpp | 6 +++++ .../ParticipantDeviceProxyModel.cpp | 4 ++-- .../participant/ParticipantProxyModel.cpp | 2 +- .../settings/AccountSettingsModel.cpp | 10 ++++++++ .../settings/AccountSettingsModel.hpp | 2 ++ .../ui/modules/Linphone/Camera/CameraItem.qml | 8 +++---- .../modules/Linphone/Chat/ChatFileMessage.qml | 1 + .../ui/modules/Linphone/File/FileView.qml | 1 + linphone-sdk | 2 +- 12 files changed, 52 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99cbd9a90..c3d4d1b2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Display video thumbnails. - Crop thumbnail and pictures if distored. - Enable registration from accounts list. -- Update SDK to 5.2.84 +- Update SDK to 5.2.88 ### Removed - Picture zoom on mouse over. diff --git a/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp b/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp index 388cfbd8b..cbd1d9537 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp +++ b/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp @@ -174,7 +174,7 @@ QSharedPointer ParticipantDeviceListModel::getMe(int * i int row = 0; for(auto item : mList){ auto device = item.objectCast(); - if( device->isMe()){ + if( device->isMe() && device->isLocal()){ if(index) *index = row; return device; diff --git a/linphone-app/src/components/participant/ParticipantDeviceModel.cpp b/linphone-app/src/components/participant/ParticipantDeviceModel.cpp index b56fa109e..5491649cb 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceModel.cpp +++ b/linphone-app/src/components/participant/ParticipantDeviceModel.cpp @@ -50,6 +50,8 @@ ParticipantDeviceModel::ParticipantDeviceModel (CallModel * callModel, std::shar if(mCall) connect(mCall, &CallModel::statusChanged, this, &ParticipantDeviceModel::onCallStatusChanged); mIsVideoEnabled = false; + if(mCall && mParticipantDevice) + updateIsLocal(); updateVideoEnabled(); } @@ -132,6 +134,13 @@ void ParticipantDeviceModel::setIsSpeaking(bool speaking){ } } +void ParticipantDeviceModel::setIsLocal(bool local){ + if(mIsLocal != local){ + mIsLocal = local; + emit isLocalChanged(); + } +} + void ParticipantDeviceModel::setState(LinphoneEnums::ParticipantDeviceState state){ auto newState = LinphoneEnums::toLinphone(state); if(mState != newState){ @@ -145,9 +154,9 @@ void ParticipantDeviceModel::updateVideoEnabled(){ ( mParticipantDevice->getStreamCapability(linphone::StreamType::Video) == linphone::MediaDirection::SendRecv || mParticipantDevice->getStreamCapability(linphone::StreamType::Video) == linphone::MediaDirection::SendOnly ) - || isMe()) && !mIsPaused; + || (isMe() && isLocal())) && !mIsPaused; if( mIsVideoEnabled != enabled && mCall && mCall->getCall()->getState() == linphone::Call::State::StreamsRunning) { - qDebug() << "VideoEnabled: " << enabled << ", old=" << mIsVideoEnabled << (mParticipantDevice ? mParticipantDevice->getAddress()->asString().c_str() : "") << ", me=" << isMe() << ", CallState=" << (mCall ? (int)mCall->getCall()->getState() : -1); + qDebug() << "VideoEnabled: " << enabled << ", old=" << mIsVideoEnabled << (mParticipantDevice ? mParticipantDevice->getAddress()->asString().c_str() : "") << ", me=" << isMe() << ", isLocal=" << isLocal() << ", CallState=" << (mCall ? (int)mCall->getCall()->getState() : -1); mIsVideoEnabled = enabled; emit videoEnabledChanged(); } @@ -157,6 +166,17 @@ bool ParticipantDeviceModel::isMe() const{ return mIsMe; } +bool ParticipantDeviceModel::isLocal()const{ + return mIsLocal; +} + +void ParticipantDeviceModel::updateIsLocal(){ + auto deviceAddress = mParticipantDevice->getAddress(); + auto callAddress = mCall->getConferenceSharedModel()->getConference()->getMe()->getAddress(); + auto gruuAddress = CoreManager::getInstance()->getAccountSettingsModel()->findAccount(callAddress)->getContactAddress(); + setIsLocal(deviceAddress->equal(gruuAddress)); +} + void ParticipantDeviceModel::onSecurityLevelChanged(std::shared_ptr device){ if(!device || mParticipantDevice && mParticipantDevice->getAddress()->weakEqual(device)) emit securityLevelChanged(); diff --git a/linphone-app/src/components/participant/ParticipantDeviceModel.hpp b/linphone-app/src/components/participant/ParticipantDeviceModel.hpp index 1800492ed..ef98e7147 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceModel.hpp +++ b/linphone-app/src/components/participant/ParticipantDeviceModel.hpp @@ -51,6 +51,7 @@ public: Q_PROPERTY(time_t timeOfJoining READ getTimeOfJoining CONSTANT) Q_PROPERTY(bool videoEnabled READ isVideoEnabled NOTIFY videoEnabledChanged) Q_PROPERTY(bool isMe READ isMe CONSTANT) + Q_PROPERTY(bool isLocal READ isLocal WRITE setIsLocal NOTIFY isLocalChanged)// Can change on call update. Not really used but it just in case as Object can be initialized with empty call/device. Q_PROPERTY(bool isPaused READ getPaused WRITE setPaused NOTIFY isPausedChanged) Q_PROPERTY(bool isSpeaking READ getIsSpeaking WRITE setIsSpeaking NOTIFY isSpeakingChanged) Q_PROPERTY(bool isMuted READ getIsMuted NOTIFY isMutedChanged) @@ -63,6 +64,7 @@ public: time_t getTimeOfJoining() const; bool isVideoEnabled() const; bool isMe() const; + bool isLocal()const; bool getPaused() const; bool getIsSpeaking() const; bool getIsMuted() const; @@ -72,6 +74,7 @@ public: void setPaused(bool paused); void setIsSpeaking(bool speaking); + void setIsLocal(bool local); void setState(LinphoneEnums::ParticipantDeviceState state); virtual void onIsSpeakingChanged(const std::shared_ptr & participantDevice, bool isSpeaking); @@ -82,6 +85,7 @@ public: void connectTo(ParticipantDeviceListener * listener); void updateVideoEnabled(); + void updateIsLocal(); public slots: void onSecurityLevelChanged(std::shared_ptr device); @@ -92,11 +96,13 @@ signals: void isPausedChanged(); void isSpeakingChanged(); void isMutedChanged(); + void isLocalChanged(); void stateChanged(); private: bool mIsMe = false; + bool mIsLocal = false; bool mIsVideoEnabled; bool mIsPaused = false; bool mIsSpeaking = false; diff --git a/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp b/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp index adab908fd..b56fa6148 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp +++ b/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp @@ -44,14 +44,14 @@ bool ParticipantDeviceProxyModel::filterAcceptsRow ( auto listModel = qobject_cast(sourceModel()); const QModelIndex index = listModel->index(sourceRow, 0, sourceParent); const ParticipantDeviceModel *device = index.data().value(); - return device && (isShowMe() || !device->isMe()); + return device && (isShowMe() || !(device->isMe() && device->isLocal())); } bool ParticipantDeviceProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { const ParticipantDeviceModel *deviceA = sourceModel()->data(left).value(); const ParticipantDeviceModel *deviceB = sourceModel()->data(right).value(); // 'me' at end (for grid). - return deviceB->isMe() || left.row() < right.row(); + return deviceB->isLocal() || !deviceA->isLocal() && deviceB->isMe() || left.row() < right.row(); } //--------------------------------------------------------------------------------- diff --git a/linphone-app/src/components/participant/ParticipantProxyModel.cpp b/linphone-app/src/components/participant/ParticipantProxyModel.cpp index 5e32d4729..1a705692a 100644 --- a/linphone-app/src/components/participant/ParticipantProxyModel.cpp +++ b/linphone-app/src/components/participant/ParticipantProxyModel.cpp @@ -212,5 +212,5 @@ bool ParticipantProxyModel::lessThan (const QModelIndex &left, const QModelIndex const ParticipantModel* a = sourceModel()->data(left).value(); const ParticipantModel* b = sourceModel()->data(right).value(); - return a->getCreationTime() > b->getCreationTime(); + return a->getCreationTime() > b->getCreationTime() || b->isMe(); } diff --git a/linphone-app/src/components/settings/AccountSettingsModel.cpp b/linphone-app/src/components/settings/AccountSettingsModel.cpp index 894b926f9..a79dfdcbd 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.cpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.cpp @@ -86,6 +86,16 @@ shared_ptr AccountSettingsModel::getUsedSipAddress () c return account ? account->getParams()->getIdentityAddress() : core->createPrimaryContactParsed(); } + std::shared_ptr AccountSettingsModel::findAccount(shared_ptr address) const { + shared_ptr core = CoreManager::getInstance()->getCore(); + list> accounts = CoreManager::getInstance()->getAccountList(); + for(auto account : accounts){ + if(account->getContactAddress()->weakEqual(address)) + return account; + } + return nullptr; +} + void AccountSettingsModel::setUsedSipAddress (const shared_ptr &address) { shared_ptr core = CoreManager::getInstance()->getCore(); shared_ptr account = core->getDefaultAccount(); diff --git a/linphone-app/src/components/settings/AccountSettingsModel.hpp b/linphone-app/src/components/settings/AccountSettingsModel.hpp index 250de51e1..43c09e572 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.hpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.hpp @@ -66,6 +66,8 @@ public: std::shared_ptr getUsedSipAddress () const; void setUsedSipAddress (const std::shared_ptr &address); + std::shared_ptr findAccount(std::shared_ptr address) const ; + QString getUsedSipAddressAsStringUriOnly () const; QString getUsedSipAddressAsString () const; diff --git a/linphone-app/ui/modules/Linphone/Camera/CameraItem.qml b/linphone-app/ui/modules/Linphone/Camera/CameraItem.qml index 4dd1294cf..d5da3db02 100644 --- a/linphone-app/ui/modules/Linphone/Camera/CameraItem.qml +++ b/linphone-app/ui/modules/Linphone/Camera/CameraItem.qml @@ -20,19 +20,19 @@ Item { property CallModel callModel property SoundPlayer linphonePlayer property string qmlName - property bool isPreview: (!callModel && !container.currentDevice) || ( container.currentDevice && container.currentDevice.isMe) + property bool isPreview: (!callModel && !container.currentDevice) || ( container.currentDevice && container.currentDevice.isMe && container.currentDevice.isLocal) property bool isFullscreen: false property bool hideCamera: false property bool isPaused: false property bool deactivateCamera: true property bool isVideoEnabled: !deactivateCamera && (!callModel || callModel.videoEnabled) && (!container.currentDevice || ( callModel && container.currentDevice && - ( (!container.currentDevice.isMe && container.currentDevice.videoEnabled) - || (container.currentDevice.isMe && callModel.cameraEnabled)))) + ( (! (container.currentDevice.isMe && container.currentDevice.isLocal) && container.currentDevice.videoEnabled) + || (container.currentDevice.isMe && container.currentDevice.isLocal && callModel.cameraEnabled)))) property bool a : callModel && callModel.videoEnabled property bool b: container.currentDevice && container.currentDevice.videoEnabled - property bool c: container.currentDevice && container.currentDevice.isMe + property bool c: container.currentDevice && container.currentDevice.isMe && container.currentDevice.isLocal property bool d : callModel && callModel.cameraEnabled property bool isReady: cameraLoader.item && cameraLoader.item.isReady diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatFileMessage.qml b/linphone-app/ui/modules/Linphone/Chat/ChatFileMessage.qml index 03a5fa617..7f268b97f 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatFileMessage.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatFileMessage.qml @@ -42,6 +42,7 @@ Item { name: mainRow.contentModel && mainRow.contentModel.name filePath: mainRow.contentModel && mainRow.contentModel.filePath isTransferring: mainRow.chatMessageModel && (mainRow.chatMessageModel.state == LinphoneEnums.ChatMessageStateFileTransferInProgress || mainRow.chatMessageModel.state == LinphoneEnums.ChatMessageStateInProgress ) + isOutgoing: mainRow.chatMessageModel && mainRow.chatMessageModel.isOutgoing } } } \ No newline at end of file diff --git a/linphone-app/ui/modules/Linphone/File/FileView.qml b/linphone-app/ui/modules/Linphone/File/FileView.qml index a1a7d577c..72eedfade 100644 --- a/linphone-app/ui/modules/Linphone/File/FileView.qml +++ b/linphone-app/ui/modules/Linphone/File/FileView.qml @@ -34,6 +34,7 @@ Item { property bool isTransferring property bool isHovering: thumbnailProvider.state == 'hovered' + property bool isOutgoing: false signal clickOnFile() diff --git a/linphone-sdk b/linphone-sdk index 7133a75fb..427cc9848 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit 7133a75fbcfa79cccfe5e8b4410aa515e4c75f4a +Subproject commit 427cc9848f43e5ed88be897341709ebed79bb354