From 55fe4de96056cf7b6bdf708a2912927dc9857207 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 7 Jan 2014 16:04:47 +0100 Subject: [PATCH] qt: Show window while shutting down Makes it clear to the user that the application is still wrapping up and the computer should not be turned off until it is finished. --- src/qt/bitcoin.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index d4a834acb..8bcf187ae 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #if defined(QT_STATICPLUGIN) #include @@ -347,17 +349,34 @@ void BitcoinApplication::requestShutdown() window->setClientModel(0); window->removeAllWallets(); guiref.clear(); + delete walletModel; + + // Show a simple window indicating shutdown status + QWidget *shutdownWindow = new QWidget(); + QVBoxLayout *layout = new QVBoxLayout(); + layout->addWidget(new QLabel( + tr("Bitcoin Core is shutting down...\n") + + tr("Do not shut down the computer until this window disappears."))); + shutdownWindow->setLayout(layout); + + // Center shutdown window at where main window was + const QPoint global = window->mapToGlobal(window->rect().center()); + shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2); + shutdownWindow->show(); + + // Request shutdown from core thread emit requestedShutdown(); } void BitcoinApplication::initializeResult(int retval) { LogPrintf("Initialization result: %i\n", retval); - /// Set exit result: 0 if successful, 1 if failure + // Set exit result: 0 if successful, 1 if failure returnValue = retval ? 0 : 1; if(retval) { + // Miscellaneous initialization after core is initialized optionsModel->Upgrade(); // Must be done after AppInit2 PaymentServer::LoadRootCAs();