Skip to content

Commit 4b79ac2

Browse files
committed
qml: Introduce DesktopWallets page
This is a main page when the AppMode is Desktop with walletEnabled. The page contains a tab based layout with the sub pages being selectable by clicking on a NavigationTab in the NavigationBar at the top of the page.
1 parent d556c93 commit 4b79ac2

File tree

5 files changed

+234
-3
lines changed

5 files changed

+234
-3
lines changed

src/Makefile.qt.include

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ QML_RES_QML = \
371371
qml/controls/PageIndicator.qml \
372372
qml/controls/NavigationBar.qml \
373373
qml/controls/NavigationBar2.qml \
374+
qml/controls/NavigationTab.qml \
374375
qml/controls/OptionButton.qml \
375376
qml/controls/OptionSwitch.qml \
376377
qml/controls/OutlineButton.qml \
@@ -401,7 +402,8 @@ QML_RES_QML = \
401402
qml/pages/settings/SettingsDisplay.qml \
402403
qml/pages/settings/SettingsProxy.qml \
403404
qml/pages/settings/SettingsStorage.qml \
404-
qml/pages/settings/SettingsTheme.qml
405+
qml/pages/settings/SettingsTheme.qml \
406+
qml/pages/wallet/DesktopWallets.qml
405407

406408
if TARGET_ANDROID
407409
BITCOIN_QT_H += qml/androidnotifier.h

src/qml/bitcoin_qml.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<file>controls/PageIndicator.qml</file>
3232
<file>controls/NavigationBar.qml</file>
3333
<file>controls/NavigationBar2.qml</file>
34+
<file>controls/NavigationTab.qml</file>
3435
<file>controls/OptionButton.qml</file>
3536
<file>controls/OptionSwitch.qml</file>
3637
<file>controls/OutlineButton.qml</file>
@@ -62,6 +63,7 @@
6263
<file>pages/settings/SettingsProxy.qml</file>
6364
<file>pages/settings/SettingsStorage.qml</file>
6465
<file>pages/settings/SettingsTheme.qml</file>
66+
<file>pages/wallet/DesktopWallets.qml</file>
6567
</qresource>
6668
<qresource prefix="/icons">
6769
<file alias="arrow-down">res/icons/arrow-down.png</file>

src/qml/controls/NavigationTab.qml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Copyright (c) 2024 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 org.bitcoincore.qt 1.0
8+
9+
Button {
10+
property color bgActiveColor: Theme.color.orange
11+
property color textColor: Theme.color.neutral7
12+
property color textHoverColor: Theme.color.neutral9
13+
property color textActiveColor: Theme.color.orange
14+
property color iconColor: "transparent"
15+
property string iconSource: ""
16+
17+
id: root
18+
checkable: true
19+
hoverEnabled: AppMode.isDesktop
20+
implicitHeight: 60
21+
implicitWidth: 80
22+
bottomPadding: 0
23+
topPadding: 0
24+
25+
contentItem: Item {
26+
width: parent.width
27+
height: parent.height
28+
CoreText {
29+
id: buttonText
30+
font.pixelSize: 15
31+
text: root.text
32+
color: root.textColor
33+
bold: true
34+
visible: root.text !== ""
35+
anchors.centerIn: parent
36+
}
37+
Icon {
38+
id: icon
39+
source: root.iconSource
40+
color: iconColor
41+
visible: root.iconSource !== ""
42+
anchors.centerIn: parent
43+
}
44+
}
45+
46+
background: Item {
47+
Rectangle {
48+
id: bg
49+
height: parent.height - 5
50+
width: parent.width
51+
radius: 5
52+
color: Theme.color.neutral3
53+
visible: root.hovered
54+
55+
FocusBorder {
56+
visible: root.visualFocus
57+
}
58+
59+
Behavior on color {
60+
ColorAnimation { duration: 150 }
61+
}
62+
}
63+
Rectangle {
64+
anchors.bottom: parent.bottom
65+
width: parent.width
66+
height: 3
67+
visible: root.checked
68+
color: root.bgActiveColor
69+
}
70+
}
71+
72+
states: [
73+
State {
74+
name: "CHECKED"; when: root.checked
75+
PropertyChanges { target: buttonText; color: root.textActiveColor }
76+
PropertyChanges { target: icon; color: root.textActiveColor }
77+
},
78+
State {
79+
name: "HOVER"; when: root.hovered
80+
PropertyChanges { target: buttonText; color: root.textHoverColor }
81+
PropertyChanges { target: icon; color: root.textHoverColor }
82+
}
83+
]
84+
}

src/qml/pages/main.qml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import "../components"
1111
import "../controls"
1212
import "./onboarding"
1313
import "./node"
14+
import "./wallet"
1415

