remove ifdef hack for style files loading
This commit is contained in:
@@ -42,7 +42,6 @@ aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c)
|
||||
textBrowser_3->setPalette(myPalette);
|
||||
textBrowser_4->setPalette(myPalette);
|
||||
|
||||
// textBrowser_licence->setSource(QUrl(QDir::toNativeSeparators(myAppDataPath+"misc/gpl2.html")));
|
||||
QFile gplFile(QDir::toNativeSeparators(myAppDataPath+"misc/gpl2.html"));
|
||||
QString gplString;
|
||||
if(gplFile.exists()) {
|
||||
|
||||
@@ -41,7 +41,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
waitStartGameMsgBoxTimer = new QTimer(this);
|
||||
waitStartGameMsgBoxTimer->setSingleShot(TRUE);
|
||||
|
||||
treeWidget_GameList->setStyleSheet("QTreeWidget {background-color: white; background-image: url("+myAppDataPath +"gfx/gui/misc/background_gamelist.png); background-attachment: fixed; background-position: top center ; background-repeat: no-repeat;}");
|
||||
treeWidget_GameList->setStyleSheet("QTreeWidget {background-color: white; background-image: url(\""+myAppDataPath +"gfx/gui/misc/background_gamelist.png\"); background-attachment: fixed; background-position: top center ; background-repeat: no-repeat;}");
|
||||
treeWidget_GameList->setAutoFillBackground(TRUE);
|
||||
|
||||
connect( pushButton_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
|
||||
|
||||
@@ -1077,13 +1077,12 @@ void gameTableImpl::dealHoleCards() {
|
||||
}
|
||||
else {
|
||||
holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(*flipside, TRUE);
|
||||
/* holeCardsArray[i][j]->setStyleSheet("QLabel:hover { background-image:url(:/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");*/
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(onePix, FALSE);
|
||||
// holeCardsArray[i][j]->repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,36 +38,29 @@ CardDeckStyleReader::~CardDeckStyleReader()
|
||||
|
||||
void CardDeckStyleReader::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
|
||||
|
||||
currentFileName = file;
|
||||
}
|
||||
else {
|
||||
currentFileName = QFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml").fileName();
|
||||
#ifdef _WIN32
|
||||
tinyFileName = currentFileName.toStdString();
|
||||
#else
|
||||
tinyFileName = currentFileName.toUtf8().constData();
|
||||
#endif
|
||||
|
||||
currentFileName = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml";
|
||||
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( "CardDeck" ).FirstChild().ToElement();
|
||||
@@ -129,7 +122,7 @@ void CardDeckStyleReader::readStyleFile(QString file) {
|
||||
else {
|
||||
loadedSuccessfull = 0;
|
||||
QMessageBox::warning(myW, tr("Card Deck Style Error"),
|
||||
tr("Can not load card deck style file: %1 \n\nPlease check the style file or choose another style!").arg(tinyFileName.c_str()),
|
||||
tr("Cannot load card deck style file: %1 \n\nPlease check the style file or choose another style!").arg(currentFileName),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ private:
|
||||
|
||||
QString currentFileName;
|
||||
QString currentDir;
|
||||
QByteArray fileContent;
|
||||
|
||||
QStringList cardsLeft;
|
||||
QStringList leftItems;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,6 +271,7 @@ private:
|
||||
QString tabBarPaddingTop;
|
||||
QString tabBarPaddingSide;
|
||||
|
||||
QByteArray fileContent;
|
||||
QString currentFileName;
|
||||
QString currentDir;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user