1
0

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

filter backups to bottom, add backups section header
This commit is contained in:
Sander van Grieken
2023-03-14 10:06:31 +01:00
parent acc1f22442
commit c0ce0296f8
3 changed files with 32 additions and 13 deletions

View File

@@ -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()
}
}
}

View File

@@ -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'))
}
}
}
}

View File

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