some fixes, add lightning balance to BalanceSummary
This commit is contained in:
@@ -12,13 +12,17 @@ Frame {
|
||||
property string formattedUnconfirmed
|
||||
property string formattedBalanceFiat
|
||||
property string formattedUnconfirmedFiat
|
||||
property string formattedLightningBalance
|
||||
property string formattedLightningBalanceFiat
|
||||
|
||||
function setBalances() {
|
||||
root.formattedBalance = Config.formatSats(Daemon.currentWallet.confirmedBalance)
|
||||
root.formattedUnconfirmed = Config.formatSats(Daemon.currentWallet.unconfirmedBalance)
|
||||
root.formattedLightningBalance = Config.formatSats(Daemon.currentWallet.lightningBalance)
|
||||
if (Daemon.fx.enabled) {
|
||||
root.formattedBalanceFiat = Daemon.fx.fiatValue(Daemon.currentWallet.confirmedBalance, false)
|
||||
root.formattedUnconfirmedFiat = Daemon.fx.fiatValue(Daemon.currentWallet.unconfirmedBalance, false)
|
||||
root.formattedLightningBalanceFiat = Daemon.fx.fiatValue(Daemon.currentWallet.lightningBalance, false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +96,30 @@ Frame {
|
||||
: ''
|
||||
}
|
||||
}
|
||||
Label {
|
||||
visible: Daemon.currentWallet.isLightning
|
||||
font.pixelSize: constants.fontSizeSmall
|
||||
text: qsTr('Lightning: ')
|
||||
}
|
||||
RowLayout {
|
||||
visible: Daemon.currentWallet.isLightning
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeSmall
|
||||
font.family: FixedFont
|
||||
text: formattedLightningBalance
|
||||
}
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeSmall
|
||||
color: Material.accentColor
|
||||
text: Config.baseUnit
|
||||
}
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeSmall
|
||||
text: Daemon.fx.enabled
|
||||
? '(' + root.formattedLightningBalanceFiat + ' ' + Daemon.fx.fiatCurrency + ')'
|
||||
: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// instead of all these explicit connections, we should expose
|
||||
@@ -107,6 +135,12 @@ Frame {
|
||||
function onWalletLoaded() { setBalances() }
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Daemon.fx
|
||||
function onEnabledUpdated() { setBalances() }
|
||||
function onQuotesUpdated() { setBalances() }
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Daemon.currentWallet
|
||||
function onBalanceChanged() {
|
||||
|
||||
@@ -22,7 +22,9 @@ TextField {
|
||||
Connections {
|
||||
target: Config
|
||||
function onBaseUnitChanged() {
|
||||
amount.text = amount.textAsSats != 0 ? Config.satsToUnits(amount.textAsSats) : ''
|
||||
amount.text = amount.textAsSats.satsInt != 0
|
||||
? Config.satsToUnits(amount.textAsSats)
|
||||
: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,3 +58,6 @@ class QEAmount(QObject):
|
||||
if self._is_max:
|
||||
return '%s(MAX)' % s
|
||||
return '%s(sats=%d, msats=%d)' % (s, self._amount_sat, self._amount_msat)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<QEAmount max={self._is_max} sats={self._amount_sat} msats={self._amount_msat}>"
|
||||
|
||||
Reference in New Issue
Block a user