mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-15 13:58:47 +02:00
Add UserActivityLogger scripting interface
This commit is contained in:
parent
ed88232fb0
commit
8b3b62aad7
3 changed files with 48 additions and 0 deletions
|
@ -67,6 +67,7 @@
|
|||
#include <input-plugins/InputPlugin.h>
|
||||
#include <controllers/UserInputMapper.h>
|
||||
#include <controllers/StateController.h>
|
||||
#include <UserActivityLoggerScriptingInterface.h>
|
||||
#include <LogHandler.h>
|
||||
#include <MainWindow.h>
|
||||
#include <MessagesClient.h>
|
||||
|
@ -4558,6 +4559,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
|
||||
scriptEngine->registerGlobalObject("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
|
||||
scriptEngine->registerGlobalObject("Reticle", getApplicationCompositor().getReticleInterface());
|
||||
|
||||
scriptEngine->registerGlobalObject("UserActivityLogger", new UserActivityLoggerScriptingInterface());
|
||||
}
|
||||
|
||||
bool Application::canAcceptURL(const QString& urlString) const {
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// UserActivityLoggerScriptingInterface.h
|
||||
// libraries/networking/src
|
||||
//
|
||||
// Created by Ryan Huffman on 6/06/16.
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "UserActivityLoggerScriptingInterface.h"
|
||||
#include "UserActivityLogger.h"
|
||||
|
||||
void UserActivityLoggerScriptingInterface::logAction(QString action, QVariantMap details) const {
|
||||
QMetaObject::invokeMethod(&UserActivityLogger::getInstance(), "logAction",
|
||||
Q_ARG(QString, action),
|
||||
Q_ARG(QJsonObject, QJsonObject::fromVariantMap(details)));
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
//
|
||||
// UserActivityLoggerScriptingInterface.h
|
||||
// libraries/networking/src
|
||||
//
|
||||
// Created by Ryan Huffman on 6/06/16.
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_UserActivityLoggerScriptingInterface_h
|
||||
#define hifi_UserActivityLoggerScriptingInterface_h
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
class QScriptValue;
|
||||
|
||||
class UserActivityLoggerScriptingInterface : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_INVOKABLE void logAction(QString action, QVariantMap details) const;
|
||||
};
|
||||
|
||||
#endif // hifi_UserActivityLoggerScriptingInterface_h
|
Loading…
Reference in a new issue