qml: add frozen lightning to BalanceDetails, indent frozen on-chain and lightning amounts
This commit is contained in:
@@ -81,77 +81,101 @@ Pane {
|
|||||||
GridLayout {
|
GridLayout {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
visible: Daemon.currentWallet
|
visible: Daemon.currentWallet
|
||||||
columns: 3
|
columns: 2
|
||||||
|
|
||||||
Rectangle {
|
RowLayout {
|
||||||
Layout.preferredWidth: constants.iconSizeXSmall
|
Rectangle {
|
||||||
Layout.preferredHeight: constants.iconSizeXSmall
|
Layout.preferredWidth: constants.iconSizeXSmall
|
||||||
border.color: constants.colorPiechartTotal
|
Layout.preferredHeight: constants.iconSizeXSmall
|
||||||
color: 'transparent'
|
border.color: constants.colorPiechartTotal
|
||||||
radius: constants.iconSizeXSmall/2
|
color: 'transparent'
|
||||||
}
|
radius: constants.iconSizeXSmall/2
|
||||||
Label {
|
}
|
||||||
text: qsTr('Total')
|
Label {
|
||||||
|
text: qsTr('Total')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FormattedAmount {
|
FormattedAmount {
|
||||||
amount: Daemon.currentWallet.totalBalance
|
amount: Daemon.currentWallet.totalBalance
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
RowLayout {
|
||||||
visible: Daemon.currentWallet.isLightning
|
Rectangle {
|
||||||
Layout.preferredWidth: constants.iconSizeXSmall
|
visible: Daemon.currentWallet.isLightning
|
||||||
Layout.preferredHeight: constants.iconSizeXSmall
|
Layout.preferredWidth: constants.iconSizeXSmall
|
||||||
color: constants.colorPiechartLightning
|
Layout.preferredHeight: constants.iconSizeXSmall
|
||||||
}
|
color: constants.colorPiechartLightning
|
||||||
Label {
|
}
|
||||||
visible: Daemon.currentWallet.isLightning
|
Label {
|
||||||
text: qsTr('Lightning')
|
visible: Daemon.currentWallet.isLightning
|
||||||
|
text: qsTr('Lightning')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FormattedAmount {
|
FormattedAmount {
|
||||||
visible: Daemon.currentWallet.isLightning
|
visible: Daemon.currentWallet.isLightning
|
||||||
amount: Daemon.currentWallet.lightningBalance
|
amount: Daemon.currentWallet.lightningBalance
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
RowLayout {
|
||||||
visible: Daemon.currentWallet.isLightning || !Daemon.currentWallet.frozenBalance.isEmpty
|
visible: Daemon.currentWallet.isLightning
|
||||||
Layout.preferredWidth: constants.iconSizeXSmall
|
Rectangle {
|
||||||
Layout.preferredHeight: constants.iconSizeXSmall
|
Layout.leftMargin: constants.paddingLarge
|
||||||
color: constants.colorPiechartOnchain
|
Layout.preferredWidth: constants.iconSizeXSmall
|
||||||
|
Layout.preferredHeight: constants.iconSizeXSmall
|
||||||
|
color: constants.colorPiechartLightningFrozen
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: qsTr('Frozen')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Label {
|
FormattedAmount {
|
||||||
|
visible: Daemon.currentWallet.isLightning
|
||||||
|
amount: Daemon.currentWallet.lightningBalanceFrozen
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
visible: Daemon.currentWallet.isLightning || !Daemon.currentWallet.frozenBalance.isEmpty
|
visible: Daemon.currentWallet.isLightning || !Daemon.currentWallet.frozenBalance.isEmpty
|
||||||
text: qsTr('On-chain')
|
Rectangle {
|
||||||
|
Layout.preferredWidth: constants.iconSizeXSmall
|
||||||
|
Layout.preferredHeight: constants.iconSizeXSmall
|
||||||
|
color: constants.colorPiechartOnchain
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: qsTr('On-chain')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FormattedAmount {
|
FormattedAmount {
|
||||||
visible: Daemon.currentWallet.isLightning || !Daemon.currentWallet.frozenBalance.isEmpty
|
visible: Daemon.currentWallet.isLightning || !Daemon.currentWallet.frozenBalance.isEmpty
|
||||||
amount: Daemon.currentWallet.confirmedBalance
|
amount: Daemon.currentWallet.confirmedBalance
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
RowLayout {
|
||||||
visible: !Daemon.currentWallet.frozenBalance.isEmpty
|
visible: !Daemon.currentWallet.frozenBalance.isEmpty
|
||||||
Layout.preferredWidth: constants.iconSizeXSmall
|
Rectangle {
|
||||||
Layout.preferredHeight: constants.iconSizeXSmall
|
Layout.leftMargin: constants.paddingLarge
|
||||||
color: constants.colorPiechartFrozen
|
Layout.preferredWidth: constants.iconSizeXSmall
|
||||||
}
|
Layout.preferredHeight: constants.iconSizeXSmall
|
||||||
Label {
|
color: constants.colorPiechartFrozen
|
||||||
visible: !Daemon.currentWallet.frozenBalance.isEmpty
|
}
|
||||||
text: qsTr('Frozen')
|
Label {
|
||||||
|
text: qsTr('Frozen')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FormattedAmount {
|
FormattedAmount {
|
||||||
amount: Daemon.currentWallet.frozenBalance
|
amount: Daemon.currentWallet.frozenBalance
|
||||||
visible: !Daemon.currentWallet.frozenBalance.isEmpty
|
visible: !Daemon.currentWallet.frozenBalance.isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
RowLayout {
|
||||||
visible: !Daemon.currentWallet.unconfirmedBalance.isEmpty
|
visible: !Daemon.currentWallet.unconfirmedBalance.isEmpty
|
||||||
Layout.preferredWidth: constants.iconSizeXSmall
|
Rectangle {
|
||||||
Layout.preferredHeight: constants.iconSizeXSmall
|
Layout.preferredWidth: constants.iconSizeXSmall
|
||||||
color: constants.colorPiechartUnconfirmed
|
Layout.preferredHeight: constants.iconSizeXSmall
|
||||||
}
|
color: constants.colorPiechartUnconfirmed
|
||||||
Label {
|
}
|
||||||
visible: !Daemon.currentWallet.unconfirmedBalance.isEmpty
|
Label {
|
||||||
text: qsTr('Unconfirmed')
|
text: qsTr('Unconfirmed')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FormattedAmount {
|
FormattedAmount {
|
||||||
amount: Daemon.currentWallet.unconfirmedBalance
|
amount: Daemon.currentWallet.unconfirmedBalance
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
|||||||
self._totalbalance = QEAmount()
|
self._totalbalance = QEAmount()
|
||||||
self._lightningcanreceive = QEAmount()
|
self._lightningcanreceive = QEAmount()
|
||||||
self._lightningcansend = QEAmount()
|
self._lightningcansend = QEAmount()
|
||||||
|
self._lightningbalancefrozen = QEAmount()
|
||||||
|
|
||||||
self._seed = ''
|
self._seed = ''
|
||||||
|
|
||||||
@@ -461,6 +462,12 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
|||||||
self._lightningbalance.satsInt = int(self.wallet.lnworker.get_balance())
|
self._lightningbalance.satsInt = int(self.wallet.lnworker.get_balance())
|
||||||
return self._lightningbalance
|
return self._lightningbalance
|
||||||
|
|
||||||
|
@pyqtProperty(QEAmount, notify=balanceChanged)
|
||||||
|
def lightningBalanceFrozen(self):
|
||||||
|
if self.isLightning:
|
||||||
|
self._lightningbalancefrozen.satsInt = int(self.wallet.lnworker.get_balance(frozen=True))
|
||||||
|
return self._lightningbalancefrozen
|
||||||
|
|
||||||
@pyqtProperty(QEAmount, notify=balanceChanged)
|
@pyqtProperty(QEAmount, notify=balanceChanged)
|
||||||
def totalBalance(self):
|
def totalBalance(self):
|
||||||
total = self.confirmedBalance.satsInt + self.lightningBalance.satsInt
|
total = self.confirmedBalance.satsInt + self.lightningBalance.satsInt
|
||||||
|
|||||||
Reference in New Issue
Block a user