Skip to content

Commit 032971d

Browse files
committed
qml: Introduce AddWalletButton
1 parent e7bea2d commit 032971d

File tree

4 files changed

+82
-22
lines changed

4 files changed

+82
-22
lines changed

src/Makefile.qt.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ QML_RES_QML = \
374374
qml/components/ThemeSettings.qml \
375375
qml/components/TotalBytesIndicator.qml \
376376
qml/components/Tooltip.qml \
377+
qml/controls/AddWalletButton.qml \
377378
qml/controls/CaretRightIcon.qml \
378379
qml/controls/ContinueButton.qml \
379380
qml/controls/CoreText.qml \

src/qml/bitcoin_qml.qrc

Lines changed: 1 addition & 0 deletions
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

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
property color iconColor: "transparent"
19+
property string iconSource: ""
20+
property bool showBalance: true
21+
property bool showIcon: true
22+
23+
hoverEnabled: AppMode.isDesktop
24+
implicitHeight: 46
25+
implicitWidth: 220
26+
bottomPadding: 10
27+
topPadding: 0
28+
29+
contentItem: RowLayout {
30+
implicitWidth: addIcon.size + addText.width
31+
implicitHeight: 45
32+
Icon {
33+
id: addIcon
34+
Layout.alignment: Qt.AlignHCenter
35+
source: "image://images/plus"
36+
color: Theme.color.neutral8
37+
size: 14
38+
topPadding: 5
39+
bottomPadding: 10
40+
}
41+
CoreText {
42+
id: addText
43+
Layout.alignment: Qt.AlignHCenter
44+
text: qsTr("Add Wallet")
45+
color: Theme.color.neutral9
46+
font.pixelSize: 15
47+
topPadding: 5
48+
bottomPadding: 10
49+
}
50+
}
51+
52+
background: Rectangle {
53+
id: bg
54+
height: 30
55+
width: 220
56+
radius: 5
57+
anchors.topMargin: 5
58+
anchors.bottomMargin: 10
59+
color: Theme.color.neutral3
60+
visible: root.hovered || root.checked
61+
62+
FocusBorder {
63+
visible: root.visualFocus
64+
}
65+
66+
Behavior on color {
67+
ColorAnimation { duration: 150 }
68+
}
69+
}
70+
71+
states: [
72+
State {
73+
name: "CHECKED"; when: root.checked
74+
},
75+
State {
76+
name: "HOVER"; when: root.hovered
77+
}
78+
]
79+
}

src/qml/pages/wallet/WalletSelect.qml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -87,29 +87,8 @@ Popup {
8787
}
8888
}
8989

90-
RowLayout {
90+
AddWalletButton {
9191
id: addWallet
92-
Layout.preferredWidth: addIcon.size + addText.width
93-
Layout.preferredHeight: 45
94-
Layout.alignment: Qt.AlignHCenter
95-
Icon {
96-
id: addIcon
97-
Layout.alignment: Qt.AlignHCenter
98-
source: "image://images/plus"
99-
color: Theme.color.neutral8
100-
size: 14
101-
topPadding: 5
102-
bottomPadding: 10
103-
}
104-
CoreText {
105-
id: addText
106-
Layout.alignment: Qt.AlignHCenter
107-
text: qsTr("Add Wallet")
108-
color: Theme.color.neutral9
109-
font.pixelSize: 15
110-
topPadding: 5
111-
bottomPadding: 10
112-
}
11392
}
11493
}
11594
}

0 commit comments

Comments
 (0)