From 20b6cddc560568f70458b9605ed0b37477419021 Mon Sep 17 00:00:00 2001 From: Elisa Lupin-Jimenez Date: Wed, 23 Aug 2017 15:38:11 -0700 Subject: [PATCH 1/7] attempt to add active tablet button --- .../marketplace/blocks/blocksApp.js | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/unpublishedScripts/marketplace/blocks/blocksApp.js b/unpublishedScripts/marketplace/blocks/blocksApp.js index 2c20e13005..2979f7abae 100644 --- a/unpublishedScripts/marketplace/blocks/blocksApp.js +++ b/unpublishedScripts/marketplace/blocks/blocksApp.js @@ -16,6 +16,7 @@ var APP_NAME = "BLOCKS"; var APP_URL = "https://vr.google.com/objects/"; var APP_ICON = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-i.svg"; + var APP_ICON_ACTIVE = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-a.svg"; try { print("Current Interface version: " + Window.checkVersion()); @@ -26,7 +27,8 @@ var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var button = tablet.addButton({ - icon: APP_ICON, + icon: APP_ICON, + activeIcon: APP_ICON_ACTIVE, text: APP_NAME }); @@ -35,6 +37,26 @@ } button.clicked.connect(onClicked); + function onScreenChanged(type, url) { + if (url !== null) { + tabletButton.editProperties({ isActive: true }); + + if (!shown) { + // hook up to the event bridge + tablet.webEventReceived.connect(onWebEventReceived); + } + shown = true; + } else { + tabletButton.editProperties({ isActive: false }); + + if (shown) { + // disconnect from the event bridge + tablet.webEventReceived.disconnect(onWebEventReceived); + } + shown = false; + } + } + function cleanup() { tablet.removeButton(button); } From 3444b0e84c1084046bcad9a48867023565269f08 Mon Sep 17 00:00:00 2001 From: Elisa Lupin-Jimenez Date: Thu, 24 Aug 2017 11:38:01 -0700 Subject: [PATCH 2/7] blocks icon button now has active state --- .../marketplace/blocks/blocksApp.js | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/unpublishedScripts/marketplace/blocks/blocksApp.js b/unpublishedScripts/marketplace/blocks/blocksApp.js index 2979f7abae..e1c7ba7051 100644 --- a/unpublishedScripts/marketplace/blocks/blocksApp.js +++ b/unpublishedScripts/marketplace/blocks/blocksApp.js @@ -15,6 +15,7 @@ (function () { var APP_NAME = "BLOCKS"; var APP_URL = "https://vr.google.com/objects/"; + var APP_OUTDATED_URL = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/updateToBlocks.html"; var APP_ICON = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-i.svg"; var APP_ICON_ACTIVE = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-a.svg"; @@ -22,7 +23,7 @@ print("Current Interface version: " + Window.checkVersion()); } catch(err) { print("Outdated Interface version does not support Blocks"); - APP_URL = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/updateToBlocks.html"; + APP_URL = APP_OUTDATED_URL; } var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); @@ -33,32 +34,40 @@ }); function onClicked() { - tablet.gotoWebScreen(APP_URL, "", true); + if (!shown) { + tablet.gotoWebScreen(APP_URL, "", true); + } else { + tablet.gotoHomeScreen(); + } } button.clicked.connect(onClicked); - function onScreenChanged(type, url) { - if (url !== null) { - tabletButton.editProperties({ isActive: true }); + var shown = false; - if (!shown) { - // hook up to the event bridge - tablet.webEventReceived.connect(onWebEventReceived); - } + function checkIfBlocks(url) { + if (url.indexOf("google") !== -1) { + return true; + } + return false; + } + + function onScreenChanged(type, url) { + if ((type === 'Web' && checkIfBlocks(url)) || url === APP_OUTDATED_URL) { + button.editProperties({ isActive: true }); shown = true; } else { - tabletButton.editProperties({ isActive: false }); - - if (shown) { - // disconnect from the event bridge - tablet.webEventReceived.disconnect(onWebEventReceived); - } + button.editProperties({ isActive: false }); shown = false; } } + tablet.screenChanged.connect(onScreenChanged); + function cleanup() { - tablet.removeButton(button); + tablet.removeButton(button); + if (shown) { + tablet.webEventReceived.disconnect(onWebEventReceived); + } } Script.scriptEnding.connect(cleanup); From 5c027705ba5788d7d88656ea8a6688467e4baa4c Mon Sep 17 00:00:00 2001 From: Elisa Lupin-Jimenez Date: Thu, 24 Aug 2017 12:01:08 -0700 Subject: [PATCH 3/7] removed extraneous line from active tablet button code --- unpublishedScripts/marketplace/blocks/blocksApp.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/unpublishedScripts/marketplace/blocks/blocksApp.js b/unpublishedScripts/marketplace/blocks/blocksApp.js index e1c7ba7051..c9e8682b23 100644 --- a/unpublishedScripts/marketplace/blocks/blocksApp.js +++ b/unpublishedScripts/marketplace/blocks/blocksApp.js @@ -65,9 +65,6 @@ function cleanup() { tablet.removeButton(button); - if (shown) { - tablet.webEventReceived.disconnect(onWebEventReceived); - } } Script.scriptEnding.connect(cleanup); From 77f93ae84b8b77522071744e50167a7ac95a9d42 Mon Sep 17 00:00:00 2001 From: Elisa Lupin-Jimenez Date: Thu, 24 Aug 2017 15:44:22 -0700 Subject: [PATCH 4/7] user agent switch allows downloads --- interface/resources/qml/hifi/tablet/TabletRoot.qml | 2 +- interface/resources/qml/hifi/tablet/WindowRoot.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletRoot.qml b/interface/resources/qml/hifi/tablet/TabletRoot.qml index bbf56c7827..2f4c3cf62a 100644 --- a/interface/resources/qml/hifi/tablet/TabletRoot.qml +++ b/interface/resources/qml/hifi/tablet/TabletRoot.qml @@ -96,7 +96,7 @@ Item { function loadTabletWebBase() { loader.source = ""; - loader.source = "../../controls/TabletWebView.qml"; + loader.source = "./BlocksWebView.qml"; } function returnToPreviousApp() { diff --git a/interface/resources/qml/hifi/tablet/WindowRoot.qml b/interface/resources/qml/hifi/tablet/WindowRoot.qml index 8596007956..94847b2973 100644 --- a/interface/resources/qml/hifi/tablet/WindowRoot.qml +++ b/interface/resources/qml/hifi/tablet/WindowRoot.qml @@ -44,7 +44,7 @@ Windows.ScrollingWindow { function loadTabletWebBase() { loader.source = ""; - loader.source = "../../controls/TabletWebView.qml"; + loader.source = "./BlocksWebView.qml"; } function loadWebUrl(url, injectedJavaScriptUrl) { From e71823a8b50345d20c7e85fe1757ddb5e4c3ea2a Mon Sep 17 00:00:00 2001 From: Elisa Lupin-Jimenez Date: Thu, 24 Aug 2017 15:46:22 -0700 Subject: [PATCH 5/7] forgot to track a file --- interface/resources/qml/hifi/tablet/BlocksWebView.qml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 interface/resources/qml/hifi/tablet/BlocksWebView.qml diff --git a/interface/resources/qml/hifi/tablet/BlocksWebView.qml b/interface/resources/qml/hifi/tablet/BlocksWebView.qml new file mode 100644 index 0000000000..1e9eb3beb4 --- /dev/null +++ b/interface/resources/qml/hifi/tablet/BlocksWebView.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +import QtWebEngine 1.2 + +import "../../controls" as Controls + +Controls.TabletWebView { + profile: WebEngineProfile { httpUserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36"} +} + + From 7cee80f0cfcc4ea26fcecf06474f4cdf331afc41 Mon Sep 17 00:00:00 2001 From: Elisa Lupin-Jimenez Date: Fri, 25 Aug 2017 11:09:11 -0700 Subject: [PATCH 6/7] my own objects (or rather objects with low poly count) download now --- interface/src/Application.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6083463c56..9ad3b5f715 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6504,6 +6504,7 @@ void Application::addAssetToWorldFromURLRequestFinished() { if (tempFile.open(QIODevice::WriteOnly)) { tempFile.write(request->getData()); addAssetToWorldInfoClear(filename); // Remove message from list; next one added will have a different key. + tempFile.close(); qApp->getFileDownloadInterface()->runUnzip(downloadPath, url, true, false, isBlocks); } else { QString errorInfo = "Couldn't open temporary file for download"; From 4c40e3bdf4dc90213cb151a06eeb47ae1e3b2989 Mon Sep 17 00:00:00 2001 From: Elisa Lupin-Jimenez Date: Fri, 25 Aug 2017 11:21:07 -0700 Subject: [PATCH 7/7] fixed weird info box display of filenames --- interface/src/Application.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 9ad3b5f715..d13b7880fa 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6457,7 +6457,7 @@ void Application::addAssetToWorldFromURL(QString url) { } if (url.contains("vr.google.com/downloads")) { filename = url.section('/', -1); - filename.remove(".zip?noDownload=false"); + filename.remove(".zip"); } if (!DependencyManager::get()->getThisNodeCanWriteAssets()) { @@ -6487,7 +6487,7 @@ void Application::addAssetToWorldFromURLRequestFinished() { } if (url.contains("vr.google.com/downloads")) { filename = url.section('/', -1); - filename.remove(".zip?noDownload=false"); + filename.remove(".zip"); isBlocks = true; }