From: Leonardo Florez-Valencia Date: Sat, 30 Jan 2016 17:03:51 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~255 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c3a83f9e38129c9efd40de5ab09aca14c731f371;p=cpPlugins.git ... --- diff --git a/lib/cpPlugins/Interface/DataObject.cxx b/lib/cpPlugins/Interface/DataObject.cxx index deac58c..2acc980 100644 --- a/lib/cpPlugins/Interface/DataObject.cxx +++ b/lib/cpPlugins/Interface/DataObject.cxx @@ -61,6 +61,7 @@ DisconnectPipeline( ) // Unbind source this->m_Source = NULL; + this->Modified( ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Interface/Parameters.cxx b/lib/cpPlugins/Interface/Parameters.cxx index e6db0e3..3c5d07c 100644 --- a/lib/cpPlugins/Interface/Parameters.cxx +++ b/lib/cpPlugins/Interface/Parameters.cxx @@ -22,7 +22,12 @@ GetProcessObject( ) const void cpPlugins::Interface::Parameters:: SetProcessObject( ProcessObject* v ) { - this->m_Process = v; + if( this->m_Process != v ) + { + this->m_Process = v; + this->Modified( ); + + } // fi } // ------------------------------------------------------------------------- @@ -147,8 +152,12 @@ SetString( const std::string& name, const std::string& v, bool force ) { if( i->second.first == Self::String || force ) { - i->second.second = v; - this->Modified( ); + if( i->second.second != v ) + { + i->second.second = v; + this->Modified( ); + + } // fi } // fi @@ -239,6 +248,7 @@ SetSelectedChoice( const std::string& name, const std::string& choice ) std::stringstream new_choices; new_choices << choices << "@" << choice; i->second.second = new_choices.str( ); + this->Modified( ); return( true ); } else @@ -251,6 +261,36 @@ SetSelectedChoice( const std::string& name, const std::string& choice ) return( false ); } +// ------------------------------------------------------------------------- +std::string cpPlugins::Interface::Parameters:: +GetAcceptedFileExtensions( const std::string& name ) const +{ + auto i = this->m_AcceptedFileExtensions.find( name ); + if( i != this->m_AcceptedFileExtensions.end( ) ) + return( i->second ); + else + return( "" ); +} + +// ------------------------------------------------------------------------- +void cpPlugins::Interface::Parameters:: +SetAcceptedFileExtensions( + const std::string& name, const std::string& extensions + ) +{ + auto i = this->m_Parameters.find( name ); + if( i != this->m_Parameters.end( ) ) + { + bool is_valid = ( i->second.first == Self::OpenFileName ); + is_valid |= ( i->second.first == Self::SaveFileName ); + is_valid |= ( i->second.first == Self::OpenFileNameList ); + is_valid |= ( i->second.first == Self::SaveFileNameList ); + if( is_valid ) + this->m_AcceptedFileExtensions[ name ] = extensions; + + } // fi +} + // ------------------------------------------------------------------------- bool cpPlugins::Interface::Parameters:: ToXML( TiXmlElement* parent_elem ) const @@ -295,6 +335,7 @@ FromXML( const TiXmlElement* filter_elem ) ret = true; } // elihw + this->Modified( ); return( ret ); } diff --git a/lib/cpPlugins/Interface/Parameters.h b/lib/cpPlugins/Interface/Parameters.h index f751e98..3bf5d01 100644 --- a/lib/cpPlugins/Interface/Parameters.h +++ b/lib/cpPlugins/Interface/Parameters.h @@ -70,12 +70,22 @@ class TiXmlElement; { \ std::stringstream str; \ str << v; \ - i->second.second = str.str( ); \ + if( i->second.second != str.str( ) ) \ + { \ + i->second.second = str.str( ); \ + this->Modified( ); \ + } \ } \ else \ - i->second.second = \ - *( reinterpret_cast< const std::string* >( &v ) ); \ - this->Modified( ); \ + { \ + const std::string* str = \ + reinterpret_cast< const std::string* >( &v ); \ + if( i->second.second != *str ) \ + { \ + i->second.second = *str; \ + this->Modified( ); \ + } \ + } \ } \ } \ } @@ -122,6 +132,7 @@ class TiXmlElement; str << i->second.second << "#"; \ str << v; \ i->second.second = str.str( ); \ + this->Modified( ); \ } \ } \ } \ @@ -131,7 +142,13 @@ class TiXmlElement; if( i != this->m_Parameters.end( ) ) \ { \ if( i->second.first == Self::Y##List ) \ - i->second.second = ""; \ + { \ + if( i->second.second != "" ) \ + { \ + i->second.second = ""; \ + this->Modified( ); \ + } \ + } \ } \ } @@ -250,6 +267,11 @@ namespace cpPlugins const std::string& name, const std::string& choice ); + std::string GetAcceptedFileExtensions( const std::string& name ) const; + void SetAcceptedFileExtensions( + const std::string& name, const std::string& extensions + ); + // XML "streaming" bool ToXML( TiXmlElement* parent_elem ) const; bool FromXML( const TiXmlElement* filter_elem ); @@ -268,8 +290,9 @@ namespace cpPlugins Self& operator=( const Self& other ); protected: - TParameters m_Parameters; - ProcessObject* m_Process; + TParameters m_Parameters; + std::map< std::string, std::string > m_AcceptedFileExtensions; + ProcessObject* m_Process; }; } // ecapseman diff --git a/lib/cpPlugins/Interface/ParametersQtDialog.cxx b/lib/cpPlugins/Interface/ParametersQtDialog.cxx index 0c3d437..456704b 100644 --- a/lib/cpPlugins/Interface/ParametersQtDialog.cxx +++ b/lib/cpPlugins/Interface/ParametersQtDialog.cxx @@ -4,12 +4,8 @@ #include -#include #include -#include -#include - #include #include #include @@ -20,78 +16,12 @@ #include #include -/* TODO -class SingleSeedCommand - : public vtkCommand -{ -public: - static SingleSeedCommand* New( ) - { return( new SingleSeedCommand ); } - virtual void Execute( vtkObject* caller, unsigned long eid, void* data ) - { - // Get seed, avoiding segfaults!!! - if( eid != vtkCommand::PlacePointEvent || this->Dialog == NULL ) - return; - vtkSeedWidget* widget = dynamic_cast< vtkSeedWidget* >( caller ); - if( widget == NULL ) - return; - vtkSeedRepresentation* rep = widget->GetSeedRepresentation( ); - if( rep == NULL ) - return; - if( rep->GetNumberOfSeeds( ) == 0 ) - return; - double seed[ 3 ]; - rep->GetSeedWorldPosition( 0, seed ); - - // Delete all seeds (remember that this command is just for one seed) - while( rep->GetNumberOfSeeds( ) > 0 ) - widget->DeleteSeed( 0 ); - - if( this->Dialog->getParameters( )->HasIndex( this->Name ) ) - { - } - else if( this->Dialog->getParameters( )->HasPoint( this->Name ) ) - { - this->Dialog->getParameters( )->SetPoint( this->Name, 3, seed ); - this->Dialog->updateParameters( ); - auto filter = this->Dialog->getParameters( )->GetProcessObject( ); - if( filter != NULL ) - { - auto plugins = filter->GetPlugins( ); - if( plugins != NULL ) - { - auto app = plugins->GetApplication( ); - if( app != NULL ) - app->UpdateActualFilter( ); - - } // fi - - } // fi - - } // fi - } -protected: - SingleSeedCommand( ) - : vtkCommand( ), - Dialog( NULL ) - { - } - virtual ~SingleSeedCommand( ) - { - } - -public: - cpPlugins::Interface::ParametersQtDialog* Dialog; - std::string Name; -}; -*/ - // ------------------------------------------------------------------------- cpPlugins::Interface::ParametersQtDialog:: ParametersQtDialog( QWidget* parent, Qt::WindowFlags f ) : QDialog( parent, f ), m_Parameters( NULL ), - m_Interactive( false ) + m_WidgetsUpdated( false ) { this->m_Title = new QLabel( this ); this->m_Title->setText( "Parameters dialog title" ); @@ -120,63 +50,230 @@ getParameters( ) const } // ------------------------------------------------------------------------- -void cpPlugins::Interface::ParametersQtDialog:: -addInteractor( vtkRenderWindowInteractor* interactor ) -{ - this->m_Interactors.insert( interactor ); -} - -// ------------------------------------------------------------------------- -cpPlugins::Interface::ParametersQtDialog:: -TInteractors& cpPlugins::Interface::ParametersQtDialog:: -getInteractors( ) +bool cpPlugins::Interface::ParametersQtDialog:: +setParameters( Parameters* parameters ) { - return( this->m_Interactors ); + if( this->m_Parameters != NULL || parameters == NULL ) + return( false ); + this->m_Parameters = parameters; + this->m_WidgetsUpdated = false; + return( true ); } // ------------------------------------------------------------------------- -const cpPlugins::Interface::ParametersQtDialog:: -TInteractors& cpPlugins::Interface::ParametersQtDialog:: -getInteractors( ) const +int cpPlugins::Interface::ParametersQtDialog:: +exec( ) { - return( this->m_Interactors ); -} + this->_updateWidgets( ); -// ------------------------------------------------------------------------- -bool cpPlugins::Interface::ParametersQtDialog:: -isInteractive( ) const -{ - return( this->m_Interactive ); + int ret = this->QDialog::exec( ); + if( ret == 1 ) + this->updateParameters( ); + else + this->updateView( ); + return( ret ); } // ------------------------------------------------------------------------- void cpPlugins::Interface::ParametersQtDialog:: -setInteractive( bool i ) +updateParameters( ) { - this->m_Interactive = i; -} + if( this->m_Parameters == NULL ) + return; -// ------------------------------------------------------------------------- -void cpPlugins::Interface::ParametersQtDialog:: -interactiveOn( ) -{ - this->m_Interactive = true; + // 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 ) + 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:: -interactiveOff( ) +updateView( ) { - this->m_Interactive = false; + 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 } // ------------------------------------------------------------------------- -bool cpPlugins::Interface::ParametersQtDialog:: -setParameters( Parameters* parameters ) +void cpPlugins::Interface::ParametersQtDialog:: +_updateWidgets( ) { - if( this->m_Parameters != NULL || parameters == NULL ) - return( false ); - this->m_Parameters = parameters; + if( this->m_WidgetsUpdated || this->m_Parameters == NULL ) + return; // Set dialog title auto filter = this->m_Parameters->GetProcessObject( ); @@ -185,7 +282,6 @@ setParameters( Parameters* parameters ) this->m_Title->setText( title.str( ).c_str( ) ); // Put values - this->m_Widgets.clear( ); auto& raw_params = this->m_Parameters->GetRawParameters( ); for( auto pIt = raw_params.begin( ); pIt != raw_params.end( ); ++pIt ) { @@ -363,6 +459,7 @@ setParameters( Parameters* parameters ) QHBoxLayout* layout = new QHBoxLayout( frame ); QLineEdit* v_string = new QLineEdit( frame ); v_string->setObjectName( pIt->first.c_str( ) ); + v_string->setMaxLength( std::numeric_limits< int >::max( ) ); v_string->setText( pIt->second.second.c_str( ) ); QPushButton* v_button = new QPushButton( frame ); v_button->setObjectName( ( pIt->first + "_=?btn" ).c_str( ) ); @@ -429,220 +526,7 @@ setParameters( Parameters* parameters ) // Update values this->updateView( ); - - return( true ); -} - -// ------------------------------------------------------------------------- -int cpPlugins::Interface::ParametersQtDialog:: -exec( ) -{ - int ret = this->QDialog::exec( ); - if( ret == 1 ) - this->updateParameters( ); - else - this->updateView( ); - return( ret ); -} - -// ------------------------------------------------------------------------- -void cpPlugins::Interface::ParametersQtDialog:: -show( ) -{ - this->QDialog::show( ); -} - -// ------------------------------------------------------------------------- -void cpPlugins::Interface::ParametersQtDialog:: -updateParameters( ) -{ - 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 ) - 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 -} - -// ------------------------------------------------------------------------- -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 + this->m_WidgetsUpdated = true; } // ------------------------------------------------------------------------- @@ -664,14 +548,18 @@ _dlg_OpenSingleFile( ) this->m_Parameters->GetOpenFileName( param_name ); if( param_value == "" ) param_value = "."; - QStringList filters; - filters << "Any file (*)"; + QStringList dialog_filters; + std::string extensions = + this->m_Parameters->GetAcceptedFileExtensions( param_name ); + if( extensions != "" ) + dialog_filters << extensions.c_str( ); + dialog_filters << "Any file (*)"; // Show dialog and check if it was accepted QFileDialog dialog( this ); dialog.setFileMode( QFileDialog::ExistingFile ); dialog.setDirectory( QFileDialog::tr( param_value.c_str( ) ) ); - dialog.setNameFilters( filters ); + dialog.setNameFilters( dialog_filters ); dialog.setAcceptMode( QFileDialog::AcceptOpen ); if( dialog.exec( ) ) line->setText( *( dialog.selectedFiles( ).begin( ) ) ); @@ -702,14 +590,18 @@ _dlg_SaveSingleFile( ) this->m_Parameters->GetSaveFileName( param_name ); if( param_value == "" ) param_value = "."; - QStringList filters; - filters << "Any file (*)"; + QStringList dialog_filters; + std::string extensions = + this->m_Parameters->GetAcceptedFileExtensions( param_name ); + if( extensions != "" ) + dialog_filters << extensions.c_str( ); + dialog_filters << "Any file (*)"; // Show dialog and check if it was accepted QFileDialog dialog( this ); dialog.setFileMode( QFileDialog::AnyFile ); dialog.setDirectory( QFileDialog::tr( param_value.c_str( ) ) ); - dialog.setNameFilters( filters ); + dialog.setNameFilters( dialog_filters ); dialog.setAcceptMode( QFileDialog::AcceptSave ); if( dialog.exec( ) ) line->setText( *( dialog.selectedFiles( ).begin( ) ) ); @@ -772,13 +664,17 @@ _dlg_OpenMultipleFiles( ) std::string param_name = line->objectName( ).toStdString( ); if( param_name != "" ) { - QStringList filters; - filters << "Any file (*)"; + QStringList dialog_filters; + std::string extensions = + this->m_Parameters->GetAcceptedFileExtensions( param_name ); + if( extensions != "" ) + dialog_filters << extensions.c_str( ); + dialog_filters << "Any file (*)"; // Show dialog and check if it was accepted QFileDialog dialog( this ); dialog.setFileMode( QFileDialog::ExistingFiles ); - dialog.setNameFilters( filters ); + dialog.setNameFilters( dialog_filters ); dialog.setAcceptMode( QFileDialog::AcceptOpen ); if( dialog.exec( ) ) { @@ -829,8 +725,10 @@ _dlg_AddInt( ) std::string( "\"" ) ).c_str( ), "Value:", - 0, -2147483647, 2147483647, 1, - &ok + 0, + -std::numeric_limits< int >::max( ), + std::numeric_limits< int >::max( ), + 1, &ok ); if( ok ) { @@ -875,7 +773,7 @@ _dlg_AddUint( ) std::string( "\"" ) ).c_str( ), "Value:", - 0, 0, 2147483647, 1, + 0, 0, std::numeric_limits< int >::max( ), 1, &ok ); if( ok ) @@ -921,8 +819,10 @@ _dlg_AddReal( ) std::string( "\"" ) ).c_str( ), "Value:", - 0, -2147483647, 2147483647, 1, - &ok + 0, + -std::numeric_limits< double >::max( ), + std::numeric_limits< double >::max( ), + 1, &ok ); if( ok ) { diff --git a/lib/cpPlugins/Interface/ParametersQtDialog.h b/lib/cpPlugins/Interface/ParametersQtDialog.h index 40b8514..421f707 100644 --- a/lib/cpPlugins/Interface/ParametersQtDialog.h +++ b/lib/cpPlugins/Interface/ParametersQtDialog.h @@ -10,17 +10,12 @@ #include -#include -#include - #include #include #include #include #include -class vtkRenderWindowInteractor; - namespace cpPlugins { namespace Interface @@ -32,51 +27,37 @@ namespace cpPlugins { Q_OBJECT; - public: - typedef std::set< vtkRenderWindowInteractor* > TInteractors; - typedef - std::map< std::string, vtkSmartPointer< vtkInteractorObserver > > - TWidgets; - public: ParametersQtDialog( QWidget* parent = 0, Qt::WindowFlags f = 0 ); virtual ~ParametersQtDialog( ); Parameters* getParameters( ) const; - void addInteractor( vtkRenderWindowInteractor* interactor ); - TInteractors& getInteractors( ); - const TInteractors& getInteractors( ) const; - bool isInteractive( ) const; - void setInteractive( bool i ); - void interactiveOn( ); - void interactiveOff( ); bool setParameters( Parameters* parameters ); virtual int exec( ); - virtual void show( ); void updateParameters( ); void updateView( ); + protected: + void _updateWidgets( ); + protected slots: - void _dlg_OpenSingleFile( ); - void _dlg_SaveSingleFile( ); - void _dlg_OpenSinglePath( ); - void _dlg_OpenMultipleFiles( ); - void _dlg_AddInt( ); - void _dlg_AddUint( ); - void _dlg_AddReal( ); + virtual void _dlg_OpenSingleFile( ); + virtual void _dlg_SaveSingleFile( ); + virtual void _dlg_OpenSinglePath( ); + virtual void _dlg_OpenMultipleFiles( ); + virtual void _dlg_AddInt( ); + virtual void _dlg_AddUint( ); + virtual void _dlg_AddReal( ); protected: Parameters* m_Parameters; + bool m_WidgetsUpdated; QLabel* m_Title; QGridLayout* m_MainLayout; QVBoxLayout* m_ToolsLayout; QDialogButtonBox* m_Buttons; - - TInteractors m_Interactors; - TWidgets m_Widgets; - bool m_Interactive; }; } // ecapseman diff --git a/lib/cpPlugins/Interface/ProcessObject.cxx b/lib/cpPlugins/Interface/ProcessObject.cxx index 1128fe1..17fe21b 100644 --- a/lib/cpPlugins/Interface/ProcessObject.cxx +++ b/lib/cpPlugins/Interface/ProcessObject.cxx @@ -77,8 +77,12 @@ SetInput( const std::string& id, const ProcessObjectPort& port ) auto i = this->m_Inputs.find( id ); if( i != this->m_Inputs.end( ) ) { - i->second = port; - this->Modified( ); + if( i->second.GetPointer( ) != port.GetPointer( ) ) + { + i->second = port; + this->Modified( ); + + } // fi return( true ); } else @@ -136,7 +140,6 @@ GetMTime( ) const std::string cpPlugins::Interface::ProcessObject:: Update( ) { - static std::string r = ""; // Force upstream updates @@ -212,7 +215,11 @@ _AddInput( const std::string& name ) typedef typename _TDataContainer::value_type _TValue; auto i = this->m_Inputs.find( name ); if( i == this->m_Inputs.end( ) ) + { i = this->m_Inputs.insert( _TValue( name, NULL ) ).first; + this->Modified( ); + + } // fi } // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/ProcessObject.hxx b/lib/cpPlugins/Interface/ProcessObject.hxx index 1b691ff..9c5b764 100644 --- a/lib/cpPlugins/Interface/ProcessObject.hxx +++ b/lib/cpPlugins/Interface/ProcessObject.hxx @@ -61,6 +61,7 @@ _AddOutput( const std::string& name ) typename O::Pointer o = O::New( ); o->SetSource( this ); this->m_Outputs[ name ] = o; + this->Modified( ); } // fi } @@ -77,6 +78,7 @@ _CreateITK( ) this->SetITK( filter_ptr.GetPointer( ) ); this->SetVTK( NULL ); filter = filter_ptr.GetPointer( ); + this->Modified( ); } // fi return( filter ); @@ -94,6 +96,7 @@ _CreateVTK( ) this->SetITK( NULL ); this->SetVTK( filter_ptr ); filter = filter_ptr.GetPointer( ); + this->Modified( ); } // fi return( filter ); diff --git a/lib/cpPlugins/Plugins/IO/DicomSeriesReader.cxx b/lib/cpPlugins/Plugins/IO/DicomSeriesReader.cxx index ef7c581..4136bb1 100644 --- a/lib/cpPlugins/Plugins/IO/DicomSeriesReader.cxx +++ b/lib/cpPlugins/Plugins/IO/DicomSeriesReader.cxx @@ -15,184 +15,204 @@ #include #include -#endif // cpPlugins_Interface_QT4 +#include #include -// ------------------------------------------------------------------------- -/* -bool cpPlugins::IO::DicomSeriesReader:: -ExecConfigurationDialog( QWidget* parent ) +/** + */ +class cpPlugins_IO_DicomSeriesReader_ParametersQtDialog + : public cpPlugins::Interface::ParametersQtDialog { - bool r = false; + // Q_OBJECT; -#ifdef cpPlugins_Interface_QT4 +public: + cpPlugins_IO_DicomSeriesReader_ParametersQtDialog( + QWidget* parent = 0, Qt::WindowFlags f = 0 + ) + : cpPlugins::Interface::ParametersQtDialog( parent, f ) + { + } + virtual ~cpPlugins_IO_DicomSeriesReader_ParametersQtDialog( ) + { + } - // DICOM series analyzer - itk::GDCMSeriesFileNames::GlobalWarningDisplayOff( ); - itk::GDCMSeriesFileNames::Pointer series = - itk::GDCMSeriesFileNames::New( ); - - // Show dialog and check if it was accepted - QFileDialog dialog( parent ); - dialog.setFileMode( QFileDialog::DirectoryOnly ); - dialog.setDirectory( QFileDialog::tr( "." ) ); - if( !dialog.exec( ) ) - return( false ); - - // Prepare dialog - QApplication::setOverrideCursor( Qt::WaitCursor ); - if( parent != NULL ) - parent->setEnabled( false ); - - QDialog* tree_dialog = new QDialog( parent ); - QTreeWidget* tree_widget = new QTreeWidget( tree_dialog ); - QList< QTreeWidgetItem* > tree_items; - std::map< std::string, std::map< std::string, TStringList > > found_files; - - std::string main_dir_name = - dialog.selectedFiles( ).begin( )->toStdString( ); - std::queue< std::string > q; - q.push( main_dir_name ); - while( !( q.empty( ) ) ) - { - std::string dir_name = q.front( ); - q.pop( ); - - // Get DICOM information - series->SetUseSeriesDetails( true ); - series->AddSeriesRestriction( "0008|0021" ); - series->SetDirectory( dir_name ); - const TStringList& seriesUID = series->GetSeriesUIDs( ); - if( seriesUID.size( ) > 0 ) +protected: + virtual void _dlg_OpenMultipleFiles( ) { - QTreeWidgetItem* new_item = new QTreeWidgetItem( - ( QTreeWidgetItem* )( NULL ), - QStringList( dir_name.c_str( ) ) - ); - QTreeWidgetItem* new_leaf = NULL; - TStringList::const_iterator sIt = seriesUID.begin( ); - for( ; sIt != seriesUID.end( ); ++sIt ) + // DICOM series analyzer + itk::GDCMSeriesFileNames::GlobalWarningDisplayOff( ); + itk::GDCMSeriesFileNames::Pointer series = + itk::GDCMSeriesFileNames::New( ); + + // Show dialog and check if it was accepted + QWidget* parent = dynamic_cast< QWidget* >( this->parent( ) ); + QFileDialog dialog( parent ); + dialog.setFileMode( QFileDialog::DirectoryOnly ); + dialog.setDirectory( QFileDialog::tr( "." ) ); + if( !dialog.exec( ) ) + return; + + // Prepare dialog + QApplication::setOverrideCursor( Qt::WaitCursor ); + if( parent != NULL ) + parent->setEnabled( false ); + + QDialog* tree_dialog = new QDialog( parent ); + QTreeWidget* tree_widget = new QTreeWidget( tree_dialog ); + QList< QTreeWidgetItem* > tree_items; + std::map< std::string, std::map< std::string, std::vector< std::string > > > + found_files; + + std::string main_dir_name = + dialog.selectedFiles( ).begin( )->toStdString( ); + std::queue< std::string > q; + q.push( main_dir_name ); + while( !( q.empty( ) ) ) { - TStringList filenames = series->GetFileNames( *sIt ); - if( filenames.size( ) > 0 ) + std::string dir_name = q.front( ); + q.pop( ); + + // Get DICOM information + series->SetUseSeriesDetails( true ); + series->AddSeriesRestriction( "0008|0021" ); + series->SetDirectory( dir_name ); + const std::vector< std::string >& seriesUID = series->GetSeriesUIDs( ); + if( seriesUID.size( ) > 0 ) { - std::stringstream ss; - ss << "(" << filenames.size( ) << "): " << *sIt; - new_leaf = - new QTreeWidgetItem( - new_item, QStringList( ss.str( ).c_str( ) ) - ); - new_item->addChild( new_leaf ); - found_files[ dir_name ][ *sIt ] = filenames; + QTreeWidgetItem* new_item = new QTreeWidgetItem( + ( QTreeWidgetItem* )( NULL ), + QStringList( dir_name.c_str( ) ) + ); + QTreeWidgetItem* new_leaf = NULL; + std::vector< std::string >::const_iterator sIt = seriesUID.begin( ); + for( ; sIt != seriesUID.end( ); ++sIt ) + { + std::vector< std::string > filenames = series->GetFileNames( *sIt ); + if( filenames.size( ) > 0 ) + { + std::stringstream ss; + ss << "(" << filenames.size( ) << "): " << *sIt; + new_leaf = + new QTreeWidgetItem( + new_item, QStringList( ss.str( ).c_str( ) ) + ); + new_item->addChild( new_leaf ); + found_files[ dir_name ][ *sIt ] = filenames; + + } // fi + + } // rof + + if( new_leaf != NULL ) + tree_items.append( new_item ); + else + delete new_item; } // fi - } // rof - - if( new_leaf != NULL ) - tree_items.append( new_item ); - else - delete new_item; - - } // fi - - // Update queue - QDir dir( dir_name.c_str( ) ); - QFileInfoList contents = dir.entryInfoList( ); - QFileInfoList::const_iterator i = contents.begin( ); - for( ; i != contents.end( ); ++i ) - { - if( i->isDir( ) ) - { - std::string new_dir_name = i->absoluteFilePath( ).toStdString( ); - if( new_dir_name.size( ) > dir_name.size( ) ) - q.push( new_dir_name ); + // Update queue + QDir dir( dir_name.c_str( ) ); + QFileInfoList contents = dir.entryInfoList( ); + QFileInfoList::const_iterator i = contents.begin( ); + for( ; i != contents.end( ); ++i ) + { + if( i->isDir( ) ) + { + std::string new_dir_name = i->absoluteFilePath( ).toStdString( ); + if( new_dir_name.size( ) > dir_name.size( ) ) + q.push( new_dir_name ); - } // fi + } // fi - } // rof + } // rof - } // elihw + } // elihw - // Show second dialog - if( tree_items.size( ) == 0 ) - { - delete tree_widget; - delete tree_dialog; - return( false ); + // Show second dialog + if( tree_items.size( ) == 0 ) + { + delete tree_widget; + delete tree_dialog; + return; - } // fi + } // fi - QLabel* title = new QLabel( tree_dialog ); - title->setText( "Choose a DICOM series" ); - QGridLayout* mainLayout = new QGridLayout( tree_dialog ); - QVBoxLayout* toolsLayout = new QVBoxLayout( ); - toolsLayout->addWidget( title ); - mainLayout->addLayout( toolsLayout, 0, 0, 1, 1 ); - - tree_widget->insertTopLevelItems( 0, tree_items ); - toolsLayout->addWidget( tree_widget ); - - QDialogButtonBox* bb = new QDialogButtonBox( - QDialogButtonBox::Ok | QDialogButtonBox::Cancel - ); - tree_dialog->connect( - bb, SIGNAL( accepted( ) ), tree_dialog, SLOT( accept( ) ) - ); - tree_dialog->connect( - bb, SIGNAL( rejected( ) ), tree_dialog, SLOT( reject( ) ) - ); - toolsLayout->addWidget( bb ); - - QApplication::restoreOverrideCursor( ); - if( parent != NULL ) - parent->setEnabled( true ); - - if( tree_dialog->exec( ) == 0 ) - return( false ); - - QTreeWidgetItem* item = tree_widget->currentItem( ); - if( item != NULL ) - { - QTreeWidgetItem* item_parent = item->parent( ); - if( item_parent != NULL ) - { - QApplication::setOverrideCursor( Qt::WaitCursor ); - if( parent != NULL ) - parent->setEnabled( false ); + QLabel* title = new QLabel( tree_dialog ); + title->setText( "Choose a DICOM series" ); + QGridLayout* mainLayout = new QGridLayout( tree_dialog ); + QVBoxLayout* toolsLayout = new QVBoxLayout( ); + toolsLayout->addWidget( title ); + mainLayout->addLayout( toolsLayout, 0, 0, 1, 1 ); - std::string serie_dir = item_parent->text( 0 ).toStdString( ); - std::string serie_id = item->text( 0 ).toStdString( ); - serie_id = serie_id.substr( serie_id.find_first_of( " " ) + 1 ); - this->m_Parameters->ClearOpenFileNameList( "FileNames" ); - const TStringList& names = found_files[ serie_dir ][ serie_id ]; - for( unsigned int f = 0; f < names.size( ); ++f ) - this->m_Parameters->AddToOpenFileNameList( "FileNames", names[ f ] ); + tree_widget->insertTopLevelItems( 0, tree_items ); + toolsLayout->addWidget( tree_widget ); - r = true; + QDialogButtonBox* bb = new QDialogButtonBox( + QDialogButtonBox::Ok | QDialogButtonBox::Cancel + ); + tree_dialog->connect( + bb, SIGNAL( accepted( ) ), tree_dialog, SLOT( accept( ) ) + ); + tree_dialog->connect( + bb, SIGNAL( rejected( ) ), tree_dialog, SLOT( reject( ) ) + ); + toolsLayout->addWidget( bb ); QApplication::restoreOverrideCursor( ); if( parent != NULL ) parent->setEnabled( true ); - } // fi + if( tree_dialog->exec( ) == 0 ) + return; - } // fi + QTreeWidgetItem* item = tree_widget->currentItem( ); + if( item != NULL ) + { + QTreeWidgetItem* item_parent = item->parent( ); + if( item_parent != NULL ) + { + QApplication::setOverrideCursor( Qt::WaitCursor ); + if( parent != NULL ) + parent->setEnabled( false ); + + std::string serie_dir = item_parent->text( 0 ).toStdString( ); + std::string serie_id = item->text( 0 ).toStdString( ); + serie_id = serie_id.substr( serie_id.find_first_of( " " ) + 1 ); + this->m_Parameters->ClearOpenFileNameList( "FileNames" ); + const std::vector< std::string >& names = + found_files[ serie_dir ][ serie_id ]; + for( unsigned int f = 0; f < names.size( ); ++f ) + this->m_Parameters->AddToOpenFileNameList( "FileNames", names[ f ] ); + this->updateView( ); + + QApplication::restoreOverrideCursor( ); + if( parent != NULL ) + parent->setEnabled( true ); - itk::GDCMSeriesFileNames::GlobalWarningDisplayOn( ); + } // fi -#endif // cpPlugins_Interface_QT4 + } // fi + itk::GDCMSeriesFileNames::GlobalWarningDisplayOn( ); + } +}; - return( r ); -} -*/ +#endif // cpPlugins_Interface_QT4 // ------------------------------------------------------------------------- cpPlugins::IO::DicomSeriesReader:: DicomSeriesReader( ) : Superclass( ) { +#ifdef cpPlugins_Interface_QT4 + if( QApplication::instance( ) != NULL ) + { + this->m_ParametersDialog = + new cpPlugins_IO_DicomSeriesReader_ParametersQtDialog( ); + this->m_ParametersDialog->setParameters( this->m_Parameters ); + + } // fi +#endif // cpPlugins_Interface_QT4 } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h b/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h index 968932f..a202a3a 100644 --- a/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h +++ b/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h @@ -34,11 +34,6 @@ namespace cpPlugins itkTypeMacro( DicomSeriesReader, ImageReader ); cpPlugins_Id_Macro( cpPlugins::IO::DicomSeriesReader, IO ); - /* TODO - public: - virtual bool ExecConfigurationDialog( QWidget* parent ); - */ - protected: DicomSeriesReader( ); virtual ~DicomSeriesReader( ); diff --git a/lib/cpPlugins/Plugins/IO/ImageReader.cxx b/lib/cpPlugins/Plugins/IO/ImageReader.cxx index c093e21..cd0d6c9 100644 --- a/lib/cpPlugins/Plugins/IO/ImageReader.cxx +++ b/lib/cpPlugins/Plugins/IO/ImageReader.cxx @@ -4,53 +4,6 @@ #include #include -/* TODO - #ifdef cpPlugins_Interface_QT4 - #include - #endif // cpPlugins_Interface_QT4 - - // ------------------------------------------------------------------------- - cpPlugins::IO::ImageReader:: - DialogResult cpPlugins::IO::ImageReader:: - ExecConfigurationDialog( QWidget* parent ) - { - DialogResult r = Self::DialogResult_Cancel; - - #ifdef cpPlugins_Interface_QT4 - - QStringList filters; - filters - << "Image files (*.bmp *.png *.jpg *.jpeg *.dcm *.mhd *.nhdr *.nrrd *.tiff)" - << "Any files (*)"; - - TStringList names = this->m_Parameters->GetFileNameList( "FileNames" ); - std::string name = ( names.size( ) > 0 )? names[ 0 ]: "."; - - // Show dialog and check if it was accepted - QFileDialog dialog( parent ); - dialog.setFileMode( QFileDialog::ExistingFiles ); - dialog.setDirectory( QFileDialog::tr( name.c_str( ) ) ); - dialog.setNameFilters( filters ); - dialog.setAcceptMode( QFileDialog::AcceptOpen ); - if( dialog.exec( ) ) - { - QStringList names = dialog.selectedFiles( ); - QStringList::const_iterator qIt = names.begin( ); - for( ; qIt != names.end( ); ++qIt ) - this->m_Parameters->AddToStringList( - "FileNames", qIt->toStdString( ) - ); - this->m_Parameters->SetBool( "VectorType", false ); - r = Self::DialogResult_NoModal; - - } // fi - - #endif // cpPlugins_Interface_QT4 - - return( r ); - } -*/ - // ------------------------------------------------------------------------- cpPlugins::IO::ImageReader:: ImageReader( ) @@ -61,6 +14,10 @@ ImageReader( ) this->m_Parameters->ConfigureAsOpenFileNameList( "FileNames" ); this->m_Parameters->ConfigureAsBool( "VectorType" ); this->m_Parameters->SetBool( "VectorType", false ); + this->m_Parameters->SetAcceptedFileExtensions( + "FileNames", + "Image files (*.bmp *.png *.jpg *.jpeg *.dcm *.mhd *.nhdr *.nrrd *.tiff)" + ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/IO/ImageWriter.cxx b/lib/cpPlugins/Plugins/IO/ImageWriter.cxx index a06f2d2..df72f66 100644 --- a/lib/cpPlugins/Plugins/IO/ImageWriter.cxx +++ b/lib/cpPlugins/Plugins/IO/ImageWriter.cxx @@ -3,46 +3,6 @@ #include -/* TODO - #ifdef cpPlugins_Interface_QT4 - #include - #endif // cpPlugins_Interface_QT4 - - // ------------------------------------------------------------------------- - cpPlugins::IO::ImageWriter:: - DialogResult cpPlugins::IO::ImageWriter:: - ExecConfigurationDialog( QWidget* parent ) - { - DialogResult r = Self::DialogResult_Cancel; - - #ifdef cpPlugins_Interface_QT4 - - std::string name = this->m_Parameters->GetString( "FileName" ); - if( name == "" ) - name = "save.mhd"; - - // Show dialog and check if it was accepted - QString qname = - QFileDialog::getSaveFileName( - parent, - QFileDialog::tr( "Save File" ), - QFileDialog::tr( name.c_str( ) ), - QFileDialog::tr( "Image files (*.bmp *.png *.jpg *.jpeg *.dcm *.mhd *.nhdr *.nrrd *.tiff);;Any file (*)") - ); - name = qname.toStdString( ); - if( name != "" ) - { - this->m_Parameters->SetString( "FileName", name ); - r = Self::DialogResult_NoModal; - - } // fi - - #endif // cpPlugins_Interface_QT4 - - return( r ); - } -*/ - // ------------------------------------------------------------------------- cpPlugins::IO::ImageWriter:: ImageWriter( ) @@ -50,6 +10,10 @@ ImageWriter( ) { this->_AddInput( "Input" ); this->m_Parameters->ConfigureAsSaveFileName( "FileName" ); + this->m_Parameters->SetAcceptedFileExtensions( + "FileName", + "Image files (*.bmp *.png *.jpg *.jpeg *.dcm *.mhd *.nhdr *.nrrd *.tiff)" + ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/IO/MeshReader.cxx b/lib/cpPlugins/Plugins/IO/MeshReader.cxx index d1410e8..60bb57d 100644 --- a/lib/cpPlugins/Plugins/IO/MeshReader.cxx +++ b/lib/cpPlugins/Plugins/IO/MeshReader.cxx @@ -4,42 +4,6 @@ #include #include -/* TODO -#ifdef cpPlugins_Interface_QT4 -#include -#endif // cpPlugins_Interface_QT4 - -// ------------------------------------------------------------------------- -cpPlugins::IO::MeshReader:: -DialogResult cpPlugins::IO::MeshReader:: -ExecConfigurationDialog( QWidget* parent ) -{ - DialogResult r = Self::DialogResult_Cancel; - -#ifdef cpPlugins_Interface_QT4 - - // Show dialog and check if it was accepted - QFileDialog dialog( parent ); - dialog.setFileMode( QFileDialog::ExistingFile ); - dialog.setDirectory( QFileDialog::tr( "." ) ); - dialog.setNameFilter( QFileDialog::tr( "All files (*)" ) ); - if( dialog.exec( ) ) - { - QStringList names = dialog.selectedFiles( ); - this->m_Parameters->SetString( "FileName", names[ 0 ].toStdString( ) ); - this->m_Parameters->SetSelectedChoice( "PixelType", "float" ); - this->m_Parameters->SetUint( "Dimension", 3 ); - - r = Self::DialogResult_NoModal; - - } // fi - -#endif // cpPlugins_Interface_QT4 - - return( r ); -} -*/ - // ------------------------------------------------------------------------- cpPlugins::IO::MeshReader:: MeshReader( ) @@ -55,6 +19,10 @@ MeshReader( ) this->m_Parameters->ConfigureAsUint( "Dimension" ); this->m_Parameters->SetUint( "Dimension", 3 ); + this->m_Parameters->SetAcceptedFileExtensions( + "FileName", + "Mesh files (*.vtk *.stl *.obj)" + ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/IO/MeshWriter.cxx b/lib/cpPlugins/Plugins/IO/MeshWriter.cxx index 37b936c..7f0bba0 100644 --- a/lib/cpPlugins/Plugins/IO/MeshWriter.cxx +++ b/lib/cpPlugins/Plugins/IO/MeshWriter.cxx @@ -5,46 +5,6 @@ #include #include -/* TODO - #ifdef cpPlugins_Interface_QT4 - #include - #endif // cpPlugins_Interface_QT4 - - // ------------------------------------------------------------------------- - cpPlugins::IO::MeshWriter:: - DialogResult cpPlugins::IO::MeshWriter:: - ExecConfigurationDialog( QWidget* parent ) - { - DialogResult r = Self::DialogResult_Cancel; - - #ifdef cpPlugins_Interface_QT4 - - std::string name = this->m_Parameters->GetString( "FileName" ); - if( name == "" ) - name = "save.vtk"; - - // Show dialog and check if it was accepted - QString qname = - QFileDialog::getSaveFileName( - parent, - QFileDialog::tr( "Save File" ), - QFileDialog::tr( name.c_str( ) ), - QFileDialog::tr( "Mesh files (*.vtk *.stl *.obj);;Any file (*)") - ); - name = qname.toStdString( ); - if( name != "" ) - { - this->m_Parameters->SetString( "FileName", name ); - r = Self::DialogResult_NoModal; - - } // fi - - #endif // cpPlugins_Interface_QT4 - - return( r ); - } -*/ - // ------------------------------------------------------------------------- cpPlugins::IO::MeshWriter:: MeshWriter( ) @@ -52,6 +12,10 @@ MeshWriter( ) { this->_AddInput( "Input" ); this->m_Parameters->ConfigureAsSaveFileName( "FileName" ); + this->m_Parameters->SetAcceptedFileExtensions( + "FileName", + "Mesh files (*.vtk *.stl *.obj)" + ); } // -------------------------------------------------------------------------