mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 05:23:09 +02:00
Merge pull request #10623 from jherico/qml_engine_singleton
Migrate to single QML engine
This commit is contained in:
commit
171d3212fe
35 changed files with 223 additions and 215 deletions
|
@ -2,7 +2,6 @@ import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.2
|
import QtQuick.Controls 1.2
|
||||||
import QtWebChannel 1.0
|
import QtWebChannel 1.0
|
||||||
import QtWebEngine 1.2
|
import QtWebEngine 1.2
|
||||||
import FileTypeProfile 1.0
|
|
||||||
|
|
||||||
import "controls-uit"
|
import "controls-uit"
|
||||||
import "styles" as HifiStyles
|
import "styles" as HifiStyles
|
||||||
|
@ -209,6 +208,7 @@ ScrollingWindow {
|
||||||
WebView {
|
WebView {
|
||||||
id: webview
|
id: webview
|
||||||
url: "https://highfidelity.com/"
|
url: "https://highfidelity.com/"
|
||||||
|
profile: FileTypeProfile;
|
||||||
|
|
||||||
property alias eventBridgeWrapper: eventBridgeWrapper
|
property alias eventBridgeWrapper: eventBridgeWrapper
|
||||||
|
|
||||||
|
@ -218,10 +218,6 @@ ScrollingWindow {
|
||||||
property var eventBridge;
|
property var eventBridge;
|
||||||
}
|
}
|
||||||
|
|
||||||
profile: FileTypeProfile {
|
|
||||||
id: webviewProfile
|
|
||||||
storageName: "qmlWebEngine"
|
|
||||||
}
|
|
||||||
|
|
||||||
webChannel.registeredObjects: [eventBridgeWrapper]
|
webChannel.registeredObjects: [eventBridgeWrapper]
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import "controls-uit" as HifiControls
|
||||||
import "styles" as HifiStyles
|
import "styles" as HifiStyles
|
||||||
import "styles-uit"
|
import "styles-uit"
|
||||||
import "windows"
|
import "windows"
|
||||||
import HFTabletWebEngineProfile 1.0
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
@ -47,10 +46,7 @@ Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
||||||
|
|
||||||
profile: HFTabletWebEngineProfile {
|
profile: HFTabletWebEngineProfile;
|
||||||
id: webviewTabletProfile
|
|
||||||
storageName: "qmlTabletWebEngine"
|
|
||||||
}
|
|
||||||
|
|
||||||
property string userScriptUrl: ""
|
property string userScriptUrl: ""
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,10 @@
|
||||||
|
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtWebEngine 1.2
|
import QtWebEngine 1.2
|
||||||
import HFWebEngineProfile 1.0
|
|
||||||
|
|
||||||
WebEngineView {
|
WebEngineView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// profile: desktop.browserProfile
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
console.log("Connecting JS messaging to Hifi Logging")
|
console.log("Connecting JS messaging to Hifi Logging")
|
||||||
// Ensure the JS from the web-engine makes it to our logging
|
// Ensure the JS from the web-engine makes it to our logging
|
||||||
|
|
|
@ -2,7 +2,6 @@ import QtQuick 2.5
|
||||||
import QtWebEngine 1.1
|
import QtWebEngine 1.1
|
||||||
import QtWebChannel 1.0
|
import QtWebChannel 1.0
|
||||||
import "../controls-uit" as HiFiControls
|
import "../controls-uit" as HiFiControls
|
||||||
import HFTabletWebEngineProfile 1.0
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
property alias url: root.url
|
property alias url: root.url
|
||||||
|
@ -39,10 +38,7 @@ Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
||||||
|
|
||||||
profile: HFTabletWebEngineProfile {
|
profile: HFTabletWebEngineProfile;
|
||||||
id: webviewProfile
|
|
||||||
storageName: "qmlTabletWebEngine"
|
|
||||||
}
|
|
||||||
|
|
||||||
property string userScriptUrl: ""
|
property string userScriptUrl: ""
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import QtWebEngine 1.2
|
import QtWebEngine 1.2
|
||||||
import QtWebChannel 1.0
|
import QtWebChannel 1.0
|
||||||
import HFTabletWebEngineProfile 1.0
|
|
||||||
import "../controls-uit" as HiFiControls
|
import "../controls-uit" as HiFiControls
|
||||||
import "../styles" as HifiStyles
|
import "../styles" as HifiStyles
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
|
@ -150,10 +149,7 @@ Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height - web.headerHeight : parent.height - web.headerHeight
|
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height - web.headerHeight : parent.height - web.headerHeight
|
||||||
anchors.top: buttons.bottom
|
anchors.top: buttons.bottom
|
||||||
profile: HFTabletWebEngineProfile {
|
profile: HFTabletWebEngineProfile;
|
||||||
id: webviewTabletProfile
|
|
||||||
storageName: "qmlTabletWebEngine"
|
|
||||||
}
|
|
||||||
|
|
||||||
property string userScriptUrl: ""
|
property string userScriptUrl: ""
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,9 @@
|
||||||
|
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import "."
|
import "."
|
||||||
import FileTypeProfile 1.0
|
|
||||||
|
|
||||||
WebView {
|
WebView {
|
||||||
viewProfile: FileTypeProfile {
|
viewProfile: FileTypeProfile;
|
||||||
id: webviewProfile
|
|
||||||
storageName: "qmlWebEngine"
|
|
||||||
}
|
|
||||||
|
|
||||||
urlTag: "noDownload=true";
|
urlTag: "noDownload=true";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ import QtQuick 2.5
|
||||||
import QtWebEngine 1.1
|
import QtWebEngine 1.1
|
||||||
import QtWebChannel 1.0
|
import QtWebChannel 1.0
|
||||||
import "../controls-uit" as HiFiControls
|
import "../controls-uit" as HiFiControls
|
||||||
import HFWebEngineProfile 1.0
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
property alias url: root.url
|
property alias url: root.url
|
||||||
|
@ -39,10 +38,7 @@ Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
||||||
|
|
||||||
profile: HFWebEngineProfile {
|
profile: HFWebEngineProfile;
|
||||||
id: webviewProfile
|
|
||||||
storageName: "qmlWebEngine"
|
|
||||||
}
|
|
||||||
|
|
||||||
property string userScriptUrl: ""
|
property string userScriptUrl: ""
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import QtWebEngine 1.1;
|
import QtWebEngine 1.1;
|
||||||
import Qt.labs.settings 1.0
|
import Qt.labs.settings 1.0
|
||||||
import HFWebEngineProfile 1.0
|
|
||||||
|
|
||||||
import "../desktop" as OriginalDesktop
|
import "../desktop" as OriginalDesktop
|
||||||
import ".."
|
import ".."
|
||||||
|
@ -27,11 +26,6 @@ OriginalDesktop.Desktop {
|
||||||
property alias toolWindow: toolWindow
|
property alias toolWindow: toolWindow
|
||||||
ToolWindow { id: toolWindow }
|
ToolWindow { id: toolWindow }
|
||||||
|
|
||||||
property var browserProfile: HFWebEngineProfile {
|
|
||||||
id: webviewProfile
|
|
||||||
storageName: "qmlWebEngine"
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
text: "Open Browser"
|
text: "Open Browser"
|
||||||
shortcut: "Ctrl+B"
|
shortcut: "Ctrl+B"
|
||||||
|
|
|
@ -5,7 +5,6 @@ import QtWebChannel 1.0
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
import "../../controls"
|
import "../../controls"
|
||||||
import "../toolbars"
|
import "../toolbars"
|
||||||
import HFWebEngineProfile 1.0
|
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
import "../../controls-uit" as HifiControls
|
import "../../controls-uit" as HifiControls
|
||||||
import "../../styles-uit"
|
import "../../styles-uit"
|
||||||
|
|
|
@ -4,7 +4,6 @@ import QtQuick.Controls 1.4
|
||||||
import QtQml 2.2
|
import QtQml 2.2
|
||||||
import QtWebChannel 1.0
|
import QtWebChannel 1.0
|
||||||
import QtWebEngine 1.1
|
import QtWebEngine 1.1
|
||||||
import HFWebEngineProfile 1.0
|
|
||||||
|
|
||||||
|
|
||||||
import "."
|
import "."
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Hifi 1.0
|
import Hifi 1.0
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import HFTabletWebEngineProfile 1.0
|
|
||||||
import "../../dialogs"
|
import "../../dialogs"
|
||||||
import "../../controls"
|
import "../../controls"
|
||||||
|
|
||||||
|
|
|
@ -150,9 +150,6 @@
|
||||||
#include "LODManager.h"
|
#include "LODManager.h"
|
||||||
#include "ModelPackager.h"
|
#include "ModelPackager.h"
|
||||||
#include "networking/CloseEventSender.h"
|
#include "networking/CloseEventSender.h"
|
||||||
#include "networking/HFWebEngineProfile.h"
|
|
||||||
#include "networking/HFTabletWebEngineProfile.h"
|
|
||||||
#include "networking/FileTypeProfile.h"
|
|
||||||
#include "scripting/TestScriptingInterface.h"
|
#include "scripting/TestScriptingInterface.h"
|
||||||
#include "scripting/AccountScriptingInterface.h"
|
#include "scripting/AccountScriptingInterface.h"
|
||||||
#include "scripting/AssetMappingsScriptingInterface.h"
|
#include "scripting/AssetMappingsScriptingInterface.h"
|
||||||
|
@ -1927,14 +1924,10 @@ void Application::initializeUi() {
|
||||||
UpdateDialog::registerType();
|
UpdateDialog::registerType();
|
||||||
qmlRegisterType<Preference>("Hifi", 1, 0, "Preference");
|
qmlRegisterType<Preference>("Hifi", 1, 0, "Preference");
|
||||||
|
|
||||||
qmlRegisterType<HFWebEngineProfile>("HFWebEngineProfile", 1, 0, "HFWebEngineProfile");
|
|
||||||
qmlRegisterType<HFTabletWebEngineProfile>("HFTabletWebEngineProfile", 1, 0, "HFTabletWebEngineProfile");
|
|
||||||
qmlRegisterType<FileTypeProfile>("FileTypeProfile", 1, 0, "FileTypeProfile");
|
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
offscreenUi->create(_glWidget->qglContext());
|
offscreenUi->create(_glWidget->qglContext());
|
||||||
|
|
||||||
auto rootContext = offscreenUi->getRootContext();
|
auto surfaceContext = offscreenUi->getSurfaceContext();
|
||||||
|
|
||||||
offscreenUi->setProxyWindow(_window->windowHandle());
|
offscreenUi->setProxyWindow(_window->windowHandle());
|
||||||
offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
|
offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
|
||||||
|
@ -1946,7 +1939,7 @@ void Application::initializeUi() {
|
||||||
// do better detection in the offscreen UI of what has focus
|
// do better detection in the offscreen UI of what has focus
|
||||||
offscreenUi->setNavigationFocused(false);
|
offscreenUi->setNavigationFocused(false);
|
||||||
|
|
||||||
auto engine = rootContext->engine();
|
auto engine = surfaceContext->engine();
|
||||||
connect(engine, &QQmlEngine::quit, [] {
|
connect(engine, &QQmlEngine::quit, [] {
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
});
|
});
|
||||||
|
@ -1955,79 +1948,78 @@ void Application::initializeUi() {
|
||||||
|
|
||||||
// For some reason there is already an "Application" object in the QML context,
|
// For some reason there is already an "Application" object in the QML context,
|
||||||
// though I can't find it. Hence, "ApplicationInterface"
|
// though I can't find it. Hence, "ApplicationInterface"
|
||||||
rootContext->setContextProperty("ApplicationInterface", this);
|
surfaceContext->setContextProperty("Audio", DependencyManager::get<AudioScriptingInterface>().data());
|
||||||
rootContext->setContextProperty("Audio", DependencyManager::get<AudioScriptingInterface>().data());
|
surfaceContext->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
|
||||||
rootContext->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
|
surfaceContext->setContextProperty("AudioScope", DependencyManager::get<AudioScope>().data());
|
||||||
rootContext->setContextProperty("AudioScope", DependencyManager::get<AudioScope>().data());
|
|
||||||
|
|
||||||
rootContext->setContextProperty("Controller", DependencyManager::get<controller::ScriptingInterface>().data());
|
surfaceContext->setContextProperty("Controller", DependencyManager::get<controller::ScriptingInterface>().data());
|
||||||
rootContext->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data());
|
surfaceContext->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data());
|
||||||
_fileDownload = new FileScriptingInterface(engine);
|
_fileDownload = new FileScriptingInterface(engine);
|
||||||
rootContext->setContextProperty("File", _fileDownload);
|
surfaceContext->setContextProperty("File", _fileDownload);
|
||||||
connect(_fileDownload, &FileScriptingInterface::unzipResult, this, &Application::handleUnzip);
|
connect(_fileDownload, &FileScriptingInterface::unzipResult, this, &Application::handleUnzip);
|
||||||
rootContext->setContextProperty("MyAvatar", getMyAvatar().get());
|
surfaceContext->setContextProperty("MyAvatar", getMyAvatar().get());
|
||||||
rootContext->setContextProperty("Messages", DependencyManager::get<MessagesClient>().data());
|
surfaceContext->setContextProperty("Messages", DependencyManager::get<MessagesClient>().data());
|
||||||
rootContext->setContextProperty("Recording", DependencyManager::get<RecordingScriptingInterface>().data());
|
surfaceContext->setContextProperty("Recording", DependencyManager::get<RecordingScriptingInterface>().data());
|
||||||
rootContext->setContextProperty("Preferences", DependencyManager::get<Preferences>().data());
|
surfaceContext->setContextProperty("Preferences", DependencyManager::get<Preferences>().data());
|
||||||
rootContext->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
|
surfaceContext->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
|
||||||
rootContext->setContextProperty("FrameTimings", &_frameTimingsScriptingInterface);
|
surfaceContext->setContextProperty("FrameTimings", &_frameTimingsScriptingInterface);
|
||||||
rootContext->setContextProperty("Rates", new RatesScriptingInterface(this));
|
surfaceContext->setContextProperty("Rates", new RatesScriptingInterface(this));
|
||||||
rootContext->setContextProperty("pathToFonts", "../../");
|
|
||||||
|
|
||||||
rootContext->setContextProperty("TREE_SCALE", TREE_SCALE);
|
surfaceContext->setContextProperty("TREE_SCALE", TREE_SCALE);
|
||||||
rootContext->setContextProperty("Quat", new Quat());
|
// FIXME Quat and Vec3 won't work with QJSEngine used by QML
|
||||||
rootContext->setContextProperty("Vec3", new Vec3());
|
surfaceContext->setContextProperty("Quat", new Quat());
|
||||||
rootContext->setContextProperty("Uuid", new ScriptUUID());
|
surfaceContext->setContextProperty("Vec3", new Vec3());
|
||||||
rootContext->setContextProperty("Assets", DependencyManager::get<AssetMappingsScriptingInterface>().data());
|
surfaceContext->setContextProperty("Uuid", new ScriptUUID());
|
||||||
|
surfaceContext->setContextProperty("Assets", DependencyManager::get<AssetMappingsScriptingInterface>().data());
|
||||||
|
|
||||||
rootContext->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data());
|
surfaceContext->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data());
|
||||||
rootContext->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data());
|
surfaceContext->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data());
|
||||||
|
|
||||||
rootContext->setContextProperty("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
|
surfaceContext->setContextProperty("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
|
||||||
|
|
||||||
rootContext->setContextProperty("Camera", &_myCamera);
|
surfaceContext->setContextProperty("Camera", &_myCamera);
|
||||||
|
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||||
rootContext->setContextProperty("SpeechRecognizer", DependencyManager::get<SpeechRecognizer>().data());
|
surfaceContext->setContextProperty("SpeechRecognizer", DependencyManager::get<SpeechRecognizer>().data());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rootContext->setContextProperty("Overlays", &_overlays);
|
surfaceContext->setContextProperty("Overlays", &_overlays);
|
||||||
rootContext->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data());
|
surfaceContext->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data());
|
||||||
rootContext->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());
|
surfaceContext->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());
|
||||||
rootContext->setContextProperty("Stats", Stats::getInstance());
|
surfaceContext->setContextProperty("Stats", Stats::getInstance());
|
||||||
rootContext->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
|
surfaceContext->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
|
||||||
rootContext->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
|
surfaceContext->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
|
||||||
rootContext->setContextProperty("AudioDevice", AudioDeviceScriptingInterface::getInstance());
|
surfaceContext->setContextProperty("AudioDevice", AudioDeviceScriptingInterface::getInstance());
|
||||||
rootContext->setContextProperty("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().data());
|
surfaceContext->setContextProperty("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().data());
|
||||||
rootContext->setContextProperty("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data());
|
surfaceContext->setContextProperty("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data());
|
||||||
|
|
||||||
// Caches
|
// Caches
|
||||||
rootContext->setContextProperty("AnimationCache", DependencyManager::get<AnimationCache>().data());
|
surfaceContext->setContextProperty("AnimationCache", DependencyManager::get<AnimationCache>().data());
|
||||||
rootContext->setContextProperty("TextureCache", DependencyManager::get<TextureCache>().data());
|
surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCache>().data());
|
||||||
rootContext->setContextProperty("ModelCache", DependencyManager::get<ModelCache>().data());
|
surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCache>().data());
|
||||||
rootContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data());
|
surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data());
|
||||||
|
|
||||||
rootContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
||||||
rootContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
surfaceContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
||||||
rootContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
|
surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
|
||||||
rootContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
|
surfaceContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
|
||||||
rootContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
|
surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
|
||||||
rootContext->setContextProperty("AvatarManager", DependencyManager::get<AvatarManager>().data());
|
surfaceContext->setContextProperty("AvatarManager", DependencyManager::get<AvatarManager>().data());
|
||||||
rootContext->setContextProperty("UndoStack", &_undoStackScriptingInterface);
|
surfaceContext->setContextProperty("UndoStack", &_undoStackScriptingInterface);
|
||||||
rootContext->setContextProperty("LODManager", DependencyManager::get<LODManager>().data());
|
surfaceContext->setContextProperty("LODManager", DependencyManager::get<LODManager>().data());
|
||||||
rootContext->setContextProperty("Paths", DependencyManager::get<PathUtils>().data());
|
surfaceContext->setContextProperty("Paths", DependencyManager::get<PathUtils>().data());
|
||||||
rootContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
surfaceContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
||||||
rootContext->setContextProperty("Scene", DependencyManager::get<SceneScriptingInterface>().data());
|
surfaceContext->setContextProperty("Scene", DependencyManager::get<SceneScriptingInterface>().data());
|
||||||
rootContext->setContextProperty("Render", _renderEngine->getConfiguration().get());
|
surfaceContext->setContextProperty("Render", _renderEngine->getConfiguration().get());
|
||||||
rootContext->setContextProperty("Reticle", getApplicationCompositor().getReticleInterface());
|
surfaceContext->setContextProperty("Reticle", getApplicationCompositor().getReticleInterface());
|
||||||
rootContext->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data());
|
surfaceContext->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data());
|
||||||
|
|
||||||
rootContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
|
surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
|
||||||
|
|
||||||
rootContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
|
surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
|
||||||
|
|
||||||
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
|
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
|
||||||
rootContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
|
surfaceContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ Web3DOverlay::~Web3DOverlay() {
|
||||||
void Web3DOverlay::update(float deltatime) {
|
void Web3DOverlay::update(float deltatime) {
|
||||||
if (_webSurface) {
|
if (_webSurface) {
|
||||||
// update globalPosition
|
// update globalPosition
|
||||||
_webSurface->getRootContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
|
_webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,57 +163,56 @@ void Web3DOverlay::loadSourceURL() {
|
||||||
_webSurface->resume();
|
_webSurface->resume();
|
||||||
_webSurface->getRootItem()->setProperty("url", _url);
|
_webSurface->getRootItem()->setProperty("url", _url);
|
||||||
_webSurface->getRootItem()->setProperty("scriptURL", _scriptURL);
|
_webSurface->getRootItem()->setProperty("scriptURL", _scriptURL);
|
||||||
_webSurface->getRootContext()->setContextProperty("ApplicationInterface", qApp);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_webSurface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath()));
|
_webSurface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath()));
|
||||||
_webSurface->load(_url, [&](QQmlContext* context, QObject* obj) {});
|
_webSurface->load(_url, [&](QQmlContext* context, QObject* obj) {});
|
||||||
_webSurface->resume();
|
_webSurface->resume();
|
||||||
|
|
||||||
_webSurface->getRootContext()->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("Preferences", DependencyManager::get<Preferences>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("Preferences", DependencyManager::get<Preferences>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("Vec3", new Vec3());
|
_webSurface->getSurfaceContext()->setContextProperty("Vec3", new Vec3());
|
||||||
_webSurface->getRootContext()->setContextProperty("Quat", new Quat());
|
_webSurface->getSurfaceContext()->setContextProperty("Quat", new Quat());
|
||||||
_webSurface->getRootContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get());
|
_webSurface->getSurfaceContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get());
|
||||||
_webSurface->getRootContext()->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data());
|
||||||
|
|
||||||
if (_webSurface->getRootItem() && _webSurface->getRootItem()->objectName() == "tabletRoot") {
|
if (_webSurface->getRootItem() && _webSurface->getRootItem()->objectName() == "tabletRoot") {
|
||||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||||
auto flags = tabletScriptingInterface->getFlags();
|
auto flags = tabletScriptingInterface->getFlags();
|
||||||
_webSurface->getRootContext()->setContextProperty("offscreenFlags", flags);
|
_webSurface->getSurfaceContext()->setContextProperty("offscreenFlags", flags);
|
||||||
_webSurface->getRootContext()->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
_webSurface->getSurfaceContext()->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
||||||
_webSurface->getRootContext()->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
|
_webSurface->getSurfaceContext()->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("fileDialogHelper", new FileDialogHelper());
|
_webSurface->getSurfaceContext()->setContextProperty("fileDialogHelper", new FileDialogHelper());
|
||||||
_webSurface->getRootContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get());
|
_webSurface->getSurfaceContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get());
|
||||||
_webSurface->getRootContext()->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("Assets", DependencyManager::get<AssetMappingsScriptingInterface>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("Assets", DependencyManager::get<AssetMappingsScriptingInterface>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("LODManager", DependencyManager::get<LODManager>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("LODManager", DependencyManager::get<LODManager>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("OctreeStats", DependencyManager::get<OctreeStatsProvider>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("OctreeStats", DependencyManager::get<OctreeStatsProvider>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("DCModel", DependencyManager::get<DomainConnectionModel>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("DCModel", DependencyManager::get<DomainConnectionModel>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("AudioDevice", AudioDeviceScriptingInterface::getInstance());
|
_webSurface->getSurfaceContext()->setContextProperty("AudioDevice", AudioDeviceScriptingInterface::getInstance());
|
||||||
_webSurface->getRootContext()->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
|
_webSurface->getSurfaceContext()->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
|
||||||
_webSurface->getRootContext()->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
|
_webSurface->getSurfaceContext()->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
|
||||||
_webSurface->getRootContext()->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data());
|
_webSurface->getSurfaceContext()->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("DialogsManager", DialogsManagerScriptingInterface::getInstance());
|
_webSurface->getSurfaceContext()->setContextProperty("DialogsManager", DialogsManagerScriptingInterface::getInstance());
|
||||||
|
|
||||||
_webSurface->getRootContext()->setContextProperty("pathToFonts", "../../");
|
_webSurface->getSurfaceContext()->setContextProperty("pathToFonts", "../../");
|
||||||
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data());
|
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data());
|
||||||
|
|
||||||
// mark the TabletProxy object as cpp ownership.
|
// mark the TabletProxy object as cpp ownership.
|
||||||
QObject* tablet = tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system");
|
QObject* tablet = tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system");
|
||||||
_webSurface->getRootContext()->engine()->setObjectOwnership(tablet, QQmlEngine::CppOwnership);
|
_webSurface->getSurfaceContext()->engine()->setObjectOwnership(tablet, QQmlEngine::CppOwnership);
|
||||||
|
|
||||||
// Override min fps for tablet UI, for silky smooth scrolling
|
// Override min fps for tablet UI, for silky smooth scrolling
|
||||||
setMaxFPS(90);
|
setMaxFPS(90);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_webSurface->getRootContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
|
_webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Web3DOverlay::setMaxFPS(uint8_t maxFPS) {
|
void Web3DOverlay::setMaxFPS(uint8_t maxFPS) {
|
||||||
|
|
|
@ -127,7 +127,7 @@ bool RenderableWebEntityItem::buildWebSurface(QSharedPointer<EntityTreeRenderer>
|
||||||
|
|
||||||
_webSurface->resume();
|
_webSurface->resume();
|
||||||
_webSurface->getRootItem()->setProperty("url", _sourceUrl);
|
_webSurface->getRootItem()->setProperty("url", _sourceUrl);
|
||||||
_webSurface->getRootContext()->setContextProperty("desktop", QVariant());
|
_webSurface->getSurfaceContext()->setContextProperty("desktop", QVariant());
|
||||||
// FIXME - Keyboard HMD only: Possibly add "HMDinfo" object to context for WebView.qml.
|
// FIXME - Keyboard HMD only: Possibly add "HMDinfo" object to context for WebView.qml.
|
||||||
|
|
||||||
// forward web events to EntityScriptingInterface
|
// forward web events to EntityScriptingInterface
|
||||||
|
@ -271,7 +271,7 @@ void RenderableWebEntityItem::loadSourceURL() {
|
||||||
});
|
});
|
||||||
|
|
||||||
_webSurface->getRootItem()->setProperty("url", _sourceUrl);
|
_webSurface->getRootItem()->setProperty("url", _sourceUrl);
|
||||||
_webSurface->getRootContext()->setContextProperty("desktop", QVariant());
|
_webSurface->getSurfaceContext()->setContextProperty("desktop", QVariant());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_contentType = qmlContent;
|
_contentType = qmlContent;
|
||||||
|
@ -284,7 +284,7 @@ void RenderableWebEntityItem::loadSourceURL() {
|
||||||
_webSurface->getRootItem(), _webSurface.data());
|
_webSurface->getRootItem(), _webSurface.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_webSurface->getRootContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
|
_webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ void RenderableWebEntityItem::update(const quint64& now) {
|
||||||
|
|
||||||
if (_webSurface) {
|
if (_webSurface) {
|
||||||
// update globalPosition
|
// update globalPosition
|
||||||
_webSurface->getRootContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
|
_webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto interval = now - _lastRenderTime;
|
auto interval = now - _lastRenderTime;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
set(TARGET_NAME gl)
|
set(TARGET_NAME gl)
|
||||||
setup_hifi_library(OpenGL Qml Quick)
|
setup_hifi_library(OpenGL Qml Quick)
|
||||||
link_hifi_libraries(shared)
|
link_hifi_libraries(shared networking)
|
||||||
|
|
||||||
target_opengl()
|
target_opengl()
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
#include <NetworkAccessManager.h>
|
#include <NetworkAccessManager.h>
|
||||||
#include <GLMHelpers.h>
|
#include <GLMHelpers.h>
|
||||||
#include <shared/GlobalAppProperties.h>
|
#include <shared/GlobalAppProperties.h>
|
||||||
|
#include <FileTypeProfile.h>
|
||||||
|
#include <HFWebEngineProfile.h>
|
||||||
|
#include <HFTabletWebEngineProfile.h>
|
||||||
|
|
||||||
#include "OffscreenGLCanvas.h"
|
#include "OffscreenGLCanvas.h"
|
||||||
#include "GLHelpers.h"
|
#include "GLHelpers.h"
|
||||||
|
@ -41,6 +44,7 @@
|
||||||
|
|
||||||
Q_LOGGING_CATEGORY(trace_render_qml, "trace.render.qml")
|
Q_LOGGING_CATEGORY(trace_render_qml, "trace.render.qml")
|
||||||
Q_LOGGING_CATEGORY(trace_render_qml_gl, "trace.render.qml.gl")
|
Q_LOGGING_CATEGORY(trace_render_qml_gl, "trace.render.qml.gl")
|
||||||
|
Q_LOGGING_CATEGORY(offscreenFocus, "hifi.offscreen.focus")
|
||||||
|
|
||||||
struct TextureSet {
|
struct TextureSet {
|
||||||
// The number of surfaces with this size
|
// The number of surfaces with this size
|
||||||
|
@ -254,8 +258,72 @@ QNetworkAccessManager* QmlNetworkAccessManagerFactory::create(QObject* parent) {
|
||||||
return new QmlNetworkAccessManager(parent);
|
return new QmlNetworkAccessManager(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_DECLARE_LOGGING_CATEGORY(offscreenFocus)
|
static QQmlEngine* globalEngine { nullptr };
|
||||||
Q_LOGGING_CATEGORY(offscreenFocus, "hifi.offscreen.focus")
|
static size_t globalEngineRefCount { 0 };
|
||||||
|
|
||||||
|
QString getEventBridgeJavascript() {
|
||||||
|
// FIXME: Refactor with similar code in RenderableWebEntityItem
|
||||||
|
QString javaScriptToInject;
|
||||||
|
QFile webChannelFile(":qtwebchannel/qwebchannel.js");
|
||||||
|
QFile createGlobalEventBridgeFile(PathUtils::resourcesPath() + "/html/createGlobalEventBridge.js");
|
||||||
|
if (webChannelFile.open(QFile::ReadOnly | QFile::Text) &&
|
||||||
|
createGlobalEventBridgeFile.open(QFile::ReadOnly | QFile::Text)) {
|
||||||
|
QString webChannelStr = QTextStream(&webChannelFile).readAll();
|
||||||
|
QString createGlobalEventBridgeStr = QTextStream(&createGlobalEventBridgeFile).readAll();
|
||||||
|
javaScriptToInject = webChannelStr + createGlobalEventBridgeStr;
|
||||||
|
} else {
|
||||||
|
qCWarning(glLogging) << "Unable to find qwebchannel.js or createGlobalEventBridge.js";
|
||||||
|
}
|
||||||
|
return javaScriptToInject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QQmlEngine* acquireEngine(QQuickWindow* window) {
|
||||||
|
Q_ASSERT(QThread::currentThread() == qApp->thread());
|
||||||
|
if (!globalEngine) {
|
||||||
|
Q_ASSERT(0 == globalEngineRefCount);
|
||||||
|
globalEngine = new QQmlEngine();
|
||||||
|
globalEngine->setNetworkAccessManagerFactory(new QmlNetworkAccessManagerFactory);
|
||||||
|
|
||||||
|
auto importList = globalEngine->importPathList();
|
||||||
|
importList.insert(importList.begin(), PathUtils::resourcesPath());
|
||||||
|
globalEngine->setImportPathList(importList);
|
||||||
|
for (const auto& path : importList) {
|
||||||
|
qDebug() << path;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!globalEngine->incubationController()) {
|
||||||
|
globalEngine->setIncubationController(window->incubationController());
|
||||||
|
}
|
||||||
|
auto rootContext = globalEngine->rootContext();
|
||||||
|
rootContext->setContextProperty("GL", ::getGLContextData());
|
||||||
|
rootContext->setContextProperty("urlHandler", new UrlHandler());
|
||||||
|
rootContext->setContextProperty("resourceDirectoryUrl", QUrl::fromLocalFile(PathUtils::resourcesPath()));
|
||||||
|
rootContext->setContextProperty("pathToFonts", "../../");
|
||||||
|
rootContext->setContextProperty("ApplicationInterface", qApp);
|
||||||
|
auto javaScriptToInject = getEventBridgeJavascript();
|
||||||
|
if (!javaScriptToInject.isEmpty()) {
|
||||||
|
rootContext->setContextProperty("eventBridgeJavaScriptToInject", QVariant(javaScriptToInject));
|
||||||
|
}
|
||||||
|
rootContext->setContextProperty("FileTypeProfile", new FileTypeProfile(rootContext));
|
||||||
|
rootContext->setContextProperty("HFWebEngineProfile", new HFWebEngineProfile(rootContext));
|
||||||
|
rootContext->setContextProperty("HFTabletWebEngineProfile", new HFTabletWebEngineProfile(rootContext));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
++globalEngineRefCount;
|
||||||
|
return globalEngine;
|
||||||
|
}
|
||||||
|
|
||||||
|
void releaseEngine() {
|
||||||
|
Q_ASSERT(QThread::currentThread() == qApp->thread());
|
||||||
|
Q_ASSERT(0 != globalEngineRefCount);
|
||||||
|
if (0 == --globalEngineRefCount) {
|
||||||
|
globalEngine->deleteLater();
|
||||||
|
globalEngine = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::cleanup() {
|
void OffscreenQmlSurface::cleanup() {
|
||||||
_canvas->makeCurrent();
|
_canvas->makeCurrent();
|
||||||
|
@ -294,6 +362,7 @@ void OffscreenQmlSurface::render() {
|
||||||
GLuint texture = offscreenTextures.getNextTexture(_size);
|
GLuint texture = offscreenTextures.getNextTexture(_size);
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _fbo);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _fbo);
|
||||||
glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0);
|
glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
_renderControl->render();
|
_renderControl->render();
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
|
@ -362,8 +431,8 @@ OffscreenQmlSurface::~OffscreenQmlSurface() {
|
||||||
_canvas->deleteLater();
|
_canvas->deleteLater();
|
||||||
_rootItem->deleteLater();
|
_rootItem->deleteLater();
|
||||||
_qmlComponent->deleteLater();
|
_qmlComponent->deleteLater();
|
||||||
_qmlEngine->deleteLater();
|
|
||||||
_quickWindow->deleteLater();
|
_quickWindow->deleteLater();
|
||||||
|
releaseEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::onAboutToQuit() {
|
void OffscreenQmlSurface::onAboutToQuit() {
|
||||||
|
@ -375,6 +444,8 @@ void OffscreenQmlSurface::create(QOpenGLContext* shareContext) {
|
||||||
qCDebug(glLogging) << "Building QML surface";
|
qCDebug(glLogging) << "Building QML surface";
|
||||||
|
|
||||||
_renderControl = new QMyQuickRenderControl();
|
_renderControl = new QMyQuickRenderControl();
|
||||||
|
connect(_renderControl, &QQuickRenderControl::renderRequested, this, [this] { _render = true; });
|
||||||
|
connect(_renderControl, &QQuickRenderControl::sceneChanged, this, [this] { _render = _polish = true; });
|
||||||
|
|
||||||
QQuickWindow::setDefaultAlphaBuffer(true);
|
QQuickWindow::setDefaultAlphaBuffer(true);
|
||||||
|
|
||||||
|
@ -385,7 +456,7 @@ void OffscreenQmlSurface::create(QOpenGLContext* shareContext) {
|
||||||
// so we wait until after its ctor to move object/context to this thread.
|
// so we wait until after its ctor to move object/context to this thread.
|
||||||
_quickWindow = new QQuickWindow(_renderControl);
|
_quickWindow = new QQuickWindow(_renderControl);
|
||||||
_quickWindow->setColor(QColor(255, 255, 255, 0));
|
_quickWindow->setColor(QColor(255, 255, 255, 0));
|
||||||
_quickWindow->setFlags(_quickWindow->flags() | static_cast<Qt::WindowFlags>(Qt::WA_TranslucentBackground));
|
_quickWindow->setClearBeforeRendering(false);
|
||||||
|
|
||||||
_renderControl->_renderWindow = _proxyWindow;
|
_renderControl->_renderWindow = _proxyWindow;
|
||||||
|
|
||||||
|
@ -398,32 +469,20 @@ void OffscreenQmlSurface::create(QOpenGLContext* shareContext) {
|
||||||
connect(_quickWindow, &QQuickWindow::focusObjectChanged, this, &OffscreenQmlSurface::onFocusObjectChanged);
|
connect(_quickWindow, &QQuickWindow::focusObjectChanged, this, &OffscreenQmlSurface::onFocusObjectChanged);
|
||||||
|
|
||||||
// Create a QML engine.
|
// Create a QML engine.
|
||||||
_qmlEngine = new QQmlEngine;
|
auto qmlEngine = acquireEngine(_quickWindow);
|
||||||
|
_qmlContext = new QQmlContext(qmlEngine->rootContext());
|
||||||
|
|
||||||
_qmlEngine->setNetworkAccessManagerFactory(new QmlNetworkAccessManagerFactory);
|
_qmlContext->setContextProperty("offscreenWindow", QVariant::fromValue(getWindow()));
|
||||||
|
_qmlContext->setContextProperty("globalEventBridge", this);
|
||||||
|
_qmlContext->setContextProperty("webEntity", this);
|
||||||
|
|
||||||
auto importList = _qmlEngine->importPathList();
|
_qmlComponent = new QQmlComponent(qmlEngine);
|
||||||
importList.insert(importList.begin(), PathUtils::resourcesPath());
|
|
||||||
_qmlEngine->setImportPathList(importList);
|
|
||||||
if (!_qmlEngine->incubationController()) {
|
|
||||||
_qmlEngine->setIncubationController(_quickWindow->incubationController());
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME
|
|
||||||
_glData = ::getGLContextData(); // Initialize JSON structure so that it can be filled in later and then used in QML.
|
|
||||||
_qmlEngine->rootContext()->setContextProperty("GL", _glData);
|
|
||||||
_qmlEngine->rootContext()->setContextProperty("offscreenWindow", QVariant::fromValue(getWindow()));
|
|
||||||
_qmlComponent = new QQmlComponent(_qmlEngine);
|
|
||||||
|
|
||||||
|
|
||||||
connect(_renderControl, &QQuickRenderControl::renderRequested, this, [this] { _render = true; });
|
|
||||||
connect(_renderControl, &QQuickRenderControl::sceneChanged, this, [this] { _render = _polish = true; });
|
|
||||||
|
|
||||||
if (!_canvas->makeCurrent()) {
|
if (!_canvas->makeCurrent()) {
|
||||||
qWarning("Failed to make context current for QML Renderer");
|
qWarning("Failed to make context current for QML Renderer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_glData = ::getGLContextData();
|
|
||||||
_renderControl->initialize(_canvas->getContext());
|
_renderControl->initialize(_canvas->getContext());
|
||||||
|
|
||||||
// When Quick says there is a need to render, we will not render immediately. Instead,
|
// When Quick says there is a need to render, we will not render immediately. Instead,
|
||||||
|
@ -433,11 +492,6 @@ void OffscreenQmlSurface::create(QOpenGLContext* shareContext) {
|
||||||
_updateTimer.setTimerType(Qt::PreciseTimer);
|
_updateTimer.setTimerType(Qt::PreciseTimer);
|
||||||
_updateTimer.setInterval(MIN_TIMER_MS); // 5ms, Qt::PreciseTimer required
|
_updateTimer.setInterval(MIN_TIMER_MS); // 5ms, Qt::PreciseTimer required
|
||||||
_updateTimer.start();
|
_updateTimer.start();
|
||||||
|
|
||||||
auto rootContext = getRootContext();
|
|
||||||
rootContext->setContextProperty("urlHandler", new UrlHandler());
|
|
||||||
rootContext->setContextProperty("resourceDirectoryUrl", QUrl::fromLocalFile(PathUtils::resourcesPath()));
|
|
||||||
rootContext->setContextProperty("pathToFonts", "../../");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uvec2 clampSize(const uvec2& size, uint32_t maxDimension) {
|
static uvec2 clampSize(const uvec2& size, uint32_t maxDimension) {
|
||||||
|
@ -460,7 +514,7 @@ void OffscreenQmlSurface::resize(const QSize& newSize_, bool forceResize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_qmlEngine->rootContext()->setContextProperty("surfaceSize", newSize);
|
_qmlContext->setContextProperty("surfaceSize", newSize);
|
||||||
|
|
||||||
if (_rootItem) {
|
if (_rootItem) {
|
||||||
_rootItem->setSize(newSize);
|
_rootItem->setSize(newSize);
|
||||||
|
@ -520,14 +574,19 @@ QQuickItem* OffscreenQmlSurface::getRootItem() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::setBaseUrl(const QUrl& baseUrl) {
|
void OffscreenQmlSurface::setBaseUrl(const QUrl& baseUrl) {
|
||||||
_qmlEngine->setBaseUrl(baseUrl);
|
_qmlContext->setBaseUrl(baseUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* OffscreenQmlSurface::load(const QUrl& qmlSource, std::function<void(QQmlContext*, QObject*)> f) {
|
QObject* OffscreenQmlSurface::load(const QUrl& qmlSource, std::function<void(QQmlContext*, QObject*)> f) {
|
||||||
// Synchronous loading may take a while; restart the deadlock timer
|
// Synchronous loading may take a while; restart the deadlock timer
|
||||||
QMetaObject::invokeMethod(qApp, "updateHeartbeat", Qt::DirectConnection);
|
QMetaObject::invokeMethod(qApp, "updateHeartbeat", Qt::DirectConnection);
|
||||||
|
|
||||||
_qmlComponent->loadUrl(qmlSource, QQmlComponent::PreferSynchronous);
|
if ((qmlSource.isRelative() && !qmlSource.isEmpty()) || qmlSource.scheme() == QLatin1String("file")) {
|
||||||
|
_qmlComponent->loadUrl(_qmlContext->resolvedUrl(qmlSource), QQmlComponent::PreferSynchronous);
|
||||||
|
} else {
|
||||||
|
_qmlComponent->loadUrl(qmlSource, QQmlComponent::PreferSynchronous);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_qmlComponent->isLoading()) {
|
if (_qmlComponent->isLoading()) {
|
||||||
connect(_qmlComponent, &QQmlComponent::statusChanged, this,
|
connect(_qmlComponent, &QQmlComponent::statusChanged, this,
|
||||||
|
@ -541,10 +600,22 @@ QObject* OffscreenQmlSurface::load(const QUrl& qmlSource, std::function<void(QQm
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::clearCache() {
|
void OffscreenQmlSurface::clearCache() {
|
||||||
getRootContext()->engine()->clearComponentCache();
|
_qmlContext->engine()->clearComponentCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* OffscreenQmlSurface::finishQmlLoad(std::function<void(QQmlContext*, QObject*)> f) {
|
QObject* OffscreenQmlSurface::finishQmlLoad(std::function<void(QQmlContext*, QObject*)> f) {
|
||||||
|
#if 0
|
||||||
|
if (!_rootItem) {
|
||||||
|
QQmlComponent component(_qmlContext->engine());
|
||||||
|
component.setData(R"QML(
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtWebChannel 1.0
|
||||||
|
Item { Component.onCompleted: globalEventBridge.WebChannel.id = "globalEventBridge"; }
|
||||||
|
)QML", QUrl());
|
||||||
|
QObject *helper = component.create(_qmlContext);
|
||||||
|
qDebug() << "Created helper";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
disconnect(_qmlComponent, &QQmlComponent::statusChanged, this, 0);
|
disconnect(_qmlComponent, &QQmlComponent::statusChanged, this, 0);
|
||||||
if (_qmlComponent->isError()) {
|
if (_qmlComponent->isError()) {
|
||||||
QList<QQmlError> errorList = _qmlComponent->errors();
|
QList<QQmlError> errorList = _qmlComponent->errors();
|
||||||
|
@ -554,21 +625,8 @@ QObject* OffscreenQmlSurface::finishQmlLoad(std::function<void(QQmlContext*, QOb
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Refactor with similar code in RenderableWebEntityItem
|
|
||||||
QString javaScriptToInject;
|
|
||||||
QFile webChannelFile(":qtwebchannel/qwebchannel.js");
|
|
||||||
QFile createGlobalEventBridgeFile(PathUtils::resourcesPath() + "/html/createGlobalEventBridge.js");
|
|
||||||
if (webChannelFile.open(QFile::ReadOnly | QFile::Text) &&
|
|
||||||
createGlobalEventBridgeFile.open(QFile::ReadOnly | QFile::Text)) {
|
|
||||||
QString webChannelStr = QTextStream(&webChannelFile).readAll();
|
|
||||||
QString createGlobalEventBridgeStr = QTextStream(&createGlobalEventBridgeFile).readAll();
|
|
||||||
javaScriptToInject = webChannelStr + createGlobalEventBridgeStr;
|
|
||||||
} else {
|
|
||||||
qCWarning(glLogging) << "Unable to find qwebchannel.js or createGlobalEventBridge.js";
|
|
||||||
}
|
|
||||||
|
|
||||||
QQmlContext* newContext = new QQmlContext(_qmlEngine, qApp);
|
QObject* newObject = _qmlComponent->beginCreate(_qmlContext);
|
||||||
QObject* newObject = _qmlComponent->beginCreate(newContext);
|
|
||||||
if (_qmlComponent->isError()) {
|
if (_qmlComponent->isError()) {
|
||||||
QList<QQmlError> errorList = _qmlComponent->errors();
|
QList<QQmlError> errorList = _qmlComponent->errors();
|
||||||
foreach(const QQmlError& error, errorList)
|
foreach(const QQmlError& error, errorList)
|
||||||
|
@ -579,12 +637,10 @@ QObject* OffscreenQmlSurface::finishQmlLoad(std::function<void(QQmlContext*, QOb
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
_qmlEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
_qmlContext->engine()->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
||||||
newObject->setProperty("eventBridge", QVariant::fromValue(this));
|
newObject->setProperty("eventBridge", QVariant::fromValue(this));
|
||||||
|
|
||||||
newContext->setContextProperty("eventBridgeJavaScriptToInject", QVariant(javaScriptToInject));
|
f(_qmlContext, newObject);
|
||||||
|
|
||||||
f(newContext, newObject);
|
|
||||||
_qmlComponent->completeCreate();
|
_qmlComponent->completeCreate();
|
||||||
|
|
||||||
|
|
||||||
|
@ -735,7 +791,7 @@ bool OffscreenQmlSurface::eventFilter(QObject* originalDestination, QEvent* even
|
||||||
mouseEvent->screenPos(), mouseEvent->button(),
|
mouseEvent->screenPos(), mouseEvent->button(),
|
||||||
mouseEvent->buttons(), mouseEvent->modifiers());
|
mouseEvent->buttons(), mouseEvent->modifiers());
|
||||||
if (event->type() == QEvent::MouseMove) {
|
if (event->type() == QEvent::MouseMove) {
|
||||||
_qmlEngine->rootContext()->setContextProperty("lastMousePosition", transformedPos);
|
_qmlContext->setContextProperty("lastMousePosition", transformedPos);
|
||||||
}
|
}
|
||||||
mappedEvent.ignore();
|
mappedEvent.ignore();
|
||||||
if (QCoreApplication::sendEvent(_quickWindow, &mappedEvent)) {
|
if (QCoreApplication::sendEvent(_quickWindow, &mappedEvent)) {
|
||||||
|
@ -762,9 +818,6 @@ void OffscreenQmlSurface::resume() {
|
||||||
if (getRootItem()) {
|
if (getRootItem()) {
|
||||||
getRootItem()->setProperty("eventBridge", QVariant::fromValue(this));
|
getRootItem()->setProperty("eventBridge", QVariant::fromValue(this));
|
||||||
}
|
}
|
||||||
if (getRootContext()) {
|
|
||||||
getRootContext()->setContextProperty("webEntity", this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OffscreenQmlSurface::isPaused() const {
|
bool OffscreenQmlSurface::isPaused() const {
|
||||||
|
@ -790,8 +843,8 @@ QSize OffscreenQmlSurface::size() const {
|
||||||
return _quickWindow->geometry().size();
|
return _quickWindow->geometry().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
QQmlContext* OffscreenQmlSurface::getRootContext() {
|
QQmlContext* OffscreenQmlSurface::getSurfaceContext() {
|
||||||
return _qmlEngine->rootContext();
|
return _qmlContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(std::function<void()>);
|
Q_DECLARE_METATYPE(std::function<void()>);
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
QQuickItem* getRootItem();
|
QQuickItem* getRootItem();
|
||||||
QQuickWindow* getWindow();
|
QQuickWindow* getWindow();
|
||||||
QObject* getEventHandler();
|
QObject* getEventHandler();
|
||||||
QQmlContext* getRootContext();
|
QQmlContext* getSurfaceContext();
|
||||||
|
|
||||||
QPointF mapToVirtualScreen(const QPointF& originalPoint, QObject* originalWidget);
|
QPointF mapToVirtualScreen(const QPointF& originalPoint, QObject* originalWidget);
|
||||||
bool eventFilter(QObject* originalDestination, QEvent* event) override;
|
bool eventFilter(QObject* originalDestination, QEvent* event) override;
|
||||||
|
@ -133,11 +133,10 @@ private slots:
|
||||||
private:
|
private:
|
||||||
QQuickWindow* _quickWindow { nullptr };
|
QQuickWindow* _quickWindow { nullptr };
|
||||||
QMyQuickRenderControl* _renderControl{ nullptr };
|
QMyQuickRenderControl* _renderControl{ nullptr };
|
||||||
QQmlEngine* _qmlEngine { nullptr };
|
QQmlContext* _qmlContext { nullptr };
|
||||||
QQmlComponent* _qmlComponent { nullptr };
|
QQmlComponent* _qmlComponent { nullptr };
|
||||||
QQuickItem* _rootItem { nullptr };
|
QQuickItem* _rootItem { nullptr };
|
||||||
OffscreenGLCanvas* _canvas { nullptr };
|
OffscreenGLCanvas* _canvas { nullptr };
|
||||||
QJsonObject _glData;
|
|
||||||
|
|
||||||
QTimer _updateTimer;
|
QTimer _updateTimer;
|
||||||
uint32_t _fbo { 0 };
|
uint32_t _fbo { 0 };
|
||||||
|
|
|
@ -49,7 +49,6 @@ QSharedPointer<OffscreenQmlSurface> OffscreenQmlSurfaceCache::buildSurface(const
|
||||||
surface->create(currentContext);
|
surface->create(currentContext);
|
||||||
surface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
|
surface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
|
||||||
surface->load(rootSource);
|
surface->load(rootSource);
|
||||||
surface->getRootContext()->setContextProperty("ApplicationInterface", qApp);
|
|
||||||
surface->resize(QSize(100, 100));
|
surface->resize(QSize(100, 100));
|
||||||
currentContext->makeCurrent(currentSurface);
|
currentContext->makeCurrent(currentSurface);
|
||||||
return surface;
|
return surface;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
set(TARGET_NAME networking)
|
set(TARGET_NAME networking)
|
||||||
setup_hifi_library(Network)
|
setup_hifi_library(Network WebEngine)
|
||||||
link_hifi_libraries(shared)
|
link_hifi_libraries(shared)
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_BINARY_DIR}/includes")
|
target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_BINARY_DIR}/includes")
|
||||||
|
|
|
@ -19,6 +19,7 @@ HFTabletWebEngineProfile::HFTabletWebEngineProfile(QObject* parent) : QQuickWebE
|
||||||
static const QString WEB_ENGINE_USER_AGENT = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36";
|
static const QString WEB_ENGINE_USER_AGENT = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36";
|
||||||
|
|
||||||
setHttpUserAgent(WEB_ENGINE_USER_AGENT);
|
setHttpUserAgent(WEB_ENGINE_USER_AGENT);
|
||||||
|
setStorageName(QML_WEB_ENGINE_NAME);
|
||||||
|
|
||||||
auto requestInterceptor = new HFTabletWebEngineRequestInterceptor(this);
|
auto requestInterceptor = new HFTabletWebEngineRequestInterceptor(this);
|
||||||
setRequestInterceptor(requestInterceptor);
|
setRequestInterceptor(requestInterceptor);
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "HFTabletWebEngineRequestInterceptor.h"
|
#include "HFTabletWebEngineRequestInterceptor.h"
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <AccountManager.h>
|
#include "AccountManager.h"
|
||||||
|
|
||||||
bool isTabletAuthableHighFidelityURL(const QUrl& url) {
|
bool isTabletAuthableHighFidelityURL(const QUrl& url) {
|
||||||
static const QStringList HF_HOSTS = {
|
static const QStringList HF_HOSTS = {
|
|
@ -20,6 +20,7 @@ HFWebEngineProfile::HFWebEngineProfile(QObject* parent) :
|
||||||
{
|
{
|
||||||
static const QString WEB_ENGINE_USER_AGENT = "Chrome/48.0 (HighFidelityInterface)";
|
static const QString WEB_ENGINE_USER_AGENT = "Chrome/48.0 (HighFidelityInterface)";
|
||||||
setHttpUserAgent(WEB_ENGINE_USER_AGENT);
|
setHttpUserAgent(WEB_ENGINE_USER_AGENT);
|
||||||
|
setStorageName(QML_WEB_ENGINE_STORAGE_NAME);
|
||||||
|
|
||||||
// we use the HFWebEngineRequestInterceptor to make sure that web requests are authenticated for the interface user
|
// we use the HFWebEngineRequestInterceptor to make sure that web requests are authenticated for the interface user
|
||||||
auto requestInterceptor = new HFWebEngineRequestInterceptor(this);
|
auto requestInterceptor = new HFWebEngineRequestInterceptor(this);
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
#include <AccountManager.h>
|
#include "AccountManager.h"
|
||||||
#include "RequestFilters.h"
|
#include "RequestFilters.h"
|
||||||
|
|
||||||
void HFWebEngineRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo& info) {
|
void HFWebEngineRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo& info) {
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
#include <AccountManager.h>
|
#include "AccountManager.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -91,14 +91,14 @@ QObject* OffscreenUi::getFlags() {
|
||||||
|
|
||||||
void OffscreenUi::create(QOpenGLContext* context) {
|
void OffscreenUi::create(QOpenGLContext* context) {
|
||||||
OffscreenQmlSurface::create(context);
|
OffscreenQmlSurface::create(context);
|
||||||
auto rootContext = getRootContext();
|
auto myContext = getSurfaceContext();
|
||||||
|
|
||||||
rootContext->setContextProperty("OffscreenUi", this);
|
myContext->setContextProperty("OffscreenUi", this);
|
||||||
rootContext->setContextProperty("offscreenFlags", offscreenFlags = new OffscreenFlags());
|
myContext->setContextProperty("offscreenFlags", offscreenFlags = new OffscreenFlags());
|
||||||
rootContext->setContextProperty("fileDialogHelper", new FileDialogHelper());
|
myContext->setContextProperty("fileDialogHelper", new FileDialogHelper());
|
||||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||||
TabletProxy* tablet = tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system");
|
TabletProxy* tablet = tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system");
|
||||||
rootContext->engine()->setObjectOwnership(tablet, QQmlEngine::CppOwnership);
|
myContext->engine()->setObjectOwnership(tablet, QQmlEngine::CppOwnership);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenUi::show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f) {
|
void OffscreenUi::show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f) {
|
||||||
|
@ -547,14 +547,14 @@ void OffscreenUi::createDesktop(const QUrl& url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
getRootContext()->setContextProperty("DebugQML", QVariant(true));
|
getSurfaceContext()->setContextProperty("DebugQML", QVariant(true));
|
||||||
#else
|
#else
|
||||||
getRootContext()->setContextProperty("DebugQML", QVariant(false));
|
getSurfaceContext()->setContextProperty("DebugQML", QVariant(false));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_desktop = dynamic_cast<QQuickItem*>(load(url));
|
_desktop = dynamic_cast<QQuickItem*>(load(url));
|
||||||
Q_ASSERT(_desktop);
|
Q_ASSERT(_desktop);
|
||||||
getRootContext()->setContextProperty("desktop", _desktop);
|
getSurfaceContext()->setContextProperty("desktop", _desktop);
|
||||||
|
|
||||||
_toolWindow = _desktop->findChild<QQuickItem*>("ToolWindow");
|
_toolWindow = _desktop->findChild<QQuickItem*>("ToolWindow");
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ private:
|
||||||
|
|
||||||
VrMenu::VrMenu(OffscreenUi* parent) : QObject(parent) {
|
VrMenu::VrMenu(OffscreenUi* parent) : QObject(parent) {
|
||||||
_rootMenu = parent->getRootItem()->findChild<QObject*>("rootMenu");
|
_rootMenu = parent->getRootItem()->findChild<QObject*>("rootMenu");
|
||||||
parent->getRootContext()->setContextProperty("rootMenu", _rootMenu);
|
parent->getSurfaceContext()->setContextProperty("rootMenu", _rootMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* VrMenu::findMenuObject(const QString& menuOption) {
|
QObject* VrMenu::findMenuObject(const QString& menuOption) {
|
||||||
|
|
Loading…
Reference in a new issue