+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);
+ aResult->setToolTip("Apply");
+ }
+ break;
+ case Abort:
+ case AbortAll: {
+ aResult = new QAction(QIcon(":pictures/button_cancel.png"), "", theParent);
+ aResult->setToolTip("Cancel");
+ if (theId == Abort) {
+ aResult->setShortcut(QKeySequence(Qt::Key_Escape));
+ }
+ }
+ break;
+ case Help: {
+ aResult = new QAction(QIcon(":pictures/button_help.png"), "", theParent);
+ aResult->setToolTip("Help");
+ }
+ 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;
+}
+