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:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user