#include <cpExtensions/QT/SimpleMPRWidget.h>
#include <cpBaseQtApplication/ActorPropertiesQDialog.h>
#include <cpBaseQtApplication/Editor.h>
+#include <cpBaseQtApplication/PathsDialog.h>
#include <vtkRenderer.h>
#include <QApplication>
#include <QColorDialog>
m_Editor( NULL ),
m_MPR( NULL )
{
- QFileInfo i( argv[ 0 ] );
- if( i.exists( ) )
- {
- this->m_ExecutionPath = i.canonicalPath( ).toStdString( );
- try
- {
- this->m_Interface.OpenEnvironments( this->m_ExecutionPath );
- this->m_Interface.UpdateEnvironments( this->m_ExecutionPath );
- }
- catch( ... ) { }
- }
- else
- this->m_ExecutionPath = "";
+ QFileInfo e_path( argv[ 0 ] );
+ QDir r_path( "." );
+ this->m_RunPath = r_path.canonicalPath( ).toStdString( );
+ std::stringstream paths;
+ paths
+ << e_path.canonicalPath( ).toStdString( )
+ << cpPlugins_SEPARATOR
+ << this->m_RunPath;
+
+ try { this->m_Interface.AddEnvironments( this->m_RunPath ); }
+ catch( ... ) { }
+ try { this->m_Interface.OpenEnvironments( this->m_RunPath ); }
+ catch( ... ) { }
+ try { this->m_Interface.SaveEnvironments( this->m_RunPath ); }
+ catch( ... ) { }
+ this->UpdateEnvironment( );
this->m_Workspace.SetInterface( &( this->m_Interface ) );
}
{
try
{
- this->m_Interface.LoadEnvironment( );
+ this->m_Interface.LoadEnvironments( );
this->m_Interface.GuessPlugins( );
}
catch( std::exception& err )
this->m_Workspace.Clear( );
}
+// -------------------------------------------------------------------------
+void cpBaseQtApplication::MainWindow::
+_AddEnvironments( const std::string& environments )
+{
+ try { this->m_Interface.AddEnvironments( environments ); }
+ catch( ... ) { }
+ try { this->m_Interface.SaveEnvironments( this->m_RunPath ); }
+ catch( ... ) { }
+ this->UpdateEnvironment( );
+}
+
// -------------------------------------------------------------------------
void cpBaseQtApplication::MainWindow::
_LoadPlugins( const std::string& filename )
);
}
-// -------------------------------------------------------------------------
-void cpBaseQtApplication::MainWindow::
-_ShowPlugins( )
-{
- auto paths = this->m_Interface.GetPaths( );
- auto plugins = this->m_Interface.GetPlugins( );
- std::stringstream info;
- info << "----- PATHS -----" << std::endl;
- for( auto i = paths.begin( ); i != paths.end( ); ++i )
- info << " " << *i << std::endl;
- info << std::endl << "----- PLUGINS -----" << std::endl;
- for( auto i = plugins.begin( ); i != plugins.end( ); ++i )
- info << " " << *i << std::endl;
- QMessageBox::information(
- this,
- "Loaded libraries and plugins information",
- info.str( ).c_str( )
- );
-}
-
// -------------------------------------------------------------------------
void cpBaseQtApplication::MainWindow::
_Block( )
this->_LoadPluginsFromPath( d.selectedFiles( ).begin( )->toStdString( ) );
}
+// -------------------------------------------------------------------------
+void cpBaseQtApplication::MainWindow::
+_ShowPlugins( )
+{
+ auto paths = this->m_Interface.GetPaths( );
+ auto plugins = this->m_Interface.GetPlugins( );
+ std::stringstream info;
+ info << "----- PATHS -----" << std::endl;
+ for( auto i = paths.begin( ); i != paths.end( ); ++i )
+ info << " " << *i << std::endl;
+ info << std::endl << "----- PLUGINS -----" << std::endl;
+ for( auto i = plugins.begin( ); i != plugins.end( ); ++i )
+ info << " " << *i << std::endl;
+ QMessageBox::information(
+ this,
+ "Loaded libraries and plugins information",
+ info.str( ).c_str( )
+ );
+}
+
// -------------------------------------------------------------------------
void cpBaseQtApplication::MainWindow::
_InteractiveLoadWorkspace( )
this->_SaveWorkspace( dlg.selectedFiles( ).begin( )->toStdString( ) );
}
+// -------------------------------------------------------------------------
+void cpBaseQtApplication::MainWindow::
+_InteractiveAddEnviromentPaths( )
+{
+ PathsDialog dlg( this );
+ dlg.addPaths( this->m_Interface.GetPaths( ) );
+ if( dlg.exec( ) )
+ {
+ auto paths = dlg.getPaths( );
+ std::stringstream envs;
+ for( auto p = paths.begin( ); p != paths.end( ); ++p )
+ envs << *p << cpPlugins_SEPARATOR;
+ this->_AddEnvironments( envs.str( ) );
+ this->UpdateEnvironment( );
+
+ } // fi
+}
+
// -------------------------------------------------------------------------
void cpBaseQtApplication::MainWindow::
_ExecFilter( const std::string& filter_name )