Skip to content
Snippets Groups Projects
Commit 37c45c27 authored by Ming Rui Zhang's avatar Ming Rui Zhang
Browse files

settings: add allow IP auto rewrite option

Change-Id: I09c24f1185b37c728eb9ce1968cca21a99b79452
parent a31fb6c0
No related branches found
No related tags found
No related merge requests found
...@@ -115,6 +115,7 @@ Item { ...@@ -115,6 +115,7 @@ Item {
property string stunAdress: qsTr("STUN address") property string stunAdress: qsTr("STUN address")
// AdvancedPublicAddressSettings // AdvancedPublicAddressSettings
property string allowIPAutoRewrite: qsTr("Allow IP Auto Rewrite")
property string publicAddress: qsTr("Public address") property string publicAddress: qsTr("Public address")
property string useCustomAddress: qsTr("Use custom address and port") property string useCustomAddress: qsTr("Use custom address and port")
property string address: qsTr("Address") property string address: qsTr("Address")
......
...@@ -552,6 +552,12 @@ SettingsAdapter::getAccountConfig_PublishedPort() ...@@ -552,6 +552,12 @@ SettingsAdapter::getAccountConfig_PublishedPort()
return getAccountConfig().publishedPort; return getAccountConfig().publishedPort;
} }
bool
SettingsAdapter::getAccountConfig_AllowIPAutoRewrite()
{
return getAccountConfig().allowIPAutoRewrite;
}
QString QString
SettingsAdapter::getAccountConfig_Mailbox() SettingsAdapter::getAccountConfig_Mailbox()
{ {
...@@ -762,6 +768,15 @@ SettingsAdapter::setUseCustomAddressAndPort(bool state) ...@@ -762,6 +768,15 @@ SettingsAdapter::setUseCustomAddressAndPort(bool state)
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->get_currentAccountId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->get_currentAccountId(), confProps);
} }
void
SettingsAdapter::setAllowIPAutoRewrite(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->get_currentAccountId());
confProps.allowIPAutoRewrite = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->get_currentAccountId(), confProps);
}
void void
SettingsAdapter::setNameServer(QString text) SettingsAdapter::setNameServer(QString text)
{ {
......
...@@ -150,6 +150,7 @@ public: ...@@ -150,6 +150,7 @@ public:
Q_INVOKABLE bool getAccountConfig_PublishedSameAsLocal(); Q_INVOKABLE bool getAccountConfig_PublishedSameAsLocal();
Q_INVOKABLE QString getAccountConfig_PublishedAddress(); Q_INVOKABLE QString getAccountConfig_PublishedAddress();
Q_INVOKABLE int getAccountConfig_PublishedPort(); Q_INVOKABLE int getAccountConfig_PublishedPort();
Q_INVOKABLE bool getAccountConfig_AllowIPAutoRewrite();
Q_INVOKABLE QString getAccountConfig_Mailbox(); Q_INVOKABLE QString getAccountConfig_Mailbox();
...@@ -178,6 +179,7 @@ public: ...@@ -178,6 +179,7 @@ public:
Q_INVOKABLE void setVerifyCertificatesClient(bool state); Q_INVOKABLE void setVerifyCertificatesClient(bool state);
Q_INVOKABLE void setRequireCertificatesIncomingTLS(bool state); Q_INVOKABLE void setRequireCertificatesIncomingTLS(bool state);
Q_INVOKABLE void setUseCustomAddressAndPort(bool state); Q_INVOKABLE void setUseCustomAddressAndPort(bool state);
Q_INVOKABLE void setAllowIPAutoRewrite(bool state);
Q_INVOKABLE void setNameServer(QString text); Q_INVOKABLE void setNameServer(QString text);
Q_INVOKABLE void setProxyAddress(QString text); Q_INVOKABLE void setProxyAddress(QString text);
......
...@@ -35,9 +35,16 @@ ColumnLayout { ...@@ -35,9 +35,16 @@ ColumnLayout {
property int itemWidth property int itemWidth
function updatePublicAddressAccountInfos() { function updatePublicAddressAccountInfos() {
checkBoxAllowIPAutoRewrite.checked = SettingsAdapter.getAccountConfig_AllowIPAutoRewrite()
checkBoxCustomAddressPort.checked = !SettingsAdapter.getAccountConfig_PublishedSameAsLocal() checkBoxCustomAddressPort.checked = !SettingsAdapter.getAccountConfig_PublishedSameAsLocal()
lineEditSIPCustomAddress.setText(SettingsAdapter.getAccountConfig_PublishedAddress()) lineEditSIPCustomAddress.setText(SettingsAdapter.getAccountConfig_PublishedAddress())
customPortSIPSpinBox.setValue(SettingsAdapter.getAccountConfig_PublishedPort()) customPortSIPSpinBox.setValue(SettingsAdapter.getAccountConfig_PublishedPort())
if (checkBoxAllowIPAutoRewrite.checked) {
checkBoxCustomAddressPort.visible = false
lineEditSIPCustomAddress.visible = false
customPortSIPSpinBox.visible = false
}
} }
Text { Text {
...@@ -58,6 +65,20 @@ ColumnLayout { ...@@ -58,6 +65,20 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize Layout.leftMargin: JamiTheme.preferredMarginSize
ToggleSwitch {
id: checkBoxAllowIPAutoRewrite
labelText: JamiStrings.allowIPAutoRewrite
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setAllowIPAutoRewrite(checked)
checkBoxCustomAddressPort.visible = !checked
lineEditSIPCustomAddress.visible = !checked
customPortSIPSpinBox.visible = !checked
}
}
ToggleSwitch { ToggleSwitch {
id: checkBoxCustomAddressPort id: checkBoxCustomAddressPort
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment