-
- QFile file (xmlFile);
- if (file.exists() && file.open(QIODevice::ReadOnly)) {
- file.close();
-
- SMESHGUI_XmlHandler* aXmlHandler = new SMESHGUI_XmlHandler();
- ASSERT(aXmlHandler);
-
- QXmlInputSource source (&file);
- QXmlSimpleReader reader;
- reader.setContentHandler(aXmlHandler);
- reader.setErrorHandler(aXmlHandler);
- bool ok = reader.parse(source);
- file.close();
- if (ok) {
- myHypothesesMap.unite( aXmlHandler->myHypothesesMap );
- myAlgorithmsMap.unite( aXmlHandler->myAlgorithmsMap );
- QList<HypothesesSet*>::iterator it, pos = myListOfHypothesesSets.begin();
- for ( it = aXmlHandler->myListOfHypothesesSets.begin();
- it != aXmlHandler->myListOfHypothesesSets.end();
- ++it ) {
- myListOfHypothesesSets.insert( pos, *it );
- }
- }
- else {
- SUIT_MessageBox::critical(SMESHGUI::desktop(),
- QObject::tr("INF_PARSE_ERROR"),
- QObject::tr(aXmlHandler->errorProtocol().toLatin1().data()));
- }
- }
- else {
- if (aNoAccessFiles.isEmpty())
- aNoAccessFiles = xmlFile;
- else
- aNoAccessFiles += ", " + xmlFile;
- }
- } // end loop
+ if ( !xmlFile.isEmpty() )
+ xmlFiles.append( xmlFile );
+ }
+
+ // loop on xmlFiles
+ QString aNoAccessFiles;
+ for (int i = 0; i < xmlFiles.count(); i++)
+ {
+ QString xmlFile = xmlFiles[ i ];
+ QFile file (xmlFile);
+ if (file.exists() && file.open(QIODevice::ReadOnly))
+ {
+ file.close();
+
+ SMESHGUI_XmlHandler* aXmlHandler = new SMESHGUI_XmlHandler();
+ ASSERT(aXmlHandler);
+
+ QXmlInputSource source (&file);
+ QXmlSimpleReader reader;
+ reader.setContentHandler(aXmlHandler);
+ reader.setErrorHandler(aXmlHandler);
+ bool ok = reader.parse(source);
+ file.close();
+ if (ok) {
+
+ THypothesisDataMap::ConstIterator it1 = aXmlHandler->myHypothesesMap.begin();
+
+ for( ;it1 != aXmlHandler->myHypothesesMap.end(); it1++)
+ myHypothesesMap.insert( it1.key(), it1.value() );
+
+
+ it1 = aXmlHandler->myAlgorithmsMap.begin();
+ for( ;it1 != aXmlHandler->myAlgorithmsMap.end(); it1++)
+ myAlgorithmsMap.insert( it1.key(), it1.value() );
+
+ QList<HypothesesSet*>::iterator it, pos = myListOfHypothesesSets.begin();
+ for ( it = aXmlHandler->myListOfHypothesesSets.begin();
+ it != aXmlHandler->myListOfHypothesesSets.end();
+ ++it )
+ {
+ (*it)->setIsCustom( i == 0 );
+ myListOfHypothesesSets.insert( pos, *it );
+ }
+ }
+ else {
+ SUIT_MessageBox::critical(SMESHGUI::desktop(),
+ QObject::tr("INF_PARSE_ERROR"),
+ QObject::tr(aXmlHandler->errorProtocol().toLatin1().data()));
+ }
+ delete aXmlHandler;
+ }
+ else if ( i > 0 ) { // 1st is ~/CustomMeshers.xml
+ if (aNoAccessFiles.isEmpty())
+ aNoAccessFiles = xmlFile;
+ else
+ aNoAccessFiles += ", " + xmlFile;
+ }
+ } // end loop on xmlFiles