qml: show historic fiat amounts when enabled and applicable
This commit is contained in:
@@ -60,6 +60,7 @@ Pane {
|
|||||||
|
|
||||||
FormattedAmount {
|
FormattedAmount {
|
||||||
amount: lnpaymentdetails.amount
|
amount: lnpaymentdetails.amount
|
||||||
|
timestamp: lnpaymentdetails.timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
@@ -71,6 +72,7 @@ Pane {
|
|||||||
FormattedAmount {
|
FormattedAmount {
|
||||||
visible: lnpaymentdetails.amount.msatsInt < 0
|
visible: lnpaymentdetails.amount.msatsInt < 0
|
||||||
amount: lnpaymentdetails.fee
|
amount: lnpaymentdetails.fee
|
||||||
|
timestamp: lnpaymentdetails.timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ Pane {
|
|||||||
Layout.preferredWidth: 1
|
Layout.preferredWidth: 1
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
amount: txdetails.lnAmount.isEmpty ? txdetails.amount : txdetails.lnAmount
|
amount: txdetails.lnAmount.isEmpty ? txdetails.amount : txdetails.lnAmount
|
||||||
|
timestamp: txdetails.timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
@@ -104,6 +105,7 @@ Pane {
|
|||||||
FormattedAmount {
|
FormattedAmount {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
amount: txdetails.fee
|
amount: txdetails.fee
|
||||||
|
timestamp: txdetails.timestamp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ GridLayout {
|
|||||||
property bool showAlt: true
|
property bool showAlt: true
|
||||||
property bool singleLine: true
|
property bool singleLine: true
|
||||||
property bool valid: true
|
property bool valid: true
|
||||||
|
property bool historic: Daemon.fx.historicRates
|
||||||
|
property int timestamp: 0
|
||||||
|
|
||||||
columns: !valid
|
columns: !valid
|
||||||
? 1
|
? 1
|
||||||
@@ -42,7 +44,11 @@ GridLayout {
|
|||||||
|
|
||||||
function setFiatValue() {
|
function setFiatValue() {
|
||||||
if (showAlt)
|
if (showAlt)
|
||||||
fiatLabel.text = '(' + Daemon.fx.fiatValue(amount) + ' ' + Daemon.fx.fiatCurrency + ')'
|
if (historic && timestamp)
|
||||||
|
fiatLabel.text = '(' + Daemon.fx.fiatValueHistoric(amount, timestamp) + ' ' + Daemon.fx.fiatCurrency + ')'
|
||||||
|
else
|
||||||
|
fiatLabel.text = '(' + Daemon.fx.fiatValue(amount) + ' ' + Daemon.fx.fiatCurrency + ')'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onAmountChanged: setFiatValue()
|
onAmountChanged: setFiatValue()
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from electrum.util import bfh, format_time
|
|||||||
from .qetypes import QEAmount
|
from .qetypes import QEAmount
|
||||||
from .qewallet import QEWallet
|
from .qewallet import QEWallet
|
||||||
|
|
||||||
|
|
||||||
class QELnPaymentDetails(QObject):
|
class QELnPaymentDetails(QObject):
|
||||||
_logger = get_logger(__name__)
|
_logger = get_logger(__name__)
|
||||||
|
|
||||||
@@ -16,9 +17,14 @@ class QELnPaymentDetails(QObject):
|
|||||||
|
|
||||||
self._wallet = None
|
self._wallet = None
|
||||||
self._key = None
|
self._key = None
|
||||||
|
self._label = ''
|
||||||
self._date = None
|
self._date = None
|
||||||
|
self._timestamp = 0
|
||||||
self._fee = QEAmount()
|
self._fee = QEAmount()
|
||||||
self._amount = QEAmount()
|
self._amount = QEAmount()
|
||||||
|
self._status = ''
|
||||||
|
self._phash = ''
|
||||||
|
self._preimage = ''
|
||||||
|
|
||||||
walletChanged = pyqtSignal()
|
walletChanged = pyqtSignal()
|
||||||
@pyqtProperty(QEWallet, notify=walletChanged)
|
@pyqtProperty(QEWallet, notify=walletChanged)
|
||||||
@@ -64,6 +70,10 @@ class QELnPaymentDetails(QObject):
|
|||||||
def date(self):
|
def date(self):
|
||||||
return self._date
|
return self._date
|
||||||
|
|
||||||
|
@pyqtProperty(int, notify=detailsChanged)
|
||||||
|
def timestamp(self):
|
||||||
|
return self._timestamp
|
||||||
|
|
||||||
@pyqtProperty(str, notify=detailsChanged)
|
@pyqtProperty(str, notify=detailsChanged)
|
||||||
def paymentHash(self):
|
def paymentHash(self):
|
||||||
return self._phash
|
return self._phash
|
||||||
@@ -93,6 +103,7 @@ class QELnPaymentDetails(QObject):
|
|||||||
self._amount.msatsInt = int(tx['amount_msat'])
|
self._amount.msatsInt = int(tx['amount_msat'])
|
||||||
self._label = tx['label']
|
self._label = tx['label']
|
||||||
self._date = format_time(tx['timestamp'])
|
self._date = format_time(tx['timestamp'])
|
||||||
|
self._timestamp = tx['timestamp']
|
||||||
self._status = 'settled' # TODO: other states? get_lightning_history is deciding the filter for us :(
|
self._status = 'settled' # TODO: other states? get_lightning_history is deciding the filter for us :(
|
||||||
self._phash = tx['payment_hash']
|
self._phash = tx['payment_hash']
|
||||||
self._preimage = tx['preimage']
|
self._preimage = tx['preimage']
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class QETxDetails(QObject, QtEventListener):
|
|||||||
self._mempool_depth = ''
|
self._mempool_depth = ''
|
||||||
|
|
||||||
self._date = ''
|
self._date = ''
|
||||||
|
self._timestamp = 0
|
||||||
self._confirmations = 0
|
self._confirmations = 0
|
||||||
self._header_hash = ''
|
self._header_hash = ''
|
||||||
self._short_id = ""
|
self._short_id = ""
|
||||||
@@ -172,6 +173,10 @@ class QETxDetails(QObject, QtEventListener):
|
|||||||
def date(self):
|
def date(self):
|
||||||
return self._date
|
return self._date
|
||||||
|
|
||||||
|
@pyqtProperty(int, notify=detailsChanged)
|
||||||
|
def timestamp(self):
|
||||||
|
return self._timestamp
|
||||||
|
|
||||||
@pyqtProperty(int, notify=detailsChanged)
|
@pyqtProperty(int, notify=detailsChanged)
|
||||||
def confirmations(self):
|
def confirmations(self):
|
||||||
return self._confirmations
|
return self._confirmations
|
||||||
@@ -307,6 +312,7 @@ class QETxDetails(QObject, QtEventListener):
|
|||||||
def update_mined_status(self, tx_mined_info: TxMinedInfo):
|
def update_mined_status(self, tx_mined_info: TxMinedInfo):
|
||||||
self._mempool_depth = ''
|
self._mempool_depth = ''
|
||||||
self._date = format_time(tx_mined_info.timestamp)
|
self._date = format_time(tx_mined_info.timestamp)
|
||||||
|
self._timestamp = tx_mined_info.timestamp
|
||||||
self._confirmations = tx_mined_info.conf
|
self._confirmations = tx_mined_info.conf
|
||||||
self._header_hash = tx_mined_info.header_hash
|
self._header_hash = tx_mined_info.header_hash
|
||||||
self._short_id = tx_mined_info.short_id() or ""
|
self._short_id = tx_mined_info.short_id() or ""
|
||||||
|
|||||||
Reference in New Issue
Block a user