From a79e69aad3eaad0b38b8b2e9cd5f8b74f2e33094 Mon Sep 17 00:00:00 2001 From: doitux Date: Wed, 30 May 2007 08:05:53 +0000 Subject: [PATCH] optional "play sound effects" optional "timeout for player action" --- src/config/configfile.cpp | 4 +- src/gui/qt/createnetworkgamedialog.ui | 114 ++++++---- .../createnetworkgamedialogimpl.cpp | 1 + src/gui/qt/mainwindow/mainwindowimpl.cpp | 25 +-- src/gui/qt/mainwindow/mainwindowimpl.h | 2 +- src/gui/qt/settingsdialog.ui | 201 ++++++++++-------- .../qt/settingsdialog/settingsdialogimpl.cpp | 6 + 7 files changed, 205 insertions(+), 148 deletions(-) diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index afd18988..15bf3ffb 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -49,7 +49,7 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0) if(strcmp(argv[i], "--nowriteaccess") == 0) { noWriteAccess = 1; } } // !!!! Revisionsnummer der Configdefaults !!!!! - configRev = 21; + configRev = 24; //standard defaults logOnOffDefault = "1"; @@ -142,6 +142,7 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0) configList.push_back(ConfigInfo("ShowFadeOutCardsAnimation", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("ShowFlipCardsAnimation", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("ShowBlindButtons", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("PlaySoundEffects", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("FlipsideTux", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("FlipsideOwn", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("FlipsideOwnFile", CONFIG_TYPE_STRING, "")); @@ -159,6 +160,7 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0) configList.push_back(ConfigInfo("NetHandsBeforeRaiseSmallBlind", CONFIG_TYPE_INT, "8")); configList.push_back(ConfigInfo("NetGameSpeed", CONFIG_TYPE_INT, "4")); configList.push_back(ConfigInfo("NetEngineVersion", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("NetTimeOutPlayerAction", CONFIG_TYPE_INT, "20")); configList.push_back(ConfigInfo("ServerPassword", CONFIG_TYPE_STRING, "")); configList.push_back(ConfigInfo("ServerUseIpv6", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("ServerPort", CONFIG_TYPE_INT, "7234")); diff --git a/src/gui/qt/createnetworkgamedialog.ui b/src/gui/qt/createnetworkgamedialog.ui index 0afbf249..1aec3c4c 100644 --- a/src/gui/qt/createnetworkgamedialog.ui +++ b/src/gui/qt/createnetworkgamedialog.ui @@ -5,8 +5,8 @@ 0 0 - 314 - 243 + 335 + 274 @@ -44,51 +44,6 @@ - - - - 1 - - - 9 - - - - - - - Hands before raise small blind: - - - - - - - Start Cash: - - - - - - - Small Blind: - - - - - - - Number of players: - - - - - - - Game Speed for computer opponent: - - - @@ -102,6 +57,27 @@ + + + + Small Blind: + + + + + + + Start Cash: + + + + + + + Number of players: + + + @@ -128,6 +104,50 @@ + + + + 60 + + + 5 + + + 20 + + + + + + + Timeout for player action (sec): + + + + + + + Hands before raise small blind: + + + + + + + 1 + + + 9 + + + + + + + Game Speed for computer opponent: + + + diff --git a/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp b/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp index 5eb7dc08..a194a1f1 100644 --- a/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp +++ b/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp @@ -58,6 +58,7 @@ void createNetworkGameDialogImpl::fillFormular() { spinBox_smallBlind->setValue(myConfig->readConfigInt("NetSmallBlind")); spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig->readConfigInt("NetHandsBeforeRaiseSmallBlind")); spinBox_gameSpeed->setValue(myConfig->readConfigInt("NetGameSpeed")); + spinBox_netTimeOutPlayerAction->setValue(myConfig->readConfigInt("NetTimeOutPlayerAction")); } void createNetworkGameDialogImpl::showDialog() { diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 0d6eb60b..9c4f44d8 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -2513,7 +2513,7 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) { if (event->key() == Qt::Key_F3) { pushButton_BetRaise->click(); } if (event->key() == Qt::Key_F10) { switchLeftToolBox(); } if (event->key() == Qt::Key_F11) { switchRightToolBox(); } - if (event->key() == Qt::Key_D) { setLabelArray[0]->startTimeOutAnimation(10); } //f + if (event->key() == Qt::Key_D) { setLabelArray[0]->startTimeOutAnimation(myConfig->readConfigInt("NetTimeOutPlayerAction")); } //f if (event->key() == Qt::Key_E) { setLabelArray[0]->stopTimeOutAnimation(); } //f if (event->key() == Qt::Key_S) { playSound(); } //s if (event->key() == 16777249) { @@ -2616,21 +2616,22 @@ void mainWindowImpl::musicDone() { void mainWindowImpl::playSound() { - cout << "play now" << endl; - /* Actually loads up the music */ - music = Mix_LoadMUS("beep.ogg"); - - /* This begins playing the music - the first argument is a - pointer to Mix_Music structure, and the second is how many - times you want it to loop (use -1 for infinite, and 0 to - have it just play once) */ - Mix_PlayMusic(music, 0); - + if(myConfig->readConfigInt("PlaySoundEffects")) { + cout << "play now" << endl; + /* Actually loads up the music */ + music = Mix_LoadMUS("beep.ogg"); + + /* This begins playing the music - the first argument is a + pointer to Mix_Music structure, and the second is how many + times you want it to loop (use -1 for infinite, and 0 to + have it just play once) */ + Mix_PlayMusic(music, 0); + } /* We want to know when our music has stopped playing so we can free it up and set 'music' back to NULL. SDL_Mixer provides us with a callback routine we can use to do exactly that */ -// Mix_HookMusicFinished(musicDone); +// Mix_HookMusicFinished(mainWindowImpl::musicDone()); } diff --git a/src/gui/qt/mainwindow/mainwindowimpl.h b/src/gui/qt/mainwindow/mainwindowimpl.h index 243c64a8..69360e63 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.h +++ b/src/gui/qt/mainwindow/mainwindowimpl.h @@ -255,7 +255,7 @@ public slots: //SOUND TESTING void playSound(); - void musicDone(); + void musicDone(); private: diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index ca312fb3..2b712904 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -6,7 +6,7 @@ 0 0 635 - 439 + 470 @@ -32,7 +32,7 @@ 6 - + Flipside of Cards @@ -126,10 +126,24 @@ p, li { white-space: pre-wrap; } - - + + - Show left toolbox (F10 to switch on/off) + Show flip-card animation + + + + + + + Show buttons for small blind and big blind + + + + + + + Show fade-out animation for non-winning cards @@ -140,23 +154,10 @@ p, li { white-space: pre-wrap; } - - - - Qt::Vertical - - - - 20 - 40 - - - - - - + + - Show fade-out animation for non-winning cards + Show left toolbox (F10 to switch on/off) @@ -180,13 +181,6 @@ p, li { white-space: pre-wrap; } - - - - Show flip-card animation - - - @@ -201,10 +195,23 @@ p, li { white-space: pre-wrap; } - - + + + + Qt::Vertical + + + + 20 + 40 + + + + + + - Show buttons for small blind and big blind + Play sound effects @@ -471,57 +478,6 @@ p, li { white-space: pre-wrap; } 6 - - - - Game Speed for computer opponents: - - - - - - - Start Cash: - - - - - - - 7 - - - 2 - - - 7 - - - - - - - 500 - - - 5 - - - - - - - Number of players: - - - - - - - Small Blind: - - - @@ -542,10 +498,16 @@ p, li { white-space: pre-wrap; } - - - - Hands before raise small blind: + + + + 7 + + + 2 + + + 7 @@ -562,11 +524,32 @@ p, li { white-space: pre-wrap; } + + + + Small Blind: + + + + + + + Game Speed for computer opponents: + + + + + + + Number of players: + + + - 0.4 (actual - under development) + 0.4 (actual) @@ -583,6 +566,50 @@ p, li { white-space: pre-wrap; } + + + + Start Cash: + + + + + + + 500 + + + 5 + + + + + + + Hands before raise small blind: + + + + + + + Timout for player action (sec): + + + + + + + 60 + + + 5 + + + 20 + + + diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index 5bfff0e9..50ad6e10 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -95,9 +95,11 @@ void settingsDialogImpl::exec() { spinBox_netHandsBeforeRaiseSmallBlind->setValue(myConfig->readConfigInt("NetHandsBeforeRaiseSmallBlind")); spinBox_netGameSpeed->setValue(myConfig->readConfigInt("NetGameSpeed")); comboBox_netEngineVersion->setCurrentIndex(myConfig->readConfigInt("NetEngineVersion")); + spinBox_netTimeOutPlayerAction->setValue(myConfig->readConfigInt("NetTimeOutPlayerAction")); spinBox_serverPort->setValue(myConfig->readConfigInt("ServerPort")); lineEdit_serverPassword->setText(QString::fromUtf8(myConfig->readConfigString("ServerPassword").c_str())); checkBox_useIpv6->setChecked(myConfig->readConfigInt("ServerUseIpv6")); + //Interface @@ -108,6 +110,7 @@ void settingsDialogImpl::exec() { checkBox_showFadeOutCardsAnimation->setChecked(myConfig->readConfigInt("ShowFadeOutCardsAnimation")); checkBox_showFlipCardsAnimation->setChecked(myConfig->readConfigInt("ShowFlipCardsAnimation")); checkBox_showBlindButtons->setChecked(myConfig->readConfigInt("ShowBlindButtons")); + checkBox_playSoundEffects->setChecked(myConfig->readConfigInt("PlaySoundEffects")); radioButton_flipsideTux->setChecked(myConfig->readConfigInt("FlipsideTux")); radioButton_flipsideOwn->setChecked(myConfig->readConfigInt("FlipsideOwn")); if(radioButton_flipsideOwn->isChecked()) { @@ -121,6 +124,7 @@ void settingsDialogImpl::exec() { lineEdit_logDir->setText(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str())); spinBox_logStoreDuration->setValue(myConfig->readConfigInt("LogStoreDuration")); comboBox_logInterval->setCurrentIndex(myConfig->readConfigInt("LogInterval")); + QDialog::exec(); @@ -225,6 +229,7 @@ void settingsDialogImpl::isAccepted() { myConfig->writeConfigInt("NetHandsBeforeRaiseSmallBlind", spinBox_netHandsBeforeRaiseSmallBlind->value()); myConfig->writeConfigInt("NetGameSpeed", spinBox_netGameSpeed->value()); myConfig->writeConfigInt("NetEngineVersion", comboBox_netEngineVersion->currentIndex()); + myConfig->writeConfigInt("NetTimeOutPlayerAction", spinBox_netTimeOutPlayerAction->value()); myConfig->writeConfigInt("ServerPort", spinBox_serverPort->value()); myConfig->writeConfigString("ServerPassword", lineEdit_serverPassword->text().toUtf8().constData()); myConfig->writeConfigInt("ServerUseIpv6", checkBox_useIpv6->isChecked()); @@ -237,6 +242,7 @@ void settingsDialogImpl::isAccepted() { myConfig->writeConfigInt("ShowFadeOutCardsAnimation", checkBox_showFadeOutCardsAnimation->isChecked()); myConfig->writeConfigInt("ShowFlipCardsAnimation", checkBox_showFlipCardsAnimation->isChecked()); myConfig->writeConfigInt("ShowBlindButtons", checkBox_showBlindButtons->isChecked()); + myConfig->writeConfigInt("PlaySoundEffects", checkBox_playSoundEffects->isChecked()); myConfig->writeConfigInt("FlipsideTux", radioButton_flipsideTux->isChecked()); myConfig->writeConfigInt("FlipsideOwn", radioButton_flipsideOwn->isChecked());