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