1
0

qml: refactor most amount values to FormattedAmount, use fixed font more consistently

This commit is contained in:
Sander van Grieken
2023-01-16 13:49:32 +01:00
parent a986e61047
commit f82136d07c
7 changed files with 40 additions and 183 deletions

View File

@@ -184,20 +184,8 @@ Pane {
color: Material.accentColor
}
RowLayout {
Label {
font.family: FixedFont
text: Config.formatSats(addressdetails.balance)
}
Label {
color: Material.accentColor
text: Config.baseUnit
}
Label {
text: Daemon.fx.enabled
? '(' + Daemon.fx.fiatValue(addressdetails.balance) + ' ' + Daemon.fx.fiatCurrency + ')'
: ''
}
FormattedAmount {
amount: addressdetails.balance
}
Label {

View File

@@ -93,20 +93,8 @@ Pane {
color: Material.accentColor
}
RowLayout {
Label {
font.family: FixedFont
text: Config.formatSats(channeldetails.capacity)
}
Label {
color: Material.accentColor
text: Config.baseUnit
}
Label {
text: Daemon.fx.enabled
? '(' + Daemon.fx.fiatValue(channeldetails.capacity) + ' ' + Daemon.fx.fiatCurrency + ')'
: ''
}
FormattedAmount {
amount: channeldetails.capacity
}
Label {
@@ -114,22 +102,11 @@ Pane {
color: Material.accentColor
}
RowLayout {
FormattedAmount {
visible: !channeldetails.frozenForSending && channeldetails.isOpen
Label {
font.family: FixedFont
text: Config.formatSats(channeldetails.canSend)
}
Label {
color: Material.accentColor
text: Config.baseUnit
}
Label {
text: Daemon.fx.enabled
? '(' + Daemon.fx.fiatValue(channeldetails.canSend) + ' ' + Daemon.fx.fiatCurrency + ')'
: ''
}
amount: channeldetails.canSend
}
Label {
visible: channeldetails.frozenForSending && channeldetails.isOpen
text: qsTr('n/a (frozen)')
@@ -144,22 +121,11 @@ Pane {
color: Material.accentColor
}
RowLayout {
FormattedAmount {
visible: !channeldetails.frozenForReceiving && channeldetails.isOpen
Label {
font.family: FixedFont
text: Config.formatSats(channeldetails.canReceive)
}
Label {
color: Material.accentColor
text: Config.baseUnit
}
Label {
text: Daemon.fx.enabled
? '(' + Daemon.fx.fiatValue(channeldetails.canReceive) + ' ' + Daemon.fx.fiatCurrency + ')'
: ''
}
amount: channeldetails.canReceive
}
Label {
visible: channeldetails.frozenForReceiving && channeldetails.isOpen
text: qsTr('n/a (frozen)')

View File

@@ -51,20 +51,8 @@ Pane {
color: Material.accentColor
}
RowLayout {
Layout.fillWidth: true
Label {
text: Config.formatSats(Daemon.currentWallet.lightningCanSend)
}
Label {
text: Config.baseUnit
color: Material.accentColor
}
Label {
text: Daemon.fx.enabled
? '(' + Daemon.fx.fiatValue(Daemon.currentWallet.lightningCanSend) + ' ' + Daemon.fx.fiatCurrency + ')'
: ''
}
FormattedAmount {
amount: Daemon.currentWallet.lightningCanSend
}
Label {
@@ -72,22 +60,9 @@ Pane {
color: Material.accentColor
}
RowLayout {
Layout.fillWidth: true
Label {
text: Config.formatSats(Daemon.currentWallet.lightningCanReceive)
}
Label {
text: Config.baseUnit
color: Material.accentColor
}
Label {
text: Daemon.fx.enabled
? '(' + Daemon.fx.fiatValue(Daemon.currentWallet.lightningCanReceive) + ' ' + Daemon.fx.fiatCurrency + ')'
: ''
}
FormattedAmount {
amount: Daemon.currentWallet.lightningCanReceive
}
}
Frame {

View File

@@ -61,7 +61,6 @@ ElDialog {
text: qsTr('Amount to send')
color: Material.accentColor
}
RowLayout {
Layout.fillWidth: true
Label {
@@ -94,16 +93,8 @@ ElDialog {
color: Material.accentColor
}
RowLayout {
Label {
id: fee
text: Config.formatSats(finalizer.fee)
}
Label {
text: Config.baseUnit
color: Material.accentColor
}
FormattedAmount {
amount: finalizer.fee
}
Label {
@@ -112,16 +103,9 @@ ElDialog {
color: Material.accentColor
}
RowLayout {
FormattedAmount {
visible: !finalizer.extraFee.isEmpty
Label {
text: Config.formatSats(finalizer.extraFee)
}
Label {
text: Config.baseUnit
color: Material.accentColor
}
amount: finalizer.extraFee
}
Label {
@@ -133,6 +117,7 @@ ElDialog {
Label {
id: feeRate
text: finalizer.feeRate
font.family: FixedFont
}
Label {

View File

@@ -72,15 +72,8 @@ ElDialog {
color: Material.accentColor
}
RowLayout {
Label {
text: Config.formatSats(cpfpfeebumper.inputAmount)
}
Label {
text: Config.baseUnit
color: Material.accentColor
}
FormattedAmount {
amount: cpfpfeebumper.inputAmount
}
Label {
@@ -88,16 +81,9 @@ ElDialog {
color: Material.accentColor
}
RowLayout {
Label {
text: cpfpfeebumper.valid ? Config.formatSats(cpfpfeebumper.outputAmount) : ''
}
Label {
visible: cpfpfeebumper.valid
text: Config.baseUnit
color: Material.accentColor
}
FormattedAmount {
amount: cpfpfeebumper.outputAmount
valid: cpfpfeebumper.valid
}
Slider {
@@ -143,17 +129,9 @@ ElDialog {
color: Material.accentColor
}
RowLayout {
Label {
id: fee
text: cpfpfeebumper.valid ? Config.formatSats(cpfpfeebumper.feeForChild) : ''
}
Label {
visible: cpfpfeebumper.valid
text: Config.baseUnit
color: Material.accentColor
}
FormattedAmount {
amount: cpfpfeebumper.feeForChild
valid: cpfpfeebumper.valid
}
Label {
@@ -161,16 +139,9 @@ ElDialog {
color: Material.accentColor
}
RowLayout {
Label {
text: cpfpfeebumper.valid ? Config.formatSats(cpfpfeebumper.totalFee) : ''
}
Label {
visible: cpfpfeebumper.valid
text: Config.baseUnit
color: Material.accentColor
}
FormattedAmount {
amount: cpfpfeebumper.totalFee
valid: cpfpfeebumper.valid
}
Label {
@@ -181,6 +152,7 @@ ElDialog {
RowLayout {
Label {
text: cpfpfeebumper.valid ? cpfpfeebumper.totalFeeRate : ''
font.family: FixedFont
}
Label {

View File

@@ -51,16 +51,8 @@ ElDialog {
color: Material.accentColor
}
RowLayout {
Label {
id: oldfee
text: Config.formatSats(txcanceller.oldfee)
}
Label {
text: Config.baseUnit
color: Material.accentColor
}
FormattedAmount {
amount: txcanceller.oldfee
}
Label {
@@ -72,6 +64,7 @@ ElDialog {
Label {
id: oldfeeRate
text: txcanceller.oldfeeRate
font.family: FixedFont
}
Label {
@@ -85,17 +78,9 @@ ElDialog {
color: Material.accentColor
}
RowLayout {
Label {
id: fee
text: txcanceller.valid ? Config.formatSats(txcanceller.fee) : ''
}
Label {
visible: txcanceller.valid
text: Config.baseUnit
color: Material.accentColor
}
FormattedAmount {
amount: txcanceller.fee
valid: txcanceller.valid
}
Label {
@@ -107,6 +92,7 @@ ElDialog {
Label {
id: feeRate
text: txcanceller.valid ? txcanceller.feeRate : ''
font.family: FixedFont
}
Label {

View File

@@ -206,24 +206,9 @@ ElDialog {
text: qsTr('Amount')
color: Material.accentColor
}
RowLayout {
FormattedAmount {
visible: !request.amount.isEmpty
Label {
text: Config.formatSats(request.amount)
font.family: FixedFont
font.pixelSize: constants.fontSizeMedium
font.bold: true
}
Label {
text: Config.baseUnit
color: Material.accentColor
font.pixelSize: constants.fontSizeMedium
}
Label {
visible: Daemon.fx.enabled
text: '(' + Daemon.fx.fiatValue(request.amount, false) + ' ' + Daemon.fx.fiatCurrency + ')'
font.pixelSize: constants.fontSizeMedium
}
amount: request.amount
}
}