Salome HOME
[bos #29467] [EDF] (2022-T1) Logging of SALOME usage: specific log in SALOME
authorPascal Obry <pascal.obry@edf.fr>
Thu, 9 Feb 2023 12:08:39 +0000 (13:08 +0100)
committerPascal Obry <pascal.obry@edf.fr>
Tue, 5 Sep 2023 09:15:09 +0000 (11:15 +0200)
src/SHAPERGUI/SHAPERGUI.cpp
src/SHAPERGUI/SHAPERGUI.h

index 475b4933d71e1b9e4831a01199ad435ef3ce7780..9232099ac0e71d0e283f41fca7e0abc919958bd8 100644 (file)
@@ -100,7 +100,7 @@ static const QString ToolbarsSection("SHAPER_Toolbars");
 static const QString FreeCommandsParam("OutOFToolbars");
 
 
-/** 
+/**
 * Class for preferences management
 */
 class SHAPERGUI_PrefMgr: public ModuleBase_IPrefMgr
@@ -383,6 +383,16 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
   connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
           this, SLOT(onSaveAsDocByShaper()));
   updateInfoPanel();
+
+  //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;
 }
 
@@ -484,6 +494,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)
 {
@@ -704,6 +747,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 aba74c8598ea7d88ce44468c8a340fcbb3282122..2a84accc3bc5bf7ddbd571e1a0f086b656a24f1e 100644 (file)
@@ -36,8 +36,9 @@ class SHAPERGUI_OCCSelector;
 class OCCViewer_Viewer;
 class CAM_Study;
 class QtxInfoPanel;
+class ModuleBase_Operation;
 
-/** 
+/**
  * \ingroup Salome
  * An implementation of SALOME connector class for implementation of
  * XGUI functionality as a module of SALOME
@@ -214,6 +215,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();
@@ -229,6 +233,9 @@ private slots:
 
   void onEditToolbars();
 
+  void onOperationCommitted(ModuleBase_Operation*);
+  void onOperationAborted(ModuleBase_Operation*);
+
  private:
    /// Create selector for OCC Viewer
    /// \param theMgr view manager