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> <height>25</height>
</rect> </rect>
</property> </property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<widget class="QMenu" name="menuView"> <widget class="QMenu" name="menuView">
<property name="title"> <property name="title">
<string>&amp;View</string> <string>&amp;View</string>
+3 -2
View File
@@ -3,9 +3,10 @@
MyMenuBar::MyMenuBar(QMainWindow* parent) MyMenuBar::MyMenuBar(QMainWindow* parent)
: QMenuBar(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()) { if(doc.RootElement()) {
TiXmlHandle docHandle( &doc ); 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(); TiXmlElement* itemsList = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).FirstChild().ToElement();
for( ; itemsList; itemsList=itemsList->NextSiblingElement()) { for( ; itemsList; itemsList=itemsList->NextSiblingElement()) {
const char *tmpStr1 = itemsList->Attribute("value"); const char *tmpStr1 = itemsList->Attribute("value");
@@ -117,7 +125,7 @@ void CardDeckStyleReader::readStyleFile(QString file) {
QMessageBox::Ok); QMessageBox::Ok);
} }
} }
}
} }
else { else {
loadedSuccessfull = 0; loadedSuccessfull = 0;
@@ -100,6 +100,13 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(doc.RootElement()) { if(doc.RootElement()) {
TiXmlHandle docHandle( &doc ); 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(); TiXmlElement* itemsList = docHandle.FirstChild( "PokerTH" ).FirstChild( "TableStyle" ).FirstChild().ToElement();
for( ; itemsList; itemsList=itemsList->NextSiblingElement()) { for( ; itemsList; itemsList=itemsList->NextSiblingElement()) {
const char *tmpStr1 = itemsList->Attribute("value"); const char *tmpStr1 = itemsList->Attribute("value");
@@ -477,6 +484,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
} }
} }
} }
}
else { else {
loadedSuccessfull = 0; loadedSuccessfull = 0;
QMessageBox::warning(myW, tr("Game Table Style Error"), QMessageBox::warning(myW, tr("Game Table Style Error"),