Browse Source

qml: show balance summary on top

patch-4
Sander van Grieken 2 years ago
parent
commit
b4d13ffb41
  1. 93
      electrum/gui/qml/components/BalanceSummary.qml
  2. 13
      electrum/gui/qml/components/History.qml

93
electrum/gui/qml/components/BalanceSummary.qml

@ -5,7 +5,7 @@ import QtQuick.Controls.Material 2.0
Frame { Frame {
id: root id: root
height: layout.height
font.pixelSize: constants.fontSizeMedium font.pixelSize: constants.fontSizeMedium
property string formattedBalance property string formattedBalance
@ -35,97 +35,124 @@ Frame {
columns: 2 columns: 2
Label { Label {
font.pixelSize: constants.fontSizeLarge font.pixelSize: constants.fontSizeXLarge
text: qsTr('Balance: ') text: qsTr('Balance:')
color: Material.accentColor
Layout.alignment: Qt.AlignRight | Qt.AlignTop
} }
ColumnLayout {
spacing: 0
RowLayout { RowLayout {
Label { Label {
font.pixelSize: constants.fontSizeLarge font.pixelSize: constants.fontSizeXLarge
font.family: FixedFont font.family: FixedFont
text: formattedBalance text: formattedBalance
} }
Label { Label {
font.pixelSize: constants.fontSizeMedium font.pixelSize: constants.fontSizeXLarge
color: Material.accentColor color: Material.accentColor
text: Config.baseUnit text: Config.baseUnit
} }
}
Label { Label {
font.pixelSize: constants.fontSizeMedium visible: Daemon.fx.enabled
text: Daemon.fx.enabled font.pixelSize: constants.fontSizeSmall
? '(' + root.formattedBalanceFiat + ' ' + Daemon.fx.fiatCurrency + ')' color: constants.mutedForeground
: '' text: root.formattedBalanceFiat + ' ' + Daemon.fx.fiatCurrency
} }
} }
Label { Label {
visible: Daemon.currentWallet.unconfirmedBalance.satsInt > 0 visible: Daemon.currentWallet.unconfirmedBalance.satsInt > 0
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeLarge
text: qsTr('Unconfirmed: ') text: qsTr('Unconfirmed:')
color: Material.accentColor
Layout.alignment: Qt.AlignRight | Qt.AlignTop
} }
RowLayout { ColumnLayout {
visible: Daemon.currentWallet.unconfirmedBalance.satsInt > 0 visible: Daemon.currentWallet.unconfirmedBalance.satsInt > 0
spacing: 0
RowLayout {
Label { Label {
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeLarge
font.family: FixedFont font.family: FixedFont
text: formattedUnconfirmed text: formattedUnconfirmed
} }
Label { Label {
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeLarge
color: Material.accentColor color: Material.accentColor
text: Config.baseUnit text: Config.baseUnit
} }
}
Label { Label {
visible: Daemon.fx.enabled
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeSmall
text: Daemon.fx.enabled color: constants.mutedForeground
? '(' + root.formattedUnconfirmedFiat + ' ' + Daemon.fx.fiatCurrency + ')' text: root.formattedUnconfirmedFiat + ' ' + Daemon.fx.fiatCurrency
: ''
} }
} }
Label { Label {
visible: Daemon.currentWallet.frozenBalance.satsInt > 0 visible: Daemon.currentWallet.frozenBalance.satsInt > 0
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeLarge
text: qsTr('Frozen: ') text: qsTr('Frozen:')
color: Material.accentColor
Layout.alignment: Qt.AlignRight | Qt.AlignTop
} }
RowLayout { ColumnLayout {
visible: Daemon.currentWallet.frozenBalance.satsInt > 0 visible: Daemon.currentWallet.frozenBalance.satsInt > 0
spacing: 0
RowLayout {
Label { Label {
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeLarge
font.family: FixedFont font.family: FixedFont
text: root.formattedFrozen text: root.formattedFrozen
} }
Label { Label {
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeLarge
color: Material.accentColor color: Material.accentColor
text: Config.baseUnit text: Config.baseUnit
} }
}
Label { Label {
visible: Daemon.fx.enabled
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeSmall
text: Daemon.fx.enabled color: constants.mutedForeground
? '(' + root.formattedFrozenFiat + ' ' + Daemon.fx.fiatCurrency + ')' text: root.formattedFrozenFiat + ' ' + Daemon.fx.fiatCurrency
: ''
} }
} }
Label { Label {
visible: Daemon.currentWallet.isLightning visible: Daemon.currentWallet.isLightning
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeLarge
text: qsTr('Lightning: ') text: qsTr('Lightning:')
color: Material.accentColor
Layout.alignment: Qt.AlignRight | Qt.AlignTop
} }
RowLayout { ColumnLayout {
visible: Daemon.currentWallet.isLightning visible: Daemon.currentWallet.isLightning
spacing: 0
RowLayout {
Label { Label {
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeLarge
font.family: FixedFont font.family: FixedFont
text: formattedLightningBalance text: formattedLightningBalance
} }
Label { Label {
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeLarge
color: Material.accentColor color: Material.accentColor
text: Config.baseUnit text: Config.baseUnit
} }
}
Label { Label {
visible: Daemon.fx.enabled
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeSmall
text: Daemon.fx.enabled color: constants.mutedForeground
? '(' + root.formattedLightningBalanceFiat + ' ' + Daemon.fx.fiatCurrency + ')' text: root.formattedLightningBalanceFiat + ' ' + Daemon.fx.fiatCurrency
: ''
} }
} }
} }

13
electrum/gui/qml/components/History.qml

@ -26,6 +26,19 @@ Pane {
model: visualModel model: visualModel
header: Item {
width: parent.width
height: headerLayout.height
ColumnLayout {
id: headerLayout
anchors.centerIn: parent
Item { height: constants.paddingXLarge; width: 1 }
BalanceSummary {}
Item { height: constants.paddingXLarge; width: 1 }
}
}
headerPositioning: ListView.InlineHeader
readonly property variant sectionLabels: { readonly property variant sectionLabels: {
'today': qsTr('Today'), 'today': qsTr('Today'),
'yesterday': qsTr('Yesterday'), 'yesterday': qsTr('Yesterday'),

Loading…
Cancel
Save