This commit is contained in:
David Rowe 2016-12-07 09:28:35 +13:00
parent d857f943f8
commit 8e30674069
4 changed files with 19 additions and 21 deletions

View file

@ -5526,7 +5526,7 @@ void Application::addAssetToWorld(QString filePath) {
if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) { if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) {
QString errorInfo = "Do not have permissions to write to asset server."; 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); addAssetToWorldError(errorInfo);
return; return;
} }
@ -5551,7 +5551,7 @@ void Application::addAssetToWorldWithNewMapping(QString path, QString mapping, i
} else if (result != GetMappingRequest::NoError) { } else if (result != GetMappingRequest::NoError) {
QString errorInfo = "Could not map asset name: " QString errorInfo = "Could not map asset name: "
+ mapping.left(mapping.length() - QString::number(copy).length() - 1); + mapping.left(mapping.length() - QString::number(copy).length() - 1);
qCDebug(interfaceapp) << "Error downloading asset: " + errorInfo; qWarning(interfaceapp) << "Error downloading asset: " + errorInfo;
addAssetToWorldError(errorInfo); addAssetToWorldError(errorInfo);
} else if (copy < MAX_COPY_COUNT - 1) { } else if (copy < MAX_COPY_COUNT - 1) {
if (copy > 0) { if (copy > 0) {
@ -5563,7 +5563,7 @@ void Application::addAssetToWorldWithNewMapping(QString path, QString mapping, i
} else { } else {
QString errorInfo = "Too many copies of asset name: " QString errorInfo = "Too many copies of asset name: "
+ mapping.left(mapping.length() - QString::number(copy).length() - 1); + mapping.left(mapping.length() - QString::number(copy).length() - 1);
qCDebug(interfaceapp) << "Error downloading asset: " + errorInfo; qWarning(interfaceapp) << "Error downloading asset: " + errorInfo;
addAssetToWorldError(errorInfo); addAssetToWorldError(errorInfo);
} }
request->deleteLater(); 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 { QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
if (upload->getError() != AssetUpload::NoError) { if (upload->getError() != AssetUpload::NoError) {
QString errorInfo = "Could not upload asset to asset server."; QString errorInfo = "Could not upload asset to asset server.";
qCDebug(interfaceapp) << "Error downloading asset: " + errorInfo; qWarning(interfaceapp) << "Error downloading asset: " + errorInfo;
addAssetToWorldError(errorInfo); addAssetToWorldError(errorInfo);
} else { } else {
addAssetToWorldSetMapping(mapping, hash); addAssetToWorldSetMapping(mapping, hash);
@ -5610,7 +5610,7 @@ void Application::addAssetToWorldSetMapping(QString mapping, QString hash) {
connect(request, &SetMappingRequest::finished, this, [=](SetMappingRequest* request) mutable { connect(request, &SetMappingRequest::finished, this, [=](SetMappingRequest* request) mutable {
if (request->getError() != SetMappingRequest::NoError) { if (request->getError() != SetMappingRequest::NoError) {
QString errorInfo = "Could not set asset mapping."; QString errorInfo = "Could not set asset mapping.";
qCDebug(interfaceapp) << "Error downloading asset: " + errorInfo; qWarning(interfaceapp) << "Error downloading asset: " + errorInfo;
addAssetToWorldError(errorInfo); addAssetToWorldError(errorInfo);
} else { } else {
addAssetToWorldAddEntity(mapping); addAssetToWorldAddEntity(mapping);
@ -5637,12 +5637,12 @@ void Application::addAssetToWorldAddEntity(QString mapping) {
auto result = DependencyManager::get<EntityScriptingInterface>()->addEntity(properties); auto result = DependencyManager::get<EntityScriptingInterface>()->addEntity(properties);
if (result == QUuid()) { if (result == QUuid()) {
QString errorInfo = "Could not add downloaded asset " + mapping + " to world."; QString errorInfo = "Could not add asset " + mapping + " to world.";
qCDebug(interfaceapp) << "Error downloading asset: " + errorInfo; qWarning(interfaceapp) << "Could not add asset to world: " + errorInfo;
addAssetToWorldError(errorInfo); addAssetToWorldError(errorInfo);
} else { } else {
QString successInfo = "Downloaded asset " + mapping + " added to world."; QString successInfo = mapping + " added to world.";
qCDebug(interfaceapp) << "Downloading asset completed: " + successInfo; qInfo() << "Downloading asset completed: " + successInfo;
_addAssetToWorldMessageBox->setProperty("text", successInfo); _addAssetToWorldMessageBox->setProperty("text", successInfo);
_addAssetToWorldMessageBox->setProperty("buttons", QMessageBox::Ok); _addAssetToWorldMessageBox->setProperty("buttons", QMessageBox::Ok);
_addAssetToWorldMessageBox->setProperty("defaultButton", QMessageBox::Ok); _addAssetToWorldMessageBox->setProperty("defaultButton", QMessageBox::Ok);

View file

@ -80,7 +80,6 @@ bool FileScriptingInterface::isZipped(QUrl url) {
return (url.toString().endsWith(".zip")); return (url.toString().endsWith(".zip"));
} }
// this function is not in use
QString FileScriptingInterface::getTempDir() { QString FileScriptingInterface::getTempDir() {
QTemporaryDir dir; QTemporaryDir dir;
dir.setAutoRemove(false); dir.setAutoRemove(false);
@ -106,7 +105,6 @@ void FileScriptingInterface::downloadZip(QString path, const QString link) {
request->send(); request->send();
} }
QString FileScriptingInterface::unzipFile(QString path, QString tempDir) { QString FileScriptingInterface::unzipFile(QString path, QString tempDir) {
QDir dir(path); QDir dir(path);

View file

@ -10,7 +10,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // 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. // Supporting styles from marketplaces.css.
// Glyph font family, size, and spacing adjusted because HiFi-Glyphs cannot be used cross-domain. // Glyph font family, size, and spacing adjusted because HiFi-Glyphs cannot be used cross-domain.
$("head").append( $("head").append(
@ -46,6 +47,5 @@ function onLoad() {
$("#marketplace-content").attr("src", "marketplacesDirectory.html"); $("#marketplace-content").attr("src", "marketplacesDirectory.html");
EventBridge.emitWebEvent("RELOAD_DIRECTORY"); EventBridge.emitWebEvent("RELOAD_DIRECTORY");
}); });
}
window.addEventListener("load", onLoad); });

View file

@ -29,12 +29,12 @@ var marketplaceWindow = new OverlayWebWindow({
}); });
marketplaceWindow.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL); marketplaceWindow.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL);
marketplaceWindow.webEventReceived.connect(function (data) { marketplaceWindow.webEventReceived.connect(function (data) {
if (data === "INJECT_CLARA") {
marketplaceWindow.setScriptURL(MARKETPLACES_CLARA_SCRIPT_URL);
}
if (data === "INJECT_HIFI") { if (data === "INJECT_HIFI") {
marketplaceWindow.setScriptURL(MARKETPLACES_HFIF_SCRIPT_URL); marketplaceWindow.setScriptURL(MARKETPLACES_HFIF_SCRIPT_URL);
} }
if (data === "INJECT_CLARA") {
marketplaceWindow.setScriptURL(MARKETPLACES_CLARA_SCRIPT_URL);
}
if (data === "RELOAD_DIRECTORY") { if (data === "RELOAD_DIRECTORY") {
marketplaceWindow.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL); marketplaceWindow.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL);
marketplaceWindow.setURL(MARKETPLACES_URL); marketplaceWindow.setURL(MARKETPLACES_URL);
@ -47,7 +47,7 @@ var TOOLBAR_MARGIN_Y = 0;
var marketplaceVisible = false; var marketplaceVisible = false;
var marketplaceWebTablet; 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. // 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"; var persistenceKey = "io.highfidelity.lastDomainTablet";
@ -65,12 +65,12 @@ function showMarketplace(marketplaceID) {
Settings.setValue(persistenceKey, marketplaceWebTablet.pickle()); Settings.setValue(persistenceKey, marketplaceWebTablet.pickle());
marketplaceWebTablet.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL); marketplaceWebTablet.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL);
marketplaceWebTablet.getOverlayObject().webEventReceived.connect(function (data) { marketplaceWebTablet.getOverlayObject().webEventReceived.connect(function (data) {
if (data === "INJECT_CLARA") {
marketplaceWebTablet.setScriptURL(MARKETPLACES_CLARA_SCRIPT_URL);
}
if (data === "INJECT_HIFI") { if (data === "INJECT_HIFI") {
marketplaceWebTablet.setScriptURL(MARKETPLACES_HFIF_SCRIPT_URL); marketplaceWebTablet.setScriptURL(MARKETPLACES_HFIF_SCRIPT_URL);
} }
if (data === "INJECT_CLARA") {
marketplaceWebTablet.setScriptURL(MARKETPLACES_CLARA_SCRIPT_URL);
}
if (data === "RELOAD_DIRECTORY") { if (data === "RELOAD_DIRECTORY") {
marketplaceWebTablet.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL); marketplaceWebTablet.setScriptURL(MARKETPLACES_DIRECTORY_SCRIPT_URL);
marketplaceWebTablet.setURL(""); // Force reload of URL. marketplaceWebTablet.setURL(""); // Force reload of URL.