mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 15:47:02 +02:00
the proper fix for browser qml issues
This commit is contained in:
parent
a111aa1724
commit
562e159ab4
11 changed files with 140 additions and 445 deletions
|
@ -1,275 +0,0 @@
|
||||||
import QtQuick 2.5
|
|
||||||
import QtWebChannel 1.0
|
|
||||||
import QtWebEngine 1.5
|
|
||||||
|
|
||||||
import controlsUit 1.0
|
|
||||||
import stylesUit 1.0
|
|
||||||
import "windows"
|
|
||||||
|
|
||||||
ScrollingWindow {
|
|
||||||
id: root
|
|
||||||
HifiConstants { id: hifi }
|
|
||||||
//HifiStyles.HifiConstants { id: hifistyles }
|
|
||||||
title: "Browser"
|
|
||||||
resizable: true
|
|
||||||
destroyOnHidden: true
|
|
||||||
width: 800
|
|
||||||
height: 600
|
|
||||||
property variant permissionsBar: {'securityOrigin':'none','feature':'none'}
|
|
||||||
property alias url: webview.url
|
|
||||||
property alias webView: webview
|
|
||||||
|
|
||||||
signal loadingChanged(int status)
|
|
||||||
|
|
||||||
x: 100
|
|
||||||
y: 100
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
focus = true
|
|
||||||
shown = true
|
|
||||||
addressBar.text = webview.url
|
|
||||||
}
|
|
||||||
|
|
||||||
function setProfile(profile) {
|
|
||||||
webview.profile = profile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showPermissionsBar(){
|
|
||||||
permissionsContainer.visible=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function hidePermissionsBar(){
|
|
||||||
permissionsContainer.visible=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function allowPermissions(){
|
|
||||||
webview.grantFeaturePermission(permissionsBar.securityOrigin, permissionsBar.feature, true);
|
|
||||||
hidePermissionsBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setAutoAdd(auto) {
|
|
||||||
desktop.setAutoAdd(auto);
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id:item
|
|
||||||
width: pane.contentWidth
|
|
||||||
implicitHeight: pane.scrollHeight
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: buttons
|
|
||||||
spacing: 4
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: 8
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 8
|
|
||||||
HiFiGlyphs {
|
|
||||||
id: back;
|
|
||||||
enabled: webview.canGoBack;
|
|
||||||
text: hifi.glyphs.backward
|
|
||||||
color: enabled ? hifi.colors.text : hifi.colors.disabledText
|
|
||||||
size: 48
|
|
||||||
MouseArea { anchors.fill: parent; onClicked: webview.goBack() }
|
|
||||||
}
|
|
||||||
|
|
||||||
HiFiGlyphs {
|
|
||||||
id: forward;
|
|
||||||
enabled: webview.canGoForward;
|
|
||||||
text: hifi.glyphs.forward
|
|
||||||
color: enabled ? hifi.colors.text : hifi.colors.disabledText
|
|
||||||
size: 48
|
|
||||||
MouseArea { anchors.fill: parent; onClicked: webview.goForward() }
|
|
||||||
}
|
|
||||||
|
|
||||||
HiFiGlyphs {
|
|
||||||
id: reload;
|
|
||||||
enabled: webview.canGoForward;
|
|
||||||
text: webview.loading ? hifi.glyphs.close : hifi.glyphs.reload
|
|
||||||
color: enabled ? hifi.colors.text : hifi.colors.disabledText
|
|
||||||
size: 48
|
|
||||||
MouseArea { anchors.fill: parent; onClicked: webview.goForward() }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: border
|
|
||||||
height: 48
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: 8
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: 8
|
|
||||||
anchors.left: buttons.right
|
|
||||||
anchors.leftMargin: 8
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: barIcon
|
|
||||||
width: parent.height
|
|
||||||
height: parent.height
|
|
||||||
Image {
|
|
||||||
source: webview.icon;
|
|
||||||
x: (parent.height - height) / 2
|
|
||||||
y: (parent.width - width) / 2
|
|
||||||
sourceSize: Qt.size(width, height);
|
|
||||||
verticalAlignment: Image.AlignVCenter;
|
|
||||||
horizontalAlignment: Image.AlignHCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: addressBar
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: 8
|
|
||||||
anchors.left: barIcon.right
|
|
||||||
anchors.leftMargin: 0
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
focus: true
|
|
||||||
colorScheme: hifi.colorSchemes.dark
|
|
||||||
placeholderText: "Enter URL"
|
|
||||||
Component.onCompleted: ScriptDiscoveryService.scriptsModelFilter.filterRegExp = new RegExp("^.*$", "i")
|
|
||||||
Keys.onPressed: {
|
|
||||||
switch(event.key) {
|
|
||||||
case Qt.Key_Enter:
|
|
||||||
case Qt.Key_Return:
|
|
||||||
event.accepted = true
|
|
||||||
if (text.indexOf("http") != 0) {
|
|
||||||
text = "http://" + text;
|
|
||||||
}
|
|
||||||
root.hidePermissionsBar();
|
|
||||||
root.keyboardRaised = false;
|
|
||||||
webview.url = text;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id:permissionsContainer
|
|
||||||
visible:false
|
|
||||||
color: "#000000"
|
|
||||||
width: parent.width
|
|
||||||
anchors.top: buttons.bottom
|
|
||||||
height:40
|
|
||||||
z:100
|
|
||||||
gradient: Gradient {
|
|
||||||
GradientStop { position: 0.0; color: "black" }
|
|
||||||
GradientStop { position: 1.0; color: "grey" }
|
|
||||||
}
|
|
||||||
|
|
||||||
RalewayLight {
|
|
||||||
id: permissionsInfo
|
|
||||||
anchors.right:permissionsRow.left
|
|
||||||
anchors.rightMargin: 32
|
|
||||||
anchors.topMargin:8
|
|
||||||
anchors.top:parent.top
|
|
||||||
text: "This site wants to use your microphone/camera"
|
|
||||||
size: 18
|
|
||||||
color: hifi.colors.white
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: permissionsRow
|
|
||||||
spacing: 4
|
|
||||||
anchors.top:parent.top
|
|
||||||
anchors.topMargin: 8
|
|
||||||
anchors.right: parent.right
|
|
||||||
visible: true
|
|
||||||
z:101
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id:allow
|
|
||||||
text: "Allow"
|
|
||||||
color: hifi.buttons.blue
|
|
||||||
colorScheme: root.colorScheme
|
|
||||||
width: 120
|
|
||||||
enabled: true
|
|
||||||
onClicked: root.allowPermissions();
|
|
||||||
z:101
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id:block
|
|
||||||
text: "Block"
|
|
||||||
color: hifi.buttons.red
|
|
||||||
colorScheme: root.colorScheme
|
|
||||||
width: 120
|
|
||||||
enabled: true
|
|
||||||
onClicked: root.hidePermissionsBar();
|
|
||||||
z:101
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WebView {
|
|
||||||
id: webview
|
|
||||||
url: "https://highfidelity.com/"
|
|
||||||
profile: FileTypeProfile;
|
|
||||||
|
|
||||||
// Create a global EventBridge object for raiseAndLowerKeyboard.
|
|
||||||
WebEngineScript {
|
|
||||||
id: createGlobalEventBridge
|
|
||||||
sourceCode: eventBridgeJavaScriptToInject
|
|
||||||
injectionPoint: WebEngineScript.Deferred
|
|
||||||
worldId: WebEngineScript.MainWorld
|
|
||||||
}
|
|
||||||
|
|
||||||
// Detect when may want to raise and lower keyboard.
|
|
||||||
WebEngineScript {
|
|
||||||
id: raiseAndLowerKeyboard
|
|
||||||
injectionPoint: WebEngineScript.Deferred
|
|
||||||
sourceUrl: resourceDirectoryUrl + "/html/raiseAndLowerKeyboard.js"
|
|
||||||
worldId: WebEngineScript.MainWorld
|
|
||||||
}
|
|
||||||
|
|
||||||
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard ]
|
|
||||||
|
|
||||||
anchors.top: buttons.bottom
|
|
||||||
anchors.topMargin: 8
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
onFeaturePermissionRequested: {
|
|
||||||
if (feature == 2) { // QWebEnginePage::MediaAudioCapture
|
|
||||||
grantFeaturePermission(securityOrigin, feature, true);
|
|
||||||
} else {
|
|
||||||
permissionsBar.securityOrigin = securityOrigin;
|
|
||||||
permissionsBar.feature = feature;
|
|
||||||
root.showPermissionsBar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onLoadingChanged: {
|
|
||||||
if (loadRequest.status === WebEngineView.LoadSucceededStatus) {
|
|
||||||
addressBar.text = loadRequest.url
|
|
||||||
}
|
|
||||||
root.loadingChanged(loadRequest.status);
|
|
||||||
}
|
|
||||||
|
|
||||||
onWindowCloseRequested: {
|
|
||||||
root.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
webChannel.registerObject("eventBridge", eventBridge);
|
|
||||||
webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
|
|
||||||
desktop.initWebviewProfileHandlers(webview.profile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // item
|
|
||||||
|
|
||||||
|
|
||||||
Keys.onPressed: {
|
|
||||||
switch(event.key) {
|
|
||||||
case Qt.Key_L:
|
|
||||||
if (event.modifiers == Qt.ControlModifier) {
|
|
||||||
event.accepted = true
|
|
||||||
addressBar.selectAll()
|
|
||||||
addressBar.forceActiveFocus()
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // dialog
|
|
58
interface/resources/qml/+webengine/BrowserWebView.qml
Normal file
58
interface/resources/qml/+webengine/BrowserWebView.qml
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
import QtQuick 2.5
|
||||||
|
import QtWebChannel 1.0
|
||||||
|
import QtWebEngine 1.5
|
||||||
|
|
||||||
|
import controlsUit 1.0
|
||||||
|
|
||||||
|
WebView {
|
||||||
|
id: webview
|
||||||
|
url: "https://highfidelity.com/"
|
||||||
|
profile: FileTypeProfile;
|
||||||
|
|
||||||
|
property var parentRoot: null
|
||||||
|
|
||||||
|
// Create a global EventBridge object for raiseAndLowerKeyboard.
|
||||||
|
WebEngineScript {
|
||||||
|
id: createGlobalEventBridge
|
||||||
|
sourceCode: eventBridgeJavaScriptToInject
|
||||||
|
injectionPoint: WebEngineScript.Deferred
|
||||||
|
worldId: WebEngineScript.MainWorld
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detect when may want to raise and lower keyboard.
|
||||||
|
WebEngineScript {
|
||||||
|
id: raiseAndLowerKeyboard
|
||||||
|
injectionPoint: WebEngineScript.Deferred
|
||||||
|
sourceUrl: resourceDirectoryUrl + "/html/raiseAndLowerKeyboard.js"
|
||||||
|
worldId: WebEngineScript.MainWorld
|
||||||
|
}
|
||||||
|
|
||||||
|
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard ]
|
||||||
|
|
||||||
|
onFeaturePermissionRequested: {
|
||||||
|
if (feature == 2) { // QWebEnginePage::MediaAudioCapture
|
||||||
|
grantFeaturePermission(securityOrigin, feature, true);
|
||||||
|
} else {
|
||||||
|
permissionsBar.securityOrigin = securityOrigin;
|
||||||
|
permissionsBar.feature = feature;
|
||||||
|
parentRoot.showPermissionsBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoadingChanged: {
|
||||||
|
if (loadRequest.status === WebEngineView.LoadSucceededStatus) {
|
||||||
|
addressBar.text = loadRequest.url
|
||||||
|
}
|
||||||
|
parentRoot.loadingChanged(loadRequest.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
onWindowCloseRequested: {
|
||||||
|
parentRoot.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
webChannel.registerObject("eventBridge", eventBridge);
|
||||||
|
webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
|
||||||
|
desktop.initWebviewProfileHandlers(webview.profile);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,50 +0,0 @@
|
||||||
//
|
|
||||||
// InfoView.qml
|
|
||||||
//
|
|
||||||
// Created by Bradley Austin Davis on 27 Apr 2015
|
|
||||||
// Copyright 2015 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
|
|
||||||
//
|
|
||||||
|
|
||||||
import QtQuick 2.5
|
|
||||||
import Hifi 1.0 as Hifi
|
|
||||||
|
|
||||||
import controlsUit 1.0
|
|
||||||
import "windows" as Windows
|
|
||||||
|
|
||||||
Windows.ScrollingWindow {
|
|
||||||
id: root
|
|
||||||
width: 800
|
|
||||||
height: 800
|
|
||||||
resizable: true
|
|
||||||
|
|
||||||
Hifi.InfoView {
|
|
||||||
id: infoView
|
|
||||||
width: pane.contentWidth
|
|
||||||
implicitHeight: pane.scrollHeight
|
|
||||||
|
|
||||||
WebView {
|
|
||||||
id: webview
|
|
||||||
objectName: "WebView"
|
|
||||||
anchors.fill: parent
|
|
||||||
url: infoView.url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
centerWindow(root);
|
|
||||||
}
|
|
||||||
|
|
||||||
onVisibleChanged: {
|
|
||||||
if (visible) {
|
|
||||||
centerWindow(root);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function centerWindow() {
|
|
||||||
desktop.centerOnVisible(root);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,108 +0,0 @@
|
||||||
//
|
|
||||||
// QmlWebWindow.qml
|
|
||||||
//
|
|
||||||
// Created by Bradley Austin Davis on 17 Dec 2015
|
|
||||||
// Copyright 2015 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
|
|
||||||
//
|
|
||||||
|
|
||||||
import QtQuick 2.5
|
|
||||||
import QtWebEngine 1.1
|
|
||||||
import QtWebChannel 1.0
|
|
||||||
|
|
||||||
import "../windows" as Windows
|
|
||||||
import controlsUit 1.0 as Controls
|
|
||||||
import stylesUit 1.0
|
|
||||||
|
|
||||||
Windows.ScrollingWindow {
|
|
||||||
id: root
|
|
||||||
HifiConstants { id: hifi }
|
|
||||||
title: "WebWindow"
|
|
||||||
resizable: true
|
|
||||||
shown: false
|
|
||||||
// Don't destroy on close... otherwise the JS/C++ will have a dangling pointer
|
|
||||||
destroyOnCloseButton: false
|
|
||||||
property alias source: webview.url
|
|
||||||
property alias scriptUrl: webview.userScriptUrl
|
|
||||||
|
|
||||||
// This is for JS/QML communication, which is unused in a WebWindow,
|
|
||||||
// but not having this here results in spurious warnings about a
|
|
||||||
// missing signal
|
|
||||||
signal sendToScript(var message);
|
|
||||||
|
|
||||||
signal moved(vector2d position);
|
|
||||||
signal resized(size size);
|
|
||||||
|
|
||||||
function notifyMoved() {
|
|
||||||
moved(Qt.vector2d(x, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
function notifyResized() {
|
|
||||||
resized(Qt.size(width, height));
|
|
||||||
}
|
|
||||||
|
|
||||||
onXChanged: notifyMoved();
|
|
||||||
onYChanged: notifyMoved();
|
|
||||||
|
|
||||||
onWidthChanged: notifyResized();
|
|
||||||
onHeightChanged: notifyResized();
|
|
||||||
|
|
||||||
onShownChanged: {
|
|
||||||
keyboardEnabled = HMD.active;
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: pane.contentWidth
|
|
||||||
implicitHeight: pane.scrollHeight
|
|
||||||
|
|
||||||
Controls.WebView {
|
|
||||||
id: webview
|
|
||||||
url: "about:blank"
|
|
||||||
anchors.fill: parent
|
|
||||||
focus: true
|
|
||||||
profile: HFWebEngineProfile;
|
|
||||||
|
|
||||||
property string userScriptUrl: ""
|
|
||||||
|
|
||||||
// Create a global EventBridge object for raiseAndLowerKeyboard.
|
|
||||||
WebEngineScript {
|
|
||||||
id: createGlobalEventBridge
|
|
||||||
sourceCode: eventBridgeJavaScriptToInject
|
|
||||||
injectionPoint: WebEngineScript.DocumentCreation
|
|
||||||
worldId: WebEngineScript.MainWorld
|
|
||||||
}
|
|
||||||
|
|
||||||
// Detect when may want to raise and lower keyboard.
|
|
||||||
WebEngineScript {
|
|
||||||
id: raiseAndLowerKeyboard
|
|
||||||
injectionPoint: WebEngineScript.Deferred
|
|
||||||
sourceUrl: resourceDirectoryUrl + "/html/raiseAndLowerKeyboard.js"
|
|
||||||
worldId: WebEngineScript.MainWorld
|
|
||||||
}
|
|
||||||
|
|
||||||
// User script.
|
|
||||||
WebEngineScript {
|
|
||||||
id: userScript
|
|
||||||
sourceUrl: webview.userScriptUrl
|
|
||||||
injectionPoint: WebEngineScript.DocumentReady // DOM ready but page load may not be finished.
|
|
||||||
worldId: WebEngineScript.MainWorld
|
|
||||||
}
|
|
||||||
|
|
||||||
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
|
|
||||||
|
|
||||||
function onWebEventReceived(event) {
|
|
||||||
if (event.slice(0, 17) === "CLARA.IO DOWNLOAD") {
|
|
||||||
ApplicationInterface.addAssetToWorldFromURL(event.slice(18));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
webChannel.registerObject("eventBridge", eventBridge);
|
|
||||||
webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
|
|
||||||
eventBridge.webEventReceived.connect(onWebEventReceived);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
53
interface/resources/qml/+webengine/QmlWebWindowView.qml
Normal file
53
interface/resources/qml/+webengine/QmlWebWindowView.qml
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
import QtQuick 2.5
|
||||||
|
import QtWebEngine 1.1
|
||||||
|
import QtWebChannel 1.0
|
||||||
|
|
||||||
|
import controlsUit 1.0 as Controls
|
||||||
|
import stylesUit 1.0
|
||||||
|
Controls.WebView {
|
||||||
|
id: webview
|
||||||
|
url: "about:blank"
|
||||||
|
anchors.fill: parent
|
||||||
|
focus: true
|
||||||
|
profile: HFWebEngineProfile;
|
||||||
|
|
||||||
|
property string userScriptUrl: ""
|
||||||
|
|
||||||
|
// Create a global EventBridge object for raiseAndLowerKeyboard.
|
||||||
|
WebEngineScript {
|
||||||
|
id: createGlobalEventBridge
|
||||||
|
sourceCode: eventBridgeJavaScriptToInject
|
||||||
|
injectionPoint: WebEngineScript.DocumentCreation
|
||||||
|
worldId: WebEngineScript.MainWorld
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detect when may want to raise and lower keyboard.
|
||||||
|
WebEngineScript {
|
||||||
|
id: raiseAndLowerKeyboard
|
||||||
|
injectionPoint: WebEngineScript.Deferred
|
||||||
|
sourceUrl: resourceDirectoryUrl + "/html/raiseAndLowerKeyboard.js"
|
||||||
|
worldId: WebEngineScript.MainWorld
|
||||||
|
}
|
||||||
|
|
||||||
|
// User script.
|
||||||
|
WebEngineScript {
|
||||||
|
id: userScript
|
||||||
|
sourceUrl: webview.userScriptUrl
|
||||||
|
injectionPoint: WebEngineScript.DocumentReady // DOM ready but page load may not be finished.
|
||||||
|
worldId: WebEngineScript.MainWorld
|
||||||
|
}
|
||||||
|
|
||||||
|
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
|
||||||
|
|
||||||
|
function onWebEventReceived(event) {
|
||||||
|
if (event.slice(0, 17) === "CLARA.IO DOWNLOAD") {
|
||||||
|
ApplicationInterface.addAssetToWorldFromURL(event.slice(18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
webChannel.registerObject("eventBridge", eventBridge);
|
||||||
|
webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
|
||||||
|
eventBridge.webEventReceived.connect(onWebEventReceived);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,13 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
|
|
||||||
import controlsUit 1.0
|
import controlsUit 1.0
|
||||||
import stylesUit 1.0
|
import stylesUit 1.0
|
||||||
|
|
||||||
import "windows"
|
import "windows"
|
||||||
|
import "."
|
||||||
|
|
||||||
ScrollingWindow {
|
ScrollingWindow {
|
||||||
id: root
|
id: root
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
//HifiStyles.HifiConstants { id: hifistyles }
|
|
||||||
title: "Browser"
|
title: "Browser"
|
||||||
resizable: true
|
resizable: true
|
||||||
destroyOnHidden: true
|
destroyOnHidden: true
|
||||||
|
@ -30,6 +29,7 @@ ScrollingWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setProfile(profile) {
|
function setProfile(profile) {
|
||||||
|
webview.profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showPermissionsBar(){
|
function showPermissionsBar(){
|
||||||
|
@ -41,6 +41,7 @@ ScrollingWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowPermissions(){
|
function allowPermissions(){
|
||||||
|
webview.grantFeaturePermission(permissionsBar.securityOrigin, permissionsBar.feature, true);
|
||||||
hidePermissionsBar();
|
hidePermissionsBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,10 +199,15 @@ ScrollingWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProxyWebView {
|
BrowserWebView {
|
||||||
id: webview
|
id: webview
|
||||||
anchors.centerIn: parent
|
parentRoot: root
|
||||||
url: "https://highfidelity.com/"
|
|
||||||
|
anchors.top: buttons.bottom
|
||||||
|
anchors.topMargin: 8
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
}
|
}
|
||||||
|
|
||||||
} // item
|
} // item
|
||||||
|
|
8
interface/resources/qml/BrowserWebView.qml
Normal file
8
interface/resources/qml/BrowserWebView.qml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import QtQuick 2.5
|
||||||
|
import controlsUit 1.0
|
||||||
|
|
||||||
|
ProxyWebView {
|
||||||
|
property var parentRoot: null
|
||||||
|
|
||||||
|
function grantFeaturePermission(origin, feature) {}
|
||||||
|
}
|
|
@ -24,7 +24,7 @@ Windows.ScrollingWindow {
|
||||||
width: pane.contentWidth
|
width: pane.contentWidth
|
||||||
implicitHeight: pane.scrollHeight
|
implicitHeight: pane.scrollHeight
|
||||||
|
|
||||||
ProxyWebView {
|
BaseWebView {
|
||||||
id: webview
|
id: webview
|
||||||
objectName: "WebView"
|
objectName: "WebView"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
|
|
||||||
import "windows" as Windows
|
import "windows" as Windows
|
||||||
|
import "."
|
||||||
import controlsUit 1.0 as Controls
|
import controlsUit 1.0 as Controls
|
||||||
import stylesUit 1.0
|
import stylesUit 1.0
|
||||||
|
|
||||||
|
@ -55,12 +56,8 @@ Windows.ScrollingWindow {
|
||||||
width: pane.contentWidth
|
width: pane.contentWidth
|
||||||
implicitHeight: pane.scrollHeight
|
implicitHeight: pane.scrollHeight
|
||||||
|
|
||||||
Controls.WebView {
|
QmlWebWindowView {
|
||||||
id: webview
|
id: webview
|
||||||
url: "about:blank"
|
|
||||||
property string userScriptUrl: ""
|
|
||||||
anchors.fill: parent
|
|
||||||
focus: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
interface/resources/qml/QmlWebWindowView.qml
Normal file
5
interface/resources/qml/QmlWebWindowView.qml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import QtQuick 2.5
|
||||||
|
import controlsUit 1.0
|
||||||
|
|
||||||
|
BaseWebView {
|
||||||
|
}
|
|
@ -18,6 +18,7 @@ Rectangle {
|
||||||
|
|
||||||
property bool safeLoading: false
|
property bool safeLoading: false
|
||||||
property bool loadingLatched: false
|
property bool loadingLatched: false
|
||||||
|
property bool loading: false
|
||||||
property var loadingRequest: null
|
property var loadingRequest: null
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue