fix #LINQT-1697 wrong encryption status on paused

This commit is contained in:
gaelle 2025-03-26 14:53:56 +01:00 committed by Gaëlle Braud
parent 9dc1f3a4aa
commit 34f914ca55
4 changed files with 56 additions and 39 deletions

View file

@ -150,6 +150,7 @@ CallCore::CallCore(const std::shared_ptr<linphone::Call> &call) : QObject(nullpt
mZrtpStats.mHashAlgorithm = Utils::coreStringToAppString(stats->getZrtpHashAlgo()); mZrtpStats.mHashAlgorithm = Utils::coreStringToAppString(stats->getZrtpHashAlgo());
mZrtpStats.mAuthenticationAlgorithm = Utils::coreStringToAppString(stats->getZrtpAuthTagAlgo()); mZrtpStats.mAuthenticationAlgorithm = Utils::coreStringToAppString(stats->getZrtpAuthTagAlgo());
mZrtpStats.mSasAlgorithm = Utils::coreStringToAppString(stats->getZrtpSasAlgo()); mZrtpStats.mSasAlgorithm = Utils::coreStringToAppString(stats->getZrtpSasAlgo());
mZrtpStats.mIsPostQuantum = stats->isZrtpKeyAgreementAlgoPostQuantum();
} }
} }
auto conference = call->getConference(); auto conference = call->getConference();
@ -307,9 +308,9 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
[this, call, encryption, tokenVerified, localToken, remoteTokens, isCaseMismatch]() { [this, call, encryption, tokenVerified, localToken, remoteTokens, isCaseMismatch]() {
setLocalToken(localToken); setLocalToken(localToken);
setRemoteTokens(remoteTokens); setRemoteTokens(remoteTokens);
setIsMismatch(isCaseMismatch);
setTokenVerified(tokenVerified);
setEncryption(encryption); setEncryption(encryption);
setIsMismatch(isCaseMismatch);
setTokenVerified(tokenVerified);
}); });
auto mediaEncryption = call->getParams()->getMediaEncryption(); auto mediaEncryption = call->getParams()->getMediaEncryption();
if (mediaEncryption == linphone::MediaEncryption::ZRTP) { if (mediaEncryption == linphone::MediaEncryption::ZRTP) {
@ -320,6 +321,7 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
zrtpStats.mHashAlgorithm = Utils::coreStringToAppString(stats->getZrtpHashAlgo()); zrtpStats.mHashAlgorithm = Utils::coreStringToAppString(stats->getZrtpHashAlgo());
zrtpStats.mAuthenticationAlgorithm = Utils::coreStringToAppString(stats->getZrtpAuthTagAlgo()); zrtpStats.mAuthenticationAlgorithm = Utils::coreStringToAppString(stats->getZrtpAuthTagAlgo());
zrtpStats.mSasAlgorithm = Utils::coreStringToAppString(stats->getZrtpSasAlgo()); zrtpStats.mSasAlgorithm = Utils::coreStringToAppString(stats->getZrtpSasAlgo());
zrtpStats.mIsPostQuantum = stats->isZrtpKeyAgreementAlgoPostQuantum();
mCallModelConnection->invokeToCore([this, zrtpStats]() { setZrtpStats(zrtpStats); }); mCallModelConnection->invokeToCore([this, zrtpStats]() { setZrtpStats(zrtpStats); });
} }
}); });
@ -645,7 +647,22 @@ LinphoneEnums::MediaEncryption CallCore::getEncryption() const {
} }
QString CallCore::getEncryptionString() const { QString CallCore::getEncryptionString() const {
return LinphoneEnums::toString(mEncryption); switch (mEncryption) {
case LinphoneEnums::MediaEncryption::Dtls:
//: DTLS
return tr("media_encryption_dtls");
case LinphoneEnums::MediaEncryption::None:
//: None
return tr("media_encryption_none");
case LinphoneEnums::MediaEncryption::Srtp:
//: SRTP
return tr("media_encryption_srtp");
case LinphoneEnums::MediaEncryption::Zrtp:
//: "ZRTP - Post quantique"
return tr("media_encryption_post_quantum");
default:
return QString();
}
} }
void CallCore::setEncryption(LinphoneEnums::MediaEncryption encryption) { void CallCore::setEncryption(LinphoneEnums::MediaEncryption encryption) {

View file

@ -149,7 +149,7 @@ void Utils::createCall(const QString &sipAddress,
if (!success) { if (!success) {
//: "L'appel n'a pas pu être créé" //: "L'appel n'a pas pu être créé"
if (errorMessage.isEmpty()) errorMessage = tr("information_popup_call_not_created_message"); if (errorMessage.isEmpty()) errorMessage = tr("information_popup_call_not_created_message");
showInformationPopup("information_popup_error_title", errorMessage, false); showInformationPopup(tr("information_popup_error_title"), errorMessage, false);
} }
}); });
} }

