+ auto& raw_params = this->m_Parameters->GetRawParameters( );
+ for( auto pIt = raw_params.begin( ); pIt != raw_params.end( ); ++pIt )
+ {
+ QString pName = pIt->first.c_str( );
+ switch( pIt->second.first )
+ {
+ case Parameters::String:
+ case Parameters::OpenFileName:
+ case Parameters::SaveFileName:
+ case Parameters::PathName:
+ case Parameters::IntList:
+ case Parameters::UintList:
+ case Parameters::RealList:
+ case Parameters::OpenFileNameList:
+ {
+ QLineEdit* v_string = this->findChild< QLineEdit* >( pName );
+ if( v_string != NULL )
+ pIt->second.second = v_string->text( ).toStdString( );
+ }
+ break;
+ case Parameters::Bool:
+ {
+ QCheckBox* v_bool = this->findChild< QCheckBox* >( pName );
+ if( v_bool != NULL )
+ pIt->second.second = ( v_bool->isChecked( ) )? "1": "0";
+ }
+ break;
+ case Parameters::Int:
+ case Parameters::Uint:
+ {
+ QSpinBox* v_uint = this->findChild< QSpinBox* >( pName );
+ if( v_uint )
+ {
+ std::stringstream str;
+ str << v_uint->value( );
+ pIt->second.second = str.str( );
+
+ } // fi
+ }
+ break;
+ case Parameters::Real:
+ {
+ QDoubleSpinBox* v_double = this->findChild< QDoubleSpinBox* >( pName );
+ if( v_double )
+ {
+ std::stringstream str;
+ str << v_double->value( );
+ pIt->second.second = str.str( );
+
+ } // fi
+ }
+ break;
+ case Parameters::StringList:
+ break;
+ case Parameters::BoolList:
+ break;
+ case Parameters::SaveFileNameList:
+ break;
+ case Parameters::PathNameList:
+ break;
+ case Parameters::Choices:
+ {
+ QComboBox* v_choices = this->findChild< QComboBox* >( pName );
+ if( v_choices != NULL )
+ {
+ std::istringstream str_choices( pIt->second.second );
+ std::string real_choices;
+ std::getline( str_choices, real_choices, '@' );
+ pIt->second.second =
+ real_choices + "@" +
+ v_choices->currentText( ).toStdString( );
+
+ } // fi
+ }
+ break;
+ default:
+ break;
+ } // hctiws
+
+ } // rof
+ this->m_Parameters->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ParametersQtDialog::
+updateView( )
+{
+ if( this->m_Parameters == NULL )
+ return;
+
+ // Put values
+ auto& raw_params = this->m_Parameters->GetRawParameters( );
+ for( auto pIt = raw_params.begin( ); pIt != raw_params.end( ); ++pIt )
+ {
+ QString pName = pIt->first.c_str( );
+ switch( pIt->second.first )
+ {
+ case Parameters::String:
+ case Parameters::OpenFileName:
+ case Parameters::SaveFileName:
+ case Parameters::PathName:
+ case Parameters::IntList:
+ case Parameters::UintList:
+ case Parameters::RealList:
+ case Parameters::OpenFileNameList:
+ {
+ QLineEdit* v_string = this->findChild< QLineEdit* >( pName );
+ if( v_string != NULL )
+ v_string->setText( pIt->second.second.c_str( ) );
+ }
+ break;
+ case Parameters::Bool:
+ {
+ QCheckBox* v_bool = this->findChild< QCheckBox* >( pName );
+ if( v_bool != NULL )
+ v_bool->setChecked( pIt->second.second == "1" );
+ }
+ break;
+ case Parameters::Int:
+ case Parameters::Uint:
+ {
+ QSpinBox* v_uint = this->findChild< QSpinBox* >( pName );
+ if( v_uint )
+ {
+ std::istringstream tok_str( pIt->second.second );
+ int v;
+ tok_str >> v;
+ v_uint->setValue( v );
+
+ } // fi
+ }
+ break;
+ case Parameters::Real:
+ {
+ QDoubleSpinBox* v_double = this->findChild< QDoubleSpinBox* >( pName );
+ if( v_double )
+ {
+ std::istringstream tok_str( pIt->second.second );
+ double v;
+ tok_str >> v;
+ v_double->setValue( v );
+
+ } // fi
+ }
+ break;
+ case Parameters::StringList:
+ break;
+ case Parameters::BoolList:
+ break;
+ case Parameters::SaveFileNameList:
+ break;
+ case Parameters::PathNameList:
+ break;
+ case Parameters::Choices:
+ {
+ QComboBox* v_choices = this->findChild< QComboBox* >( pName );
+ if( v_choices != NULL )
+ {
+ std::istringstream str_choices( pIt->second.second );
+ std::string choices, real_choice;
+ std::getline( str_choices, choices, '@' );
+ std::getline( str_choices, real_choice, '@' );
+ std::istringstream str( choices );
+ std::string token;
+ int id = -1, cont = 0;
+ while( std::getline( str, token, '#' ) )
+ {
+ if( token == real_choice )
+ id = cont;
+ cont++;
+
+ } // elihw
+
+ if( id > -1 )
+ v_choices->setCurrentIndex( id );
+
+ } // fi
+ }
+ break;
+ default:
+ break;
+ } // hctiws
+
+ } // rof
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ParametersQtDialog::
+_addButtons( )
+{
+ // Add buttons
+ this->m_Buttons = new QDialogButtonBox(
+ QDialogButtonBox::Ok | QDialogButtonBox::Cancel
+ );
+ this->connect(
+ this->m_Buttons, SIGNAL( accepted( ) ), this, SLOT( accept( ) )
+ );
+ this->connect(
+ this->m_Buttons, SIGNAL( rejected( ) ), this, SLOT( reject( ) )
+ );
+ this->m_ToolsLayout->addWidget( this->m_Buttons );
+
+ this->updateView( );
+ this->m_WidgetsUpdated = true;
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ParametersQtDialog::
+_updateWidgets( )
+{
+ if( this->m_WidgetsUpdated || this->m_Parameters == NULL )
+ return;
+
+ // Set dialog title
+ auto filter = this->m_Parameters->GetProcessObject( );
+ std::stringstream title;
+ title
+ << "Parameters for an object of class \""
+ << filter->GetClassName( )
+ << "\"";
+ this->m_Title->setText( title.str( ).c_str( ) );
+
+ // Put values
+ auto& raw_params = this->m_Parameters->GetRawParameters( );
+ for( auto pIt = raw_params.begin( ); pIt != raw_params.end( ); ++pIt )