From 7a8e9807127fdb836f47db693e973534b3f7ffdc Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Wed, 12 Apr 2023 16:19:17 +0200 Subject: [PATCH] qml: since qeswaphelper is tied to SwapDialog anyway, let's make it a direct child --- electrum/gui/qml/components/main.qml | 57 ++++++++++++---------------- 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/electrum/gui/qml/components/main.qml b/electrum/gui/qml/components/main.qml index b00c3c88b..20484c3e0 100644 --- a/electrum/gui/qml/components/main.qml +++ b/electrum/gui/qml/components/main.qml @@ -365,9 +365,29 @@ ApplicationWindow Component { id: swapDialog SwapDialog { - onClosed: { - swaphelper.destroy() - destroy() + onClosed: destroy() + swaphelper: SwapHelper { + id: _swaphelper + wallet: Daemon.currentWallet + onConfirm: { + var dialog = app.messageDialog.createObject(app, {text: message, yesno: true}) + dialog.accepted.connect(function() { + _swaphelper.executeSwap(true) + }) + dialog.open() + } + onAuthRequired: { + app.handleAuthRequired(_swaphelper, method) + } + onError: { + var dialog = app.messageDialog.createObject(app, { text: message }) + dialog.open() + } + onSwapStarted: { + // swapdialog.close() + var progressdialog = swapProgressDialog.createObject(app, { swaphelper: swaphelper }) + progressdialog.open() + } } } } @@ -392,29 +412,6 @@ ApplicationWindow } } - property alias swaphelper: _swaphelper - Component { - id: _swaphelper - SwapHelper { - id: __swaphelper - wallet: Daemon.currentWallet - onConfirm: { - var dialog = app.messageDialog.createObject(app, {text: message, yesno: true}) - dialog.accepted.connect(function() { - __swaphelper.executeSwap(true) - }) - dialog.open() - } - onAuthRequired: { - app.handleAuthRequired(__swaphelper, method) - } - onError: { - var dialog = app.messageDialog.createObject(app, { text: message }) - dialog.open() - } - } - } - Component.onCompleted: { coverTimer.start() @@ -591,13 +588,7 @@ 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() - }) + var swapdialog = swapDialog.createObject(app) swapdialog.open() }