ConfigMgr: do not silently fail to parse configuration file

Instead of failing silently when parsing configuration file show a
messagebox with helpful debugging information.
This commit is contained in:
Tobias Doerffel
2011-07-02 13:28:02 +02:00
parent 76a4d88fe4
commit 7b31be67ac

View File

@@ -244,7 +244,9 @@ void configManager::loadConfigFile()
if( cfg_file.open( QIODevice::ReadOnly ) )
{
if( dom_tree.setContent( &cfg_file ) )
QString errorString;
int errorLine, errorCol;
if( dom_tree.setContent( &cfg_file, false, &errorString, &errorLine, &errorCol ) )
{
// get the head information from the DOM
QDomElement root = dom_tree.documentElement();
@@ -314,6 +316,14 @@ void configManager::loadConfigFile()
#endif
setBackgroundArtwork( value( "paths", "backgroundartwork" ) );
}
else
{
QMessageBox::warning( NULL, MainWindow::tr( "Configuration file" ),
MainWindow::tr( "Error while parsing configuration file at line %1:%2: %3" ).
arg( errorLine ).
arg( errorCol ).
arg( errorString ) );
}
cfg_file.close();
}