Merge pull request #10104 from druiz17/tablet-webView3.0

Remove unnecessary prints and code for tabletWebView.qml
This commit is contained in:
Seth Alves 2017-04-03 16:10:54 -07:00 committed by GitHub
commit cb787c2862
2 changed files with 26 additions and 48 deletions

View file

@ -110,7 +110,6 @@ Item {
Component.onCompleted: { Component.onCompleted: {
// Ensure the JS from the web-engine makes it to our logging // Ensure the JS from the web-engine makes it to our logging
webview.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) { webview.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
console.log("TabletBrowser");
console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message); console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message);
}); });
@ -138,33 +137,22 @@ Item {
} }
} }
onActiveFocusOnPressChanged: { onNewViewRequested: {
console.log("on active focus changed"); var component = Qt.createComponent("./TabletBrowser.qml");
setActiveFocusOnPress(true);
} if (component.status != Component.Ready) {
if (component.status == Component.Error) {
onNewViewRequested:{ console.log("Error: " + component.errorString());
// desktop is not defined for web-entities
if (stackRoot.isDesktop) {
var component = Qt.createComponent("./Browser.qml");
var newWindow = component.createObject(desktop);
request.openIn(newWindow.webView);
} else {
var component = Qt.createComponent("./TabletBrowser.qml");
if (component.status != Component.Ready) {
if (component.status == Component.Error) {
console.log("Error: " + component.errorString());
}
return;
} }
var newWindow = component.createObject(); return;
newWindow.setProfile(webview.profile);
request.openIn(newWindow.webView);
newWindow.eventBridge = web.eventBridge;
stackRoot.push(newWindow);
newWindow.webView.forceActiveFocus();
} }
var newWindow = component.createObject();
newWindow.setProfile(webview.profile);
request.openIn(newWindow.webView);
newWindow.eventBridge = web.eventBridge;
stackRoot.push(newWindow);
newWindow.webView.forceActiveFocus();
} }
} }

View file

@ -112,6 +112,7 @@ Item {
currentItem.goBack(); currentItem.goBack();
} else { } else {
stackRoot.pop(); stackRoot.pop();
currentItem.webView.focus = true;
currentItem.webView.forceActiveFocus(); currentItem.webView.forceActiveFocus();
web.address = currentItem.webView.url; web.address = currentItem.webView.url;
} }
@ -186,7 +187,6 @@ Item {
Component.onCompleted: { Component.onCompleted: {
// Ensure the JS from the web-engine makes it to our logging // Ensure the JS from the web-engine makes it to our logging
root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) { root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
console.log("WebView.qml");
console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message); console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message);
}); });
@ -202,7 +202,6 @@ Item {
keyboardRaised = false; keyboardRaised = false;
punctuationMode = false; punctuationMode = false;
keyboard.resetShiftMode(false); keyboard.resetShiftMode(false);
console.log("[DR] -> printing user string " + root.profile.httpUserAgent);
// Required to support clicking on "hifi://" links // Required to support clicking on "hifi://" links
if (WebEngineView.LoadStartedStatus == loadRequest.status) { if (WebEngineView.LoadStartedStatus == loadRequest.status) {
var url = loadRequest.url.toString(); var url = loadRequest.url.toString();
@ -215,30 +214,21 @@ Item {
} }
onNewViewRequested:{ onNewViewRequested:{
// desktop is not defined for web-entities var component = Qt.createComponent("../TabletBrowser.qml");
if (web.isDesktop) { if (component.status != Component.Ready) {
var component = Qt.createComponent("../Browser.qml"); if (component.status == Component.Error) {
var newWindow = component.createObject(desktop); console.log("Error: " + component.errorString());
newWindow.setProfile(root.profile);
request.openIn(newWindow.webView);
} else {
var component = Qt.createComponent("../TabletBrowser.qml");
if (component.status != Component.Ready) {
if (component.status == Component.Error) {
console.log("Error: " + component.errorString());
}
return;
} }
var newWindow = component.createObject(); return;
newWindow.setProfile(root.profile);
request.openIn(newWindow.webView);
newWindow.eventBridge = web.eventBridge;
stackRoot.push(newWindow);
} }
var newWindow = component.createObject();
newWindow.setProfile(root.profile);
request.openIn(newWindow.webView);
newWindow.eventBridge = web.eventBridge;
stackRoot.push(newWindow);
} }
} }
HiFiControls.Keyboard { HiFiControls.Keyboard {
id: keyboard id: keyboard
raised: web.keyboardEnabled && web.keyboardRaised raised: web.keyboardEnabled && web.keyboardRaised