mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-09 00:02:21 +02:00
Move directory web UI into the overlay
This commit is contained in:
parent
82c865af2c
commit
5088eec2a2
4 changed files with 28 additions and 2 deletions
|
@ -62,7 +62,7 @@ var directory = (function () {
|
|||
function setUp() {
|
||||
viewport = Controller.getViewportDimensions();
|
||||
|
||||
directoryWindow = new WebWindow('Directory', DIRECTORY_URL, 900, 700, false);
|
||||
directoryWindow = new OverlayWebWindow('Directory', DIRECTORY_URL, 900, 700, false);
|
||||
directoryWindow.setVisible(false);
|
||||
|
||||
directoryButton = Overlays.addOverlay("image", {
|
||||
|
|
|
@ -19,12 +19,27 @@ VrDialog {
|
|||
backgroundColor: "#7f000000"
|
||||
property url source: "about:blank"
|
||||
|
||||
signal navigating(string url)
|
||||
|
||||
Component.onCompleted: {
|
||||
enabled = true
|
||||
console.log("Web Window Created " + root);
|
||||
webview.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
|
||||
console.log("Web Window JS message: " + sourceID + " " + lineNumber + " " + message);
|
||||
});
|
||||
|
||||
webview.loadingChanged.connect(handleWebviewLoading)
|
||||
}
|
||||
|
||||
|
||||
function handleWebviewLoading(loadRequest) {
|
||||
var HIFI_URL_PATTERN = /^hifi:\/\//;
|
||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||
var newUrl = loadRequest.url.toString();
|
||||
if (newUrl.match(HIFI_URL_PATTERN)) {
|
||||
root.navigating(newUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
|
@ -35,11 +50,14 @@ VrDialog {
|
|||
y: root.clientY
|
||||
width: root.clientWidth
|
||||
height: root.clientHeight
|
||||
|
||||
|
||||
WebEngineView {
|
||||
id: webview
|
||||
url: root.source
|
||||
anchors.fill: parent
|
||||
profile: WebEngineProfile {
|
||||
httpUserAgent: "Mozilla/5.0 (HighFidelityInterface)"
|
||||
}
|
||||
}
|
||||
} // item
|
||||
} // dialog
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <QtWebSockets/QWebSocketServer>
|
||||
#include <QtWebChannel/QWebChannel>
|
||||
|
||||
#include <AddressManager.h>
|
||||
#include <DependencyManager.h>
|
||||
|
||||
#include "impl/websocketclientwrapper.h"
|
||||
|
@ -86,8 +87,14 @@ QmlWebWindowClass::QmlWebWindowClass(QObject* qmlWindow)
|
|||
qDebug() << "Created window with ID " << _windowId;
|
||||
Q_ASSERT(_qmlWindow);
|
||||
Q_ASSERT(dynamic_cast<const QQuickItem*>(_qmlWindow));
|
||||
QObject::connect(_qmlWindow, SIGNAL(navigating(QString)), this, SLOT(handleNavigation(QString)));
|
||||
}
|
||||
|
||||
void QmlWebWindowClass::handleNavigation(const QString& url) {
|
||||
DependencyManager::get<AddressManager>()->handleLookupString(url);
|
||||
}
|
||||
|
||||
|
||||
void QmlWebWindowClass::setVisible(bool visible) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "setVisible", Qt::AutoConnection, Q_ARG(bool, visible));
|
||||
|
|
|
@ -81,6 +81,7 @@ signals:
|
|||
|
||||
private slots:
|
||||
void hasClosed();
|
||||
void handleNavigation(const QString& url);
|
||||
|
||||
private:
|
||||
QmlScriptEventBridge* _eventBridge;
|
||||
|
|
Loading…
Reference in a new issue