Skip to content

Commit d512d17

Browse files
committed
qml: Cleanup Receive layouts
1 parent 84fbd2f commit d512d17

File tree

1 file changed

+131
-132
lines changed

1 file changed

+131
-132
lines changed

src/qml/pages/wallet/RequestPayment.qml

Lines changed: 131 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -15,167 +15,166 @@ Page {
1515
id: root
1616
background: null
1717

18-
property int requestCounter: 0
1918
property WalletQmlModel wallet: walletController.selectedWallet
2019
property PaymentRequest request: wallet.currentPaymentRequest
2120

2221
ScrollView {
2322
clip: true
24-
width: parent.width
25-
height: parent.height
23+
anchors.fill: parent
2624
contentWidth: width
2725

28-
CoreText {
29-
id: title
30-
anchors.left: contentRow.left
26+
ColumnLayout {
27+
id: scrollContent
28+
anchors.horizontalCenter: parent.horizontalCenter
3129
anchors.top: parent.top
3230
anchors.topMargin: 20
33-
text: qsTr("Request a payment")
34-
font.pixelSize: 21
35-
bold: true
36-
}
31+
spacing: 20
32+
33+
CoreText {
34+
id: title
35+
Layout.alignment: Qt.AlignLeft
36+
text: root.request.id === ""
37+
? qsTr("Request a payment")
38+
: qsTr("Payment request #") + root.request.id
39+
font.pixelSize: 21
40+
bold: true
41+
}
3742

38-
RowLayout {
39-
id: contentRow
43+
RowLayout {
44+
id: contentRow
45+
Layout.fillWidth: true
46+
enabled: walletController.initialized
47+
spacing: 30
4048

41-
enabled: walletController.initialized
49+
ColumnLayout {
50+
id: formColumn
51+
Layout.minimumWidth: 450
52+
Layout.maximumWidth: 450
4253

43-
anchors.top: title.bottom
44-
anchors.topMargin: 40
45-
anchors.horizontalCenter: parent.horizontalCenter
46-
spacing: 30
47-
ColumnLayout {
48-
id: columnLayout
49-
Layout.minimumWidth: 450
50-
Layout.maximumWidth: 470
51-
52-
spacing: 5
53-
54-
BitcoinAmountInputField {
55-
Layout.fillWidth: true
56-
enabled: walletController.initialized
57-
amount: root.request.amount
58-
errorText: root.request.amountError
59-
}
60-
61-
Separator {
62-
Layout.fillWidth: true
63-
}
54+
spacing: 10
6455

65-
LabeledTextInput {
66-
id: label
67-
Layout.fillWidth: true
68-
labelText: qsTr("Label")
69-
placeholderText: qsTr("Enter label...")
70-
}
56+
BitcoinAmountInputField {
57+
Layout.fillWidth: true
58+
enabled: walletController.initialized
59+
amount: root.request.amount
60+
errorText: root.request.amountError
61+
}
7162

72-
Separator {
73-
Layout.fillWidth: true
74-
}
63+
Separator {
64+
Layout.fillWidth: true
65+
}
7566

76-
LabeledTextInput {
77-
id: message
78-
Layout.fillWidth: true
79-
labelText: qsTr("Message")
80-
placeholderText: qsTr("Enter message...")
81-
}
67+
LabeledTextInput {
68+
id: label
69+
Layout.fillWidth: true
70+
labelText: qsTr("Label")
71+
placeholderText: qsTr("Enter label...")
72+
}
8273

83-
Separator {
84-
Layout.fillWidth: true
85-
}
74+
Separator {
75+
Layout.fillWidth: true
76+
}
8677

87-
Item {
88-
Layout.fillWidth: true
89-
Layout.minimumHeight: addressLabel.height + copyLabel.height + 20
90-
Layout.topMargin: 10
91-
height: addressLabel.height + copyLabel.height
92-
CoreText {
93-
id: addressLabel
94-
anchors.left: parent.left
95-
anchors.top: parent.top
96-
horizontalAlignment: Text.AlignLeft
97-
width: 110
98-
text: qsTr("Address")
99-
font.pixelSize: 18
78+
LabeledTextInput {
79+
id: message
80+
Layout.fillWidth: true
81+
labelText: qsTr("Message")
82+
placeholderText: qsTr("Enter message...")
10083
}
101-
CoreText {
102-
id: copyLabel
103-
anchors.left: parent.left
104-
anchors.top: addressLabel.bottom
105-
horizontalAlignment: Text.AlignLeft
106-
width: 110
107-
text: qsTr("copy")
108-
font.pixelSize: 18
109-
color: enabled ? Theme.color.neutral7 : Theme.color.neutral4
84+
85+
Separator {
86+
Layout.fillWidth: true
11087
}
11188

112-
CoreText {
113-
id: address
114-
anchors.left: addressLabel.right
115-
anchors.right: parent.right
116-
anchors.top: parent.top
117-
text: root.request.address
118-
horizontalAlignment: Text.AlignLeft
119-
font.pixelSize: 18
120-
wrapMode: Text.WrapAnywhere
121-
background: Rectangle {
122-
color: Theme.color.neutral2
123-
radius: 5
89+
RowLayout {
90+
Layout.fillWidth: true
91+
Layout.topMargin: 10
92+
93+
spacing: 0
94+
95+
ColumnLayout {
96+
spacing: 5
97+
Layout.alignment: Qt.AlignLeft
98+
Layout.minimumWidth: 110
99+
100+
CoreText {
101+
id: addressLabel
102+
text: qsTr("Address")
103+
font.pixelSize: 18
104+
}
105+
CoreText {
106+
id: copyLabel
107+
text: qsTr("copy")
108+
font.pixelSize: 18
109+
color: enabled ? Theme.color.neutral7 : Theme.color.neutral4
110+
}
111+
}
112+
113+
CoreText {
114+
id: address
115+
Layout.fillWidth: true
116+
Layout.minimumHeight: 50
117+
text: root.request.address
118+
horizontalAlignment: Text.AlignLeft
119+
font.pixelSize: 18
120+
wrapMode: Text.WrapAnywhere
121+
background: Rectangle {
122+
color: Theme.color.neutral2
123+
radius: 5
124+
}
124125
}
125126
}
126-
}
127127

128-
ContinueButton {
129-
id: continueButton
130-
Layout.fillWidth: true
131-
Layout.topMargin: 30
132-
text: qsTr("Create bitcoin address")
133-
onClicked: {
134-
if (!clearRequest.visible) {
135-
requestCounter = requestCounter + 1
136-
clearRequest.visible = true
137-
wallet.commitPaymentRequest()
138-
title.text = qsTr("Payment request #" + requestCounter)
139-
continueButton.text = qsTr("Copy payment request")
128+
ContinueButton {
129+
id: continueButton
130+
Layout.fillWidth: true
131+
Layout.topMargin: 30
132+
text: qsTr("Create bitcoin address")
133+
onClicked: {
134+
if (!clearRequest.visible) {
135+
clearRequest.visible = true
136+
root.wallet.commitPaymentRequest()
137+
title.text = qsTr("Payment request #" + root.wallet.request.id)
138+
continueButton.text = qsTr("Copy payment request")
139+
}
140140
}
141141
}
142-
}
143142

144-
ContinueButton {
145-
id: clearRequest
146-
Layout.fillWidth: true
147-
Layout.topMargin: 10
148-
visible: false
149-
borderColor: Theme.color.neutral6
150-
borderHoverColor: Theme.color.orangeLight1
151-
borderPressedColor: Theme.color.orangeLight2
152-
backgroundColor: "transparent"
153-
backgroundHoverColor: "transparent"
154-
backgroundPressedColor: "transparent"
155-
text: qsTr("Clear")
156-
onClicked: {
157-
clearRequest.visible = false
158-
title.text = qsTr("Request a payment")
159-
root.request.clear()
160-
continueButton.text = qsTr("Create bitcoin address")
143+
ContinueButton {
144+
id: clearRequest
145+
Layout.fillWidth: true
146+
Layout.topMargin: 10
147+
visible: false
148+
borderColor: Theme.color.neutral6
149+
borderHoverColor: Theme.color.orangeLight1
150+
borderPressedColor: Theme.color.orangeLight2
151+
backgroundColor: "transparent"
152+
backgroundHoverColor: "transparent"
153+
backgroundPressedColor: "transparent"
154+
text: qsTr("Clear")
155+
onClicked: {
156+
clearRequest.visible = false
157+
root.request.clear()
158+
continueButton.text = qsTr("Create bitcoin address")
159+
}
161160
}
162161
}
163-
}
164162

165-
Pane {
166-
Layout.alignment: Qt.AlignTop
167-
Layout.minimumWidth: 150
168-
Layout.minimumHeight: 150
169-
padding: 0
170-
background: Rectangle {
171-
color: Theme.color.neutral2
172-
visible: qrImage.code === ""
173-
}
174-
contentItem: QRImage {
175-
id: qrImage
176-
backgroundColor: "transparent"
177-
foregroundColor: Theme.color.neutral9
178-
code: root.request.address
163+
Pane {
164+
Layout.alignment: Qt.AlignTop
165+
Layout.minimumWidth: 150
166+
Layout.minimumHeight: 150
167+
padding: 0
168+
background: Rectangle {
169+
color: Theme.color.neutral2
170+
visible: qrImage.code === ""
171+
}
172+
contentItem: QRImage {
173+
id: qrImage
174+
backgroundColor: "transparent"
175+
foregroundColor: Theme.color.neutral9
176+
code: root.request.address
177+
}
179178
}
180179
}
181180
}

0 commit comments

Comments
 (0)