From 363377b6a67a7727ad7bd79e25143ee6b6cc271b Mon Sep 17 00:00:00 2001 From: doitux Date: Sat, 5 May 2007 20:38:43 +0000 Subject: [PATCH] buggy->fixed!!! --- src/config/configfile.cpp | 18 +++++++++++++----- src/config/configfile.h | 4 ++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index 5a141244..30ab19b1 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -113,8 +113,8 @@ ConfigFile::ConfigFile(bool configFirstStart) //Prüfen ob Configfile existiert --> sonst anlegen TiXmlDocument doc(configFileName); if(!doc.LoadFile()){ - CONFIGSTATE = Inexistens; - updateConfig(CONFIGSTATE); + configState = nonexisting; + updateConfig(configState); } else { //Prüfen ob die Revision stimmt ansonsten löschen und neue anlegen @@ -123,8 +123,8 @@ ConfigFile::ConfigFile(bool configFirstStart) TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "ConfigRevision" ).ToElement(); if ( conf ) { conf->QueryIntAttribute("value", &temp ); } if (temp < configRev) { /*löschen()*/ - CONFIGSTATE = Old; - updateConfig(CONFIGSTATE) ; + configState = old; + updateConfig(configState) ; } } } @@ -135,10 +135,18 @@ ConfigFile::~ConfigFile() { } -void ConfigFile::updateConfig(CONFIGSTATE) { +void ConfigFile::updateConfig(CONFIGSTATE myConfigState) { QtToolsInterface *myQtToolsInterface = new QtToolsWrapper; + if(myConfigState == old) { + configFileName += "config.xml"; + TiXmlDocument doc(configFileName); + TiXmlHandle docHandle( &doc ); + TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "ConfigRevision" ).ToElement(); + + } + //Anlegen! TiXmlDocument doc; TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); diff --git a/src/config/configfile.h b/src/config/configfile.h index bacfb975..4aedd48a 100644 --- a/src/config/configfile.h +++ b/src/config/configfile.h @@ -23,7 +23,7 @@ #include "tinyxml.h" #include -enum CONFIGSTATE { Inexistens, Old }; +enum CONFIGSTATE { nonexisting, old }; class ConfigFile{ public: @@ -46,7 +46,7 @@ private: std::string dataDir; int configRev; - + CONFIGSTATE configState; }; #endif