1
0

qml: add server and proxy config dialogs

This commit is contained in:
Sander van Grieken
2022-08-24 16:01:50 +02:00
parent 757ec53ea2
commit 9a72f98855
5 changed files with 77 additions and 15 deletions

View File

@@ -10,7 +10,7 @@ Image {
property bool lagging: connected && Network.isLagging
property bool fork: connected && Network.chaintips > 1
property bool syncing: connected && Daemon.currentWallet && Daemon.currentWallet.synchronizing
property bool proxy: connected && Network.proxy.mode
property bool proxy: connected && 'mode' in Network.proxy && Network.proxy.mode
// ?: in order to keep this a binding..
source: !connected

View File

@@ -3,6 +3,8 @@ import QtQuick.Layouts 1.0
import QtQuick.Controls 2.1
Item {
id: pc
property alias proxy_enabled: proxy_enabled_cb.checked
property alias proxy_type: proxytype.currentIndex
property alias proxy_address: address.text
@@ -12,8 +14,29 @@ Item {
property var proxy_types: ['TOR', 'SOCKS5', 'SOCKS4']
height: rootLayout.height
function toProxyDict() {
var p = {}
p['enabled'] = pc.proxy_enabled
if (pc.proxy_enabled) {
var type = pc.proxy_types[pc.proxy_type].toLowerCase()
if (type == 'tor')
type = 'socks5'
p['mode'] = type
p['host'] = pc.proxy_address
p['port'] = pc.proxy_port
p['user'] = pc.username
p['password'] = pc.password
}
return p
}
ColumnLayout {
id: rootLayout
width: parent.width
spacing: constants.paddingLarge
Label {
text: qsTr('Proxy settings')

View File

@@ -6,8 +6,13 @@ Item {
property alias auto_server: auto_server_cb.checked
property alias address: address_tf.text
height: rootLayout.height
ColumnLayout {
id: rootLayout
width: parent.width
spacing: constants.paddingLarge
Label {
text: qsTr('Server settings')
@@ -31,6 +36,7 @@ Item {
TextField {
id: address_tf
enabled: !auto_server_cb.checked
Layout.fillWidth: true
}
}
}