qml: detect request paid status on receive dialog
This commit is contained in:
@@ -19,6 +19,8 @@ ElDialog {
|
||||
|
||||
property bool _render_qr: false // delay qr rendering until dialog is shown
|
||||
|
||||
property bool _ispaid: false
|
||||
|
||||
parent: Overlay.overlay
|
||||
modal: true
|
||||
standardButtons: Dialog.Close
|
||||
@@ -31,6 +33,7 @@ ElDialog {
|
||||
id: rootLayout
|
||||
width: parent.width
|
||||
spacing: constants.paddingMedium
|
||||
visible: !_ispaid
|
||||
|
||||
states: [
|
||||
State {
|
||||
@@ -198,9 +201,38 @@ ElDialog {
|
||||
onClicked: receiveDetailsDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
visible: _ispaid
|
||||
anchors.centerIn: parent
|
||||
states: [
|
||||
State {
|
||||
name: 'paid'
|
||||
when: _ispaid
|
||||
}
|
||||
]
|
||||
transitions: [
|
||||
Transition {
|
||||
from: ''
|
||||
to: 'paid'
|
||||
NumberAnimation { target: paidIcon; properties: 'opacity'; from: 0; to: 1; duration: 200 }
|
||||
NumberAnimation { target: paidIcon; properties: 'scale'; from: 0; to: 1; duration: 500; easing.type: Easing.OutBack; easing.overshoot: 10 }
|
||||
}
|
||||
]
|
||||
Image {
|
||||
id: paidIcon
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.preferredWidth: constants.iconSizeXXLarge
|
||||
Layout.preferredHeight: constants.iconSizeXXLarge
|
||||
source: '../../icons/confirmed.png'
|
||||
}
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: qsTr('Paid!')
|
||||
font.pixelSize: constants.fontSizeXXLarge
|
||||
}
|
||||
}
|
||||
|
||||
// make clicking the dialog background move the scope away from textedit fields
|
||||
// so the keyboard goes away
|
||||
@@ -266,6 +298,11 @@ ElDialog {
|
||||
rootLayout.state = 'address'
|
||||
}
|
||||
}
|
||||
onStatusChanged: {
|
||||
if (status == RequestDetails.Paid || status == RequestDetails.Unconfirmed) {
|
||||
_ispaid = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReceiveDetailsDialog {
|
||||
|
||||
@@ -1,22 +1,34 @@
|
||||
from time import time
|
||||
|
||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QTimer
|
||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QTimer, Q_ENUMS
|
||||
|
||||
from electrum.logging import get_logger
|
||||
from electrum.invoices import PR_UNPAID, LN_EXPIRY_NEVER
|
||||
from electrum.invoices import (PR_UNPAID, PR_EXPIRED, PR_UNKNOWN, PR_PAID, PR_INFLIGHT,
|
||||
PR_FAILED, PR_ROUTING, PR_UNCONFIRMED, LN_EXPIRY_NEVER)
|
||||
|
||||
from .qewallet import QEWallet
|
||||
from .qetypes import QEAmount
|
||||
|
||||
class QERequestDetails(QObject):
|
||||
_logger = get_logger(__name__)
|
||||
|
||||
class Status:
|
||||
Unpaid = PR_UNPAID
|
||||
Expired = PR_EXPIRED
|
||||
Unknown = PR_UNKNOWN
|
||||
Paid = PR_PAID
|
||||
Inflight = PR_INFLIGHT
|
||||
Failed = PR_FAILED
|
||||
Routing = PR_ROUTING
|
||||
Unconfirmed = PR_UNCONFIRMED
|
||||
|
||||
Q_ENUMS(Status)
|
||||
|
||||
_logger = get_logger(__name__)
|
||||
|
||||
_wallet = None
|
||||
_key = None
|
||||
_req = None
|
||||
_timer = None
|
||||
|
||||
_amount = None
|
||||
|
||||
detailsChanged = pyqtSignal() # generic request properties changed signal
|
||||
|
||||
Reference in New Issue
Block a user