Commit 11b12e2d authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Settings/SettingsCallsChat): supports media encryption

parent dfafcb3b
......@@ -38,6 +38,23 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
m_config = CoreManager::getInstance()->getCore()->getConfig();
}
// =============================================================================
// Chat & calls.
// =============================================================================
SettingsModel::MediaEncryption SettingsModel::getMediaEncryption () const {
return static_cast<SettingsModel::MediaEncryption>(
CoreManager::getInstance()->getCore()->getMediaEncryption()
);
}
void SettingsModel::setMediaEncryption (MediaEncryption encryption) {
CoreManager::getInstance()->getCore()->setMediaEncryption(
static_cast<linphone::MediaEncryption>(encryption)
);
emit mediaEncryptionChanged(encryption);
}
// =============================================================================
// Network.
// =============================================================================
......
......@@ -35,6 +35,10 @@ class SettingsModel : public QObject {
// PROPERTIES.
// ===========================================================================
// Chat & calls. -------------------------------------------------------------
Q_PROPERTY(MediaEncryption mediaEncryption READ getMediaEncryption WRITE setMediaEncryption NOTIFY mediaEncryptionChanged);
// Network. ------------------------------------------------------------------
Q_PROPERTY(bool useSipInfoForDtmfs READ getUseSipInfoForDtmfs WRITE setUseSipInfoForDtmfs NOTIFY dtmfsProtocolChanged);
......@@ -78,12 +82,26 @@ class SettingsModel : public QObject {
Q_PROPERTY(QString savedVideosFolder READ getSavedVideosFolder WRITE setSavedVideosFolder NOTIFY savedVideosFolderChanged);
public:
enum MediaEncryption {
MediaEncryptionDtls = linphone::MediaEncryptionDTLS,
MediaEncryptionNone = linphone::MediaEncryptionNone,
MediaEncryptionSrtp = linphone::MediaEncryptionSRTP,
MediaEncryptionZrtp = linphone::MediaEncryptionZRTP
};
Q_ENUM(MediaEncryption);
SettingsModel (QObject *parent = Q_NULLPTR);
// ===========================================================================
// METHODS.
// ===========================================================================
// Chat & calls. -------------------------------------------------------------
MediaEncryption getMediaEncryption () const;
void setMediaEncryption (MediaEncryption encryption);
// Network. ------------------------------------------------------------------
bool getUseSipInfoForDtmfs () const;
......@@ -160,6 +178,10 @@ public:
// ===========================================================================
signals:
// Chat & calls. -------------------------------------------------------------
void mediaEncryptionChanged (MediaEncryption encryption);
// Network. ------------------------------------------------------------------
void dtmfsProtocolChanged ();
......
......@@ -486,6 +486,18 @@ function includes (obj, value, startIndex) {
// -----------------------------------------------------------------------------
function invert (obj) {
var out = {}
for (var key in obj) {
out[key] = obj[key]
}
return out
}
// -----------------------------------------------------------------------------
function isArray (array) {
return (array instanceof Array)
}
......
import QtQuick 2.7
import Common 1.0
import Linphone 1.0
import Utils 1.0
import App.Styles 1.0
......@@ -20,12 +22,25 @@ TabContainer {
label: qsTr('encryptionLabel')
ExclusiveButtons {
property var _resolveButton
texts: [
qsTr('noEncryption'),
'SRTP',
'ZRTP',
'DTLS'
qsTr('noEncryption'), // 0.
'SRTP', // 1.
'ZRTP', // 2.
'DTLS' // 3.
]
Component.onCompleted: {
var map = _resolveButton = {}
map[SettingsModel.MediaEncryptionNone] = 0
map[SettingsModel.MediaEncryptionSrtp] = 1
map[SettingsModel.MediaEncryptionZrtp] = 2
map[SettingsModel.MediaEncryptionDtls] = 3
selectedButton = Utils.invert(map)[SettingsModel.mediaEncryption]
}
onClicked: SettingsModel.mediaEncryption = _resolveButton[button]
}
}
}
......
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