#ifndef __CPBASEQTAPPLICATION__MAINWINDOW__H__ #define __CPBASEQTAPPLICATION__MAINWINDOW__H__ #include #include #include #include // ------------------------------------------------------------------------- #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 { class SimpleMPRWidget; } } class QTreeWidget; namespace cpBaseQtApplication { class Editor; /** */ class cpBaseQtApplication_EXPORT MainWindow : public QMainWindow { Q_OBJECT; public: typedef MainWindow Self; typedef QMainWindow Superclass; protected: /** */ class _TBlocker : public QObject { protected: virtual bool eventFilter( QObject* obj, QEvent* event ) ITK_OVERRIDE; }; public: explicit MainWindow( int argc, char* argv[], QApplication* app, QWidget* parent = NULL ); virtual ~MainWindow( ); void UpdateEnvironment( ); protected: void _Configure( QTreeWidget* tree, cpExtensions::QT::SimpleMPRWidget* mpr, cpBaseQtApplication::Editor* editor ); void _ClearWorkspace( ); void _AddEnvironments( const std::string& environments ); void _LoadPlugins( const std::string& filename ); void _LoadPluginsFromPath( const std::string& path ); void _UpdateLoadedPlugins( ); void _Block( ); void _UnBlock( ); void _LoadWorkspace( const std::string& filename ); void _SaveWorkspace( const std::string& filename ); void _BackgroundProperties( unsigned int i ); void _DataProperties( const std::string& actor ); protected slots: void _InteractiveLoadPlugins( ); void _InteractiveLoadPluginsFromPath( ); void _ShowPlugins( ); void _InteractiveLoadWorkspace( ); void _InteractiveSaveWorkspace( ); void _InteractiveAddEnviromentPaths( ); void _ExecFilter( const std::string& filter_name ); void _ShowData( const std::string& filter_name, const std::string& output_name ); void _HideData( const std::string& filter_name, const std::string& output_name ); void _DataProperties( const std::string& filter_name, const std::string& output_name ); protected: QApplication* m_Application; _TBlocker m_Blocker; std::string m_PluginsPath; std::string m_RunPath; cpPlugins::Interface m_Interface; cpPlugins::Workspace m_Workspace; QTreeWidget* m_TreeWidget; Editor* m_Editor; cpExtensions::QT::SimpleMPRWidget* m_MPR; }; } // ecapseman #endif // __CPBASEQTAPPLICATION__MAINWINDOW__H__ // eof - $RCSfile$