Updated server shutdown timer logic

Will follow the following rules

+ send a message initially
+ send a message every 20 mins
+ send a message every min when time <= 5

Updated client popup

Updated client to close any previous popups and bring up a new one.

NEEDS TO BE TESTED

added missing include

Added delete on close
This commit is contained in:
Matt Lowe 2015-04-22 17:34:43 +02:00
parent 82d8c72427
commit e646122f55
4 changed files with 34 additions and 21 deletions

View file

@ -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)