Commit 5d018bc6 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Settings/SettingsNetwork): supports DSCP fields

parent b69e5bda
...@@ -186,6 +186,7 @@ ...@@ -186,6 +186,7 @@
<file>ui/modules/Common/Form/CheckBoxText.qml</file> <file>ui/modules/Common/Form/CheckBoxText.qml</file>
<file>ui/modules/Common/Form/ComboBox.qml</file> <file>ui/modules/Common/Form/ComboBox.qml</file>
<file>ui/modules/Common/Form/DroppableTextArea.qml</file> <file>ui/modules/Common/Form/DroppableTextArea.qml</file>
<file>ui/modules/Common/Form/Fields/HexField.qml</file>
<file>ui/modules/Common/Form/Fields/NumericField.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/PortField.qml</file>
<file>ui/modules/Common/Form/Fields/TextAreaField.qml</file> <file>ui/modules/Common/Form/Fields/TextAreaField.qml</file>
......
...@@ -42,6 +42,14 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) { ...@@ -42,6 +42,14 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
// Network. // Network.
// ============================================================================= // =============================================================================
// bool SettingsModel::getTcpPortEnabled () const {}
// void SettingsModel::setTcpPortEnabled (bool status) {
// emit tcpPortEnabledChanged(status);
// }
// -----------------------------------------------------------------------------
QList<int> SettingsModel::getAudioPortRange () const { QList<int> SettingsModel::getAudioPortRange () const {
int a, b; int a, b;
CoreManager::getInstance()->getCore()->getAudioPortRange(a, b); CoreManager::getInstance()->getCore()->getAudioPortRange(a, b);
...@@ -133,6 +141,35 @@ void SettingsModel::setIpv6Enabled (bool status) { ...@@ -133,6 +141,35 @@ void SettingsModel::setIpv6Enabled (bool status) {
emit ipv6EnabledChanged(status); emit ipv6EnabledChanged(status);
} }
// -----------------------------------------------------------------------------
int SettingsModel::getDscpSip () const {
return CoreManager::getInstance()->getCore()->getSipDscp();
}
void SettingsModel::setDscpSip (int dscp) {
CoreManager::getInstance()->getCore()->setSipDscp(dscp);
emit dscpSipChanged(dscp);
}
int SettingsModel::getDscpAudio () const {
return CoreManager::getInstance()->getCore()->getAudioDscp();
}
void SettingsModel::setDscpAudio (int dscp) {
CoreManager::getInstance()->getCore()->setAudioDscp(dscp);
emit dscpAudioChanged(dscp);
}
int SettingsModel::getDscpVideo () const {
return CoreManager::getInstance()->getCore()->getVideoDscp();
}
void SettingsModel::setDscpVideo (int dscp) {
CoreManager::getInstance()->getCore()->setVideoDscp(dscp);
emit dscpVideoChanged(dscp);
}
// ============================================================================= // =============================================================================
// Misc. // Misc.
// ============================================================================= // =============================================================================
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
class SettingsModel : public QObject { class SettingsModel : public QObject {
Q_OBJECT; Q_OBJECT;
// Q_PROPERTY(bool tcpPortEnabled READ getTcpPortEnabled WRITE setTcpPortEnabled NOTIFY tcpPortEnabledChanged);
Q_PROPERTY(QList<int> audioPortRange READ getAudioPortRange WRITE setAudioPortRange NOTIFY audioPortRangeChanged); Q_PROPERTY(QList<int> audioPortRange READ getAudioPortRange WRITE setAudioPortRange NOTIFY audioPortRangeChanged);
Q_PROPERTY(QList<int> videoPortRange READ getVideoPortRange WRITE setVideoPortRange NOTIFY videoPortRangeChanged); Q_PROPERTY(QList<int> videoPortRange READ getVideoPortRange WRITE setVideoPortRange NOTIFY videoPortRangeChanged);
...@@ -39,6 +41,10 @@ class SettingsModel : public QObject { ...@@ -39,6 +41,10 @@ class SettingsModel : public QObject {
Q_PROPERTY(bool ipv6Enabled READ getIpv6Enabled WRITE setIpv6Enabled NOTIFY ipv6EnabledChanged); Q_PROPERTY(bool ipv6Enabled READ getIpv6Enabled WRITE setIpv6Enabled NOTIFY ipv6EnabledChanged);
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);
Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged); Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged);
Q_PROPERTY(QString fileTransferUrl READ getFileTransferUrl WRITE setFileTransferUrl NOTIFY fileTransferUrlChanged); Q_PROPERTY(QString fileTransferUrl READ getFileTransferUrl WRITE setFileTransferUrl NOTIFY fileTransferUrlChanged);
...@@ -50,6 +56,9 @@ public: ...@@ -50,6 +56,9 @@ public:
// Network. ------------------------------------------------------------------ // Network. ------------------------------------------------------------------
// bool getTcpPortEnabled () const;
// void setTcpPortEnabled (bool status);
QList<int> getAudioPortRange () const; QList<int> getAudioPortRange () const;
void setAudioPortRange (const QList<int> &range); void setAudioPortRange (const QList<int> &range);
...@@ -65,6 +74,15 @@ public: ...@@ -65,6 +74,15 @@ public:
bool getIpv6Enabled () const; bool getIpv6Enabled () const;
void setIpv6Enabled (bool status); void setIpv6Enabled (bool status);
int getDscpSip () const;
void setDscpSip (int dscp);
int getDscpAudio () const;
void setDscpAudio (int dscp);
int getDscpVideo () const;
void setDscpVideo (int dscp);
// Misc. --------------------------------------------------------------------- // Misc. ---------------------------------------------------------------------
bool getAutoAnswerStatus () const; bool getAutoAnswerStatus () const;
...@@ -84,6 +102,8 @@ public: ...@@ -84,6 +102,8 @@ public:
static const std::string UI_SECTION; static const std::string UI_SECTION;
signals: signals:
// void tcpPortEnabledChanged (bool status);
void audioPortRangeChanged (int a, int b); void audioPortRangeChanged (int a, int b);
void videoPortRangeChanged (int a, int b); void videoPortRangeChanged (int a, int b);
...@@ -91,6 +111,10 @@ signals: ...@@ -91,6 +111,10 @@ signals:
void ipv6EnabledChanged (bool status); void ipv6EnabledChanged (bool status);
void dscpSipChanged (int dscp);
void dscpAudioChanged (int dscp);
void dscpVideoChanged (int dscp);
void autoAnswerStatusChanged (bool status); void autoAnswerStatusChanged (bool status);
void fileTransferUrlChanged (const QString &url); void fileTransferUrlChanged (const QString &url);
......
import QtQuick 2.7
// =============================================================================
Item {
id: wrapper
// ---------------------------------------------------------------------------
property alias readOnly: textField.readOnly
property string text
// ---------------------------------------------------------------------------
signal editingFinished (int value)
// ---------------------------------------------------------------------------
function _computeText (text) {
return (+text).toString(16).toUpperCase()
}
// ---------------------------------------------------------------------------
implicitHeight: textField.height
implicitWidth: textField.width
// ---------------------------------------------------------------------------
Binding {
property: 'text'
target: textField
value: _computeText(wrapper.text)
}
TextField {
id: textField
validator: RegExpValidator {
regExp: /[0-9A-F]*/
}
onEditingFinished: {
text = text.length
? parseInt(textField.text, 16)
: 0
wrapper.editingFinished(text)
}
}
}
...@@ -46,8 +46,8 @@ Item { ...@@ -46,8 +46,8 @@ Item {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
implicitWidth: textField.width
implicitHeight: textField.height implicitHeight: textField.height
implicitWidth: textField.width
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
...@@ -67,7 +67,7 @@ Item { ...@@ -67,7 +67,7 @@ Item {
} }
// Workaround to supports empty string. // Workaround to supports empty string.
Keys.onReturnPressed: textField.focus = false Keys.onReturnPressed: editingFinished()
onActiveFocusChanged: !activeFocus && editingFinished() onActiveFocusChanged: !activeFocus && editingFinished()
onEditingFinished: { onEditingFinished: {
......
...@@ -33,6 +33,7 @@ FileChooserButton 1.0 Form/Buttons/FileChooserButton.qml ...@@ -33,6 +33,7 @@ FileChooserButton 1.0 Form/Buttons/FileChooserButton.qml
TextButtonA 1.0 Form/Buttons/TextButtonA.qml TextButtonA 1.0 Form/Buttons/TextButtonA.qml
TextButtonB 1.0 Form/Buttons/TextButtonB.qml TextButtonB 1.0 Form/Buttons/TextButtonB.qml
HexField 1.0 Form/Fields/HexField.qml
NumericField 1.0 Form/Fields/NumericField.qml NumericField 1.0 Form/Fields/NumericField.qml
PortField 1.0 Form/Fields/PortField.qml PortField 1.0 Form/Fields/PortField.qml
TextAreaField 1.0 Form/Fields/TextAreaField.qml TextAreaField 1.0 Form/Fields/TextAreaField.qml
......
...@@ -38,12 +38,10 @@ TabContainer { ...@@ -38,12 +38,10 @@ TabContainer {
FormGroup { FormGroup {
label: qsTr('sipUdpPortLabel') label: qsTr('sipUdpPortLabel')
PortField { NumericField {
//readOnly: randomSipUdpPort.checked || !enableSipUdpPort.checked minValue: 0
//supportsRange: true maxValue: 65535
//text: SettingsModel.videoPortRange.join(':') readOnly: randomSipUdpPort.checked || !enableSipUdpPort.checked
//onEditingFinished: SettingsModel.videoPortRange = [ portA, portB ]
} }
} }
...@@ -194,6 +192,43 @@ TabContainer { ...@@ -194,6 +192,43 @@ TabContainer {
} }
} }
// -------------------------------------------------------------------------
// Bandwidth control.
// -------------------------------------------------------------------------
Form {
title: qsTr('bandwidthControlTitle')
width: parent.width
FormLine {
FormGroup {
label: qsTr('downloadSpeedLimitLabel')
NumericField {
minValue: 0
maxValue: 100000
}
}
FormGroup {
label: qsTr('uploadSpeedLimitLabel')
NumericField {
minValue: 0
maxValue: 100000
}
}
}
FormLine {
FormGroup {
label: qsTr('enableAdaptiveRateControlLabel')
Switch {}
}
}
}
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// DSCP fields. // DSCP fields.
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
...@@ -206,7 +241,10 @@ TabContainer { ...@@ -206,7 +241,10 @@ TabContainer {
FormGroup { FormGroup {
label: qsTr('sipFieldLabel') label: qsTr('sipFieldLabel')
TextField {} HexField {
text: SettingsModel.dscpSip
onEditingFinished: SettingsModel.dscpSip = value
}
} }
} }
...@@ -214,13 +252,19 @@ TabContainer { ...@@ -214,13 +252,19 @@ TabContainer {
FormGroup { FormGroup {
label: qsTr('audioRtpStreamFieldLabel') label: qsTr('audioRtpStreamFieldLabel')
TextField {} HexField {
text: SettingsModel.dscpAudio
onEditingFinished: SettingsModel.dscpAudio = value
}
} }
FormGroup { FormGroup {
label: qsTr('videoRtpStreamFieldLabel') label: qsTr('videoRtpStreamFieldLabel')
TextField {} HexField {
text: SettingsModel.dscpVideo
onEditingFinished: SettingsModel.dscpVideo = value
}
} }
} }
} }
...@@ -286,42 +330,5 @@ TabContainer { ...@@ -286,42 +330,5 @@ TabContainer {
} }
} }
} }
// -------------------------------------------------------------------------
// Bandwidth control.
// -------------------------------------------------------------------------
Form {
title: qsTr('bandwidthControlTitle')
width: parent.width
FormLine {
FormGroup {
label: qsTr('downloadSpeedLimitLabel')
NumericField {
minValue: 0
maxValue: 100000
}
}
FormGroup {
label: qsTr('uploadSpeedLimitLabel')
NumericField {
minValue: 0
maxValue: 100000
}
}
}
FormLine {
FormGroup {
label: qsTr('enableAdaptiveRateControlLabel')
Switch {}
}
}
}
} }
} }
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