This commit is contained in:
doitux
2007-01-21 14:20:15 +00:00
parent 45c447c380
commit 019ca62194
7 changed files with 51 additions and 65 deletions
+4 -4
View File
@@ -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() ; }
}
+11 -9
View File
@@ -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("<p align='center'><span style='font-size:x-large; font-weight:bold'>Pot Total</span></p>");
label_Sets->setText("<p align='center'><span style='font-size:medium; font-weight:bold'>Sets:</span></p>");
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(); }
}
}
+4 -4
View File
@@ -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));
}
+22 -22
View File
@@ -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));
}
+4 -24
View File
@@ -20,41 +20,21 @@
#include "session.h"
#include "game.h"
#include "guiinterface.h"
#include "tinyxml.h"
#include <cstdlib>
#include "configfile.h"
#ifdef _WIN32
#include <direct.h>
#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";
}
+4
View File
@@ -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;
};