16
16
background: null
17
17
18
18
property int requestCounter: 0
19
+ property WalletQmlModel wallet: walletController .selectedWallet
20
+ property PaymentRequest request: wallet .currentPaymentRequest
19
21
20
22
ScrollView {
21
23
clip: true
@@ -49,74 +51,11 @@ Page {
49
51
50
52
spacing: 5
51
53
52
- Item {
53
- BitcoinAmount {
54
- id: bitcoinAmount
55
- }
56
-
57
- height: amountInput .height
54
+ BitcoinAmountInputField {
58
55
Layout .fillWidth : true
59
- CoreText {
60
- id: amountLabel
61
- width: 110
62
- anchors .left : parent .left
63
- anchors .verticalCenter : parent .verticalCenter
64
- horizontalAlignment: Text .AlignLeft
65
- text: " Amount"
66
- font .pixelSize : 18
67
- }
68
-
69
- TextField {
70
- id: amountInput
71
- anchors .left : amountLabel .right
72
- anchors .verticalCenter : parent .verticalCenter
73
- leftPadding: 0
74
- font .family : " Inter"
75
- font .styleName : " Regular"
76
- font .pixelSize : 18
77
- color: Theme .color .neutral9
78
- placeholderTextColor: enabled ? Theme .color .neutral7 : Theme .color .neutral4
79
- background: Item {}
80
- placeholderText: " 0.00000000"
81
- selectByMouse: true
82
- onTextEdited: {
83
- amountInput .text = bitcoinAmount .sanitize (amountInput .text )
84
- }
85
- }
86
- Item {
87
- width: unitLabel .width + flipIcon .width
88
- height: Math .max (unitLabel .height , flipIcon .height )
89
- anchors .right : parent .right
90
- anchors .verticalCenter : parent .verticalCenter
91
- MouseArea {
92
- anchors .fill : parent
93
- onClicked: {
94
- if (bitcoinAmount .unit == BitcoinAmount .BTC ) {
95
- amountInput .text = bitcoinAmount .convert (amountInput .text , BitcoinAmount .BTC )
96
- bitcoinAmount .unit = BitcoinAmount .SAT
97
- } else {
98
- amountInput .text = bitcoinAmount .convert (amountInput .text , BitcoinAmount .SAT )
99
- bitcoinAmount .unit = BitcoinAmount .BTC
100
- }
101
- }
102
- }
103
- CoreText {
104
- id: unitLabel
105
- anchors .right : flipIcon .left
106
- anchors .verticalCenter : parent .verticalCenter
107
- text: bitcoinAmount .unitLabel
108
- font .pixelSize : 18
109
- color: enabled ? Theme .color .neutral7 : Theme .color .neutral4
110
- }
111
- Icon {
112
- id: flipIcon
113
- anchors .right : parent .right
114
- anchors .verticalCenter : parent .verticalCenter
115
- source: " image://images/flip-vertical"
116
- color: unitLabel .enabled ? Theme .color .neutral8 : Theme .color .neutral4
117
- size: 30
118
- }
119
- }
56
+ enabled: walletController .initialized
57
+ amount: root .request .amount
58
+ errorText: root .request .amountError
120
59
}
121
60
122
61
Separator {
@@ -147,7 +86,7 @@ Page {
147
86
148
87
Item {
149
88
Layout .fillWidth : true
150
- Layout .minimumHeight : addressLabel .height + copyLabel .height
89
+ Layout .minimumHeight : addressLabel .height + copyLabel .height + 20
151
90
Layout .topMargin : 10
152
91
height: addressLabel .height + copyLabel .height
153
92
CoreText {
@@ -179,11 +118,12 @@ Page {
179
118
radius: 5
180
119
CoreText {
181
120
id: address
121
+ text: root .request .address
182
122
anchors .fill : parent
183
123
anchors .leftMargin : 5
184
124
horizontalAlignment: Text .AlignLeft
185
125
font .pixelSize : 18
186
- wrap : true
126
+ wrapMode : Text . WrapAnywhere
187
127
}
188
128
}
189
129
}
@@ -197,9 +137,8 @@ Page {
197
137
if (! clearRequest .visible ) {
198
138
requestCounter = requestCounter + 1
199
139
clearRequest .visible = true
140
+ wallet .commitPaymentRequest ()
200
141
title .text = qsTr (" Payment request #" + requestCounter)
201
- address .text = " bc1q f5xe y2tf 89k9 zy6k gnru wszy 5fsa truy 9te1 bu"
202
- qrImage .code = " bc1qf5xey2tf89k9zy6kgnruwszy5fsatruy9te1bu"
203
142
continueButton .text = qsTr (" Copy payment request" )
204
143
}
205
144
}
@@ -220,8 +159,7 @@ Page {
220
159
onClicked: {
221
160
clearRequest .visible = false
222
161
title .text = qsTr (" Request a payment" )
223
- address .text = " "
224
- qrImage .code = " "
162
+ root .request .clear ()
225
163
continueButton .text = qsTr (" Create bitcoin address" )
226
164
}
227
165
}
@@ -240,6 +178,7 @@ Page {
240
178
id: qrImage
241
179
backgroundColor: " transparent"
242
180
foregroundColor: Theme .color .neutral9
181
+ code: root .request .address
243
182
}
244
183
}
245
184
}
0 commit comments