Salome HOME
Adding test for bos #41748 [CEA] Issue in interpolation edition
[modules/shaper.git] / src / XGUI / XGUI_MenuMgr.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 73d0447..d916a92
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include <XGUI_MenuMgr.h>
@@ -41,6 +40,7 @@
 #endif
 
 #include <ModuleBase_IModule.h>
+#include <ModuleBase_Tools.h>
 
 #include <QObject>
 #include <QAction>
@@ -75,15 +75,18 @@ void XGUI_MenuMgr::addFeature(const std::shared_ptr<Config_FeatureMessage>& theM
 #endif
     return;
   }
+  QString aWchName = ModuleBase_Tools::translate("workshop", theMessage->workbenchId());
+  theMessage->setToolBarId(ModuleBase_Tools::translate("workshop",
+      theMessage->workbenchId()).toStdString());
 #ifdef HAVE_SALOME
-  std::shared_ptr<XGUI_MenuWorkbench> aWorkbench = findWorkbench(theMessage->workbenchId());
+  std::string aWchNameString = aWchName.toStdString();
+  std::shared_ptr<XGUI_MenuWorkbench> aWorkbench = findWorkbench(aWchNameString);
   std::shared_ptr<XGUI_MenuGroup> aGroup = aWorkbench->findGroup(theMessage->groupId());
   aGroup->setFeatureInfo(theMessage);
 #else
   ActionInfo aFeatureInfo;
   aFeatureInfo.initFrom(theMessage);
 
-  QString aWchName = QString::fromStdString(theMessage->workbenchId());
   QStringList aNestedFeatures =
       QString::fromStdString(theMessage->nestedFeatures()).split(" ", QString::SkipEmptyParts);
   QList<QAction*> aNestedActList;
@@ -99,8 +102,7 @@ void XGUI_MenuMgr::addFeature(const std::shared_ptr<Config_FeatureMessage>& theM
     }
     if (aNestedActions.contains(FEATURE_WHEN_NESTED_ABORT)) {
       QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll);
-      QObject::connect(anAction, SIGNAL(triggered()),
-                       anOperationMgr, SLOT(onAbortAllOperations()));
+      QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(onAbortAllOperation()));
       aNestedActList << anAction;
     }
   }
@@ -171,8 +173,8 @@ void XGUI_MenuMgr::createFeatureActions()
         aGroup->featuresInfo();
       std::list<std::shared_ptr<Config_FeatureMessage> >::const_iterator aFIt =
         aFeaturesInfo.begin(), aFLast = aFeaturesInfo.end();
-      int aFSize = aFeaturesInfo.size();
-      for(int i = 0; aFIt != aFLast; aFIt++, i++) {
+      size_t aFSize = aFeaturesInfo.size();
+      for(size_t i = 0; aFIt != aFLast; aFIt++, i++) {
         std::shared_ptr<Config_FeatureMessage> aMessage = *aFIt;
         bool aUseSeparator = i == aFSize-1;
         QAction* aAction = buildAction(aMessage, aWchName, aUseSeparator);
@@ -204,14 +206,13 @@ QAction* XGUI_MenuMgr::buildAction(const std::shared_ptr<Config_FeatureMessage>&
     XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
     XGUI_ActionsMgr* anActionsMgr = myWorkshop->actionsMgr();
     if (aNestedActions.contains(FEATURE_WHEN_NESTED_ACCEPT)) {
-      QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll);
+      anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll);
       QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(commitAllOperations()));
       aNestedActList << anAction;
     }
     if (aNestedActions.contains(FEATURE_WHEN_NESTED_ABORT)) {
-      QAction* anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll);
-      QObject::connect(anAction, SIGNAL(triggered()),
-                       anOperationMgr, SLOT(onAbortAllOperations()));
+      anAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll);
+      QObject::connect(anAction, SIGNAL(triggered()), anOperationMgr, SLOT(onAbortAllOperation()));
       aNestedActList << anAction;
     }
     anAction = aSalomeConnector->addFeatureOfNested(theWchName.c_str(), aFeatureInfo,