From 68d10a2fe15ca4d90bdaad66a9cb772c555b4077 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sat, 18 Jan 2020 20:48:00 +0100 Subject: [PATCH 01/24] Make default copy constructors explicit Recent versions of gcc generate a warning without this --- interface/src/raypick/StylusPick.h | 2 ++ libraries/animation/src/AnimInverseKinematics.h | 1 + libraries/entities/src/EntityItemProperties.h | 2 ++ libraries/entities/src/SimulationOwner.h | 1 + libraries/shared/src/CubicHermiteSpline.h | 4 ++++ 5 files changed, 10 insertions(+) diff --git a/interface/src/raypick/StylusPick.h b/interface/src/raypick/StylusPick.h index 27514efefa..89444149d8 100644 --- a/interface/src/raypick/StylusPick.h +++ b/interface/src/raypick/StylusPick.h @@ -31,6 +31,8 @@ public: surfaceNormal = stylusPickResult.surfaceNormal; } + StylusPickResult& operator=(const StylusPickResult &right) = default; + IntersectionType type { NONE }; bool intersects { false }; QUuid objectID; diff --git a/libraries/animation/src/AnimInverseKinematics.h b/libraries/animation/src/AnimInverseKinematics.h index bcad7867cc..aa7e8fb69e 100644 --- a/libraries/animation/src/AnimInverseKinematics.h +++ b/libraries/animation/src/AnimInverseKinematics.h @@ -162,6 +162,7 @@ protected: const QString& typeVarIn, const QString& weightVarIn, float weightIn, const std::vector& flexCoefficientsIn, const QString& poleVectorEnabledVar, const QString& poleReferenceVectorVar, const QString& poleVectorVar); IKTargetVar(const IKTargetVar& orig); + AnimInverseKinematics::IKTargetVar& operator=(const AnimInverseKinematics::IKTargetVar&) = default; QString jointName; QString positionVar; diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 63d8183899..7ee6742e7f 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -121,6 +121,8 @@ public: static void propertiesToBlob(QScriptEngine& scriptEngine, const QUuid& myAvatarID, const EntityItemProperties& properties, QByteArray& blob); EntityItemProperties(EntityPropertyFlags desiredProperties = EntityPropertyFlags()); + EntityItemProperties(const EntityItemProperties&) = default; + virtual ~EntityItemProperties() = default; void merge(const EntityItemProperties& other); diff --git a/libraries/entities/src/SimulationOwner.h b/libraries/entities/src/SimulationOwner.h index 6f37066e47..4039719cd3 100644 --- a/libraries/entities/src/SimulationOwner.h +++ b/libraries/entities/src/SimulationOwner.h @@ -112,6 +112,7 @@ public: SimulationOwner(); SimulationOwner(const QUuid& id, uint8_t priority); + SimulationOwner(const SimulationOwner &) = default; const QUuid& getID() const { return _id; } const uint64_t& getExpiry() const { return _expiry; } diff --git a/libraries/shared/src/CubicHermiteSpline.h b/libraries/shared/src/CubicHermiteSpline.h index c83000996b..f91b25aa7a 100644 --- a/libraries/shared/src/CubicHermiteSpline.h +++ b/libraries/shared/src/CubicHermiteSpline.h @@ -19,6 +19,8 @@ public: CubicHermiteSplineFunctor(const CubicHermiteSplineFunctor& orig) : _p0(orig._p0), _m0(orig._m0), _p1(orig._p1), _m1(orig._m1) {} + CubicHermiteSplineFunctor& operator=(const CubicHermiteSplineFunctor&) = default; + virtual ~CubicHermiteSplineFunctor() {} // evalute the hermite curve at parameter t (0..1) @@ -85,6 +87,8 @@ public: memcpy(_values, orig._values, sizeof(float) * (NUM_SUBDIVISIONS + 1)); } + CubicHermiteSplineFunctorWithArcLength& operator=(const CubicHermiteSplineFunctorWithArcLength&) = default; + // given the spline parameter (0..1) output the arcLength of the spline up to that point. float arcLength(float t) const { float index = t * NUM_SUBDIVISIONS; From d0dc041275ae9b0eae64a5776159bfbcdba35bc5 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 19 Jan 2020 11:24:51 +0100 Subject: [PATCH 02/24] Another default operator= and copy constructor --- libraries/image/src/image/Image.h | 2 +- libraries/shared/src/shared/MediaTypeLibrary.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/image/src/image/Image.h b/libraries/image/src/image/Image.h index dd39383dfb..14aa12d11a 100644 --- a/libraries/image/src/image/Image.h +++ b/libraries/image/src/image/Image.h @@ -59,7 +59,7 @@ namespace image { Image() : _dims(0,0) {} Image(int width, int height, Format format); Image(const QImage& data) : _packedData(data), _dims(data.width(), data.height()), _format((Format)data.format()) {} - + Image(const Image &other) = default; void operator=(const QImage& other) { _packedData = other; _floatData.clear(); diff --git a/libraries/shared/src/shared/MediaTypeLibrary.h b/libraries/shared/src/shared/MediaTypeLibrary.h index c87da01fa1..d4931c1601 100644 --- a/libraries/shared/src/shared/MediaTypeLibrary.h +++ b/libraries/shared/src/shared/MediaTypeLibrary.h @@ -48,6 +48,7 @@ public: webMediaTypes(mediaType.webMediaTypes), fileSignatures(mediaType.fileSignatures) { } + MediaType& operator=(const MediaType&) = default; static MediaType NONE; From 6c81f597af58d63f53ab1a66041fb6753362084c Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 22 Jan 2020 20:55:50 +1300 Subject: [PATCH 03/24] Display vertical scrollbar in Settings dialogs that scroll --- interface/resources/qml/hifi/audio/Audio.qml | 4 +- .../tabletWindows/TabletPreferencesDialog.qml | 45 ++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index eef339b854..2f5ac68b4b 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -44,7 +44,6 @@ Rectangle { return (root.parent !== null) && root.parent.objectName == "loader"; } - property bool isVR: AudioScriptingInterface.context === "VR" property real rightMostInputLevelPos: root.width //placeholder for control sizes and paddings @@ -128,7 +127,8 @@ Rectangle { anchors.top: flickView.top; anchors.right: flickView.right; anchors.bottom: flickView.bottom; - anchors.rightMargin: -verticalScrollWidth; //compensate flickView's right margin + anchors.rightMargin: 2 + background: Item { implicitWidth: verticalScrollWidth; Rectangle { diff --git a/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml b/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml index 66661843e6..7e672aafaa 100644 --- a/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml +++ b/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml @@ -9,6 +9,7 @@ // import QtQuick 2.5 +import QtQuick.Controls 2.2 import "." import "./preferences" @@ -33,7 +34,10 @@ Item { property bool gotoPreviousAppFromScript: false property var tablet; - + + readonly property real verticalScrollWidth: 10 + readonly property real verticalScrollShaft: 8 + function saveAll() { dialog.forceActiveFocus(); // Accept any text box edits in progress. @@ -103,6 +107,43 @@ Item { height: parent.height contentWidth: parent.width contentHeight: getSectionsHeight(); + + anchors.top: main.top + anchors.bottom: main.bottom + + ScrollBar.vertical: ScrollBar { + policy: ScrollBar.AlwaysOn + parent: scrollView.parent + anchors.top: scrollView.top + anchors.right: scrollView.right + anchors.bottom: scrollView.bottom + anchors.rightMargin: 2 + + background: Item { + implicitWidth: verticalScrollWidth + Rectangle { + color: hifi.colors.darkGray30; + radius: 4 + anchors { + fill: parent + } + } + } + contentItem: Item { + implicitWidth: verticalScrollShaft + Rectangle { + radius: verticalScrollShaft/2 + color: hifi.colors.white30 + anchors { + fill: parent + leftMargin: 1 // Finesse size and position. + topMargin: 1 + bottomMargin: 1 + } + } + } + } + Column { width: 480 Component { @@ -183,7 +224,7 @@ Item { for (var i = 0; i < sections.length; i++) { totalHeight += sections[i].height + sections[i].getPreferencesHeight(); } - var bottomPadding = 170; + var bottomPadding = 30; return (totalHeight + bottomPadding); } } From cfde36c9f5f47121eee6f7bf6be7983b07c60f76 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 23 Jan 2020 11:25:48 +1300 Subject: [PATCH 04/24] Fix up scrollbars and separators --- interface/resources/qml/hifi/audio/Audio.qml | 13 +++++-------- .../tabletWindows/TabletPreferencesDialog.qml | 6 +++--- interface/resources/qml/windows/ScrollingWindow.qml | 4 +--- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index 2f5ac68b4b..963a3246fc 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -127,17 +127,16 @@ Rectangle { anchors.top: flickView.top; anchors.right: flickView.right; anchors.bottom: flickView.bottom; - anchors.rightMargin: 2 + z: 100 // Display over top of separators. background: Item { implicitWidth: verticalScrollWidth; Rectangle { - color: hifi.colors.darkGray30; + color: hifi.colors.baseGrayShadow radius: 4; anchors { fill: parent; - topMargin: -1; // Finesse size - bottomMargin: -2; + topMargin: 2 // Finess position } } } @@ -148,9 +147,7 @@ Rectangle { color: hifi.colors.white30; anchors { fill: parent; - leftMargin: 2; // Finesse size and position. - topMargin: 1; - bottomMargin: 1; + topMargin: 1; // Finesse position. } } } @@ -338,7 +335,6 @@ Rectangle { anchors.topMargin: 10; } - Item { id: inputDeviceHeader x: margins.paddings; @@ -688,4 +684,5 @@ Rectangle { anchors.topMargin: 10; } } + } diff --git a/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml b/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml index 7e672aafaa..cedbfb0fe1 100644 --- a/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml +++ b/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml @@ -117,15 +117,16 @@ Item { anchors.top: scrollView.top anchors.right: scrollView.right anchors.bottom: scrollView.bottom - anchors.rightMargin: 2 + z: 100 // Display over top of separators. background: Item { implicitWidth: verticalScrollWidth Rectangle { - color: hifi.colors.darkGray30; + color: hifi.colors.baseGrayShadow radius: 4 anchors { fill: parent + bottomMargin: 1 } } } @@ -136,7 +137,6 @@ Item { color: hifi.colors.white30 anchors { fill: parent - leftMargin: 1 // Finesse size and position. topMargin: 1 bottomMargin: 1 } diff --git a/interface/resources/qml/windows/ScrollingWindow.qml b/interface/resources/qml/windows/ScrollingWindow.qml index 70640a2b75..0c91b58e31 100644 --- a/interface/resources/qml/windows/ScrollingWindow.qml +++ b/interface/resources/qml/windows/ScrollingWindow.qml @@ -97,11 +97,10 @@ Windows.Window { background: Item { implicitWidth: verticalScrollWidth Rectangle { - color: hifi.colors.darkGray30 + color: hifi.colors.baseGrayShadow radius: 4 anchors { fill: parent - topMargin: -1 // Finesse size bottomMargin: -2 } } @@ -113,7 +112,6 @@ Windows.Window { color: hifi.colors.white30 anchors { fill: parent - leftMargin: 2 // Finesse size and position. topMargin: 1 bottomMargin: 1 } From b8e41fd244c68b2063193a488e7964ad5ffcb63b Mon Sep 17 00:00:00 2001 From: Fluffy Jenkins Date: Tue, 28 Jan 2020 22:06:27 +0000 Subject: [PATCH 05/24] Added basic beta default scripts feature --- scripts/defaultScripts.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 795458f05d..8ba12f8e8b 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -39,7 +39,7 @@ var DEFAULT_SCRIPTS_COMBINED = [ var DEFAULT_SCRIPTS_SEPARATE = [ "system/controllers/controllerScripts.js", "communityModules/notificationCore/notificationCore.js", - "communityModules/chat/FloofChat.js" + {"stable": "communityModules/chat/FloofChat.js", "beta": "https://content.fluffy.ws/scripts/chat/FloofChat.js"} //"system/chat.js" ]; @@ -53,7 +53,8 @@ var MENU_CATEGORY = "Developer > Scripting"; var MENU_ITEM = "Debug defaultScripts.js"; var SETTINGS_KEY = '_debugDefaultScriptsIsChecked'; -var previousSetting = Settings.getValue(SETTINGS_KEY); +var SETTINGS_KEY_BETA = '_betaDefaultScriptsIsChecked'; +var previousSetting = Settings.getValue(SETTINGS_KEY, false); if (previousSetting === '' || previousSetting === false || previousSetting === 'false') { previousSetting = false; @@ -71,23 +72,31 @@ if (Menu.menuExists(MENU_CATEGORY) && !Menu.menuItemExists(MENU_CATEGORY, MENU_I isChecked: previousSetting, }); } - function loadSeparateDefaults() { var currentlyRunningScripts = ScriptDiscoveryService.getRunning(); for (var i in DEFAULT_SCRIPTS_SEPARATE) { var shouldLoadCurrentDefaultScript = true; + var scriptItem = DEFAULT_SCRIPTS_SEPARATE[i]; + if (typeof scriptItem === "object") { + if (previousSettingBeta) { + console.info("Loading Beta item " + scriptItem.beta); + scriptItem = scriptItem.beta; + } else { + scriptItem = scriptItem.stable; + } + } for (var j = 0; j < currentlyRunningScripts.length; j++) { var currentRunningScriptObject = currentlyRunningScripts[j]; - var currentDefaultScriptName = DEFAULT_SCRIPTS_SEPARATE[i].substr((DEFAULT_SCRIPTS_SEPARATE[i].lastIndexOf("/") + 1), DEFAULT_SCRIPTS_SEPARATE[i].length); + var currentDefaultScriptName = scriptItem.substr((scriptItem.lastIndexOf("/") + 1), scriptItem.length); if (currentDefaultScriptName === currentRunningScriptObject.name) { shouldLoadCurrentDefaultScript = false; } } if (shouldLoadCurrentDefaultScript) { - Script.load(DEFAULT_SCRIPTS_SEPARATE[i]); + Script.load(scriptItem); } } } @@ -161,7 +170,7 @@ function removeMenuItem() { } } -Script.scriptEnding.connect(function() { +Script.scriptEnding.connect(function () { removeMenuItem(); }); From a66bbcb12564a6b6a7b53fffe06a07732467953b Mon Sep 17 00:00:00 2001 From: Fluffy Jenkins Date: Tue, 28 Jan 2020 22:23:01 +0000 Subject: [PATCH 06/24] Made fixes --- scripts/defaultScripts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 8ba12f8e8b..af802ddc1e 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -54,7 +54,8 @@ var MENU_ITEM = "Debug defaultScripts.js"; var SETTINGS_KEY = '_debugDefaultScriptsIsChecked'; var SETTINGS_KEY_BETA = '_betaDefaultScriptsIsChecked'; -var previousSetting = Settings.getValue(SETTINGS_KEY, false); +var previousSetting = Settings.getValue(SETTINGS_KEY, false);; +var previousSettingBeta = Settings.getValue(SETTINGS_KEY_BETA, false); if (previousSetting === '' || previousSetting === false || previousSetting === 'false') { previousSetting = false; @@ -91,7 +92,7 @@ function loadSeparateDefaults() { var currentRunningScriptObject = currentlyRunningScripts[j]; var currentDefaultScriptName = scriptItem.substr((scriptItem.lastIndexOf("/") + 1), scriptItem.length); if (currentDefaultScriptName === currentRunningScriptObject.name) { - shouldLoadCurrentDefaultScript = false; + ScriptDiscoveryService.stopScript(currentRunningScriptObject.url); } } From 5492759a0c8223f9838b920d4f932fefbb35ebe2 Mon Sep 17 00:00:00 2001 From: Fluffy Jenkins Date: Wed, 29 Jan 2020 19:50:23 +0000 Subject: [PATCH 07/24] Made requested changes and changed how it loads --- scripts/defaultScripts.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index af802ddc1e..7ea1632314 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -54,7 +54,7 @@ var MENU_ITEM = "Debug defaultScripts.js"; var SETTINGS_KEY = '_debugDefaultScriptsIsChecked'; var SETTINGS_KEY_BETA = '_betaDefaultScriptsIsChecked'; -var previousSetting = Settings.getValue(SETTINGS_KEY, false);; +var previousSetting = Settings.getValue(SETTINGS_KEY, false); var previousSettingBeta = Settings.getValue(SETTINGS_KEY_BETA, false); if (previousSetting === '' || previousSetting === false || previousSetting === 'false') { @@ -73,6 +73,7 @@ if (Menu.menuExists(MENU_CATEGORY) && !Menu.menuItemExists(MENU_CATEGORY, MENU_I isChecked: previousSetting, }); } + function loadSeparateDefaults() { var currentlyRunningScripts = ScriptDiscoveryService.getRunning(); @@ -81,7 +82,7 @@ function loadSeparateDefaults() { var scriptItem = DEFAULT_SCRIPTS_SEPARATE[i]; if (typeof scriptItem === "object") { if (previousSettingBeta) { - console.info("Loading Beta item " + scriptItem.beta); + console.log("Loading Beta item " + scriptItem.beta); scriptItem = scriptItem.beta; } else { scriptItem = scriptItem.stable; @@ -92,7 +93,11 @@ function loadSeparateDefaults() { var currentRunningScriptObject = currentlyRunningScripts[j]; var currentDefaultScriptName = scriptItem.substr((scriptItem.lastIndexOf("/") + 1), scriptItem.length); if (currentDefaultScriptName === currentRunningScriptObject.name) { - ScriptDiscoveryService.stopScript(currentRunningScriptObject.url); + if (currentRunningScriptObject.url !== scriptItem) { + ScriptDiscoveryService.stopScript(currentRunningScriptObject.url); + } else { + shouldLoadCurrentDefaultScript = false; + } } } From 46173439ed2cb860d6df14dc8e7531b477d2c8e0 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 1 Feb 2020 12:46:28 +1300 Subject: [PATCH 08/24] Enable serverless domains via HTTP and HTTPS --- interface/src/Application.cpp | 40 +++++++++++---------- interface/src/Application.h | 2 +- libraries/networking/src/AddressManager.cpp | 7 ++-- libraries/octree/src/Octree.cpp | 19 +++++++++- libraries/octree/src/Octree.h | 1 + 5 files changed, 44 insertions(+), 25 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6a1925c7fb..ccca85e7ec 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4059,7 +4059,7 @@ void Application::setIsServerlessMode(bool serverlessDomain) { } } -std::map Application::prepareServerlessDomainContents(QUrl domainURL) { +std::map Application::prepareServerlessDomainContents(QUrl domainURL, QByteArray data) { QUuid serverlessSessionID = QUuid::createUuid(); getMyAvatar()->setSessionUUID(serverlessSessionID); auto nodeList = DependencyManager::get(); @@ -4070,14 +4070,13 @@ std::map Application::prepareServerlessDomainContents(QUrl dom permissions.setAll(true); nodeList->setPermissions(permissions); - // we can't import directly into the main tree because we would need to lock it, and - // Octree::readFromURL calls loop.exec which can run code which will also attempt to lock the tree. + // FIXME: Lock the main tree and import directly into it. EntityTreePointer tmpTree(new EntityTree()); tmpTree->setIsServerlessMode(true); tmpTree->createRootElement(); auto myAvatar = getMyAvatar(); tmpTree->setMyAvatar(myAvatar); - bool success = tmpTree->readFromURL(domainURL.toString()); + bool success = tmpTree->readFromByteArray(domainURL.toString(), data); if (success) { tmpTree->reaverageOctreeElements(); tmpTree->sendEntities(&_entityEditSender, getEntities()->getTree(), 0, 0, 0); @@ -4100,12 +4099,26 @@ void Application::loadServerlessDomain(QUrl domainURL) { return; } - auto namedPaths = prepareServerlessDomainContents(domainURL); - auto nodeList = DependencyManager::get(); + QString trimmedUrl = domainURL.toString().trimmed(); + bool DEFAULT_IS_OBSERVABLE = true; + const qint64 DEFAULT_CALLER_ID = -1; + auto request = DependencyManager::get()->createResourceRequest( + this, trimmedUrl, DEFAULT_IS_OBSERVABLE, DEFAULT_CALLER_ID, "Application::loadServerlessDomain"); - nodeList->getDomainHandler().connectedToServerless(namedPaths); + if (!request) { + return; + } - _fullSceneReceivedCounter++; + connect(request, &ResourceRequest::finished, this, [=]() { + if (request->getResult() == ResourceRequest::Success) { + auto namedPaths = prepareServerlessDomainContents(domainURL, request->getData()); + auto nodeList = DependencyManager::get(); + nodeList->getDomainHandler().connectedToServerless(namedPaths); + _fullSceneReceivedCounter++; + } + request->deleteLater(); + }); + request->send(); } void Application::loadErrorDomain(QUrl domainURL) { @@ -4114,16 +4127,7 @@ void Application::loadErrorDomain(QUrl domainURL) { return; } - if (domainURL.isEmpty()) { - return; - } - - auto namedPaths = prepareServerlessDomainContents(domainURL); - auto nodeList = DependencyManager::get(); - - nodeList->getDomainHandler().loadedErrorDomain(namedPaths); - - _fullSceneReceivedCounter++; + loadServerlessDomain(domainURL); } bool Application::importImage(const QString& urlString) { diff --git a/interface/src/Application.h b/interface/src/Application.h index 114bca864d..198f5ef7cf 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -464,7 +464,7 @@ public slots: void setPreferredCursor(const QString& cursor); void setIsServerlessMode(bool serverlessDomain); - std::map prepareServerlessDomainContents(QUrl domainURL); + std::map prepareServerlessDomainContents(QUrl domainURL, QByteArray data); void loadServerlessDomain(QUrl domainURL); void loadErrorDomain(QUrl domainURL); diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index 50e2657622..5c821bdbf5 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -358,11 +358,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) { emit lookupResultsFinished(); return true; - } else if (lookupUrl.scheme() == HIFI_URL_SCHEME_FILE) { - // TODO -- once Octree::readFromURL no-longer takes over the main event-loop, serverless-domain urls can - // be loaded over http(s) - // lookupUrl.scheme() == URL_SCHEME_HTTP || - // lookupUrl.scheme() == HIFI_URL_SCHEME_HTTPS || + } else if (lookupUrl.scheme() == HIFI_URL_SCHEME_FILE || lookupUrl.scheme() == HIFI_URL_SCHEME_HTTPS + || lookupUrl.scheme() == HIFI_URL_SCHEME_HTTP) { // TODO once a file can return a connection refusal if there were to be some kind of load error, we'd // need to store the previous domain tried in _lastVisitedURL. For now , do not store it. diff --git a/libraries/octree/src/Octree.cpp b/libraries/octree/src/Octree.cpp index df02b54856..aac0de27a1 100644 --- a/libraries/octree/src/Octree.cpp +++ b/libraries/octree/src/Octree.cpp @@ -738,7 +738,6 @@ bool Octree::readFromURL( ) { QString trimmedUrl = urlString.trimmed(); QString marketplaceID = getMarketplaceID(trimmedUrl); - qDebug() << "!!!!! going to createResourceRequest " << callerId; auto request = std::unique_ptr( DependencyManager::get()->createResourceRequest( this, trimmedUrl, isObservable, callerId, "Octree::readFromURL")); @@ -770,6 +769,24 @@ bool Octree::readFromURL( return readFromStream(data.size(), inputStream, marketplaceID); } +bool Octree::readFromByteArray( + const QString& urlString, + const QByteArray& data +) { + QString trimmedUrl = urlString.trimmed(); + QString marketplaceID = getMarketplaceID(trimmedUrl); + + QByteArray uncompressedJsonData; + bool wasCompressed = gunzip(data, uncompressedJsonData); + + if (wasCompressed) { + QDataStream inputStream(uncompressedJsonData); + return readFromStream(uncompressedJsonData.size(), inputStream, marketplaceID); + } + + QDataStream inputStream(data); + return readFromStream(data.size(), inputStream, marketplaceID); +} bool Octree::readFromStream( uint64_t streamLength, diff --git a/libraries/octree/src/Octree.h b/libraries/octree/src/Octree.h index 4f994da60e..45dae3049d 100644 --- a/libraries/octree/src/Octree.h +++ b/libraries/octree/src/Octree.h @@ -217,6 +217,7 @@ public: // Octree importers bool readFromFile(const char* filename); bool readFromURL(const QString& url, const bool isObservable = true, const qint64 callerId = -1); // will support file urls as well... + bool readFromByteArray(const QString& url, const QByteArray& byteArray); bool readFromStream(uint64_t streamLength, QDataStream& inputStream, const QString& marketplaceID=""); bool readSVOFromStream(uint64_t streamLength, QDataStream& inputStream); bool readJSONFromStream(uint64_t streamLength, QDataStream& inputStream, const QString& marketplaceID=""); From 1112367b06daaa8064aac322fe7c6590558aaeca Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sun, 2 Feb 2020 20:57:56 +1300 Subject: [PATCH 09/24] Handle localStorage not being available --- .../hifi-jsdoc-template/tmpl/layout.tmpl | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/layout.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/layout.tmpl index 76262ec499..6d12ccd816 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/layout.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/layout.tmpl @@ -34,17 +34,29 @@