+ QAction* aResult = NULL;
+ if (myOperationActions.contains(theId)) {
+ aResult = myOperationActions.value(theId);
+ //if (theParent && aResult->parent() != theParent) {
+ // aResult->setParent(theParent);
+ //}
+ } else {
+ QWidget* aParent = myWorkshop->desktop();
+ switch (theId) {
+ case Accept:
+ case AcceptAll: {
+ aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_ok.png"),
+ "Apply" /*empty to show error*/, aParent);
+ }
+ break;
+ case AcceptPlus: {
+ aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_ok-plus.png"),
+ "Apply and continue" /*empty to show error*/, aParent);
+ }
+ break;
+ case Abort:
+ case AbortAll: {
+ aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_cancel.png"), "Cancel",
+ aParent);
+ }
+ break;
+ case Help: {
+ aResult = ModuleBase_Tools::createAction(QIcon(":pictures/button_help.png"), "Help",
+ aParent);
+ }
+ break;
+ case Preview: {
+ aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"),
+ aParent, 0, 0, "Compute preview");
+ aResult->setStatusTip(aResult->toolTip());
+ }
+ break;
+ default:
+ break;
+ }
+ myOperationActions.insert(theId, aResult);
+ }
+ return aResult;
+}
+
+QAction* XGUI_ActionsMgr::action(const QString& theId)
+{
+ QAction* anAction = 0;
+ if(myActions.contains(theId)) {
+ anAction = myActions.value(theId);
+ }
+ return anAction;
+}
+
+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()
+{
+ foreach(QString eachAction, myActions.keys()) {
+ if (myActions.contains(eachAction)) {
+ QAction* aAction = myActions[eachAction];
+ aAction->setEnabled(true);
+ }