Recreate the preferences dialog every time, to avoid displaying unsaved changes

This commit is contained in:
Olivier Teulière 2012-03-05 22:23:10 +01:00
parent cf6cec0527
commit ff21e64a7f
2 changed files with 5 additions and 12 deletions

View file

@ -73,7 +73,7 @@ const char *MainWindow::m_windowName = "MainWindow";
MainWindow::MainWindow(QWidget *iParent) MainWindow::MainWindow(QWidget *iParent)
: QMainWindow(iParent), m_dic(NULL), m_game(NULL), : QMainWindow(iParent), m_dic(NULL), m_game(NULL),
m_newGameDialog(NULL), m_prefsDialog(NULL), m_newGameDialog(NULL),
m_playersWidget(NULL), m_trainingWidget(NULL), m_playersWidget(NULL), m_trainingWidget(NULL),
m_arbitrationWidget(NULL), m_scoresWidget(NULL), m_arbitrationWidget(NULL), m_scoresWidget(NULL),
m_bagWindow(NULL), m_boardWindow(NULL), m_bagWindow(NULL), m_boardWindow(NULL),
@ -978,13 +978,10 @@ void MainWindow::onGameQuit()
void MainWindow::onSettingsPreferences() void MainWindow::onSettingsPreferences()
{ {
if (m_prefsDialog == NULL) PrefsDialog *prefsDialog = new PrefsDialog(this);
{ QObject::connect(prefsDialog, SIGNAL(prefsUpdated()),
m_prefsDialog = new PrefsDialog(this); this, SLOT(prefsUpdated()));
QObject::connect(m_prefsDialog, SIGNAL(prefsUpdated()), prefsDialog->exec();
this, SLOT(prefsUpdated()));
}
m_prefsDialog->exec();
} }

View file

@ -34,7 +34,6 @@ class Board;
class History; class History;
class PublicGame; class PublicGame;
class NewGame; class NewGame;
class PrefsDialog;
class PlayerTabWidget; class PlayerTabWidget;
class ScoreWidget; class ScoreWidget;
class TrainingWidget; class TrainingWidget;
@ -127,9 +126,6 @@ private:
/// Dialog for creating a new game /// Dialog for creating a new game
NewGame *m_newGameDialog; NewGame *m_newGameDialog;
/// Dialog for the preferences
PrefsDialog *m_prefsDialog;
/// Widget for the players /// Widget for the players
PlayerTabWidget *m_playersWidget; PlayerTabWidget *m_playersWidget;