]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Commit of the current operation if the preselection is activated.
authornds <natalia.donis@opencascade.com>
Thu, 11 Dec 2014 14:30:30 +0000 (17:30 +0300)
committernds <natalia.donis@opencascade.com>
Thu, 11 Dec 2014 14:30:30 +0000 (17:30 +0300)
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
src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_IWorkshop.h
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/XGUI/XGUI_ModuleConnector.cpp
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_OperationMgr.h
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index 9f7da7a38f3a7bd69213e6a8f05dd7ec36feaeda..7584e6bf0ac963b8789a56335938e566797dfa0c 100644 (file)
 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()));
 
 
index bf1675bfaa9e4ac32f9ec5dc7e8fe7ed0073b6ea..018980bdbc6d8213218c6e2347977868c396f91e 100644 (file)
@@ -53,6 +53,15 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \param theOperation a resumed operation\r
   virtual void operationResumed(ModuleBase_Operation* theOperation) {}\r
 \r
+  /// Realizes some functionality by an operation stop\r
+  virtual void operationStopped(ModuleBase_Operation* theOperation) {}\r
+\r
+  /// Realizes some functionality by an operation commit\r
+  virtual void operationCommitted(ModuleBase_Operation* theOperation) {}\r
+\r
+  /// Realizes some functionality by an operation abort\r
+  virtual void operationAborted(ModuleBase_Operation* theOperation) {}\r
+\r
   /// Called when it is necessary to update a command state (enable or disable it)\r
   //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;\r
 \r
@@ -74,16 +83,6 @@ public slots:
   void onFeatureTriggered();\r
 \r
 protected slots:\r
-  /// SLOT, that is called after the operation is stopped. Switched off the modfications performed\r
-  /// by the operation start\r
-  virtual void onOperationStopped(ModuleBase_Operation* theOperation) {}\r
-\r
-\r
-  virtual void onOperationComitted(ModuleBase_Operation* theOperation) {}\r
-\r
-  virtual void onOperationAborted(ModuleBase_Operation* theOperation) {}\r
-\r
-\r
   /// Called on selection changed event\r
   virtual void onSelectionChanged() {}\r
 \r
index 46ff9f84a817547eaa6655e7cfdfadcfaea2c711..4ecfabfc1ebbb58201b648101af0cf13e8d2f54b 100644 (file)
@@ -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();
 
index bffa6148d710e82f1beaddc82f3598790845a595..9291d3fe4515663da4788b9facead2b2ad5c7787 100644 (file)
@@ -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();
index e9a145ebb2c947f6a26d6c0e060ef004421d6dee..0f86152f2b9820f44008abe561829458f922bed3 100644 (file)
@@ -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();
 
index e45a52ccea18854b72d5bb65bd3e6ff39689fbd5..9cf8be7d2286c302e1efa6c168643d711eb827df 100644 (file)
@@ -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);
 }
 
index 4a5449caf2e66607ad4d0105a4d3599ae383e501..756b7b9354fe34f46db2e52e8a3414e97cb44d82 100644 (file)
@@ -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<ModuleBase_Operation*>(sender());
-  emit operationComitted(aSenderOperation);
+  emit operationCommitted(aSenderOperation);
 }
 
 void XGUI_OperationMgr::onOperationResumed()
index 8c8acfb3d7468a2bd16e90f08a9b26e4c8dc3b50..3ae398af4fb0d49d99e149561f3fbaf5d01402fc 100644 (file)
@@ -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:
index f8fe475ca68e19a063172b064c081518237062fd..d9402eea4013c7e988deaa7101ca76937f57709d 100644 (file)
@@ -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)
index f8c293c5e9744a3812cae58774c4d292da0b1f33..941f1f19f5bdfefb13b2be55102acf0e9d3fe67c 100644 (file)
@@ -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);