mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-18 15:17:56 +02:00
Pass tablet QQuickItem to TabletScriptingInterface
Also, moved TabletScriptingInterface to script-engine library for easy access, baby.
This commit is contained in:
parent
db0b2ba7d3
commit
d4f9d21ce8
6 changed files with 21 additions and 4 deletions
|
@ -3,6 +3,7 @@ import QtGraphicalEffects 1.0
|
|||
|
||||
Item {
|
||||
id: tablet
|
||||
objectName: "tablet"
|
||||
|
||||
property double miclevel: 0.8
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@
|
|||
#include <ScriptCache.h>
|
||||
#include <SoundCache.h>
|
||||
#include <steamworks-wrapper/SteamClient.h>
|
||||
#include <TabletScriptingInterface.h>
|
||||
#include <Tooltip.h>
|
||||
#include <udt/PacketHeaders.h>
|
||||
#include <UserActivityLogger.h>
|
||||
|
@ -144,7 +145,6 @@
|
|||
#include "scripting/SettingsScriptingInterface.h"
|
||||
#include "scripting/WindowScriptingInterface.h"
|
||||
#include "scripting/ControllerScriptingInterface.h"
|
||||
#include "scripting/TabletScriptingInterface.h"
|
||||
#include "scripting/ToolbarScriptingInterface.h"
|
||||
#include "scripting/RatesScriptingInterface.h"
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||
|
@ -5183,8 +5183,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
scriptEngine->registerGlobalObject("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
|
||||
scriptEngine->registerGlobalObject("Reticle", getApplicationCompositor().getReticleInterface());
|
||||
|
||||
scriptEngine->registerGlobalObject("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
||||
|
||||
scriptEngine->registerGlobalObject("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
|
||||
scriptEngine->registerGlobalObject("Users", DependencyManager::get<UsersScriptingInterface>().data());
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <PathUtils.h>
|
||||
#include <TextureCache.h>
|
||||
#include <gpu/Context.h>
|
||||
#include <TabletScriptingInterface.h>
|
||||
|
||||
#include "EntityTreeRenderer.h"
|
||||
#include "EntitiesRendererLogging.h"
|
||||
|
@ -255,7 +256,13 @@ void RenderableWebEntityItem::loadSourceURL() {
|
|||
} else {
|
||||
_contentType = qmlContent;
|
||||
_webSurface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath()));
|
||||
_webSurface->load(_sourceUrl, [&](QQmlContext* context, QObject* obj) { });
|
||||
_webSurface->load(_sourceUrl, [&](QQmlContext* context, QObject* obj) {});
|
||||
|
||||
// TABLET_UI_HACK: move this to overlays as well!
|
||||
if (_webSurface->getRootItem() && _webSurface->getRootItem()->objectName() == "tablet") {
|
||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||
tabletScriptingInterface->setupTablet("com.highfidelity.interface.tablet.system", _webSurface->getRootItem());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include "WebSocketClass.h"
|
||||
#include "RecordingScriptingInterface.h"
|
||||
#include "ScriptEngines.h"
|
||||
#include "TabletScriptingInterface.h"
|
||||
|
||||
#include "MIDIEvent.h"
|
||||
|
||||
|
@ -542,6 +543,8 @@ void ScriptEngine::init() {
|
|||
auto recordingInterface = DependencyManager::get<RecordingScriptingInterface>();
|
||||
registerGlobalObject("Recording", recordingInterface.data());
|
||||
|
||||
registerGlobalObject("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
||||
|
||||
registerGlobalObject("Assets", &_assetScriptingInterface);
|
||||
registerGlobalObject("Resources", DependencyManager::get<ResourceScriptingInterface>().data());
|
||||
}
|
||||
|
|
|
@ -27,6 +27,11 @@ QObject* TabletScriptingInterface::getTablet(const QString& tabletId) {
|
|||
}
|
||||
}
|
||||
|
||||
void TabletScriptingInterface::setupTablet(QString tabletId, QQuickItem* qmlTablet) {
|
||||
// AJT: TODO
|
||||
qDebug() << "AJT: setupTablet objname = " << qmlTablet->objectName();
|
||||
}
|
||||
|
||||
//
|
||||
// TabletProxy
|
||||
//
|
|
@ -14,6 +14,7 @@
|
|||
#include <QtCore/QObject>
|
||||
#include <QVariant>
|
||||
#include <QScriptValue>
|
||||
#include <QQuickItem>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
|
||||
|
@ -34,6 +35,8 @@ public:
|
|||
* @return {TabletProxy} tablet instance
|
||||
*/
|
||||
Q_INVOKABLE QObject* getTablet(const QString& tabletId);
|
||||
|
||||
void setupTablet(QString tabletId, QQuickItem* qmlTablet);
|
||||
protected:
|
||||
std::mutex _tabletProxiesMutex;
|
||||
std::map<QString, QSharedPointer<TabletProxy>> _tabletProxies;
|
Loading…
Reference in a new issue