From 680530d24cbbdaa4b47aa14699f43c13fda426d7 Mon Sep 17 00:00:00 2001 From: johnny9 <985648+johnny9@users.noreply.github.com> Date: Wed, 6 Nov 2024 09:11:42 -0500 Subject: [PATCH] qml: Remove creation of PaymentRequests and add default values to RequestConfirmation Having issues with creation of the new QObject so working around for now. --- src/qml/bitcoin_qml.qrc | 1 + src/qml/models/paymentrequest.cpp | 4 +++ src/qml/models/walletqmlmodel.cpp | 4 +-- src/qml/pages/wallet/RequestConfirmation.qml | 36 +++++++++++++------- src/qml/pages/wallet/RequestPayment.qml | 6 ++-- 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/qml/bitcoin_qml.qrc b/src/qml/bitcoin_qml.qrc index c82c11e40..d40b9b20b 100644 --- a/src/qml/bitcoin_qml.qrc +++ b/src/qml/bitcoin_qml.qrc @@ -105,6 +105,7 @@ res/icons/minus.png res/icons/network-dark.png res/icons/network-light.png + res/icons/pending.png res/icons/plus.png res/icons/shutdown.png res/icons/singlesig-wallet.png diff --git a/src/qml/models/paymentrequest.cpp b/src/qml/models/paymentrequest.cpp index 385e18065..84f03ee4a 100644 --- a/src/qml/models/paymentrequest.cpp +++ b/src/qml/models/paymentrequest.cpp @@ -7,6 +7,10 @@ PaymentRequest::PaymentRequest(QObject *parent) : QObject(parent) { + m_amount = ""; + m_address = ""; + m_label = ""; + m_message = ""; } QString PaymentRequest::address() const diff --git a/src/qml/models/walletqmlmodel.cpp b/src/qml/models/walletqmlmodel.cpp index 0f07e4e5b..11e50595f 100644 --- a/src/qml/models/walletqmlmodel.cpp +++ b/src/qml/models/walletqmlmodel.cpp @@ -41,8 +41,8 @@ QString WalletQmlModel::name() const } PaymentRequest* WalletQmlModel::createPaymentRequest(const QString& amount, - const QString& label, - const QString& message) + const QString& label, + const QString& message) { PaymentRequest* request = new PaymentRequest(this); request->setAmount(amount); diff --git a/src/qml/pages/wallet/RequestConfirmation.qml b/src/qml/pages/wallet/RequestConfirmation.qml index f2e8ac99a..a6dfa3af7 100644 --- a/src/qml/pages/wallet/RequestConfirmation.qml +++ b/src/qml/pages/wallet/RequestConfirmation.qml @@ -12,7 +12,12 @@ import "../../components" import "../settings" Page { - property PaymentRequest request + PaymentRequest { + id: request + label: "" + message: "" + amount: "" + } id: root background: null @@ -57,11 +62,13 @@ Page { width: Math.min(parent.width, 450) spacing: 30 - Icon { + Image { + width: 60 + height: 60 Layout.alignment: Qt.AlignHCenter source: "image://images/pending" - width: 60 - height: width + sourceSize.width: 60 + sourceSize.height: 60 } CoreText { @@ -74,6 +81,7 @@ Page { Item { height: 50 Layout.fillWidth: true + visible: request.label != "" CoreText { anchors.left: parent.left anchors.top: parent.top @@ -92,7 +100,7 @@ Page { color: Theme.color.neutral9 placeholderTextColor: Theme.color.neutral7 background: Item {} - text: root.request.amount + text: request.label } } @@ -103,6 +111,7 @@ Page { height: 50 Layout.fillWidth: true + visible: request.amount != "" CoreText { anchors.left: parent.left anchors.top: parent.top @@ -123,7 +132,7 @@ Page { placeholderTextColor: Theme.color.neutral7 background: Item {} placeholderText: "0.00000000" - text: root.request.amount + text: request.amount onTextChanged: { bitcoinAmountText.text = bitcoinAmount.sanitize(bitcoinAmountText.text) } @@ -133,15 +142,18 @@ Page { Item { height: 50 Layout.fillWidth: true + visible: request.message != "" CoreText { + visible: parent.visible anchors.left: parent.left anchors.top: parent.top color: Theme.color.neutral7 - text: "Your name" + text: "Message" font.pixelSize: 15 } TextField { + visible: parent.visible anchors.left: parent.left anchors.bottom: parent.bottom leftPadding: 0 @@ -151,7 +163,7 @@ Page { color: Theme.color.neutral9 placeholderTextColor: Theme.color.neutral7 background: Item {} - placeholderText: qsTr("Enter name...") + placeholderText: qsTr("Enter message...") } } @@ -162,11 +174,11 @@ Page { anchors.left: parent.left anchors.top: parent.top color: Theme.color.neutral7 - text: "Message" + text: qsTr("Address") font.pixelSize: 15 } - TextField { + CoreText { anchors.left: parent.left anchors.bottom: parent.bottom leftPadding: 0 @@ -174,9 +186,7 @@ Page { font.styleName: "Regular" font.pixelSize: 18 color: Theme.color.neutral9 - placeholderTextColor: Theme.color.neutral7 - background: Item {} - placeholderText: qsTr("Enter message...") + text: "bc1q wvlv mha3 cvhy q6qz tjzu mq2d 63ff htzy xxu6 q8" } } } diff --git a/src/qml/pages/wallet/RequestPayment.qml b/src/qml/pages/wallet/RequestPayment.qml index 1130e6fd1..8a2d36665 100644 --- a/src/qml/pages/wallet/RequestPayment.qml +++ b/src/qml/pages/wallet/RequestPayment.qml @@ -182,12 +182,12 @@ StackView { Layout.alignment: Qt.AlignCenter text: qsTr("Continue") onClicked: { - var newRequest = walletController.selectedWallet.createPaymentRequest( + /*var newRequest = walletController.selectedWallet.createPaymentRequest( label.text, bitcoinAmount.sanitize(amountInput.text), message.text - ) - stackView.push(confirmationComponent, { request: newRequest }) + )*/ + stackView.push(confirmationComponent) } } }