From dc79d3262a979f268753fbb861377880e22bc1ba Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Wed, 9 Mar 2016 15:50:33 -0800 Subject: [PATCH 1/5] Update glyphs font --- .../qml/styles-uit/HifiConstants.qml | 131 +++++++++++++----- 1 file changed, 100 insertions(+), 31 deletions(-) diff --git a/interface/resources/qml/styles-uit/HifiConstants.qml b/interface/resources/qml/styles-uit/HifiConstants.qml index 32cf61117b..09cba6d462 100644 --- a/interface/resources/qml/styles-uit/HifiConstants.qml +++ b/interface/resources/qml/styles-uit/HifiConstants.qml @@ -35,7 +35,7 @@ Item { glyph = hifi.glyphs.alert; break; case hifi.icons.critical: - glyph = hifi.glyphs.critical; + glyph = hifi.glyphs.error; break; case hifi.icons.placemark: glyph = hifi.glyphs.placemark; @@ -159,36 +159,6 @@ Item { readonly property real disclosureButton: dimensions.largeScreen ? 20 : 15 } - Item { - id: glyphs - readonly property string alert: "+" - readonly property string backward: "E" - readonly property string caratDn: "5" - readonly property string caratR: "3" - readonly property string caratUp: "6" - readonly property string close: "w" - readonly property string closeInverted: "x" - readonly property string closeSmall: "C" - readonly property string critical: "=" - readonly property string disclosureButtonCollapse: "M" - readonly property string disclosureButtonExpand: "L" - readonly property string disclosureCollapse: "Z" - readonly property string disclosureExpand: "B" - readonly property string forward: "D" - readonly property string info: "[" - readonly property string noIcon: "" - readonly property string pin: "y" - readonly property string pinInverted: "z" - readonly property string placemark: "U" - readonly property string question: "]" - readonly property string reloadSmall: "a" - readonly property string resizeHandle: "A" - readonly property string upload: "j" - readonly property string reload: "a" - readonly property string back: "1" - - } - Item { id: icons // Values per OffscreenUi::Icon @@ -221,4 +191,103 @@ Item { id: effects readonly property int fadeInDuration: 300 } + Item { + id: glyphs + readonly property string noIcon: "" + readonly property string hmd: "b" + readonly property string screen: "c" + readonly property string keyboard: "d" + readonly property string handControllers: "e" + readonly property string headphonesMic: "f" + readonly property string gamepad: "g" + readonly property string headphones: "h" + readonly property string mic: "i" + readonly property string upload: "j" + readonly property string script: "k" + readonly property string text: "l" + readonly property string cube: "m" + readonly property string sphere: "n" + readonly property string zone: "o" + readonly property string light: "p" + readonly property string web: "q" + readonly property string web2: "r" + readonly property string edit: "s" + readonly property string market: "t" + readonly property string directory: "u" + readonly property string menu: "v" + readonly property string close: "w" + readonly property string closeInverted: "x" + readonly property string pin: "y" + readonly property string pinInverted: "z" + readonly property string resizeHandle: "A" + readonly property string disclosureExpand: "B" + readonly property string reloadSmall: "a" + readonly property string closeSmall: "C" + readonly property string forward: "D" + readonly property string backward: "E" + readonly property string reload: "F" + readonly property string unmuted: "G" + readonly property string muted: "H" + readonly property string minimize: "I" + readonly property string maximize: "J" + readonly property string maximizeInverted: "K" + readonly property string disclosureButtonExpand: "L" + readonly property string disclosureButtonCollapse: "M" + readonly property string scriptStop: "N" + readonly property string scriptReload: "O" + readonly property string scriptRun: "P" + readonly property string scriptNew: "Q" + readonly property string hifiForum: "2" + readonly property string hifiLogoSmall: "S" + readonly property string avatar1: "T" + readonly property string placemark: "U" + readonly property string box: "V" + readonly property string community: "0" + readonly property string grabHandle: "X" + readonly property string search: "Y" + readonly property string disclosureCollapse: "Z" + readonly property string scriptUpload: "R" + readonly property string code: "W" + readonly property string avatar: "<" + readonly property string arrowsH: ":" + readonly property string arrowsV: ";" + readonly property string arrows: "`" + readonly property string compress: "!" + readonly property string expand: "\"" + readonly property string placemark1: "#" + readonly property string circle: "$" + readonly property string handPointer: "9" + readonly property string plusSquareO: "%" + readonly property string sliders: "&" + readonly property string square: "'" + readonly property string alignCenter: "8" + readonly property string alignJustify: ")" + readonly property string alignLeft: "*" + readonly property string alignRight: "^" + readonly property string bars: "7" + readonly property string circleSlash: "," + readonly property string sync: "()" + readonly property string key: "-" + readonly property string link: "." + readonly property string location: "/" + readonly property string caratR: "3" + readonly property string caratL: "4" + readonly property string caratDn: "5" + readonly property string caratUp: "6" + readonly property string folderLg: ">" + readonly property string folderSm: "?" + readonly property string levelUp: "1" + readonly property string info: "[" + readonly property string question: "]" + readonly property string alert: "+" + readonly property string home: "_" + readonly property string error: "=" + readonly property string settings: "@" + readonly property string trash: "{" + readonly property string objectGroup: "" + readonly property string cm: "}" + readonly property string msvg79: "~" + readonly property string deg: "\\" + readonly property string px: "|" + } } From 7d7a683b18ae9f623b8b379e2076f6ccfdcdaeb6 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 10 Mar 2016 13:33:36 -0800 Subject: [PATCH 2/5] Add uploadFile method that prompts the user --- interface/resources/qml/AssetServer.qml | 18 ++-- .../resources/qml/dialogs/QueryDialog.qml | 4 +- interface/src/Application.cpp | 2 +- .../AssetMappingsScriptingInterface.cpp | 84 ++++++++++++++----- .../AssetMappingsScriptingInterface.h | 1 + libraries/networking/src/MappingRequest.h | 1 + 6 files changed, 74 insertions(+), 36 deletions(-) rename {libraries/script-engine/src => interface/src/scripting}/AssetMappingsScriptingInterface.cpp (76%) rename {libraries/script-engine/src => interface/src/scripting}/AssetMappingsScriptingInterface.h (96%) diff --git a/interface/resources/qml/AssetServer.qml b/interface/resources/qml/AssetServer.qml index 32e0a3b8ee..eacbd15ec5 100644 --- a/interface/resources/qml/AssetServer.qml +++ b/interface/resources/qml/AssetServer.qml @@ -159,7 +159,7 @@ Window { var object = desktop.inputDialog({ label: "Enter new path:", - prefilledText: path, + current: path, placeholderText: "Enter path here" }); object.selected.connect(function(destinationPath) { @@ -220,18 +220,12 @@ Window { var directory = path ? path.slice(0, path.lastIndexOf('/') + 1) : ""; var filename = fileUrl.slice(fileUrl.lastIndexOf('/') + 1); - var object = desktop.inputDialog({ - label: "Enter asset path:", - prefilledText: directory + filename, - placeholderText: "Enter path here" - }); - object.selected.connect(function(destinationPath) { - if (fileExists(destinationPath)) { - askForOverride(fileUrl, function() { - doUploadFile(fileUrl, destinationPath, addToWorld); - }); + Assets.uploadFile(fileUrl, directory + filename, function(err) { + if (err) { + console.log("Error uploading: ", fileUrl, " - error ", err); + errorMessage("There was an error uploading:\n" + fileUrl + "\n\nPlease try again."); } else { - doUploadFile(fileUrl, destinationPath, addToWorld); + console.log("Finished uploading: ", fileUrl); } }); } diff --git a/interface/resources/qml/dialogs/QueryDialog.qml b/interface/resources/qml/dialogs/QueryDialog.qml index 754851030c..48df9a41ce 100644 --- a/interface/resources/qml/dialogs/QueryDialog.qml +++ b/interface/resources/qml/dialogs/QueryDialog.qml @@ -34,12 +34,10 @@ ModalWindow { property var items; property string label property var result; - // FIXME not current honored - property var current; + property alias current: textResult.text // For text boxes property alias placeholderText: textResult.placeholderText - property alias prefilledText: textResult.text // For combo boxes property bool editable: true; diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2660acfa00..e8b2384bbf 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -66,7 +66,6 @@ #include #include #include -#include #include #include #include @@ -142,6 +141,7 @@ #include "ModelPackager.h" #include "PluginContainerProxy.h" #include "scripting/AccountScriptingInterface.h" +#include "scripting/AssetMappingsScriptingInterface.h" #include "scripting/AudioDeviceScriptingInterface.h" #include "scripting/ClipboardScriptingInterface.h" #include "scripting/DesktopScriptingInterface.h" diff --git a/libraries/script-engine/src/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp similarity index 76% rename from libraries/script-engine/src/AssetMappingsScriptingInterface.cpp rename to interface/src/scripting/AssetMappingsScriptingInterface.cpp index a843094df3..b4f9458551 100644 --- a/libraries/script-engine/src/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -12,11 +12,13 @@ #include "AssetMappingsScriptingInterface.h" #include +#include #include #include #include #include +#include AssetMappingsScriptingInterface::AssetMappingsScriptingInterface() { _proxyModel.setSourceModel(&_assetMappingModel); @@ -51,12 +53,12 @@ void AssetMappingsScriptingInterface::setMapping(QString path, QString hash, QJS auto request = assetClient->createSetMappingRequest(path, hash); connect(request, &SetMappingRequest::finished, this, [this, callback](SetMappingRequest* request) mutable { - QJSValueList args { uint8_t(request->getError()) }; - - callback.call(args); + if (callback.isCallable()) { + QJSValueList args { uint8_t(request->getError()) }; + callback.call(args); + } request->deleteLater(); - }); request->start(); @@ -67,28 +69,70 @@ void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback auto request = assetClient->createGetMappingRequest(path); connect(request, &GetMappingRequest::finished, this, [this, callback](GetMappingRequest* request) mutable { - QJSValueList args { uint8_t(request->getError()), request->getHash() }; - - callback.call(args); + if (callback.isCallable()) { + QJSValueList args { uint8_t(request->getError()) }; + callback.call(args); + } request->deleteLater(); - }); request->start(); } +void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, QJSValue callback) { + QFile file(path); + if (!file.open(QFile::ReadOnly)) { + qCWarning(asset_client) << "Error uploading file to asset server:\n" + << "Could not open" << qPrintable(path); + OffscreenUi::warning("File Error", "Could not open file: " + path, QMessageBox::Ok); + return; + } + + auto offscreenUi = DependencyManager::get(); + auto result = offscreenUi->inputDialog(OffscreenUi::ICON_NONE, "Enter asset path:", "", mapping); + if (!result.isValid()) { + return; + } + + // Check for override + if (isKnownMapping(result.toString())) { + auto message = "The following file already exists:\n" + path + "\nDo you want to override it?"; + auto button = offscreenUi->messageBox(OffscreenUi::ICON_QUESTION, "", message, + QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + if (button == QMessageBox::No) { + return; + } + } + + auto upload = DependencyManager::get()->createUpload(file.readAll()); + QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable { + if (upload->getError() != AssetUpload::NoError) { + if (callback.isCallable()) { + QJSValueList args { uint8_t(upload->getError()) }; + callback.call(args); + } + } else { + setMapping(mapping, hash, callback); + } + + upload->deleteLater(); + }); + + upload->start(); +} + void AssetMappingsScriptingInterface::deleteMappings(QStringList paths, QJSValue callback) { auto assetClient = DependencyManager::get(); auto request = assetClient->createDeleteMappingsRequest(paths); connect(request, &DeleteMappingsRequest::finished, this, [this, callback](DeleteMappingsRequest* request) mutable { - QJSValueList args { uint8_t(request->getError()) }; - - callback.call(args); + if (callback.isCallable()) { + QJSValueList args { uint8_t(request->getError()) }; + callback.call(args); + } request->deleteLater(); - }); request->start(); @@ -106,12 +150,12 @@ void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) { map.setProperty(kv.first, kv.second); } - QJSValueList args { uint8_t(request->getError()), map }; - - callback.call(args); + if (callback.isCallable()) { + QJSValueList args { uint8_t(request->getError()) }; + callback.call(args); + } request->deleteLater(); - }); request->start(); @@ -122,12 +166,12 @@ void AssetMappingsScriptingInterface::renameMapping(QString oldPath, QString new auto request = assetClient->createRenameMappingRequest(oldPath, newPath); connect(request, &RenameMappingRequest::finished, this, [this, callback](RenameMappingRequest* request) mutable { - QJSValueList args { uint8_t(request->getError()) }; - - callback.call(args); + if (callback.isCallable()) { + QJSValueList args { uint8_t(request->getError()) }; + callback.call(args); + } request->deleteLater(); - }); request->start(); diff --git a/libraries/script-engine/src/AssetMappingsScriptingInterface.h b/interface/src/scripting/AssetMappingsScriptingInterface.h similarity index 96% rename from libraries/script-engine/src/AssetMappingsScriptingInterface.h rename to interface/src/scripting/AssetMappingsScriptingInterface.h index 3458da949a..f1198ef17d 100644 --- a/libraries/script-engine/src/AssetMappingsScriptingInterface.h +++ b/interface/src/scripting/AssetMappingsScriptingInterface.h @@ -61,6 +61,7 @@ public: Q_INVOKABLE void setMapping(QString path, QString hash, QJSValue callback); Q_INVOKABLE void getMapping(QString path, QJSValue callback); + Q_INVOKABLE void uploadFile(QString path, QString mapping, QJSValue callback = QJSValue()); Q_INVOKABLE void deleteMappings(QStringList paths, QJSValue callback); Q_INVOKABLE void deleteMapping(QString path, QJSValue callback) { deleteMappings(QStringList(path), callback); } Q_INVOKABLE void getAllMappings(QJSValue callback); diff --git a/libraries/networking/src/MappingRequest.h b/libraries/networking/src/MappingRequest.h index c6a27e0274..504a0cb2fa 100644 --- a/libraries/networking/src/MappingRequest.h +++ b/libraries/networking/src/MappingRequest.h @@ -64,6 +64,7 @@ class SetMappingRequest : public MappingRequest { public: SetMappingRequest(const AssetPath& path, const AssetHash& hash); + AssetPath getPath() const { return _path; } AssetHash getHash() const { return _hash; } signals: From 548d826a4e58d6a95db92de16febec17a226706c Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 10 Mar 2016 14:04:52 -0800 Subject: [PATCH 3/5] Couple bug fixes --- interface/resources/qml/AssetServer.qml | 4 +++- interface/src/Application.cpp | 3 +-- .../scripting/AssetMappingsScriptingInterface.cpp | 15 ++++----------- .../scripting/AssetMappingsScriptingInterface.h | 2 +- libraries/networking/src/MappingRequest.cpp | 2 +- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/interface/resources/qml/AssetServer.qml b/interface/resources/qml/AssetServer.qml index eacbd15ec5..1220f288f7 100644 --- a/interface/resources/qml/AssetServer.qml +++ b/interface/resources/qml/AssetServer.qml @@ -217,7 +217,7 @@ Window { var addToWorld = addToWorldCheckBox.checked var path = assetProxyModel.data(treeView.currentIndex, 0x100); - var directory = path ? path.slice(0, path.lastIndexOf('/') + 1) : ""; + var directory = path ? path.slice(0, path.lastIndexOf('/') + 1) : "/"; var filename = fileUrl.slice(fileUrl.lastIndexOf('/') + 1); Assets.uploadFile(fileUrl, directory + filename, function(err) { @@ -227,6 +227,8 @@ Window { } else { console.log("Finished uploading: ", fileUrl); } + + reload(); }); } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e8b2384bbf..a8e64513ee 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -426,7 +426,6 @@ bool setupEssentials(int& argc, char** argv) { DependencyManager::set(); DependencyManager::set(); DependencyManager::set(); - DependencyManager::set(); DependencyManager::set(); DependencyManager::set(true, qApp, qApp); DependencyManager::set(); @@ -1296,7 +1295,7 @@ void Application::initializeUi() { rootContext->setContextProperty("Quat", new Quat()); rootContext->setContextProperty("Vec3", new Vec3()); rootContext->setContextProperty("Uuid", new ScriptUUID()); - rootContext->setContextProperty("Assets", DependencyManager::get().data()); + rootContext->setContextProperty("Assets", new AssetMappingsScriptingInterface()); rootContext->setContextProperty("AvatarList", DependencyManager::get().data()); diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp index b4f9458551..ea763210c9 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -81,22 +81,15 @@ void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback } void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, QJSValue callback) { - QFile file(path); - if (!file.open(QFile::ReadOnly)) { - qCWarning(asset_client) << "Error uploading file to asset server:\n" - << "Could not open" << qPrintable(path); - OffscreenUi::warning("File Error", "Could not open file: " + path, QMessageBox::Ok); - return; - } - auto offscreenUi = DependencyManager::get(); auto result = offscreenUi->inputDialog(OffscreenUi::ICON_NONE, "Enter asset path:", "", mapping); if (!result.isValid()) { return; } + mapping = result.toString(); // Check for override - if (isKnownMapping(result.toString())) { + if (isKnownMapping(mapping)) { auto message = "The following file already exists:\n" + path + "\nDo you want to override it?"; auto button = offscreenUi->messageBox(OffscreenUi::ICON_QUESTION, "", message, QMessageBox::Yes | QMessageBox::No, QMessageBox::No); @@ -105,7 +98,7 @@ void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, } } - auto upload = DependencyManager::get()->createUpload(file.readAll()); + auto upload = DependencyManager::get()->createUpload(path); QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable { if (upload->getError() != AssetUpload::NoError) { if (callback.isCallable()) { @@ -242,7 +235,7 @@ void AssetMappingModel::refresh() { auto it = existingPaths.begin(); while (it != existingPaths.end()) { auto item = _pathToItemMap[*it]; - if (item->data(Qt::UserRole + 1).toBool()) { + if (item && item->data(Qt::UserRole + 1).toBool()) { it = existingPaths.erase(it); } else { ++it; diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.h b/interface/src/scripting/AssetMappingsScriptingInterface.h index f1198ef17d..2ad7da7c94 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.h +++ b/interface/src/scripting/AssetMappingsScriptingInterface.h @@ -45,7 +45,7 @@ }; -class AssetMappingsScriptingInterface : public QObject, public Dependency { +class AssetMappingsScriptingInterface : public QObject { Q_OBJECT Q_PROPERTY(AssetMappingModel* mappingModel READ getAssetMappingModel CONSTANT) Q_PROPERTY(QAbstractProxyModel* proxyModel READ getProxyModel CONSTANT) diff --git a/libraries/networking/src/MappingRequest.cpp b/libraries/networking/src/MappingRequest.cpp index 6f76d1103f..2cc28c03be 100644 --- a/libraries/networking/src/MappingRequest.cpp +++ b/libraries/networking/src/MappingRequest.cpp @@ -109,7 +109,7 @@ void SetMappingRequest::doStart() { auto validPath = isValidPath(_path); auto validHash = isValidHash(_hash); if (!validPath || !validHash) { - _error = validPath ? MappingRequest::InvalidPath : MappingRequest::InvalidHash; + _error = !validPath ? MappingRequest::InvalidPath : MappingRequest::InvalidHash; emit finished(this); return; } From 63571a7c36d424dffa0157e67b3da2ea23d81787 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 10 Mar 2016 14:57:02 -0800 Subject: [PATCH 4/5] Make sure Upload is not clicked several times --- interface/resources/qml/AssetServer.qml | 7 +++++++ .../src/scripting/AssetMappingsScriptingInterface.cpp | 1 + 2 files changed, 8 insertions(+) diff --git a/interface/resources/qml/AssetServer.qml b/interface/resources/qml/AssetServer.qml index 1220f288f7..0490db2fa7 100644 --- a/interface/resources/qml/AssetServer.qml +++ b/interface/resources/qml/AssetServer.qml @@ -212,7 +212,13 @@ Window { }); } + property var uploadOpen: false; function uploadClicked() { + if(uploadOpen) { + return; + } + uploadOpen = true; + var fileUrl = fileUrlTextField.text var addToWorld = addToWorldCheckBox.checked @@ -230,6 +236,7 @@ Window { reload(); }); + uploadOpen = false; } function errorMessageBox(message) { diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp index ea763210c9..9934b7937c 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -83,6 +83,7 @@ void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, QJSValue callback) { auto offscreenUi = DependencyManager::get(); auto result = offscreenUi->inputDialog(OffscreenUi::ICON_NONE, "Enter asset path:", "", mapping); + if (!result.isValid()) { return; } From a6ccfb1685e75f77f6dfa3f39699cf44c83c6517 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 10 Mar 2016 15:03:25 -0800 Subject: [PATCH 5/5] CR --- interface/resources/qml/AssetServer.qml | 2 +- .../src/scripting/AssetMappingsScriptingInterface.cpp | 4 ++-- .../src/scripting/AssetMappingsScriptingInterface.h | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/interface/resources/qml/AssetServer.qml b/interface/resources/qml/AssetServer.qml index 0490db2fa7..c4855b7704 100644 --- a/interface/resources/qml/AssetServer.qml +++ b/interface/resources/qml/AssetServer.qml @@ -214,7 +214,7 @@ Window { property var uploadOpen: false; function uploadClicked() { - if(uploadOpen) { + if (uploadOpen) { return; } uploadOpen = true; diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp index 9934b7937c..2839a0a9f6 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -91,8 +91,8 @@ void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, // Check for override if (isKnownMapping(mapping)) { - auto message = "The following file already exists:\n" + path + "\nDo you want to override it?"; - auto button = offscreenUi->messageBox(OffscreenUi::ICON_QUESTION, "", message, + auto message = path + "\n" + "This file already exists. Do you want to overwrite it?"; + auto button = offscreenUi->messageBox(OffscreenUi::ICON_QUESTION, "Overwrite File", message, QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (button == QMessageBox::No) { return; diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.h b/interface/src/scripting/AssetMappingsScriptingInterface.h index 2ad7da7c94..3a7711b340 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.h +++ b/interface/src/scripting/AssetMappingsScriptingInterface.h @@ -59,13 +59,13 @@ public: Q_INVOKABLE QString getErrorString(int errorCode) const; - Q_INVOKABLE void setMapping(QString path, QString hash, QJSValue callback); - Q_INVOKABLE void getMapping(QString path, QJSValue callback); + Q_INVOKABLE void setMapping(QString path, QString hash, QJSValue callback = QJSValue()); + Q_INVOKABLE void getMapping(QString path, QJSValue callback = QJSValue()); Q_INVOKABLE void uploadFile(QString path, QString mapping, QJSValue callback = QJSValue()); Q_INVOKABLE void deleteMappings(QStringList paths, QJSValue callback); - Q_INVOKABLE void deleteMapping(QString path, QJSValue callback) { deleteMappings(QStringList(path), callback); } - Q_INVOKABLE void getAllMappings(QJSValue callback); - Q_INVOKABLE void renameMapping(QString oldPath, QString newPath, QJSValue callback); + Q_INVOKABLE void deleteMapping(QString path, QJSValue callback) { deleteMappings(QStringList(path), callback = QJSValue()); } + Q_INVOKABLE void getAllMappings(QJSValue callback = QJSValue()); + Q_INVOKABLE void renameMapping(QString oldPath, QString newPath, QJSValue callback = QJSValue()); protected: QSet _pendingRequests;