From 9658e1b8ac9af06a6447dd15089bec80035a46df Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 31 Mar 2017 19:25:03 +0100 Subject: [PATCH] better web view handling --- interface/resources/qml/TabletBrowser.qml | 5 +- .../resources/qml/controls/TabletWebView.qml | 3 +- .../qml/hifi/tablet/TabletAddressDialog.qml | 3 +- .../qml/hifi/tablet/TabletStoryCard.qml | 94 +------------------ 4 files changed, 10 insertions(+), 95 deletions(-) diff --git a/interface/resources/qml/TabletBrowser.qml b/interface/resources/qml/TabletBrowser.qml index ffedb35cf3..1d49d46c43 100644 --- a/interface/resources/qml/TabletBrowser.qml +++ b/interface/resources/qml/TabletBrowser.qml @@ -147,7 +147,7 @@ Item { // desktop is not defined for web-entities if (stackRoot.isDesktop) { var component = Qt.createComponent("./Browser.qml"); - var newWindow = component.createObject(desktop); + var newWindow = component.createObject(desktop); request.openIn(newWindow.webView); } else { var component = Qt.createComponent("./TabletBrowser.qml"); @@ -161,8 +161,9 @@ Item { var newWindow = component.createObject(); //newWindow.setProfile(webview.profile); request.openIn(newWindow.webView); + newWindow.eventBridge = web.eventBridge; stackRoot.push(newWindow); - newWindow.forceActiveFocus(); + newWindow.webView.forceActiveFocus(); } } } diff --git a/interface/resources/qml/controls/TabletWebView.qml b/interface/resources/qml/controls/TabletWebView.qml index 1a4df2c2d9..70d2539744 100644 --- a/interface/resources/qml/controls/TabletWebView.qml +++ b/interface/resources/qml/controls/TabletWebView.qml @@ -17,7 +17,7 @@ Item { property string address: url property alias scriptURL: root.userScriptUrl property alias eventBridge: eventBridgeWrapper.eventBridge - property bool keyboardEnabled: HMD.active // FIXME - Keyboard HMD only: Default to false + property bool keyboardEnabled: HMD.active property bool keyboardRaised: false property bool punctuationMode: false property bool isDesktop: false @@ -230,6 +230,7 @@ Item { var newWindow = component.createObject(); //newWindow.setProfile(root.profile); request.openIn(newWindow.webView); + newWindow.eventBridge = web.eventBridge; stackRoot.push(newWindow); } } diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index a5059b4b88..a58177640d 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -27,7 +27,7 @@ StackView { initialItem: addressBarDialog width: parent.width height: parent.height - + property var eventBridge; property var allStories: []; property int cardWidth: 460; property int cardHeight: 320; @@ -59,6 +59,7 @@ StackView { if (0 !== targetString.indexOf('hifi://')) { var card = tabletStoryCard.createObject(); card.setUrl(addressBarDialog.metaverseServerUrl + targetString); + card.eventBridge = root.eventBridge; root.push(card); return; } diff --git a/interface/resources/qml/hifi/tablet/TabletStoryCard.qml b/interface/resources/qml/hifi/tablet/TabletStoryCard.qml index 2edd51e933..1d57c8a083 100644 --- a/interface/resources/qml/hifi/tablet/TabletStoryCard.qml +++ b/interface/resources/qml/hifi/tablet/TabletStoryCard.qml @@ -27,101 +27,13 @@ Rectangle { width: parent.width height: parent.height property string address: "" - + property alias eventBridge: webview.eventBridge function setUrl(url) { cardRoot.address = url; webview.url = url; } - - function goBack() { - } - - function visit() { - } - - /* Rectangle { - id: header - anchors { - left: parent.left - right: parent.right - top: parent.top - } - - width: parent.width - height: 50 - color: hifi.colors.white - - Row { - anchors.fill: parent - spacing: 80 - - Item { - id: backButton - anchors { - top: parent.top - left: parent.left - leftMargin: 100 - } - height: parent.height - width: parent.height - - HifiStyles.FiraSansSemiBold { - text: "BACK" - elide: Text.ElideRight - anchors.fill: parent - size: 16 - - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - - color: hifi.colors.lightGray - - MouseArea { - id: backButtonMouseArea - anchors.fill: parent - hoverEnabled: enabled - - onClicked: { - webview.goBack(); - } - } - } - } - - Item { - id: closeButton - anchors { - top: parent.top - right: parent.right - rightMargin: 100 - } - height: parent.height - width: parent.height - - HifiStyles.FiraSansSemiBold { - text: "CLOSE" - elide: Text.ElideRight - anchors.fill: parent - size: 16 - - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - - color: hifi.colors.lightGray - - MouseArea { - id: closeButtonMouseArea - anchors.fill: parent - hoverEnabled: enabled - - onClicked: root.pop(); - } - } - } - } - }*/ - - HifiControls.WebView { + + HifiControls.TabletWebView { id: webview parentStackItem: root anchors {