{
}
-std::string Config_WidgetReader::featureWidgetCfg(std::string theFeatureName)
+std::string Config_WidgetReader::featureWidgetCfg(const std::string& theFeatureName)
{
return myWidgetCache[theFeatureName];
}
+std::string Config_WidgetReader::featureDescription(const std::string& theFeatureName)
+{
+ return myDescriptionCache[theFeatureName];
+}
+
void Config_WidgetReader::processNode(xmlNodePtr theNode)
{
if (isNode(theNode, NODE_FEATURE, NULL)) {
result = std::string((char*) buffer->content);
}
myWidgetCache[aNodeName] = result;
+ myDescriptionCache[aNodeName] = getProperty(theNode, FEATURE_TEXT);
}
}
CONFIG_EXPORT Config_WidgetReader(const std::string& theXmlFile);
CONFIG_EXPORT virtual ~Config_WidgetReader();
- CONFIG_EXPORT std::string featureWidgetCfg(std::string theFeatureName);
+ CONFIG_EXPORT std::string featureWidgetCfg(const std::string& theFeatureName);
+ CONFIG_EXPORT std::string featureDescription(const std::string& theFeatureName);
protected:
void processNode(xmlNodePtr theNode);
private:
std::map<std::string, std::string> myWidgetCache;
+ std::map<std::string, std::string> myDescriptionCache;
};
SET(PROJECT_HEADERS
ModuleBase.h
ModuleBase_Operation.h
+ ModuleBase_PropPanelOperation.h
)
SET(PROJECT_SOURCES
ModuleBase_Operation.cpp
+ ModuleBase_PropPanelOperation.cpp
)
SET(PROJECT_LIBRARIES
--- /dev/null
+/*
+ * ModuleBase_PropPanelOperation.cpp
+ *
+ * Created on: Apr 2, 2014
+ * Author: sbh
+ */
+
+#include <ModuleBase_PropPanelOperation.h>
+#include <QString>
+
+/*!
+ \brief Constructor
+ \param XGUI_Workshop - workshop for this operation
+
+ Constructs an empty operation. Constructor should work very fast because many
+ operators may be created after starting workshop but only several from them
+ may be used. As result this constructor stores given workshop in myApp field
+ and set Waiting status.
+ */
+ModuleBase_PropPanelOperation::ModuleBase_PropPanelOperation(const QString& theId, QObject* parent)
+: ModuleBase_Operation(theId, parent)
+{
+}
+
+/*!
+ * \brief Destructor
+ */
+ModuleBase_PropPanelOperation::~ModuleBase_PropPanelOperation()
+{
+
+}
+
--- /dev/null
+/*
+ * ModuleBase_PropPanelOperation.h
+ *
+ * Created on: Apr 2, 2014
+ * Author: sbh
+ */
+
+#ifndef MODULEBASE_PROPPANELOPERATION_H
+#define MODULEBASE_PROPPANELOPERATION_H
+
+#include <ModuleBase.h>
+#include <ModuleBase_Operation.h>
+
+#include <QObject>
+#include <QString>
+
+#include <memory>
+
+/*!
+ * \class ModuleBase_PropPanelOperation
+ *
+ */
+class MODULEBASE_EXPORT ModuleBase_PropPanelOperation: public ModuleBase_Operation
+{
+
+ Q_OBJECT
+
+public:
+ ModuleBase_PropPanelOperation(const QString& theId = "", QObject* parent = 0);
+ virtual ~ModuleBase_PropPanelOperation();
+
+ /*!
+ * \brief Returns XML representation of the operation's widget.
+ * \return XML QString
+ *
+ * Returns XML representation of the operation's widget.
+ */
+ const QString& xmlRepresentation() const
+ {
+ return myXmlRepr;
+ }
+
+ /*!
+ * \brief Sets XML representation of the operation's widget.
+ * \param xmlRepr - XML QString
+ *
+ * Sets XML representation of the operation's widget.
+ */
+ void setXmlRepresentation(const QString& xmlRepr)
+ {
+ this->myXmlRepr = xmlRepr;
+ }
+
+
+ /*
+ * Returns a short description of operation (will be
+ * inserted in title of property panel)
+ */
+ const QString& description() const
+ {
+ return myDescription;
+ }
+
+ /*
+ * Sets a short description of operation (will be
+ * inserted in title of property panel)
+ */
+ void setDescription(const QString& theDescription)
+ {
+ this->myDescription = theDescription;
+ }
+
+private:
+ //!< Next fields could be extracted into a subclass;
+ QString myXmlRepr;
+ QString myDescription;
+};
+
+#endif //MODULEBASE_PROPPANELOPERATION_H
#include <PartSet_Module.h>
-#include <ModuleBase_Operation.h>
+#include <ModuleBase_PropPanelOperation.h>
#include <Config_PointerMessage.h>
#include <Config_ModuleReader.h>
XGUI_Command* aCmd = dynamic_cast<XGUI_Command*>(sender());
QString aCmdId = aCmd->id();
std::string aXmlCfg = aWdgReader.featureWidgetCfg(aCmdId.toStdString());
+ std::string aDescription = aWdgReader.featureDescription(aCmdId.toStdString());
//TODO(sbh): Implement static method to extract event id [SEID]
static Event_ID aModuleEvent = Event_Loop::eventByName("PartSetModuleEvent");
Config_PointerMessage aMessage(aModuleEvent, this);
- ModuleBase_Operation* aPartSetOp = new ModuleBase_Operation(aCmdId, this);
+ ModuleBase_PropPanelOperation* aPartSetOp = new ModuleBase_PropPanelOperation(aCmdId, this);
aPartSetOp->setXmlRepresentation(QString::fromStdString(aXmlCfg));
+ aPartSetOp->setDescription(QString::fromStdString(aDescription));
aMessage.setPointer(aPartSetOp);
Event_Loop::loop()->send(aMessage);
}
tabifyDockWidget(aObjDock, myPropertyPanelDock);
}
+void XGUI_MainWindow::setPropertyPannelTitle(const QString& theTitle)
+{
+ myPropertyPanelDock->setWindowTitle(theTitle);
+}
+
QDockWidget* XGUI_MainWindow::createPropertyPanel()
{
QDockWidget* aPropPanel = new QDockWidget(this);
aPropPanel->setWindowTitle(tr("Property Panel"));
+ QAction* aViewAct = aPropPanel->toggleViewAction();
aPropPanel->setObjectName(XGUI::PROP_PANEL);
QWidget* aContent = new QWidget(aPropPanel);
// Creates Dock widgets: Object broewser and Property panel
void createDockWidgets();
+ void setPropertyPannelTitle(const QString& theTitle);
public slots:
void showPythonConsole();
#include <XGUI_SwitchWidget.h>
-#include <ModuleBase_Operation.h>
+#include <ModuleBase_PropPanelOperation.h>
#include <Config_Keywords.h>
#include <Config_WidgetAPI.h>
#include <cfloat>
#include <climits>
-XGUI_WidgetFactory::XGUI_WidgetFactory(ModuleBase_Operation* theOperation)
+XGUI_WidgetFactory::XGUI_WidgetFactory(ModuleBase_PropPanelOperation* theOperation)
: myOperation(theOperation)
{
QString aXml = myOperation->xmlRepresentation();
class QWidget;
class Config_WidgetAPI;
-class ModuleBase_Operation;
+class ModuleBase_PropPanelOperation;
class XGUI_EXPORT XGUI_WidgetFactory
{
public:
- XGUI_WidgetFactory(ModuleBase_Operation*);
+ XGUI_WidgetFactory(ModuleBase_PropPanelOperation*);
virtual ~XGUI_WidgetFactory();
void createWidget(QWidget* theParent);
private:
Config_WidgetAPI* myWidgetApi;
- ModuleBase_Operation* myOperation;
+ ModuleBase_PropPanelOperation* myOperation;
};
#include <ModelAPI_AttributeDocRef.h>
#include <Event_Loop.h>
-#include <ModuleBase_Operation.h>
+#include <ModuleBase_PropPanelOperation.h>
#include <Config_FeatureMessage.h>
#include <Config_PointerMessage.h>
const Config_PointerMessage* aPartSetMsg =
dynamic_cast<const Config_PointerMessage*>(theMessage);
if (aPartSetMsg) {
- ModuleBase_Operation* aOperation = (ModuleBase_Operation*)(aPartSetMsg->pointer());
+ ModuleBase_PropPanelOperation* aOperation =
+ (ModuleBase_PropPanelOperation*)(aPartSetMsg->pointer());
setCurrentOperation(aOperation);
if(aOperation->xmlRepresentation().isEmpty()) { //!< No need for property panel
myCurrentOperation->start();
/*
*
*/
-void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation)
+void XGUI_Workshop::fillPropertyPanel(ModuleBase_PropPanelOperation* theOperation)
{
connectToPropertyPanel(theOperation);
QWidget* aPropWidget = myMainWindow->findChild<QWidget*>(XGUI::PROP_PANEL_WDG);
theOperation->start();
XGUI_WidgetFactory aFactory = XGUI_WidgetFactory(theOperation);
aFactory.createWidget(aPropWidget);
+ myMainWindow->setPropertyPannelTitle(theOperation->description());
}
void XGUI_Workshop::setCurrentOperation(ModuleBase_Operation* theOperation)
class XGUI_Workbench;
class XGUI_SelectionMgr;
class ModuleBase_Operation;
+class ModuleBase_PropPanelOperation;
class Config_FeatureMessage;
class Config_PointerMessage;
protected:
//Event-loop processing methods:
void addFeature(const Config_FeatureMessage*);
- void fillPropertyPanel(ModuleBase_Operation* theOperation);
+ void fillPropertyPanel(ModuleBase_PropPanelOperation* theOperation);
void connectToPropertyPanel(ModuleBase_Operation* theOperation);
void setCurrentOperation(ModuleBase_Operation* theOperation);