X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FCAM%2FCAM_Application.cxx;h=e45d4a8cdf24950d56b0d38690062d21b45dd272;hb=e6caa123c65e3c4a3017364ec5bb4225fd898465;hp=fc99c754c652d4463fe1de5529deab84285fd33f;hpb=e07448c48ea5b2127e34fc7b8c3427d01c7ce17b;p=modules%2Fgui.git diff --git a/src/CAM/CAM_Application.cxx b/src/CAM/CAM_Application.cxx index fc99c754c..e45d4a8cd 100755 --- a/src/CAM/CAM_Application.cxx +++ b/src/CAM/CAM_Application.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -44,6 +44,7 @@ #endif #include +#include namespace { @@ -82,6 +83,8 @@ extern "C" CAM_EXPORT SUIT_Application* createApplication() - etc */ +CAM_Application::ModuleInfoList CAM_Application::myInfoList; + /*! \brief Constructor. @@ -361,7 +364,7 @@ CAM_Module* CAM_Application::loadModule( const QString& modName, const bool show char* version = getVersion ? getVersion() : 0; - if(version) { + if ( version ) { for ( ModuleInfoList::iterator it = myInfoList.begin(); it != myInfoList.end(); ++it ) { if ( (*it).title == modName ) { if( (*it).version.isEmpty() ) { @@ -382,7 +385,7 @@ CAM_Module* CAM_Application::loadModule( const QString& modName, const bool show */ bool CAM_Application::activateModule( const QString& modName ) { - if ( !modName.isEmpty() && !activeStudy() || myBlocked ) + if ( (!modName.isEmpty() && !activeStudy()) || myBlocked ) return false; // VSR 25/10/2011: prevent nested activation/deactivation @@ -455,6 +458,67 @@ bool CAM_Application::activateModule( CAM_Module* mod ) return true; } +/*! + \brief Load module \a modName and activate its operation, corresponding to \a actionId. + This method is dedicated to run operations of some module from any other module. + \param modName module name + \param actionId is a numerical unique operation identifier + \return \c true in case of success and \c false otherwise +*/ +bool CAM_Application::activateOperation( const QString& modName, int actionId ) +{ + if (isModuleAccessible(modName)) { + CAM_Module* mod = loadModule(modName, false); + if (mod) { + addModule(mod); + return mod->activateOperation(actionId); + } + } + return false; +} + +/*! + \brief Load module \a modName and activate its operation, corresponding to \a actionId. + This method is dedicated to run operations of some module from any other module. + \param modName module name + \param actionId is a string unique operation identifier + \return \c true in case of success and \c false otherwise +*/ +bool CAM_Application::activateOperation( const QString& modName, const QString& actionId ) +{ + if (isModuleAccessible(modName)) { + CAM_Module* mod = loadModule(modName, false); + if (mod) { + addModule(mod); + return mod->activateOperation(actionId); + } + } + return false; +} + +/*! + \brief Load module \a modName and activate its operation, + corresponding to \a actionId and \a pluginName. + This method is dedicated to run operations of some module from any other module. + \param modName module name + \param actionId is a string unique operation identifier + \param pluginName is a name of a plugin where the operation is implemented + \return \c true in case of success and \c false otherwise +*/ +bool CAM_Application::activateOperation( const QString& modName, + const QString& actionId, + const QString& pluginName ) +{ + if (isModuleAccessible(modName)) { + CAM_Module* mod = loadModule(modName, false); + if (mod) { + addModule(mod); + return mod->activateOperation(actionId, pluginName); + } + } + return false; +} + /*! \brief Create new study. \return study object pointer @@ -518,7 +582,7 @@ void CAM_Application::moduleAdded( CAM_Module* /*mod*/ ) \param title module title (user name) \return module name or null QString if module is not found */ -QString CAM_Application::moduleName( const QString& title ) const +QString CAM_Application::moduleName( const QString& title ) { QString res; for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it ) @@ -534,7 +598,7 @@ QString CAM_Application::moduleName( const QString& title ) const \param name module name \return module title (user name) or null QString if module is not found */ -QString CAM_Application::moduleTitle( const QString& name ) const +QString CAM_Application::moduleTitle( const QString& name ) { QString res; for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it ) @@ -550,7 +614,7 @@ QString CAM_Application::moduleTitle( const QString& name ) const \param name module name \return module icon or null QString if module is not found */ -QString CAM_Application::moduleIcon( const QString& name ) const +QString CAM_Application::moduleIcon( const QString& name ) { QString res; for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isNull(); ++it ) @@ -568,7 +632,7 @@ QString CAM_Application::moduleIcon( const QString& name ) const \param title module title (user name) \return \c true if module is accessible (can be loaded) or \c false otherwise */ -bool CAM_Application::isModuleAccessible( const QString& title ) const +bool CAM_Application::isModuleAccessible( const QString& title ) { bool found = false; bool blocked = false; @@ -599,7 +663,7 @@ bool CAM_Application::isModuleAccessible( const QString& title ) const \param full if \c true, return full library name, otherwise return its internal name \return module library name or null QString if module is not found */ -QString CAM_Application::moduleLibrary( const QString& title, const bool full ) const +QString CAM_Application::moduleLibrary( const QString& title, const bool full ) { QString res; for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it ) @@ -777,8 +841,8 @@ void CAM_Application::createEmptyStudy() /*! \brief Return information about version of the each module. */ -CAM_Application::ModuleShortInfoList CAM_Application::getVersionInfo() const { - +CAM_Application::ModuleShortInfoList CAM_Application::getVersionInfo() +{ ModuleShortInfoList info; ModuleShortInfo kernel;