diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-09-22 10:08:47 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-09-22 10:13:52 +0200 |
commit | cfc5cfb0f0d074774b17adcb88aaed11e6847c92 (patch) | |
tree | e2e45db192bc450888caadb3ab2241f10404f30c /src/qt/utilitydialog.cpp | |
parent | 6b09bc45b12465dc8511f1e84791e3b4db5400b8 (diff) |
qt: Make splash and shutdown window ignore close events
It's strange to be able to close these windows while there is work
in progress.
Also set Qt::WA_DeleteOnClose on both windows to make sure that they
are deleted eventually, no matter what happens.
Diffstat (limited to 'src/qt/utilitydialog.cpp')
-rw-r--r-- | src/qt/utilitydialog.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 7df9d1bc2d..84f88dff5a 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -15,6 +15,7 @@ #include <stdio.h> +#include <QCloseEvent> #include <QLabel> #include <QRegExp> #include <QVBoxLayout> @@ -106,18 +107,26 @@ void HelpMessageDialog::on_okButton_accepted() /** "Shutdown" window */ +ShutdownWindow::ShutdownWindow(QWidget *parent, Qt::WindowFlags f): + QWidget(parent, f) +{ + QVBoxLayout *layout = new QVBoxLayout(); + layout->addWidget(new QLabel( + tr("Bitcoin Core is shutting down...") + "<br /><br />" + + tr("Do not shut down the computer until this window disappears."))); + setLayout(layout); +} + void ShutdownWindow::showShutdownWindow(BitcoinGUI *window) { if (!window) return; // 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...") + "<br /><br />" + - tr("Do not shut down the computer until this window disappears."))); - shutdownWindow->setLayout(layout); + QWidget *shutdownWindow = new ShutdownWindow(); + // We don't hold a direct pointer to the shutdown window after creation, so use + // Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually. + shutdownWindow->setAttribute(Qt::WA_DeleteOnClose); shutdownWindow->setWindowTitle(window->windowTitle()); // Center shutdown window at where main window was @@ -125,3 +134,8 @@ void ShutdownWindow::showShutdownWindow(BitcoinGUI *window) shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2); shutdownWindow->show(); } + +void ShutdownWindow::closeEvent(QCloseEvent *event) +{ + event->ignore(); +} |