From ac63def3eb29ba78d5e285c5edb026fb083f302b Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 11 Dec 2014 17:30:30 +0300 Subject: [PATCH] Commit of the current operation if the preselection is activated. Extend the correction to commit/abort/stop signals. The call of the module functionailty should be direct and from the workshop --- src/ModuleBase/ModuleBase_IModule.cpp | 9 --------- src/ModuleBase/ModuleBase_IModule.h | 19 +++++++++---------- src/ModuleBase/ModuleBase_IWorkshop.h | 16 ---------------- src/PartSet/PartSet_Module.cpp | 6 +++--- src/PartSet/PartSet_Module.h | 23 ++++++++++++++++------- src/XGUI/XGUI_ModuleConnector.cpp | 11 ----------- src/XGUI/XGUI_OperationMgr.cpp | 6 +++--- src/XGUI/XGUI_OperationMgr.h | 6 +++--- src/XGUI/XGUI_Workshop.cpp | 16 ++++++++++++++++ src/XGUI/XGUI_Workshop.h | 10 +++++++++- 10 files changed, 59 insertions(+), 63 deletions(-) diff --git a/src/ModuleBase/ModuleBase_IModule.cpp b/src/ModuleBase/ModuleBase_IModule.cpp index 9f7da7a38..7584e6bf0 100644 --- a/src/ModuleBase/ModuleBase_IModule.cpp +++ b/src/ModuleBase/ModuleBase_IModule.cpp @@ -20,15 +20,6 @@ ModuleBase_IModule::ModuleBase_IModule(ModuleBase_IWorkshop* theParent) : QObject(theParent), myWorkshop(theParent) { - connect(myWorkshop, SIGNAL(operationStopped(ModuleBase_Operation*)), - SLOT(onOperationStopped(ModuleBase_Operation*))); - - connect(myWorkshop, SIGNAL(operationComitted(ModuleBase_Operation*)), - SLOT(onOperationComitted(ModuleBase_Operation*))); - - connect(myWorkshop, SIGNAL(operationAborted(ModuleBase_Operation*)), - SLOT(onOperationAborted(ModuleBase_Operation*))); - connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h index bf1675bfa..018980bdb 100644 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -53,6 +53,15 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// \param theOperation a resumed operation virtual void operationResumed(ModuleBase_Operation* theOperation) {} + /// Realizes some functionality by an operation stop + virtual void operationStopped(ModuleBase_Operation* theOperation) {} + + /// Realizes some functionality by an operation commit + virtual void operationCommitted(ModuleBase_Operation* theOperation) {} + + /// Realizes some functionality by an operation abort + virtual void operationAborted(ModuleBase_Operation* theOperation) {} + /// Called when it is necessary to update a command state (enable or disable it) //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0; @@ -74,16 +83,6 @@ public slots: void onFeatureTriggered(); protected slots: - /// SLOT, that is called after the operation is stopped. Switched off the modfications performed - /// by the operation start - virtual void onOperationStopped(ModuleBase_Operation* theOperation) {} - - - virtual void onOperationComitted(ModuleBase_Operation* theOperation) {} - - virtual void onOperationAborted(ModuleBase_Operation* theOperation) {} - - /// Called on selection changed event virtual void onSelectionChanged() {} diff --git a/src/ModuleBase/ModuleBase_IWorkshop.h b/src/ModuleBase/ModuleBase_IWorkshop.h index 46ff9f84a..4ecfabfc1 100644 --- a/src/ModuleBase/ModuleBase_IWorkshop.h +++ b/src/ModuleBase/ModuleBase_IWorkshop.h @@ -70,22 +70,6 @@ Q_OBJECT signals: void selectionChanged(); - /// Signal about an operation is started. It is emitted after the start() of operation is done. - void operationStarted(ModuleBase_Operation* theOperation); - - /// Signal about an operation is stopped. It is emitted after the stop() of operation is done. - /// \param theOperation a stopped operation - void operationStopped(ModuleBase_Operation* theOperation); - - /// Signal about an operation is resumed. It is emitted after the resume() of operation is done. - void operationResumed(ModuleBase_Operation* theOperation); - - /// Emitted when current operation is comitted - void operationComitted(ModuleBase_Operation* theOperation); - - /// Emitted when current operation is aborted - void operationAborted(ModuleBase_Operation* theOperation); - /// Signal which is emited after activation of property panel void propertyPanelActivated(); diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index bffa6148d..9291d3fe4 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -149,7 +149,7 @@ void PartSet_Module::registerFilters() aFactory->registerFilter("LinearEdgeFilter", new ModuleBase_FilterLinearEdge); } -void PartSet_Module::onOperationComitted(ModuleBase_Operation* theOperation) +void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) { if (theOperation->isEditOperation()) return; @@ -173,7 +173,7 @@ void PartSet_Module::breakOperationSequence() myRestartingMode = RM_None; } -void PartSet_Module::onOperationAborted(ModuleBase_Operation* theOperation) +void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation) { breakOperationSequence(); } @@ -218,7 +218,7 @@ void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation) myWorkshop->viewer()->addSelectionFilter(myDocumentShapeFilter); } -void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation) +void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation) { if (theOperation->id().toStdString() == SketchPlugin_Sketch::ID()) { DataPtr aData = myCurrentSketch->data(); diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index e9a145ebb..0f86152f2 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -50,22 +50,31 @@ public: QStringList sketchOperationIdList() const; /// Realizes some functionality by an operation start + /// Displays all sketcher sub-Objects, hides sketcher result, appends selection filters /// \param theOperation a started operation virtual void operationStarted(ModuleBase_Operation* theOperation); + /// Realizes some functionality by an operation commit + /// Restarts sketcher operation automatically of it is necessary + /// \param theOperation a committed operation + virtual void operationCommitted(ModuleBase_Operation* theOperation); + + /// Realizes some functionality by an operation abort + /// Hides all sketcher sub-Objects, displays sketcher result and removes selection filters + /// \param theOperation an aborted operation + virtual void operationAborted(ModuleBase_Operation* theOperation); + + /// Realizes some functionality by an operation stop + /// Hides all sketcher sub-Objects, displays sketcher result and removes selection filters + /// \param theOperation a stopped operation + virtual void operationStopped(ModuleBase_Operation* theOperation); + public slots: /// SLOT, that is called by no more widget signal emitted by property panel /// Set a specific flag to restart the sketcher operation void onNoMoreWidgets(); protected slots: - /// Called when previous operation is finished - virtual void onOperationComitted(ModuleBase_Operation* theOperation); - - virtual void onOperationAborted(ModuleBase_Operation* theOperation); - - virtual void onOperationStopped(ModuleBase_Operation* theOperation); - /// Called when previous operation is finished virtual void onSelectionChanged(); diff --git a/src/XGUI/XGUI_ModuleConnector.cpp b/src/XGUI/XGUI_ModuleConnector.cpp index e45a52cce..9cf8be7d2 100644 --- a/src/XGUI/XGUI_ModuleConnector.cpp +++ b/src/XGUI/XGUI_ModuleConnector.cpp @@ -22,17 +22,6 @@ XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop* theWorkshop) XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr(); - connect(anOperationMgr, SIGNAL(operationStarted(ModuleBase_Operation*)), - SIGNAL(operationStarted(ModuleBase_Operation*))); - connect(anOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), - SIGNAL(operationStopped(ModuleBase_Operation*))); - connect(anOperationMgr, SIGNAL(operationResumed(ModuleBase_Operation*)), - SIGNAL(operationResumed(ModuleBase_Operation*))); - connect(anOperationMgr, SIGNAL(operationComitted(ModuleBase_Operation*)), - SIGNAL(operationComitted(ModuleBase_Operation*))); - connect(anOperationMgr, SIGNAL(operationAborted(ModuleBase_Operation*)), - SIGNAL(operationAborted(ModuleBase_Operation*))); - //myDocumentShapeFilter = new ModuleBase_ShapeDocumentFilter(this); } diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 4a5449caf..756b7b935 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -100,7 +100,7 @@ bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation) connect(theOperation, SIGNAL(started()), SLOT(onOperationStarted())); connect(theOperation, SIGNAL(aborted()), SLOT(onOperationAborted())); - connect(theOperation, SIGNAL(committed()), SLOT(onOperationComitted())); + connect(theOperation, SIGNAL(committed()), SLOT(onOperationCommitted())); connect(theOperation, SIGNAL(stopped()), SLOT(onOperationStopped())); connect(theOperation, SIGNAL(resumed()), SLOT(onOperationResumed())); connect(theOperation, SIGNAL(activatedByPreselection()), @@ -217,10 +217,10 @@ void XGUI_OperationMgr::onOperationAborted() emit operationAborted(aSenderOperation); } -void XGUI_OperationMgr::onOperationComitted() +void XGUI_OperationMgr::onOperationCommitted() { ModuleBase_Operation* aSenderOperation = dynamic_cast(sender()); - emit operationComitted(aSenderOperation); + emit operationCommitted(aSenderOperation); } void XGUI_OperationMgr::onOperationResumed() diff --git a/src/XGUI/XGUI_OperationMgr.h b/src/XGUI/XGUI_OperationMgr.h index 8c8acfb3d..3ae398af4 100644 --- a/src/XGUI/XGUI_OperationMgr.h +++ b/src/XGUI/XGUI_OperationMgr.h @@ -99,8 +99,8 @@ signals: /// Signal about an operation is resumed. It is emitted after the resume() of operation is done. void operationResumed(ModuleBase_Operation* theOperation); - /// Emitted when current operation is comitted - void operationComitted(ModuleBase_Operation* theOperation); + /// Emitted when current operation is Committed + void operationCommitted(ModuleBase_Operation* theOperation); /// Emitted when current operation is aborted void operationAborted(ModuleBase_Operation* theOperation); @@ -137,7 +137,7 @@ signals: void onOperationStopped(); void onOperationStarted(); void onOperationAborted(); - void onOperationComitted(); + void onOperationCommitted(); void onOperationResumed(); private: diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index f8fe475ca..d9402eea4 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -151,6 +151,10 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector) SLOT(onOperationResumed(ModuleBase_Operation*))); connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), SLOT(onOperationStopped(ModuleBase_Operation*))); + connect(myOperationMgr, SIGNAL(operationCommitted(ModuleBase_Operation*)), + SLOT(onOperationCommitted(ModuleBase_Operation*))); + connect(myOperationMgr, SIGNAL(operationAborted(ModuleBase_Operation*)), + SLOT(onOperationAborted(ModuleBase_Operation*))); connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit())); // TODO(sbh): It seems that application works properly without update on operationStarted connect(myOperationMgr, SIGNAL(operationStarted(ModuleBase_Operation*)), @@ -602,6 +606,18 @@ void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation) for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) { myDisplayer->activate(*aIt); } + myModule->operationStopped(theOperation); +} + + +void XGUI_Workshop::onOperationCommitted(ModuleBase_Operation* theOperation) +{ + myModule->operationCommitted(theOperation); +} + +void XGUI_Workshop::onOperationAborted(ModuleBase_Operation* theOperation) +{ + myModule->operationAborted(theOperation); } void XGUI_Workshop::setNestedFeatures(ModuleBase_Operation* theOperation) diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index f8c293c5e..941f1f19f 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -259,7 +259,15 @@ signals: /// SLOT, that is called after the operation is stopped. Update workshop state, e.g. /// hides the property panel and udpate the command status. /// \param theOpertion a stopped operation - void onOperationStopped(ModuleBase_Operation* theOperation); + virtual void onOperationStopped(ModuleBase_Operation* theOperation); + + /// SLOT, that is called after the operation is committed. + /// \param theOpertion a commmitted operation + virtual void onOperationCommitted(ModuleBase_Operation* theOperation); + + /// SLOT, that is called after the operation is aborted. + /// \param theOpertion an aborted operation + void onOperationAborted(ModuleBase_Operation* theOperation); void onContextMenuCommand(const QString& theId, bool isChecked); -- 2.30.2