path to UTF8
configfile split
This commit is contained in:
@@ -90,13 +90,11 @@ public:
|
||||
// virtual void timerBlockerFalse() const=0;
|
||||
virtual void meInAction() const=0;
|
||||
|
||||
|
||||
//log.cpp
|
||||
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
|
||||
virtual void logNewGameHandMsg(int gameID, int HandID) =0;
|
||||
|
||||
//qthelper.cpp
|
||||
virtual std::string stringToUtf8(const std::string &) =0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -21,11 +21,13 @@
|
||||
#include "session.h"
|
||||
#include "configfile.h"
|
||||
|
||||
createNetworkGameDialogImpl::createNetworkGameDialogImpl(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
createNetworkGameDialogImpl::createNetworkGameDialogImpl(QWidget *parent, std::string path)
|
||||
: QDialog(parent), myConfig(0)
|
||||
{
|
||||
|
||||
setupUi(this);
|
||||
myConfig = new ConfigFile(path);
|
||||
|
||||
setupUi(this);
|
||||
|
||||
fillFormular();
|
||||
|
||||
@@ -46,14 +48,13 @@ void createNetworkGameDialogImpl::cancel() {
|
||||
void createNetworkGameDialogImpl::fillFormular() {
|
||||
|
||||
//Formulare Füllen
|
||||
ConfigFile myConfig;
|
||||
|
||||
//Network Game Settings
|
||||
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NetNumberOfPlayers"));
|
||||
spinBox_startCash->setValue(myConfig.readConfigInt("NetStartCash"));
|
||||
spinBox_smallBlind->setValue(myConfig.readConfigInt("NetSmallBlind"));
|
||||
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("NetHandsBeforeRaiseSmallBlind"));
|
||||
spinBox_gameSpeed->setValue(myConfig.readConfigInt("NetGameSpeed"));
|
||||
spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NetNumberOfPlayers"));
|
||||
spinBox_startCash->setValue(myConfig->readConfigInt("NetStartCash"));
|
||||
spinBox_smallBlind->setValue(myConfig->readConfigInt("NetSmallBlind"));
|
||||
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig->readConfigInt("NetHandsBeforeRaiseSmallBlind"));
|
||||
spinBox_gameSpeed->setValue(myConfig->readConfigInt("NetGameSpeed"));
|
||||
}
|
||||
|
||||
void createNetworkGameDialogImpl::showDialog() {
|
||||
|
||||
@@ -23,15 +23,18 @@
|
||||
#include "ui_createnetworkgamedialog.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <QtGui>
|
||||
#include <QtCore>
|
||||
|
||||
class Session;
|
||||
class ConfigFile;
|
||||
|
||||
|
||||
class createNetworkGameDialogImpl: public QDialog, public Ui::createNetworkGameDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
createNetworkGameDialogImpl(QWidget *parent = 0);
|
||||
createNetworkGameDialogImpl(QWidget *parent = 0, std::string = "");
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -40,6 +43,10 @@ public slots:
|
||||
void fillFormular();
|
||||
void showDialog();
|
||||
void keyPressEvent ( QKeyEvent * event );
|
||||
private:
|
||||
|
||||
ConfigFile *myConfig;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by Felix Hammer *
|
||||
* f.hammer@web.de *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "defaultconfig.h"
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#define MODUS 0711
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
DefaultConfig::DefaultConfig()
|
||||
{
|
||||
// !!!! Revisionsnummer der Configdefaults !!!!!
|
||||
configRev = 17;
|
||||
|
||||
// Pfad und Dateinamen setzen
|
||||
#ifdef _WIN32
|
||||
const char *appDataPath = getenv("AppData");
|
||||
if (appDataPath && appDataPath[0] != 0) {
|
||||
configFileName = appDataPath;
|
||||
}
|
||||
else {
|
||||
const int MaxPathSize = 1024;
|
||||
char curDir[MaxPathSize + 1];
|
||||
curDir[0] = 0;
|
||||
_getcwd(curDir, MaxPathSize);
|
||||
curDir[MaxPathSize] = 0;
|
||||
configFileName = curDir;
|
||||
// Testen ob das Verzeichnis beschreibbar ist
|
||||
ofstream tmpFile;
|
||||
const char *tmpFileName = "pokerth_test.tmp";
|
||||
tmpFile.open((configFileName + "\\" + tmpFileName).c_str());
|
||||
if (tmpFile) {
|
||||
// Erfolgreich, Verzeichnis beschreibbar.
|
||||
// Datei wieder loeschen.
|
||||
tmpFile.close();
|
||||
remove((configFileName + "\\" + tmpFileName).c_str());
|
||||
}
|
||||
else {
|
||||
// Fehlgeschlagen, Verzeichnis nicht beschreibbar
|
||||
curDir[0] = 0;
|
||||
GetTempPathA(MaxPathSize, curDir);
|
||||
curDir[MaxPathSize] = 0;
|
||||
configFileName = curDir;
|
||||
}
|
||||
}
|
||||
|
||||
//UTF8 !!!!
|
||||
QString tmpString = QString::fromStdString(configFileName);
|
||||
configFileName = tmpString.toUtf8().constData();
|
||||
//UTF8 !!!!
|
||||
|
||||
|
||||
//Programmordner erstellen
|
||||
configFileName += "\\pokerth\\";
|
||||
mkdir(configFileName.c_str());
|
||||
//Log-File Ordner auch erstellen
|
||||
logDir = configFileName;
|
||||
logDir += "log-files\\";
|
||||
mkdir(logDir.c_str());
|
||||
//data Ordner auch erstellen
|
||||
dataDir = configFileName;
|
||||
dataDir += "data\\";
|
||||
mkdir(dataDir.c_str());
|
||||
|
||||
#else
|
||||
//Programmordner erstellen
|
||||
const char *homePath = getenv("HOME");
|
||||
if(homePath) {
|
||||
configFileName = homePath;
|
||||
configFileName += "/.pokerth/";
|
||||
mkdir(configFileName.c_str(), MODUS) ;
|
||||
//Log-File Ordner auch erstellen
|
||||
logDir = configFileName;
|
||||
logDir += "log-files/";
|
||||
mkdir(logDir.c_str(), MODUS);
|
||||
//data Ordner auch erstellen
|
||||
dataDir = configFileName;
|
||||
dataDir += "data/";
|
||||
mkdir(dataDir.c_str(), MODUS);
|
||||
}
|
||||
#endif
|
||||
configFileName += "config.xml";
|
||||
|
||||
//Prüfen ob Configfile existiert --> sonst anlegen
|
||||
|
||||
TiXmlDocument doc(configFileName);
|
||||
if(!doc.LoadFile()){ createDefaultConfig(); }
|
||||
else {
|
||||
|
||||
//Prüfen ob die Revision stimmt ansonsten löschen und neue anlegen
|
||||
int temp = 0;
|
||||
TiXmlHandle docHandle( &doc );
|
||||
TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "ConfigRevision" ).ToElement();
|
||||
if ( conf ) { conf->QueryIntAttribute("value", &temp ); }
|
||||
|
||||
if (temp < configRev) { /*löschen()*/ createDefaultConfig() ;}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
DefaultConfig::~DefaultConfig()
|
||||
{
|
||||
}
|
||||
|
||||
void DefaultConfig::createDefaultConfig() {
|
||||
|
||||
//Anlegen!
|
||||
TiXmlDocument doc;
|
||||
TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", "");
|
||||
doc.LinkEndChild( decl );
|
||||
|
||||
TiXmlElement * root = new TiXmlElement( "PokerTH" );
|
||||
doc.LinkEndChild( root );
|
||||
//
|
||||
TiXmlElement * config;
|
||||
config = new TiXmlElement( "Configuration" );
|
||||
root->LinkEndChild( config );
|
||||
|
||||
|
||||
TiXmlElement * confElement0 = new TiXmlElement( "ConfigRevision" );
|
||||
config->LinkEndChild( confElement0 );
|
||||
confElement0->SetAttribute("value", configRev);
|
||||
TiXmlElement * confElement11 = new TiXmlElement( "ShowLeftToolBox" );
|
||||
config->LinkEndChild( confElement11 );
|
||||
confElement11->SetAttribute("value", 1);
|
||||
TiXmlElement * confElement22 = new TiXmlElement( "ShowRightToolBox" );
|
||||
config->LinkEndChild( confElement22 );
|
||||
confElement22->SetAttribute("value", 1);
|
||||
TiXmlElement * confElement43 = new TiXmlElement( "ShowStatusbarMessages" );
|
||||
config->LinkEndChild( confElement43 );
|
||||
confElement43->SetAttribute("value", 1);
|
||||
TiXmlElement * confElement13 = new TiXmlElement( "ShowIntro" );
|
||||
config->LinkEndChild( confElement13 );
|
||||
confElement13->SetAttribute("value", 1);
|
||||
TiXmlElement * confElement15 = new TiXmlElement( "ShowFadeOutCardsAnimation" );
|
||||
config->LinkEndChild( confElement15 );
|
||||
confElement15->SetAttribute("value", 1);
|
||||
TiXmlElement * confElement19 = new TiXmlElement( "ShowFlipCardsAnimation" );
|
||||
config->LinkEndChild( confElement19 );
|
||||
confElement19->SetAttribute("value", 1);
|
||||
TiXmlElement * confElement16 = new TiXmlElement( "FlipsideTux" );
|
||||
config->LinkEndChild( confElement16 );
|
||||
confElement16->SetAttribute("value", 1);
|
||||
TiXmlElement * confElement17 = new TiXmlElement( "FlipsideOwn" );
|
||||
config->LinkEndChild( confElement17 );
|
||||
confElement17->SetAttribute("value", 0);
|
||||
TiXmlElement * confElement18 = new TiXmlElement( "FlipsideOwnFile" );
|
||||
config->LinkEndChild( confElement18 );
|
||||
confElement18->SetAttribute("value", "");
|
||||
|
||||
TiXmlElement * confElement1 = new TiXmlElement( "NumberOfPlayers" );
|
||||
config->LinkEndChild( confElement1 );
|
||||
confElement1->SetAttribute("value", 7);
|
||||
TiXmlElement * confElement2 = new TiXmlElement( "StartCash" );
|
||||
config->LinkEndChild( confElement2 );
|
||||
confElement2->SetAttribute("value", 3000);
|
||||
TiXmlElement * confElement3 = new TiXmlElement( "SmallBlind" );
|
||||
config->LinkEndChild( confElement3 );
|
||||
confElement3->SetAttribute("value", 10);
|
||||
TiXmlElement * confElement12 = new TiXmlElement( "HandsBeforeRaiseSmallBlind" );
|
||||
config->LinkEndChild( confElement12 );
|
||||
confElement12->SetAttribute("value", 8);
|
||||
TiXmlElement * confElement4 = new TiXmlElement( "GameSpeed" );
|
||||
config->LinkEndChild( confElement4 );
|
||||
confElement4->SetAttribute("value", 4);
|
||||
TiXmlElement * confElement32 = new TiXmlElement( "EngineVersion" );
|
||||
config->LinkEndChild( confElement32 );
|
||||
confElement32->SetAttribute("value", 0);
|
||||
TiXmlElement * confElement14 = new TiXmlElement( "PauseBetweenHands" );
|
||||
config->LinkEndChild( confElement14 );
|
||||
confElement14->SetAttribute("value", 0);
|
||||
TiXmlElement * confElement5 = new TiXmlElement( "ShowGameSettingsDialogOnNewGame" );
|
||||
config->LinkEndChild( confElement5 );
|
||||
confElement5->SetAttribute("value", 1);
|
||||
|
||||
TiXmlElement * confElement23 = new TiXmlElement( "NetNumberOfPlayers" );
|
||||
config->LinkEndChild( confElement23 );
|
||||
confElement23->SetAttribute("value", 7);
|
||||
TiXmlElement * confElement24 = new TiXmlElement( "NetStartCash" );
|
||||
config->LinkEndChild( confElement24 );
|
||||
confElement24->SetAttribute("value", 2000);
|
||||
TiXmlElement * confElement25 = new TiXmlElement( "NetSmallBlind" );
|
||||
config->LinkEndChild( confElement25 );
|
||||
confElement25->SetAttribute("value", 10);
|
||||
TiXmlElement * confElement26 = new TiXmlElement( "NetHandsBeforeRaiseSmallBlind" );
|
||||
config->LinkEndChild( confElement26 );
|
||||
confElement26->SetAttribute("value", 9);
|
||||
TiXmlElement * confElement27 = new TiXmlElement( "NetGameSpeed" );
|
||||
config->LinkEndChild( confElement27 );
|
||||
confElement27->SetAttribute("value", 4);
|
||||
TiXmlElement * confElement33 = new TiXmlElement( "NetEngineVersion" );
|
||||
config->LinkEndChild( confElement33 );
|
||||
confElement33->SetAttribute("value", 1);
|
||||
TiXmlElement * confElement28 = new TiXmlElement( "ServerPassword" );
|
||||
config->LinkEndChild( confElement28 );
|
||||
confElement28->SetAttribute("value", "");
|
||||
TiXmlElement * confElement29 = new TiXmlElement( "ServerUseIpv6" );
|
||||
config->LinkEndChild( confElement29 );
|
||||
confElement29->SetAttribute("value", 0);
|
||||
TiXmlElement * confElement30 = new TiXmlElement( "ServerPort" );
|
||||
config->LinkEndChild( confElement30 );
|
||||
confElement30->SetAttribute("value", 7234);
|
||||
|
||||
TiXmlElement * confElement6 = new TiXmlElement( "MyName" );
|
||||
config->LinkEndChild( confElement6 );
|
||||
confElement6->SetAttribute("value", "Human Player");
|
||||
TiXmlElement * confElement34 = new TiXmlElement( "MyAvatar" );
|
||||
config->LinkEndChild( confElement34 );
|
||||
confElement34->SetAttribute("value", "");
|
||||
TiXmlElement * confElement7 = new TiXmlElement( "Opponent1Name" );
|
||||
config->LinkEndChild( confElement7 );
|
||||
confElement7->SetAttribute("value", "Player 1");
|
||||
TiXmlElement * confElement35 = new TiXmlElement( "Opponent1Avatar" );
|
||||
config->LinkEndChild( confElement35 );
|
||||
confElement35->SetAttribute("value", "");
|
||||
TiXmlElement * confElement8 = new TiXmlElement( "Opponent2Name" );
|
||||
config->LinkEndChild( confElement8 );
|
||||
confElement8->SetAttribute("value", "Player 2");
|
||||
TiXmlElement * confElement36 = new TiXmlElement( "Opponent2Avatar" );
|
||||
config->LinkEndChild( confElement36 );
|
||||
confElement36->SetAttribute("value", "");
|
||||
TiXmlElement * confElement9 = new TiXmlElement( "Opponent3Name" );
|
||||
config->LinkEndChild( confElement9 );
|
||||
confElement9->SetAttribute("value", "Player 3");
|
||||
TiXmlElement * confElement37 = new TiXmlElement( "Opponent3Avatar" );
|
||||
config->LinkEndChild( confElement37 );
|
||||
confElement37->SetAttribute("value", "");
|
||||
TiXmlElement * confElement10 = new TiXmlElement( "Opponent4Name" );
|
||||
config->LinkEndChild( confElement10 );
|
||||
confElement10->SetAttribute("value", "Player 4");
|
||||
TiXmlElement * confElement38 = new TiXmlElement( "Opponent4Avatar" );
|
||||
config->LinkEndChild( confElement38 );
|
||||
confElement38->SetAttribute("value", "");
|
||||
TiXmlElement * confElement39 = new TiXmlElement( "Opponent5Name" );
|
||||
config->LinkEndChild( confElement39 );
|
||||
confElement39->SetAttribute("value", "Player 5");
|
||||
TiXmlElement * confElement40 = new TiXmlElement( "Opponent5Avatar" );
|
||||
config->LinkEndChild( confElement40 );
|
||||
confElement40->SetAttribute("value", "");
|
||||
TiXmlElement * confElement41 = new TiXmlElement( "Opponent6Name" );
|
||||
config->LinkEndChild( confElement41 );
|
||||
confElement41->SetAttribute("value", "Player 6");
|
||||
TiXmlElement * confElement42 = new TiXmlElement( "Opponent6Avatar" );
|
||||
config->LinkEndChild( confElement42 );
|
||||
confElement42->SetAttribute("value", "");
|
||||
|
||||
TiXmlElement * confElement20 = new TiXmlElement( "LogDir" );
|
||||
config->LinkEndChild( confElement20 );
|
||||
confElement20->SetAttribute("value", logDir);
|
||||
TiXmlElement * confElement21 = new TiXmlElement( "LogStoreDuration" );
|
||||
config->LinkEndChild( confElement21 );
|
||||
confElement21->SetAttribute("value", 2);
|
||||
|
||||
TiXmlElement * confElement31 = new TiXmlElement( "DataDir" );
|
||||
config->LinkEndChild( confElement31 );
|
||||
confElement31->SetAttribute("value", dataDir);
|
||||
|
||||
doc.SaveFile( configFileName );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by Felix Hammer *
|
||||
* f.hammer@web.de *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef DEFAULTCONFIG_H
|
||||
#define DEFAULTCONFIG_H
|
||||
|
||||
#include "tinyxml.h"
|
||||
#include <string>
|
||||
|
||||
class DefaultConfig{
|
||||
public:
|
||||
DefaultConfig();
|
||||
|
||||
~DefaultConfig();
|
||||
|
||||
void createDefaultConfig();
|
||||
|
||||
std::string getMyPath() const { return configFileName; }
|
||||
|
||||
private:
|
||||
std::string configFileName;
|
||||
std::string logDir;
|
||||
std::string dataDir;
|
||||
int configRev;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -24,16 +24,13 @@
|
||||
using namespace std;
|
||||
|
||||
|
||||
GuiWrapper::GuiWrapper() : myLog(0), myW(0)
|
||||
GuiWrapper::GuiWrapper(Session *session) : myLog(0), myW(0)
|
||||
{
|
||||
|
||||
|
||||
myW = new mainWindowImpl;
|
||||
myW = new mainWindowImpl(session);
|
||||
myW->show();
|
||||
|
||||
myLog = new Log(myW);
|
||||
myConfig = new ConfigFile;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -88,9 +85,6 @@ void GuiWrapper::meInAction() const { myW->meInAction(); }
|
||||
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->logPlayerActionMsg(playerName, action, setValue); }
|
||||
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->logNewGameHandMsg(gameID, handID); }
|
||||
|
||||
std::string GuiWrapper::stringToUtf8(const std::string &myString) { return myQtHelper->stringToUtf8(myString); }
|
||||
|
||||
|
||||
void GuiWrapper::SignalNetClientConnect(int actionID) { myW->SignalNetClientConnect(actionID); }
|
||||
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->SignalNetClientGameInfo(actionID); }
|
||||
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->SignalNetClientError(errorID, osErrorID); }
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "log.h"
|
||||
#include "mainwindowimpl.h"
|
||||
#include "connecttoserverdialogimpl.h"
|
||||
#include "qthelper.h"
|
||||
#include "configfile.h"
|
||||
|
||||
#include <string>
|
||||
@@ -39,7 +38,7 @@
|
||||
class GuiWrapper : public GuiInterface
|
||||
{
|
||||
public:
|
||||
GuiWrapper();
|
||||
GuiWrapper(Session*);
|
||||
|
||||
~GuiWrapper();
|
||||
|
||||
@@ -89,8 +88,6 @@ public:
|
||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||
void logNewGameHandMsg(int gameID, int handID) ;
|
||||
|
||||
std::string stringToUtf8(const std::string &);
|
||||
|
||||
void SignalNetClientConnect(int actionID);
|
||||
void SignalNetClientGameInfo(int actionID);
|
||||
void SignalNetClientError(int errorID, int osErrorID);
|
||||
@@ -103,8 +100,6 @@ private:
|
||||
|
||||
Log *myLog;
|
||||
mainWindowImpl *myW;
|
||||
ConfigFile *myConfig;
|
||||
QtHelper *myQtHelper;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
joinNetworkGameDialogImpl::joinNetworkGameDialogImpl(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
joinNetworkGameDialogImpl::joinNetworkGameDialogImpl(QWidget *parent, std::string path)
|
||||
: QDialog(parent), myConfig(0)
|
||||
{
|
||||
|
||||
setupUi(this);
|
||||
myConfig = new ConfigFile(path);
|
||||
|
||||
setupUi(this);
|
||||
|
||||
//Profile Name darf nicht mit einer Zahl beginnen --> XML konform
|
||||
QRegExp rx("[A-Z|a-z]+[A-Z|a-z|\\d]*");
|
||||
@@ -39,7 +40,7 @@ joinNetworkGameDialogImpl::joinNetworkGameDialogImpl(QWidget *parent)
|
||||
|
||||
lineEdit_ipAddress->setFocus();
|
||||
|
||||
myServerProfilesFile = myConfig.readConfigString("DataDir")+"serverprofiles.xml";
|
||||
myServerProfilesFile = myConfig->readConfigString("DataDir")+"serverprofiles.xml";
|
||||
|
||||
//Anlegen wenn noch nicht existiert!
|
||||
QFile serverProfilesfile(QString::fromUtf8(myServerProfilesFile.c_str()));
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "configfile.h"
|
||||
#include <QtGui>
|
||||
#include <QtCore>
|
||||
|
||||
@@ -34,9 +33,9 @@ class ConfigFile;
|
||||
class joinNetworkGameDialogImpl: public QDialog, public Ui::joinNetworkGameDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
joinNetworkGameDialogImpl(QWidget *parent = 0);
|
||||
joinNetworkGameDialogImpl(QWidget *parent = 0, std::string = "");
|
||||
|
||||
ConfigFile myConfig;
|
||||
|
||||
std::string myServerProfilesFile;
|
||||
|
||||
public slots:
|
||||
@@ -47,6 +46,9 @@ public slots:
|
||||
void saveServerProfile();
|
||||
void deleteServerProfile();
|
||||
void keyPressEvent ( QKeyEvent * event );
|
||||
|
||||
private:
|
||||
ConfigFile *myConfig;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "mainwindowimpl.h"
|
||||
#include <game_defs.h>
|
||||
#include "session.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -28,7 +29,8 @@ Log::Log(mainWindowImpl* w) : myW(w)
|
||||
{
|
||||
myW->setLog(this);
|
||||
|
||||
myConfig = new ConfigFile;
|
||||
myConfig = new ConfigFile(myW->getSession()->getConfigPath());
|
||||
|
||||
if(myConfig->readConfigString("LogDir") != "" && QDir::QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str())).exists()) {
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
class mainWindowImpl;
|
||||
|
||||
|
||||
class Log{
|
||||
public:
|
||||
Log(mainWindowImpl*);
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include "log.h"
|
||||
#include "configfile.h"
|
||||
#include "defaultconfig.h"
|
||||
|
||||
#include <net/socket_msg.h>
|
||||
|
||||
@@ -48,8 +49,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
mainWindowImpl::mainWindowImpl(QMainWindow *parent)
|
||||
: QMainWindow(parent), actualGame(0), actualHand(0), mySession(0), gameSpeed(0), debugMode(0), breakAfterActualHand(FALSE)
|
||||
mainWindowImpl::mainWindowImpl(Session* s, QMainWindow *parent)
|
||||
: QMainWindow(parent), actualGame(0), actualHand(0), mySession(s), gameSpeed(0), debugMode(0), breakAfterActualHand(FALSE)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -59,7 +60,13 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
|
||||
}
|
||||
////////////////////////////
|
||||
|
||||
myConfig = new ConfigFile;
|
||||
//Create Defaultconfig if there is no one
|
||||
DefaultConfig myDefaultConfig;
|
||||
|
||||
//set SessionConfigPath
|
||||
mySession->setConfigPath(myDefaultConfig.getMyPath());
|
||||
|
||||
myConfig = new ConfigFile(mySession->getConfigPath());
|
||||
|
||||
// Resourcen abladen
|
||||
QFile preflopValuesFile(":data/resources/data/preflopValues");
|
||||
@@ -479,10 +486,10 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
|
||||
}
|
||||
|
||||
//Dialoge
|
||||
myJoinNetworkGameDialog = new joinNetworkGameDialogImpl(this);
|
||||
myJoinNetworkGameDialog = new joinNetworkGameDialogImpl(this, mySession->getConfigPath());
|
||||
myConnectToServerDialog = new connectToServerDialogImpl(this);
|
||||
myStartNetworkGameDialog = new startNetworkGameDialogImpl(this);
|
||||
myCreateNetworkGameDialog = new createNetworkGameDialogImpl(this);
|
||||
myCreateNetworkGameDialog = new createNetworkGameDialogImpl(this, mySession->getConfigPath());
|
||||
myWaitingForServerGameDialog = new waitForServerToStartGameDialogImpl(this);
|
||||
|
||||
//Connects
|
||||
@@ -554,7 +561,7 @@ void mainWindowImpl::callNewGameDialog() {
|
||||
//wenn Dialogfenster gezeigt werden soll
|
||||
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")){
|
||||
|
||||
newGameDialogImpl *v = new newGameDialogImpl(this);
|
||||
newGameDialogImpl *v = new newGameDialogImpl(this, mySession->getConfigPath());
|
||||
v->exec();
|
||||
if (v->result() == QDialog::Accepted ) { startNewLocalGame(v); }
|
||||
// else { startNewLocalGame(); }
|
||||
@@ -685,7 +692,7 @@ void mainWindowImpl::callJoinNetworkGameDialog() {
|
||||
|
||||
void mainWindowImpl::callSettingsDialog() {
|
||||
|
||||
settingsDialogImpl *v = new settingsDialogImpl(this);
|
||||
settingsDialogImpl *v = new settingsDialogImpl(this, mySession->getConfigPath());
|
||||
v->exec();
|
||||
|
||||
|
||||
@@ -826,7 +833,7 @@ void mainWindowImpl::refreshPlayerAvatar() {
|
||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
|
||||
if(!i) {
|
||||
if(actualHand->getPlayerArray()[0]->getMyAvatar() == "") {
|
||||
if(actualHand->getPlayerArray()[0]->getMyAvatar() == ""/* || !QDir::QDir(QString::fromUtf8(actualHand->getPlayerArray()[0]->getMyAvatar().c_str())).exists()*/) {
|
||||
playerAvatarLabelArray[0]->setPixmap(QPixmap(":/guiv2/resources/guiv2/genereticAvatar.png"));
|
||||
}
|
||||
else {
|
||||
@@ -834,7 +841,7 @@ void mainWindowImpl::refreshPlayerAvatar() {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(actualHand->getPlayerArray()[i]->getMyAvatar() == "") {
|
||||
if(actualHand->getPlayerArray()[i]->getMyAvatar() == ""/* || !QDir::QDir(QString::fromUtf8(actualHand->getPlayerArray()[i]->getMyAvatar().c_str())).exists()*/) {
|
||||
playerAvatarLabelArray[i]->setPixmap(QPixmap(":/guiv2/resources/guiv2/genereticAvatar.png"));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -53,13 +53,14 @@ class mainWindowImpl: public QMainWindow, public Ui::mainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
mainWindowImpl(QMainWindow *parent = 0 );
|
||||
mainWindowImpl(Session* = 0, QMainWindow *parent = 0 );
|
||||
|
||||
~mainWindowImpl();
|
||||
|
||||
void setGame(Game*);
|
||||
void setHand(HandInterface*);
|
||||
void setSession(Session*);
|
||||
Session* getSession() { return mySession; }
|
||||
void setLog(Log*);
|
||||
|
||||
void setActualHand(HandInterface* theValue) { actualHand = theValue;}
|
||||
|
||||
@@ -20,22 +20,22 @@
|
||||
#include "newgamedialogimpl.h"
|
||||
#include "configfile.h"
|
||||
|
||||
newGameDialogImpl::newGameDialogImpl(QWidget *parent)
|
||||
newGameDialogImpl::newGameDialogImpl(QWidget *parent, std::string path)
|
||||
: QDialog(parent)
|
||||
{
|
||||
|
||||
setupUi(this);
|
||||
|
||||
//Formulare Füllen
|
||||
ConfigFile myConfig;
|
||||
myConfig = new ConfigFile(path);
|
||||
|
||||
//Game Settings
|
||||
|
||||
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers"));
|
||||
spinBox_startCash->setValue(myConfig.readConfigInt("StartCash"));
|
||||
spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind"));
|
||||
spinBox_gameSpeed->setValue(myConfig.readConfigInt("GameSpeed"));
|
||||
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("HandsBeforeRaiseSmallBlind"));
|
||||
spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NumberOfPlayers"));
|
||||
spinBox_startCash->setValue(myConfig->readConfigInt("StartCash"));
|
||||
spinBox_smallBlind->setValue(myConfig->readConfigInt("SmallBlind"));
|
||||
spinBox_gameSpeed->setValue(myConfig->readConfigInt("GameSpeed"));
|
||||
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig->readConfigInt("HandsBeforeRaiseSmallBlind"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,17 +23,22 @@
|
||||
#include "ui_newgamedialog.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <QtGui>
|
||||
#include <QtCore>
|
||||
|
||||
class ConfigFile;
|
||||
|
||||
class newGameDialogImpl: public QDialog, public Ui::newGameDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
newGameDialogImpl(QWidget *parent = 0);
|
||||
newGameDialogImpl(QWidget *parent = 0, std::string = "");
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
private:
|
||||
ConfigFile *myConfig;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// C++ Implementation: qthelper
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: FThauer FHammer <webmaster@pokerth.net>, (C) 2007
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#include "qthelper.h"
|
||||
|
||||
QtHelper::QtHelper()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QtHelper::~QtHelper()
|
||||
{
|
||||
}
|
||||
|
||||
std::string QtHelper::stringToUtf8(const std::string &myString) {
|
||||
|
||||
QString tmpString = QString::fromStdString(myString);
|
||||
std::string myUtf8String = tmpString.toUtf8().constData();
|
||||
|
||||
return myUtf8String;
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
//
|
||||
// C++ Interface: qthelper
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// Author: FThauer FHammer <webmaster@pokerth.net>, (C) 2007
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#ifndef QTHELPER_H
|
||||
#define QTHELPER_H
|
||||
|
||||
#include <QtCore>
|
||||
/**
|
||||
@author FThauer FHammer <webmaster@pokerth.net>
|
||||
*/
|
||||
class QtHelper{
|
||||
public:
|
||||
QtHelper();
|
||||
|
||||
~QtHelper();
|
||||
|
||||
std::string stringToUtf8(const std::string &);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -22,9 +22,10 @@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
settingsDialogImpl::settingsDialogImpl(QWidget *parent)
|
||||
settingsDialogImpl::settingsDialogImpl(QWidget *parent, std::string path)
|
||||
: QDialog(parent)
|
||||
{
|
||||
myConfig = new ConfigFile(path);
|
||||
|
||||
setupUi(this);
|
||||
|
||||
@@ -35,64 +36,64 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent)
|
||||
playerNickIsChanged = FALSE;
|
||||
|
||||
//Formulare Füllen
|
||||
ConfigFile myConfig;
|
||||
|
||||
|
||||
//Player Nicks
|
||||
lineEdit_humanPlayerName->setText(QString::fromUtf8(myConfig.readConfigString("MyName").c_str()));
|
||||
lineEdit_humanPlayerAvatar->setText(QString::fromUtf8(myConfig.readConfigString("MyAvatar").c_str()));
|
||||
lineEdit_Opponent1Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent1Name").c_str()));
|
||||
lineEdit_Opponent1Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent1Avatar").c_str()));
|
||||
lineEdit_Opponent2Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent2Name").c_str()));
|
||||
lineEdit_Opponent2Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent2Avatar").c_str()));
|
||||
lineEdit_Opponent3Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent3Name").c_str()));
|
||||
lineEdit_Opponent3Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent3Avatar").c_str()));
|
||||
lineEdit_Opponent4Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent4Name").c_str()));
|
||||
lineEdit_Opponent4Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent4Avatar").c_str()));
|
||||
lineEdit_Opponent5Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent5Name").c_str()));
|
||||
lineEdit_Opponent5Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent5Avatar").c_str()));
|
||||
lineEdit_Opponent6Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent6Name").c_str()));
|
||||
lineEdit_Opponent6Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent6Avatar").c_str()));
|
||||
lineEdit_humanPlayerName->setText(QString::fromUtf8(myConfig->readConfigString("MyName").c_str()));
|
||||
lineEdit_humanPlayerAvatar->setText(QString::fromUtf8(myConfig->readConfigString("MyAvatar").c_str()));
|
||||
lineEdit_Opponent1Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent1Name").c_str()));
|
||||
lineEdit_Opponent1Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent1Avatar").c_str()));
|
||||
lineEdit_Opponent2Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent2Name").c_str()));
|
||||
lineEdit_Opponent2Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent2Avatar").c_str()));
|
||||
lineEdit_Opponent3Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent3Name").c_str()));
|
||||
lineEdit_Opponent3Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent3Avatar").c_str()));
|
||||
lineEdit_Opponent4Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent4Name").c_str()));
|
||||
lineEdit_Opponent4Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent4Avatar").c_str()));
|
||||
lineEdit_Opponent5Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent5Name").c_str()));
|
||||
lineEdit_Opponent5Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent5Avatar").c_str()));
|
||||
lineEdit_Opponent6Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent6Name").c_str()));
|
||||
lineEdit_Opponent6Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent6Avatar").c_str()));
|
||||
|
||||
//Local Game Settings
|
||||
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers"));
|
||||
spinBox_startCash->setValue(myConfig.readConfigInt("StartCash"));
|
||||
spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind"));
|
||||
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("HandsBeforeRaiseSmallBlind"));
|
||||
spinBox_gameSpeed->setValue(myConfig.readConfigInt("GameSpeed"));
|
||||
checkBox_pauseBetweenHands->setChecked(myConfig.readConfigInt("PauseBetweenHands"));
|
||||
checkBox_showGameSettingsDialogOnNewGame->setChecked(myConfig.readConfigInt("ShowGameSettingsDialogOnNewGame"));
|
||||
comboBox_engineVersion->setCurrentIndex(myConfig.readConfigInt("EngineVersion"));
|
||||
spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NumberOfPlayers"));
|
||||
spinBox_startCash->setValue(myConfig->readConfigInt("StartCash"));
|
||||
spinBox_smallBlind->setValue(myConfig->readConfigInt("SmallBlind"));
|
||||
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig->readConfigInt("HandsBeforeRaiseSmallBlind"));
|
||||
spinBox_gameSpeed->setValue(myConfig->readConfigInt("GameSpeed"));
|
||||
checkBox_pauseBetweenHands->setChecked(myConfig->readConfigInt("PauseBetweenHands"));
|
||||
checkBox_showGameSettingsDialogOnNewGame->setChecked(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame"));
|
||||
comboBox_engineVersion->setCurrentIndex(myConfig->readConfigInt("EngineVersion"));
|
||||
|
||||
//Network Game Settings
|
||||
spinBox_netQuantityPlayers->setValue(myConfig.readConfigInt("NetNumberOfPlayers"));
|
||||
spinBox_netStartCash->setValue(myConfig.readConfigInt("NetStartCash"));
|
||||
spinBox_netSmallBlind->setValue(myConfig.readConfigInt("NetSmallBlind"));
|
||||
spinBox_netHandsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("NetHandsBeforeRaiseSmallBlind"));
|
||||
spinBox_netGameSpeed->setValue(myConfig.readConfigInt("NetGameSpeed"));
|
||||
comboBox_netEngineVersion->setCurrentIndex(myConfig.readConfigInt("NetEngineVersion"));
|
||||
spinBox_serverPort->setValue(myConfig.readConfigInt("ServerPort"));
|
||||
lineEdit_serverPassword->setText(QString::fromUtf8(myConfig.readConfigString("ServerPassword").c_str()));
|
||||
checkBox_useIpv6->setChecked(myConfig.readConfigInt("ServerUseIpv6"));
|
||||
spinBox_netQuantityPlayers->setValue(myConfig->readConfigInt("NetNumberOfPlayers"));
|
||||
spinBox_netStartCash->setValue(myConfig->readConfigInt("NetStartCash"));
|
||||
spinBox_netSmallBlind->setValue(myConfig->readConfigInt("NetSmallBlind"));
|
||||
spinBox_netHandsBeforeRaiseSmallBlind->setValue(myConfig->readConfigInt("NetHandsBeforeRaiseSmallBlind"));
|
||||
spinBox_netGameSpeed->setValue(myConfig->readConfigInt("NetGameSpeed"));
|
||||
comboBox_netEngineVersion->setCurrentIndex(myConfig->readConfigInt("NetEngineVersion"));
|
||||
spinBox_serverPort->setValue(myConfig->readConfigInt("ServerPort"));
|
||||
lineEdit_serverPassword->setText(QString::fromUtf8(myConfig->readConfigString("ServerPassword").c_str()));
|
||||
checkBox_useIpv6->setChecked(myConfig->readConfigInt("ServerUseIpv6"));
|
||||
|
||||
|
||||
//Interface
|
||||
checkBox_showLeftToolbox->setChecked(myConfig.readConfigInt("ShowLeftToolBox"));
|
||||
checkBox_showRightToolbox->setChecked(myConfig.readConfigInt("ShowRightToolBox"));
|
||||
checkBox_showStatusbarMessages->setChecked(myConfig.readConfigInt("ShowStatusbarMessages"));
|
||||
checkBox_showIntro->setChecked(myConfig.readConfigInt("ShowIntro"));
|
||||
checkBox_showFadeOutCardsAnimation->setChecked(myConfig.readConfigInt("ShowFadeOutCardsAnimation"));
|
||||
checkBox_showFlipCardsAnimation->setChecked(myConfig.readConfigInt("ShowFlipCardsAnimation"));
|
||||
radioButton_flipsideTux->setChecked(myConfig.readConfigInt("FlipsideTux"));
|
||||
radioButton_flipsideOwn->setChecked(myConfig.readConfigInt("FlipsideOwn"));
|
||||
checkBox_showLeftToolbox->setChecked(myConfig->readConfigInt("ShowLeftToolBox"));
|
||||
checkBox_showRightToolbox->setChecked(myConfig->readConfigInt("ShowRightToolBox"));
|
||||
checkBox_showStatusbarMessages->setChecked(myConfig->readConfigInt("ShowStatusbarMessages"));
|
||||
checkBox_showIntro->setChecked(myConfig->readConfigInt("ShowIntro"));
|
||||
checkBox_showFadeOutCardsAnimation->setChecked(myConfig->readConfigInt("ShowFadeOutCardsAnimation"));
|
||||
checkBox_showFlipCardsAnimation->setChecked(myConfig->readConfigInt("ShowFlipCardsAnimation"));
|
||||
radioButton_flipsideTux->setChecked(myConfig->readConfigInt("FlipsideTux"));
|
||||
radioButton_flipsideOwn->setChecked(myConfig->readConfigInt("FlipsideOwn"));
|
||||
if(radioButton_flipsideOwn->isChecked()) {
|
||||
lineEdit_OwnFlipsideFilename->setEnabled(TRUE);
|
||||
pushButton_openFlipsidePicture->setEnabled(TRUE);
|
||||
}
|
||||
lineEdit_OwnFlipsideFilename->setText(QString::fromUtf8(myConfig.readConfigString("FlipsideOwnFile").c_str()));
|
||||
lineEdit_OwnFlipsideFilename->setText(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
|
||||
|
||||
//Log
|
||||
lineEdit_logDir->setText(QString::fromUtf8(myConfig.readConfigString("LogDir").c_str()));
|
||||
spinBox_logStoreDuration->setValue(myConfig.readConfigInt("LogStoreDuration"));
|
||||
lineEdit_logDir->setText(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
||||
spinBox_logStoreDuration->setValue(myConfig->readConfigInt("LogStoreDuration"));
|
||||
|
||||
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) );
|
||||
connect( lineEdit_humanPlayerName, SIGNAL( textChanged( const QString &) ), this, SLOT( playerNickChanged() ) );
|
||||
@@ -118,12 +119,11 @@ void settingsDialogImpl::isAccepted() {
|
||||
settingsCorrect = TRUE;
|
||||
|
||||
//Daten speichern
|
||||
ConfigFile myConfig;
|
||||
|
||||
// Player Nicks
|
||||
myConfig.writeConfigString("MyName", lineEdit_humanPlayerName->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("MyName", lineEdit_humanPlayerName->text().toUtf8().constData());
|
||||
if(QFile::QFile(lineEdit_humanPlayerAvatar->text()).exists() || lineEdit_humanPlayerAvatar->text() == "") {
|
||||
myConfig.writeConfigString("MyAvatar", lineEdit_humanPlayerAvatar->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("MyAvatar", lineEdit_humanPlayerAvatar->text().toUtf8().constData());
|
||||
}
|
||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||
tr("The entered human player avatar picture doesn't exists.\n"
|
||||
@@ -132,9 +132,9 @@ void settingsDialogImpl::isAccepted() {
|
||||
settingsCorrect = FALSE;
|
||||
}
|
||||
|
||||
myConfig.writeConfigString("Opponent1Name", lineEdit_Opponent1Name->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent1Name", lineEdit_Opponent1Name->text().toUtf8().constData());
|
||||
if(QFile::QFile(lineEdit_Opponent1Avatar->text()).exists() || lineEdit_Opponent1Avatar->text() == "") {
|
||||
myConfig.writeConfigString("Opponent1Avatar", lineEdit_Opponent1Avatar->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent1Avatar", lineEdit_Opponent1Avatar->text().toUtf8().constData());
|
||||
}
|
||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||
tr("The entered \"opponent 1\" avatar picture doesn't exists.\n"
|
||||
@@ -143,9 +143,9 @@ void settingsDialogImpl::isAccepted() {
|
||||
settingsCorrect = FALSE;
|
||||
}
|
||||
|
||||
myConfig.writeConfigString("Opponent2Name", lineEdit_Opponent2Name->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent2Name", lineEdit_Opponent2Name->text().toUtf8().constData());
|
||||
if(QFile::QFile(lineEdit_Opponent2Avatar->text()).exists() || lineEdit_Opponent2Avatar->text() == "") {
|
||||
myConfig.writeConfigString("Opponent2Avatar", lineEdit_Opponent2Avatar->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent2Avatar", lineEdit_Opponent2Avatar->text().toUtf8().constData());
|
||||
}
|
||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||
tr("The entered \"opponent 2\" avatar picture doesn't exists.\n"
|
||||
@@ -154,9 +154,9 @@ void settingsDialogImpl::isAccepted() {
|
||||
settingsCorrect = FALSE;
|
||||
}
|
||||
|
||||
myConfig.writeConfigString("Opponent3Name", lineEdit_Opponent3Name->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent3Name", lineEdit_Opponent3Name->text().toUtf8().constData());
|
||||
if(QFile::QFile(lineEdit_Opponent3Avatar->text()).exists() || lineEdit_Opponent3Avatar->text() == "") {
|
||||
myConfig.writeConfigString("Opponent3Avatar", lineEdit_Opponent3Avatar->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent3Avatar", lineEdit_Opponent3Avatar->text().toUtf8().constData());
|
||||
}
|
||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||
tr("The entered \"opponent 3\" avatar picture doesn't exists.\n"
|
||||
@@ -165,9 +165,9 @@ void settingsDialogImpl::isAccepted() {
|
||||
settingsCorrect = FALSE;
|
||||
}
|
||||
|
||||
myConfig.writeConfigString("Opponent4Name", lineEdit_Opponent4Name->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent4Name", lineEdit_Opponent4Name->text().toUtf8().constData());
|
||||
if(QFile::QFile(lineEdit_Opponent4Avatar->text()).exists() || lineEdit_Opponent4Avatar->text() == "") {
|
||||
myConfig.writeConfigString("Opponent4Avatar", lineEdit_Opponent4Avatar->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent4Avatar", lineEdit_Opponent4Avatar->text().toUtf8().constData());
|
||||
}
|
||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||
tr("The entered \"opponent 4\" avatar picture doesn't exists.\n"
|
||||
@@ -176,9 +176,9 @@ void settingsDialogImpl::isAccepted() {
|
||||
settingsCorrect = FALSE;
|
||||
}
|
||||
|
||||
myConfig.writeConfigString("Opponent5Name", lineEdit_Opponent5Name->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent5Name", lineEdit_Opponent5Name->text().toUtf8().constData());
|
||||
if(QFile::QFile(lineEdit_Opponent5Avatar->text()).exists() || lineEdit_Opponent5Avatar->text() == "") {
|
||||
myConfig.writeConfigString("Opponent5Avatar", lineEdit_Opponent5Avatar->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent5Avatar", lineEdit_Opponent5Avatar->text().toUtf8().constData());
|
||||
}
|
||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||
tr("The entered \"opponent 5\" avatar picture doesn't exists.\n"
|
||||
@@ -187,9 +187,9 @@ void settingsDialogImpl::isAccepted() {
|
||||
settingsCorrect = FALSE;
|
||||
}
|
||||
|
||||
myConfig.writeConfigString("Opponent6Name", lineEdit_Opponent6Name->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent6Name", lineEdit_Opponent6Name->text().toUtf8().constData());
|
||||
if(QFile::QFile(lineEdit_Opponent6Avatar->text()).exists() || lineEdit_Opponent6Avatar->text() == "") {
|
||||
myConfig.writeConfigString("Opponent6Avatar", lineEdit_Opponent6Avatar->text().toUtf8().constData());
|
||||
myConfig->writeConfigString("Opponent6Avatar", lineEdit_Opponent6Avatar->text().toUtf8().constData());
|
||||
}
|
||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||
tr("The entered \"opponent 6\" avatar picture doesn't exists.\n"
|
||||
@@ -199,38 +199,38 @@ void settingsDialogImpl::isAccepted() {
|
||||
}
|
||||
|
||||
// Local Game Settings
|
||||
myConfig.writeConfigInt("NumberOfPlayers", spinBox_quantityPlayers->value());
|
||||
myConfig.writeConfigInt("StartCash", spinBox_startCash->value());
|
||||
myConfig.writeConfigInt("SmallBlind", spinBox_smallBlind->value());
|
||||
myConfig.writeConfigInt("HandsBeforeRaiseSmallBlind", spinBox_handsBeforeRaiseSmallBlind->value());
|
||||
myConfig.writeConfigInt("GameSpeed", spinBox_gameSpeed->value());
|
||||
myConfig.writeConfigInt("EngineVersion", comboBox_engineVersion->currentIndex());
|
||||
myConfig.writeConfigInt("PauseBetweenHands", checkBox_pauseBetweenHands->isChecked());
|
||||
myConfig.writeConfigInt("ShowGameSettingsDialogOnNewGame", checkBox_showGameSettingsDialogOnNewGame->isChecked());
|
||||
myConfig->writeConfigInt("NumberOfPlayers", spinBox_quantityPlayers->value());
|
||||
myConfig->writeConfigInt("StartCash", spinBox_startCash->value());
|
||||
myConfig->writeConfigInt("SmallBlind", spinBox_smallBlind->value());
|
||||
myConfig->writeConfigInt("HandsBeforeRaiseSmallBlind", spinBox_handsBeforeRaiseSmallBlind->value());
|
||||
myConfig->writeConfigInt("GameSpeed", spinBox_gameSpeed->value());
|
||||
myConfig->writeConfigInt("EngineVersion", comboBox_engineVersion->currentIndex());
|
||||
myConfig->writeConfigInt("PauseBetweenHands", checkBox_pauseBetweenHands->isChecked());
|
||||
myConfig->writeConfigInt("ShowGameSettingsDialogOnNewGame", checkBox_showGameSettingsDialogOnNewGame->isChecked());
|
||||
|
||||
//Network Game Settings
|
||||
myConfig.writeConfigInt("NetNumberOfPlayers", spinBox_netQuantityPlayers->value());
|
||||
myConfig.writeConfigInt("NetStartCash", spinBox_netStartCash->value());
|
||||
myConfig.writeConfigInt("NetSmallBlind", spinBox_netSmallBlind->value());
|
||||
myConfig.writeConfigInt("NetHandsBeforeRaiseSmallBlind", spinBox_netHandsBeforeRaiseSmallBlind->value());
|
||||
myConfig.writeConfigInt("NetGameSpeed", spinBox_netGameSpeed->value());
|
||||
myConfig.writeConfigInt("NetEngineVersion", comboBox_netEngineVersion->currentIndex());
|
||||
myConfig.writeConfigInt("ServerPort", spinBox_serverPort->value());
|
||||
myConfig.writeConfigString("ServerPassword", lineEdit_serverPassword->text().toUtf8().constData());
|
||||
myConfig.writeConfigInt("ServerUseIpv6", checkBox_useIpv6->isChecked());
|
||||
myConfig->writeConfigInt("NetNumberOfPlayers", spinBox_netQuantityPlayers->value());
|
||||
myConfig->writeConfigInt("NetStartCash", spinBox_netStartCash->value());
|
||||
myConfig->writeConfigInt("NetSmallBlind", spinBox_netSmallBlind->value());
|
||||
myConfig->writeConfigInt("NetHandsBeforeRaiseSmallBlind", spinBox_netHandsBeforeRaiseSmallBlind->value());
|
||||
myConfig->writeConfigInt("NetGameSpeed", spinBox_netGameSpeed->value());
|
||||
myConfig->writeConfigInt("NetEngineVersion", comboBox_netEngineVersion->currentIndex());
|
||||
myConfig->writeConfigInt("ServerPort", spinBox_serverPort->value());
|
||||
myConfig->writeConfigString("ServerPassword", lineEdit_serverPassword->text().toUtf8().constData());
|
||||
myConfig->writeConfigInt("ServerUseIpv6", checkBox_useIpv6->isChecked());
|
||||
|
||||
// Interface
|
||||
myConfig.writeConfigInt("ShowLeftToolBox", checkBox_showLeftToolbox->isChecked());
|
||||
myConfig.writeConfigInt("ShowRightToolBox", checkBox_showRightToolbox->isChecked());
|
||||
myConfig.writeConfigInt("ShowStatusbarMessages", checkBox_showStatusbarMessages->isChecked());
|
||||
myConfig.writeConfigInt("ShowIntro", checkBox_showIntro->isChecked());
|
||||
myConfig.writeConfigInt("ShowFadeOutCardsAnimation", checkBox_showFadeOutCardsAnimation->isChecked());
|
||||
myConfig.writeConfigInt("ShowFlipCardsAnimation", checkBox_showFlipCardsAnimation->isChecked());
|
||||
myConfig.writeConfigInt("FlipsideTux", radioButton_flipsideTux->isChecked());
|
||||
myConfig.writeConfigInt("FlipsideOwn", radioButton_flipsideOwn->isChecked());
|
||||
myConfig->writeConfigInt("ShowLeftToolBox", checkBox_showLeftToolbox->isChecked());
|
||||
myConfig->writeConfigInt("ShowRightToolBox", checkBox_showRightToolbox->isChecked());
|
||||
myConfig->writeConfigInt("ShowStatusbarMessages", checkBox_showStatusbarMessages->isChecked());
|
||||
myConfig->writeConfigInt("ShowIntro", checkBox_showIntro->isChecked());
|
||||
myConfig->writeConfigInt("ShowFadeOutCardsAnimation", checkBox_showFadeOutCardsAnimation->isChecked());
|
||||
myConfig->writeConfigInt("ShowFlipCardsAnimation", checkBox_showFlipCardsAnimation->isChecked());
|
||||
myConfig->writeConfigInt("FlipsideTux", radioButton_flipsideTux->isChecked());
|
||||
myConfig->writeConfigInt("FlipsideOwn", radioButton_flipsideOwn->isChecked());
|
||||
|
||||
if(radioButton_flipsideOwn->isChecked()) {
|
||||
if(QFile::QFile(lineEdit_OwnFlipsideFilename->text()).exists() && lineEdit_OwnFlipsideFilename->text() != "") {myConfig.writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toUtf8().constData()); }
|
||||
if(QFile::QFile(lineEdit_OwnFlipsideFilename->text()).exists() && lineEdit_OwnFlipsideFilename->text() != "") {myConfig->writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toUtf8().constData()); }
|
||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||
tr("The entered flipside picture doesn't exists.\n"
|
||||
"Please enter an valid picture!"),
|
||||
@@ -240,7 +240,7 @@ void settingsDialogImpl::isAccepted() {
|
||||
}
|
||||
|
||||
// Log
|
||||
if(QDir::QDir(lineEdit_logDir->text()).exists() && lineEdit_logDir->text() != "") { myConfig.writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData()); }
|
||||
if(QDir::QDir(lineEdit_logDir->text()).exists() && lineEdit_logDir->text() != "") { myConfig->writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData()); }
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Settings Error"),
|
||||
tr("The log file directory doesn't exists.\n"
|
||||
@@ -249,7 +249,7 @@ void settingsDialogImpl::isAccepted() {
|
||||
settingsCorrect = FALSE;
|
||||
}
|
||||
|
||||
myConfig.writeConfigInt("LogStoreDuration", spinBox_logStoreDuration->value());
|
||||
myConfig->writeConfigInt("LogStoreDuration", spinBox_logStoreDuration->value());
|
||||
|
||||
//Wenn alles richtig eingegeben wurde --> Dialog schließen
|
||||
if(settingsCorrect) { this->hide(); }
|
||||
|
||||
@@ -22,14 +22,16 @@
|
||||
|
||||
#include "ui_settingsdialog.h"
|
||||
|
||||
#include <string>
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
|
||||
class ConfigFile;
|
||||
|
||||
class settingsDialogImpl: public QDialog, public Ui::settingsDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
settingsDialogImpl(QWidget *parent = 0);
|
||||
settingsDialogImpl(QWidget *parent = 0, std::string = "");
|
||||
|
||||
void setPlayerNickIsChanged(bool theValue){ playerNickIsChanged = theValue;}
|
||||
bool getPlayerNickIsChanged() const{ return playerNickIsChanged;}
|
||||
@@ -53,6 +55,7 @@ private:
|
||||
|
||||
bool playerNickIsChanged;
|
||||
bool settingsCorrect;
|
||||
ConfigFile *myConfig;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user