mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-31 02:49:21 +00:00
feat(ui/views/App/Settings/SettingsCallsChat): supports media encryption
This commit is contained in:
parent
dfafcb3b65
commit
11b12e2d76
4 changed files with 70 additions and 4 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
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]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue