Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
234a8cc9
Commit
234a8cc9
authored
Mar 01, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/views/App/Settings/SettingsCallsChat): supports media encryption and lime
parent
11b12e2d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
122 additions
and
25 deletions
+122
-25
SettingsModel.cpp
linphone-desktop/src/components/settings/SettingsModel.cpp
+57
-0
SettingsModel.hpp
linphone-desktop/src/components/settings/SettingsModel.hpp
+20
-1
SettingsCallsChat.qml
linphone-desktop/ui/views/App/Settings/SettingsCallsChat.qml
+44
-23
linphone
submodules/linphone
+1
-1
No files found.
linphone-desktop/src/components/settings/SettingsModel.cpp
View file @
234a8cc9
...
...
@@ -42,6 +42,34 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
// Chat & calls.
// =============================================================================
bool
SettingsModel
::
getLimeIsSupported
()
const
{
return
CoreManager
::
getInstance
()
->
getCore
()
->
limeAvailable
();
}
// -----------------------------------------------------------------------------
inline
QVariant
buildEncryptionDescription
(
SettingsModel
::
MediaEncryption
encryption
,
const
char
*
description
)
{
return
QVariantList
()
<<
encryption
<<
description
;
}
QVariantList
SettingsModel
::
getSupportedMediaEncryptions
()
const
{
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
QVariantList
list
;
if
(
core
->
mediaEncryptionSupported
(
linphone
::
MediaEncryptionDTLS
))
list
<<
buildEncryptionDescription
(
MediaEncryptionDtls
,
"DTLS"
);
if
(
core
->
mediaEncryptionSupported
(
linphone
::
MediaEncryptionSRTP
))
list
<<
buildEncryptionDescription
(
MediaEncryptionSrtp
,
"SRTP"
);
if
(
core
->
mediaEncryptionSupported
(
linphone
::
MediaEncryptionZRTP
))
list
<<
buildEncryptionDescription
(
MediaEncryptionZrtp
,
"ZRTP"
);
return
list
;
}
// -----------------------------------------------------------------------------
SettingsModel
::
MediaEncryption
SettingsModel
::
getMediaEncryption
()
const
{
return
static_cast
<
SettingsModel
::
MediaEncryption
>
(
CoreManager
::
getInstance
()
->
getCore
()
->
getMediaEncryption
()
...
...
@@ -49,12 +77,41 @@ SettingsModel::MediaEncryption SettingsModel::getMediaEncryption () const {
}
void
SettingsModel
::
setMediaEncryption
(
MediaEncryption
encryption
)
{
if
(
encryption
==
getMediaEncryption
())
return
;
if
(
encryption
!=
SettingsModel
::
MediaEncryptionZrtp
)
setLimeState
(
SettingsModel
::
LimeStateDisabled
);
CoreManager
::
getInstance
()
->
getCore
()
->
setMediaEncryption
(
static_cast
<
linphone
::
MediaEncryption
>
(
encryption
)
);
emit
mediaEncryptionChanged
(
encryption
);
}
// -----------------------------------------------------------------------------
SettingsModel
::
LimeState
SettingsModel
::
getLimeState
()
const
{
return
static_cast
<
SettingsModel
::
LimeState
>
(
CoreManager
::
getInstance
()
->
getCore
()
->
limeEnabled
()
);
}
void
SettingsModel
::
setLimeState
(
LimeState
state
)
{
if
(
state
==
getLimeState
())
return
;
if
(
state
!=
SettingsModel
::
LimeStateDisabled
)
setMediaEncryption
(
SettingsModel
::
MediaEncryptionZrtp
);
CoreManager
::
getInstance
()
->
getCore
()
->
enableLime
(
static_cast
<
linphone
::
LimeState
>
(
state
)
);
emit
limeStateChanged
(
state
);
}
// =============================================================================
// Network.
// =============================================================================
...
...
linphone-desktop/src/components/settings/SettingsModel.hpp
View file @
234a8cc9
...
...
@@ -37,7 +37,11 @@ class SettingsModel : public QObject {
// Chat & calls. -------------------------------------------------------------
Q_PROPERTY
(
bool
limeIsSupported
READ
getLimeIsSupported
CONSTANT
);
Q_PROPERTY
(
QVariantList
supportedMediaEncryptions
READ
getSupportedMediaEncryptions
CONSTANT
);
Q_PROPERTY
(
MediaEncryption
mediaEncryption
READ
getMediaEncryption
WRITE
setMediaEncryption
NOTIFY
mediaEncryptionChanged
);
Q_PROPERTY
(
LimeState
limeState
READ
getLimeState
WRITE
setLimeState
NOTIFY
limeStateChanged
);
// Network. ------------------------------------------------------------------
...
...
@@ -83,14 +87,22 @@ class SettingsModel : public QObject {
public:
enum
MediaEncryption
{
MediaEncryptionDtls
=
linphone
::
MediaEncryptionDTLS
,
MediaEncryptionNone
=
linphone
::
MediaEncryptionNone
,
MediaEncryptionDtls
=
linphone
::
MediaEncryptionDTLS
,
MediaEncryptionSrtp
=
linphone
::
MediaEncryptionSRTP
,
MediaEncryptionZrtp
=
linphone
::
MediaEncryptionZRTP
};
Q_ENUM
(
MediaEncryption
);
enum
LimeState
{
LimeStateDisabled
=
linphone
::
LimeStateDisabled
,
LimeStateMandatory
=
linphone
::
LimeStateMandatory
,
LimeStatePreferred
=
linphone
::
LimeStatePreferred
};
Q_ENUM
(
LimeState
);
SettingsModel
(
QObject
*
parent
=
Q_NULLPTR
);
// ===========================================================================
...
...
@@ -99,9 +111,15 @@ public:
// Chat & calls. -------------------------------------------------------------
bool
getLimeIsSupported
()
const
;
QVariantList
getSupportedMediaEncryptions
()
const
;
MediaEncryption
getMediaEncryption
()
const
;
void
setMediaEncryption
(
MediaEncryption
encryption
);
LimeState
getLimeState
()
const
;
void
setLimeState
(
LimeState
state
);
// Network. ------------------------------------------------------------------
bool
getUseSipInfoForDtmfs
()
const
;
...
...
@@ -181,6 +199,7 @@ signals:
// Chat & calls. -------------------------------------------------------------
void
mediaEncryptionChanged
(
MediaEncryption
encryption
);
void
limeStateChanged
(
LimeState
state
);
// Network. ------------------------------------------------------------------
...
...
linphone-desktop/ui/views/App/Settings/SettingsCallsChat.qml
View file @
234a8cc9
...
...
@@ -18,29 +18,34 @@ TabContainer {
width
:
parent
.
width
FormLine
{
visible
:
!!
encryption
.
encryptions
.
length
FormGroup
{
label
:
qsTr
(
'
encryptionLabel
'
)
ExclusiveButtons
{
property
var
_resolveButton
texts
:
[
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
]
}
id
:
encryption
property
var
encryptions
:
(
function
()
{
var
encryptions
=
SettingsModel
.
supportedMediaEncryptions
if
(
encryptions
.
length
)
{
encryptions
.
unshift
([
SettingsModel
.
MediaEncryptionNone
,
qsTr
(
'
noEncryption
'
)
])
}
return
encryptions
})()
onClicked
:
SettingsModel
.
mediaEncryption
=
_resolveButton
[
button
]
texts
:
encryptions
.
map
(
function
(
value
)
{
return
value
[
1
]
})
onClicked
:
SettingsModel
.
mediaEncryption
=
encryptions
[
button
][
0
]
Binding
{
property
:
'
selectedButton
'
target
:
encryption
value
:
SettingsModel
.
mediaEncryption
}
}
}
}
...
...
@@ -77,15 +82,31 @@ TabContainer {
}
FormLine
{
visible
:
SettingsModel
.
limeIsSupported
FormGroup
{
label
:
qsTr
(
'
encryptWithLimeLabel
'
)
ExclusiveButtons
{
texts
:
[
qsTr
(
'
limeDisabled
'
),
qsTr
(
'
limeRequired
'
),
qsTr
(
'
limePreferred
'
)
]
id
:
lime
property
var
limeStates
:
([
[
SettingsModel
.
LimeStateDisabled
,
qsTr
(
'
limeDisabled
'
)
],
[
SettingsModel
.
LimeStateMandatory
,
qsTr
(
'
limeRequired
'
)
],
[
SettingsModel
.
LimeStatePreferred
,
qsTr
(
'
limePreferred
'
)
]
])
texts
:
limeStates
.
map
(
function
(
value
)
{
return
value
[
1
]
})
onClicked
:
SettingsModel
.
limeState
=
limeStates
[
button
][
0
]
Binding
{
property
:
'
selectedButton
'
target
:
lime
value
:
SettingsModel
.
limeState
}
}
}
}
...
...
linphone
@
8599aec3
Subproject commit
e71c6a8c10b53bec9501eee689c7a37c27cc9ba7
Subproject commit
8599aec3e5cf04afa3780885ffd78a3063abed22
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment