Browse Source

qml: show balance summary on top

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

151
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
} }
RowLayout { ColumnLayout {
Label { spacing: 0
font.pixelSize: constants.fontSizeLarge
font.family: FixedFont RowLayout {
text: formattedBalance Label {
} font.pixelSize: constants.fontSizeXLarge
Label { font.family: FixedFont
font.pixelSize: constants.fontSizeMedium text: formattedBalance
color: Material.accentColor }
text: Config.baseUnit Label {
font.pixelSize: constants.fontSizeXLarge
color: Material.accentColor
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
Label { spacing: 0
font.pixelSize: constants.fontSizeSmall RowLayout {
font.family: FixedFont Label {
text: formattedUnconfirmed font.pixelSize: constants.fontSizeLarge
font.family: FixedFont
text: formattedUnconfirmed
}
Label {
font.pixelSize: constants.fontSizeLarge
color: Material.accentColor
text: Config.baseUnit
}
} }
Label { Label {
visible: Daemon.fx.enabled
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeSmall
color: Material.accentColor color: constants.mutedForeground
text: Config.baseUnit text: root.formattedUnconfirmedFiat + ' ' + Daemon.fx.fiatCurrency
}
Label {
font.pixelSize: constants.fontSizeSmall
text: Daemon.fx.enabled
? '(' + 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
Label { spacing: 0
font.pixelSize: constants.fontSizeSmall
font.family: FixedFont RowLayout {
text: root.formattedFrozen Label {
} font.pixelSize: constants.fontSizeLarge
Label { font.family: FixedFont
font.pixelSize: constants.fontSizeSmall text: root.formattedFrozen
color: Material.accentColor }
text: Config.baseUnit Label {
font.pixelSize: constants.fontSizeLarge
color: Material.accentColor
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
Label { spacing: 0
font.pixelSize: constants.fontSizeSmall
font.family: FixedFont RowLayout {
text: formattedLightningBalance Label {
} font.pixelSize: constants.fontSizeLarge
Label { font.family: FixedFont
font.pixelSize: constants.fontSizeSmall text: formattedLightningBalance
color: Material.accentColor }
text: Config.baseUnit Label {
font.pixelSize: constants.fontSizeLarge
color: Material.accentColor
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