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
cb711fb0
Commit
cb711fb0
authored
Feb 28, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/views/App/Settings/SettingsNetwork): supports turn/ice
parent
a84cb8e2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
177 additions
and
42 deletions
+177
-42
SettingsModel.cpp
linphone-desktop/src/components/settings/SettingsModel.cpp
+86
-0
SettingsModel.hpp
linphone-desktop/src/components/settings/SettingsModel.hpp
+31
-0
SettingsNetwork.qml
linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml
+60
-42
No files found.
linphone-desktop/src/components/settings/SettingsModel.cpp
View file @
cb711fb0
...
...
@@ -143,6 +143,92 @@ void SettingsModel::setIpv6Enabled (bool status) {
// -----------------------------------------------------------------------------
bool
SettingsModel
::
getIceEnabled
()
const
{
return
CoreManager
::
getInstance
()
->
getCore
()
->
getNatPolicy
()
->
iceEnabled
();
}
void
SettingsModel
::
setIceEnabled
(
bool
status
)
{
shared_ptr
<
linphone
::
NatPolicy
>
nat_policy
=
CoreManager
::
getInstance
()
->
getCore
()
->
getNatPolicy
();
nat_policy
->
enableIce
(
status
);
nat_policy
->
enableStun
(
status
);
emit
iceEnabledChanged
(
status
);
}
// -----------------------------------------------------------------------------
bool
SettingsModel
::
getTurnEnabled
()
const
{
return
CoreManager
::
getInstance
()
->
getCore
()
->
getNatPolicy
()
->
turnEnabled
();
}
void
SettingsModel
::
setTurnEnabled
(
bool
status
)
{
CoreManager
::
getInstance
()
->
getCore
()
->
getNatPolicy
()
->
enableTurn
(
status
);
emit
turnEnabledChanged
(
status
);
}
// -----------------------------------------------------------------------------
QString
SettingsModel
::
getStunServer
()
const
{
return
::
Utils
::
linphoneStringToQString
(
CoreManager
::
getInstance
()
->
getCore
()
->
getNatPolicy
()
->
getStunServer
()
);
}
void
SettingsModel
::
setStunServer
(
const
QString
&
stun_server
)
{
CoreManager
::
getInstance
()
->
getCore
()
->
getNatPolicy
()
->
setStunServer
(
::
Utils
::
qStringToLinphoneString
(
stun_server
)
);
}
// -----------------------------------------------------------------------------
QString
SettingsModel
::
getTurnUser
()
const
{
return
::
Utils
::
linphoneStringToQString
(
CoreManager
::
getInstance
()
->
getCore
()
->
getNatPolicy
()
->
getStunServerUsername
()
);
}
void
SettingsModel
::
setTurnUser
(
const
QString
&
user
)
{
CoreManager
::
getInstance
()
->
getCore
()
->
getNatPolicy
()
->
setStunServerUsername
(
::
Utils
::
qStringToLinphoneString
(
user
)
);
emit
turnUserChanged
(
user
);
}
// -----------------------------------------------------------------------------
QString
SettingsModel
::
getTurnPassword
()
const
{
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
shared_ptr
<
linphone
::
NatPolicy
>
nat_policy
=
core
->
getNatPolicy
();
shared_ptr
<
linphone
::
AuthInfo
>
auth_info
=
core
->
findAuthInfo
(
nat_policy
->
getStunServerUsername
(),
""
,
""
);
return
auth_info
?
::
Utils
::
linphoneStringToQString
(
auth_info
->
getPasswd
())
:
""
;
}
void
SettingsModel
::
setTurnPassword
(
const
QString
&
password
)
{
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
shared_ptr
<
linphone
::
NatPolicy
>
nat_policy
=
core
->
getNatPolicy
();
const
string
&
username
=
nat_policy
->
getStunServerUsername
();
shared_ptr
<
linphone
::
AuthInfo
>
auth_info
=
core
->
findAuthInfo
(
username
,
""
,
""
);
if
(
auth_info
)
{
shared_ptr
<
linphone
::
AuthInfo
>
_auth_info
=
auth_info
->
clone
();
core
->
removeAuthInfo
(
auth_info
);
_auth_info
->
setPasswd
(
::
Utils
::
qStringToLinphoneString
(
password
));
core
->
addAuthInfo
(
_auth_info
);
}
else
{
auth_info
=
linphone
::
Factory
::
get
()
->
createAuthInfo
(
username
,
username
,
::
Utils
::
qStringToLinphoneString
(
password
),
""
,
""
,
""
);
core
->
addAuthInfo
(
auth_info
);
}
emit
turnPasswordChanged
(
password
);
}
// -----------------------------------------------------------------------------
int
SettingsModel
::
getDscpSip
()
const
{
return
CoreManager
::
getInstance
()
->
getCore
()
->
getSipDscp
();
}
...
...
linphone-desktop/src/components/settings/SettingsModel.hpp
View file @
cb711fb0
...
...
@@ -41,6 +41,14 @@ class SettingsModel : public QObject {
Q_PROPERTY
(
bool
ipv6Enabled
READ
getIpv6Enabled
WRITE
setIpv6Enabled
NOTIFY
ipv6EnabledChanged
);
Q_PROPERTY
(
bool
iceEnabled
READ
getIceEnabled
WRITE
setIceEnabled
NOTIFY
iceEnabledChanged
);
Q_PROPERTY
(
bool
turnEnabled
READ
getTurnEnabled
WRITE
setTurnEnabled
NOTIFY
turnEnabledChanged
);
Q_PROPERTY
(
QString
stunServer
READ
getStunServer
WRITE
setStunServer
NOTIFY
stunServerChanged
);
Q_PROPERTY
(
QString
turnUser
READ
getTurnUser
WRITE
setTurnUser
NOTIFY
turnUserChanged
);
Q_PROPERTY
(
QString
turnPassword
READ
getTurnPassword
WRITE
setTurnPassword
NOTIFY
turnPasswordChanged
);
Q_PROPERTY
(
int
dscpSip
READ
getDscpSip
WRITE
setDscpSip
NOTIFY
dscpSipChanged
);
Q_PROPERTY
(
int
dscpAudio
READ
getDscpAudio
WRITE
setDscpAudio
NOTIFY
dscpAudioChanged
);
Q_PROPERTY
(
int
dscpVideo
READ
getDscpVideo
WRITE
setDscpVideo
NOTIFY
dscpVideoChanged
);
...
...
@@ -74,6 +82,21 @@ public:
bool
getIpv6Enabled
()
const
;
void
setIpv6Enabled
(
bool
status
);
bool
getIceEnabled
()
const
;
void
setIceEnabled
(
bool
status
);
bool
getTurnEnabled
()
const
;
void
setTurnEnabled
(
bool
status
);
QString
getStunServer
()
const
;
void
setStunServer
(
const
QString
&
stun_server
);
QString
getTurnUser
()
const
;
void
setTurnUser
(
const
QString
&
user
);
QString
getTurnPassword
()
const
;
void
setTurnPassword
(
const
QString
&
password
);
int
getDscpSip
()
const
;
void
setDscpSip
(
int
dscp
);
...
...
@@ -111,6 +134,14 @@ signals:
void
ipv6EnabledChanged
(
bool
status
);
void
iceEnabledChanged
(
bool
status
);
void
turnEnabledChanged
(
bool
status
);
void
stunServerChanged
(
const
QString
&
server
);
void
turnUserChanged
(
const
QString
&
user
);
void
turnPasswordChanged
(
const
QString
&
password
);
void
dscpSipChanged
(
int
dscp
);
void
dscpAudioChanged
(
int
dscp
);
void
dscpVideoChanged
(
int
dscp
);
...
...
linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml
View file @
cb711fb0
...
...
@@ -229,46 +229,6 @@ TabContainer {
}
}
// -------------------------------------------------------------------------
// DSCP fields.
// -------------------------------------------------------------------------
Form
{
title
:
qsTr
(
'
dscpFieldsTitle
'
)
width
:
parent
.
width
FormLine
{
FormGroup
{
label
:
qsTr
(
'
sipFieldLabel
'
)
HexField
{
text
:
SettingsModel
.
dscpSip
onEditingFinished
:
SettingsModel
.
dscpSip
=
value
}
}
}
FormLine
{
FormGroup
{
label
:
qsTr
(
'
audioRtpStreamFieldLabel
'
)
HexField
{
text
:
SettingsModel
.
dscpAudio
onEditingFinished
:
SettingsModel
.
dscpAudio
=
value
}
}
FormGroup
{
label
:
qsTr
(
'
videoRtpStreamFieldLabel
'
)
HexField
{
text
:
SettingsModel
.
dscpVideo
onEditingFinished
:
SettingsModel
.
dscpVideo
=
value
}
}
}
}
// -------------------------------------------------------------------------
// NAT and Firewall.
// -------------------------------------------------------------------------
...
...
@@ -283,6 +243,10 @@ TabContainer {
Switch
{
id
:
enableIce
checked
:
SettingsModel
.
iceEnabled
onClicked
:
SettingsModel
.
iceEnabled
=
!
checked
}
}
...
...
@@ -291,6 +255,10 @@ TabContainer {
TextField
{
readOnly
:
!
enableIce
.
checked
text
:
SettingsModel
.
stunServer
onEditingFinished
:
SettingsModel
.
stunServer
=
text
}
}
}
...
...
@@ -303,6 +271,9 @@ TabContainer {
id
:
enableTurn
enabled
:
enableIce
.
checked
checked
:
SettingsModel
.
turnEnabled
onClicked
:
SettingsModel
.
turnEnabled
=
!
checked
}
}
...
...
@@ -310,7 +281,12 @@ TabContainer {
label
:
qsTr
(
'
turnUserLabel
'
)
TextField
{
id
:
turnUser
readOnly
:
!
enableTurn
.
checked
||
!
enableTurn
.
enabled
text
:
SettingsModel
.
turnUser
onEditingFinished
:
SettingsModel
.
turnUser
=
text
}
}
}
...
...
@@ -324,8 +300,50 @@ TabContainer {
label
:
qsTr
(
'
turnPasswordLabel
'
)
TextField
{
echoMode
:
TextInput
.
Password
readOnly
:
!
enableTurn
.
checked
||
!
enableTurn
.
enabled
readOnly
:
!
enableTurn
.
checked
||
!
enableTurn
.
enabled
||
!
turnUser
.
text
.
length
text
:
SettingsModel
.
turnPassword
onEditingFinished
:
SettingsModel
.
turnPassword
=
text
}
}
}
}
// -------------------------------------------------------------------------
// DSCP fields.
// -------------------------------------------------------------------------
Form
{
title
:
qsTr
(
'
dscpFieldsTitle
'
)
width
:
parent
.
width
FormLine
{
FormGroup
{
label
:
qsTr
(
'
sipFieldLabel
'
)
HexField
{
text
:
SettingsModel
.
dscpSip
onEditingFinished
:
SettingsModel
.
dscpSip
=
value
}
}
}
FormLine
{
FormGroup
{
label
:
qsTr
(
'
audioRtpStreamFieldLabel
'
)
HexField
{
text
:
SettingsModel
.
dscpAudio
onEditingFinished
:
SettingsModel
.
dscpAudio
=
value
}
}
FormGroup
{
label
:
qsTr
(
'
videoRtpStreamFieldLabel
'
)
HexField
{
text
:
SettingsModel
.
dscpVideo
onEditingFinished
:
SettingsModel
.
dscpVideo
=
value
}
}
}
...
...
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