error handling for card deck styles

This commit is contained in:
doitux
2009-04-03 09:03:31 +00:00
parent 2e28dfc83b
commit dddd1a4da3
3 changed files with 30 additions and 3 deletions
+24
View File
@@ -67,11 +67,35 @@ void CardDeckStyleReader::readStyleFile(QString file) {
tempString1 = tmpStr1;
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 { 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);
}
+5 -2
View File
@@ -42,16 +42,19 @@ public:
QString getPreview() const { return Preview; }
bool getFallBack() const { return fallBack; }
void showErrorMessage(QString, QStringList, QString);
private:
QString StyleDescription;
QString StyleDescription;
QString StyleMaintainerEMail;
QString Preview;
QString currentFileName;
QString currentDir;
QStringList cardsLeft;
ConfigFile *myConfig;
gameTableImpl *myW;
+1 -1
View File
@@ -328,7 +328,7 @@ void GameTableStyleReader::showErrorMessage(QString style, QStringList failedIte
QString items = failedItems.join(", ");
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);
}