remove ifdef hack for style files loading

This commit is contained in:
doitux
2009-04-18 23:17:10 +00:00
parent bde28a9f2a
commit 50cfd57448
7 changed files with 27 additions and 42 deletions
+10 -18
View File
@@ -76,36 +76,28 @@ GameTableStyleReader::~GameTableStyleReader()
void GameTableStyleReader::readStyleFile(QString file) {
string tinyFileName;
//if style file failed --> default style fallback
if(QFile(file).exists()) {
currentFileName = QFile(file).fileName();
#ifdef _WIN32
tinyFileName = currentFileName.toStdString();
#else
tinyFileName = currentFileName.toUtf8().constData();
#endif
}
else {
currentFileName = QFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml").fileName();
#ifdef _WIN32
tinyFileName = currentFileName.toStdString();
#else
tinyFileName = currentFileName.toUtf8().constData();
#endif
fallBack = 1;
}
QFile myFile(currentFileName);
myFile.open(QIODevice::ReadOnly | QIODevice::Text);
fileContent = myFile.readAll();
QFileInfo info(currentFileName);
currentDir = info.absolutePath()+"/";
//start reading the file and fill vars
string tempString1("");
TiXmlDocument doc(tinyFileName);
if(doc.LoadFile()) {
TiXmlDocument doc;
doc.Parse(fileContent.constData());
if(doc.RootElement()) {
TiXmlHandle docHandle( &doc );
TiXmlElement* itemsList = docHandle.FirstChild( "PokerTH" ).FirstChild( "TableStyle" ).FirstChild().ToElement();
@@ -488,7 +480,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
else {
loadedSuccessfull = 0;
QMessageBox::warning(myW, tr("Game Table Style Error"),
tr("Cannot load game table style file: %1 \n\nPlease check the style file or choose another style!").arg(tinyFileName.c_str()),
tr("Cannot load game table style file: %1 \n\nPlease check the style file or choose another style!").arg(currentFileName),
QMessageBox::Ok);
}
}