buggy->fixed!!!
This commit is contained in:
@@ -113,8 +113,8 @@ ConfigFile::ConfigFile(bool configFirstStart)
|
|||||||
//Prüfen ob Configfile existiert --> sonst anlegen
|
//Prüfen ob Configfile existiert --> sonst anlegen
|
||||||
TiXmlDocument doc(configFileName);
|
TiXmlDocument doc(configFileName);
|
||||||
if(!doc.LoadFile()){
|
if(!doc.LoadFile()){
|
||||||
CONFIGSTATE = Inexistens;
|
configState = nonexisting;
|
||||||
updateConfig(CONFIGSTATE);
|
updateConfig(configState);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Prüfen ob die Revision stimmt ansonsten löschen und neue anlegen
|
//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();
|
TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "ConfigRevision" ).ToElement();
|
||||||
if ( conf ) { conf->QueryIntAttribute("value", &temp ); }
|
if ( conf ) { conf->QueryIntAttribute("value", &temp ); }
|
||||||
if (temp < configRev) { /*löschen()*/
|
if (temp < configRev) { /*löschen()*/
|
||||||
CONFIGSTATE = Old;
|
configState = old;
|
||||||
updateConfig(CONFIGSTATE) ;
|
updateConfig(configState) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,10 +135,18 @@ ConfigFile::~ConfigFile()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigFile::updateConfig(CONFIGSTATE) {
|
void ConfigFile::updateConfig(CONFIGSTATE myConfigState) {
|
||||||
|
|
||||||
QtToolsInterface *myQtToolsInterface = new QtToolsWrapper;
|
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!
|
//Anlegen!
|
||||||
TiXmlDocument doc;
|
TiXmlDocument doc;
|
||||||
TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", "");
|
TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", "");
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "tinyxml.h"
|
#include "tinyxml.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
enum CONFIGSTATE { Inexistens, Old };
|
enum CONFIGSTATE { nonexisting, old };
|
||||||
|
|
||||||
class ConfigFile{
|
class ConfigFile{
|
||||||
public:
|
public:
|
||||||
@@ -46,7 +46,7 @@ private:
|
|||||||
std::string dataDir;
|
std::string dataDir;
|
||||||
int configRev;
|
int configRev;
|
||||||
|
|
||||||
|
CONFIGSTATE configState;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user