Skip to content

Commit

Permalink
qml: ask user whether to configure Tor or other proxy before presenti…
Browse files Browse the repository at this point in the history
…ng proxy detail config screen
  • Loading branch information
accumulator committed Mar 16, 2023
1 parent 39eaf9d commit 7a86d8d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
43 changes: 43 additions & 0 deletions electrum/gui/qml/components/wizard/WCProxyAsk.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import QtQuick 2.6
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.1
import QtQuick.Controls.Material 2.0

import "../controls"

WizardComponent {
valid: true

function apply() {
wizard_data['want_proxy'] = wantproxygroup.checkedButton.wantproxy
}

ColumnLayout {
width: parent.width

Label {
Layout.fillWidth: true
text: qsTr('Do you want to connect through TOR, or through another service to reach to the internet?')
wrapMode: Text.Wrap
}

ButtonGroup {
id: wantproxygroup
onCheckedButtonChanged: checkIsLast()
}

RadioButton {
ButtonGroup.group: wantproxygroup
property bool wantproxy: true
text: qsTr('Yes')
}
RadioButton {
ButtonGroup.group: wantproxygroup
property bool wantproxy: false
text: qsTr('No')
checked: true
}

}

}
3 changes: 2 additions & 1 deletion electrum/gui/qml/components/wizard/WCProxyConfig.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ WizardComponent {

ProxyConfig {
id: pc
width: parent.width
Layout.fillWidth: true
proxy_enabled: true
}
}
}
1 change: 1 addition & 0 deletions electrum/gui/qml/qewizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def __init__(self, daemon, parent = None):
# attach view names
self.navmap_merge({
'autoconnect': { 'gui': 'WCAutoConnect' },
'proxy_ask': { 'gui': 'WCProxyAsk' },
'proxy_config': { 'gui': 'WCProxyConfig' },
'server_config': { 'gui': 'WCServerConfig' },
})
5 changes: 4 additions & 1 deletion electrum/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,12 @@ class ServerConnectWizard(AbstractWizard):
def __init__(self, daemon):
self.navmap = {
'autoconnect': {
'next': 'proxy_config',
'next': 'proxy_ask',
'last': lambda v,d: d['autoconnect']
},
'proxy_ask': {
'next': lambda d: 'proxy_config' if d['want_proxy'] else 'server_config'
},
'proxy_config': {
'next': 'server_config'
},
Expand Down

0 comments on commit 7a86d8d

Please sign in to comment.