1516
ApplicationWindow {
1617
id: appWindow
@@ -33,7 +34,17 @@ ApplicationWindow {
3334

3435
StackView {
3536
id: main
36-
initialItem: needOnboarding ? onboardingWizard : node
37+
initialItem: {
38+
if (needOnboarding) {
39+
onboardingWizard
40+
} else {
41+
if (AppMode.walletEnabled && AppMode.isDesktop) {
42+
desktopWallets
43+
} else {
44+
node
45+
}
46+
}
47+
}
3748
anchors.fill: parent
3849
focus: true
3950
Keys.onReleased: {
@@ -66,10 +77,21 @@ ApplicationWindow {
6677
OnboardingStorageAmount {}
6778
OnboardingConnection {}
6879

69-
onFinishedChanged: main.push(node)
80+
onFinishedChanged: {
81+
if (AppMode.walletEnabled && AppMode.isDesktop) {
82+
main.push(desktopWallets)
83+
} else {
84+
main.push(node)
85+
}
86+
}
7087
}
7188
}
7289

90+
Component {
91+
id: desktopWallets
92+
DesktopWallets {}
93+
}
94+
7395
Component {
7496
id: shutdown
7597
Shutdown {}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// Copyright (c) 2024 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 org.bitcoincore.qt 1.0
9+
import "../../controls"
10+
import "../../components"
11+
import "../node"
12+
13+
Page {
14+
id: root
15+
background: null
16+
17+
ButtonGroup { id: navigationTabs }
18+
19+
header: NavigationBar2 {
20+
id: navBar
21+
leftItem: RowLayout {
22+
spacing: 5
23+
Icon {
24+
source: "image://images/singlesig-wallet"
25+
color: Theme.color.neutral8
26+
Layout.preferredWidth: 30
27+
Layout.preferredHeight: 30
28+
Layout.leftMargin: 10
29+
}
30+
Column {
31+
spacing: 2
32+
CoreText {
33+
text: "Singlesig Wallet"
34+
color: Theme.color.neutral7
35+
bold: true
36+
}
37+
CoreText {
38+
text: "<font color=\""+Theme.color.white+"\">₿</font> 0.00 <font color=\""+Theme.color.white+"\">167 599</font>"
39+
color: Theme.color.neutral7
40+
}
41+
}
42+
}
43+
centerItem: RowLayout {
44+
NavigationTab {
45+
id: activityTabButton
46+
checked: true
47+
text: qsTr("Activity")
48+
property int index: 0
49+
ButtonGroup.group: navigationTabs
50+
}
51+
NavigationTab {
52+
text: qsTr("Send")
53+
property int index: 1
54+
ButtonGroup.group: navigationTabs
55+
}
56+
NavigationTab {
57+
text: qsTr("Receive")
58+
property int index: 2
59+
ButtonGroup.group: navigationTabs
60+
}
61+
}
62+
rightItem: RowLayout {
63+
spacing: 5
64+
NetworkIndicator {
65+
textSize: 11
66+
Layout.rightMargin: 5
67+
}
68+
NavigationTab {
69+
Layout.preferredWidth: 30
70+
Layout.rightMargin: 10
71+
property int index: 3
72+
ButtonGroup.group: navigationTabs
73+
}
74+
NavigationTab {
75+
iconSource: "image://images/gear-outline"
76+
iconColor: Theme.color.neutral7
77+
Layout.preferredWidth: 30
78+
property int index: 4
79+
ButtonGroup.group: navigationTabs
80+
}
81+
}
82+
background: Rectangle {
83+
color: Theme.color.neutral4
84+
anchors.bottom: navBar.bottom
85+
anchors.bottomMargin: 4
86+
height: 1
87+
width: parent.width
88+
}
89+
}
90+
91+
StackLayout {
92+
width: parent.width
93+
height: parent.height
94+
currentIndex: navigationTabs.checkedButton.index
95+
Item {
96+
id: activityTab
97+
CoreText { text: "Activity" }
98+
}
99+
Item {
100+
id: sendTab
101+
CoreText { text: "Send" }
102+
}
103+
Item {
104+
id: receiveTab
105+
CoreText { text: "Receive" }
106+
}
107+
Item {
108+
id: blockClockTab
109+
anchors.fill: parent
110+
BlockClock {
111+
parentWidth: parent.width - 40
112+
parentHeight: parent.height
113+
anchors.centerIn: parent
114+
}
115+
}
116+
NodeSettings {
117+
}
118+
}
119+
120+
Component.onCompleted: nodeModel.startNodeInitializionThread();
121+
}

0 commit comments

Comments
 (0)