From 8cd2ad84b2c2b9003e441e602e9c3db0d392aa0f Mon Sep 17 00:00:00 2001 From: stv Date: Tue, 13 Dec 2011 11:58:35 +0000 Subject: [PATCH] Possibility to use the environment variables in directive "import" was added. --- src/Qtx/QtxResourceMgr.cxx | 117 ++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 55 deletions(-) diff --git a/src/Qtx/QtxResourceMgr.cxx b/src/Qtx/QtxResourceMgr.cxx index a9656564c..13b8938ea 100644 --- a/src/Qtx/QtxResourceMgr.cxx +++ b/src/Qtx/QtxResourceMgr.cxx @@ -398,7 +398,12 @@ QTranslator* QtxResourceMgr::Resources::loadTranslator( const QString& sect, con { delete trans; trans = 0; + + if ( !fname.isEmpty() ) + qDebug() << "Translator" << fname << "not loaded"; } + else + qDebug() << "Load translator:" << fname; return trans; } @@ -507,7 +512,7 @@ bool QtxResourceMgr::IniFormat::load( const QString& fname, QMap& secMap, QSet& importHistory) +bool QtxResourceMgr::IniFormat::load( const QString& fname, QMap& secMap, QSet& importHistory ) { QString aFName = fname.trimmed(); if ( !QFileInfo( aFName ).exists() ) @@ -580,9 +585,10 @@ bool QtxResourceMgr::IniFormat::load( const QString& fname, QMap impMap; if ( !load( impFInfo.absoluteFilePath(), impMap, importHistory ) ) @@ -591,34 +597,34 @@ bool QtxResourceMgr::IniFormat::load( const QString& fname, QMap::const_iterator it = impMap.constBegin(); - for ( ; it != impMap.constEnd() ; ++it ) - { - if ( !secMap.contains( it.key() ) ) - { - // insert full section - secMap.insert( it.key(), it.value() ); - } - else - { - // insert all parameters from the section - Section::ConstIterator paramIt = it.value().begin(); - for ( ; paramIt != it.value().end() ; ++paramIt ) - { - if ( !secMap[it.key()].contains( paramIt.key() ) ) - secMap[it.key()].insert( paramIt.key(), paramIt.value() ); - } - } - } + QMap::const_iterator it = impMap.constBegin(); + for ( ; it != impMap.constEnd() ; ++it ) + { + if ( !secMap.contains( it.key() ) ) + { + // insert full section + secMap.insert( it.key(), it.value() ); + } + else + { + // insert all parameters from the section + Section::ConstIterator paramIt = it.value().begin(); + for ( ; paramIt != it.value().end() ; ++paramIt ) + { + if ( !secMap[it.key()].contains( paramIt.key() ) ) + secMap[it.key()].insert( paramIt.key(), paramIt.value() ); + } + } + } } } else { res = false; if ( section.isEmpty() ) - qWarning() << "QtxResourceMgr: Current section is empty"; + qWarning() << "QtxResourceMgr: Current section is empty"; else - qWarning() << "QtxResourceMgr: Error in line:" << line; + qWarning() << "QtxResourceMgr: Error in line:" << line; } } @@ -804,7 +810,7 @@ bool QtxResourceMgr::XmlFormat::load( const QString& fname, QMap impMap; if ( !load( impFInfo.absoluteFilePath(), impMap, importHistory ) ) - { - qDebug() << "QtxResourceMgr: Error with importing file:" << sectElem.attribute( nameAttribute() ); - } - else - { - QMap::const_iterator it = impMap.constBegin(); - for ( ; it != impMap.constEnd() ; ++it ) - { - if ( !secMap.contains( it.key() ) ) - { - // insert full section - secMap.insert( it.key(), it.value() ); - } - else - { - // insert all parameters from the section - Section::ConstIterator paramIt = it.value().begin(); - for ( ; paramIt != it.value().end() ; ++paramIt ) - { - if ( !secMap[it.key()].contains( paramIt.key() ) ) - secMap[it.key()].insert( paramIt.key(), paramIt.value() ); - } - } - } - } + { + qDebug() << "QtxResourceMgr: Error with importing file:" << sectElem.attribute( nameAttribute() ); + } + else + { + QMap::const_iterator it = impMap.constBegin(); + for ( ; it != impMap.constEnd() ; ++it ) + { + if ( !secMap.contains( it.key() ) ) + { + // insert full section + secMap.insert( it.key(), it.value() ); + } + else + { + // insert all parameters from the section + Section::ConstIterator paramIt = it.value().begin(); + for ( ; paramIt != it.value().end() ; ++paramIt ) + { + if ( !secMap[it.key()].contains( paramIt.key() ) ) + secMap[it.key()].insert( paramIt.key(), paramIt.value() ); + } + } + } + } } else { - qDebug() << "QtxResourceMgr: Invalid section in file:" << aFName; - res = false; + qDebug() << "QtxResourceMgr: Invalid section in file:" << aFName; + res = false; } } else -- 2.39.2