Commit 77cf08e9 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(src/components/call/CallModel): add a tooltip on call encryption

parent 4bf63398
...@@ -315,6 +315,10 @@ ...@@ -315,6 +315,10 @@
<source>callErrorNotAcceptable</source> <source>callErrorNotAcceptable</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>noMediaEncryption</source>
<translation>None</translation>
</message>
</context> </context>
<context> <context>
<name>CallSipAddress</name> <name>CallSipAddress</name>
......
...@@ -315,6 +315,10 @@ ...@@ -315,6 +315,10 @@
<source>callErrorNotAcceptable</source> <source>callErrorNotAcceptable</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>noMediaEncryption</source>
<translation>Aucun</translation>
</message>
</context> </context>
<context> <context>
<name>CallSipAddress</name> <name>CallSipAddress</name>
......
...@@ -27,6 +27,18 @@ ...@@ -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 { namespace Utils {
inline QString coreStringToAppString (const std::string &string) { inline QString coreStringToAppString (const std::string &string) {
return QString::fromLocal8Bit(string.c_str(), static_cast<int>(string.size())); return QString::fromLocal8Bit(string.c_str(), static_cast<int>(string.size()));
......
...@@ -504,18 +504,7 @@ void CallModel::verifyAuthenticationToken (bool verify) { ...@@ -504,18 +504,7 @@ void CallModel::verifyAuthenticationToken (bool verify) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
CallModel::CallEncryption CallModel::getEncryption () const { CallModel::CallEncryption CallModel::getEncryption () const {
switch (mCall->getCurrentParams()->getMediaEncryption()) { return static_cast<CallEncryption>(mCall->getCurrentParams()->getMediaEncryption());
case linphone::MediaEncryptionSRTP:
return CallEncryptionSRTP;
case linphone::MediaEncryptionZRTP:
return CallEncryptionZRTP;
case linphone::MediaEncryptionDTLS:
return CallEncryptionDTLS;
case linphone::MediaEncryptionNone:
break;
}
return CallEncryptionNone;
} }
bool CallModel::isSecured () const { bool CallModel::isSecured () const {
...@@ -528,18 +517,35 @@ 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()); QString token = ::Utils::coreStringToAppString(mCall->getAuthenticationToken());
return mCall->getDir() == linphone::CallDirIncoming ? token.left(2).toUpper() : token.right(2).toUpper(); 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()); QString token = ::Utils::coreStringToAppString(mCall->getAuthenticationToken());
return mCall->getDir() != linphone::CallDirIncoming ? token.left(2).toUpper() : token.right(2).toUpper(); 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 { QVariantList CallModel::getAudioStats () const {
return mAudioStats; return mAudioStats;
} }
...@@ -619,8 +625,8 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt ...@@ -619,8 +625,8 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
statsList << createStat(tr("callStatsReceivedVideoDefinition"), receivedVideoDefinition == receivedVideoDefinitionName statsList << createStat(tr("callStatsReceivedVideoDefinition"), receivedVideoDefinition == receivedVideoDefinitionName
? receivedVideoDefinition ? receivedVideoDefinition
: QString("%1 (%2)").arg(receivedVideoDefinition).arg(receivedVideoDefinitionName)); : QString("%1 (%2)").arg(receivedVideoDefinition).arg(receivedVideoDefinitionName));
} } break;
break;
default: default:
break; break;
} }
......
...@@ -57,8 +57,9 @@ class CallModel : public QObject { ...@@ -57,8 +57,9 @@ class CallModel : public QObject {
Q_PROPERTY(CallEncryption encryption READ getEncryption NOTIFY securityUpdated); Q_PROPERTY(CallEncryption encryption READ getEncryption NOTIFY securityUpdated);
Q_PROPERTY(bool isSecured READ isSecured NOTIFY securityUpdated); Q_PROPERTY(bool isSecured READ isSecured NOTIFY securityUpdated);
Q_PROPERTY(QString localSAS READ getLocalSAS NOTIFY securityUpdated); Q_PROPERTY(QString localSas READ getLocalSas NOTIFY securityUpdated);
Q_PROPERTY(QString remoteSAS READ getRemoteSAS NOTIFY securityUpdated); Q_PROPERTY(QString remoteSas READ getRemoteSas NOTIFY securityUpdated);
Q_PROPERTY(QString securedString READ getSecuredString NOTIFY securityUpdated);
public: public:
enum CallStatus { enum CallStatus {
...@@ -73,10 +74,10 @@ public: ...@@ -73,10 +74,10 @@ public:
Q_ENUM(CallStatus); Q_ENUM(CallStatus);
enum CallEncryption { enum CallEncryption {
CallEncryptionNone, CallEncryptionNone = linphone::MediaEncryptionNone,
CallEncryptionSRTP, CallEncryptionDtls = linphone::MediaEncryptionDTLS,
CallEncryptionZRTP, CallEncryptionSrtp = linphone::MediaEncryptionSRTP,
CallEncryptionDTLS CallEncryptionZrtp = linphone::MediaEncryptionZRTP
}; };
Q_ENUM(CallEncryption); Q_ENUM(CallEncryption);
...@@ -165,8 +166,10 @@ private: ...@@ -165,8 +166,10 @@ private:
CallEncryption getEncryption () const; CallEncryption getEncryption () const;
bool isSecured () const; bool isSecured () const;
QString getLocalSAS () const; QString getLocalSas () const;
QString getRemoteSAS () const; QString getRemoteSas () const;
QString getSecuredString () const;
QVariantList getAudioStats () const; QVariantList getAudioStats () const;
QVariantList getVideoStats () const; QVariantList getVideoStats () const;
......
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
#include <lmcons.h> #include <lmcons.h>
#endif // ifdef Q_OS_WIN #endif // ifdef Q_OS_WIN
#include "../../Utils.hpp"
#include "SingleApplication.hpp" #include "SingleApplication.hpp"
#include "SingleApplicationPrivate.hpp" #include "SingleApplicationPrivate.hpp"
...@@ -302,7 +304,7 @@ void SingleApplicationPrivate::slotConnectionEstablished () { ...@@ -302,7 +304,7 @@ void SingleApplicationPrivate::slotConnectionEstablished () {
tmp = nextConnSocket->read(checksum.length()); tmp = nextConnSocket->read(checksum.length());
if (checksum == tmp) if (checksum == tmp)
break; // Otherwise set to invalid connection (next line) break; // Otherwise set to invalid connection (next line)
} } UTILS_NO_BREAK;
default: default:
connectionType = InvalidConnection; connectionType = InvalidConnection;
} }
...@@ -315,23 +317,13 @@ void SingleApplicationPrivate::slotConnectionEstablished () { ...@@ -315,23 +317,13 @@ void SingleApplicationPrivate::slotConnectionEstablished () {
return; return;
} }
QObject::connect( QObject::connect(nextConnSocket, &QLocalSocket::aboutToClose, this, [nextConnSocket, instanceId, this]() {
nextConnSocket,
&QLocalSocket::aboutToClose,
this,
[nextConnSocket, instanceId, this]() {
Q_EMIT this->slotClientConnectionClosed(nextConnSocket, instanceId); Q_EMIT this->slotClientConnectionClosed(nextConnSocket, instanceId);
} });
);
QObject::connect( QObject::connect(nextConnSocket, &QLocalSocket::readyRead, this, [nextConnSocket, instanceId, this]() {
nextConnSocket,
&QLocalSocket::readyRead,
this,
[nextConnSocket, instanceId, this]() {
Q_EMIT this->slotDataAvailable(nextConnSocket, instanceId); Q_EMIT this->slotDataAvailable(nextConnSocket, instanceId);
} });
);
if (connectionType == NewInstance || ( if (connectionType == NewInstance || (
connectionType == SecondaryInstance && connectionType == SecondaryInstance &&
......
...@@ -107,7 +107,12 @@ Rectangle { ...@@ -107,7 +107,12 @@ Rectangle {
id: callSecure id: callSecure
icon: incall.call.isSecured ? 'call_chat_secure' : 'call_chat_unsecure' icon: incall.call.isSecured ? 'call_chat_secure' : 'call_chat_unsecure'
onClicked: zrtp.visible = (incall.call.encryption === CallModel.CallEncryptionZRTP) onClicked: zrtp.visible = (incall.call.encryption === CallModel.CallEncryptionZRTP)
TooltipArea {
text: incall.call.securedString
}
} }
} }
......
...@@ -62,7 +62,7 @@ ColumnLayout { ...@@ -62,7 +62,7 @@ ColumnLayout {
pointSize: CallStyle.zrtpArea.text.fontSize pointSize: CallStyle.zrtpArea.text.fontSize
} }
text: zrtp.call.localSAS text: zrtp.call.localSas
} }
Text { Text {
...@@ -85,7 +85,7 @@ ColumnLayout { ...@@ -85,7 +85,7 @@ ColumnLayout {
pointSize: CallStyle.zrtpArea.text.fontSize pointSize: CallStyle.zrtpArea.text.fontSize
} }
text: zrtp.call.remoteSAS text: zrtp.call.remoteSas
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment