]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 29 Jun 2016 03:15:22 +0000 (22:15 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 29 Jun 2016 03:15:22 +0000 (22:15 -0500)
lib/cpBaseQtApplication/MainWindow.cxx
lib/cpBaseQtApplication/MainWindow.h

index 41f2df5248725e9ecebc71977d2b3880dd973969..fcff5c2a435dcfe3ac97004fe9fa3defe582999c 100644 (file)
@@ -365,6 +365,25 @@ _BackgroundProperties( unsigned int i )
   } // fi
 }
 
+// -------------------------------------------------------------------------
+void cpBaseQtApplication::MainWindow::
+_DataProperties( const std::string& actor )
+{
+  if( this->m_MPR == NULL )
+    return;
+  this->_Block( );
+  auto actors = this->m_MPR->GetActors( actor );
+  auto dlg = new cpBaseQtApplication::ActorPropertiesQDialog( NULL );
+  for( auto i = actors.begin( ); i != actors.end( ); ++i )
+    dlg->addActor( *i );
+  dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 0 ) );
+  dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 1 ) );
+  dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 2 ) );
+  dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 3 ) );
+  this->_UnBlock( );
+  dlg->exec( );
+}
+
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
 _ShowData( const std::string& filter_name, const std::string& output_name )
@@ -423,21 +442,7 @@ _DataProperties(
 
   auto output = this->m_Workspace.GetOutput( filter_name, output_name );
   if( output != NULL )
-  {
-    this->_Block( );
-    auto actors = this->m_MPR->GetActors(
-      output_name + std::string( "@" ) + filter_name
-      );
-    auto dlg = new ActorPropertiesQDialog( NULL );
-    for( auto i = actors.begin( ); i != actors.end( ); ++i )
-      dlg->addActor( *i );
-    dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 0 ) );
-    dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 1 ) );
-    dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 2 ) );
-    dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 3 ) );
-    this->_UnBlock( );
-    dlg->exec( );
-  }
+    this->_DataProperties( output_name + std::string( "@" ) + filter_name );
   else
     QMessageBox::critical(
       this,
@@ -553,40 +558,7 @@ _InteractiveAddEnviromentPaths( )
 void cpBaseQtApplication::MainWindow::
 _ExecFilter( const std::string& filter_name )
 {
-  this->_Block( );
-  try
-  {
-    this->m_Workspace.Execute( filter_name );
-    this->_UnBlock( );
-  }
-  catch( itk::ExceptionObject& err1 )
-  {
-    this->_UnBlock( );
-    QMessageBox::critical(
-      this,
-      QMessageBox::tr( "Error executing filter" ),
-      QMessageBox::tr( err1.GetDescription( ) )
-      );
-  }
-  catch( std::exception& err2 )
-  {
-    this->_UnBlock( );
-    QMessageBox::critical(
-      this,
-      QMessageBox::tr( "Error executing filter" ),
-      QMessageBox::tr( err2.what( ) )
-      );
-  }
-  catch( ... )
-  {
-    this->_UnBlock( );
-    QMessageBox::critical(
-      this,
-      QMessageBox::tr( "Error executing filter" ),
-      QMessageBox::tr( "Unknown error" )
-      );
-
-  } // yrt
+  cpBaseQtApplication_Execute( this->m_Workspace.Execute( filter_name ) );
 }
 
 // eof - $RCSfile$
index 6a7190ea653bc1b73fffa03f0c9bf3945b9b1a3e..febf21e355c3a6d672de9b82fef611df2447bb97 100644 (file)
@@ -6,6 +6,51 @@
 #include <cpPlugins/Interface.h>
 #include <cpPlugins/Workspace.h>
 
+// -------------------------------------------------------------------------
+#define cpBaseQtApplication_ConnectAction( _action_, _slot_ )           \
+  this->connect(                                                        \
+    this->m_UI->_action_, SIGNAL( triggered( ) ),                       \
+    this, SLOT( _slot_( ) )                                             \
+    )
+
+// -------------------------------------------------------------------------
+#define cpBaseQtApplication_Execute( _command_ )        \
+  this->_Block( );                                      \
+  try                                                   \
+  {                                                     \
+    _command_;                                          \
+    this->_UnBlock( );                                  \
+  }                                                     \
+  catch( itk::ExceptionObject& err1 )                   \
+  {                                                     \
+    this->_UnBlock( );                                  \
+    QMessageBox::critical(                              \
+      this,                                             \
+      QMessageBox::tr( "Error executing filter" ),      \
+      QMessageBox::tr( err1.GetDescription( ) )         \
+      );                                                \
+  }                                                     \
+  catch( std::exception& err2 )                         \
+  {                                                     \
+    this->_UnBlock( );                                  \
+    QMessageBox::critical(                              \
+      this,                                             \
+      QMessageBox::tr( "Error executing filter" ),      \
+      QMessageBox::tr( err2.what( ) )                   \
+      );                                                \
+  }                                                     \
+  catch( ... )                                          \
+  {                                                     \
+    this->_UnBlock( );                                  \
+    QMessageBox::critical(                              \
+      this,                                             \
+      QMessageBox::tr( "Error executing filter" ),      \
+      QMessageBox::tr( "Unknown error" )                \
+      );                                                \
+  }                                                     \
+  this->_UnBlock( )
+
+
 namespace cpExtensions
 {
   namespace QT
@@ -68,6 +113,7 @@ namespace cpBaseQtApplication
     void _SaveWorkspace( const std::string& filename );
 
     void _BackgroundProperties( unsigned int i );
+    void _DataProperties( const std::string& actor );
 
   protected slots:
     void _InteractiveLoadPlugins( );