diff --git a/linphone-desktop/src/components/call/CallModel.cpp b/linphone-desktop/src/components/call/CallModel.cpp index 7ab80bf1c..09bd8d44b 100644 --- a/linphone-desktop/src/components/call/CallModel.cpp +++ b/linphone-desktop/src/components/call/CallModel.cpp @@ -496,10 +496,15 @@ void CallModel::sendDtmf (const QString &dtmf) { // ----------------------------------------------------------------------------- +void CallModel::verifyAuthenticationToken (bool verify) { + mCall->setAuthenticationTokenVerified(verify); + emit securityUpdated(); +} + +// ----------------------------------------------------------------------------- + CallModel::CallEncryption CallModel::getEncryption () const { - shared_ptr params = mCall->getCurrentParams(); - linphone::MediaEncryption encryption = params->getMediaEncryption(); - switch (encryption) { + switch (mCall->getCurrentParams()->getMediaEncryption()) { case linphone::MediaEncryptionSRTP: return CallEncryptionSRTP; case linphone::MediaEncryptionZRTP: @@ -507,41 +512,30 @@ CallModel::CallEncryption CallModel::getEncryption () const { case linphone::MediaEncryptionDTLS: return CallEncryptionDTLS; case linphone::MediaEncryptionNone: - default: - return CallEncryptionNone; + break; } + + return CallEncryptionNone; } bool CallModel::isSecured () const { shared_ptr params = mCall->getCurrentParams(); linphone::MediaEncryption encryption = params->getMediaEncryption(); - return (encryption == linphone::MediaEncryptionZRTP && mCall->getAuthenticationTokenVerified()) - || encryption == linphone::MediaEncryptionSRTP || encryption == linphone::MediaEncryptionDTLS; + return ( + encryption == linphone::MediaEncryptionZRTP && mCall->getAuthenticationTokenVerified() + ) || encryption == linphone::MediaEncryptionSRTP || encryption == linphone::MediaEncryptionDTLS; } -QString CallModel::getLocalSAS() const { - QString token = mCall->getAuthenticationToken().c_str(); - linphone::CallDir direction = mCall->getDir(); - if (direction == linphone::CallDirIncoming) { - return token.left(2).toUpper(); - } else { - return token.right(2).toUpper(); - } +// ----------------------------------------------------------------------------- + +QString CallModel::getLocalSAS () const { + QString token = ::Utils::coreStringToAppString(mCall->getAuthenticationToken()); + return mCall->getDir() == linphone::CallDirIncoming ? token.left(2).toUpper() : token.right(2).toUpper(); } -QString CallModel::getRemoteSAS() const { - QString token = mCall->getAuthenticationToken().c_str(); - linphone::CallDir direction = mCall->getDir(); - if (direction == linphone::CallDirIncoming) { - return token.right(2).toUpper(); - } else { - return token.left(2).toUpper(); - } -} - -void CallModel::verifyAuthenticationToken(bool verify) { - mCall->setAuthenticationTokenVerified(verify); - emit securityUpdated(); +QString CallModel::getRemoteSAS () const { + QString token = ::Utils::coreStringToAppString(mCall->getAuthenticationToken()); + return mCall->getDir() != linphone::CallDirIncoming ? token.left(2).toUpper() : token.right(2).toUpper(); } // ----------------------------------------------------------------------------- @@ -554,6 +548,8 @@ QVariantList CallModel::getVideoStats () const { return mVideoStats; } +// ----------------------------------------------------------------------------- + inline QVariantMap createStat (const QString &key, const QString &value) { QVariantMap m; m["key"] = key; @@ -579,13 +575,13 @@ void CallModel::updateStats (const shared_ptr &callSt switch (callStats->getIpFamilyOfRemote()) { case linphone::AddressFamilyInet: - family = "IPv4"; + family = QStringLiteral("IPv4"); break; case linphone::AddressFamilyInet6: - family = "IPv6"; + family = QStringLiteral("IPv6"); break; default: - family = "Unknown"; + family = QStringLiteral("Unknown"); break; } @@ -630,6 +626,8 @@ void CallModel::updateStats (const shared_ptr &callSt } } +// ----------------------------------------------------------------------------- + QString CallModel::iceStateToString (linphone::IceState state) const { switch (state) { case linphone::IceStateNotActivated: diff --git a/linphone-desktop/src/components/call/CallModel.hpp b/linphone-desktop/src/components/call/CallModel.hpp index bd9e40762..ad7aec7d2 100644 --- a/linphone-desktop/src/components/call/CallModel.hpp +++ b/linphone-desktop/src/components/call/CallModel.hpp @@ -114,7 +114,7 @@ public: Q_INVOKABLE void sendDtmf (const QString &dtmf); - Q_INVOKABLE void verifyAuthenticationToken(bool verify); + Q_INVOKABLE void verifyAuthenticationToken (bool verify); signals: void callErrorChanged (const QString &callError); @@ -164,6 +164,7 @@ private: CallEncryption getEncryption () const; bool isSecured () const; + QString getLocalSAS () const; QString getRemoteSAS () const; @@ -171,7 +172,6 @@ private: QVariantList getVideoStats () const; void updateStats (const std::shared_ptr &callStats, QVariantList &statsList); - QString iceStateToString (linphone::IceState state) const; bool mIsInConference = false; diff --git a/linphone-desktop/ui/views/App/Calls/Incall.qml b/linphone-desktop/ui/views/App/Calls/Incall.qml index 8b7997250..f90ab8405 100644 --- a/linphone-desktop/ui/views/App/Calls/Incall.qml +++ b/linphone-desktop/ui/views/App/Calls/Incall.qml @@ -107,7 +107,7 @@ Rectangle { id: callSecure icon: incall.call.isSecured ? 'call_chat_secure' : 'call_chat_unsecure' - onClicked: incall.call.encryption === CallModel.CallEncryptionZRTP ? zrtp.visible = true : zrtp.visible = false + onClicked: zrtp.visible = (incall.call.encryption === CallModel.CallEncryptionZRTP) } } @@ -235,7 +235,7 @@ Rectangle { Camera { call: incall.call - height: zrtp.visible ? container.height - zrtp.height : container.height + height: container.height width: container.width } }