Move common webview flickable code to separate core file

This commit is contained in:
vladest 2017-08-24 21:35:47 +02:00
parent 34c091114d
commit c7fe845403
6 changed files with 409 additions and 340 deletions

View file

@ -1,7 +1,7 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtWebChannel 1.0
import QtWebEngine 1.2
import QtWebEngine 1.5
import "controls"
import "controls-uit" as HifiControls
@ -17,7 +17,7 @@ Item {
height: 600
property variant permissionsBar: {'securityOrigin':'none','feature':'none'}
property alias url: webview.url
property WebEngineView webView: webview
//property WebEngineView webView: webview
property bool canGoBack: webview.canGoBack
property bool canGoForward: webview.canGoForward

View file

@ -9,7 +9,7 @@
//
import QtQuick 2.5
import QtWebEngine 1.2
import QtWebEngine 1.5
WebEngineView {
id: root

View file

@ -9,11 +9,13 @@
//
import QtQuick 2.5
import QtWebEngine 1.5
AnimatedImage {
property Item webroot: parent
property WebEngineView webview: parent
source: "../../icons/loader-snake-64-w.gif"
visible: webroot.loading && /^(http.*|)$/i.test(webroot.url.toString())
visible: webview.loading && /^(http.*|)$/i.test(webview.url.toString())
playing: visible
z: 10000
anchors {
horizontalCenter: parent.horizontalCenter

View file

@ -1,6 +1,4 @@
import QtQuick 2.7
import QtWebEngine 1.5
import QtWebChannel 1.0
import "../controls-uit" as HiFiControls
Item {
@ -8,7 +6,7 @@ Item {
property alias url: webroot.url
property alias scriptURL: webroot.userScriptUrl
property alias canGoBack: webroot.canGoBack;
property var goBack: webroot.goBack;
property var goBack: webroot.webViewCore.goBack;
property alias urlTag: webroot.urlTag
property bool keyboardEnabled: true // FIXME - Keyboard HMD only: Default to false
property bool keyboardRaised: false
@ -22,117 +20,139 @@ Item {
}
*/
property alias viewProfile: webroot.profile
property alias viewProfile: webroot.webViewCoreProfile
Flickable {
id: flick
FlickableWebViewCore {
id: webroot
width: parent.width
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
WebEngineView {
id: webroot
objectName: "webEngineView"
anchors.fill: parent
onLoadingChangedCallback: {
keyboardRaised = false;
punctuationMode = false;
keyboard.resetShiftMode(false);
}
profile: HFWebEngineProfile;
property string userScriptUrl: ""
// creates a global EventBridge object.
WebEngineScript {
id: createGlobalEventBridge
sourceCode: eventBridgeJavaScriptToInject
injectionPoint: WebEngineScript.DocumentCreation
worldId: WebEngineScript.MainWorld
}
// detects when to raise and lower virtual keyboard
WebEngineScript {
id: raiseAndLowerKeyboard
injectionPoint: WebEngineScript.Deferred
sourceUrl: resourceDirectoryUrl + "/html/raiseAndLowerKeyboard.js"
worldId: WebEngineScript.MainWorld
}
// User script.
WebEngineScript {
id: userScript
sourceUrl: webroot.userScriptUrl
injectionPoint: WebEngineScript.DocumentReady // DOM ready but page load may not be finished.
worldId: WebEngineScript.MainWorld
}
property string urlTag: "noDownload=false";
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
property string newUrl: ""
//disable popup
onContextMenuRequested: {
request.accepted = true;
}
onContentsSizeChanged: {
flick.contentHeight = Math.max(contentsSize.height, flick.height);
flick.contentWidth = flick.width
}
Component.onCompleted: {
webChannel.registerObject("eventBridge", eventBridge);
webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
// Ensure the JS from the web-engine makes it to our logging
webroot.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message);
});
webroot.profile.httpUserAgent = "Mozilla/5.0 Chrome (HighFidelityInterface)";
}
onFeaturePermissionRequested: {
grantFeaturePermission(securityOrigin, feature, true);
}
onLoadingChanged: {
keyboardRaised = false;
punctuationMode = false;
keyboard.resetShiftMode(false);
// Required to support clicking on "hifi://" links
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
flick.contentWidth = 0
flick.contentHeight = 0
var url = loadRequest.url.toString();
url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag;
if (urlHandler.canHandleUrl(url)) {
if (urlHandler.handleUrl(url)) {
webroot.stop();
}
}
}
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
webroot.runJavaScript("document.body.scrollHeight;", function (i_actualPageHeight) {
flick.contentHeight = Math.max(i_actualPageHeight, flick.height);
})
flick.contentWidth = flick.width
}
}
onNewViewRequested:{
// desktop is not defined for web-entities or tablet
if (typeof desktop !== "undefined") {
desktop.openBrowserWindow(request, profile);
} else {
tabletRoot.openBrowserWindow(request, profile);
}
onNewViewRequestedCallback: {
// desktop is not defined for web-entities or tablet
if (typeof desktop !== "undefined") {
desktop.openBrowserWindow(request, profile);
} else {
tabletRoot.openBrowserWindow(request, profile);
}
}
}
HiFiControls.WebSpinner {
anchors.centerIn: parent
webroot: webroot
}
// Flickable {
// id: flick
// width: parent.width
// height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
// WebEngineView {
// id: webroot
// objectName: "webEngineView"
// anchors.fill: parent
// profile: HFWebEngineProfile;
// property string userScriptUrl: ""
// // creates a global EventBridge object.
// WebEngineScript {
// id: createGlobalEventBridge
// sourceCode: eventBridgeJavaScriptToInject
// injectionPoint: WebEngineScript.DocumentCreation
// worldId: WebEngineScript.MainWorld
// }
// // detects when to raise and lower virtual keyboard
// WebEngineScript {
// id: raiseAndLowerKeyboard
// injectionPoint: WebEngineScript.Deferred
// sourceUrl: resourceDirectoryUrl + "/html/raiseAndLowerKeyboard.js"
// worldId: WebEngineScript.MainWorld
// }
// // User script.
// WebEngineScript {
// id: userScript
// sourceUrl: webroot.userScriptUrl
// injectionPoint: WebEngineScript.DocumentReady // DOM ready but page load may not be finished.
// worldId: WebEngineScript.MainWorld
// }
// property string urlTag: "noDownload=false";
// userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
// property string newUrl: ""
// //disable popup
// onContextMenuRequested: {
// request.accepted = true;
// }
// onContentsSizeChanged: {
// flick.contentHeight = Math.max(contentsSize.height, flick.height);
// flick.contentWidth = flick.width
// }
// Component.onCompleted: {
// webChannel.registerObject("eventBridge", eventBridge);
// webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
// // Ensure the JS from the web-engine makes it to our logging
// webroot.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
// console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message);
// });
// webroot.profile.httpUserAgent = "Mozilla/5.0 Chrome (HighFidelityInterface)";
// }
// onFeaturePermissionRequested: {
// grantFeaturePermission(securityOrigin, feature, true);
// }
// onLoadingChanged: {
// keyboardRaised = false;
// punctuationMode = false;
// keyboard.resetShiftMode(false);
// // Required to support clicking on "hifi://" links
// if (WebEngineView.LoadStartedStatus == loadRequest.status) {
// flick.contentWidth = 0
// flick.contentHeight = 0
// var url = loadRequest.url.toString();
// url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag;
// if (urlHandler.canHandleUrl(url)) {
// if (urlHandler.handleUrl(url)) {
// webroot.stop();
// }
// }
// }
// if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
// webroot.runJavaScript("document.body.scrollHeight;", function (i_actualPageHeight) {
// flick.contentHeight = Math.max(i_actualPageHeight, flick.height);
// })
// flick.contentWidth = flick.width
// }
// }
// onNewViewRequested:{
// // desktop is not defined for web-entities or tablet
// if (typeof desktop !== "undefined") {
// desktop.openBrowserWindow(request, profile);
// } else {
// tabletRoot.openBrowserWindow(request, profile);
// }
// }
// }
// }
// HiFiControls.WebSpinner {
// anchors.centerIn: parent
// webroot: webroot
// }
HiFiControls.Keyboard {
id: keyboard

View file

@ -1,15 +1,15 @@
import QtQuick 2.7
import QtQuick.Controls 1.4
//import QtQuick.Controls 1.4
import QtWebEngine 1.5
import QtWebChannel 1.0
//import QtWebChannel 1.0
import "../controls-uit" as HiFiControls
import "../styles" as HifiStyles
import "../styles-uit"
import "../"
import "."
//import "../"
//import "."
Item {
id: web
id: root
HifiConstants { id: hifi }
width: parent !== null ? parent.width : undefined
height: parent !== null ? parent.height : undefined
@ -21,8 +21,8 @@ Item {
property bool keyboardRaised: false
property bool punctuationMode: false
property bool isDesktop: false
property alias webView: webview
property alias profile: webview.profile
property alias webView: web.webViewCore
property alias profile: web.webViewCoreProfile
property bool remove: false
property bool closeButtonVisible: true
@ -79,7 +79,7 @@ Item {
color: hifi.colors.baseGray
font.pixelSize: 12
verticalAlignment: Text.AlignLeft
text: webview.url
text: root.url
anchors {
top: nav.bottom
horizontalCenter: parent.horizontalCenter;
@ -104,13 +104,13 @@ Item {
function closeWebEngine() {
if (remove) {
web.destroy();
root.destroy();
return;
}
if (parentStackItem) {
parentStackItem.pop();
} else {
web.visible = false;
root.visible = false;
}
}
@ -128,131 +128,160 @@ Item {
}
function loadUrl(url) {
webview.url = url
web.url = webview.url;
web.webViewCore.url = url
root.url = web.webViewCore.url;
}
onUrlChanged: {
loadUrl(url);
}
Flickable {
id: flick
FlickableWebViewCore {
id: web
width: parent.width
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height - web.headerHeight : parent.height - web.headerHeight
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height - root.headerHeight : parent.height - root.headerHeight
anchors.top: buttons.bottom
WebEngineView {
id: webview
objectName: "webEngineView"
anchors.fill: parent
profile: HFWebEngineProfile;
property string userScriptUrl: ""
// creates a global EventBridge object.
WebEngineScript {
id: createGlobalEventBridge
sourceCode: eventBridgeJavaScriptToInject
injectionPoint: WebEngineScript.DocumentCreation
worldId: WebEngineScript.MainWorld
onUrlChanged: {
// Record history, skipping null and duplicate items.
var urlString = url + "";
urlString = urlString.replace(/\//g, "%2F"); // Consistent representation of "/"s to avoid false differences.
if (urlString.length > 0 && (historyIndex === -1 || urlString !== history[historyIndex])) {
historyIndex++;
history = history.slice(0, historyIndex);
history.push(urlString);
}
}
// detects when to raise and lower virtual keyboard
WebEngineScript {
id: raiseAndLowerKeyboard
injectionPoint: WebEngineScript.Deferred
sourceUrl: resourceDirectoryUrl + "/html/raiseAndLowerKeyboard.js"
worldId: WebEngineScript.MainWorld
}
onLoadingChangedCallback: {
keyboardRaised = false;
punctuationMode = false;
keyboard.resetShiftMode(false);
webViewCore.forceActiveFocus();
}
// User script.
WebEngineScript {
id: userScript
sourceUrl: webview.userScriptUrl
injectionPoint: WebEngineScript.DocumentReady // DOM ready but page load may not be finished.
worldId: WebEngineScript.MainWorld
}
property string urlTag: "noDownload=false";
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
property string newUrl: ""
Component.onCompleted: {
webChannel.registerObject("eventBridge", eventBridge);
webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
// Ensure the JS from the web-engine makes it to our logging
webview.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message);
});
}
onFeaturePermissionRequested: {
grantFeaturePermission(securityOrigin, feature, true);
}
onUrlChanged: {
// Record history, skipping null and duplicate items.
var urlString = url + "";
urlString = urlString.replace(/\//g, "%2F"); // Consistent representation of "/"s to avoid false differences.
if (urlString.length > 0 && (historyIndex === -1 || urlString !== history[historyIndex])) {
historyIndex++;
history = history.slice(0, historyIndex);
history.push(urlString);
}
}
onContentsSizeChanged: {
flick.contentHeight = Math.max(contentsSize.height, flick.height);
flick.contentWidth = flick.width
}
//disable popup
onContextMenuRequested: {
request.accepted = true;
}
onLoadingChanged: {
keyboardRaised = false;
punctuationMode = false;
keyboard.resetShiftMode(false);
// Required to support clicking on "hifi://" links
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
flick.contentWidth = 0
flick.contentHeight = 0
var url = loadRequest.url.toString();
if (urlHandler.canHandleUrl(url)) {
if (urlHandler.handleUrl(url)) {
root.stop();
}
}
}
if (WebEngineView.LoadFailedStatus == loadRequest.status) {
console.log(" Tablet WebEngineView failed to load url: " + loadRequest.url.toString());
}
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
webview.runJavaScript("document.body.scrollHeight;", function (i_actualPageHeight) {
flick.contentHeight = Math.max(i_actualPageHeight, flick.height);
})
flick.contentWidth = flick.width
webview.forceActiveFocus();
}
}
onNewViewRequested: {
request.openIn(webview);
}
onNewViewRequestedCallback: {
request.openIn(webViewCore);
}
}
HiFiControls.WebSpinner {
webroot: webview
anchors.centerIn: parent
}
// Flickable {
// id: flick
// width: parent.width
// height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height - web.headerHeight : parent.height - web.headerHeight
// anchors.top: buttons.bottom
// WebEngineView {
// id: webview
// objectName: "webEngineView"
// anchors.fill: parent
// profile: HFWebEngineProfile;
// property string userScriptUrl: ""
// // creates a global EventBridge object.
// WebEngineScript {
// id: createGlobalEventBridge
// sourceCode: eventBridgeJavaScriptToInject
// injectionPoint: WebEngineScript.DocumentCreation
// worldId: WebEngineScript.MainWorld
// }
// // detects when to raise and lower virtual 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
// }
// property string urlTag: "noDownload=false";
// userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
// property string newUrl: ""
// Component.onCompleted: {
// webChannel.registerObject("eventBridge", eventBridge);
// webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
// // Ensure the JS from the web-engine makes it to our logging
// webview.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
// console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message);
// });
// }
// onFeaturePermissionRequested: {
// grantFeaturePermission(securityOrigin, feature, true);
// }
// onUrlChanged: {
// // Record history, skipping null and duplicate items.
// var urlString = url + "";
// urlString = urlString.replace(/\//g, "%2F"); // Consistent representation of "/"s to avoid false differences.
// if (urlString.length > 0 && (historyIndex === -1 || urlString !== history[historyIndex])) {
// historyIndex++;
// history = history.slice(0, historyIndex);
// history.push(urlString);
// }
// }
// onContentsSizeChanged: {
// flick.contentHeight = Math.max(contentsSize.height, flick.height);
// flick.contentWidth = flick.width
// }
// //disable popup
// onContextMenuRequested: {
// request.accepted = true;
// }
// onLoadingChanged: {
// keyboardRaised = false;
// punctuationMode = false;
// keyboard.resetShiftMode(false);
// // Required to support clicking on "hifi://" links
// if (WebEngineView.LoadStartedStatus == loadRequest.status) {
// flick.contentWidth = 0
// flick.contentHeight = 0
// var url = loadRequest.url.toString();
// if (urlHandler.canHandleUrl(url)) {
// if (urlHandler.handleUrl(url)) {
// root.stop();
// }
// }
// }
// if (WebEngineView.LoadFailedStatus == loadRequest.status) {
// console.log(" Tablet WebEngineView failed to load url: " + loadRequest.url.toString());
// }
// if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
// webview.runJavaScript("document.body.scrollHeight;", function (i_actualPageHeight) {
// flick.contentHeight = Math.max(i_actualPageHeight, flick.height);
// })
// flick.contentWidth = flick.width
// webview.forceActiveFocus();
// }
// }
// onNewViewRequested: {
// request.openIn(webview);
// }
// }
// }
// HiFiControls.WebSpinner {
// webview: webview
// anchors.centerIn: parent
// }
HiFiControls.Keyboard {
id: keyboard
@ -267,7 +296,7 @@ Item {
}
Component.onCompleted: {
web.isDesktop = (typeof desktop !== "undefined");
root.isDesktop = (typeof desktop !== "undefined");
keyboardEnabled = HMD.active;
}

View file

@ -1,17 +1,15 @@
import QtQuick 2.7
import QtWebEngine 1.5
import QtWebChannel 1.0
import "../controls-uit" as HiFiControls
Item {
width: parent !== null ? parent.width : undefined
height: parent !== null ? parent.height : undefined
property alias url: root.url
property alias scriptURL: root.userScriptUrl
property alias canGoBack: root.canGoBack;
property var goBack: root.goBack;
property alias urlTag: root.urlTag
property alias url: webroot.url
property alias scriptURL: webroot.userScriptUrl
property alias canGoBack: webroot.canGoBack;
property var goBack: webroot.webViewCore.goBack;
property alias urlTag: webroot.urlTag
property bool keyboardEnabled: true // FIXME - Keyboard HMD only: Default to false
property bool keyboardRaised: false
property bool punctuationMode: false
@ -24,116 +22,137 @@ Item {
}
*/
property alias viewProfile: root.profile
property alias viewProfile: webroot.webViewCoreProfile
Flickable {
id: flick
FlickableWebViewCore {
id: webroot
width: parent.width
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
WebEngineView {
id: root
objectName: "webEngineView"
anchors.fill: parent
onLoadingChangedCallback: {
keyboardRaised = false;
punctuationMode = false;
keyboard.resetShiftMode(false);
}
profile: HFWebEngineProfile;
property string userScriptUrl: ""
// creates a global EventBridge object.
WebEngineScript {
id: createGlobalEventBridge
sourceCode: eventBridgeJavaScriptToInject
injectionPoint: WebEngineScript.DocumentCreation
worldId: WebEngineScript.MainWorld
}
// detects when to raise and lower virtual keyboard
WebEngineScript {
id: raiseAndLowerKeyboard
injectionPoint: WebEngineScript.Deferred
sourceUrl: resourceDirectoryUrl + "/html/raiseAndLowerKeyboard.js"
worldId: WebEngineScript.MainWorld
}
// User script.
WebEngineScript {
id: userScript
sourceUrl: root.userScriptUrl
injectionPoint: WebEngineScript.DocumentReady // DOM ready but page load may not be finished.
worldId: WebEngineScript.MainWorld
}
property string urlTag: "noDownload=false";
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
property string newUrl: ""
Component.onCompleted: {
webChannel.registerObject("eventBridge", eventBridge);
webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
// Ensure the JS from the web-engine makes it to our logging
root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message);
});
}
onFeaturePermissionRequested: {
grantFeaturePermission(securityOrigin, feature, true);
}
onContentsSizeChanged: {
console.log("WebView contentsSize", contentsSize)
flick.contentWidth = flick.width
flick.contentHeight = Math.max(contentsSize.height, flick.height)
}
//disable popup
onContextMenuRequested: {
request.accepted = true;
}
onLoadingChanged: {
keyboardRaised = false;
punctuationMode = false;
keyboard.resetShiftMode(false);
// Required to support clicking on "hifi://" links
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
flick.contentWidth = 0
flick.contentHeight = 0
var url = loadRequest.url.toString();
url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag;
if (urlHandler.canHandleUrl(url)) {
if (urlHandler.handleUrl(url)) {
root.stop();
}
}
}
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
root.runJavaScript("document.body.scrollHeight;", function (i_actualPageHeight) {
flick.contentHeight = Math.max(i_actualPageHeight, flick.height);
})
flick.contentWidth = flick.width
}
}
onNewViewRequested:{
// desktop is not defined for web-entities or tablet
if (typeof desktop !== "undefined") {
desktop.openBrowserWindow(request, profile);
} else {
tabletRoot.openBrowserWindow(request, profile);
}
onNewViewRequestedCallback: {
// desktop is not defined for web-entities or tablet
if (typeof desktop !== "undefined") {
desktop.openBrowserWindow(request, profile);
} else {
tabletRoot.openBrowserWindow(request, profile);
}
}
}
HiFiControls.WebSpinner {
anchors.centerIn: parent
webroot: root
}
// Flickable {
// id: flick
// width: parent.width
// height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
// WebEngineView {
// id: root
// objectName: "webEngineView"
// anchors.fill: parent
// profile: HFWebEngineProfile;
// property string userScriptUrl: ""
// // creates a global EventBridge object.
// WebEngineScript {
// id: createGlobalEventBridge
// sourceCode: eventBridgeJavaScriptToInject
// injectionPoint: WebEngineScript.DocumentCreation
// worldId: WebEngineScript.MainWorld
// }
// // detects when to raise and lower virtual keyboard
// WebEngineScript {
// id: raiseAndLowerKeyboard
// injectionPoint: WebEngineScript.Deferred
// sourceUrl: resourceDirectoryUrl + "/html/raiseAndLowerKeyboard.js"
// worldId: WebEngineScript.MainWorld
// }
// // User script.
// WebEngineScript {
// id: userScript
// sourceUrl: root.userScriptUrl
// injectionPoint: WebEngineScript.DocumentReady // DOM ready but page load may not be finished.
// worldId: WebEngineScript.MainWorld
// }
// property string urlTag: "noDownload=false";
// userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
// property string newUrl: ""
// Component.onCompleted: {
// webChannel.registerObject("eventBridge", eventBridge);
// webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
// // Ensure the JS from the web-engine makes it to our logging
// root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
// console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message);
// });
// }
// onFeaturePermissionRequested: {
// grantFeaturePermission(securityOrigin, feature, true);
// }
// onContentsSizeChanged: {
// console.log("WebView contentsSize", contentsSize)
// flick.contentWidth = flick.width
// flick.contentHeight = Math.max(contentsSize.height, flick.height)
// }
// //disable popup
// onContextMenuRequested: {
// request.accepted = true;
// }
// onLoadingChanged: {
// keyboardRaised = false;
// punctuationMode = false;
// keyboard.resetShiftMode(false);
// // Required to support clicking on "hifi://" links
// if (WebEngineView.LoadStartedStatus == loadRequest.status) {
// flick.contentWidth = 0
// flick.contentHeight = 0
// var url = loadRequest.url.toString();
// url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag;
// if (urlHandler.canHandleUrl(url)) {
// if (urlHandler.handleUrl(url)) {
// root.stop();
// }
// }
// }
// if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
// root.runJavaScript("document.body.scrollHeight;", function (i_actualPageHeight) {
// flick.contentHeight = Math.max(i_actualPageHeight, flick.height);
// })
// flick.contentWidth = flick.width
// }
// }
// onNewViewRequested:{
// // desktop is not defined for web-entities or tablet
// if (typeof desktop !== "undefined") {
// desktop.openBrowserWindow(request, profile);
// } else {
// tabletRoot.openBrowserWindow(request, profile);
// }
// }
// }
// }
// HiFiControls.WebSpinner {
// anchors.centerIn: parent
// webroot: root
// }
HiFiControls.Keyboard {
id: keyboard
@ -145,5 +164,4 @@ Item {
bottom: parent.bottom
}
}
}