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.preferredWidth: parent.width
Layout.fillHeight: true Layout.fillHeight: true
clip: 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 { delegate: ChannelDelegate {
onClicked: { onClicked: {
@ -102,7 +117,6 @@ Pane {
} }
} }
ButtonContainer { ButtonContainer {
Layout.fillWidth: true Layout.fillWidth: true
FlatButton { 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 visible: Daemon.currentWallet && Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning
icon.source: '../../icons/lightning.png' 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 # sort, for now simply by state
def chan_sort_score(c): 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) channels.sort(key=chan_sort_score)
self.clear() self.clear()

Loading…
Cancel
Save