1
0

qml: use FormattedAmount in LightningPaymentDetails, formatter and fx now use millisats if available, else sats

This commit is contained in:
Sander van Grieken
2023-01-09 17:36:12 +01:00
parent 4071fe9726
commit 82458e7cf0
3 changed files with 5 additions and 14 deletions

View File

@@ -12,10 +12,7 @@ Pane {
width: parent.width
height: parent.height
// property string title: qsTr("Lightning payment details")
property string key
property alias label: lnpaymentdetails.label
signal detailsChanged
@@ -70,14 +67,8 @@ Pane {
color: Material.accentColor
}
RowLayout {
Label {
text: Config.formatMilliSats(lnpaymentdetails.amount)
}
Label {
text: Config.baseUnit
color: Material.accentColor
}
FormattedAmount {
amount: lnpaymentdetails.amount
}
Label {

View File

@@ -9,7 +9,7 @@ RowLayout {
required property Amount amount
property bool showAlt: true
Label {
text: Config.formatSats(amount)
text: amount.msatsInt > 0 ? Config.formatMilliSats(amount) : Config.formatSats(amount)
font.family: FixedFont
}
Label {

View File

@@ -101,7 +101,7 @@ class QEFX(QObject, QtEventListener):
def fiatValue(self, satoshis, plain=True):
rate = self.fx.exchange_rate()
if isinstance(satoshis, QEAmount):
satoshis = satoshis.satsInt
satoshis = satoshis.msatsInt / 1000 if satoshis.msatsInt > 0 else satoshis.satsInt
else:
try:
sd = Decimal(satoshis)
@@ -118,7 +118,7 @@ class QEFX(QObject, QtEventListener):
@pyqtSlot(QEAmount, str, bool, result=str)
def fiatValueHistoric(self, satoshis, timestamp, plain=True):
if isinstance(satoshis, QEAmount):
satoshis = satoshis.satsInt
satoshis = satoshis.msatsInt / 1000 if satoshis.msatsInt > 0 else satoshis.satsInt
else:
try:
sd = Decimal(satoshis)