Skip to content

Commit 06235ca

Browse files
jarolrodJohnny Carlson
and
Johnny Carlson
committed
qml: use node specific pages, introduce node settings
Co-Authored-By: Johnny Carlson <[email protected]>
1 parent 725f6db commit 06235ca

File tree

5 files changed

+187
-20
lines changed

5 files changed

+187
-20
lines changed

src/Makefile.qt.include

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,8 @@ QML_RES_QML = \
343343
qml/controls/ValueInput.qml \
344344
qml/pages/initerrormessage.qml \
345345
qml/pages/main.qml \
346+
qml/pages/node/NodeRunner.qml \
347+
qml/pages/node/NodeSettings.qml \
346348
qml/pages/onboarding/OnboardingBlockclock.qml \
347349
qml/pages/onboarding/OnboardingConnection.qml \
348350
qml/pages/onboarding/OnboardingCover.qml \

src/qml/bitcoin_qml.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
<file>controls/ValueInput.qml</file>
2727
<file>pages/initerrormessage.qml</file>
2828
<file>pages/main.qml</file>
29+
<file>pages/node/NodeRunner.qml</file>
30+
<file>pages/node/NodeSettings.qml</file>
2931
<file>pages/onboarding/OnboardingBlockclock.qml</file>
3032
<file>pages/onboarding/OnboardingConnection.qml</file>
3133
<file>pages/onboarding/OnboardingCover.qml</file>

src/qml/pages/main.qml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import QtQuick.Layouts 1.15
88
import "../components"
99
import "../controls"
1010
import "./onboarding"
11+
import "./node"
1112

1213
ApplicationWindow {
1314
id: appWindow
@@ -44,30 +45,29 @@ ApplicationWindow {
4445

4546
Component {
4647
id: node
47-
Page {
48+
SwipeView {
49+
id: node_swipe
4850
anchors.fill: parent
49-
background: null
50-
ColumnLayout {
51-
width: 600
52-
spacing: 0
53-
anchors.centerIn: parent
54-
Component.onCompleted: nodeModel.startNodeInitializionThread();
55-
Image {
56-
Layout.alignment: Qt.AlignCenter
57-
source: "image://images/app"
58-
sourceSize.width: 64
59-
sourceSize.height: 64
51+
interactive: false
52+
orientation: Qt.Vertical
53+
NodeRunner {
54+
navRightDetail: NavButton {
55+
iconSource: "image://images/gear"
56+
iconHeight: 24
57+
onClicked: node_swipe.incrementCurrentIndex()
6058
}
61-
BlockCounter {
62-
Layout.alignment: Qt.AlignCenter
63-
blockHeight: nodeModel.blockTipHeight
59+
}
60+
NodeSettings {
61+
navMiddleDetail: Header {
62+
bold: true
63+
headerSize: 18
64+
header: "Settings"
6465
}
65-
ProgressIndicator {
66-
width: 200
67-
Layout.alignment: Qt.AlignCenter
68-
progress: nodeModel.verificationProgress
66+
navRightDetail: NavButton {
67+
text: qsTr("Done")
68+
onClicked: node_swipe.decrementCurrentIndex()
6969
}
7070
}
71-
}
71+
}
7272
}
7373
}

src/qml/pages/node/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 2.15
6+
import QtQuick.Controls 2.15
7+
import QtQuick.Layouts 1.15
8+
import "../../controls"
9+
import "../../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/pages/node/NodeSettings.qml

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

0 commit comments

Comments
 (0)