Skip to content

Commit

Permalink
qml: Remove creation of PaymentRequests and add default values to Req…
Browse files Browse the repository at this point in the history
…uestConfirmation

Having issues with creation of the new QObject so working around for
now.
  • Loading branch information
johnny9 committed Nov 6, 2024
1 parent 1c19692 commit 680530d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/qml/bitcoin_qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
<file alias="minus">res/icons/minus.png</file>
<file alias="network-dark">res/icons/network-dark.png</file>
<file alias="network-light">res/icons/network-light.png</file>
<file alias="pending">res/icons/pending.png</file>
<file alias="plus">res/icons/plus.png</file>
<file alias="shutdown">res/icons/shutdown.png</file>
<file alias="singlesig-wallet">res/icons/singlesig-wallet.png</file>
Expand Down
4 changes: 4 additions & 0 deletions src/qml/models/paymentrequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
PaymentRequest::PaymentRequest(QObject *parent)
: QObject(parent)
{
m_amount = "";
m_address = "";
m_label = "";
m_message = "";
}

QString PaymentRequest::address() const
Expand Down
4 changes: 2 additions & 2 deletions src/qml/models/walletqmlmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
36 changes: 23 additions & 13 deletions src/qml/pages/wallet/RequestConfirmation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import "../../components"
import "../settings"

Page {
property PaymentRequest request
PaymentRequest {
id: request
label: ""
message: ""
amount: ""
}

id: root
background: null
Expand Down Expand Up @@ -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 {
Expand All @@ -74,6 +81,7 @@ Page {
Item {
height: 50
Layout.fillWidth: true
visible: request.label != ""
CoreText {
anchors.left: parent.left
anchors.top: parent.top
Expand All @@ -92,7 +100,7 @@ Page {
color: Theme.color.neutral9
placeholderTextColor: Theme.color.neutral7
background: Item {}
text: root.request.amount
text: request.label
}
}

Expand All @@ -103,6 +111,7 @@ Page {

height: 50
Layout.fillWidth: true
visible: request.amount != ""
CoreText {
anchors.left: parent.left
anchors.top: parent.top
Expand All @@ -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)
}
Expand All @@ -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
Expand All @@ -151,7 +163,7 @@ Page {
color: Theme.color.neutral9
placeholderTextColor: Theme.color.neutral7
background: Item {}
placeholderText: qsTr("Enter name...")
placeholderText: qsTr("Enter message...")
}
}

Expand All @@ -162,21 +174,19 @@ 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
font.family: "Inter"
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"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/qml/pages/wallet/RequestPayment.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down

0 comments on commit 680530d

Please sign in to comment.