From d292451f913bf18dd2dccc1431c1600e4ed8e255 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 24 Apr 2017 15:43:04 -0700 Subject: [PATCH 1/5] Remove unnecessary const --- assignment-client/src/scripts/EntityScriptServer.cpp | 4 ++-- assignment-client/src/scripts/EntityScriptServer.h | 4 ++-- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 4 ++-- libraries/entities-renderer/src/EntityTreeRenderer.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/assignment-client/src/scripts/EntityScriptServer.cpp b/assignment-client/src/scripts/EntityScriptServer.cpp index 954c25a342..270a22e17b 100644 --- a/assignment-client/src/scripts/EntityScriptServer.cpp +++ b/assignment-client/src/scripts/EntityScriptServer.cpp @@ -481,14 +481,14 @@ void EntityScriptServer::deletingEntity(const EntityItemID& entityID) { } } -void EntityScriptServer::entityServerScriptChanging(const EntityItemID& entityID, const bool reload) { +void EntityScriptServer::entityServerScriptChanging(const EntityItemID& entityID, bool reload) { if (_entityViewer.getTree() && !_shuttingDown) { _entitiesScriptEngine->unloadEntityScript(entityID, true); checkAndCallPreload(entityID, reload); } } -void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, const bool reload) { +void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, bool reload) { if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine) { EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID); diff --git a/assignment-client/src/scripts/EntityScriptServer.h b/assignment-client/src/scripts/EntityScriptServer.h index a468e62958..687641d6be 100644 --- a/assignment-client/src/scripts/EntityScriptServer.h +++ b/assignment-client/src/scripts/EntityScriptServer.h @@ -67,8 +67,8 @@ private: void addingEntity(const EntityItemID& entityID); void deletingEntity(const EntityItemID& entityID); - void entityServerScriptChanging(const EntityItemID& entityID, const bool reload); - void checkAndCallPreload(const EntityItemID& entityID, const bool reload = false); + void entityServerScriptChanging(const EntityItemID& entityID, bool reload); + void checkAndCallPreload(const EntityItemID& entityID, bool reload = false); void cleanupOldKilledListeners(); diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 63684dcf0f..0cf40a0ccc 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -1015,11 +1015,11 @@ void EntityTreeRenderer::addEntityToScene(EntityItemPointer entity) { } -void EntityTreeRenderer::entityScriptChanging(const EntityItemID& entityID, const bool reload) { +void EntityTreeRenderer::entityScriptChanging(const EntityItemID& entityID, bool reload) { checkAndCallPreload(entityID, reload, true); } -void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID, const bool reload, const bool unloadFirst) { +void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID, bool reload, bool unloadFirst) { if (_tree && !_shuttingDown) { EntityItemPointer entity = getTree()->findEntityByEntityItemID(entityID); if (!entity) { diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.h b/libraries/entities-renderer/src/EntityTreeRenderer.h index ec9f707962..f4717dca51 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.h +++ b/libraries/entities-renderer/src/EntityTreeRenderer.h @@ -152,7 +152,7 @@ private: bool applySkyboxAndHasAmbient(); bool applyLayeredZones(); - void checkAndCallPreload(const EntityItemID& entityID, const bool reload = false, const bool unloadFirst = false); + void checkAndCallPreload(const EntityItemID& entityID, bool reload = false, bool unloadFirst = false); QList _releasedModels; RayToEntityIntersectionResult findRayIntersectionWorker(const PickRay& ray, Octree::lockType lockType, From 24f4107c928aea990673334c7bbefd1b17a1e554 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 24 Apr 2017 15:56:37 -0700 Subject: [PATCH 2/5] Unload script when replaced with empty URL --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 0cf40a0ccc..d16f044821 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -1027,11 +1027,11 @@ void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID, bool } bool shouldLoad = entity->shouldPreloadScript() && _entitiesScriptEngine; QString scriptUrl = entity->getScript(); - if (shouldLoad && (unloadFirst || scriptUrl.isEmpty())) { + if ((shouldLoad && unloadFirst) || scriptUrl.isEmpty()) { _entitiesScriptEngine->unloadEntityScript(entityID); entity->scriptHasUnloaded(); } - if (shouldLoad && !scriptUrl.isEmpty()) { + if (shouldLoad) { scriptUrl = ResourceManager::normalizeURL(scriptUrl); _entitiesScriptEngine->loadEntityScript(entityID, scriptUrl, reload); entity->scriptHasPreloaded(); From b78bae37beb196f1e8b819a4d51d209d5fd60c40 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 25 Apr 2017 23:22:27 +0100 Subject: [PATCH 3/5] added keyboard for tabletWebview --- .../resources/qml/controls/TabletWebView.qml | 44 ++++++++++++++++--- .../qml/hifi/tablet/TabletAddressDialog.qml | 1 + 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/interface/resources/qml/controls/TabletWebView.qml b/interface/resources/qml/controls/TabletWebView.qml index 9a08e8b866..7396395fdb 100644 --- a/interface/resources/qml/controls/TabletWebView.qml +++ b/interface/resources/qml/controls/TabletWebView.qml @@ -23,6 +23,8 @@ Item { property bool keyboardRaised: false property bool punctuationMode: false property bool isDesktop: false + property bool removingPage: false + property bool loadingPage: false property int currentPage: -1 // used as a model for repeater @@ -94,10 +96,14 @@ Item { } function goBack() { - if (webview.canGoBack) { - pagesModel.remove(currentPage); + if (webview.canGoBack && !isUrlLoaded(webview.url)) { + if (currentPage > 0) { + removingPage = true; + pagesModel.remove(currentPage); + } webview.goBack(); } else if (currentPage > 0) { + removingPage = true; pagesModel.remove(currentPage); } } @@ -121,6 +127,10 @@ Item { urlAppend(url) } + function isUrlLoaded(url) { + return (pagesModel.get(currentPage).webUrl === url); + } + function reloadPage() { view.reloadAndBypassCache() view.setActiveFocusOnPress(true); @@ -128,6 +138,10 @@ Item { } function urlAppend(url) { + if (removingPage) { + removingPage = false; + return; + } var lurl = decodeURIComponent(url) if (lurl[lurl.length - 1] !== "/") { lurl = lurl + "/" @@ -140,6 +154,7 @@ Item { onCurrentPageChanged: { if (currentPage >= 0 && currentPage < pagesModel.count) { + timer.start(); webview.url = pagesModel.get(currentPage).webUrl; web.url = webview.url; web.address = webview.url; @@ -158,7 +173,7 @@ Item { Timer { id: timer - interval: 100 + interval: 200 running: false repeat: false onTriggered: timer.stop(); @@ -227,13 +242,13 @@ Item { } onLoadingChanged: { - keyboardRaised = false; - punctuationMode = false; + //keyboardRaised = false; + //punctuationMode = false; keyboard.resetShiftMode(false); - // Required to support clicking on "hifi://" links if (WebEngineView.LoadStartedStatus == loadRequest.status) { - urlAppend(loadRequest.url.toString()) + urlAppend(loadRequest.url.toString()); + loadingPage = true; var url = loadRequest.url.toString(); if (urlHandler.canHandleUrl(url)) { if (urlHandler.handleUrl(url)) { @@ -241,12 +256,27 @@ Item { } } } + + if (WebEngineView.LoadFailedStatus == loadRequest.status) { + console.log(" Tablet WebEngineView failed to laod url: " + loadRequest.url.toString()); + } } onNewViewRequested: { request.openIn(webview); } } + + HiFiControls.Keyboard { + id: keyboard + raised: parent.keyboardEnabled && parent.keyboardRaised + + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + } Component.onCompleted: { web.isDesktop = (typeof desktop !== "undefined"); diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index bed1f82ac2..b78254a4a0 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -65,6 +65,7 @@ StackView { var card = tabletWebView.createObject(); card.url = addressBarDialog.metaverseServerUrl + targetString; card.parentStackItem = root; + card.eventBridge = root.eventBridge; root.push(card); return; } From 851eece0e49f5d5908e3780d3ffe0441d251eb71 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 25 Apr 2017 23:26:16 +0100 Subject: [PATCH 4/5] removed comments --- interface/resources/qml/controls/TabletWebView.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/controls/TabletWebView.qml b/interface/resources/qml/controls/TabletWebView.qml index 7396395fdb..41cea625e2 100644 --- a/interface/resources/qml/controls/TabletWebView.qml +++ b/interface/resources/qml/controls/TabletWebView.qml @@ -242,8 +242,8 @@ Item { } onLoadingChanged: { - //keyboardRaised = false; - //punctuationMode = false; + keyboardRaised = false; + punctuationMode = false; keyboard.resetShiftMode(false); // Required to support clicking on "hifi://" links if (WebEngineView.LoadStartedStatus == loadRequest.status) { From 3e242969961c054d951bee23b4f75adf176ecff4 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 26 Apr 2017 09:10:05 -0700 Subject: [PATCH 5/5] Swap the two lines --- scripts/system/makeUserConnection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/makeUserConnection.js b/scripts/system/makeUserConnection.js index 674da2d677..704450d8c3 100644 --- a/scripts/system/makeUserConnection.js +++ b/scripts/system/makeUserConnection.js @@ -582,8 +582,8 @@ function handleConnectionResponseAndMaybeRepeat(error, response) { UserActivityLogger.makeUserConnection(connectingId, false, error || response); connectionRequestCompleted(); } else { - debug('server success', result); result = response; + debug('server success', result); if (pollCount++) { connectionRequestCompleted(); } else { // Wait for other guy, so that final succcess is at roughly the same time.