void SHAPERGUI::logShaperGUIEvent()
{
QAction* anAction = static_cast<QAction*>(sender());
- QString anId = anAction->data().toString();
- QString anEventDescription ("SHAPER");
+ if ( !anAction )
+ return;
+ const QString anId = anAction->data().toString();
+ const QString section = anId.contains("Sketch") ? "sketcher" : "";
+
+ CAM_Application::logStructuredUserEvent( moduleName(),
+ section,
+ anAction->text(),
+ "activated" );
+}
+
+//******************************************************
+static void onOperationGeneric( ModuleBase_Operation* theOperation,
+ const QString moduleName,
+ const QString &event )
+{
+ QString anId = theOperation->id();
+ QString section = "";
+
if (anId.contains("Sketch"))
- anEventDescription += " sketcher";
- anEventDescription += ": ";
- anEventDescription += anAction->text();
- anEventDescription += " has been started";
- CAM_Application::logUserEvent(anEventDescription);
+ {
+ section = "sketcher";
+ anId.remove("Sketch");
+ }
+
+ CAM_Application::logStructuredUserEvent( moduleName,
+ section,
+ anId,
+ event );
}
//******************************************************
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);
+ onOperationGeneric(theOperation, moduleName(), "committed");
}
//******************************************************
void SHAPERGUI::onOperationAborted(ModuleBase_Operation* theOperation)
{
- QString anEventDescription ("SHAPER operation ");
- anEventDescription += theOperation->id();
- anEventDescription += " has been aborted";
- CAM_Application::logUserEvent(anEventDescription);
+ onOperationGeneric(theOperation, moduleName(), "aborted");
}
//******************************************************
createTool(separator(), aWBTool); /// nested action is always separated of others
registerCommandToolbar(theWBName, -1);
+ connect(anAction, SIGNAL(triggered(bool)), this, SLOT(logShaperGUIEvent()));
+
return anAction;
}
aAction->setStatusTip(theTip);
aAction->setData(theId);
createMenu(aId, aMenu, theMenuPosition);
+
+ connect(aAction, SIGNAL(triggered(bool)), this, SLOT(logShaperGUIEvent()));
+
return aAction;
}