|
| 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 | +} |
0 commit comments