From 4a167612a30e91ad68282f79ea8bd84bb2ac5ae0 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Wed, 18 Dec 2024 17:51:23 +0100 Subject: [PATCH] fix #LINQT-1499 do not display zrtp popup in conference --- Linphone/core/call/CallCore.cpp | 20 ++++++++++++++++--- Linphone/core/call/CallCore.hpp | 4 +++- Linphone/model/call/CallModel.cpp | 2 +- .../view/Page/Window/Call/CallsWindow.qml | 13 ++++++++++-- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/Linphone/core/call/CallCore.cpp b/Linphone/core/call/CallCore.cpp index 18bacbe7f..1472cdea2 100644 --- a/Linphone/core/call/CallCore.cpp +++ b/Linphone/core/call/CallCore.cpp @@ -278,7 +278,12 @@ void CallCore::setSelf(QSharedPointer me) { const std::string &message) { double speakerVolume = mSpeakerVolumeGain; double micVolumeGain = mMicrophoneVolumeGain; - if (state == linphone::Call::State::StreamsRunning) { + bool isConf = false; + if (state == linphone::Call::State::Connected) { + // The conference object is not ready until the StreamRunning status, + // so it can't be used at this point + isConf = call->getConference() != nullptr; + } else if (state == linphone::Call::State::StreamsRunning) { speakerVolume = mCallModel->getSpeakerVolumeGain(); if (speakerVolume < 0) { speakerVolume = CoreModel::getInstance()->getCore()->getPlaybackGainDb(); @@ -289,12 +294,13 @@ void CallCore::setSelf(QSharedPointer me) { } } auto subject = call->getConference() ? Utils::coreStringToAppString(call->getConference()->getSubject()) : ""; - mCallModelConnection->invokeToCore([this, state, speakerVolume, micVolumeGain, subject]() { + mCallModelConnection->invokeToCore([this, state, speakerVolume, micVolumeGain, subject, isConf]() { setSpeakerVolumeGain(speakerVolume); setMicrophoneVolumeGain(micVolumeGain); setRecordable(state == linphone::Call::State::StreamsRunning); setPaused(state == linphone::Call::State::Paused || state == linphone::Call::State::PausedByRemote); if (mConference) mConference->setSubject(subject); + setIsConference(isConf); }); mCallModelConnection->invokeToCore([this, state, message]() { setState(LinphoneEnums::fromLinphone(state)); }); }); @@ -634,12 +640,20 @@ void CallCore::setConference(const QSharedPointer &conference) { mustBeInMainThread(log().arg(Q_FUNC_INFO)); if (mConference != conference) { mConference = conference; - mIsConference = (mConference != nullptr); lDebug() << "[CallCore] Set conference : " << mConference; + setIsConference(conference != nullptr); emit conferenceChanged(); } } +void CallCore::setIsConference(bool isConf) { + mustBeInMainThread(log().arg(Q_FUNC_INFO)); + if (mIsConference != isConf) { + mIsConference = isConf; + emit isConferenceChanged(); + } +} + bool CallCore::isConference() const { return mIsConference; } diff --git a/Linphone/core/call/CallCore.hpp b/Linphone/core/call/CallCore.hpp index 639785832..84e219067 100644 --- a/Linphone/core/call/CallCore.hpp +++ b/Linphone/core/call/CallCore.hpp @@ -129,7 +129,7 @@ public: Q_PROPERTY(float microVolume READ getMicrophoneVolume WRITE setMicrophoneVolume NOTIFY microphoneVolumeChanged) Q_PROPERTY(LinphoneEnums::CallState transferState READ getTransferState NOTIFY transferStateChanged) Q_PROPERTY(ConferenceGui *conference READ getConferenceGui NOTIFY conferenceChanged) - Q_PROPERTY(bool isConference READ isConference NOTIFY conferenceChanged) + Q_PROPERTY(bool isConference READ isConference NOTIFY isConferenceChanged) Q_PROPERTY(LinphoneEnums::ConferenceLayout conferenceVideoLayout READ getConferenceVideoLayout WRITE lSetConferenceVideoLayout NOTIFY conferenceVideoLayoutChanged) @@ -186,6 +186,7 @@ public: ConferenceGui *getConferenceGui() const; QSharedPointer getConferenceCore() const; void setConference(const QSharedPointer &conference); + void setIsConference(bool isConf); bool isConference() const; @@ -271,6 +272,7 @@ signals: void microphoneVolumeChanged(); void microphoneVolumeGainChanged(); void conferenceChanged(); + void isConferenceChanged(); void conferenceVideoLayoutChanged(); void videoSourceDescriptorChanged(); void zrtpStatsChanged(); diff --git a/Linphone/model/call/CallModel.cpp b/Linphone/model/call/CallModel.cpp index 34f3fb920..e7b2ba49f 100644 --- a/Linphone/model/call/CallModel.cpp +++ b/Linphone/model/call/CallModel.cpp @@ -415,6 +415,7 @@ void CallModel::onStateChanged(const std::shared_ptr &call, const std::string &message) { lDebug() << "CallModel::onStateChanged" << (int)state; if (state == linphone::Call::State::StreamsRunning) { + setConference(call->getConference()); mDurationTimer.start(); // After UpdatedByRemote, video direction could be changed. auto videoDirection = call->getCurrentParams()->getVideoDirection(); @@ -422,7 +423,6 @@ void CallModel::onStateChanged(const std::shared_ptr &call, videoDirection == linphone::MediaDirection::SendRecv); emit remoteVideoEnabledChanged(videoDirection == linphone::MediaDirection::RecvOnly || videoDirection == linphone::MediaDirection::SendRecv); - setConference(call->getConference()); updateConferenceVideoLayout(); } else if (state == linphone::Call::State::End || state == linphone::Call::State::Error) { mDurationTimer.stop(); diff --git a/Linphone/view/Page/Window/Call/CallsWindow.qml b/Linphone/view/Page/Window/Call/CallsWindow.qml index 050ad0e03..b197fa318 100644 --- a/Linphone/view/Page/Window/Call/CallsWindow.qml +++ b/Linphone/view/Page/Window/Call/CallsWindow.qml @@ -16,6 +16,7 @@ AbstractWindow { property CallGui call property ConferenceGui conference: call && call.core.conference || null + property bool isConference: call ? call.core.isConference : false property int conferenceLayout: call && call.core.conferenceVideoLayout || 0 property bool localVideoEnabled: call && call.core.localVideoEnabled @@ -31,7 +32,7 @@ AbstractWindow { middleItemStackView.replace(inCallItem) bottomButtonsLayout.visible = true } - if(call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp && !mainWindow.conference && (!call.core.tokenVerified || call.core.isMismatch)) { + if(call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp && !mainWindow.isConference && (!call.core.tokenVerified || call.core.isMismatch)) { zrtpValidation.open() } } @@ -380,8 +381,16 @@ AbstractWindow { } } RowLayout { + id: securityStateLayout spacing: 5 * DefaultStyle.dp - visible: mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState === LinphoneEnums.CallState.StreamsRunning + visible: false + Connections { + target: mainWindow + function onCallStateChanged() { + if (mainWindow.callState === LinphoneEnums.CallState.Connected) securityStateLayout.visible = true + else if (mainWindow.callState === LinphoneEnums.CallState.End || mainWindow.callState === LinphoneEnums.CallState.Released) securityStateLayout.visible = false + } + } BusyIndicator { visible: mainWindow.call && mainWindow.callState != LinphoneEnums.CallState.Connected && mainWindow.callState != LinphoneEnums.CallState.StreamsRunning Layout.preferredWidth: 15 * DefaultStyle.dp