more robust management of reading global parameters

This commit is contained in:
Paolo Cignoni cignoni 2010-02-10 10:55:22 +00:00
parent a89037fd7b
commit ae8a955ca9
2 changed files with 9 additions and 4 deletions

View File

@ -373,7 +373,7 @@ bool RichParameterFactory::create( const QDomElement& np,RichParameter** par )
if(type=="RichBool")
{
QString val = np.attribute("value").toLower();
if ((val != QString("true")) || (val != QString("false")))
if ((val != QString("true")) && (val != QString("false")))
return false;
*par = new RichBool(name,np.attribute("value")!=QString("false"),desc,tooltip);
return true;

View File

@ -689,11 +689,16 @@ void MainWindow::loadMeshLabSettings()
RichParameter* rpar = NULL;
if(!docElem.isNull())
{
RichParameterFactory::create(docElem,&rpar);
bool ret = RichParameterFactory::create(docElem,&rpar);
if (!ret)
{
qDebug("Warning Ignored parameter '%s' = '%s'. Malformed.", qPrintable(docElem.attribute("name")),qPrintable(docElem.attribute("value")));
continue;
}
if (!defaultGlobalParams.hasParameter(rpar->name))
{
qDebug("Warning in the saved parameters there were parameters that are not in the HardWired ones.\n"
"This should not happen. Ignored parameter %s",qPrintable(rpar->name));
qDebug("Warning Ignored parameter %s. In the saved parameters there are ones that are not in the HardWired ones. "
"It happens if you are running MeshLab with only a subset of the plugins. ",qPrintable(rpar->name));
}
else currentGlobalParams.addParam(rpar);
}