qml: move balance from drawer to history listview header
This commit is contained in:
@@ -26,6 +26,20 @@ Pane {
|
||||
|
||||
model: visualModel
|
||||
|
||||
header: Item {
|
||||
width: parent.width
|
||||
height: headerLayout.height
|
||||
ColumnLayout {
|
||||
id: headerLayout
|
||||
anchors.centerIn: parent
|
||||
BalanceSummary {
|
||||
Layout.topMargin: constants.paddingXLarge
|
||||
Layout.bottomMargin: constants.paddingXLarge
|
||||
}
|
||||
}
|
||||
}
|
||||
headerPositioning: ListView.InlineHeader
|
||||
|
||||
readonly property variant sectionLabels: {
|
||||
'local': qsTr('Local'),
|
||||
'mempool': qsTr('Mempool'),
|
||||
|
||||
@@ -61,49 +61,6 @@ Item {
|
||||
|
||||
Item { Layout.preferredWidth: 1; Layout.preferredHeight: 1 }
|
||||
|
||||
TextHighlightPane {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
GridLayout {
|
||||
columns: 3
|
||||
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeXLarge
|
||||
text: qsTr('Balance:')
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeXLarge
|
||||
font.family: FixedFont
|
||||
text: formattedTotalBalance
|
||||
}
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeXLarge
|
||||
color: Material.accentColor
|
||||
text: Config.baseUnit
|
||||
}
|
||||
|
||||
Item {
|
||||
visible: Daemon.fx.enabled
|
||||
Layout.preferredHeight: 1
|
||||
Layout.preferredWidth: 1
|
||||
}
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
visible: Daemon.fx.enabled
|
||||
font.pixelSize: constants.fontSizeLarge
|
||||
color: constants.mutedForeground
|
||||
text: formattedTotalBalanceFiat
|
||||
}
|
||||
Label {
|
||||
visible: Daemon.fx.enabled
|
||||
font.pixelSize: constants.fontSizeLarge
|
||||
color: constants.mutedForeground
|
||||
text: Daemon.fx.fiatCurrency
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
FlatButton {
|
||||
|
||||
@@ -3,209 +3,75 @@ import QtQuick.Layouts 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Controls.Material 2.0
|
||||
|
||||
Frame {
|
||||
Item {
|
||||
id: root
|
||||
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
implicitWidth: balancePane.implicitWidth
|
||||
implicitHeight: balancePane.implicitHeight
|
||||
|
||||
property string formattedTotalBalance
|
||||
property string formattedTotalBalanceFiat
|
||||
property string formattedOnchainBalance
|
||||
property string formattedOnchainBalanceFiat
|
||||
property string formattedUnconfirmed
|
||||
property string formattedUnconfirmedFiat
|
||||
property string formattedFrozen
|
||||
property string formattedFrozenFiat
|
||||
property string formattedLightningBalance
|
||||
property string formattedLightningBalanceFiat
|
||||
|
||||
function setBalances() {
|
||||
root.formattedTotalBalance = Config.formatSats(Daemon.currentWallet.totalBalance)
|
||||
root.formattedOnchainBalance = Config.formatSats(Daemon.currentWallet.confirmedBalance)
|
||||
root.formattedUnconfirmed = Config.formatSats(Daemon.currentWallet.unconfirmedBalance)
|
||||
root.formattedFrozen = Config.formatSats(Daemon.currentWallet.frozenBalance)
|
||||
root.formattedLightningBalance = Config.formatSats(Daemon.currentWallet.lightningBalance)
|
||||
if (Daemon.fx.enabled) {
|
||||
root.formattedTotalBalanceFiat = Daemon.fx.fiatValue(Daemon.currentWallet.totalBalance, false)
|
||||
root.formattedOnchainBalanceFiat = Daemon.fx.fiatValue(Daemon.currentWallet.confirmedBalance, false)
|
||||
root.formattedUnconfirmedFiat = Daemon.fx.fiatValue(Daemon.currentWallet.unconfirmedBalance, false)
|
||||
root.formattedFrozenFiat = Daemon.fx.fiatValue(Daemon.currentWallet.frozenBalance, false)
|
||||
root.formattedLightningBalanceFiat = Daemon.fx.fiatValue(Daemon.currentWallet.lightningBalance, false)
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
id: layout
|
||||
columns: 2
|
||||
TextHighlightPane {
|
||||
id: balancePane
|
||||
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeXLarge
|
||||
text: qsTr('Balance')
|
||||
color: Material.accentColor
|
||||
Layout.columnSpan: 2
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
GridLayout {
|
||||
columns: 3
|
||||
|
||||
Rectangle {
|
||||
color: Material.accentColor
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 1
|
||||
}
|
||||
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeXLarge
|
||||
text: qsTr('Total:')
|
||||
color: Material.accentColor
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
}
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeXLarge
|
||||
font.family: FixedFont
|
||||
text: formattedTotalBalance
|
||||
}
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeXLarge
|
||||
color: Material.accentColor
|
||||
text: Config.baseUnit
|
||||
}
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeXLarge
|
||||
text: qsTr('Balance:')
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
Label {
|
||||
visible: Daemon.fx.enabled
|
||||
font.pixelSize: constants.fontSizeSmall
|
||||
color: constants.mutedForeground
|
||||
text: root.formattedTotalBalanceFiat + ' ' + Daemon.fx.fiatCurrency
|
||||
font.pixelSize: constants.fontSizeXLarge
|
||||
font.family: FixedFont
|
||||
text: formattedTotalBalance
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
text: qsTr('On-chain:')
|
||||
color: Material.accentColor
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
}
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
font.family: FixedFont
|
||||
text: formattedOnchainBalance
|
||||
}
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
color: Material.accentColor
|
||||
text: Config.baseUnit
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
visible: Daemon.fx.enabled
|
||||
font.pixelSize: constants.fontSizeSmall
|
||||
color: constants.mutedForeground
|
||||
text: root.formattedOnchainBalanceFiat + ' ' + Daemon.fx.fiatCurrency
|
||||
font.pixelSize: constants.fontSizeXLarge
|
||||
color: Material.accentColor
|
||||
text: Config.baseUnit
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
visible: Daemon.currentWallet.unconfirmedBalance.satsInt > 0
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
text: qsTr('Unconfirmed:')
|
||||
color: Material.accentColor
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
}
|
||||
ColumnLayout {
|
||||
visible: Daemon.currentWallet.unconfirmedBalance.satsInt > 0
|
||||
spacing: 0
|
||||
RowLayout {
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
font.family: FixedFont
|
||||
text: formattedUnconfirmed
|
||||
}
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
color: Material.accentColor
|
||||
text: Config.baseUnit
|
||||
}
|
||||
Item {
|
||||
visible: Daemon.fx.enabled
|
||||
Layout.preferredHeight: 1
|
||||
Layout.preferredWidth: 1
|
||||
}
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
visible: Daemon.fx.enabled
|
||||
font.pixelSize: constants.fontSizeLarge
|
||||
color: constants.mutedForeground
|
||||
text: formattedTotalBalanceFiat
|
||||
}
|
||||
Label {
|
||||
visible: Daemon.fx.enabled
|
||||
font.pixelSize: constants.fontSizeSmall
|
||||
font.pixelSize: constants.fontSizeLarge
|
||||
color: constants.mutedForeground
|
||||
text: root.formattedUnconfirmedFiat + ' ' + Daemon.fx.fiatCurrency
|
||||
text: Daemon.fx.fiatCurrency
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
visible: Daemon.currentWallet.frozenBalance.satsInt > 0
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
text: qsTr('Frozen:')
|
||||
color: Material.accentColor
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
}
|
||||
ColumnLayout {
|
||||
visible: Daemon.currentWallet.frozenBalance.satsInt > 0
|
||||
spacing: 0
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
font.family: FixedFont
|
||||
text: root.formattedFrozen
|
||||
}
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
color: Material.accentColor
|
||||
text: Config.baseUnit
|
||||
}
|
||||
}
|
||||
Label {
|
||||
visible: Daemon.fx.enabled
|
||||
font.pixelSize: constants.fontSizeSmall
|
||||
color: constants.mutedForeground
|
||||
text: root.formattedFrozenFiat + ' ' + Daemon.fx.fiatCurrency
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
visible: Daemon.currentWallet.isLightning
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
text: qsTr('Lightning:')
|
||||
color: Material.accentColor
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
}
|
||||
ColumnLayout {
|
||||
visible: Daemon.currentWallet.isLightning
|
||||
spacing: 0
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
font.family: FixedFont
|
||||
text: formattedLightningBalance
|
||||
}
|
||||
Label {
|
||||
font.pixelSize: constants.fontSizeMedium
|
||||
color: Material.accentColor
|
||||
text: Config.baseUnit
|
||||
}
|
||||
}
|
||||
Label {
|
||||
visible: Daemon.fx.enabled
|
||||
font.pixelSize: constants.fontSizeSmall
|
||||
color: constants.mutedForeground
|
||||
text: root.formattedLightningBalanceFiat + ' ' + Daemon.fx.fiatCurrency
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: balancePane
|
||||
onClicked: {
|
||||
app.stack.pushOnRoot(Qt.resolvedUrl('../WalletDetails.qml'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// instead of all these explicit connections, we should expose
|
||||
// formatted balances directly as a property
|
||||
Connections {
|
||||
|
||||
Reference in New Issue
Block a user