Salome HOME
Constriction type for all sketch entities
[modules/shaper.git] / src / XGUI / XGUI_ActionsMgr.cpp
index 0d9c4d01fdf5f435f736757ed67f6a6191199b88..33f1826a792e99d7bcb183d94f35cddb37e78f2d 100644 (file)
@@ -142,9 +142,6 @@ void XGUI_ActionsMgr::updateOnViewSelection()
   foreach(QString aId, nestedCommands(aFeatureId)) {
     std::list<ModelAPI_Validator*> aValidators;
     std::list<std::list<std::string> > anArguments;
-    if (!anArguments.empty()) {
-      std::list<std::string> firstArg = anArguments.front();
-    }
     aFactory->validators(aId.toStdString(), aValidators, anArguments);
     std::list<ModelAPI_Validator*>::iterator aValidator = aValidators.begin();
     std::list<std::list<std::string> >::iterator aValidatorArgs = anArguments.begin();
@@ -213,6 +210,51 @@ void XGUI_ActionsMgr::processEvent(const std::shared_ptr<Events_Message>& theMes
   }
 }
 
+QAction* XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId, QObject* theParent)
+{
+  QAction* aResult = NULL;
+  if (myOperationActions.contains(theId)) {
+    aResult = myOperationActions.value(theId);
+    if (theParent && aResult->parent() != theParent) {
+      aResult->setParent(theParent);
+    }
+  } else {
+    switch (theId) {
+      case Accept:
+      case AcceptAll:
+        aResult = new QAction(QIcon(":pictures/button_ok.png"), "", theParent);
+        break;
+      case Abort:
+      case AbortAll: {
+        aResult = new QAction(QIcon(":pictures/button_cancel.png"), "", theParent);
+        if(theId == Abort) {
+          aResult->setShortcut(QKeySequence(Qt::Key_Escape));
+        }
+      }
+      break;
+      case Help:
+        aResult = new QAction(QIcon(":pictures/button_help.png"), "", theParent);
+        break;
+      default:
+        break;
+    }
+    myOperationActions.insert(theId, aResult);
+  }
+  return aResult;
+}
+
+ActionInfo XGUI_ActionsMgr::actionInfoById(const QString& theId)
+{
+  ActionInfo aResult;
+  if(myActions.contains(theId)) {
+    aResult.initFrom(myActions.value(theId));
+  } else {
+   aResult.id = theId;
+   aResult.text = theId;
+  }
+  return aResult;
+}
+
 void XGUI_ActionsMgr::setAllEnabled(bool isEnabled)
 {
   foreach(QString eachAction, myActions.keys())