Skip to content

Commit 3625f4b

Browse files
jarolrodJohnny Carlson
authored andcommitted
qml: use node specific pages, introduce node settings
Github-Pull: #203 Rebased-From: 6037471 Co-Authored-By: Johnny Carlson <johncarlson@pm.me>
1 parent 6376005 commit 3625f4b

File tree

4 files changed

+183
-20
lines changed

4 files changed

+183
-20
lines changed

src/qml/BitcoinApp/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ qt6_add_qml_module(bitcoin_qml
1616
QML_FILES
1717
initerrormessage.qml
1818
main.qml
19+
NodeRunner.qml
20+
NodeSettings.qml
1921
OnboardingBlockclock.qml
2022
OnboardingConnection.qml
2123
OnboardingCover.qml

src/qml/BitcoinApp/NodeRunner.qml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) 2022 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
6+
import QtQuick.Controls
7+
import QtQuick.Layouts
8+
import BitcoinApp.Controls
9+
import BitcoinApp.Components
10+
11+
Page {
12+
background: null
13+
clip: true
14+
property alias navRightDetail: navbar.rightDetail
15+
header: NavigationBar {
16+
id: navbar
17+
}
18+
ColumnLayout {
19+
spacing: 0
20+
anchors.fill: parent
21+
ColumnLayout {
22+
width: 600
23+
spacing: 0
24+
anchors.centerIn: parent
25+
Component.onCompleted: nodeModel.startNodeInitializionThread();
26+
Image {
27+
Layout.alignment: Qt.AlignCenter
28+
source: "image://images/app"
29+
sourceSize.width: 64
30+
sourceSize.height: 64
31+
}
32+
BlockCounter {
33+
Layout.alignment: Qt.AlignCenter
34+
blockHeight: nodeModel.blockTipHeight
35+
}
36+
ProgressIndicator {
37+
width: 200
38+
Layout.alignment: Qt.AlignCenter
39+
progress: nodeModel.verificationProgress
40+
}
41+
}
42+
}
43+
}

src/qml/BitcoinApp/NodeSettings.qml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// Copyright (c) 2022 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
6+
import QtQuick.Controls
7+
import QtQuick.Layouts
8+
import BitcoinApp.Controls
9+
import BitcoinApp.Components
10+
11+
Item {
12+
id: nodeSettings
13+
property alias navMiddleDetail: nodeSettingsView.navMiddleDetail
14+
property alias navRightDetail: nodeSettingsView.navRightDetail
15+
StackView {
16+
id: nodeSettingsView
17+
property alias navMiddleDetail: node_settings.navMiddleDetail
18+
property alias navRightDetail: node_settings.navRightDetail
19+
initialItem: Page {
20+
id: node_settings
21+
property alias navMiddleDetail: navbar.middleDetail
22+
property alias navRightDetail: navbar.rightDetail
23+
background: null
24+
header: NavigationBar {
25+
id: navbar
26+
}
27+
ColumnLayout {
28+
spacing: 0
29+
width: parent.width
30+
ColumnLayout {
31+
spacing: 20
32+
Layout.maximumWidth: 450
33+
Layout.topMargin: 30
34+
Layout.leftMargin: 20
35+
Layout.rightMargin: 20
36+
Layout.alignment: Qt.AlignCenter
37+
Setting {
38+
Layout.fillWidth: true
39+
header: qsTr("Dark Mode")
40+
actionItem: OptionSwitch {
41+
checked: Theme.dark
42+
onToggled: Theme.toggleDark()
43+
}
44+
}
45+
Setting {
46+
Layout.fillWidth: true
47+
header: qsTr("About")
48+
actionItem: NavButton {
49+
iconSource: "image://images/caret-right"
50+
background: null
51+
onClicked: {
52+
nodeSettingsView.push(about_page)
53+
}
54+
}
55+
}
56+
Setting {
57+
Layout.fillWidth: true
58+
header: qsTr("Storage")
59+
actionItem: NavButton {
60+
iconSource: "image://images/caret-right"
61+
background: null
62+
onClicked: {
63+
nodeSettingsView.push(storage_page)
64+
}
65+
}
66+
}
67+
Setting {
68+
Layout.fillWidth: true
69+
header: qsTr("Connection")
70+
actionItem: NavButton {
71+
iconSource: "image://images/caret-right"
72+
background: null
73+
onClicked: {
74+
nodeSettingsView.push(connection_page)
75+
}
76+
}
77+
}
78+
}
79+
}
80+
}
81+
anchors.fill: parent
82+
}
83+
Component {
84+
id: about_page
85+
SettingsAbout {
86+
navLeftDetail: NavButton {
87+
iconSource: "image://images/caret-left"
88+
text: qsTr("Back")
89+
onClicked: {
90+
nodeSettingsView.pop()
91+
}
92+
}
93+
}
94+
}
95+
Component {
96+
id: storage_page
97+
SettingsStorage {
98+
navLeftDetail: NavButton {
99+
iconSource: "image://images/caret-left"
100+
text: qsTr("Back")
101+
onClicked: {
102+
nodeSettingsView.pop()
103+
}
104+
}
105+
}
106+
}
107+
Component {
108+
id: connection_page
109+
SettingsConnection {
110+
navLeftDetail: NavButton {
111+
iconSource: "image://images/caret-left"
112+
text: qsTr("Back")
113+
onClicked: {
114+
nodeSettingsView.pop()
115+
}
116+
}
117+
}
118+
}
119+
}

src/qml/BitcoinApp/main.qml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,29 @@ ApplicationWindow {
4343

4444
Component {
4545
id: node
46-
Page {
46+
SwipeView {
47+
id: node_swipe
4748
anchors.fill: parent
48-
background: null
49-
ColumnLayout {
50-
width: 600
51-
spacing: 0
52-
anchors.centerIn: parent
53-
Component.onCompleted: nodeModel.startNodeInitializionThread();
54-
Image {
55-
Layout.alignment: Qt.AlignCenter
56-
source: "image://images/app"
57-
sourceSize.width: 64
58-
sourceSize.height: 64
49+
interactive: false
50+
orientation: Qt.Vertical
51+
NodeRunner {
52+
navRightDetail: NavButton {
53+
iconSource: "image://images/gear"
54+
iconHeight: 24
55+
onClicked: node_swipe.incrementCurrentIndex()
5956
}
60-
BlockCounter {
61-
Layout.alignment: Qt.AlignCenter
62-
blockHeight: nodeModel.blockTipHeight
57+
}
58+
NodeSettings {
59+
navMiddleDetail: Header {
60+
bold: true
61+
headerSize: 18
62+
header: "Settings"
6363
}
64-
ProgressIndicator {
65-
width: 200
66-
Layout.alignment: Qt.AlignCenter
67-
progress: nodeModel.verificationProgress
64+
navRightDetail: NavButton {
65+
text: qsTr("Done")
66+
onClicked: node_swipe.decrementCurrentIndex()
6867
}
6968
}
70-
}
69+
}
7170
}
7271
}

0 commit comments

Comments
 (0)