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
1891 rootContext->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data());1891 rootContext->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data());
1892 _fileDownload = new FileScriptingInterface(engine);1892 _fileDownload = new FileScriptingInterface(engine);
1893 rootContext->setContextProperty("File", _fileDownload);1893 rootContext->setContextProperty("File", _fileDownload);
1894 connect(_fileDownload, &FileScriptingInterface::unzipSuccess, this, &Application::handleUnzip);1894 connect(_fileDownload, &FileScriptingInterface::unzipResult, this, &Application::handleUnzip);
1895 rootContext->setContextProperty("MyAvatar", getMyAvatar().get());1895 rootContext->setContextProperty("MyAvatar", getMyAvatar().get());
1896 rootContext->setContextProperty("Messages", DependencyManager::get<MessagesClient>().data());1896 rootContext->setContextProperty("Messages", DependencyManager::get<MessagesClient>().data());
1897 rootContext->setContextProperty("Recording", DependencyManager::get<RecordingScriptingInterface>().data());1897 rootContext->setContextProperty("Recording", DependencyManager::get<RecordingScriptingInterface>().data());
@@ -5649,6 +5649,12 @@ void Application::addAssetToWorldFromURLRequestFinished() { · 3751 unmodified lines
5649 request->deleteLater();5649 request->deleteLater();
5650}5650}
5651 5651
5652void 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
5652void Application::addAssetToWorld(QString filePath) {5658void Application::addAssetToWorld(QString filePath) {
5653 // Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().5659 // Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().
5654 5660
@@ -6020,11 +6026,15 @@ void Application::addAssetToWorldMessageClose() { · 365 unmodified lines
6020}6026}
6021 6027
6022 6028
6023void Application::handleUnzip(QString filePath, bool autoAdd) {6029void Application::handleUnzip(QString zipFile, QString unzipFile, bool autoAdd) {
6024 if (autoAdd && !filePath.isEmpty()) {6030 if (autoAdd) {
6025 addAssetToWorld(filePath);6031 if (!unzipFile.isEmpty()) {
6032 addAssetToWorld(unzipFile);
6033 } else {
6034 addAssetToWorldUnzipFailure(zipFile);
6035 }
6026 } else {6036 } else {
6027 showAssetServerWidget(filePath);6037 showAssetServerWidget(unzipFile);
6028 }6038 }
6029}6039}
6030 6040