Browse Source

qml: show lightning can send/receive amounts in balance details,

rather than in requestDetaildDialog.

Also remove junk code copy-pasted from WalletDetails.
master
ThomasV 3 years ago
parent
commit
03fbf6c3d8
  1. 54
      electrum/gui/qml/components/BalanceDetails.qml
  2. 28
      electrum/gui/qml/components/ReceiveDetailsDialog.qml

54
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()

28
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')

Loading…
Cancel
Save