]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[bos #29467] [EDF] (2022-T1) Logging of SALOME usage: specific log in SALOME
authorjfa <jfa@opencascade.com>
Mon, 30 May 2022 13:28:55 +0000 (16:28 +0300)
committerjfa <jfa@opencascade.com>
Mon, 30 May 2022 13:28:55 +0000 (16:28 +0300)
src/SHAPERGUI/SHAPERGUI.cpp
src/SHAPERGUI/SHAPERGUI.h

index 8bb312a30e4ee8c7dc40acdb59d14465b6079a51..64b24b8ce5f64a8e45f53a3eccd14e618fdf82fb 100644 (file)
@@ -390,6 +390,15 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
   connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
           this, SLOT(onSaveAsDocByShaper()));
 
+  //connect(myWorkshop->operationMgr(), SIGNAL(operationResumed(ModuleBase_Operation*)),
+  //        this, SLOT(onOperationResumed(ModuleBase_Operation*)));
+  //connect(myWorkshop->operationMgr(), SIGNAL(operationStopped(ModuleBase_Operation*)),
+  //        this, SLOT(onOperationStopped(ModuleBase_Operation*)));
+  connect(myWorkshop->operationMgr(), SIGNAL(operationCommitted(ModuleBase_Operation*)),
+          this, SLOT(onOperationCommitted(ModuleBase_Operation*)));
+  connect(myWorkshop->operationMgr(), SIGNAL(operationAborted(ModuleBase_Operation*)),
+          this, SLOT(onOperationAborted(ModuleBase_Operation*)));
+
   return isDone;
 }
 
@@ -493,6 +502,39 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy)
   return LightApp_Module::deactivateModule(theStudy);
 }
 
+//******************************************************
+void SHAPERGUI::logShaperGUIEvent()
+{
+  QAction* anAction = static_cast<QAction*>(sender());
+  QString anId = anAction->data().toString();
+  QString anEventDescription ("SHAPER");
+  if (anId.contains("Sketch"))
+    anEventDescription += " sketcher";
+  anEventDescription += ": ";
+  anEventDescription += anAction->text();
+  anEventDescription += " has been started";
+  CAM_Application::logUserEvent(anEventDescription);
+}
+
+//******************************************************
+void SHAPERGUI::onOperationCommitted(ModuleBase_Operation* theOperation)
+{
+  //QString anEventDescription ("SHAPER operation has been committed");
+  QString anEventDescription ("SHAPER operation ");
+  anEventDescription += theOperation->id();
+  anEventDescription += " has been committed";
+  CAM_Application::logUserEvent(anEventDescription);
+}
+
+//******************************************************
+void SHAPERGUI::onOperationAborted(ModuleBase_Operation* theOperation)
+{
+  QString anEventDescription ("SHAPER operation ");
+  anEventDescription += theOperation->id();
+  anEventDescription += " has been aborted";
+  CAM_Application::logUserEvent(anEventDescription);
+}
+
 //******************************************************
 void SHAPERGUI::onViewManagerAdded(SUIT_ViewManager* theMgr)
 {
@@ -708,6 +750,7 @@ QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theTBNam
     createTool(separator(), aWBTool);
     registerCommandToolbar(theTBName, -1);
   }
+  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(logShaperGUIEvent()));
   return aAction;
 }
 
index 6346618e6f8dc61e3869224b0f7436ff864850bd..dfed54779bdd25879cdbb8cf8596e55a23417193 100644 (file)
@@ -35,6 +35,7 @@ class XGUI_Workshop;
 class SHAPERGUI_OCCSelector;
 class OCCViewer_Viewer;
 class CAM_Study;
+class ModuleBase_Operation;
 
 /** 
  * \ingroup Salome
@@ -211,6 +212,9 @@ Q_OBJECT
   /// Obtains the current application and updates its actions
   void onUpdateCommandStatus();
 
+   /// \brief The method is called on any GUI action
+  virtual void logShaperGUIEvent();
+
  protected:
    /// Create data model
   CAM_DataModel* createDataModel();
@@ -226,6 +230,9 @@ private slots:
 
   void onEditToolbars();
 
+  void onOperationCommitted(ModuleBase_Operation*);
+  void onOperationAborted(ModuleBase_Operation*);
+
  private:
    /// Create selector for OCC Viewer
    /// \param theMgr view manager