X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2FInteractiveDeformableMeshSegmentation%2FMainWnd_LoadPlugins.cxx;fp=appli%2FInteractiveDeformableMeshSegmentation%2FMainWnd_LoadPlugins.cxx;h=8c01ef8e1b26fa212b6e54787da77202c58489b6;hb=93ddd2fe04d05b28dff31448032fd3af93ffe750;hp=8f673c1a638095a6d6c1088a1b4b9d50e54e973d;hpb=6d6bf5d5e3b9318a507216f2f231c32299d1a941;p=cpMesh.git diff --git a/appli/InteractiveDeformableMeshSegmentation/MainWnd_LoadPlugins.cxx b/appli/InteractiveDeformableMeshSegmentation/MainWnd_LoadPlugins.cxx index 8f673c1..8c01ef8 100644 --- a/appli/InteractiveDeformableMeshSegmentation/MainWnd_LoadPlugins.cxx +++ b/appli/InteractiveDeformableMeshSegmentation/MainWnd_LoadPlugins.cxx @@ -30,52 +30,55 @@ _LoadPlugins( ) std::remove_if( clean_line.begin( ), clean_line.end( ), isspace ), clean_line.end( ) ); - 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[ 0 ] != '#' ) { - if( clean_line != "" ) + if( + clean_line != "sectionplugins" && + clean_line != "sectionbase_classes" && + clean_line != "sectionsegmentation_classes" && + clean_line != "sectionsegmentation_filter_classes" && + clean_line != "sectionmesh_filter_classes" + ) { - if( actual_section == "sectionplugins" ) + if( clean_line != "" ) { - if( !( this->m_Plugins.Load( clean_line ) ) ) + if( actual_section == "sectionplugins" ) { - QMessageBox::warning( - this, - tr( "Ignoring plugin" ), - tr( clean_line.c_str( ) ) - ); + 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 - } - 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 + } + else if( clean_line != "" ) + { + if( clean_line[ 0 ] != '#' ) + actual_section = clean_line; } // fi - } - else if( clean_line != "" ) - { - if( clean_line[ 0 ] != '#' ) - actual_section = clean_line; } // fi - std::getline( in, line ); } // elihw @@ -94,6 +97,18 @@ _LoadPlugins( ) } // 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 @@ -235,4 +250,19 @@ _CheckClassesInPlugins( const TStringMap& classes ) return( r ); } +// ------------------------------------------------------------------------- +void MainWnd:: +_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 ); + + } // rof +} + // eof - $RCSfile$