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