History

Handle unzip failure

David Rowe committed 9 years ago

Commit e9dbb321 parent 77676434 files · +22 −11Browse files

Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all

Unified · Split

interface/src/Application.cpp+15−5
@@ -1891,7 +1891,7 @@ void Application::initializeUi() { · 1890 unmodified lines
18911891 rootContext->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data());
18921892 _fileDownload = new FileScriptingInterface(engine);
18931893 rootContext->setContextProperty("File", _fileDownload);
1894− connect(_fileDownload, &FileScriptingInterface::unzipSuccess, this, &Application::handleUnzip);
1894+ connect(_fileDownload, &FileScriptingInterface::unzipResult, this, &Application::handleUnzip);
18951895 rootContext->setContextProperty("MyAvatar", getMyAvatar().get());
18961896 rootContext->setContextProperty("Messages", DependencyManager::get<MessagesClient>().data());
18971897 rootContext->setContextProperty("Recording", DependencyManager::get<RecordingScriptingInterface>().data());
@@ -5649,6 +5649,12 @@ void Application::addAssetToWorldFromURLRequestFinished() { · 3751 unmodified lines
56495649 request->deleteLater();
56505650 }
56515651
5652+void Application::addAssetToWorldUnzipFailure(QString filePath) {
5653+ QString filename = filePath.right(filePath.length() - filePath.lastIndexOf("/") - 1);
5654+ qWarning(interfaceapp) << "Couldn't unzip file" << filePath;
5655+ addAssetToWorldError(filename, "Couldn't unzip file " + filename + ".");
5656+}
5657+
56525658 void Application::addAssetToWorld(QString filePath) {
56535659 // Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().
56545660
@@ -6020,11 +6026,15 @@ void Application::addAssetToWorldMessageClose() { · 365 unmodified lines
60206026 }
60216027
60226028
6023−void Application::handleUnzip(QString filePath, bool autoAdd) {
6024− if (autoAdd && !filePath.isEmpty()) {
6025− addAssetToWorld(filePath);
6029+void Application::handleUnzip(QString zipFile, QString unzipFile, bool autoAdd) {
6030+ if (autoAdd) {
6031+ if (!unzipFile.isEmpty()) {
6032+ addAssetToWorld(unzipFile);
6033+ } else {
6034+ addAssetToWorldUnzipFailure(zipFile);
6035+ }
60266036 } else {
6027− showAssetServerWidget(filePath);
6037+ showAssetServerWidget(unzipFile);
60286038 }
60296039 }
60306040