- // Add buttons
- QDialogButtonBox* bb = new QDialogButtonBox(
- QDialogButtonBox::Ok | QDialogButtonBox::Cancel
- );
- QObject::connect(
- bb, SIGNAL( accepted( ) ), this->m_ParametersDlg, SLOT( accept( ) )
- );
- QObject::connect(
- bb, SIGNAL( rejected( ) ), this->m_ParametersDlg, SLOT( reject( ) )
- );
- verticalLayout->addWidget( bb );
- gridLayout->addLayout( verticalLayout, 0, 0, 1, 1 );
-
- // Execute
- QMetaObject::connectSlotsByName( this->m_ParametersDlg );
- if( !( this->m_ParametersDlg->exec( ) ) )
- return( false );
-
- // Get values back
- nIt = names.begin( );
- for( ; nIt != names.end( ); ++nIt )
- {
- std::string par_name = *nIt;
- TParameters::Type par_type = parameters.GetParameterType( par_name );
- if( par_type == TParameters::Uint )
- {
- QSpinBox* v_uint =
- this->m_ParametersDlg->findChild< QSpinBox* >( par_name.c_str( ) );
- if( v_uint != NULL )
- parameters.SetValueAsUint( par_name, v_uint->value( ) );
- }
- else if( par_type == TParameters::Int )
- {
- QSpinBox* v_int =
- this->m_ParametersDlg->findChild< QSpinBox* >( par_name.c_str( ) );
- if( v_int != NULL )
- parameters.SetValueAsInt( par_name, v_int->value( ) );
- }
- else if( par_type == TParameters::Real )
- {
- QDoubleSpinBox* v_double =
- this->m_ParametersDlg->findChild< QDoubleSpinBox* >(
- par_name.c_str( )
- );
- if( v_double != NULL )
- parameters.SetValueAsReal( par_name, v_double->value( ) );
-
- } // fi
+// -------------------------------------------------------------------------
+#define ImageMPR_ReadImage( F ) \
+ this->m_UI->MPR->DeleteAllData( ); \
+ this->m_Plugins.ClearDataObjects( ); \
+ try \
+ { \
+ std::string name = this->m_Plugins.Read##F( "" ); \
+ if( name == "" ) \
+ return; \
+ TImage* image = this->m_Plugins.GetData< TImage >( name ); \
+ this->m_UI->MPR->AddData( image, name, "" ); \
+ this->m_UI->MPR->SetMainImage( name ); \
+ this->m_UI->MPR->ShowData( name ); \
+ } \
+ catch( std::exception& err ) \
+ { \
+ QMessageBox::critical( \
+ this, \
+ QMessageBox::tr( "Error reading image." ), \
+ QMessageBox::tr( err.what( ) ) \
+ ); \
+ }