From 2fbba75428a963d6ce95b45eea17212413ece4e9 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 30 May 2022 16:28:55 +0300 Subject: [PATCH] [bos #29467] [EDF] (2022-T1) Logging of SALOME usage: specific log in SALOME --- src/SHAPERGUI/SHAPERGUI.cpp | 43 +++++++++++++++++++++++++++++++++++++ src/SHAPERGUI/SHAPERGUI.h | 7 ++++++ 2 files changed, 50 insertions(+) diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index 8bb312a30..64b24b8ce 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -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(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; } diff --git a/src/SHAPERGUI/SHAPERGUI.h b/src/SHAPERGUI/SHAPERGUI.h index 6346618e6..dfed54779 100644 --- a/src/SHAPERGUI/SHAPERGUI.h +++ b/src/SHAPERGUI/SHAPERGUI.h @@ -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 -- 2.39.2