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();
}
}
-QKeySequence XGUI_ActionsMgr::registerShortcut(const QString& theKeySequence)
+QKeySequence XGUI_ActionsMgr::registerShortcut(const QKeySequence& theKeySequence)
{
if (theKeySequence.isEmpty()) {
return QKeySequence();
}
- QKeySequence aResult(theKeySequence);
- if (myShortcuts.contains(aResult)) {
- QString aMessage = tr("Shortcut %1 is already defined. Ignore.").arg(theKeySequence);
+ if (myShortcuts.contains(theKeySequence)) {
+ QString aMessage = tr("Shortcut %1 is already defined. Ignore.");
+ aMessage = aMessage.arg(theKeySequence.toString());
Events_Error::send(aMessage.toStdString());
return QKeySequence();
}
- myShortcuts.append(aResult);
+ myShortcuts.append(theKeySequence);
+ return theKeySequence;
+}
+
+QKeySequence XGUI_ActionsMgr::registerShortcut(const QString& theKeySequence)
+{
+ if (theKeySequence.isEmpty()) {
+ return QKeySequence();
+ }
+ QKeySequence aResult(theKeySequence);
+ registerShortcut(aResult);
return aResult;
}
}
}
+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())