Browse Source

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

master
Sander van Grieken 3 years ago
parent
commit
f82136d07c
  1. 16
      electrum/gui/qml/components/AddressDetails.qml
  2. 50
      electrum/gui/qml/components/ChannelDetails.qml
  3. 33
      electrum/gui/qml/components/Channels.qml
  4. 25
      electrum/gui/qml/components/ConfirmTxDialog.qml
  5. 52
      electrum/gui/qml/components/CpfpBumpFeeDialog.qml
  6. 28
      electrum/gui/qml/components/RbfCancelDialog.qml
  7. 19
      electrum/gui/qml/components/ReceiveDialog.qml

16
electrum/gui/qml/components/AddressDetails.qml

@ -184,20 +184,8 @@ Pane {
color: Material.accentColor color: Material.accentColor
} }
RowLayout { FormattedAmount {
Label { amount: addressdetails.balance
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 + ')'
: ''
}
} }
Label { Label {

50
electrum/gui/qml/components/ChannelDetails.qml

@ -93,20 +93,8 @@ Pane {
color: Material.accentColor color: Material.accentColor
} }
RowLayout { FormattedAmount {
Label { amount: channeldetails.capacity
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 + ')'
: ''
}
} }
Label { Label {
@ -114,22 +102,11 @@ Pane {
color: Material.accentColor color: Material.accentColor
} }
RowLayout { FormattedAmount {
visible: !channeldetails.frozenForSending && channeldetails.isOpen visible: !channeldetails.frozenForSending && channeldetails.isOpen
Label { amount: channeldetails.canSend
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 + ')'
: ''
}
} }
Label { Label {
visible: channeldetails.frozenForSending && channeldetails.isOpen visible: channeldetails.frozenForSending && channeldetails.isOpen
text: qsTr('n/a (frozen)') text: qsTr('n/a (frozen)')
@ -144,22 +121,11 @@ Pane {
color: Material.accentColor color: Material.accentColor
} }
RowLayout { FormattedAmount {
visible: !channeldetails.frozenForReceiving && channeldetails.isOpen visible: !channeldetails.frozenForReceiving && channeldetails.isOpen
Label { amount: channeldetails.canReceive
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 + ')'
: ''
}
} }
Label { Label {
visible: channeldetails.frozenForReceiving && channeldetails.isOpen visible: channeldetails.frozenForReceiving && channeldetails.isOpen
text: qsTr('n/a (frozen)') text: qsTr('n/a (frozen)')

33
electrum/gui/qml/components/Channels.qml

@ -51,20 +51,8 @@ Pane {
color: Material.accentColor color: Material.accentColor
} }
RowLayout { FormattedAmount {
Layout.fillWidth: true amount: Daemon.currentWallet.lightningCanSend
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 + ')'
: ''
}
} }
Label { Label {
@ -72,22 +60,9 @@ Pane {
color: Material.accentColor color: Material.accentColor
} }
RowLayout { FormattedAmount {
Layout.fillWidth: true amount: Daemon.currentWallet.lightningCanReceive
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 + ')'
: ''
}
}
} }
Frame { Frame {

25
electrum/gui/qml/components/ConfirmTxDialog.qml

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

52
electrum/gui/qml/components/CpfpBumpFeeDialog.qml

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

28
electrum/gui/qml/components/RbfCancelDialog.qml

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

19
electrum/gui/qml/components/ReceiveDialog.qml

@ -206,24 +206,9 @@ ElDialog {
text: qsTr('Amount') text: qsTr('Amount')
color: Material.accentColor color: Material.accentColor
} }
RowLayout { FormattedAmount {
visible: !request.amount.isEmpty visible: !request.amount.isEmpty
Label { amount: request.amount
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
}
} }
} }

Loading…
Cancel
Save