diff --git a/pokerth.pro b/pokerth.pro index 2e6d87df..c3776f9b 100755 --- a/pokerth.pro +++ b/pokerth.pro @@ -78,8 +78,8 @@ SOURCES += pokerth.cpp \ RESOURCES = src/gui/qt/deck.qrc TEMPLATE = app -DEPENDPATH += . src uics src/gui src/gui/qt src/engine src/engine/local_engine src/engine/network_engine src/tinyxml -INCLUDEPATH += . src uics src/gui src/gui/qt src/engine src/engine/local_engine src/engine/network_engine src/tinyxml +DEPENDPATH += . src uics src/config src/config/tinyxml src/gui src/gui/qt src/engine src/engine/local_engine src/engine/network_engine +INCLUDEPATH += . src uics src/config src/config/tinyxml src/gui src/gui/qt src/engine src/engine/local_engine src/engine/network_engine CONFIG += qt release UI_DIR = uics TARGET = bin/pokerth diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index 86011471..97224d87 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -49,10 +49,10 @@ void GuiWrapper::setSession(Session *s) { myW->setSession(s); } int GuiWrapper::getMaxQuantityPlayers() const { return myW->getMaxQuantityPlayers(); } std::string GuiWrapper::getPlayerName(int id) const { - if(id==0) { - return myConfig->readConfig("myname", "Human Player").toStdString() ; - } - else { return myConfig->readConfig("opponent"+QString::number(id)+"name", "Player "+QString::number(id)).toStdString() ; } +// if(id==0) { +// return myConfig->readConfig("myname", "Human Player").toStdString() ; +// } +// else { return myConfig->readConfig("opponent"+QString::number(id)+"name", "Player "+QString::number(id)).toStdString() ; } } diff --git a/src/gui/qt/mainwindowimpl.cpp b/src/gui/qt/mainwindowimpl.cpp index accda622..b7f33d64 100755 --- a/src/gui/qt/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindowimpl.cpp @@ -67,7 +67,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name) bool ok; //Toolbox verstecken? - if (!myConfigFile->readConfig("showtoolbox", "1").toInt(&ok,10)) { groupBox_tools->hide(); } +// if (!myConfigFile->readConfig("showtoolbox", "1").toInt(&ok,10)) { groupBox_tools->hide(); } pushButton_raise->setDisabled(TRUE); @@ -197,7 +197,7 @@ void mainWindowImpl::callNewGameDialog() { //wenn Dialogfenster gezeigt werden soll bool ok; - if(myConfigFile->readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10)) { +// if(myConfigFile->readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10)) { newGameDialogImpl *v = new newGameDialogImpl(); v->exec(); @@ -237,9 +237,9 @@ void mainWindowImpl::callNewGameDialog() { mySession->startGame(v->spinBox_quantityPlayers->value(), v->spinBox_startCash->value(), v->spinBox_smallBlind->value()); } - } +// } // sonst mit gespeicherten Werten starten - else { +// else { if(actualGame) { mySession->deleteGame(); @@ -255,7 +255,7 @@ void mainWindowImpl::callNewGameDialog() { label_Pot->setText("

Pot Total

"); label_Sets->setText("

Sets:

"); - guiGameSpeed = myConfigFile->readConfig("gamespeed","4").toInt(&ok,10); + guiGameSpeed = 4/*myConfigFile->readConfig("gamespeed","4").toInt(&ok,10)*/; // debugMode = v->checkBox_debugMode->isChecked(); //Tools und Board aufhellen und enablen @@ -272,9 +272,11 @@ void mainWindowImpl::callNewGameDialog() { //Start Game!!! - mySession->startGame(myConfigFile->readConfig("numberofplayers","5").toInt(&ok,10), myConfigFile->readConfig("startcash","2000").toInt(&ok,10), myConfigFile->readConfig("smallblind","10").toInt(&ok,10)); +// mySession->startGame(myConfigFile->readConfig("numberofplayers","5").toInt(&ok,10), myConfigFile->readConfig("startcash","2000").toInt(&ok,10), myConfigFile->readConfig("smallblind","10").toInt(&ok,10)); + mySession->startGame(5, 2000, 10); - } + +// } } @@ -293,8 +295,8 @@ void mainWindowImpl::callSettingsDialog() { bool ok; //Toolbox verstecken? - if (!myConfigFile->readConfig("showtoolbox", "1").toInt(&ok,10)) { groupBox_tools->hide(); } - else { groupBox_tools->show(); } +// if (!myConfigFile->readConfig("showtoolbox", "1").toInt(&ok,10)) { groupBox_tools->hide(); } +// else { groupBox_tools->show(); } } } diff --git a/src/gui/qt/newgamedialogimpl.cpp b/src/gui/qt/newgamedialogimpl.cpp index e0e2cc2d..43df5b26 100755 --- a/src/gui/qt/newgamedialogimpl.cpp +++ b/src/gui/qt/newgamedialogimpl.cpp @@ -32,10 +32,10 @@ newGameDialogImpl::newGameDialogImpl(QWidget *parent, const char *name) bool ok=TRUE; //Game Settings - spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10)); - spinBox_startCash->setValue(config.readConfig("startcash", "2000").toInt(&ok,10)); - spinBox_smallBlind->setValue(config.readConfig("smallblind", "10").toInt(&ok,10)); - spinBox_gameSpeed->setValue(config.readConfig("gamespeed", "4").toInt(&ok,10)); +// spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10)); +// spinBox_startCash->setValue(config.readConfig("startcash", "2000").toInt(&ok,10)); +// spinBox_smallBlind->setValue(config.readConfig("smallblind", "10").toInt(&ok,10)); +// spinBox_gameSpeed->setValue(config.readConfig("gamespeed", "4").toInt(&ok,10)); } diff --git a/src/gui/qt/settingsdialogimpl.cpp b/src/gui/qt/settingsdialogimpl.cpp index 8a27c6a9..9d7d1822 100644 --- a/src/gui/qt/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialogimpl.cpp @@ -34,21 +34,21 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, const char *name) bool ok=TRUE; //Player Nicks - lineEdit_humanPlayerName->setText(config.readConfig("myname", "Human Player")); - lineEdit_Opponent1Name->setText(config.readConfig("opponent1name", "Player 1")); - lineEdit_Opponent2Name->setText(config.readConfig("opponent2name", "Player 2")); - lineEdit_Opponent3Name->setText(config.readConfig("opponent3name", "Player 3")); - lineEdit_Opponent4Name->setText(config.readConfig("opponent4name", "Player 4")); +// lineEdit_humanPlayerName->setText(config.readConfig("myname", "Human Player")); +// lineEdit_Opponent1Name->setText(config.readConfig("opponent1name", "Player 1")); +// lineEdit_Opponent2Name->setText(config.readConfig("opponent2name", "Player 2")); +// lineEdit_Opponent3Name->setText(config.readConfig("opponent3name", "Player 3")); +// lineEdit_Opponent4Name->setText(config.readConfig("opponent4name", "Player 4")); //Game Settings - spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10)); - spinBox_startCash->setValue(config.readConfig("startcash", "2000").toInt(&ok,10)); - spinBox_smallBlind->setValue(config.readConfig("smallblind", "10").toInt(&ok,10)); - spinBox_gameSpeed->setValue(config.readConfig("gamespeed", "4").toInt(&ok,10)); - checkBox_showGameSettingsDialogOnNewGame->setChecked(config.readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10)); +// spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10)); +// spinBox_startCash->setValue(config.readConfig("startcash", "2000").toInt(&ok,10)); +// spinBox_smallBlind->setValue(config.readConfig("smallblind", "10").toInt(&ok,10)); +// spinBox_gameSpeed->setValue(config.readConfig("gamespeed", "4").toInt(&ok,10)); +// checkBox_showGameSettingsDialogOnNewGame->setChecked(config.readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10)); //Interface - checkBox_showToolbox->setChecked(config.readConfig("showtoolbox", "1").toInt(&ok,10)); +// checkBox_showToolbox->setChecked(config.readConfig("showtoolbox", "1").toInt(&ok,10)); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) ); @@ -62,20 +62,20 @@ void settingsDialogImpl::isAccepted() { ConfigFile config; //Player Nicks - config.writeConfig("myname", lineEdit_humanPlayerName->text()); - config.writeConfig("opponent1name", lineEdit_Opponent1Name->text()); - config.writeConfig("opponent2name", lineEdit_Opponent2Name->text()); - config.writeConfig("opponent3name", lineEdit_Opponent3Name->text()); - config.writeConfig("opponent4name", lineEdit_Opponent4Name->text()); +// config.writeConfig("myname", lineEdit_humanPlayerName->text()); +// config.writeConfig("opponent1name", lineEdit_Opponent1Name->text()); +// config.writeConfig("opponent2name", lineEdit_Opponent2Name->text()); +// config.writeConfig("opponent3name", lineEdit_Opponent3Name->text()); +// config.writeConfig("opponent4name", lineEdit_Opponent4Name->text()); //Game Settings - config.writeConfig("numberofplayers", QString::number(spinBox_quantityPlayers->value(),10)); - config.writeConfig("startcash", QString::number(spinBox_startCash->value(),10)); - config.writeConfig("smallblind", QString::number(spinBox_smallBlind->value(),10)); - config.writeConfig("gamespeed", QString::number(spinBox_gameSpeed->value(),10)); - config.writeConfig("showgamesettingsdialogonnewgame", QString::number(checkBox_showGameSettingsDialogOnNewGame->isChecked(),10)); +// config.writeConfig("numberofplayers", QString::number(spinBox_quantityPlayers->value(),10)); +// config.writeConfig("startcash", QString::number(spinBox_startCash->value(),10)); +// config.writeConfig("smallblind", QString::number(spinBox_smallBlind->value(),10)); +// config.writeConfig("gamespeed", QString::number(spinBox_gameSpeed->value(),10)); +// config.writeConfig("showgamesettingsdialogonnewgame", QString::number(checkBox_showGameSettingsDialogOnNewGame->isChecked(),10)); //Interface - config.writeConfig("showtoolbox", QString::number(checkBox_showToolbox->isChecked(),10)); +// config.writeConfig("showtoolbox", QString::number(checkBox_showToolbox->isChecked(),10)); } diff --git a/src/session.cpp b/src/session.cpp index 827ad88d..b5dd2460 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -20,41 +20,21 @@ #include "session.h" #include "game.h" #include "guiinterface.h" -#include "tinyxml.h" -#include +#include "configfile.h" + -#ifdef _WIN32 -#include -#endif using namespace std; Session::Session(GuiInterface* g) : actualGame(0), myGui(g) { - - // Session an mainwindowimpl bergeben myGui->setSession(this); - // Konfiguration erstellen + myConfig = new ConfigFile; + - string configFileName; -#ifdef _WIN32 - const char *appDataPath = getenv("AppData"); - if (appDataPath) - { - configFileName = appDataPath; - configFileName += "\\pokerth\\"; - mkdir(configFileName.c_str()); - } -#else - // hier Linux/Mac Code zur Basispfadbestimmung, z.B. - configFileName = "~/pokerth"; - // wenn nicht existiert, erzeugen! -#endif - - configFileName += "config.xml"; } diff --git a/src/session.h b/src/session.h index 8fb4c324..cfdac6f1 100755 --- a/src/session.h +++ b/src/session.h @@ -25,6 +25,7 @@ class GuiInterface; class Game; +class ConfigFile; class Session{ @@ -37,9 +38,12 @@ public: void startGame(int, int, int); void deleteGame(); +// void createConfig(); + private: Game *actualGame; GuiInterface *myGui; + ConfigFile *myConfig; };