X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2FcpPipelineEditor%2FcpPipelineEditor.cxx;h=872b4f4a33907f9f2cbf2539f16a4c07439b5fdb;hb=f4aeff15ebb41183d4b89f41b29ec26043848722;hp=9abdd013aabdffb41f5125e2bbd66efba3172f3e;hpb=2c372f652bce67b347cd91737916504a054604a3;p=cpPlugins.git diff --git a/appli/cpPipelineEditor/cpPipelineEditor.cxx b/appli/cpPipelineEditor/cpPipelineEditor.cxx index 9abdd01..872b4f4 100644 --- a/appli/cpPipelineEditor/cpPipelineEditor.cxx +++ b/appli/cpPipelineEditor/cpPipelineEditor.cxx @@ -1,6 +1,8 @@ #include "cpPipelineEditor.h" #include "ui_cpPipelineEditor.h" +#include "QNodesEditor.h" + #include #include #include @@ -32,6 +34,7 @@ cpPipelineEditor( QWidget* parent ) cpPipelineEditor_ConnectButton( LoadPluginsFile ); cpPipelineEditor_ConnectButton( LoadPluginsPath ); cpPipelineEditor_ConnectAction( OpenWorkspace ); + cpPipelineEditor_ConnectAction( SaveWorkspace ); } // ------------------------------------------------------------------------- @@ -136,6 +139,7 @@ _ButtonLoadPluginsFile( ) ); // Update view + this->m_UI->Canvas->editor( )->setWorkspace( this->m_Workspace ); this->_UpdateLoadedPlugins( ); } @@ -163,6 +167,7 @@ _ButtonLoadPluginsPath( ) ); // Update view + this->m_UI->Canvas->editor( )->setWorkspace( this->m_Workspace ); this->_UpdateLoadedPlugins( ); } @@ -187,7 +192,7 @@ _ActionOpenWorkspace( ) std::string err = this->m_Workspace->LoadWorkspace( fname ); if( err == "" ) { - this->m_UI->Canvas->setWorkspace( this->m_Workspace ); + this->m_UI->Canvas->editor( )->setWorkspace( this->m_Workspace ); } else { @@ -202,4 +207,32 @@ _ActionOpenWorkspace( ) } // fi } +// ------------------------------------------------------------------------- +void cpPipelineEditor:: +_ActionSaveWorkspace( ) +{ + if( this->m_Workspace == NULL ) + return; + + QFileDialog dlg( this ); + dlg.setFileMode( QFileDialog::AnyFile ); + dlg.setDirectory( "." ); + dlg.setAcceptMode( QFileDialog::AcceptSave ); + 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( ); + + std::string err = this->m_Workspace->SaveWorkspace( fname ); + if( err != "" ) + QMessageBox::critical( + this, + QMessageBox::tr( "Error saving workspace" ), + QMessageBox::tr( err.c_str( ) ) + ); +} + // eof - $RCSfile$