Commit 1d425f5b authored by Zach's avatar Zach
Browse files

Merge pull request #1261 from ZeldaZach/fix_982

Confirmation dialog on close
parents da3ade32 ebd516fb
......@@ -136,18 +136,21 @@ void TabSupervisor::retranslateUi()
bool TabSupervisor::closeRequest()
{
if (getGameCount()) {
if (QMessageBox::question(this, tr("Are you sure?"), tr("There are still open games. Are you sure you want to quit?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) {
if (getGameCount())
{
if (QMessageBox::question(this, tr("Are you sure?"), tr("There are still open games. Are you sure you want to quit?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
return false;
}
}
foreach(TabDeckEditor *tab, deckEditorTabs)
else
{
if(!tab->confirmClose())
if (QMessageBox::question(this, tr("Close Cockatrice"), tr("Are you sure you want to close Cockatrice?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
return false;
}
foreach(TabDeckEditor *tab, deckEditorTabs)
if (!tab->confirmClose())
return false;
return true;
}
......
......@@ -71,7 +71,7 @@ void MainWindow::processConnectionClosedEvent(const Event_ConnectionClosed &even
client->disconnectFromServer();
QString reasonStr;
switch (event.reason()) {
case Event_ConnectionClosed::USER_LIMIT_REACHED: reasonStr = tr("The server has reached its maximum user capacity, please check back later."); break;
case Event_ConnectionClosed::USER_LIMIT_REACHED: reasonStr = tr("The server has reached its maximum user capacity, please check back later."); break;
case Event_ConnectionClosed::TOO_MANY_CONNECTIONS: reasonStr = tr("There are too many concurrent connections from your address."); break;
case Event_ConnectionClosed::BANNED: {
reasonStr = tr("Banned by moderator");
......@@ -632,7 +632,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
{
// workaround Qt bug where closeEvent gets called twice
static bool bClosingDown=false;
if(bClosingDown)
if (bClosingDown)
return;
bClosingDown=true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment