Browse Source

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.
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
55fe4de960
  1. 21
      src/qt/bitcoin.cpp

21
src/qt/bitcoin.cpp

@ -32,6 +32,8 @@
#include <QTranslator> #include <QTranslator>
#include <QWeakPointer> #include <QWeakPointer>
#include <QThread> #include <QThread>
#include <QVBoxLayout>
#include <QLabel>
#if defined(QT_STATICPLUGIN) #if defined(QT_STATICPLUGIN)
#include <QtPlugin> #include <QtPlugin>
@ -347,17 +349,34 @@ void BitcoinApplication::requestShutdown()
window->setClientModel(0); window->setClientModel(0);
window->removeAllWallets(); window->removeAllWallets();
guiref.clear(); guiref.clear();
delete walletModel; 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(); emit requestedShutdown();
} }
void BitcoinApplication::initializeResult(int retval) void BitcoinApplication::initializeResult(int retval)
{ {
LogPrintf("Initialization result: %i\n", 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; returnValue = retval ? 0 : 1;
if(retval) if(retval)
{ {
// Miscellaneous initialization after core is initialized
optionsModel->Upgrade(); // Must be done after AppInit2 optionsModel->Upgrade(); // Must be done after AppInit2
PaymentServer::LoadRootCAs(); PaymentServer::LoadRootCAs();

Loading…
Cancel
Save