1
0

qml: move Lightning can receive amount to ReceiveDialog, rename Lightning can send to Lightning (balance) in BalanceSummary

FormattedAmount is now aware of FX rate changing and updates accordingly
This commit is contained in:
Sander van Grieken
2023-01-31 14:00:41 +01:00
parent cf3e5c0dfd
commit 6111c69f1e
3 changed files with 42 additions and 50 deletions

View File

@@ -179,6 +179,25 @@ ElDialog {
}
}
RowLayout {
Layout.alignment: Qt.AlignHCenter
visible: Daemon.currentWallet.isLightning
spacing: constants.paddingXSmall
Image {
Layout.preferredWidth: constants.iconSizeSmall
Layout.preferredHeight: constants.iconSizeSmall
source: '../../icons/lightning.png'
}
Label {
text: qsTr('can receive:')
font.pixelSize: constants.fontSizeSmall
color: Material.accentColor
}
FormattedAmount {
amount: Daemon.currentWallet.lightningCanReceive
}
}
Rectangle {
height: 1
Layout.alignment: Qt.AlignHCenter
@@ -410,5 +429,4 @@ ElDialog {
}
}
}
}

View File

@@ -11,18 +11,14 @@ Item {
property string formattedTotalBalance
property string formattedTotalBalanceFiat
property string formattedLightningCanReceive
property string formattedLightningCanReceiveFiat
property string formattedLightningCanSend
property string formattedLightningCanSendFiat
function setBalances() {
root.formattedTotalBalance = Config.formatSats(Daemon.currentWallet.totalBalance)
root.formattedLightningCanReceive = Config.formatSats(Daemon.currentWallet.lightningCanReceive)
root.formattedLightningCanSend = Config.formatSats(Daemon.currentWallet.lightningCanSend)
if (Daemon.fx.enabled) {
root.formattedTotalBalanceFiat = Daemon.fx.fiatValue(Daemon.currentWallet.totalBalance, false)
root.formattedLightningCanReceiveFiat = Daemon.fx.fiatValue(Daemon.currentWallet.lightningCanReceive, false)
root.formattedLightningCanSendFiat = Daemon.fx.fiatValue(Daemon.currentWallet.lightningCanSend, false)
}
}
@@ -68,49 +64,6 @@ Item {
color: constants.mutedForeground
text: Daemon.fx.fiatCurrency
}
RowLayout {
visible: Daemon.currentWallet.isLightning
Image {
Layout.preferredWidth: constants.iconSizeSmall
Layout.preferredHeight: constants.iconSizeSmall
source: '../../../icons/lightning.png'
}
Label {
text: qsTr('can receive:')
font.pixelSize: constants.fontSizeSmall
color: Material.accentColor
}
}
Label {
visible: Daemon.currentWallet.isLightning
Layout.alignment: Qt.AlignRight
text: formattedLightningCanReceive
font.family: FixedFont
}
Label {
visible: Daemon.currentWallet.isLightning
font.pixelSize: constants.fontSizeSmall
color: Material.accentColor
text: Config.baseUnit
}
Item {
visible: Daemon.currentWallet.isLightning && Daemon.fx.enabled
Layout.preferredHeight: 1
Layout.preferredWidth: 1
}
Label {
Layout.alignment: Qt.AlignRight
visible: Daemon.currentWallet.isLightning && Daemon.fx.enabled
font.pixelSize: constants.fontSizeSmall
color: constants.mutedForeground
text: formattedLightningCanReceiveFiat
}
Label {
visible: Daemon.currentWallet.isLightning && Daemon.fx.enabled
font.pixelSize: constants.fontSizeSmall
color: constants.mutedForeground
text: Daemon.fx.fiatCurrency
}
RowLayout {
visible: Daemon.currentWallet.isLightning
@@ -120,7 +73,7 @@ Item {
source: '../../../icons/lightning.png'
}
Label {
text: qsTr('can send:')
text: qsTr('Lightning:')
font.pixelSize: constants.fontSizeSmall
color: Material.accentColor
}

View File

@@ -34,9 +34,30 @@ GridLayout {
}
Label {
id: fiatLabel
Layout.columnSpan: singleLine ? 1 : 2
visible: showAlt && Daemon.fx.enabled && valid
text: '(' + Daemon.fx.fiatValue(amount) + ' ' + Daemon.fx.fiatCurrency + ')'
font.pixelSize: constants.fontSizeSmall
}
function setFiatValue() {
fiatLabel.text = '(' + Daemon.fx.fiatValue(amount) + ' ' + Daemon.fx.fiatCurrency + ')'
}
Connections {
target: Daemon.fx
function onQuotesUpdated() { setFiatValue() }
}
Connections {
target: amount
function onValueChanged() {
setFiatValue()
}
}
Component.onCompleted: {
if (showAlt)
setFiatValue()
}
}