diff --git a/electrum/gui/qml/components/ServerConfigDialog.qml b/electrum/gui/qml/components/ServerConfigDialog.qml
index b9679546e..ec53ef412 100644
--- a/electrum/gui/qml/components/ServerConfigDialog.qml
+++ b/electrum/gui/qml/components/ServerConfigDialog.qml
@@ -42,10 +42,8 @@ ElDialog {
text: qsTr('Ok')
icon.source: '../../icons/confirmed.png'
onClicked: {
- Network.oneServer = serverconfig.auto_connect
- ? false
- : serverconfig.one_server
- Config.autoConnect = serverconfig.auto_connect
+ Network.oneServer = serverconfig.serverConnectMode == ServerConnectModeComboBox.Mode.Single
+ Config.autoConnect = serverconfig.serverConnectMode == ServerConnectModeComboBox.Mode.Autoconnect
Network.server = serverconfig.address
rootItem.close()
}
diff --git a/electrum/gui/qml/components/controls/ServerConfig.qml b/electrum/gui/qml/components/controls/ServerConfig.qml
index 46a4cbba2..47bd4e680 100644
--- a/electrum/gui/qml/components/controls/ServerConfig.qml
+++ b/electrum/gui/qml/components/controls/ServerConfig.qml
@@ -10,9 +10,8 @@ Item {
id: root
property bool showAutoselectServer: true
- property alias auto_connect: auto_server_cb.checked
property alias address: address_tf.text
- property alias one_server: one_server_cb.checked
+ property alias serverConnectMode: server_connect_mode_cb.currentValue
implicitHeight: rootLayout.height
@@ -23,12 +22,32 @@ Item {
height: parent.height
spacing: constants.paddingLarge
- CheckBox {
- id: auto_server_cb
- visible: showAutoselectServer
- text: Config.shortDescFor('NETWORK_AUTO_CONNECT')
- checked: !showAutoselectServer
- enabled: !one_server_cb.checked
+
+ RowLayout {
+ Layout.fillWidth: true
+
+ ServerConnectModeComboBox {
+ id: server_connect_mode_cb
+ }
+
+ Item {
+ Layout.fillWidth: true
+ Layout.preferredHeight: 1
+ }
+
+ HelpButton {
+ Layout.alignment: Qt.AlignRight
+ heading: qsTr('Connection mode')+':'
+ helptext: Config.getTranslatedMessage('MSG_CONNECTMODE_SERVER_HELP') + '
' +
+ Config.getTranslatedMessage('MSG_CONNECTMODE_NODES_HELP') + '
' +
+ '- ' + Config.getTranslatedMessage('MSG_CONNECTMODE_AUTOCONNECT') +
+ ': ' + Config.getTranslatedMessage('MSG_CONNECTMODE_AUTOCONNECT_HELP') + '
' +
+ '- ' + Config.getTranslatedMessage('MSG_CONNECTMODE_MANUAL') +
+ ': ' + Config.getTranslatedMessage('MSG_CONNECTMODE_MANUAL_HELP') + '
' +
+ '- ' + Config.getTranslatedMessage('MSG_CONNECTMODE_ONESERVER') +
+ ': ' + Config.getTranslatedMessage('MSG_CONNECTMODE_ONESERVER_HELP') + '
' +
+ '
'
+ }
}
Label {
@@ -41,28 +60,12 @@ Item {
TextField {
id: address_tf
- enabled: !auto_server_cb.checked
+ enabled: server_connect_mode_cb.currentValue != ServerConnectModeComboBox.Mode.Autoconnect
width: parent.width
inputMethodHints: Qt.ImhNoPredictiveText
}
}
- RowLayout {
- Layout.fillWidth: true
- visible: !auto_server_cb.checked && address_tf.text
-
- CheckBox {
- id: one_server_cb
- Layout.fillWidth: true
- text: Config.shortDescFor('NETWORK_ONESERVER')
- }
-
- HelpButton {
- heading: Config.shortDescFor('NETWORK_ONESERVER')
- helptext: Config.longDescFor('NETWORK_ONESERVER')
- }
- }
-
ColumnLayout {
Heading {
text: qsTr('Servers')
@@ -112,9 +115,6 @@ Item {
}
Component.onCompleted: {
- root.auto_connect = Config.autoConnectDefined ? Config.autoConnect : false
root.address = Network.server
- one_server_cb.checked = Network.oneServer
- // TODO: initial setup should not connect already, is Network.server defined?
}
}
diff --git a/electrum/gui/qml/components/controls/ServerConnectModeComboBox.qml b/electrum/gui/qml/components/controls/ServerConnectModeComboBox.qml
new file mode 100644
index 000000000..c35074550
--- /dev/null
+++ b/electrum/gui/qml/components/controls/ServerConnectModeComboBox.qml
@@ -0,0 +1,38 @@
+import QtQuick
+import QtQuick.Controls
+
+import org.electrum 1.0
+
+ElComboBox {
+ id: control
+
+ enum Mode {
+ Autoconnect,
+ Manual,
+ Single
+ }
+
+ textRole: 'text'
+ valueRole: 'value'
+
+ model: [
+ { text: qsTr('Auto-connect'), value: ServerConnectModeComboBox.Mode.Autoconnect },
+ { text: qsTr('Manual server selection'), value: ServerConnectModeComboBox.Mode.Manual },
+ { text: qsTr('Connect only to a single server'), value: ServerConnectModeComboBox.Mode.Single }
+ ]
+
+ Component.onCompleted: {
+ if (!Config.autoConnectDefined) { // initial setup
+ server_connect_mode_cb.currentIndex = server_connect_mode_cb.indexOfValue(
+ ServerConnectModeComboBox.Mode.Manual)
+ } else {
+ server_connect_mode_cb.currentIndex = server_connect_mode_cb.indexOfValue(
+ Config.autoConnect
+ ? ServerConnectModeComboBox.Mode.Autoconnect
+ : Network.oneServer
+ ? ServerConnectModeComboBox.Mode.Single
+ : ServerConnectModeComboBox.Mode.Manual
+ )
+ }
+ }
+}
diff --git a/electrum/gui/qml/components/wizard/WCServerConfig.qml b/electrum/gui/qml/components/wizard/WCServerConfig.qml
index a48a1bd70..bc784d1b6 100644
--- a/electrum/gui/qml/components/wizard/WCServerConfig.qml
+++ b/electrum/gui/qml/components/wizard/WCServerConfig.qml
@@ -10,9 +10,9 @@ WizardComponent {
title: qsTr('Server')
function apply() {
- wizard_data['autoconnect'] = sc.address.trim() == ""
wizard_data['server'] = sc.address
- wizard_data['one_server'] = sc.one_server
+ wizard_data['autoconnect'] = sc.serverConnectMode == ServerConnectModeComboBox.Mode.Autoconnect
+ wizard_data['one_server'] = sc.serverConnectMode == ServerConnectModeComboBox.Mode.Single
}
ColumnLayout {
@@ -21,7 +21,6 @@ WizardComponent {
ServerConfig {
id: sc
- showAutoselectServer: false
Layout.fillWidth: true
Layout.fillHeight: true
}