Commit 26171f84 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Settings/SettingsNetwork): supports tcp/udp ports

parent 90663b34
...@@ -408,11 +408,35 @@ void SettingsModel::setAdaptiveRateControlEnabled (bool status) { ...@@ -408,11 +408,35 @@ void SettingsModel::setAdaptiveRateControlEnabled (bool status) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// bool SettingsModel::getTcpPortEnabled () const {} int SettingsModel::getTcpPort () const {
return CoreManager::getInstance()->getCore()->getTransports()->getTcpPort();
}
void SettingsModel::setTcpPort (int port) {
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
shared_ptr<linphone::Transports> transports = core->getTransports();
transports->setTcpPort(port);
core->setTransports(transports);
emit tcpPortChanged(port);
}
// -----------------------------------------------------------------------------
int SettingsModel::getUdpPort () const {
return CoreManager::getInstance()->getCore()->getTransports()->getUdpPort();
}
// void SettingsModel::setTcpPortEnabled (bool status) { void SettingsModel::setUdpPort (int port) {
// emit tcpPortEnabledChanged(status); shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
// } shared_ptr<linphone::Transports> transports = core->getTransports();
transports->setUdpPort(port);
core->setTransports(transports);
emit udpPortChanged(port);
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -90,7 +90,8 @@ class SettingsModel : public QObject { ...@@ -90,7 +90,8 @@ class SettingsModel : public QObject {
NOTIFY adaptiveRateControlEnabledChanged NOTIFY adaptiveRateControlEnabledChanged
); );
// Q_PROPERTY(bool tcpPortEnabled READ getTcpPortEnabled WRITE setTcpPortEnabled NOTIFY tcpPortEnabledChanged); Q_PROPERTY(int tcpPort READ getTcpPort WRITE setTcpPort NOTIFY tcpPortChanged);
Q_PROPERTY(int udpPort READ getUdpPort WRITE setUdpPort NOTIFY udpPortChanged);
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);
...@@ -213,8 +214,11 @@ public: ...@@ -213,8 +214,11 @@ public:
bool getAdaptiveRateControlEnabled () const; bool getAdaptiveRateControlEnabled () const;
void setAdaptiveRateControlEnabled (bool status); void setAdaptiveRateControlEnabled (bool status);
// bool getTcpPortEnabled () const; int getTcpPort () const;
// void setTcpPortEnabled (bool status); void setTcpPort (int port);
int getUdpPort () const;
void setUdpPort (int port);
QList<int> getAudioPortRange () const; QList<int> getAudioPortRange () const;
void setAudioPortRange (const QList<int> &range); void setAudioPortRange (const QList<int> &range);
...@@ -303,7 +307,8 @@ signals: ...@@ -303,7 +307,8 @@ signals:
bool adaptiveRateControlEnabledChanged (bool status); bool adaptiveRateControlEnabledChanged (bool status);
// void tcpPortEnabledChanged (bool status); void tcpPortChanged (int port);
void udpPortChanged (int port);
void audioPortRangeChanged (int a, int b); void audioPortRangeChanged (int a, int b);
void videoPortRangeChanged (int a, int b); void videoPortRangeChanged (int a, int b);
......
...@@ -116,9 +116,13 @@ TabContainer { ...@@ -116,9 +116,13 @@ TabContainer {
FormTableEntry { FormTableEntry {
NumericField { NumericField {
minValue: 0 minValue: 1
maxValue: 65535 maxValue: 65535
readOnly: randomSipUdpPort.checked || !enableSipUdpPort.checked readOnly: randomSipUdpPort.checked || !enableSipUdpPort.checked
text: SettingsModel.udpPort
onEditingFinished: SettingsModel.udpPort = text
} }
} }
...@@ -126,13 +130,22 @@ TabContainer { ...@@ -126,13 +130,22 @@ TabContainer {
Switch { Switch {
id: randomSipUdpPort id: randomSipUdpPort
readonly property int defaultPort: 5060
checked: SettingsModel.udpPort === -1
enabled: enableSipUdpPort.checked enabled: enableSipUdpPort.checked
onClicked: SettingsModel.udpPort = checked ? defaultPort : -1
} }
} }
FormTableEntry { FormTableEntry {
Switch { Switch {
id: enableSipUdpPort id: enableSipUdpPort
checked: SettingsModel.udpPort !== 0
onClicked: SettingsModel.udpPort = checked ? 0 : -1
} }
} }
} }
...@@ -142,10 +155,13 @@ TabContainer { ...@@ -142,10 +155,13 @@ TabContainer {
FormTableEntry { FormTableEntry {
NumericField { NumericField {
minValue: 1
minValue: 0
maxValue: 65535 maxValue: 65535
readOnly: randomSipTcpPort.checked || !enableSipTcpPort.checked readOnly: randomSipTcpPort.checked || !enableSipTcpPort.checked
text: SettingsModel.tcpPort
onEditingFinished: SettingsModel.tcpPort = text
} }
} }
...@@ -153,13 +169,22 @@ TabContainer { ...@@ -153,13 +169,22 @@ TabContainer {
Switch { Switch {
id: randomSipTcpPort id: randomSipTcpPort
readonly property int defaultPort: 5060
checked: SettingsModel.tcpPort === -1
enabled: enableSipTcpPort.checked enabled: enableSipTcpPort.checked
onClicked: SettingsModel.tcpPort = checked ? defaultPort : -1
} }
} }
FormTableEntry { FormTableEntry {
Switch { Switch {
id: enableSipTcpPort id: enableSipTcpPort
checked: SettingsModel.tcpPort !== 0
onClicked: SettingsModel.tcpPort = checked ? 0 : -1
} }
} }
} }
......
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