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) {
// -----------------------------------------------------------------------------
// 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) {
// emit tcpPortEnabledChanged(status);
// }
void SettingsModel::setUdpPort (int port) {
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 {
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> videoPortRange READ getVideoPortRange WRITE setVideoPortRange NOTIFY videoPortRangeChanged);
......@@ -213,8 +214,11 @@ public:
bool getAdaptiveRateControlEnabled () const;
void setAdaptiveRateControlEnabled (bool status);
// bool getTcpPortEnabled () const;
// void setTcpPortEnabled (bool status);
int getTcpPort () const;
void setTcpPort (int port);
int getUdpPort () const;
void setUdpPort (int port);
QList<int> getAudioPortRange () const;
void setAudioPortRange (const QList<int> &range);
......@@ -303,7 +307,8 @@ signals:
bool adaptiveRateControlEnabledChanged (bool status);
// void tcpPortEnabledChanged (bool status);
void tcpPortChanged (int port);
void udpPortChanged (int port);
void audioPortRangeChanged (int a, int b);
void videoPortRangeChanged (int a, int b);
......
......@@ -116,9 +116,13 @@ TabContainer {
FormTableEntry {
NumericField {
minValue: 0
minValue: 1
maxValue: 65535
readOnly: randomSipUdpPort.checked || !enableSipUdpPort.checked
text: SettingsModel.udpPort
onEditingFinished: SettingsModel.udpPort = text
}
}
......@@ -126,13 +130,22 @@ TabContainer {
Switch {
id: randomSipUdpPort
readonly property int defaultPort: 5060
checked: SettingsModel.udpPort === -1
enabled: enableSipUdpPort.checked
onClicked: SettingsModel.udpPort = checked ? defaultPort : -1
}
}
FormTableEntry {
Switch {
id: enableSipUdpPort
checked: SettingsModel.udpPort !== 0
onClicked: SettingsModel.udpPort = checked ? 0 : -1
}
}
}
......@@ -142,10 +155,13 @@ TabContainer {
FormTableEntry {
NumericField {
minValue: 0
minValue: 1
maxValue: 65535
readOnly: randomSipTcpPort.checked || !enableSipTcpPort.checked
text: SettingsModel.tcpPort
onEditingFinished: SettingsModel.tcpPort = text
}
}
......@@ -153,13 +169,22 @@ TabContainer {
Switch {
id: randomSipTcpPort
readonly property int defaultPort: 5060
checked: SettingsModel.tcpPort === -1
enabled: enableSipTcpPort.checked
onClicked: SettingsModel.tcpPort = checked ? defaultPort : -1
}
}
FormTableEntry {
Switch {
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