From: vsv Date: Thu, 12 Jul 2018 10:52:02 +0000 (+0300) Subject: Issue #2566: Define option toolbar for features group. X-Git-Tag: SHAPER_V9_1_0RC1~127 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=08c56d0b00a8167f6183ec528db6d2e4d36348db;p=modules%2Fshaper.git Issue #2566: Define option toolbar for features group. --- diff --git a/src/Config/Config_FeatureMessage.cpp b/src/Config/Config_FeatureMessage.cpp index c944bc6d4..7220887d8 100644 --- a/src/Config/Config_FeatureMessage.cpp +++ b/src/Config/Config_FeatureMessage.cpp @@ -31,6 +31,7 @@ Config_FeatureMessage::Config_FeatureMessage(const Events_ID theId, const void* myGroupId = ""; myWorkbenchId = ""; + myToolBarId = ""; myPluginLibrary = ""; myInternal = false; @@ -100,6 +101,16 @@ void Config_FeatureMessage::setGroupId(const std::string& groupId) myGroupId = groupId; } +const std::string& Config_FeatureMessage::toolBarId() const +{ + return myToolBarId; +} + +void Config_FeatureMessage::setToolBarId(const std::string& aId) +{ + myToolBarId = aId; +} + const std::string& Config_FeatureMessage::workbenchId() const { return myWorkbenchId; diff --git a/src/Config/Config_FeatureMessage.h b/src/Config/Config_FeatureMessage.h index 4b6419f9e..1bd9ecff0 100644 --- a/src/Config/Config_FeatureMessage.h +++ b/src/Config/Config_FeatureMessage.h @@ -45,6 +45,7 @@ class Config_FeatureMessage : public Events_Message std::string myGroupId; ///setText(aText); std::string aToolTip = Config_Translator::translate(anId, getProperty(theFeatureNode, FEATURE_TOOLTIP)); - outFeatureMessage->setTooltip(aToolTip); outFeatureMessage->setIcon(getProperty(theFeatureNode, FEATURE_ICON)); outFeatureMessage->setKeysequence(getProperty(theFeatureNode, FEATURE_KEYSEQUENCE)); - outFeatureMessage->setGroupId(restoreAttribute(NODE_GROUP, _ID)); - outFeatureMessage->setWorkbenchId(restoreAttribute(NODE_WORKBENCH, _ID)); + + std::string aGroupName = restoreAttribute(NODE_GROUP, _ID); + std::string aWBNName = restoreAttribute(NODE_WORKBENCH, _ID); + std::string isGroupToolbarId = restoreAttribute(NODE_GROUP, GROUP_TOOLBAR); + bool isGroupToolbar = false; + if (isGroupToolbarId.length() > 0) + isGroupToolbar = (isGroupToolbarId == "yes"); + outFeatureMessage->setGroupId(aGroupName); + outFeatureMessage->setWorkbenchId(aWBNName); + outFeatureMessage->setToolBarId(isGroupToolbar ? aGroupName : aWBNName); + // Get document kind of a feature, if empty set workbench's kind (might be empty too) std::string aDocKind = getProperty(theFeatureNode, FEATURE_DOC); if(aDocKind.empty()) { diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index 938749424..545d738a2 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -71,6 +71,7 @@ const static char* WORKBENCH_DOC = "document"; const static char* SOURCE_FILE = "path"; // NODE_FEATURE properties const static char* FEATURE_TOOLTIP = "tooltip"; +const static char* GROUP_TOOLBAR = "toolbar"; const static char* FEATURE_ICON = "icon"; const static char* FEATURE_TEXT = "title"; const static char* FEATURE_KEYSEQUENCE = "keysequence"; diff --git a/src/FeaturesPlugin/plugin-Features.xml b/src/FeaturesPlugin/plugin-Features.xml index b09cf282b..6b466e29d 100644 --- a/src/FeaturesPlugin/plugin-Features.xml +++ b/src/FeaturesPlugin/plugin-Features.xml @@ -53,7 +53,7 @@ email : webmaster.salome@opencascade.com - + diff --git a/src/ModuleBase/ModuleBase_ActionInfo.cpp b/src/ModuleBase/ModuleBase_ActionInfo.cpp index 427b7d93e..6c494850f 100644 --- a/src/ModuleBase/ModuleBase_ActionInfo.cpp +++ b/src/ModuleBase/ModuleBase_ActionInfo.cpp @@ -72,6 +72,7 @@ void ModuleBase_ActionInfo::initFrom(std::shared_ptr theM } text = QString::fromUtf8(theMessage->text().c_str()); toolTip = QString::fromUtf8(theMessage->tooltip().c_str()); + toolBar = QString::fromStdString(theMessage->toolBarId()); QString aShortcutStr = QString::fromStdString(theMessage->keysequence()); if (!aShortcutStr.isEmpty()) { shortcut = QKeySequence(aShortcutStr); diff --git a/src/ModuleBase/ModuleBase_ActionInfo.h b/src/ModuleBase/ModuleBase_ActionInfo.h index 15a081ae2..347d16137 100644 --- a/src/ModuleBase/ModuleBase_ActionInfo.h +++ b/src/ModuleBase/ModuleBase_ActionInfo.h @@ -49,6 +49,7 @@ struct MODULEBASE_EXPORT ModuleBase_ActionInfo QString iconText; //!< action's descriptive icon text QString iconFile; //!< path to icon's file. Can not be initialized from QAction QString toolTip; //!< action's tooltip + QString toolBar; //!< A name of toolbar. By default = group of features name // QString statusTip; // QString whatsThis; QKeySequence shortcut; //!< action's primary shortcut key