mirror of
https://github.com/overte-org/overte.git
synced 2025-04-10 19:29:07 +02:00
Make activity logging from scripts only available for certain events
This commit is contained in:
parent
bce05df56b
commit
c2ebcd1f77
4 changed files with 22 additions and 8 deletions
|
@ -12,8 +12,16 @@
|
|||
#include "UserActivityLoggerScriptingInterface.h"
|
||||
#include "UserActivityLogger.h"
|
||||
|
||||
void UserActivityLoggerScriptingInterface::logAction(QString action, QVariantMap details) const {
|
||||
void UserActivityLoggerScriptingInterface::enabledEdit() {
|
||||
logAction("enabled_edit");
|
||||
}
|
||||
|
||||
void UserActivityLoggerScriptingInterface::openedMarketplace() {
|
||||
logAction("opened_marketplace");
|
||||
}
|
||||
|
||||
void UserActivityLoggerScriptingInterface::logAction(QString action, QJsonObject details) {
|
||||
QMetaObject::invokeMethod(&UserActivityLogger::getInstance(), "logAction",
|
||||
Q_ARG(QString, action),
|
||||
Q_ARG(QJsonObject, QJsonObject::fromVariantMap(details)));
|
||||
Q_ARG(QJsonObject, details));
|
||||
}
|
||||
|
|
|
@ -13,14 +13,18 @@
|
|||
#define hifi_UserActivityLoggerScriptingInterface_h
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
#include <QJsonObject>
|
||||
|
||||
class QScriptValue;
|
||||
#include <DependencyManager.h>
|
||||
|
||||
class UserActivityLoggerScriptingInterface : public QObject {
|
||||
class UserActivityLoggerScriptingInterface : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_INVOKABLE void logAction(QString action, QVariantMap details) const;
|
||||
Q_INVOKABLE void enabledEdit();
|
||||
Q_INVOKABLE void openedMarketplace();
|
||||
|
||||
private:
|
||||
void logAction(QString action, QJsonObject details = {});
|
||||
};
|
||||
|
||||
#endif // hifi_UserActivityLoggerScriptingInterface_h
|
||||
#endif // hifi_UserActivityLoggerScriptingInterface_h
|
||||
|
|
|
@ -340,7 +340,7 @@ var toolBar = (function() {
|
|||
Messages.sendLocalMessage("edit-events", JSON.stringify({
|
||||
enabled: active
|
||||
}));
|
||||
UserActivityLogger.logAction("enabled_edit");
|
||||
UserActivityLogger.enabledEdit();
|
||||
isActive = active;
|
||||
if (!isActive) {
|
||||
entityListTool.setVisible(false);
|
||||
|
|
|
@ -37,6 +37,8 @@ function showExamples(marketplaceID) {
|
|||
print("setting examples URL to " + url);
|
||||
examplesWindow.setURL(url);
|
||||
examplesWindow.setVisible(true);
|
||||
|
||||
UserActivityLogger.openedMarketplace();
|
||||
}
|
||||
|
||||
function hideExamples() {
|
||||
|
|
Loading…
Reference in a new issue