From 03fbf6c3d80783210b1a3b5a52d14eac6e6fdc7d Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sun, 2 Apr 2023 10:37:35 +0200 Subject: [PATCH] qml: show lightning can send/receive amounts in balance details, rather than in requestDetaildDialog. Also remove junk code copy-pasted from WalletDetails. --- .../gui/qml/components/BalanceDetails.qml | 54 ++++++++----------- .../qml/components/ReceiveDetailsDialog.qml | 28 ---------- 2 files changed, 23 insertions(+), 59 deletions(-) diff --git a/electrum/gui/qml/components/BalanceDetails.qml b/electrum/gui/qml/components/BalanceDetails.qml index 0398436ec..cc4073deb 100644 --- a/electrum/gui/qml/components/BalanceDetails.qml +++ b/electrum/gui/qml/components/BalanceDetails.qml @@ -13,36 +13,6 @@ Pane { padding: 0 - property bool _is2fa: Daemon.currentWallet && Daemon.currentWallet.walletType == '2fa' - - function enableLightning() { - var dialog = app.messageDialog.createObject(rootItem, - {'text': qsTr('Enable Lightning for this wallet?'), 'yesno': true}) - dialog.yesClicked.connect(function() { - Daemon.currentWallet.enableLightning() - }) - dialog.open() - } - - function deleteWallet() { - var dialog = app.messageDialog.createObject(rootItem, - {'text': qsTr('Really delete this wallet?'), 'yesno': true}) - dialog.yesClicked.connect(function() { - Daemon.checkThenDeleteWallet(Daemon.currentWallet) - }) - dialog.open() - } - - function changePassword() { - // trigger dialog via wallet (auth then signal) - Daemon.startChangePassword() - } - - function importAddressesKeys() { - var dialog = importAddressesKeysDialog.createObject(rootItem) - dialog.open() - } - ColumnLayout { id: rootLayout anchors.fill: parent @@ -149,6 +119,28 @@ Pane { visible: !Daemon.currentWallet.frozenBalance.isEmpty } } + + Heading { + text: qsTr('Lightning Liquidity') + visible: Daemon.currentWallet.isLightning + } + GridLayout { + Layout.alignment: Qt.AlignHCenter + visible: Daemon.currentWallet && Daemon.currentWallet.isLightning + columns: 2 + Label { + text: qsTr('Can send') + } + FormattedAmount { + amount: Daemon.currentWallet.lightningCanSend + } + Label { + text: qsTr('Can receive') + } + FormattedAmount { + amount: Daemon.currentWallet.lightningCanReceive + } + } } } } @@ -178,7 +170,7 @@ Pane { Layout.preferredWidth: 1 text: qsTr('Open Channel') visible: Daemon.currentWallet.isLightning - enabled: Daemon.currentWallet.confirmedBalance.satInt > 0 + enabled: Daemon.currentWallet.confirmedBalance.satsInt > 0 onClicked: { var dialog = openChannelDialog.createObject(rootItem) dialog.open() diff --git a/electrum/gui/qml/components/ReceiveDetailsDialog.qml b/electrum/gui/qml/components/ReceiveDetailsDialog.qml index c16ab337e..4f45ea3c0 100644 --- a/electrum/gui/qml/components/ReceiveDetailsDialog.qml +++ b/electrum/gui/qml/components/ReceiveDetailsDialog.qml @@ -33,34 +33,6 @@ ElDialog { columnSpacing: constants.paddingSmall columns: 4 - TextHighlightPane { - Layout.columnSpan: 4 - Layout.fillWidth: true - - visible: !Daemon.currentWallet.lightningCanReceive.isEmpty - - RowLayout { - width: parent.width - spacing: constants.paddingXSmall - Label { - text: qsTr('Max amount over Lightning') - font.pixelSize: constants.fontSizeSmall - color: Material.accentColor - wrapMode: Text.Wrap - // try to fill/wrap in remaining space - Layout.preferredWidth: Math.min(implicitWidth, parent.width - 2*parent.spacing - constants.iconSizeSmall - lnMaxAmount.implicitWidth) - } - Image { - Layout.preferredWidth: constants.iconSizeSmall - Layout.preferredHeight: constants.iconSizeSmall - source: '../../icons/lightning.png' - } - FormattedAmount { - id: lnMaxAmount - amount: Daemon.currentWallet.lightningCanReceive - } - } - } Label { text: qsTr('Message')