From 7b31be67acffeae2eb64aad147867844a6f9d3be Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sat, 2 Jul 2011 13:28:02 +0200 Subject: [PATCH] ConfigMgr: do not silently fail to parse configuration file Instead of failing silently when parsing configuration file show a messagebox with helpful debugging information. --- src/core/config_mgr.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/config_mgr.cpp b/src/core/config_mgr.cpp index 2c1793f4c..7e2a17680 100644 --- a/src/core/config_mgr.cpp +++ b/src/core/config_mgr.cpp @@ -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(); }