Browse Source

qml: show channel backups together with channels in Channels, remove Channel backups button from WalletDetails,

filter backups to bottom, add backups section header
master
Sander van Grieken 3 years ago
parent
commit
c0ce0296f8
  1. 33
      electrum/gui/qml/components/Channels.qml
  2. 10
      electrum/gui/qml/components/WalletDetails.qml
  3. 2
      electrum/gui/qml/qechannellistmodel.py

33
electrum/gui/qml/components/Channels.qml

@ -78,7 +78,22 @@ Pane {
Layout.preferredWidth: parent.width
Layout.fillHeight: true
clip: true
model: Daemon.currentWallet.channelModel.filterModelNoBackups()
model: Daemon.currentWallet.channelModel
section.property: 'is_backup'
section.criteria: ViewSection.FullString
section.delegate: RowLayout {
width: ListView.view.width
required property string section
Label {
visible: section == 'true'
text: qsTr('Channel backups')
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: constants.paddingLarge
font.pixelSize: constants.fontSizeSmall
color: Material.accentColor
}
}
delegate: ChannelDelegate {
onClicked: {
@ -102,7 +117,6 @@ Pane {
}
}
ButtonContainer {
Layout.fillWidth: true
FlatButton {
@ -158,4 +172,19 @@ Pane {
}
}
Component {
id: importChannelBackupDialog
ImportChannelBackupDialog {
onClosed: destroy()
}
}
Connections {
target: Daemon.currentWallet
function onImportChannelBackupFailed(message) {
var dialog = app.messageDialog.createObject(root, { text: message })
dialog.open()
}
}
}

10
electrum/gui/qml/components/WalletDetails.qml

@ -527,16 +527,6 @@ Pane {
visible: Daemon.currentWallet && Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning
icon.source: '../../icons/lightning.png'
}
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Channel backups')
visible: Daemon.currentWallet && Daemon.currentWallet.isLightning
icon.source: '../../icons/lightning.png'
onClicked: {
app.stack.push(Qt.resolvedUrl('ChannelBackups.qml'))
}
}
}
}

2
electrum/gui/qml/qechannellistmodel.py

@ -119,7 +119,7 @@ class QEChannelListModel(QAbstractListModel, QtEventListener):
# sort, for now simply by state
def chan_sort_score(c):
return c['state_code']
return c['state_code'] + (10 if c['is_backup'] else 0)
channels.sort(key=chan_sort_score)
self.clear()

Loading…
Cancel
Save