diff --git a/cockatrice/src/tab_supervisor.h b/cockatrice/src/tab_supervisor.h index 10b6fbad..e3b128df 100644 --- a/cockatrice/src/tab_supervisor.h +++ b/cockatrice/src/tab_supervisor.h @@ -31,6 +31,7 @@ public: void retranslateUi(); void start(Client *_client); void stop(); + int getGameCount() const { return gameTabs.size(); } signals: void setMenu(QMenu *menu); private slots: diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index 7e887b45..ef6c6a07 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -207,8 +207,15 @@ MainWindow::MainWindow(QWidget *parent) resize(900, 700); } -void MainWindow::closeEvent(QCloseEvent */*event*/) +void MainWindow::closeEvent(QCloseEvent *event) { + if (tabSupervisor->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) { + event->ignore(); + return; + } + } + event->accept(); delete tabSupervisor; } diff --git a/cockatrice/translations/cockatrice_de.ts b/cockatrice/translations/cockatrice_de.ts index 274c9c5e..244bba3c 100644 --- a/cockatrice/translations/cockatrice_de.ts +++ b/cockatrice/translations/cockatrice_de.ts @@ -925,7 +925,7 @@ GameView - + Esc Esc @@ -1084,6 +1084,16 @@ &Disconnect Verbindung &trennen + + + Are you sure? + Sind Sie sicher? + + + + There are still open games. Are you sure you want to quit? + Es gibt noch offene Spiele. Wollen Sie das Programm wirklich beenden? + &Restart game... Spiel neu sta&rten... @@ -1784,57 +1794,57 @@ PhasesToolbar - + Untap step Enttappsegment - + Upkeep step Versorgungssegment - + Draw step Ziehsegment - + First main phase erste Hauptphase - + Beginning of combat step Anfangssegment der Kampfphase - + Declare attackers step Angreifer-Deklarieren-Segment - + Declare blockers step Blocker-Deklarieren-Segment - + Combat damage step Kampfschadenssegment - + End of combat step Endsegment der Kampfphase - + Second main phase zweite Hauptphase - + End of turn step Ende-des-Zuges-Segment @@ -2176,12 +2186,12 @@ - + Number: Anzahl: - + Set counters Setze Zählmarken @@ -2285,17 +2295,17 @@ RemoteDeckList_TreeModel - + Name Name - + ID ID - + Upload time Änderungsdatum diff --git a/cockatrice/translations/cockatrice_en.ts b/cockatrice/translations/cockatrice_en.ts index 35ee2567..de83275a 100644 --- a/cockatrice/translations/cockatrice_en.ts +++ b/cockatrice/translations/cockatrice_en.ts @@ -552,7 +552,7 @@ GameView - + Esc @@ -737,6 +737,16 @@ &Cockatrice + + + Are you sure? + + + + + There are still open games. Are you sure you want to quit? + + MessageLogWidget @@ -1107,57 +1117,57 @@ PhasesToolbar - + Untap step - + Upkeep step - + Draw step - + First main phase - + Beginning of combat step - + Declare attackers step - + Declare blockers step - + Combat damage step - + End of combat step - + Second main phase - + End of turn step @@ -1463,7 +1473,7 @@ - + Number: @@ -1488,7 +1498,7 @@ - + Set counters @@ -1552,17 +1562,17 @@ RemoteDeckList_TreeModel - + Name - + ID - + Upload time