View file

@ -31,9 +31,11 @@ ColumnLayout {
spacing: Math.round(7 * DefaultStyle.dp) spacing: Math.round(7 * DefaultStyle.dp)
Text { Text {
property bool isPostQuantum: mainItem.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp && mainItem.call.core.zrtpStats.isPostQuantum property bool isPostQuantum: mainItem.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp && mainItem.call.core.zrtpStats.isPostQuantum
//: "Chiffrement du média : %1%2" //: Chiffrement du média : %1
//: "ZRTP Post Quantique" text: qsTr("call_stats_media_encryption").arg(isPostQuantum ?
text: qsTr("call_stats_media_encryption").arg(isPostQuantum ? tr("call_stats_media_encryption_zrtp_post_quantum") : mainItem.call.core.encryptionString) //: ZRTP Post Quantique
qsTr("call_stats_media_encryption_zrtp_post_quantum")
: mainItem.call.core.encryptionString)
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
font { font {
pixelSize: Math.round(12 * DefaultStyle.dp) pixelSize: Math.round(12 * DefaultStyle.dp)

View file

@ -348,12 +348,17 @@ AbstractWindow {
spacing: Math.round(10 * DefaultStyle.dp) spacing: Math.round(10 * DefaultStyle.dp)
Text { Text {
id: callStatusText id: callStatusText
property string remoteName: mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState === LinphoneEnums.CallState.StreamsRunning property string remoteName: mainWindow.call ? qsTr("call_dir").arg(EnumsToStringCpp.dirToString(mainWindow.call.core.dir)) : ""
? mainWindow.call.core.remoteName Connections {
//: "Appel %1" target: mainWindow
: mainWindow.call ? qsTr("call_dir").arg(EnumsToStringCpp.dirToString(mainWindow.call.core.dir)) : "" onCallStateChanged: {
//: "Appel terminé" if (mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState === LinphoneEnums.CallState.StreamsRunning)
callStatusText.remoteName = mainWindow.call.core.remoteName
}
}
text: (mainWindow.callState === LinphoneEnums.CallState.End || mainWindow.callState === LinphoneEnums.CallState.Released) text: (mainWindow.callState === LinphoneEnums.CallState.End || mainWindow.callState === LinphoneEnums.CallState.Released)
//: "Appel terminé"
? qsTr("call_ended") ? qsTr("call_ended")
: mainWindow.call && (mainWindow.call.core.paused || (mainWindow.callState === LinphoneEnums.CallState.Paused || mainWindow.callState === LinphoneEnums.CallState.PausedByRemote)) : mainWindow.call && (mainWindow.call.core.paused || (mainWindow.callState === LinphoneEnums.CallState.Paused || mainWindow.callState === LinphoneEnums.CallState.PausedByRemote))
? (mainWindow.conference ? (mainWindow.conference
@ -426,11 +431,7 @@ AbstractWindow {
} }
} }
BusyIndicator { BusyIndicator {
visible: mainWindow.call visible: encryptionStatusText.text === qsTr("call_waiting_for_encryption_info")
&& mainWindow.callState
!= LinphoneEnums.CallState.Connected
&& mainWindow.callState
!= LinphoneEnums.CallState.StreamsRunning
Layout.preferredWidth: Math.round(15 * DefaultStyle.dp) Layout.preferredWidth: Math.round(15 * DefaultStyle.dp)
Layout.preferredHeight: Math.round(15 * DefaultStyle.dp) Layout.preferredHeight: Math.round(15 * DefaultStyle.dp)
indicatorColor: DefaultStyle.grey_0 indicatorColor: DefaultStyle.grey_0
@ -440,10 +441,6 @@ AbstractWindow {
Layout.preferredHeight: Math.round(15 * DefaultStyle.dp) Layout.preferredHeight: Math.round(15 * DefaultStyle.dp)
colorizationColor: mainWindow.call ? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp ? DefaultStyle.info_500_main : mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp ? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified ? DefaultStyle.warning_600 : DefaultStyle.info_500_main : DefaultStyle.grey_0 : "transparent" colorizationColor: mainWindow.call ? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp ? DefaultStyle.info_500_main : mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp ? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified ? DefaultStyle.warning_600 : DefaultStyle.info_500_main : DefaultStyle.grey_0 : "transparent"
visible: mainWindow.call visible: mainWindow.call
&& mainWindow.callState
=== LinphoneEnums.CallState.Connected
|| mainWindow.callState
=== LinphoneEnums.CallState.StreamsRunning
imageSource: mainWindow.call imageSource: mainWindow.call
? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp ? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp
? AppIcons.lockSimple ? AppIcons.lockSimple
@ -455,29 +452,30 @@ AbstractWindow {
: "" : ""
} }
Text { Text {
text: mainWindow.call && mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState === LinphoneEnums.CallState.StreamsRunning id: encryptionStatusText
? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp text: mainWindow.conference
//: "Appel chiffré de point à point" //: Appel chiffré de bout en bout
? qsTr("call_zrtp_end_to_end_encrypted")
:mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp
//: Appel chiffré de point à point
? qsTr("call_srtp_point_to_point_encrypted") ? qsTr("call_srtp_point_to_point_encrypted")
: mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp : mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp
? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified ? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified
//: "Vérification nécessaire" //: Vérification nécessaire
? qsTr("call_zrtp_sas_validation_required") ? qsTr("call_zrtp_sas_validation_required")
//: "Appel chiffré de bout en bout"
: qsTr("call_zrtp_end_to_end_encrypted") : qsTr("call_zrtp_end_to_end_encrypted")
//: "Appel non chiffré" : mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.None
: qsTr("call_not_encrypted") //: "Appel non chiffré"
//: "En attente de chiffrement" ? qsTr("call_not_encrypted")
: qsTr("call_waiting_for_encryption_info") //: "En attente de chiffrement"
color: mainWindow.call && mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState === LinphoneEnums.CallState.StreamsRunning : qsTr("call_waiting_for_encryption_info")
? mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp color: mainWindow.conference || mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Srtp
? DefaultStyle.info_500_main ? DefaultStyle.info_500_main
: mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp : mainWindow.call.core.encryption === LinphoneEnums.MediaEncryption.Zrtp
? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified ? mainWindow.call.core.isMismatch || !mainWindow.call.core.tokenVerified
? DefaultStyle.warning_600 ? DefaultStyle.warning_600
: DefaultStyle.info_500_main : DefaultStyle.info_500_main
: DefaultStyle.grey_0 : DefaultStyle.grey_0
: DefaultStyle.grey_0
font { font {
pixelSize: Math.round(12 * DefaultStyle.dp) pixelSize: Math.round(12 * DefaultStyle.dp)
weight: Math.round(400 * DefaultStyle.dp) weight: Math.round(400 * DefaultStyle.dp)