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
d18c57c5
Commit
d18c57c5
authored
Feb 27, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/views/App/Settings/SettingsNetwork): supports video port
parent
16ae7c20
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
182 additions
and
50 deletions
+182
-50
resources.qrc
linphone-desktop/resources.qrc
+2
-0
SettingsModel.cpp
linphone-desktop/src/components/settings/SettingsModel.cpp
+32
-11
SettingsModel.hpp
linphone-desktop/src/components/settings/SettingsModel.hpp
+7
-0
PortField.qml
linphone-desktop/ui/modules/Common/Form/Fields/PortField.qml
+76
-0
qmldir
linphone-desktop/ui/modules/Common/qmldir
+1
-0
port-tools.js
linphone-desktop/ui/scripts/Utils/port-tools.js
+15
-0
utils.js
linphone-desktop/ui/scripts/Utils/utils.js
+8
-0
SettingsNetwork.qml
linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml
+41
-39
No files found.
linphone-desktop/resources.qrc
View file @
d18c57c5
...
...
@@ -187,6 +187,7 @@
<file>
ui/modules/Common/Form/ComboBox.qml
</file>
<file>
ui/modules/Common/Form/DroppableTextArea.qml
</file>
<file>
ui/modules/Common/Form/Fields/NumericField.qml
</file>
<file>
ui/modules/Common/Form/Fields/PortField.qml
</file>
<file>
ui/modules/Common/Form/Fields/TextAreaField.qml
</file>
<file>
ui/modules/Common/Form/Fields/TextField.qml
</file>
<file>
ui/modules/Common/Form/+linux/SearchBox.qml
</file>
...
...
@@ -301,6 +302,7 @@
<file>
ui/modules/Linphone/Timeline.qml
</file>
<file>
ui/scripts/LinphoneUtils/linphone-utils.js
</file>
<file>
ui/scripts/LinphoneUtils/qmldir
</file>
<file>
ui/scripts/Utils/port-tools.js
</file>
<file>
ui/scripts/Utils/qmldir
</file>
<file>
ui/scripts/Utils/uri-tools.js
</file>
<file>
ui/scripts/Utils/utils.js
</file>
...
...
linphone-desktop/src/components/settings/SettingsModel.cpp
View file @
d18c57c5
...
...
@@ -42,22 +42,23 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
// Network.
// =============================================================================
bool
SettingsModel
::
getUseRfc2833ForDtmfs
()
const
{
return
CoreManager
::
getInstance
()
->
getCore
()
->
getUseRfc2833ForDtmf
();
QList
<
int
>
SettingsModel
::
getVideoPortRange
()
const
{
int
a
,
b
;
CoreManager
::
getInstance
()
->
getCore
()
->
getVideoPortRange
(
a
,
b
);
return
QList
<
int
>
()
<<
a
<<
b
;
}
void
SettingsModel
::
set
UseRfc2833ForDtmfs
(
bool
status
)
{
void
SettingsModel
::
set
VideoPortRange
(
const
QList
<
int
>
&
range
)
{
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
int
a
=
range
[
0
];
int
b
=
range
[
1
];
if
(
status
)
{
core
->
setUseInfoForDtmf
(
false
);
core
->
setUseRfc2833ForDtmf
(
true
);
}
else
{
core
->
setUseRfc2833ForDtmf
(
false
);
core
->
setUseInfoForDtmf
(
true
);
}
if
(
b
==
-
1
)
core
->
setVideoPort
(
a
);
else
core
->
setVideoPortRange
(
a
,
b
);
emit
dtmfsProtocolChanged
(
);
emit
videoPortRangeChanged
(
a
,
b
);
}
// -----------------------------------------------------------------------------
...
...
@@ -82,6 +83,26 @@ void SettingsModel::setUseSipInfoForDtmfs (bool status) {
// -----------------------------------------------------------------------------
bool
SettingsModel
::
getUseRfc2833ForDtmfs
()
const
{
return
CoreManager
::
getInstance
()
->
getCore
()
->
getUseRfc2833ForDtmf
();
}
void
SettingsModel
::
setUseRfc2833ForDtmfs
(
bool
status
)
{
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
if
(
status
)
{
core
->
setUseInfoForDtmf
(
false
);
core
->
setUseRfc2833ForDtmf
(
true
);
}
else
{
core
->
setUseRfc2833ForDtmf
(
false
);
core
->
setUseInfoForDtmf
(
true
);
}
emit
dtmfsProtocolChanged
();
}
// -----------------------------------------------------------------------------
bool
SettingsModel
::
getIpv6Enabled
()
const
{
return
CoreManager
::
getInstance
()
->
getCore
()
->
ipv6Enabled
();
}
...
...
linphone-desktop/src/components/settings/SettingsModel.hpp
View file @
d18c57c5
...
...
@@ -31,6 +31,8 @@
class
SettingsModel
:
public
QObject
{
Q_OBJECT
;
Q_PROPERTY
(
QList
<
int
>
videoPortRange
READ
getVideoPortRange
WRITE
setVideoPortRange
NOTIFY
videoPortRangeChanged
);
Q_PROPERTY
(
bool
useSipInfoForDtmfs
READ
getUseSipInfoForDtmfs
WRITE
setUseSipInfoForDtmfs
NOTIFY
dtmfsProtocolChanged
);
Q_PROPERTY
(
bool
useRfc2833ForDtmfs
READ
getUseRfc2833ForDtmfs
WRITE
setUseRfc2833ForDtmfs
NOTIFY
dtmfsProtocolChanged
);
...
...
@@ -47,6 +49,9 @@ public:
// Network. ------------------------------------------------------------------
QList
<
int
>
getVideoPortRange
()
const
;
void
setVideoPortRange
(
const
QList
<
int
>
&
range
);
bool
getUseSipInfoForDtmfs
()
const
;
void
setUseSipInfoForDtmfs
(
bool
status
);
...
...
@@ -75,6 +80,8 @@ public:
static
const
std
::
string
UI_SECTION
;
signals:
void
videoPortRangeChanged
(
int
a
,
int
b
);
void
dtmfsProtocolChanged
();
void
ipv6EnabledChanged
(
bool
status
);
...
...
linphone-desktop/ui/modules/Common/Form/Fields/PortField.qml
0 → 100644
View file @
d18c57c5
import
QtQuick
2.7
import
Utils
1.0
// =============================================================================
Item
{
id
:
wrapper
// ---------------------------------------------------------------------------
property
string
text
property
bool
supportsRange
:
false
// ---------------------------------------------------------------------------
signal
editingFinished
(
int
portA
,
int
portB
)
// ---------------------------------------------------------------------------
function
_extractPorts
(
text
)
{
var
portA
=
+
text
.
split
(
'
:
'
)[
0
]
var
portB
=
(
function
()
{
var
port
=
text
.
split
(
'
:
'
)[
1
]
return
port
&&
port
.
length
>
0
?
+
port
:
-
1
})()
if
(
portB
<
0
||
portA
===
portB
)
{
return
[
portA
,
-
1
]
}
if
(
portA
<
portB
)
{
return
[
portA
,
portB
]
}
return
[
portB
,
portA
]
}
function
_computeText
(
range
)
{
return
range
[
1
]
<
0
?
range
[
0
]
:
range
[
0
]
+
'
:
'
+
range
[
1
]
}
// ---------------------------------------------------------------------------
implicitWidth
:
textField
.
width
implicitHeight
:
textField
.
height
onTextChanged
:
textField
.
text
=
_computeText
(
_extractPorts
(
text
))
// ---------------------------------------------------------------------------
TextField
{
id
:
textField
property
bool
locked
:
false
validator
:
RegExpValidator
{
regExp
:
wrapper
.
supportsRange
?
Utils
.
PORT_RANGE_REGEX
:
Utils
.
PORT_REGEX
}
// Workaround to supports empty string.
Keys.onReturnPressed
:
editingFinished
()
onActiveFocusChanged
:
!
activeFocus
&&
!
text
.
length
&&
editingFinished
()
onEditingFinished
:
{
var
range
=
_extractPorts
(
textField
.
text
)
wrapper
.
text
=
textField
.
text
=
_computeText
(
range
)
wrapper
.
editingFinished
(
range
[
0
],
range
[
1
])
}
}
}
linphone-desktop/ui/modules/Common/qmldir
View file @
d18c57c5
...
...
@@ -34,6 +34,7 @@ TextButtonA 1.0 Form/Buttons/TextButtonA.qml
TextButtonB 1.0 Form/Buttons/TextButtonB.qml
NumericField 1.0 Form/Fields/NumericField.qml
PortField 1.0 Form/Fields/PortField.qml
TextAreaField 1.0 Form/Fields/TextAreaField.qml
TextField 1.0 Form/Fields/TextField.qml
...
...
linphone-desktop/ui/scripts/Utils/port-tools.js
0 → 100644
View file @
d18c57c5
// =============================================================================
// Library to deal with Ports.
// =============================================================================
.
pragma
library
// -----------------------------------------------------------------------------
var
PORT
=
'
([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])
'
var
PORT_RANGE
=
PORT
+
'
(?::
'
+
PORT
+
'
)?
'
// -----------------------------------------------------------------------------
var
PORT_REGEX
=
new
RegExp
(
'
^
'
+
PORT
+
'
$
'
)
var
PORT_RANGE_REGEX
=
new
RegExp
(
'
^
'
+
PORT_RANGE
+
'
$
'
)
linphone-desktop/ui/scripts/Utils/utils.js
View file @
d18c57c5
...
...
@@ -6,8 +6,16 @@
.
import
QtQuick
2.0
as
QtQuick
.
import
'
port-tools.js
'
as
PortTools
.
import
'
uri-tools.js
'
as
UriTools
// =============================================================================
// Constants.
// =============================================================================
var
PORT_REGEX
=
PortTools
.
PORT_REGEX
var
PORT_RANGE_REGEX
=
PortTools
.
PORT_RANGE_REGEX
// =============================================================================
// QML helpers.
// =============================================================================
...
...
linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml
View file @
d18c57c5
...
...
@@ -12,41 +12,6 @@ TabContainer {
spacing
:
SettingsWindowStyle
.
forms
.
spacing
width
:
parent
.
width
// -------------------------------------------------------------------------
// Transport.
// -------------------------------------------------------------------------
Form
{
title
:
qsTr
(
'
transportTitle
'
)
width
:
parent
.
width
FormLine
{
FormGroup
{
label
:
qsTr
(
'
sendDtmfsLabel
'
)
ExclusiveButtons
{
selectedButton
:
Number
(
!
SettingsModel
.
useSipInfoForDtmfs
)
texts
:
[
'
SIP INFO
'
,
'
RFC 2833
'
]
onClicked
:
SettingsModel
.
useSipInfoForDtmfs
=
!
button
}
}
FormGroup
{
label
:
qsTr
(
'
allowIpV6Label
'
)
Switch
{
checked
:
SettingsModel
.
ipv6Enabled
onClicked
:
SettingsModel
.
ipv6Enabled
=
!
checked
}
}
}
}
// -------------------------------------------------------------------------
// Network protocol and ports.
// -------------------------------------------------------------------------
...
...
@@ -73,10 +38,12 @@ TabContainer {
FormGroup
{
label
:
qsTr
(
'
sipUdpPortLabel
'
)
NumericField
{
minValue
:
0
maxValue
:
65535
readOnly
:
randomSipUdpPort
.
checked
||
!
enableSipUdpPort
.
checked
PortField
{
//readOnly: randomSipUdpPort.checked || !enableSipUdpPort.checked
supportsRange
:
true
text
:
SettingsModel
.
videoPortRange
.
join
(
'
:
'
)
onEditingFinished
:
SettingsModel
.
videoPortRange
=
[
portA
,
portB
]
}
}
...
...
@@ -184,6 +151,41 @@ TabContainer {
}
}
// -------------------------------------------------------------------------
// Transport.
// -------------------------------------------------------------------------
Form
{
title
:
qsTr
(
'
transportTitle
'
)
width
:
parent
.
width
FormLine
{
FormGroup
{
label
:
qsTr
(
'
sendDtmfsLabel
'
)
ExclusiveButtons
{
selectedButton
:
Number
(
!
SettingsModel
.
useSipInfoForDtmfs
)
texts
:
[
'
SIP INFO
'
,
'
RFC 2833
'
]
onClicked
:
SettingsModel
.
useSipInfoForDtmfs
=
!
button
}
}
FormGroup
{
label
:
qsTr
(
'
allowIpV6Label
'
)
Switch
{
checked
:
SettingsModel
.
ipv6Enabled
onClicked
:
SettingsModel
.
ipv6Enabled
=
!
checked
}
}
}
}
// -------------------------------------------------------------------------
// DSCP fields.
// -------------------------------------------------------------------------
...
...
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