check if settingsdialog is called from ingame and disable reset settings

button
This commit is contained in:
doitux
2012-01-06 09:34:26 +00:00
parent cd3eaaf2b9
commit bc8f9b9b89
6 changed files with 40 additions and 10 deletions
+2 -1
View File
@@ -605,7 +605,8 @@ gameTableImpl::~gameTableImpl()
void gameTableImpl::callSettingsDialog() void gameTableImpl::callSettingsDialog()
{ {
myStartWindow->callSettingsDialog(); bool iamInGame = true;
myStartWindow->callSettingsDialog(iamInGame);
} }
void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog)
+13 -1
View File
@@ -3701,7 +3701,7 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<spacer name="verticalSpacer_6"> <spacer name="verticalSpacer_6">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@@ -3721,6 +3721,18 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="label_resetNote">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Note: You can not reset all settings to default during a running game!</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
@@ -486,11 +486,22 @@ void settingsDialogImpl::prepareDialog()
//set this AFTER switch combobox like config-settings. This IS a currentIndexChanged() ;-) //set this AFTER switch combobox like config-settings. This IS a currentIndexChanged() ;-)
languageIsChanged = FALSE; languageIsChanged = FALSE;
//disable reset config button when dialog is called from ingame
if(calledIngame) {
pushButton_resetSettings->setDisabled(true);
label_resetNote->show();
}
else {
pushButton_resetSettings->setEnabled(true);
label_resetNote->hide();
} }
void settingsDialogImpl::exec() }
{
void settingsDialogImpl::exec(bool in_game)
{
calledIngame = in_game;
prepareDialog(); prepareDialog();
QDialog::exec(); QDialog::exec();
@@ -1371,7 +1382,7 @@ void settingsDialogImpl::showLogFilePreview()
void settingsDialogImpl::resetSettings() void settingsDialogImpl::resetSettings()
{ {
int ret = QMessageBox::warning(this, tr("PokerTH - Settings"), int ret = QMessageBox::warning(this, tr("PokerTH - Settings"),
tr("Attention: this will delete all your personal settings!\n" tr("Attention: this will delete all your personal settings and close PokerTH!\n"
"Do you really want to reset factory settings?"), "Do you really want to reset factory settings?"),
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if(ret == QMessageBox::Yes) if(ret == QMessageBox::Yes)
@@ -44,7 +44,7 @@ public:
~settingsDialogImpl(); ~settingsDialogImpl();
void prepareDialog(); void prepareDialog();
void exec(); void exec(bool ingame);
void setPlayerNickIsChanged(bool theValue) { void setPlayerNickIsChanged(bool theValue) {
playerNickIsChanged = theValue; playerNickIsChanged = theValue;
@@ -142,6 +142,7 @@ private:
QString myAppDataPath; QString myAppDataPath;
bool languageIsChanged; bool languageIsChanged;
bool calledIngame;
int changedLanguageIndex; int changedLanguageIndex;
}; };
+7 -3
View File
@@ -110,7 +110,7 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
connect( pushButton_Join_Network_Game, SIGNAL( clicked() ), this, SLOT( callJoinNetworkGameDialog() ) ); connect( pushButton_Join_Network_Game, SIGNAL( clicked() ), this, SLOT( callJoinNetworkGameDialog() ) );
connect( actionAbout_PokerTH, SIGNAL( triggered() ), this, SLOT( callAboutPokerthDialog() ) ); connect( actionAbout_PokerTH, SIGNAL( triggered() ), this, SLOT( callAboutPokerthDialog() ) );
connect( actionConfigure_PokerTH, SIGNAL( triggered() ), this, SLOT( callSettingsDialog() ) ); connect( actionConfigure_PokerTH, SIGNAL( triggered() ), this, SLOT( callSettingsDialogFromStartwindow() ) );
connect(this, SIGNAL(signalShowClientDialog()), this, SLOT(showClientDialog())); connect(this, SIGNAL(signalShowClientDialog()), this, SLOT(showClientDialog()));
@@ -587,10 +587,14 @@ void startWindowImpl::callAboutPokerthDialog()
myAboutPokerthDialog->exec(); myAboutPokerthDialog->exec();
} }
void startWindowImpl::callSettingsDialog() void startWindowImpl::callSettingsDialogFromStartwindow()
{ {
callSettingsDialog(false);
}
mySettingsDialog->exec(); void startWindowImpl::callSettingsDialog(bool ingame)
{
mySettingsDialog->exec(ingame);
if (mySettingsDialog->result() == QDialog::Accepted && mySettingsDialog->getSettingsCorrect()) { if (mySettingsDialog->result() == QDialog::Accepted && mySettingsDialog->getSettingsCorrect()) {
myGuiInterface->getMyW()->applySettings(mySettingsDialog); myGuiInterface->getMyW()->applySettings(mySettingsDialog);
+2 -1
View File
@@ -126,7 +126,8 @@ signals:
public slots: public slots:
void callAboutPokerthDialog(); void callAboutPokerthDialog();
void callSettingsDialog(); void callSettingsDialog(bool);
void callSettingsDialogFromStartwindow();
void callNewGameDialog(); void callNewGameDialog();
void callGameLobbyDialog(); void callGameLobbyDialog();
void callCreateNetworkGameDialog(); void callCreateNetworkGameDialog();