mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 11:38:49 -07:00
Merge pull request #1010 from poixen/server_shutdown_warnings
Updated server shutdown timer logic
This commit is contained in:
commit
924dd174e3
4 changed files with 34 additions and 21 deletions
|
|
@ -86,7 +86,13 @@ void MainWindow::processConnectionClosedEvent(const Event_ConnectionClosed &even
|
|||
|
||||
void MainWindow::processServerShutdownEvent(const Event_ServerShutdown &event)
|
||||
{
|
||||
QMessageBox::information(this, tr("Scheduled server shutdown"), 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())));
|
||||
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();
|
||||
}
|
||||
|
||||
void MainWindow::statusChanged(ClientStatus _status)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class LocalClient;
|
|||
class LocalServer;
|
||||
class ServerInfo_User;
|
||||
class QThread;
|
||||
class QMessageBox;
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
|
@ -86,6 +87,8 @@ private:
|
|||
|
||||
LocalServer *localServer;
|
||||
bool bHasActivated;
|
||||
|
||||
QMessageBox *serverShutdownMessageBox;
|
||||
public:
|
||||
MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue