return 0;
}
-//******************************************************
-void SHAPERGUI::setNestedActions(const QString& theId, const QStringList& theActions)
-{
- myNestedActions[theId] = theActions;
-}
-
-//******************************************************
-QStringList SHAPERGUI::nestedActions(const QString& theId) const
-{
- if (myNestedActions.contains(theId))
- return myNestedActions[theId];
- return QStringList();
-}
-
-//******************************************************
-void SHAPERGUI::setDocumentKind(const QString& theId, const QString& theKind)
+void SHAPERGUI::setFeatureInfo(const QString& theFeatureId,
+ const std::shared_ptr<Config_FeatureMessage>& theMessage)
{
- myDocumentType[theId] = theKind;
+ myFeaturesInfo.insert(theFeatureId, theMessage);
}
-//******************************************************
-QString SHAPERGUI::documentKind(const QString& theId) const
+const std::shared_ptr<Config_FeatureMessage>& SHAPERGUI::featureInfo(const QString& theFeatureId)
{
- if (myDocumentType.contains(theId))
- return myDocumentType[theId];
- return QString();
-
+ return myFeaturesInfo.contains(theFeatureId) ? myFeaturesInfo[theFeatureId] : NULL;
}
//******************************************************
virtual QAction* command(const QString& theId) const;
- //! Set nested actions dependent on command Id
- //! \param theId - the command ID
- //! \param theActions - the list of nested actions
- virtual void setNestedActions(const QString& theId, const QStringList& theActions);
+ //! Stores XML information for the feature kind
+ //! \param theFeatureId a feature kind
+ //! \param theMessage a container of the feature XML properties
+ virtual void setFeatureInfo(const QString& theFeatureId,
+ const std::shared_ptr<Config_FeatureMessage>& theMessage);
- //! Returns list of nested actions according to the given command ID
- virtual QStringList nestedActions(const QString& theId) const;
-
- //! Set the document kind of the action by the given command Id
- //! \param theId - the command ID
- //! \param theKind - the document kind
- virtual void setDocumentKind(const QString& theId, const QString& theKind);
-
- //! Returns the document kind of the action by the given command ID
- virtual QString documentKind(const QString& theId) const;
+ //! Returns XML information for the feature kind
+ //! \param theFeatureId a feature kind
+ //! \return theMessage a container of the feature XML properties
+ virtual const std::shared_ptr<Config_FeatureMessage>& featureInfo(const QString& theFeatureId);
//! Returns interface to Salome viewer
virtual ModuleBase_IViewer* viewer() const
/// Proxy viewer for connection to OCC Viewer in SALOME
SHAPERGUI_SalomeViewer* myProxyViewer;
- /// Map of nested actions [ActionID: list of nested actions Id]
- QMap<QString, QStringList> myNestedActions;
-
- /// Map of document types
- QMap<QString, QString> myDocumentType;
+ /// Map of feature kind to a container of XML properties for the feature
+ QMap<QString, std::shared_ptr<Config_FeatureMessage> > myFeaturesInfo;
/// Flag of opened document state
bool myIsOpened;
myActions.insert(aId, theCmd);
#ifdef HAVE_SALOME
XGUI_Workshop* aWorkshop = static_cast<XGUI_Workshop*>(parent());
- myNestedActions[aId] = aWorkshop->salomeConnector()->nestedActions(aId);
+ const std::shared_ptr<Config_FeatureMessage>& anInfo =
+ aWorkshop->salomeConnector()->featureInfo(aId);
+ if (anInfo.get())
+ myNestedActions[aId] = QString::fromStdString(anInfo->nestedFeatures())
+ .split(" ", QString::SkipEmptyParts);
#else
AppElements_Command* aXCmd = dynamic_cast<AppElements_Command*>(theCmd);
myNestedActions[aId] = aXCmd->nestedCommands();
#ifdef HAVE_SALOME
QString aId = eachAction->data().toString();
if (!aId.isEmpty()) {
- aCmdDocKind = aWorkshop->salomeConnector()->documentKind(aId);
+ aCmdDocKind = QString::fromStdString(
+ aWorkshop->salomeConnector()->featureInfo(aId)->documentKind());
}
#else
AppElements_Command* aCmd = dynamic_cast<AppElements_Command*>(eachAction);
#include <ModuleBase_ActionInfo.h>
class QMainWindow;
+class Config_FeatureMessage;
class ModuleBase_IViewer;
/**
//! Returns list of Ids of defined actions (just by NewGeom module)
virtual QStringList commandIdList() const = 0;
- //! Set nested actions dependent on command Id
- //! \param theId - the command ID
- //! \param theActions - the list of nested actions
- virtual void setNestedActions(const QString& theId, const QStringList& theActions) = 0;
+ //! Stores XML information for the feature kind
+ //! \param theFeatureId a feature kind
+ //! \param theMessage a container of the feature XML properties
+ virtual void setFeatureInfo(const QString& theFeatureId,
+ const std::shared_ptr<Config_FeatureMessage>& theMessage) = 0;
- //! Returns list of nested actions according to the given command ID
- virtual QStringList nestedActions(const QString& theId) const = 0;
-
- //! Set the document kind of the action by the given command Id
- //! \param theId - the command ID
- //! \param theKind - the document kind
- virtual void setDocumentKind(const QString& theId, const QString& theKind) = 0;
-
- //! Returns the document kind of the action by the given command ID
- virtual QString documentKind(const QString& theId) const = 0;
+ //! Returns XML information for the feature kind
+ //! \param theFeatureId a feature kind
+ //! \return theMessage a container of the feature XML properties
+ virtual const std::shared_ptr<Config_FeatureMessage>& featureInfo(const QString& theFeatureId) = 0;
//! Returns interface to Salome viewer
virtual ModuleBase_IViewer* viewer() const = 0;
// update visible state of Preview button
#ifdef HAVE_SALOME
- bool anIsAutoPreview = true;//mySalomeConnector->featureInfo(aFeatureKind)->isAutoPreview();
+ bool anIsAutoPreview = mySalomeConnector->featureInfo(aFeatureKind.c_str())->isAutoPreview();
#else
AppElements_MainMenu* aMenuBar = mainWindow()->menuObject();
AppElements_Command* aCommand = aMenuBar->feature(aFeatureKind.c_str());
return;
QStringList aGrantedIds;
- if (isSalomeMode())
- aGrantedIds = mySalomeConnector->nestedActions(theOperation->id());
+ if (isSalomeMode()) {
+ const std::shared_ptr<Config_FeatureMessage>& anInfo =
+ mySalomeConnector->featureInfo(theOperation->id());
+ if (anInfo.get())
+ aGrantedIds = QString::fromStdString(anInfo->nestedFeatures())
+ .split(" ", QString::SkipEmptyParts);
+ }
else
aGrantedIds = myActionsMgr->nestedCommands(theOperation->id());
QString aWchName = QString::fromStdString(theMessage->workbenchId());
QStringList aNestedFeatures =
QString::fromStdString(theMessage->nestedFeatures()).split(" ", QString::SkipEmptyParts);
- QString aDocKind = QString::fromStdString(theMessage->documentKind());
QList<QAction*> aNestedActList;
bool isColumnButton = !aNestedFeatures.isEmpty();
if (isColumnButton) {
aFeatureInfo.toolTip = aFeatureInfo.text;
aAction = aSalomeConnector->addFeature(aWchName, aFeatureInfo);
}
- aSalomeConnector->setNestedActions(aFeatureInfo.id, aNestedFeatures);
- aSalomeConnector->setDocumentKind(aFeatureInfo.id, aDocKind);
+ aSalomeConnector->setFeatureInfo(aFeatureInfo.id, theMessage);
aWorkshop->actionsMgr()->addCommand(aAction);
aWorkshop->module()->actionCreated(aAction);