utf8 for logdir and datadir xml stream
This commit is contained in:
+10
-4
@@ -22,7 +22,8 @@ DEPENDPATH += . \
|
||||
src/gui/qt/createnetworkgamedialog \
|
||||
src/gui/qt/joinnetworkgamedialog \
|
||||
src/gui/qt/log \
|
||||
src/gui/qt/qthelper \
|
||||
src/gui/qt/qttools \
|
||||
src/gui/qt/qttools/qthelper \
|
||||
src/gui/qt/newlocalgamedialog \
|
||||
src/gui/qt/settingsdialog \
|
||||
src/gui/qt/startnetworkgamedialog \
|
||||
@@ -37,9 +38,10 @@ INCLUDEPATH += . \
|
||||
src/core/tinyxml \
|
||||
src/gui/qt \
|
||||
src/gui/qt/log \
|
||||
src/gui/qt/qthelper \
|
||||
src/gui/qt/connecttoserverdialog \
|
||||
src/core \
|
||||
src/gui/qt/qttools \
|
||||
src/gui/qt/qttools/qthelper \
|
||||
src/gui/qt/mainwindow \
|
||||
src/gui/qt/mainwindow/startsplash \
|
||||
src/gui/qt/aboutpokerth \
|
||||
@@ -102,7 +104,9 @@ HEADERS += src/game.h \
|
||||
src/gui/qt/settingsdialog/settingsdialogimpl.h \
|
||||
src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h \
|
||||
src/gui/qt/waitforservertostartgamedialog/waitforservertostartgamedialogimpl.h \
|
||||
src/gui/qt/qthelper/qthelper.h
|
||||
src/gui/qttoolsinterface.h \
|
||||
src/gui/qt/qttools/qttoolswrapper.h \
|
||||
src/gui/qt/qttools/qthelper/qthelper.h
|
||||
FORMS += src/gui/qt/mainwindow.ui \
|
||||
src/gui/qt/aboutpokerth.ui \
|
||||
src/gui/qt/connecttoserverdialog.ui \
|
||||
@@ -174,7 +178,9 @@ SOURCES += src/game.cpp \
|
||||
src/gui/qt/settingsdialog/settingsdialogimpl.cpp \
|
||||
src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp \
|
||||
src/gui/qt/waitforservertostartgamedialog/waitforservertostartgamedialogimpl.cpp \
|
||||
src/gui/qt/qthelper/qthelper.cpp
|
||||
src/gui/qttoolsinterface.cpp \
|
||||
src/gui/qt/qttools/qttoolswrapper.cpp \
|
||||
src/gui/qt/qttools/qthelper/qthelper.cpp
|
||||
RESOURCES += src/gui/qt/resources.qrc
|
||||
|
||||
TEMPLATE = vcapp
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
***************************************************************************/
|
||||
#include "configfile.h"
|
||||
|
||||
#include <qttoolswrapper.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <sys/types.h>
|
||||
@@ -30,6 +32,8 @@
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
class QtToolsWrapper;
|
||||
|
||||
using namespace std;
|
||||
|
||||
ConfigFile::ConfigFile()
|
||||
@@ -120,6 +124,8 @@ ConfigFile::~ConfigFile()
|
||||
|
||||
void ConfigFile::createDefaultConfig() {
|
||||
|
||||
QtToolsInterface *myQtToolsInterface = new QtToolsWrapper;
|
||||
|
||||
//Anlegen!
|
||||
TiXmlDocument doc;
|
||||
TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", "");
|
||||
@@ -127,12 +133,11 @@ void ConfigFile::createDefaultConfig() {
|
||||
|
||||
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);
|
||||
@@ -262,17 +267,20 @@ void ConfigFile::createDefaultConfig() {
|
||||
|
||||
TiXmlElement * confElement20 = new TiXmlElement( "LogDir" );
|
||||
config->LinkEndChild( confElement20 );
|
||||
confElement20->SetAttribute("value", logDir);
|
||||
confElement20->SetAttribute("value", myQtToolsInterface->stringToUtf8(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);
|
||||
confElement31->SetAttribute("value", myQtToolsInterface->stringToUtf8(dataDir));
|
||||
|
||||
doc.SaveFile( configFileName );
|
||||
|
||||
delete myQtToolsInterface;
|
||||
myQtToolsInterface = 0;
|
||||
|
||||
}
|
||||
|
||||
string ConfigFile::readConfigString(string varName)
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "tinyxml.h"
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
class ConfigFile{
|
||||
public:
|
||||
ConfigFile();
|
||||
|
||||
@@ -95,9 +95,6 @@ public:
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -88,9 +88,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>
|
||||
@@ -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);
|
||||
@@ -104,7 +101,6 @@ private:
|
||||
Log *myLog;
|
||||
mainWindowImpl *myW;
|
||||
ConfigFile *myConfig;
|
||||
QtHelper *myQtHelper;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -94,6 +94,8 @@ Log::Log(mainWindowImpl* w) : myW(w)
|
||||
|
||||
Log::~Log()
|
||||
{
|
||||
delete myConfig;
|
||||
myConfig = 0;
|
||||
}
|
||||
|
||||
void Log::logPlayerActionMsg(string playerName, int action, int setValue) {
|
||||
|
||||
@@ -547,7 +547,11 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
|
||||
|
||||
}
|
||||
|
||||
mainWindowImpl::~mainWindowImpl() {}
|
||||
mainWindowImpl::~mainWindowImpl() {
|
||||
|
||||
delete myConfig;
|
||||
myConfig = 0;
|
||||
}
|
||||
|
||||
void mainWindowImpl::callNewGameDialog() {
|
||||
|
||||
|
||||
@@ -20,21 +20,21 @@
|
||||
|
||||
#include "qttoolswrapper.h"
|
||||
|
||||
#include <appdirpath.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
QtToolsWrapper::QtToolsWrapper() : myAppDirPath(0)
|
||||
QtToolsWrapper::QtToolsWrapper() : myQtHelper(0)
|
||||
{
|
||||
|
||||
myAppDirPath = new AppDirPath();
|
||||
myQtHelper = new QtHelper();
|
||||
}
|
||||
|
||||
|
||||
QtToolsWrapper::~QtToolsWrapper()
|
||||
{
|
||||
delete myQtHelper;
|
||||
myQtHelper = 0;
|
||||
}
|
||||
|
||||
std::string QtToolsWrapper::getMyAppDirPath() const { return myAppDirPath->getMyPath(); }
|
||||
std::string QtToolsWrapper::stringToUtf8(const std::string &myString) { return myQtHelper->stringToUtf8(myString); }
|
||||
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
#define QTTOOLSWRAPPER_H
|
||||
|
||||
#include <qttoolsinterface.h>
|
||||
#include <qthelper.h>
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
class AppDirPath;
|
||||
class QtHelper;
|
||||
|
||||
class QtToolsWrapper : public QtToolsInterface
|
||||
{
|
||||
@@ -34,11 +35,11 @@ public:
|
||||
|
||||
~QtToolsWrapper();
|
||||
|
||||
std::string getMyAppDirPath() const;
|
||||
std::string stringToUtf8(const std::string &myString);
|
||||
|
||||
private:
|
||||
|
||||
AppDirPath *myAppDirPath;
|
||||
QtHelper *myQtHelper;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@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 "qttoolsinterface.h"
|
||||
|
||||
QtToolsInterface::~QtToolsInterface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@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 QTTOOLSINTERFACE_H
|
||||
#define QTTOOLSINTERFACE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class QtToolsInterface {
|
||||
public:
|
||||
virtual ~QtToolsInterface();
|
||||
|
||||
//qthelper.cpp
|
||||
virtual std::string stringToUtf8(const std::string &) =0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -42,6 +42,7 @@ Session::~Session()
|
||||
terminateNetworkServer();
|
||||
deleteGame();
|
||||
delete myConfig;
|
||||
myConfig = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user