#include "cpPipelineEditor.h" #include "ui_cpPipelineEditor.h" #include #include #include // ------------------------------------------------------------------------- #define cpPipelineEditor_ConnectAction( ACTION ) \ QObject::connect( \ this->m_UI->Action##ACTION, SIGNAL( triggered( ) ), \ this, SLOT( _Action##ACTION( ) ) \ ) // ------------------------------------------------------------------------- cpPipelineEditor:: cpPipelineEditor( QWidget* parent ) : QMainWindow( parent ), m_UI( new Ui::cpPipelineEditor ), m_Workspace( NULL ) { this->m_UI->setupUi( this ); // Connect actions to slots cpPipelineEditor_ConnectAction( OpenWorkspace ); } // ------------------------------------------------------------------------- cpPipelineEditor:: ~cpPipelineEditor( ) { delete this->m_UI; if( this->m_Workspace != NULL ) delete this->m_Workspace; } // ------------------------------------------------------------------------- void cpPipelineEditor:: _ActionOpenWorkspace( ) { QFileDialog dlg( this ); dlg.setFileMode( QFileDialog::ExistingFile ); dlg.setDirectory( "." ); dlg.setNameFilter( QFileDialog::tr( "Workspace file (*.xml);;All files (*)" ) ); dlg.setDefaultSuffix( QFileDialog::tr( "xml" ) ); if( !( dlg.exec( ) ) ) return; std::string fname = dlg.selectedFiles( ).at( 0 ).toStdString( ); if( this->m_Workspace != NULL ) delete this->m_Workspace; this->m_Workspace = new cpPlugins::Interface::Workspace( ); std::string err = this->m_Workspace->LoadWorkspace( fname ); if( err == "" ) { this->m_UI->Canvas->setWorkspace( this->m_Workspace ); } else { delete this->m_Workspace; this->m_Workspace = NULL; QMessageBox::critical( this, QMessageBox::tr( "Error loading workspace" ), QMessageBox::tr( err.c_str( ) ) ); } // fi } // eof - $RCSfile$