advanced error handling for style readers

This commit is contained in:
doitux
2009-04-24 22:53:52 +00:00
parent 5a912803a4
commit 973030eb54
5 changed files with 398 additions and 384 deletions
-3
View File
@@ -3535,9 +3535,6 @@
<height>25</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<widget class="QMenu" name="menuView">
<property name="title">
<string>&amp;View</string>
+3 -2
View File
@@ -3,9 +3,10 @@
MyMenuBar::MyMenuBar(QMainWindow* parent)
: QMenuBar(parent)
{
//this->setAttribute(Qt::WA_TranslucentBackground);
}
void MyMenuBar::paintEvent(QPaintEvent * event) {
void MyMenuBar::paintEvent(QPaintEvent *e) {
QMenuBar::paintEvent(event);
QMenuBar::paintEvent(e);
}
+9 -1
View File
@@ -63,6 +63,14 @@ void CardDeckStyleReader::readStyleFile(QString file) {
if(doc.RootElement()) {
TiXmlHandle docHandle( &doc );
TiXmlElement *GameTableElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "TableStyle" ).ToElement();
if(GameTableElement) {
QMessageBox::warning(myW, tr("Card Deck Style Error"),
tr("You wanna add a card deck style but selected a game table style.\nPlease choose a card deck style and try again!"),
QMessageBox::Ok);
}
else {
TiXmlElement* itemsList = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).FirstChild().ToElement();
for( ; itemsList; itemsList=itemsList->NextSiblingElement()) {
const char *tmpStr1 = itemsList->Attribute("value");
@@ -117,7 +125,7 @@ void CardDeckStyleReader::readStyleFile(QString file) {
QMessageBox::Ok);
}
}
}
}
else {
loadedSuccessfull = 0;
+18 -10
View File
@@ -100,19 +100,26 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(doc.RootElement()) {
TiXmlHandle docHandle( &doc );
TiXmlElement *CardDeckElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).ToElement();
if(CardDeckElement) {
QMessageBox::warning(myW, tr("Game Table Style Error"),
tr("You wanna add a game table style but selected a card deck style.\nPlease choose a game table style and try again!"),
QMessageBox::Ok);
}
else {
TiXmlElement* itemsList = docHandle.FirstChild( "PokerTH" ).FirstChild( "TableStyle" ).FirstChild().ToElement();
for( ; itemsList; itemsList=itemsList->NextSiblingElement()) {
const char *tmpStr1 = itemsList->Attribute("value");
if (tmpStr1) {
tempString1 = tmpStr1;
// INFOS
// INFOS
if(itemsList->ValueStr() == "StyleDescription") { StyleDescription = QString::fromUtf8(tempString1.c_str()); }
else if(itemsList->ValueStr() == "StyleMaintainerName") { StyleMaintainerName = QString::fromUtf8(tempString1.c_str()); }
else if(itemsList->ValueStr() == "StyleMaintainerEMail") { StyleMaintainerEMail = QString::fromUtf8(tempString1.c_str()); }
else if(itemsList->ValueStr() == "StyleCreateDate") { StyleCreateDate = QString::fromUtf8(tempString1.c_str()); }
else if(itemsList->ValueStr() == "PokerTHStyleFileVersion") { PokerTHStyleFileVersion = QString::fromUtf8(tempString1.c_str()); }
// WINDOWS SETTINGS
// WINDOWS SETTINGS
else if (itemsList->ValueStr() == "IfFixedWindowSize") { IfFixedWindowSize = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "FixedWindowWidth") { FixedWindowWidth = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "FixedWindowHeight") { FixedWindowHeight = QString::fromUtf8(tempString1.c_str()); }
@@ -120,7 +127,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
else if (itemsList->ValueStr() == "MinimumWindowHeight") { MinimumWindowHeight = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "MaximumWindowWidth") { MaximumWindowWidth = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "MaximumWindowHeight") { MaximumWindowHeight = QString::fromUtf8(tempString1.c_str()); }
// PICS
// PICS
else if (itemsList->ValueStr() == "Preview") { Preview = currentDir+QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "ActionAllInI18NPic") { ActionAllInI18NPic = currentDir+QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "ActionRaiseI18NPic") { ActionRaiseI18NPic = currentDir+QString::fromUtf8(tempString1.c_str()); }
@@ -182,7 +189,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
else if (itemsList->ValueStr() == "TurnI18NString") { TurnI18NString = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "RiverI18NString") { RiverI18NString = QString::fromUtf8(tempString1.c_str()); }
// COLORS
// COLORS
else if (itemsList->ValueStr() == "FKeyIndicatorColor") { FKeyIndicatorColor = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "ChanceLabelPossibleColor") { ChanceLabelPossibleColor = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "ChanceLabelImpossibleColor") { ChanceLabelImpossibleColor = QString::fromUtf8(tempString1.c_str()); }
@@ -234,7 +241,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
else if (itemsList->ValueStr() == "BetSpeedSliderGrooveBorderColor") { BetSpeedSliderGrooveBorderColor = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "BetSpeedSliderHandleBgColor") { BetSpeedSliderHandleBgColor = QString::fromUtf8(tempString1.c_str()); }
else if (itemsList->ValueStr() == "BetSpeedSliderHandleBorderColor") { BetSpeedSliderHandleBorderColor = QString::fromUtf8(tempString1.c_str()); }
// SIZES
// SIZES
else if (itemsList->ValueStr() == "ChatLogTextSize") { ChatLogTextSize = QString::fromUtf8(tempString1.c_str()); }
}
}
@@ -243,13 +250,13 @@ void GameTableStyleReader::readStyleFile(QString file) {
leftItems.clear();
itemPicsLeft.clear();
// INFOS
// INFOS
if(StyleDescription == "") { leftItems << "StyleDescription"; }
if(StyleMaintainerName == "") { leftItems << "StyleMaintainerName"; }
if(StyleMaintainerEMail == "") { leftItems << "StyleMaintainerEMail"; }
if(StyleCreateDate == "") { leftItems << "StyleCreateDate"; }
if(PokerTHStyleFileVersion == "") { leftItems << "PokerTHStyleFileVersion"; }
// WINDOWS SETTINGS
// WINDOWS SETTINGS
if(IfFixedWindowSize == "") { leftItems << "IfFixedWindowSize"; }
if(FixedWindowWidth == "") { leftItems << "FixedWindowWidth"; }
if(FixedWindowHeight == "") { leftItems << "FixedWindowHeight"; }
@@ -257,7 +264,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(MinimumWindowHeight == "") { leftItems << "MinimumWindowHeight"; }
if(MaximumWindowWidth == "") { leftItems << "MaximumWindowWidth"; }
if(MaximumWindowHeight == "") { leftItems << "MaximumWindowHeight"; }
// PICS
// PICS
if(ActionAllInI18NPic == "") { leftItems << "ActionAllInI18NPic"; }
else if(ActionAllInI18NPic != QString(currentDir+"NULL") && !QFile(ActionAllInI18NPic).exists()) { itemPicsLeft << "ActionAllInI18NPic = "+ActionAllInI18NPic; }
@@ -401,7 +408,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(TurnI18NString == "") { leftItems << "TurnI18NString"; }
if(RiverI18NString == "") { leftItems << "RiverI18NString"; }
// COLORS
// COLORS
if(FKeyIndicatorColor == "") { leftItems << "FKeyIndicatorColor"; }
if(ChanceLabelPossibleColor == "") { leftItems << "ChanceLabelPossibleColor"; }
if(ChanceLabelImpossibleColor == "") { leftItems << "ChanceLabelImpossibleColor"; }
@@ -453,7 +460,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(BetSpeedSliderGrooveBorderColor == "") { leftItems << "BetSpeedSliderGrooveBorderColor"; }
if(BetSpeedSliderHandleBgColor == "") { leftItems << "BetSpeedSliderHandleBgColor"; }
if(BetSpeedSliderHandleBorderColor == "") { leftItems << "BetSpeedSliderHandleBorderColor"; }
// SIZE
// SIZE
if(ChatLogTextSize == "") { leftItems << "ChatLogTextSize"; }
//set loadedSuccessfull TRUE if everything works
@@ -477,6 +484,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
}
}
}
}
else {
loadedSuccessfull = 0;
QMessageBox::warning(myW, tr("Game Table Style Error"),