qml: deduplicate swap initiation, move to main.qml
This commit is contained in:
@@ -171,15 +171,7 @@ Pane {
|
||||
visible: Daemon.currentWallet.isLightning
|
||||
enabled: Daemon.currentWallet.lightningCanSend.satsInt > 0 || Daemon.currentWallet.lightningCanReceive.satInt > 0
|
||||
icon.source: Qt.resolvedUrl('../../icons/update.png')
|
||||
onClicked: {
|
||||
var swaphelper = app.swaphelper.createObject(app)
|
||||
swaphelper.swapStarted.connect(function() {
|
||||
var dialog = swapProgressDialog.createObject(app, { swaphelper: swaphelper })
|
||||
dialog.open()
|
||||
})
|
||||
var dialog = swapDialog.createObject(rootItem, { swaphelper: swaphelper })
|
||||
dialog.open()
|
||||
}
|
||||
onClicked: app.startSwap()
|
||||
}
|
||||
|
||||
FlatButton {
|
||||
@@ -199,20 +191,6 @@ Pane {
|
||||
|
||||
}
|
||||
|
||||
Component {
|
||||
id: swapDialog
|
||||
SwapDialog {
|
||||
onClosed: destroy()
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: swapProgressDialog
|
||||
SwapProgressDialog {
|
||||
onClosed: destroy()
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: openChannelDialog
|
||||
OpenChannelDialog {
|
||||
|
||||
@@ -125,15 +125,7 @@ Pane {
|
||||
text: qsTr('Swap');
|
||||
enabled: Daemon.currentWallet.lightningCanSend.satsInt > 0 || Daemon.currentWallet.lightningCanReceive.satInt > 0
|
||||
icon.source: Qt.resolvedUrl('../../icons/update.png')
|
||||
onClicked: {
|
||||
var swaphelper = app.swaphelper.createObject(app)
|
||||
swaphelper.swapStarted.connect(function() {
|
||||
var dialog = swapProgressDialog.createObject(app, { swaphelper: swaphelper })
|
||||
dialog.open()
|
||||
})
|
||||
var dialog = swapDialog.createObject(root, { swaphelper: swaphelper })
|
||||
dialog.open()
|
||||
}
|
||||
onClicked: app.startSwap()
|
||||
}
|
||||
|
||||
FlatButton {
|
||||
@@ -152,23 +144,6 @@ Pane {
|
||||
|
||||
}
|
||||
|
||||
Component {
|
||||
id: swapDialog
|
||||
SwapDialog {
|
||||
onClosed: {
|
||||
console.log('Destroying SwapDialog ' + this)
|
||||
destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: swapProgressDialog
|
||||
SwapProgressDialog {
|
||||
onClosed: destroy()
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: openChannelDialog
|
||||
OpenChannelDialog {
|
||||
|
||||
@@ -362,6 +362,21 @@ ApplicationWindow
|
||||
id: _channelOpenProgressDialog
|
||||
}
|
||||
|
||||
Component {
|
||||
id: swapDialog
|
||||
SwapDialog {
|
||||
onClosed: destroy()
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: swapProgressDialog
|
||||
SwapProgressDialog {
|
||||
onClosed: destroy()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NotificationPopup {
|
||||
id: notificationPopup
|
||||
width: parent.width
|
||||
@@ -572,6 +587,17 @@ ApplicationWindow
|
||||
}
|
||||
}
|
||||
|
||||
function startSwap() {
|
||||
var swaphelper = app.swaphelper.createObject(app)
|
||||
var swapdialog = swapDialog.createObject(app, { swaphelper: swaphelper })
|
||||
swaphelper.swapStarted.connect(function() {
|
||||
swapdialog.close()
|
||||
var progressdialog = swapProgressDialog.createObject(app, { swaphelper: swaphelper })
|
||||
progressdialog.open()
|
||||
})
|
||||
swapdialog.open()
|
||||
}
|
||||
|
||||
property var _lastActive: 0 // record time of last activity
|
||||
property bool _lockDialogShown: false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user