diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index e6f88e95..29a3f4d4 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -86,13 +86,11 @@ void MainWindow::processConnectionClosedEvent(const Event_ConnectionClosed &even void MainWindow::processServerShutdownEvent(const Event_ServerShutdown &event) { - if (serverShutdownMessageBox) - serverShutdownMessageBox->close(); - serverShutdownMessageBox = new QMessageBox(this); - serverShutdownMessageBox->setAttribute(Qt::WA_DeleteOnClose); - serverShutdownMessageBox->setInformativeText(tr("The server is going to be restarted in %n minute(s).\nAll running games will be lost.\nReason for shutdown: %1", "", event.minutes()).arg(QString::fromStdString(event.reason()))); - serverShutdownMessageBox->setText(tr("Scheduled server shutdown")); - serverShutdownMessageBox->exec(); + serverShutdownMessageBox.setInformativeText(tr("The server is going to be restarted in %n minute(s).\nAll running games will be lost.\nReason for shutdown: %1", "", event.minutes()).arg(QString::fromStdString(event.reason()))); + serverShutdownMessageBox.setIconPixmap(QPixmap(":/resources/appicon.svg").scaled(64, 64)); + serverShutdownMessageBox.setText(tr("Scheduled server shutdown")); + serverShutdownMessageBox.setWindowModality(Qt::ApplicationModal); + serverShutdownMessageBox.setVisible(true); } void MainWindow::statusChanged(ClientStatus _status) @@ -436,8 +434,6 @@ MainWindow::MainWindow(QWidget *parent) createTrayActions(); createTrayIcon(); } - - serverShutdownMessageBox = 0; } MainWindow::~MainWindow() diff --git a/cockatrice/src/window_main.h b/cockatrice/src/window_main.h index 1087d2e7..aed256dd 100644 --- a/cockatrice/src/window_main.h +++ b/cockatrice/src/window_main.h @@ -23,6 +23,7 @@ #include #include #include +#include #include "abstractclient.h" #include "pb/response.pb.h" @@ -32,7 +33,6 @@ class LocalClient; class LocalServer; class ServerInfo_User; class QThread; -class QMessageBox; class MainWindow : public QMainWindow { Q_OBJECT @@ -95,7 +95,7 @@ private: LocalServer *localServer; bool bHasActivated; - QMessageBox *serverShutdownMessageBox; + QMessageBox serverShutdownMessageBox; QProcess * cardUpdateProcess; public: MainWindow(QWidget *parent = 0);