[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot/qt main_window.cpp main_window.h
From: |
Olivier Teulière |
Subject: |
[Eliot-dev] eliot/qt main_window.cpp main_window.h |
Date: |
Sun, 17 Oct 2010 21:24:18 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Changes by: Olivier Teulière <ipkiss> 10/10/17 21:24:18
Modified files:
qt : main_window.cpp main_window.h
Log message:
Ask for a confirmation before starting a new game
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/main_window.cpp?cvsroot=eliot&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/main_window.h?cvsroot=eliot&r1=1.18&r2=1.19
Patches:
Index: main_window.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/main_window.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- main_window.cpp 16 May 2010 18:12:55 -0000 1.38
+++ main_window.cpp 17 Oct 2010 21:24:18 -0000 1.39
@@ -360,13 +360,7 @@
if (m_game)
{
QString msg = _q("Loading a dictionary will stop the current
game.");
- QMessageBox confirmationBox(QMessageBox::Question, _q("Eliot"),
msg,
- QMessageBox::Yes | QMessageBox::No,
this);
- confirmationBox.setInformativeText(_q("Do you want to continue?"));
- confirmationBox.setDefaultButton(QMessageBox::Yes);
- confirmationBox.setEscapeButton(QMessageBox::No);
- int res = confirmationBox.exec();
- if (res == QMessageBox::No)
+ if (!requestConfirmation(msg))
return;
}
@@ -392,6 +386,18 @@
}
+bool MainWindow::requestConfirmation(QString msg)
+{
+ QMessageBox confirmationBox(QMessageBox::Question, _q("Eliot"), msg,
+ QMessageBox::Yes | QMessageBox::No, this);
+ confirmationBox.setInformativeText(_q("Do you want to continue?"));
+ confirmationBox.setDefaultButton(QMessageBox::Yes);
+ confirmationBox.setEscapeButton(QMessageBox::No);
+ int res = confirmationBox.exec();
+ return res == QMessageBox::Yes;
+}
+
+
QAction * MainWindow::addMenuAction(QMenu *menu, QString iText,
const QKeySequence &iShortcut,
QString iStatusTip, const char *iMember,
@@ -515,6 +521,13 @@
if (res == QDialog::Rejected)
return;
+ if (m_game)
+ {
+ QString msg = _q("Starting a new game will stop the current one.");
+ if (!requestConfirmation(msg))
+ return;
+ }
+
// Destroy the game and the associated controls
destroyCurrentGame();
@@ -938,13 +951,7 @@
QString msg = _q("Replaying this turn will modify the game history "
"by deleting the turns after the displayed one (i.e. "
"turns \"in the future\").");
- QMessageBox confirmationBox(QMessageBox::Question, _q("Eliot"), msg,
- QMessageBox::Yes | QMessageBox::No, this);
- confirmationBox.setInformativeText(_q("Do you want to continue?"));
- confirmationBox.setDefaultButton(QMessageBox::Yes);
- confirmationBox.setEscapeButton(QMessageBox::No);
- int ret = confirmationBox.exec();
- if (ret != QMessageBox::Yes)
+ if (!requestConfirmation(msg))
return;
}
Index: main_window.h
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/main_window.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- main_window.h 15 May 2010 12:20:27 -0000 1.18
+++ main_window.h 17 Oct 2010 21:24:18 -0000 1.19
@@ -167,6 +167,9 @@
/// Destroy the current game (if any) and the associated widgets
void destroyCurrentGame();
+ /// Ask for a confirmation
+ bool requestConfirmation(QString msg);
+
};
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Eliot-dev] eliot/qt main_window.cpp main_window.h,
Olivier Teulière <=