mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-10 04:45:00 +00:00
DaemonManager: async stop, simple mode wizard - show splash on stop
This commit is contained in:
parent
eb7fae92ef
commit
636ca1c41d
3 changed files with 18 additions and 21 deletions
15
main.qml
15
main.qml
|
@ -678,9 +678,12 @@ ApplicationWindow {
|
||||||
daemonManager.start(flags, persistentSettings.nettype, persistentSettings.blockchainDataDir, persistentSettings.bootstrapNodeAddress, noSync);
|
daemonManager.start(flags, persistentSettings.nettype, persistentSettings.blockchainDataDir, persistentSettings.bootstrapNodeAddress, noSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopDaemon(){
|
function stopDaemon(callback){
|
||||||
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop..."))
|
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop..."))
|
||||||
daemonManager.stop(persistentSettings.nettype);
|
daemonManager.stopAsync(persistentSettings.nettype, function(result) {
|
||||||
|
hideProcessingSplash();
|
||||||
|
callback(result);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDaemonStarted(){
|
function onDaemonStarted(){
|
||||||
|
@ -694,8 +697,6 @@ ApplicationWindow {
|
||||||
simpleModeConnectionTimer.start();
|
simpleModeConnectionTimer.start();
|
||||||
}
|
}
|
||||||
function onDaemonStopped(){
|
function onDaemonStopped(){
|
||||||
console.log("daemon stopped");
|
|
||||||
hideProcessingSplash();
|
|
||||||
currentWallet.connected(true);
|
currentWallet.connected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1927,8 +1928,7 @@ ApplicationWindow {
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
confirmationDialog.onRejectedCallback = function() {
|
confirmationDialog.onRejectedCallback = function() {
|
||||||
daemonManager.stop(persistentSettings.nettype);
|
stopDaemon(onClose);
|
||||||
onClose();
|
|
||||||
};
|
};
|
||||||
confirmationDialog.open();
|
confirmationDialog.open();
|
||||||
}
|
}
|
||||||
|
@ -1955,8 +1955,7 @@ ApplicationWindow {
|
||||||
// If daemon is running - prompt user before exiting
|
// If daemon is running - prompt user before exiting
|
||||||
if(typeof daemonManager != "undefined" && daemonRunning) {
|
if(typeof daemonManager != "undefined" && daemonRunning) {
|
||||||
if (appWindow.walletMode == 0) {
|
if (appWindow.walletMode == 0) {
|
||||||
stopDaemon();
|
stopDaemon(closeAccepted);
|
||||||
closeAccepted();
|
|
||||||
} else {
|
} else {
|
||||||
showDaemonIsRunningDialog(closeAccepted);
|
showDaemonIsRunningDialog(closeAccepted);
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,21 +153,19 @@ bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DaemonManager::stop(NetworkType::Type nettype)
|
void DaemonManager::stopAsync(NetworkType::Type nettype, const QJSValue& callback)
|
||||||
{
|
{
|
||||||
|
const auto feature = m_scheduler.run([this, nettype] {
|
||||||
QString message;
|
QString message;
|
||||||
sendCommand({"exit"}, nettype, message);
|
sendCommand({"exit"}, nettype, message);
|
||||||
qDebug() << message;
|
|
||||||
|
|
||||||
// Start stop watcher - Will kill if not shutting down
|
return QJSValueList({stopWatcher(nettype)});
|
||||||
m_scheduler.run([this, nettype] {
|
}, callback);
|
||||||
if (stopWatcher(nettype))
|
|
||||||
|
if (!feature.first)
|
||||||
{
|
{
|
||||||
emit daemonStopped();
|
QJSValue(callback).call(QJSValueList({false}));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DaemonManager::startWatcher(NetworkType::Type nettype) const
|
bool DaemonManager::startWatcher(NetworkType::Type nettype) const
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
static DaemonManager * instance(const QStringList *args);
|
static DaemonManager * instance(const QStringList *args);
|
||||||
|
|
||||||
Q_INVOKABLE bool start(const QString &flags, NetworkType::Type nettype, const QString &dataDir = "", const QString &bootstrapNodeAddress = "", bool noSync = false);
|
Q_INVOKABLE bool start(const QString &flags, NetworkType::Type nettype, const QString &dataDir = "", const QString &bootstrapNodeAddress = "", bool noSync = false);
|
||||||
Q_INVOKABLE bool stop(NetworkType::Type nettype);
|
Q_INVOKABLE void stopAsync(NetworkType::Type nettype, const QJSValue& callback);
|
||||||
|
|
||||||
Q_INVOKABLE bool noSync() const noexcept;
|
Q_INVOKABLE bool noSync() const noexcept;
|
||||||
// return true if daemon process is started
|
// return true if daemon process is started
|
||||||
|
|
Loading…
Reference in a new issue