]> Creatis software - cpMesh.git/blobdiff - appli/InteractiveDeformableMeshSegmentation/MainWnd_LoadPlugins.cxx
...
[cpMesh.git] / appli / InteractiveDeformableMeshSegmentation / MainWnd_LoadPlugins.cxx
index 27fbfe2fab30bcaad8ded329f0107fb87856e97b..7d8ab32cb5b9e12979a38c1a8ddffebc2f341cf5 100644 (file)
 bool MainWnd::
 _LoadPlugins( )
 {
-  // Clear states
-  this->m_Plugins.UnloadAll( );
-  this->m_BaseClasses.clear( );
-  this->m_SegmentationClasses.clear( );
-  this->m_SegmentationFilterClasses.clear( );
-  this->m_MeshFilterClasses.clear( );
-
-  // Read file and load plugins
-  std::ifstream in( this->m_PluginsConfigurationFile.c_str( ) );
-  if( !in )
-    return( false );
-  this->m_LastOpenedFile = this->m_PluginsConfigurationFile;
-  std::string line, actual_section = "";
-  std::getline( in, line );
-  while( !( in.eof( ) ) )
-  {
-    std::string clean_line = line;
-    clean_line.erase(
-      std::remove_if( clean_line.begin( ), clean_line.end( ), isspace ),
-      clean_line.end( )
-      );
-    if( clean_line[ 0 ] != '#' )
-    {
-      if(
-        clean_line != "sectionplugins"                     &&
-        clean_line != "sectionbase_classes"                &&
-        clean_line != "sectionsegmentation_classes"        &&
-        clean_line != "sectionsegmentation_filter_classes" &&
-        clean_line != "sectionmesh_filter_classes"
-        )
-      {
-        if( clean_line != "" )
-        {
-          if( actual_section == "sectionplugins" )
-          {
-            if( !( this->m_Plugins.Load( clean_line ) ) )
-            {
-              QMessageBox::warning(
-                this,
-                tr( "Ignoring plugin" ),
-                tr( clean_line.c_str( ) )
-                );
-
-            } // fi
-          }
-          else
-          {
-            std::string name =
-              clean_line.substr( clean_line.find_last_of( ":" ) + 1 );
-            if( actual_section == "sectionbase_classes" )
-              this->m_BaseClasses[ name ] = clean_line;
-            else if( actual_section == "sectionsegmentation_classes" )
-              this->m_SegmentationClasses[ name ] = clean_line;
-            else if( actual_section == "sectionsegmentation_filter_classes" )
-              this->m_SegmentationFilterClasses[ name ] = clean_line;
-            else if( actual_section == "sectionmesh_filter_classes" )
-              this->m_MeshFilterClasses[ name ] = clean_line;
-
-          } // fi
-
-        } // fi
-      }
-      else if( clean_line != "" )
-      {
-        if( clean_line[ 0 ] != '#' )
-          actual_section = clean_line;
-
-      } // fi
-
-    } // fi
-    std::getline( in, line );
-
-  } // elihw
-  in.close( );
-
-  // Check classes existence
-  if( !( this->_CheckClassesInPlugins( this->m_BaseClasses ) ) )
-  {
-    QMessageBox::critical(
-      this,
-      tr( "Could not load all base plugins." ),
-      tr( "Could not load all base plugins... Closing application!" )
-      );
-    std::exit( 1 );
-
-  } // fi
-
-  // Needed object from plugins
-  this->_AddPluginActions(
-    this->m_SegmentationClasses, this->m_UI->menuSegmentInputImage,
-    SLOT( _triggered_actionSegmentImage( ) )
-    );
-  this->_AddPluginActions(
-    this->m_SegmentationFilterClasses, this->m_UI->menuFilterSegmentedImage,
-    SLOT( _triggered_actionFilterSegmentation( ) )
-    );
-  this->_AddPluginActions(
-    this->m_MeshFilterClasses, this->m_UI->menuProcessMesh,
-    SLOT( _triggered_actionProcessMesh( ) )
-    );
-
-  // Historic objects
+//   // Clear states
+//   this->m_Plugins.UnloadAll( );
+//   this->m_BaseClasses.clear( );
+//   this->m_SegmentationClasses.clear( );
+//   this->m_SegmentationFilterClasses.clear( );
+//   this->m_MeshFilterClasses.clear( );
+
+//   // Read file and load plugins
+//   std::ifstream in( this->m_PluginsConfigurationFile.c_str( ) );
+//   if( !in )
+//     return( false );
+//   this->m_LastOpenedFile = this->m_PluginsConfigurationFile;
+//   std::string line, actual_section = "";
+//   std::getline( in, line );
+//   while( !( in.eof( ) ) )
+//   {
+//     std::string clean_line = line;
+//     clean_line.erase(
+//       std::remove_if( clean_line.begin( ), clean_line.end( ), isspace ),
+//       clean_line.end( )
+//       );
+//     if( clean_line[ 0 ] != '#' )
+//     {
+//       if(
+//         clean_line != "sectionplugins"                     &&
+//         clean_line != "sectionbase_classes"                &&
+//         clean_line != "sectionsegmentation_classes"        &&
+//         clean_line != "sectionsegmentation_filter_classes" &&
+//         clean_line != "sectionmesh_filter_classes"
+//         )
+//       {
+//         if( clean_line != "" )
+//         {
+//           if( actual_section == "sectionplugins" )
+//           {
+//             if( !( this->m_Plugins.Load( clean_line ) ) )
+//             {
+//               QMessageBox::warning(
+//                 this,
+//                 tr( "Ignoring plugin" ),
+//                 tr( clean_line.c_str( ) )
+//                 );
+
+//             } // fi
+//           }
+//           else
+//           {
+//             std::string name =
+//               clean_line.substr( clean_line.find_last_of( ":" ) + 1 );
+//             if( actual_section == "sectionbase_classes" )
+//               this->m_BaseClasses[ name ] = clean_line;
+//             else if( actual_section == "sectionsegmentation_classes" )
+//               this->m_SegmentationClasses[ name ] = clean_line;
+//             else if( actual_section == "sectionsegmentation_filter_classes" )
+//               this->m_SegmentationFilterClasses[ name ] = clean_line;
+//             else if( actual_section == "sectionmesh_filter_classes" )
+//               this->m_MeshFilterClasses[ name ] = clean_line;
+
+//           } // fi
+
+//         } // fi
+//       }
+//       else if( clean_line != "" )
+//       {
+//         if( clean_line[ 0 ] != '#' )
+//           actual_section = clean_line;
+
+//       } // fi
+
+//     } // fi
+//     std::getline( in, line );
+
+//   } // elihw
+//   in.close( );
+
+//   // Check classes existence
+//   if( !( this->_CheckClassesInPlugins( this->m_BaseClasses ) ) )
+//   {
+//     QMessageBox::critical(
+//       this,
+//       tr( "Could not load all base plugins." ),
+//       tr( "Could not load all base plugins... Closing application!" )
+//       );
+//     std::exit( 1 );
+
+//   } // fi
+
+//   // Needed object from plugins
+//   this->_AddPluginActions(
+//     this->m_SegmentationClasses, this->m_UI->menuSegmentInputImage,
+//     SLOT( _triggered_actionSegmentImage( ) )
+//     );
+//   this->_AddPluginActions(
+//     this->m_SegmentationFilterClasses, this->m_UI->menuFilterSegmentedImage,
+//     SLOT( _triggered_actionFilterSegmentation( ) )
+//     );
+//   this->_AddPluginActions(
+//     this->m_MeshFilterClasses, this->m_UI->menuProcessMesh,
+//     SLOT( _triggered_actionProcessMesh( ) )
+//     );
+
+//   // Historic objects
 }
 
 // -------------------------------------------------------------------------
 bool MainWnd::
 _CheckClassesInPlugins( const TStringMap& classes )
 {
-  bool r = true;
-  TStringMap::const_iterator cIt = classes.begin( );
-  for( ; cIt != classes.end( ); ++cIt )
-  {
-    TPluginObject* o = this->m_Plugins.CreateObject( cIt->second );
-    if( o != NULL )
-      delete o;
-    else
-      r &= false;
+//   bool r = true;
+//   TStringMap::const_iterator cIt = classes.begin( );
+//   for( ; cIt != classes.end( ); ++cIt )
+//   {
+//     TPluginObject* o = this->m_Plugins.CreateObject( cIt->second );
+//     if( o != NULL )
+//       delete o;
+//     else
+//       r &= false;
     
-  } // rof
-  return( r );
+//   } // rof
+//   return( r );
 }
 
 // -------------------------------------------------------------------------
@@ -137,13 +137,13 @@ _AddPluginActions(
   const TStringMap& classes, QMenu* menu, const char* method
   )
 {
-  TStringMap::const_iterator clIt = classes.begin( );
-  for( ; clIt != classes.end( ); ++clIt )
-  {
-    QAction* action = menu->addAction( QString( clIt->first.c_str( ) ) );
-    QObject::connect( action, SIGNAL( triggered( ) ), this, method );
+//   TStringMap::const_iterator clIt = classes.begin( );
+//   for( ; clIt != classes.end( ); ++clIt )
+//   {
+//     QAction* action = menu->addAction( QString( clIt->first.c_str( ) ) );
+//     QObject::connect( action, SIGNAL( triggered( ) ), this, method );
 
-  } // rof
+//   } // rof
 }
 
 // eof - $RCSfile$