Skip to content

Commit adff8f2

Browse files
committed
qml: Introduce RequestConfirmation page
This page contains the details of a payment request. It is pushed onto the RequestPayment page's stack after the user has clicke don Continue.
1 parent 9fb3663 commit adff8f2

File tree

4 files changed

+176
-0
lines changed

4 files changed

+176
-0
lines changed

src/Makefile.qt.include

+1
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ QML_RES_QML = \
444444
qml/pages/wallet/CreatePassword.qml \
445445
qml/pages/wallet/CreateWalletWizard.qml \
446446
qml/pages/wallet/DesktopWallets.qml \
447+
qml/pages/wallet/RequestConfirmation.qml \
447448
qml/pages/wallet/RequestPayment.qml \
448449
qml/pages/wallet/WalletBadge.qml \
449450
qml/pages/wallet/WalletSelect.qml

src/qml/bitcoin_qml.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
<file>pages/wallet/CreatePassword.qml</file>
7979
<file>pages/wallet/CreateWalletWizard.qml</file>
8080
<file>pages/wallet/DesktopWallets.qml</file>
81+
<file>pages/wallet/RequestConfirmation.qml</file>
8182
<file>pages/wallet/RequestPayment.qml</file>
8283
<file>pages/wallet/WalletBadge.qml</file>
8384
<file>pages/wallet/WalletSelect.qml</file>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
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+
10+
import "../../controls"
11+
import "../../components"
12+
import "../settings"
13+
14+
Page {
15+
id: root
16+
background: null
17+
property string label: "alice"
18+
property string message: "payment for goods"
19+
property string amount: "0.000"
20+
21+
header: NavigationBar2 {
22+
id: navbar
23+
leftItem: NavButton {
24+
iconSource: "image://images/caret-left"
25+
text: qsTr("Back")
26+
onClicked: {
27+
root.StackView.view.pop()
28+
}
29+
}
30+
centerItem: Item {
31+
id: header
32+
Layout.fillWidth: true
33+
34+
CoreText {
35+
anchors.left: parent.left
36+
text: qsTr("Payment request")
37+
font.pixelSize: 21
38+
bold: true
39+
}
40+
}
41+
}
42+
43+
ScrollView {
44+
clip: true
45+
width: parent.width
46+
height: parent.height
47+
contentWidth: width
48+
49+
ColumnLayout {
50+
id: columnLayout
51+
anchors.horizontalCenter: parent.horizontalCenter
52+
width: Math.min(parent.width, 450)
53+
spacing: 30
54+
55+
Image {
56+
width: 60
57+
height: 60
58+
Layout.alignment: Qt.AlignHCenter
59+
source: "image://images/pending"
60+
sourceSize.width: 60
61+
sourceSize.height: 60
62+
}
63+
64+
CoreText {
65+
Layout.alignment: Qt.AlignHCenter
66+
text: qsTr("Created just now")
67+
color: Theme.color.neutral7
68+
font.pixelSize: 18
69+
}
70+
71+
LabeledTextInput {
72+
id: labelInput
73+
Layout.fillWidth: true
74+
labelText: qsTr("Label")
75+
visible: label != ""
76+
enabled: false
77+
text: label
78+
}
79+
80+
Item {
81+
BitcoinAmount {
82+
id: bitcoinAmount
83+
}
84+
85+
height: 50
86+
Layout.fillWidth: true
87+
visible: amount != ""
88+
CoreText {
89+
anchors.left: parent.left
90+
anchors.top: parent.top
91+
color: Theme.color.neutral7
92+
text: qsTr("Amount")
93+
font.pixelSize: 15
94+
}
95+
96+
TextField {
97+
id: bitcoinAmountText
98+
anchors.left: parent.left
99+
anchors.bottom: parent.bottom
100+
leftPadding: 0
101+
font.family: "Inter"
102+
font.styleName: "Regular"
103+
font.pixelSize: 18
104+
color: Theme.color.neutral9
105+
placeholderTextColor: Theme.color.neutral7
106+
background: Item {}
107+
placeholderText: "0.00000000"
108+
text: request.amount
109+
enabled: false
110+
onTextChanged: {
111+
bitcoinAmountText.text = bitcoinAmount.sanitize(bitcoinAmountText.text)
112+
}
113+
}
114+
}
115+
116+
117+
LabeledTextInput {
118+
id: messageInput
119+
Layout.fillWidth: true
120+
labelText: qsTr("Message")
121+
visible: message != ""
122+
enabled: false
123+
text: message
124+
}
125+
126+
Item {
127+
height: addressLabel.height + addressText.height
128+
Layout.fillWidth: true
129+
CoreText {
130+
id: addressLabel
131+
anchors.left: parent.left
132+
anchors.top: parent.top
133+
color: Theme.color.neutral7
134+
text: qsTr("Address")
135+
font.pixelSize: 15
136+
}
137+
138+
CoreText {
139+
id: addressText
140+
anchors.left: parent.left
141+
anchors.right: copyIcon.left
142+
anchors.top: addressLabel.bottom
143+
leftPadding: 0
144+
font.family: "Inter"
145+
font.styleName: "Regular"
146+
font.pixelSize: 18
147+
horizontalAlignment: Text.AlignLeft
148+
color: Theme.color.neutral9
149+
text: "bc1q wvlv mha3 cvhy q6qz tjzu mq2d 63ff htzy xxu6 q8"
150+
}
151+
152+
Icon {
153+
id: copyIcon
154+
anchors.right: parent.right
155+
anchors.verticalCenter: addressText.verticalCenter
156+
source: "image://images/copy"
157+
color: Theme.color.neutral8
158+
size: 30
159+
enabled: true
160+
onClicked: {
161+
Clipboard.setText(addressText.text)
162+
}
163+
}
164+
}
165+
}
166+
}
167+
}

src/qml/pages/wallet/RequestPayment.qml

+7
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,16 @@ PageStack {
143143
Layout.rightMargin: 20
144144
Layout.alignment: Qt.AlignCenter
145145
text: qsTr("Continue")
146+
onClicked: stackView.push(confirmationComponent)
146147
}
147148
}
148149
}
149150
}
150151
}
152+
153+
Component {
154+
id: confirmationComponent
155+
RequestConfirmation {
156+
}
157+
}
151158
}

0 commit comments

Comments
 (0)