Browse Source

qml: parent channel open progress dialog to main.qml as it might live longer than OpenChannel

patch-4
Sander van Grieken 3 years ago
parent
commit
e9a1824a77
  1. 8
      electrum/gui/qml/components/ChannelOpenProgressDialog.qml
  2. 21
      electrum/gui/qml/components/OpenChannel.qml
  3. 5
      electrum/gui/qml/components/main.qml

8
electrum/gui/qml/components/ChannelOpenProgressDialog.qml

@ -27,6 +27,12 @@ ElDialog {
property alias error: errorText.text
property alias peer: peerText.text
function reset() {
state = ''
errorText.text = ''
peerText.text = ''
}
Item {
id: s
state: ''
@ -52,6 +58,7 @@ ElDialog {
id: content
anchors.centerIn: parent
width: parent.width
spacing: constants.paddingLarge
RowLayout {
Layout.alignment: Qt.AlignHCenter
@ -103,6 +110,7 @@ ElDialog {
id: infoText
visible: false
text: qsTr('Channel will be open after 3 confirmations')
width: parent.width
}
}
}

21
electrum/gui/qml/components/OpenChannel.qml

@ -157,12 +157,6 @@ Pane {
}
}
property var channelOpenProgressDialogInstance
Component {
id: channelOpenProgressDialog
ChannelOpenProgressDialog { }
}
ChannelOpener {
id: channelopener
wallet: Daemon.currentWallet
@ -190,21 +184,22 @@ Pane {
}
onChannelOpening: {
console.log('Channel is opening')
channelOpenProgressDialogInstance = channelOpenProgressDialog.createObject(app, {peer: peer})
channelOpenProgressDialogInstance.open()
app.channelOpenProgressDialog.reset()
app.channelOpenProgressDialog.peer = peer
app.channelOpenProgressDialog.open()
}
onChannelOpenError: {
channelOpenProgressDialogInstance.state = 'failed'
channelOpenProgressDialogInstance.error = message
app.channelOpenProgressDialog.state = 'failed'
app.channelOpenProgressDialog.error = message
}
onChannelOpenSuccess: {
var message = 'success!'
if (!has_backup)
message = message + ' (but no backup. TODO: show QR)'
channelOpenProgressDialogInstance.state = 'success'
channelOpenProgressDialogInstance.error = message
app.channelOpenProgressDialog.state = 'success'
app.channelOpenProgressDialog.error = message
channelopener.wallet.channelModel.new_channel(cid)
// app.stack.pop()
app.stack.pop()
}
}

5
electrum/gui/qml/components/main.qml

@ -186,6 +186,11 @@ ApplicationWindow
}
}
property alias channelOpenProgressDialog: _channelOpenProgressDialog
ChannelOpenProgressDialog {
id: _channelOpenProgressDialog
}
NotificationPopup {
id: notificationPopup
}

Loading…
Cancel
Save