mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-31 02:49:21 +00:00
feat(src/components/call/CallModel): add a tooltip on call encryption
This commit is contained in:
parent
4bf633980b
commit
77cf08e998
8 changed files with 67 additions and 41 deletions
|
|
@ -315,6 +315,10 @@
|
|||
<source>callErrorNotAcceptable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>noMediaEncryption</source>
|
||||
<translation>None</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CallSipAddress</name>
|
||||
|
|
|
|||
|
|
@ -315,6 +315,10 @@
|
|||
<source>callErrorNotAcceptable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>noMediaEncryption</source>
|
||||
<translation>Aucun</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CallSipAddress</name>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,18 @@
|
|||
|
||||
// =============================================================================
|
||||
|
||||
/*
|
||||
* Define telling G++ that a 'break' statement has been deliberately omitted
|
||||
* in switch block.
|
||||
*/
|
||||
#ifndef UTILS_NO_BREAK
|
||||
#if defined(__GNUC__) && __GNUC__ >= 7
|
||||
#define UTILS_NO_BREAK __attribute__((fallthrough))
|
||||
#else
|
||||
#define UTILS_NO_BREAK
|
||||
#endif // if defined(__GNUC__) && __GNUC__ >= 7
|
||||
#endif // ifndef UTILS_NO_BREAK
|
||||
|
||||
namespace Utils {
|
||||
inline QString coreStringToAppString (const std::string &string) {
|
||||
return QString::fromLocal8Bit(string.c_str(), static_cast<int>(string.size()));
|
||||
|
|
|
|||
|
|
@ -504,18 +504,7 @@ void CallModel::verifyAuthenticationToken (bool verify) {
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
CallModel::CallEncryption CallModel::getEncryption () const {
|
||||
switch (mCall->getCurrentParams()->getMediaEncryption()) {
|
||||
case linphone::MediaEncryptionSRTP:
|
||||
return CallEncryptionSRTP;
|
||||
case linphone::MediaEncryptionZRTP:
|
||||
return CallEncryptionZRTP;
|
||||
case linphone::MediaEncryptionDTLS:
|
||||
return CallEncryptionDTLS;
|
||||
case linphone::MediaEncryptionNone:
|
||||
break;
|
||||
}
|
||||
|
||||
return CallEncryptionNone;
|
||||
return static_cast<CallEncryption>(mCall->getCurrentParams()->getMediaEncryption());
|
||||
}
|
||||
|
||||
bool CallModel::isSecured () const {
|
||||
|
|
@ -528,18 +517,35 @@ bool CallModel::isSecured () const {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString CallModel::getLocalSAS () const {
|
||||
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 CallModel::getRemoteSas () const {
|
||||
QString token = ::Utils::coreStringToAppString(mCall->getAuthenticationToken());
|
||||
return mCall->getDir() != linphone::CallDirIncoming ? token.left(2).toUpper() : token.right(2).toUpper();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString CallModel::getSecuredString () const {
|
||||
switch (mCall->getCurrentParams()->getMediaEncryption()) {
|
||||
case linphone::MediaEncryptionSRTP:
|
||||
return QStringLiteral("SRTP");
|
||||
case linphone::MediaEncryptionZRTP:
|
||||
return QStringLiteral("ZRTP");
|
||||
case linphone::MediaEncryptionDTLS:
|
||||
return QStringLiteral("DTLS");
|
||||
case linphone::MediaEncryptionNone:
|
||||
break;
|
||||
}
|
||||
|
||||
return tr("noMediaEncryption");
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QVariantList CallModel::getAudioStats () const {
|
||||
return mAudioStats;
|
||||
}
|
||||
|
|
@ -619,8 +625,8 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
|
|||
statsList << createStat(tr("callStatsReceivedVideoDefinition"), receivedVideoDefinition == receivedVideoDefinitionName
|
||||
? receivedVideoDefinition
|
||||
: QString("%1 (%2)").arg(receivedVideoDefinition).arg(receivedVideoDefinitionName));
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,8 +57,9 @@ class CallModel : public QObject {
|
|||
|
||||
Q_PROPERTY(CallEncryption encryption READ getEncryption NOTIFY securityUpdated);
|
||||
Q_PROPERTY(bool isSecured READ isSecured NOTIFY securityUpdated);
|
||||
Q_PROPERTY(QString localSAS READ getLocalSAS NOTIFY securityUpdated);
|
||||
Q_PROPERTY(QString remoteSAS READ getRemoteSAS NOTIFY securityUpdated);
|
||||
Q_PROPERTY(QString localSas READ getLocalSas NOTIFY securityUpdated);
|
||||
Q_PROPERTY(QString remoteSas READ getRemoteSas NOTIFY securityUpdated);
|
||||
Q_PROPERTY(QString securedString READ getSecuredString NOTIFY securityUpdated);
|
||||
|
||||
public:
|
||||
enum CallStatus {
|
||||
|
|
@ -73,10 +74,10 @@ public:
|
|||
Q_ENUM(CallStatus);
|
||||
|
||||
enum CallEncryption {
|
||||
CallEncryptionNone,
|
||||
CallEncryptionSRTP,
|
||||
CallEncryptionZRTP,
|
||||
CallEncryptionDTLS
|
||||
CallEncryptionNone = linphone::MediaEncryptionNone,
|
||||
CallEncryptionDtls = linphone::MediaEncryptionDTLS,
|
||||
CallEncryptionSrtp = linphone::MediaEncryptionSRTP,
|
||||
CallEncryptionZrtp = linphone::MediaEncryptionZRTP
|
||||
};
|
||||
|
||||
Q_ENUM(CallEncryption);
|
||||
|
|
@ -165,8 +166,10 @@ private:
|
|||
CallEncryption getEncryption () const;
|
||||
bool isSecured () const;
|
||||
|
||||
QString getLocalSAS () const;
|
||||
QString getRemoteSAS () const;
|
||||
QString getLocalSas () const;
|
||||
QString getRemoteSas () const;
|
||||
|
||||
QString getSecuredString () const;
|
||||
|
||||
QVariantList getAudioStats () const;
|
||||
QVariantList getVideoStats () const;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@
|
|||
#include <lmcons.h>
|
||||
#endif // ifdef Q_OS_WIN
|
||||
|
||||
#include "../../Utils.hpp"
|
||||
|
||||
#include "SingleApplication.hpp"
|
||||
#include "SingleApplicationPrivate.hpp"
|
||||
|
||||
|
|
@ -302,7 +304,7 @@ void SingleApplicationPrivate::slotConnectionEstablished () {
|
|||
tmp = nextConnSocket->read(checksum.length());
|
||||
if (checksum == tmp)
|
||||
break; // Otherwise set to invalid connection (next line)
|
||||
}
|
||||
} UTILS_NO_BREAK;
|
||||
default:
|
||||
connectionType = InvalidConnection;
|
||||
}
|
||||
|
|
@ -315,23 +317,13 @@ void SingleApplicationPrivate::slotConnectionEstablished () {
|
|||
return;
|
||||
}
|
||||
|
||||
QObject::connect(
|
||||
nextConnSocket,
|
||||
&QLocalSocket::aboutToClose,
|
||||
this,
|
||||
[nextConnSocket, instanceId, this]() {
|
||||
QObject::connect(nextConnSocket, &QLocalSocket::aboutToClose, this, [nextConnSocket, instanceId, this]() {
|
||||
Q_EMIT this->slotClientConnectionClosed(nextConnSocket, instanceId);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
QObject::connect(
|
||||
nextConnSocket,
|
||||
&QLocalSocket::readyRead,
|
||||
this,
|
||||
[nextConnSocket, instanceId, this]() {
|
||||
QObject::connect(nextConnSocket, &QLocalSocket::readyRead, this, [nextConnSocket, instanceId, this]() {
|
||||
Q_EMIT this->slotDataAvailable(nextConnSocket, instanceId);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
if (connectionType == NewInstance || (
|
||||
connectionType == SecondaryInstance &&
|
||||
|
|
|
|||
|
|
@ -107,7 +107,12 @@ Rectangle {
|
|||
id: callSecure
|
||||
|
||||
icon: incall.call.isSecured ? 'call_chat_secure' : 'call_chat_unsecure'
|
||||
|
||||
onClicked: zrtp.visible = (incall.call.encryption === CallModel.CallEncryptionZRTP)
|
||||
|
||||
TooltipArea {
|
||||
text: incall.call.securedString
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ ColumnLayout {
|
|||
pointSize: CallStyle.zrtpArea.text.fontSize
|
||||
}
|
||||
|
||||
text: zrtp.call.localSAS
|
||||
text: zrtp.call.localSas
|
||||
}
|
||||
|
||||
Text {
|
||||
|
|
@ -85,7 +85,7 @@ ColumnLayout {
|
|||
pointSize: CallStyle.zrtpArea.text.fontSize
|
||||
}
|
||||
|
||||
text: zrtp.call.remoteSAS
|
||||
text: zrtp.call.remoteSas
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue