error handling for card deck styles
This commit is contained in:
@@ -67,11 +67,35 @@ void CardDeckStyleReader::readStyleFile(QString file) {
|
|||||||
tempString1 = tmpStr1;
|
tempString1 = tmpStr1;
|
||||||
|
|
||||||
if(itemsList->ValueStr() == "StyleDescription") { StyleDescription = QString::fromUtf8(tempString1.c_str()); }
|
if(itemsList->ValueStr() == "StyleDescription") { StyleDescription = QString::fromUtf8(tempString1.c_str()); }
|
||||||
|
else if(itemsList->ValueStr() == "StyleMaintainerEMail") { StyleMaintainerEMail = QString::fromUtf8(tempString1.c_str()); }
|
||||||
else if (itemsList->ValueStr() == "Preview") { Preview = currentDir+QString::fromUtf8(tempString1.c_str()); }
|
else if (itemsList->ValueStr() == "Preview") { Preview = currentDir+QString::fromUtf8(tempString1.c_str()); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else { qDebug() << "could not load card deck file: " << tinyFileName.c_str(); }
|
else { qDebug() << "could not load card deck file: " << tinyFileName.c_str(); }
|
||||||
|
|
||||||
|
//check if all files are there
|
||||||
|
cardsLeft.clear();
|
||||||
|
int i;
|
||||||
|
for(i=0; i<52; i++) {
|
||||||
|
QString cardString(QString::number(i)+".png");
|
||||||
|
if(!QDir(currentDir).exists(cardString)) {
|
||||||
|
cardsLeft << cardString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!QDir(currentDir).exists("flipside.png")) {
|
||||||
|
cardsLeft << "flipside.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!cardsLeft.isEmpty() && myW != 0) showErrorMessage(StyleDescription, cardsLeft, StyleMaintainerEMail);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardDeckStyleReader::showErrorMessage(QString style, QStringList failedItems, QString email)
|
||||||
|
{
|
||||||
|
QString items = failedItems.join(", ");
|
||||||
|
|
||||||
|
QMessageBox::warning(myW, tr("Card Deck Style Error"),
|
||||||
|
tr("Selected card deck style \"%1\" seems to be incomplete or defective. \nThe card picture(s) \"%2\" is/are not available. \n\nPlease contact the card deck style builder %3.").arg(style).arg(items).arg(email),
|
||||||
|
QMessageBox::Ok);
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,16 +42,19 @@ public:
|
|||||||
QString getPreview() const { return Preview; }
|
QString getPreview() const { return Preview; }
|
||||||
|
|
||||||
bool getFallBack() const { return fallBack; }
|
bool getFallBack() const { return fallBack; }
|
||||||
|
void showErrorMessage(QString, QStringList, QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QString StyleDescription;
|
QString StyleDescription;
|
||||||
|
QString StyleMaintainerEMail;
|
||||||
QString Preview;
|
QString Preview;
|
||||||
|
|
||||||
QString currentFileName;
|
QString currentFileName;
|
||||||
QString currentDir;
|
QString currentDir;
|
||||||
|
|
||||||
|
QStringList cardsLeft;
|
||||||
|
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
gameTableImpl *myW;
|
gameTableImpl *myW;
|
||||||
|
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ void GameTableStyleReader::showErrorMessage(QString style, QStringList failedIte
|
|||||||
QString items = failedItems.join(", ");
|
QString items = failedItems.join(", ");
|
||||||
|
|
||||||
QMessageBox::warning(myW, tr("Game Table Style Error"),
|
QMessageBox::warning(myW, tr("Game Table Style Error"),
|
||||||
tr("Selected game table style \"%1\" seems to be incomplete or defective. \nThe value of \"%2\" is wrong or left. Please contact the style builder %3.").arg(style).arg(items).arg(email),
|
tr("Selected game table style \"%1\" seems to be incomplete or defective. \nThe value(s) of \"%2\" is/are wrong or left. \n\nPlease contact the game table style builder %3.").arg(style).arg(items).arg(email),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user