]> Creatis software - cpPlugins.git/blobdiff - lib/cpBaseQtApplication/MainWindow.cxx
...
[cpPlugins.git] / lib / cpBaseQtApplication / MainWindow.cxx
index 1bdca767b08be6428f5c5336d663c35d78a176d9..668eb3bff5951d0e3dae76672b5935957d4bce00 100644 (file)
 
 // -------------------------------------------------------------------------
 cpBaseQtApplication::MainWindow::
-MainWindow(
-  int argc, char* argv[],
-  QWidget* parent
-  )
+MainWindow( int argc, char* argv[], QWidget* parent )
   : Superclass( parent ),
     m_LastSaveFileName( "" ),
     m_BaseWindowTitle( "cpBaseQtApplication" ),
@@ -22,17 +19,8 @@ MainWindow(
     m_Viewer( NULL )
 {
   this->m_RunPath = QDir( "." ).canonicalPath( ).toStdString( );
-  this->m_Plugins = TPlugins::New( );
-  try
-  {
-    this->m_Plugins->GuessEnvironment( this->m_RunPath );
-    this->m_Plugins->GuessPlugins( );
-  }
-  catch( std::exception& err )
-  {
-    QMessageBox::critical( this, "Error guessing plugins.", err.what( ) );
-
-  } // yrt
+  this->m_Loader.GuessEnvironment( this->m_RunPath );
+  this->m_Loader.SaveEnvironment( this->m_RunPath );
   this->_clearWorkspace( );
 }
 
@@ -143,7 +131,7 @@ _loadPlugins( const std::string& filename )
 {
   try
   {
-    this->m_Plugins->LoadPluginsFile( filename );
+    this->m_Loader.Register( filename );
     if( this->m_Navigator != NULL )
       this->m_Navigator->Update( );
   }
@@ -183,8 +171,8 @@ _loadPluginsFromPath( const std::string& path )
 {
   try
   {
-    this->m_Plugins->LoadPluginsDirectory( path );
-    this->m_Plugins->SaveEnvironment( this->m_RunPath );
+    this->m_Loader.RegisterFromDirectory( path );
+    this->m_Loader.SaveEnvironment( this->m_RunPath );
     if( this->m_Navigator != NULL )
       this->m_Navigator->Update( );
   }