1 #ifndef __cpBaseQtApplication__MainWindow__h__
2 #define __cpBaseQtApplication__MainWindow__h__
4 #include <cpBaseQtApplication_Export.h>
7 #include <cpPlugins/Interface/Plugins.h>
8 #include <cpPlugins/Interface/Workspace.h>
9 #include <cpBaseQtApplication/Blocker.h>
11 // -------------------------------------------------------------------------
12 #define cpBaseQtApplication_ConnectAction( _act_, _slt_ ) \
14 this->m_UI->_act_, SIGNAL( triggered( ) ), this, SLOT( _slt_( ) ) \
17 // -------------------------------------------------------------------------
18 #define cpBaseQtApplication_Execute( _cmd_ ) \
20 this->m_Blocker.block( ); \
24 this->m_Blocker.unblock( ); \
26 catch( std::exception& err ) \
28 this->m_Blocker.unblock( ); \
29 QMessageBox::critical( \
31 QMessageBox::tr( "Error executing filter" ), \
32 QMessageBox::tr( err.what( ) ) \
37 this->m_Blocker.unblock( ); \
38 QMessageBox::critical( \
40 QMessageBox::tr( "Error executing filter" ), \
41 QMessageBox::tr( "Unknown error" ) \
44 this->m_Blocker.unblock( ); \
47 // -------------------------------------------------------------------------
48 namespace cpExtensions { namespace QT { class ActorsWidgetInterface; } }
50 // -------------------------------------------------------------------------
51 namespace cpBaseQtApplication
53 namespace Pipeline { class Canvas; }
54 namespace Plugins { class Navigator; }
58 class cpBaseQtApplication_EXPORT MainWindow
64 typedef MainWindow Self;
65 typedef QMainWindow Superclass;
67 typedef cpPlugins::Interface::Plugins TPlugins;
68 typedef cpPlugins::Interface::Workspace TWorkspace;
72 int argc, char* argv[],
73 QWidget* parent = NULL
75 virtual ~MainWindow( );
77 TWorkspace* workspace( );
78 const TWorkspace* workspace( ) const;
80 Pipeline::Canvas* canvas( );
81 const Pipeline::Canvas* canvas( ) const;
82 void setCanvas( Pipeline::Canvas* c );
84 Plugins::Navigator* navigator( );
85 const Plugins::Navigator* navigator( ) const;
86 void setNavigator( Plugins::Navigator* n );
88 cpExtensions::QT::ActorsWidgetInterface* viewer( );
89 const cpExtensions::QT::ActorsWidgetInterface* viewer( ) const;
90 void setViewer( cpExtensions::QT::ActorsWidgetInterface* v );
93 template< class _TViewer >
94 _TViewer* _configureViewer( QWidget* w )
96 _TViewer* v = dynamic_cast< _TViewer* >( w );
103 void _loadPlugins( const std::string& filename );
104 void _loadPlugins( );
105 void _loadPluginsFromPath( const std::string& path );
106 void _loadPluginsFromPath( );
108 void _clearWorkspace( );
110 void _saveWorkspace( const std::string& fname );
111 void _saveWorkspace( );
113 void _loadWorkspace( const std::string& fname );
114 void _loadWorkspace( );
116 void _actorsProperties( );
120 std::string m_RunPath;
121 TPlugins::Pointer m_Plugins;
122 std::string m_LastSaveFileName;
123 TWorkspace::Pointer m_Workspace;
125 std::string m_BaseWindowTitle;
127 Pipeline::Canvas* m_Canvas;
128 Plugins::Navigator* m_Navigator;
129 cpExtensions::QT::ActorsWidgetInterface* m_Viewer;
134 #endif // __cpBaseQtApplication__MainWindow__h__