fix #LINQT-1499 do not display zrtp popup in conference

This commit is contained in:
Gaelle Braud 2024-12-18 17:51:23 +01:00 committed by Gaëlle Braud
parent e42d90f9ee
commit 4a167612a3
4 changed files with 32 additions and 7 deletions

View file

@ -278,7 +278,12 @@ void CallCore::setSelf(QSharedPointer<CallCore> 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<CallCore> 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<ConferenceCore> &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;
}

View file

@ -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<ConferenceCore> getConferenceCore() const;
void setConference(const QSharedPointer<ConferenceCore> &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();

View file

@ -415,6 +415,7 @@ void CallModel::onStateChanged(const std::shared_ptr<linphone::Call> &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<linphone::Call> &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();

View file

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