Skip to content

Commit 55fe4de

Browse files
committed
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.
1 parent 202d853 commit 55fe4de

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/qt/bitcoin.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#include <QTranslator>
3333
#include <QWeakPointer>
3434
#include <QThread>
35+
#include <QVBoxLayout>
36+
#include <QLabel>
3537

3638
#if defined(QT_STATICPLUGIN)
3739
#include <QtPlugin>
@@ -347,17 +349,34 @@ void BitcoinApplication::requestShutdown()
347349
window->setClientModel(0);
348350
window->removeAllWallets();
349351
guiref.clear();
352+
350353
delete walletModel;
354+
355+
// Show a simple window indicating shutdown status
356+
QWidget *shutdownWindow = new QWidget();
357+
QVBoxLayout *layout = new QVBoxLayout();
358+
layout->addWidget(new QLabel(
359+
tr("Bitcoin Core is shutting down...\n") +
360+
tr("Do not shut down the computer until this window disappears.")));
361+
shutdownWindow->setLayout(layout);
362+
363+
// Center shutdown window at where main window was
364+
const QPoint global = window->mapToGlobal(window->rect().center());
365+
shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2);
366+
shutdownWindow->show();
367+
368+
// Request shutdown from core thread
351369
emit requestedShutdown();
352370
}
353371

354372
void BitcoinApplication::initializeResult(int retval)
355373
{
356374
LogPrintf("Initialization result: %i\n", retval);
357-
/// Set exit result: 0 if successful, 1 if failure
375+
// Set exit result: 0 if successful, 1 if failure
358376
returnValue = retval ? 0 : 1;
359377
if(retval)
360378
{
379+
// Miscellaneous initialization after core is initialized
361380
optionsModel->Upgrade(); // Must be done after AppInit2
362381

363382
PaymentServer::LoadRootCAs();

0 commit comments

Comments
 (0)