diff --git a/src/musredit/PAdmin.cpp b/src/musredit/PAdmin.cpp index 3db17322..95fe9992 100644 --- a/src/musredit/PAdmin.cpp +++ b/src/musredit/PAdmin.cpp @@ -416,6 +416,66 @@ bool PAdminXMLParser::endDocument() return true; } +//-------------------------------------------------------------------------- +/** + *
+ * + * \param exception + */ +bool PAdminXMLParser::warning( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**WARNING** while parsing musredit_startup.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**WARNING MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + +//-------------------------------------------------------------------------- +/** + *
+ * + * \param exception + */ +bool PAdminXMLParser::error( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**ERROR** while parsing musredit_startup.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**ERROR MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::critical(0, "ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + +//-------------------------------------------------------------------------- +/** + *
+ * + * \param exception + */ +bool PAdminXMLParser::fatalError( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**FATAL ERROR** while parsing musredit_startup.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**FATAL ERROR MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::critical(0, "FATAL ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + //-------------------------------------------------------------------------- /** *
Expands system variables to full path, e.g. $HOME -> \home\user
@@ -510,7 +570,12 @@ PAdmin::PAdmin()
QXmlInputSource source( &xmlFile );
QXmlSimpleReader reader;
reader.setContentHandler( &handler );
- reader.parse( source );
+ reader.setErrorHandler( &handler );
+ if (!reader.parse( source )) {
+ QMessageBox::critical(0, "ERROR",
+ "Error parsing musredit_startup.xml settings file.\nProbably a few things will not work porperly.\nPlease fix this first.",
+ QMessageBox::Ok, QMessageBox::NoButton);
+ }
} else {
QMessageBox::critical(0, "ERROR",
"Couldn't find the musredit_startup.xml settings file.\nProbably a few things will not work porperly.\nPlease fix this first.",
diff --git a/src/musredit/PAdmin.h b/src/musredit/PAdmin.h
index d2d037d2..47c91626 100644
--- a/src/musredit/PAdmin.h
+++ b/src/musredit/PAdmin.h
@@ -86,6 +86,10 @@ class PAdminXMLParser : public QXmlDefaultHandler
bool characters(const QString&);
bool endDocument();
+ bool warning( const QXmlParseException & exception );
+ bool error( const QXmlParseException & exception );
+ bool fatalError( const QXmlParseException & exception );
+
QString expandPath(const QString&);
EAdminKeyWords fKeyWord; ///< key word tag to know how to handle the content
diff --git a/src/musredit/musredit_startup.xml b/src/musredit/musredit_startup.xml
index 49c5ad9d..0c05a8ff 100644
--- a/src/musredit/musredit_startup.xml
+++ b/src/musredit/musredit_startup.xml
@@ -46,7 +46,7 @@