Skip to content

Commit cfa9c3e

Browse files
committed
qml: introduce proxy setting components and pages
1 parent 3bf58b2 commit cfa9c3e

File tree

4 files changed

+115
-0
lines changed

4 files changed

+115
-0
lines changed

src/Makefile.qt.include

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ QML_RES_QML = \
336336
qml/components/DeveloperOptions.qml \
337337
qml/components/PeersIndicator.qml \
338338
qml/components/NetworkIndicator.qml \
339+
qml/components/ProxySettings.qml \
339340
qml/components/Separator.qml \
340341
qml/components/StorageLocations.qml \
341342
qml/components/StorageOptions.qml \
@@ -369,6 +370,7 @@ QML_RES_QML = \
369370
qml/pages/settings/SettingsAbout.qml \
370371
qml/pages/settings/SettingsConnection.qml \
371372
qml/pages/settings/SettingsDeveloper.qml \
373+
qml/pages/settings/SettingsProxy.qml \
372374
qml/pages/settings/SettingsStorage.qml
373375

374376
BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP)

src/qml/bitcoin_qml.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<file>components/PeersIndicator.qml</file>
1010
<file>components/DeveloperOptions.qml</file>
1111
<file>components/NetworkIndicator.qml</file>
12+
<file>components/ProxySettings.qml</file>
1213
<file>components/StorageLocations.qml</file>
1314
<file>components/Separator.qml</file>
1415
<file>components/StorageOptions.qml</file>
@@ -42,6 +43,7 @@
4243
<file>pages/settings/SettingsAbout.qml</file>
4344
<file>pages/settings/SettingsConnection.qml</file>
4445
<file>pages/settings/SettingsDeveloper.qml</file>
46+
<file>pages/settings/SettingsProxy.qml</file>
4547
<file>pages/settings/SettingsStorage.qml</file>
4648
</qresource>
4749
<qresource prefix="/icons">

src/qml/components/ProxySettings.qml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Copyright (c) 2023 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
import QtQuick 2.15
6+
import QtQuick.Controls 2.15
7+
import QtQuick.Layouts 1.15
8+
import "../controls"
9+
10+
ColumnLayout {
11+
spacing: 4
12+
Header {
13+
headerBold: true
14+
center: false
15+
header: qsTr("Default Proxy")
16+
headerSize: 24
17+
description: qsTr("Run peer connections through a proxy (SOCKS5) for improved privacy. The default proxy supports connections via IPv4, IPv6 and Tor. Tor connections can also be run through a separate Tor proxy.")
18+
descriptionSize: 15
19+
Layout.bottomMargin: 10
20+
}
21+
Separator { Layout.fillWidth: true }
22+
Setting {
23+
Layout.fillWidth: true
24+
header: qsTr("Enable")
25+
actionItem: OptionSwitch {}
26+
onClicked: {
27+
loadedItem.toggle()
28+
loadedItem.toggled()
29+
}
30+
}
31+
Separator { Layout.fillWidth: true }
32+
Setting {
33+
id: defaultProxy
34+
Layout.fillWidth: true
35+
header: qsTr("IP and Port")
36+
actionItem: ValueInput {
37+
parentState: defaultProxy.state
38+
description: "127.0.0.1:9050"
39+
onEditingFinished: {
40+
defaultProxy.forceActiveFocus()
41+
}
42+
}
43+
onClicked: loadedItem.forceActiveFocus()
44+
}
45+
Separator { Layout.fillWidth: true }
46+
Header {
47+
headerBold: true
48+
center: false
49+
header: qsTr("Tor Proxy")
50+
headerSize: 24
51+
description: qsTr("Enable to run Tor connections through a dedicated proxy.")
52+
descriptionSize: 15
53+
Layout.topMargin: 35
54+
Layout.bottomMargin: 10
55+
}
56+
Separator { Layout.fillWidth: true }
57+
Setting {
58+
Layout.fillWidth: true
59+
header: qsTr("Enable")
60+
actionItem: OptionSwitch {}
61+
description: qsTr("When disabled, Tor connections will use the default proxy (if enabled).")
62+
onClicked: {
63+
loadedItem.toggle()
64+
loadedItem.toggled()
65+
}
66+
}
67+
Separator { Layout.fillWidth: true }
68+
Setting {
69+
id: torProxy
70+
Layout.fillWidth: true
71+
header: qsTr("IP and Port")
72+
actionItem: ValueInput {
73+
parentState: torProxy.state
74+
description: "127.0.0.1:9050"
75+
onEditingFinished: {
76+
torProxy.forceActiveFocus()
77+
}
78+
}
79+
onClicked: loadedItem.forceActiveFocus()
80+
}
81+
Separator { Layout.fillWidth: true }
82+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) 2023 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
import QtQuick 2.15
6+
import QtQuick.Controls 2.15
7+
import QtQuick.Layouts 1.15
8+
import "../../controls"
9+
import "../../components"
10+
11+
Page {
12+
id: proxy_settings
13+
property alias navLeftDetail: navbar.leftDetail
14+
property alias navMiddleDetail: navbar.middleDetail
15+
16+
background: null
17+
implicitWidth: 450
18+
leftPadding: 20
19+
rightPadding: 20
20+
topPadding: 30
21+
22+
header: NavigationBar {
23+
id: navbar
24+
}
25+
ProxySettings {
26+
width: Math.min(parent.width, 450)
27+
anchors.horizontalCenter: parent.horizontalCenter
28+
}
29+
}

0 commit comments

Comments
 (0)