From 8e3067406957f2954b51bc0353a0ea92da149cfc Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 7 Dec 2016 09:28:35 +1300 Subject: [PATCH] Tidying --- interface/src/Application.cpp | 18 +++++++++--------- .../src/FileScriptingInterface.cpp | 2 -- scripts/system/html/js/marketplacesHiFi.js | 6 +++--- scripts/system/marketplaces/marketplaces.js | 14 +++++++------- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index dd41e825f6..23460549b9 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5526,7 +5526,7 @@ void Application::addAssetToWorld(QString filePath) { if (!DependencyManager::get()->getThisNodeCanWriteAssets()) { QString errorInfo = "Do not have permissions to write to asset server."; - qCDebug(interfaceapp) << "Error downloading asset: " + errorInfo; + qWarning(interfaceapp) << "Error downloading asset: " + errorInfo; addAssetToWorldError(errorInfo); return; } @@ -5551,7 +5551,7 @@ void Application::addAssetToWorldWithNewMapping(QString path, QString mapping, i } else if (result != GetMappingRequest::NoError) { QString errorInfo = "Could not map asset name: " + mapping.left(mapping.length() - QString::number(copy).length() - 1); - qCDebug(interfaceapp) << "Error downloading asset: " + errorInfo; + qWarning(interfaceapp) << "Error downloading asset: " + errorInfo; addAssetToWorldError(errorInfo); } else if (copy < MAX_COPY_COUNT - 1) { if (copy > 0) { @@ -5563,7 +5563,7 @@ void Application::addAssetToWorldWithNewMapping(QString path, QString mapping, i } else { QString errorInfo = "Too many copies of asset name: " + mapping.left(mapping.length() - QString::number(copy).length() - 1); - qCDebug(interfaceapp) << "Error downloading asset: " + errorInfo; + qWarning(interfaceapp) << "Error downloading asset: " + errorInfo; addAssetToWorldError(errorInfo); } request->deleteLater(); @@ -5581,7 +5581,7 @@ void Application::addAssetToWorldUpload(QString path, QString mapping) { QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable { if (upload->getError() != AssetUpload::NoError) { QString errorInfo = "Could not upload asset to asset server."; - qCDebug(interfaceapp) << "Error downloading asset: " + errorInfo; + qWarning(interfaceapp) << "Error downloading asset: " + errorInfo; addAssetToWorldError(errorInfo); } else { addAssetToWorldSetMapping(mapping, hash); @@ -5610,7 +5610,7 @@ void Application::addAssetToWorldSetMapping(QString mapping, QString hash) { connect(request, &SetMappingRequest::finished, this, [=](SetMappingRequest* request) mutable { if (request->getError() != SetMappingRequest::NoError) { QString errorInfo = "Could not set asset mapping."; - qCDebug(interfaceapp) << "Error downloading asset: " + errorInfo; + qWarning(interfaceapp) << "Error downloading asset: " + errorInfo; addAssetToWorldError(errorInfo); } else { addAssetToWorldAddEntity(mapping); @@ -5637,12 +5637,12 @@ void Application::addAssetToWorldAddEntity(QString mapping) { auto result = DependencyManager::get()->addEntity(properties); if (result == QUuid()) { - QString errorInfo = "Could not add downloaded asset " + mapping + " to world."; - qCDebug(interfaceapp) << "Error downloading asset: " + errorInfo; + QString errorInfo = "Could not add asset " + mapping + " to world."; + qWarning(interfaceapp) << "Could not add asset to world: " + errorInfo; addAssetToWorldError(errorInfo); } else { - QString successInfo = "Downloaded asset " + mapping + " added to world."; - qCDebug(interfaceapp) << "Downloading asset completed: " + successInfo; + QString successInfo = mapping + " added to world."; + qInfo() << "Downloading asset completed: " + successInfo; _addAssetToWorldMessageBox->setProperty("text", successInfo); _addAssetToWorldMessageBox->setProperty("buttons", QMessageBox::Ok); _addAssetToWorldMessageBox->setProperty("defaultButton", QMessageBox::Ok); diff --git a/libraries/script-engine/src/FileScriptingInterface.cpp b/libraries/script-engine/src/FileScriptingInterface.cpp index cd9d92da8b..676158f606 100644 --- a/libraries/script-engine/src/FileScriptingInterface.cpp +++ b/libraries/script-engine/src/FileScriptingInterface.cpp @@ -80,7 +80,6 @@ bool FileScriptingInterface::isZipped(QUrl url) { return (url.toString().endsWith(".zip")); } -// this function is not in use QString FileScriptingInterface::getTempDir() { QTemporaryDir dir; dir.setAutoRemove(false); @@ -106,7 +105,6 @@ void FileScriptingInterface::downloadZip(QString path, const QString link) { request->send(); } - QString FileScriptingInterface::unzipFile(QString path, QString tempDir) { QDir dir(path); diff --git a/scripts/system/html/js/marketplacesHiFi.js b/scripts/system/html/js/marketplacesHiFi.js index 562d20f584..3fa45ccd05 100644 --- a/scripts/system/html/js/marketplacesHiFi.js +++ b/scripts/system/html/js/marketplacesHiFi.js @@ -10,7 +10,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -function onLoad() { +$(document).ready(function () { + // Supporting styles from marketplaces.css. // Glyph font family, size, and spacing adjusted because HiFi-Glyphs cannot be used cross-domain. $("head").append( @@ -46,6 +47,5 @@ function onLoad() { $("#marketplace-content").attr("src", "marketplacesDirectory.html"); EventBridge.emitWebEvent("RELOAD_DIRECTORY"); }); -} -window.addEventListener("load", onLoad); +}); diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index 2570bca308..49e64b91ab 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -29,12 +29,12 @@ var marketplaceWindow = new OverlayWebWindow({ }); marketplaceWindow.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL); marketplaceWindow.webEventReceived.connect(function (data) { - if (data === "INJECT_CLARA") { - marketplaceWindow.setScriptURL(MARKETPLACES_CLARA_SCRIPT_URL); - } if (data === "INJECT_HIFI") { marketplaceWindow.setScriptURL(MARKETPLACES_HFIF_SCRIPT_URL); } + if (data === "INJECT_CLARA") { + marketplaceWindow.setScriptURL(MARKETPLACES_CLARA_SCRIPT_URL); + } if (data === "RELOAD_DIRECTORY") { marketplaceWindow.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL); marketplaceWindow.setURL(MARKETPLACES_URL); @@ -47,7 +47,7 @@ var TOOLBAR_MARGIN_Y = 0; var marketplaceVisible = false; var marketplaceWebTablet; -// We persist clientOnly data in the .ini file, and reconsistitute it on restart. +// We persist clientOnly data in the .ini file, and reconstitute it on restart. // To keep things consistent, we pickle the tablet data in Settings, and kill any existing such on restart and domain change. var persistenceKey = "io.highfidelity.lastDomainTablet"; @@ -65,12 +65,12 @@ function showMarketplace(marketplaceID) { Settings.setValue(persistenceKey, marketplaceWebTablet.pickle()); marketplaceWebTablet.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL); marketplaceWebTablet.getOverlayObject().webEventReceived.connect(function (data) { - if (data === "INJECT_CLARA") { - marketplaceWebTablet.setScriptURL(MARKETPLACES_CLARA_SCRIPT_URL); - } if (data === "INJECT_HIFI") { marketplaceWebTablet.setScriptURL(MARKETPLACES_HFIF_SCRIPT_URL); } + if (data === "INJECT_CLARA") { + marketplaceWebTablet.setScriptURL(MARKETPLACES_CLARA_SCRIPT_URL); + } if (data === "RELOAD_DIRECTORY") { marketplaceWebTablet.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL); marketplaceWebTablet.setURL(""); // Force reload of URL.