Skip to content

Commit 8a1526f

Browse files
committed
Merge bitcoin-core#418: Introduce AddWalletButton and connect it to the AddWallet flow
2d2be8c qml: Start AddWallet flow when AddWalletButton is clicked (johnny9) b2c1a15 qml: Introduce AddWalletButton (johnny9) Pull request description: These commits enable the "Add Wallet" button at the bottom of the Wallet Select menu on Desktop <!-- Link to github actions build artifacts. [![Build Artifacts](https://img.shields.io/badge/Build%20Artifacts-green )]() --> ACKs for top commit: hebasto: ACK 2d2be8c, tested on Ubuntu 24.10. Tree-SHA512: 9e04760443f94ffdc3675ed3232b79549f4de1d63db5457879d80eeced79e981887c822754f529f4314080b2f01d07f1d32de31befd04a8c64d3d1db504c5900
2 parents 100eedf + 2d2be8c commit 8a1526f

File tree

6 files changed

+107
-23
lines changed

6 files changed

+107
-23
lines changed

src/Makefile.qt.include

+1
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ QML_RES_QML = \
388388
qml/components/ThemeSettings.qml \
389389
qml/components/TotalBytesIndicator.qml \
390390
qml/components/Tooltip.qml \
391+
qml/controls/AddWalletButton.qml \
391392
qml/controls/CaretRightIcon.qml \
392393
qml/controls/ContinueButton.qml \
393394
qml/controls/CoreText.qml \

src/qml/bitcoin_qml.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<file>components/ThemeSettings.qml</file>
2121
<file>components/TotalBytesIndicator.qml</file>
2222
<file>components/Tooltip.qml</file>
23+
<file>controls/AddWalletButton.qml</file>
2324
<file>controls/ContinueButton.qml</file>
2425
<file>controls/CoreText.qml</file>
2526
<file>controls/CoreTextField.qml</file>

src/qml/controls/AddWalletButton.qml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
9+
import org.bitcoincore.qt 1.0
10+
11+
Button {
12+
id: root
13+
14+
property color bgActiveColor: Theme.color.neutral2
15+
property color textColor: Theme.color.neutral7
16+
property color textHoverColor: Theme.color.orange
17+
property color textActiveColor: Theme.color.orange
18+
19+
hoverEnabled: AppMode.isDesktop
20+
implicitHeight: 30
21+
implicitWidth: 220
22+
23+
MouseArea {
24+
anchors.fill: parent
25+
enabled: false
26+
hoverEnabled: true
27+
cursorShape: Qt.PointingHandCursor
28+
}
29+
30+
contentItem: Item {
31+
anchors.fill: parent
32+
RowLayout {
33+
anchors.centerIn: parent
34+
spacing: 3
35+
Icon {
36+
id: addIcon
37+
Layout.alignment: Qt.AlignRight
38+
source: "image://images/plus"
39+
color: Theme.color.neutral7
40+
size: 16
41+
Layout.minimumWidth: 16
42+
Layout.preferredWidth: 16
43+
Layout.maximumWidth: 16
44+
}
45+
CoreText {
46+
id: addText
47+
Layout.fillHeight: true
48+
Layout.alignment: Qt.AlignLeft
49+
text: qsTr("Add Wallet")
50+
color: Theme.color.neutral7
51+
font.pixelSize: 15
52+
}
53+
}
54+
}
55+
56+
background: Rectangle {
57+
id: bg
58+
height: 30
59+
width: 220
60+
radius: 5
61+
color: Theme.color.neutral3
62+
visible: root.hovered || root.checked
63+
64+
FocusBorder {
65+
visible: root.visualFocus
66+
}
67+
68+
Behavior on color {
69+
ColorAnimation { duration: 150 }
70+
}
71+
}
72+
73+
states: [
74+
State {
75+
name: "CHECKED"; when: root.checked
76+
},
77+
State {
78+
name: "HOVER"; when: root.hovered
79+
PropertyChanges { target: addText; color: textHoverColor }
80+
PropertyChanges { target: addIcon; color: textHoverColor }
81+
}
82+
]
83+
}

src/qml/pages/main.qml

+6-2
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,17 @@ ApplicationWindow {
8080

8181
Component {
8282
id: desktopWallets
83-
DesktopWallets {}
83+
DesktopWallets {
84+
onAddWallet: {
85+
main.push(createWalletWizard)
86+
}
87+
}
8488
}
8589

8690
Component {
8791
id: createWalletWizard
8892
CreateWalletWizard {
89-
onFinished: {
93+
onFinished: {
9094
main.pop()
9195
}
9296
}

src/qml/pages/wallet/DesktopWallets.qml

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Page {
1919

2020
ButtonGroup { id: navigationTabs }
2121

22+
signal addWallet()
23+
2224
header: NavigationBar2 {
2325
id: navBar
2426
leftItem: WalletBadge {
@@ -41,6 +43,10 @@ Page {
4143
closePolicy: Popup.CloseOnPressOutside
4244
x: 0
4345
y: parent.height
46+
47+
onAddWallet: {
48+
root.addWallet()
49+
}
4450
}
4551
}
4652
centerItem: RowLayout {

src/qml/pages/wallet/WalletSelect.qml

+10-21
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ Popup {
1212
id: root
1313

1414
property alias model: listView.model
15-
implicitHeight: layout.height + arrow.height
15+
implicitHeight: layout.height + arrow.height + 11
1616
implicitWidth: 250
1717
clip: true
1818

19+
signal addWallet()
20+
1921
background: Item {
2022
anchors.fill: parent
2123
Rectangle {
@@ -89,28 +91,15 @@ Popup {
8991
}
9092
}
9193

92-
RowLayout {
94+
AddWalletButton {
9395
id: addWallet
94-
Layout.preferredWidth: addIcon.size + addText.width
95-
Layout.preferredHeight: 45
96+
9697
Layout.alignment: Qt.AlignHCenter
97-
Icon {
98-
id: addIcon
99-
Layout.alignment: Qt.AlignHCenter
100-
source: "image://images/plus"
101-
color: Theme.color.neutral8
102-
size: 14
103-
topPadding: 5
104-
bottomPadding: 10
105-
}
106-
CoreText {
107-
id: addText
108-
Layout.alignment: Qt.AlignHCenter
109-
text: qsTr("Add Wallet")
110-
color: Theme.color.neutral9
111-
font.pixelSize: 15
112-
topPadding: 5
113-
bottomPadding: 10
98+
Layout.preferredWidth: 220
99+
Layout.preferredHeight: 30
100+
onClicked: {
101+
root.addWallet()
102+
root.close()
114103
}
115104
}
116105
}

0 commit comments

Comments
 (0)