This commit is contained in:
+2
-2
@@ -78,8 +78,8 @@ SOURCES += pokerth.cpp \
|
|||||||
|
|
||||||
RESOURCES = src/gui/qt/deck.qrc
|
RESOURCES = src/gui/qt/deck.qrc
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
DEPENDPATH += . 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/gui src/gui/qt src/engine src/engine/local_engine src/engine/network_engine src/tinyxml
|
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
|
CONFIG += qt release
|
||||||
UI_DIR = uics
|
UI_DIR = uics
|
||||||
TARGET = bin/pokerth
|
TARGET = bin/pokerth
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ void GuiWrapper::setSession(Session *s) { myW->setSession(s); }
|
|||||||
int GuiWrapper::getMaxQuantityPlayers() const { return myW->getMaxQuantityPlayers(); }
|
int GuiWrapper::getMaxQuantityPlayers() const { return myW->getMaxQuantityPlayers(); }
|
||||||
std::string GuiWrapper::getPlayerName(int id) const {
|
std::string GuiWrapper::getPlayerName(int id) const {
|
||||||
|
|
||||||
if(id==0) {
|
// if(id==0) {
|
||||||
return myConfig->readConfig("myname", "Human Player").toStdString() ;
|
// return myConfig->readConfig("myname", "Human Player").toStdString() ;
|
||||||
}
|
// }
|
||||||
else { return myConfig->readConfig("opponent"+QString::number(id)+"name", "Player "+QString::number(id)).toStdString() ; }
|
// else { return myConfig->readConfig("opponent"+QString::number(id)+"name", "Player "+QString::number(id)).toStdString() ; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name)
|
|||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
//Toolbox verstecken?
|
//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);
|
pushButton_raise->setDisabled(TRUE);
|
||||||
@@ -197,7 +197,7 @@ void mainWindowImpl::callNewGameDialog() {
|
|||||||
|
|
||||||
//wenn Dialogfenster gezeigt werden soll
|
//wenn Dialogfenster gezeigt werden soll
|
||||||
bool ok;
|
bool ok;
|
||||||
if(myConfigFile->readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10)) {
|
// if(myConfigFile->readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10)) {
|
||||||
|
|
||||||
newGameDialogImpl *v = new newGameDialogImpl();
|
newGameDialogImpl *v = new newGameDialogImpl();
|
||||||
v->exec();
|
v->exec();
|
||||||
@@ -237,9 +237,9 @@ void mainWindowImpl::callNewGameDialog() {
|
|||||||
mySession->startGame(v->spinBox_quantityPlayers->value(), v->spinBox_startCash->value(), v->spinBox_smallBlind->value());
|
mySession->startGame(v->spinBox_quantityPlayers->value(), v->spinBox_startCash->value(), v->spinBox_smallBlind->value());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
// sonst mit gespeicherten Werten starten
|
// sonst mit gespeicherten Werten starten
|
||||||
else {
|
// else {
|
||||||
|
|
||||||
if(actualGame) {
|
if(actualGame) {
|
||||||
mySession->deleteGame();
|
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_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>");
|
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();
|
// debugMode = v->checkBox_debugMode->isChecked();
|
||||||
|
|
||||||
//Tools und Board aufhellen und enablen
|
//Tools und Board aufhellen und enablen
|
||||||
@@ -272,9 +272,11 @@ void mainWindowImpl::callNewGameDialog() {
|
|||||||
|
|
||||||
|
|
||||||
//Start Game!!!
|
//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;
|
bool ok;
|
||||||
//Toolbox verstecken?
|
//Toolbox verstecken?
|
||||||
if (!myConfigFile->readConfig("showtoolbox", "1").toInt(&ok,10)) { groupBox_tools->hide(); }
|
// if (!myConfigFile->readConfig("showtoolbox", "1").toInt(&ok,10)) { groupBox_tools->hide(); }
|
||||||
else { groupBox_tools->show(); }
|
// else { groupBox_tools->show(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ newGameDialogImpl::newGameDialogImpl(QWidget *parent, const char *name)
|
|||||||
bool ok=TRUE;
|
bool ok=TRUE;
|
||||||
|
|
||||||
//Game Settings
|
//Game Settings
|
||||||
spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10));
|
// spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10));
|
||||||
spinBox_startCash->setValue(config.readConfig("startcash", "2000").toInt(&ok,10));
|
// spinBox_startCash->setValue(config.readConfig("startcash", "2000").toInt(&ok,10));
|
||||||
spinBox_smallBlind->setValue(config.readConfig("smallblind", "10").toInt(&ok,10));
|
// spinBox_smallBlind->setValue(config.readConfig("smallblind", "10").toInt(&ok,10));
|
||||||
spinBox_gameSpeed->setValue(config.readConfig("gamespeed", "4").toInt(&ok,10));
|
// spinBox_gameSpeed->setValue(config.readConfig("gamespeed", "4").toInt(&ok,10));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,21 +34,21 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, const char *name)
|
|||||||
bool ok=TRUE;
|
bool ok=TRUE;
|
||||||
|
|
||||||
//Player Nicks
|
//Player Nicks
|
||||||
lineEdit_humanPlayerName->setText(config.readConfig("myname", "Human Player"));
|
// lineEdit_humanPlayerName->setText(config.readConfig("myname", "Human Player"));
|
||||||
lineEdit_Opponent1Name->setText(config.readConfig("opponent1name", "Player 1"));
|
// lineEdit_Opponent1Name->setText(config.readConfig("opponent1name", "Player 1"));
|
||||||
lineEdit_Opponent2Name->setText(config.readConfig("opponent2name", "Player 2"));
|
// lineEdit_Opponent2Name->setText(config.readConfig("opponent2name", "Player 2"));
|
||||||
lineEdit_Opponent3Name->setText(config.readConfig("opponent3name", "Player 3"));
|
// lineEdit_Opponent3Name->setText(config.readConfig("opponent3name", "Player 3"));
|
||||||
lineEdit_Opponent4Name->setText(config.readConfig("opponent4name", "Player 4"));
|
// lineEdit_Opponent4Name->setText(config.readConfig("opponent4name", "Player 4"));
|
||||||
|
|
||||||
//Game Settings
|
//Game Settings
|
||||||
spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10));
|
// spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10));
|
||||||
spinBox_startCash->setValue(config.readConfig("startcash", "2000").toInt(&ok,10));
|
// spinBox_startCash->setValue(config.readConfig("startcash", "2000").toInt(&ok,10));
|
||||||
spinBox_smallBlind->setValue(config.readConfig("smallblind", "10").toInt(&ok,10));
|
// spinBox_smallBlind->setValue(config.readConfig("smallblind", "10").toInt(&ok,10));
|
||||||
spinBox_gameSpeed->setValue(config.readConfig("gamespeed", "4").toInt(&ok,10));
|
// spinBox_gameSpeed->setValue(config.readConfig("gamespeed", "4").toInt(&ok,10));
|
||||||
checkBox_showGameSettingsDialogOnNewGame->setChecked(config.readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10));
|
// checkBox_showGameSettingsDialogOnNewGame->setChecked(config.readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10));
|
||||||
|
|
||||||
//Interface
|
//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() ) );
|
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) );
|
||||||
@@ -62,20 +62,20 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
ConfigFile config;
|
ConfigFile config;
|
||||||
|
|
||||||
//Player Nicks
|
//Player Nicks
|
||||||
config.writeConfig("myname", lineEdit_humanPlayerName->text());
|
// config.writeConfig("myname", lineEdit_humanPlayerName->text());
|
||||||
config.writeConfig("opponent1name", lineEdit_Opponent1Name->text());
|
// config.writeConfig("opponent1name", lineEdit_Opponent1Name->text());
|
||||||
config.writeConfig("opponent2name", lineEdit_Opponent2Name->text());
|
// config.writeConfig("opponent2name", lineEdit_Opponent2Name->text());
|
||||||
config.writeConfig("opponent3name", lineEdit_Opponent3Name->text());
|
// config.writeConfig("opponent3name", lineEdit_Opponent3Name->text());
|
||||||
config.writeConfig("opponent4name", lineEdit_Opponent4Name->text());
|
// config.writeConfig("opponent4name", lineEdit_Opponent4Name->text());
|
||||||
|
|
||||||
//Game Settings
|
//Game Settings
|
||||||
config.writeConfig("numberofplayers", QString::number(spinBox_quantityPlayers->value(),10));
|
// config.writeConfig("numberofplayers", QString::number(spinBox_quantityPlayers->value(),10));
|
||||||
config.writeConfig("startcash", QString::number(spinBox_startCash->value(),10));
|
// config.writeConfig("startcash", QString::number(spinBox_startCash->value(),10));
|
||||||
config.writeConfig("smallblind", QString::number(spinBox_smallBlind->value(),10));
|
// config.writeConfig("smallblind", QString::number(spinBox_smallBlind->value(),10));
|
||||||
config.writeConfig("gamespeed", QString::number(spinBox_gameSpeed->value(),10));
|
// config.writeConfig("gamespeed", QString::number(spinBox_gameSpeed->value(),10));
|
||||||
config.writeConfig("showgamesettingsdialogonnewgame", QString::number(checkBox_showGameSettingsDialogOnNewGame->isChecked(),10));
|
// config.writeConfig("showgamesettingsdialogonnewgame", QString::number(checkBox_showGameSettingsDialogOnNewGame->isChecked(),10));
|
||||||
|
|
||||||
//Interface
|
//Interface
|
||||||
config.writeConfig("showtoolbox", QString::number(checkBox_showToolbox->isChecked(),10));
|
// config.writeConfig("showtoolbox", QString::number(checkBox_showToolbox->isChecked(),10));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-23
@@ -20,41 +20,21 @@
|
|||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "guiinterface.h"
|
#include "guiinterface.h"
|
||||||
#include "tinyxml.h"
|
#include "configfile.h"
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <direct.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Session::Session(GuiInterface* g) : actualGame(0), myGui(g)
|
Session::Session(GuiInterface* g) : actualGame(0), myGui(g)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Session an mainwindowimpl bergeben
|
// Session an mainwindowimpl bergeben
|
||||||
myGui->setSession(this);
|
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";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
class GuiInterface;
|
class GuiInterface;
|
||||||
class Game;
|
class Game;
|
||||||
|
class ConfigFile;
|
||||||
|
|
||||||
|
|
||||||
class Session{
|
class Session{
|
||||||
@@ -37,9 +38,12 @@ public:
|
|||||||
void startGame(int, int, int);
|
void startGame(int, int, int);
|
||||||
void deleteGame();
|
void deleteGame();
|
||||||
|
|
||||||
|
// void createConfig();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Game *actualGame;
|
Game *actualGame;
|
||||||
GuiInterface *myGui;
|
GuiInterface *myGui;
|
||||||
|
ConfigFile *myConfig;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user