-#include <cpPlugins/BaseQtMainWindow.h>
-
-#ifdef cpPlugins_QT4
+#include <cpPipelineEditor/BaseQtMainWindow.h>
#include <cpExtensions/QT/SimpleMPRWidget.h>
#include <cpPipelineEditor/Editor.h>
#include <QTreeWidget>
// -------------------------------------------------------------------------
-bool cpPlugins::BaseQtMainWindow::_TBlocker::
+bool cpPipelineEditor::BaseQtMainWindow::_TBlocker::
eventFilter( QObject* obj, QEvent* event )
{
return( true ); // -> Block all events
}
// -------------------------------------------------------------------------
-cpPlugins::BaseQtMainWindow::
+cpPipelineEditor::BaseQtMainWindow::
BaseQtMainWindow(
int argc, char* argv[],
QApplication* app,
m_TreeWidget( NULL ),
m_Editor( NULL )
{
- // Prepare plugins interface
+ this->m_Interface.GuessAccesiblePlugins( );
+
+ // Try to load plugins from executable dir
QFileInfo info( argv[ 0 ] );
if( info.exists( ) )
- {
- this->m_Interface.LoadConfiguration( cpPlugins_CONFIG_FILE );
- this->_LoadPluginsFromPath( this->m_PluginsPath );
- this->m_PluginsPath = info.canonicalPath( ).toStdString( );
-
- } // fi
- QDir exec_dir( "." );
- if( exec_dir.exists( ) )
- {
- this->_LoadPluginsFromPath( exec_dir.canonicalPath( ).toStdString( ) );
- this->m_PluginsPath = exec_dir.canonicalPath( ).toStdString( );
-
- } // fi
+ this->_LoadPluginsFromPath( info.canonicalPath( ).toStdString( ) );
// Prepare workspace
this->m_Workspace.SetInterface( &( this->m_Interface ) );
}
// -------------------------------------------------------------------------
-cpPlugins::BaseQtMainWindow::
+cpPipelineEditor::BaseQtMainWindow::
~BaseQtMainWindow( )
{
this->m_Interface.UnloadAll( );
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_Configure(
QTreeWidget* tree,
cpExtensions::QT::SimpleMPRWidget* mpr,
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_LoadPlugins( const std::string& filename )
{
try
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_LoadPluginsFromPath( const std::string& path )
{
try
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_UpdateLoadedPlugins( )
{
this->_Block( );
} // fi
this->_UnBlock( );
- this->m_Interface.SaveConfiguration( cpPlugins_CONFIG_FILE );
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_Block( )
{
this->m_Application->setOverrideCursor( Qt::WaitCursor );
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_UnBlock( )
{
while( this->m_Application->overrideCursor( ) )
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_LoadWorkspace( const std::string& filename )
{
std::string err = this->m_Workspace.LoadWorkspace( filename );
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_SaveWorkspace( const std::string& filename )
{
std::string err = this->m_Workspace.SaveWorkspace( filename );
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_InteractiveLoadPlugins( )
{
QFileDialog dlg( this );
dlg.setDirectory( this->m_PluginsPath.c_str( ) );
std::stringstream name_filter;
- std::string suffix = std::string( cpPlugins_PLUGIN_EXT );
+ std::string suffix = std::string( cpPlugins_LIB_EXT );
name_filter
- << "Plugins file (*." << cpPlugins_PLUGIN_EXT << ");;All files (*)";
+ << "Plugins file (*." << cpPlugins_LIB_EXT << ");;All files (*)";
dlg.setNameFilter( name_filter.str( ).c_str( ) );
dlg.setDefaultSuffix( suffix.c_str( ) );
if( !( dlg.exec( ) ) )
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_InteractiveLoadPluginsFromPath( )
{
QFileDialog dlg( this );
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_InteractiveLoadWorkspace( )
{
QFileDialog dlg( this );
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_InteractiveSaveWorkspace( )
{
QFileDialog dlg( this );
}
// -------------------------------------------------------------------------
-void cpPlugins::BaseQtMainWindow::
+void cpPipelineEditor::BaseQtMainWindow::
_ExecFilter( const std::string& filter_name )
{
this->_Block( );
- std::string err = this->m_Workspace.Execute( filter_name );
- this->_UnBlock( );
- if( err != "" )
+ 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( err.c_str( ) )
+ 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" )
);
-}
-#endif // cpPlugins_QT4
+ } // yrt
+}
// eof - $RCSfile$