Merge pull request #3155

db4273ee NetworkStatusItem: 'starting/stopping the node' status (no splash) (xiphon)
This commit is contained in:
Alexander Blair 2020-10-19 00:10:19 -07:00
commit 1f9d60602a
No known key found for this signature in database
GPG key ID: C64552D877C32479
2 changed files with 24 additions and 14 deletions

View file

@ -39,6 +39,15 @@ Rectangle {
property var connected: Wallet.ConnectionStatus_Disconnected property var connected: Wallet.ConnectionStatus_Disconnected
function getConnectionStatusString(status) { function getConnectionStatusString(status) {
switch (appWindow.daemonStartStopInProgress)
{
case 1:
return qsTr("Starting the node");
case 2:
return qsTr("Stopping the node");
default:
break;
}
switch (status) { switch (status) {
case Wallet.ConnectionStatus_Connected: case Wallet.ConnectionStatus_Connected:
if (!appWindow.daemonSynced) if (!appWindow.daemonSynced)

View file

@ -72,7 +72,7 @@ ApplicationWindow {
property bool walletSynced: false property bool walletSynced: false
property int maxWindowHeight: (isAndroid || isIOS)? screenHeight : (screenHeight < 900)? 720 : 800; property int maxWindowHeight: (isAndroid || isIOS)? screenHeight : (screenHeight < 900)? 720 : 800;
property bool daemonRunning: !persistentSettings.useRemoteNode && !disconnected property bool daemonRunning: !persistentSettings.useRemoteNode && !disconnected
property bool daemonStartStopInProgress: false property int daemonStartStopInProgress: 0
property alias toolTip: toolTip property alias toolTip: toolTip
property string walletName property string walletName
property bool viewOnly: false property bool viewOnly: false
@ -707,31 +707,33 @@ ApplicationWindow {
} }
function startDaemon(flags){ function startDaemon(flags){
daemonStartStopInProgress = true; daemonStartStopInProgress = 1;
// Pause refresh while starting daemon // Pause refresh while starting daemon
currentWallet.pauseRefresh(); currentWallet.pauseRefresh();
appWindow.showProcessingSplash(qsTr("Waiting for daemon to start..."))
const noSync = appWindow.walletMode === 0; const noSync = appWindow.walletMode === 0;
const bootstrapNodeAddress = persistentSettings.walletMode < 2 ? "auto" : persistentSettings.bootstrapNodeAddress const bootstrapNodeAddress = persistentSettings.walletMode < 2 ? "auto" : persistentSettings.bootstrapNodeAddress
daemonManager.start(flags, persistentSettings.nettype, persistentSettings.blockchainDataDir, bootstrapNodeAddress, noSync); daemonManager.start(flags, persistentSettings.nettype, persistentSettings.blockchainDataDir, bootstrapNodeAddress, noSync);
} }
function stopDaemon(callback){ function stopDaemon(callback, splash){
daemonStartStopInProgress = true; daemonStartStopInProgress = 2;
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop...")) if (splash) {
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop..."));
}
daemonManager.stopAsync(persistentSettings.nettype, function(result) { daemonManager.stopAsync(persistentSettings.nettype, function(result) {
daemonStartStopInProgress = false; daemonStartStopInProgress = 0;
hideProcessingSplash(); if (splash) {
hideProcessingSplash();
}
callback(result); callback(result);
}); });
} }
function onDaemonStarted(){ function onDaemonStarted(){
console.log("daemon started"); console.log("daemon started");
daemonStartStopInProgress = false; daemonStartStopInProgress = 0;
hideProcessingSplash();
currentWallet.connected(true); currentWallet.connected(true);
// resume refresh // resume refresh
currentWallet.startRefresh(); currentWallet.startRefresh();
@ -744,8 +746,7 @@ ApplicationWindow {
function onDaemonStartFailure(error) { function onDaemonStartFailure(error) {
console.log("daemon start failed"); console.log("daemon start failed");
daemonStartStopInProgress = false; daemonStartStopInProgress = 0;
hideProcessingSplash();
// resume refresh // resume refresh
currentWallet.startRefresh(); currentWallet.startRefresh();
informationPopup.title = qsTr("Daemon failed to start") + translationManager.emptyString; informationPopup.title = qsTr("Daemon failed to start") + translationManager.emptyString;
@ -1965,7 +1966,7 @@ ApplicationWindow {
// Simple mode connection check timer // Simple mode connection check timer
id: simpleModeConnectionTimer id: simpleModeConnectionTimer
interval: 2000 interval: 2000
running: appWindow.walletMode < 2 && currentWallet != undefined && !daemonStartStopInProgress running: appWindow.walletMode < 2 && currentWallet != undefined && daemonStartStopInProgress == 0
repeat: true repeat: true
onTriggered: appWindow.checkSimpleModeConnection() onTriggered: appWindow.checkSimpleModeConnection()
} }
@ -2043,7 +2044,7 @@ ApplicationWindow {
if(daemonManager == undefined || persistentSettings.useRemoteNode) { if(daemonManager == undefined || persistentSettings.useRemoteNode) {
closeAccepted(); closeAccepted();
} else if (appWindow.walletMode == 0) { } else if (appWindow.walletMode == 0) {
stopDaemon(closeAccepted); stopDaemon(closeAccepted, true);
} else { } else {
showProcessingSplash(qsTr("Checking local node status...")); showProcessingSplash(qsTr("Checking local node status..."));
const handler = function(running) { const handler = function(running) {