From 08f33396934248f9dbacf8cbc83d61449322d297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Tue, 20 Feb 2024 09:33:13 -0500 Subject: [PATCH] accountconfig: avoid duplication between dhtPort and DHT.port Also show it in advanced settings Change-Id: I8de880657530c4a957846ca334332f7ccf79ef8c --- daemon | 2 +- src/app/currentaccount.cpp | 1 + src/app/currentaccount.h | 1 + src/app/net/jami/Constants/JamiStrings.qml | 1 + .../components/AdvancedOpenDHTSettings.qml | 14 ++++++++++++++ src/libclient/accountmodel.cpp | 4 ++-- src/libclient/api/account.h | 2 +- 7 files changed, 21 insertions(+), 4 deletions(-) diff --git a/daemon b/daemon index 842128f09..c9bb7b123 160000 --- a/daemon +++ b/daemon @@ -1 +1 @@ -Subproject commit 842128f09bf0f1259602de70604285e8a2a427f1 +Subproject commit c9bb7b123194967dda603f0ef3ba00d2b5b4c520 diff --git a/src/app/currentaccount.cpp b/src/app/currentaccount.cpp index 1fdcbd608..45e8a77cf 100644 --- a/src/app/currentaccount.cpp +++ b/src/app/currentaccount.cpp @@ -145,6 +145,7 @@ CurrentAccount::updateData() set_peerDiscovery(accConfig.peerDiscovery, true); set_sendReadReceipt(accConfig.sendReadReceipt, true); set_isRendezVous(accConfig.isRendezVous, true); + set_dhtPort(accConfig.dhtPort, true); set_autoAnswer(accConfig.autoAnswer, true); set_proxyEnabled(accConfig.proxyEnabled, true); set_upnpEnabled(accConfig.upnpEnabled, true); diff --git a/src/app/currentaccount.h b/src/app/currentaccount.h index f2f5e7337..32ffdfb84 100644 --- a/src/app/currentaccount.h +++ b/src/app/currentaccount.h @@ -116,6 +116,7 @@ class CurrentAccount final : public QObject QML_RO_PROPERTY(lrc::api::profile::Type, type) QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, keepAliveEnabled) + QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(int, dhtPort) QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, peerDiscovery) QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, sendReadReceipt) QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, isRendezVous) diff --git a/src/app/net/jami/Constants/JamiStrings.qml b/src/app/net/jami/Constants/JamiStrings.qml index 3316ed079..e02580253 100644 --- a/src/app/net/jami/Constants/JamiStrings.qml +++ b/src/app/net/jami/Constants/JamiStrings.qml @@ -162,6 +162,7 @@ Item { property string videoRTPMaxPort: qsTr("Video RTP maximum port") // AdvancedOpenDHTSettings + property string dhtPortUsed: qsTr("Current DHT port used") property string enablePeerDiscovery: qsTr("Enable local peer discovery") property string tooltipPeerDiscovery: qsTr("Connect to other DHT nodes advertising on your local network.") property string openDHTConfig: qsTr("OpenDHT configuration") diff --git a/src/app/settingsview/components/AdvancedOpenDHTSettings.qml b/src/app/settingsview/components/AdvancedOpenDHTSettings.qml index cb2d8feea..cfb5fe2a1 100644 --- a/src/app/settingsview/components/AdvancedOpenDHTSettings.qml +++ b/src/app/settingsview/components/AdvancedOpenDHTSettings.qml @@ -45,6 +45,20 @@ ColumnLayout { ColumnLayout { Layout.fillWidth: true + SettingSpinBox { + id: dhtPortUsed + + visible: !root.isSIP + + title: JamiStrings.dhtPortUsed + itemWidth: root.itemWidth + bottomValue: 0 + topValue: 65535 + + valueField: CurrentAccount.dhtPort + onNewValue: CurrentAccount.dhtPort = valueField + } + ToggleSwitch { id: checkAutoConnectOnLocalNetwork visible: !root.isSIP diff --git a/src/libclient/accountmodel.cpp b/src/libclient/accountmodel.cpp index b1e681123..51f7e50a0 100644 --- a/src/libclient/accountmodel.cpp +++ b/src/libclient/accountmodel.cpp @@ -849,6 +849,7 @@ account::Info::fromDetails(const MapStringString& details) confProperties.proxyEnabled = toBool(details[ConfProperties::PROXY_ENABLED]); confProperties.proxyServer = details[ConfProperties::PROXY_SERVER]; confProperties.proxyPushToken = details[ConfProperties::PROXY_PUSH_TOKEN]; + confProperties.dhtPort = toInt(details[ConfProperties::DHT_PORT]); confProperties.peerDiscovery = toBool(details[ConfProperties::DHT_PEER_DISCOVERY]); confProperties.accountDiscovery = toBool(details[ConfProperties::ACCOUNT_PEER_DISCOVERY]); confProperties.accountPublish = toBool(details[ConfProperties::ACCOUNT_PUBLISH]); @@ -905,7 +906,6 @@ account::Info::fromDetails(const MapStringString& details) confProperties.TLS.disableSecureDlgCheck = toBool( details[ConfProperties::TLS::DISABLE_SECURE_DLG_CHECK]); // DHT - confProperties.DHT.port = toInt(details[ConfProperties::DHT::PORT]); confProperties.DHT.PublicInCalls = toBool(details[ConfProperties::DHT::PUBLIC_IN_CALLS]); confProperties.DHT.AllowFromTrusted = toBool(details[ConfProperties::DHT::ALLOW_FROM_TRUSTED]); // RingNS @@ -960,6 +960,7 @@ account::ConfProperties_t::toDetails() const details[ConfProperties::PROXY_ENABLED] = toQString(this->proxyEnabled); details[ConfProperties::PROXY_SERVER] = this->proxyServer; details[ConfProperties::PROXY_PUSH_TOKEN] = this->proxyPushToken; + details[ConfProperties::DHT_PORT] = toQString(this->dhtPort); details[ConfProperties::DHT_PEER_DISCOVERY] = toQString(this->peerDiscovery); details[ConfProperties::ACCOUNT_PEER_DISCOVERY] = toQString(this->accountDiscovery); details[ConfProperties::ACCOUNT_PUBLISH] = toQString(this->accountPublish); @@ -1014,7 +1015,6 @@ account::ConfProperties_t::toDetails() const details[ConfProperties::TLS::DISABLE_SECURE_DLG_CHECK] = toQString( this->TLS.disableSecureDlgCheck); // DHT - details[ConfProperties::DHT::PORT] = toQString(this->DHT.port); details[ConfProperties::DHT::PUBLIC_IN_CALLS] = toQString(this->DHT.PublicInCalls); details[ConfProperties::DHT::ALLOW_FROM_TRUSTED] = toQString(this->DHT.AllowFromTrusted); // RingNS diff --git a/src/libclient/api/account.h b/src/libclient/api/account.h index eb4d33ba1..9e867da7a 100644 --- a/src/libclient/api/account.h +++ b/src/libclient/api/account.h @@ -110,6 +110,7 @@ struct ConfProperties_t QString proxyServer; QString proxyPushToken; bool peerDiscovery; + int dhtPort; bool accountDiscovery; bool accountPublish; int registrationExpire; @@ -176,7 +177,6 @@ struct ConfProperties_t } TLS; struct DHT_t { - int port; bool PublicInCalls; bool AllowFromTrusted; } DHT; -- GitLab