Showing the changes to libraries/script-engine/src/FileScriptingInterface.cpp (1 of 45 files). Show all
Unified · Split
| @@ -32,7 +32,7 @@ FileScriptingInterface::FileScriptingInterface(QObject* parent) : QObject(parent · 31 unmodified lines | ||
| 32 | 32 | // nothing for now |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | −void FileScriptingInterface::runUnzip(QString path, QUrl url) { | |
| 35 | +void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd) { | |
| 36 | 36 | qCDebug(scriptengine) << "Url that was downloaded: " + url.toString(); |
| 37 | 37 | qCDebug(scriptengine) << "Path where download is saved: " + path; |
| 38 | 38 | QString fileName = "/" + path.section("/", -1); |
| @@ -45,15 +45,13 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url) { · 6 unmodified lines | ||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | QString file = unzipFile(path, tempDir); |
| 48 | + QString filename = QUrl::fromLocalFile(file).toString(); | |
| 48 | 49 | if (file != "") { |
| 49 | − qCDebug(scriptengine) << "Object file to upload: " + file; | |
| 50 | − QUrl url = QUrl::fromLocalFile(file); | |
| 51 | − emit unzipSuccess(url.toString()); | |
| 50 | + qCDebug(scriptengine) << "File to upload: " + filename; | |
| 52 | 51 | } else { |
| 53 | − qCDebug(scriptengine) << "unzip failed"; | |
| 52 | + qCDebug(scriptengine) << "Unzip failed"; | |
| 54 | 53 | } |
| 55 | − qCDebug(scriptengine) << "Removing temporary directory at: " + tempDir; | |
| 56 | − QDir(tempDir).removeRecursively(); | |
| 54 | + emit unzipResult(path, filename, autoAdd); | |
| 57 | 55 | } |
| 58 | 56 | |
| 59 | 57 | // fix to check that we are only referring to a temporary directory |
| @@ -69,21 +67,6 @@ bool FileScriptingInterface::isTempDir(QString tempDir) { · 9 unmodified lines | ||
| 69 | 67 | return (testContainer == tempContainer); |
| 70 | 68 | } |
| 71 | 69 | |
| 72 | −// checks whether the webview is displaying a Clara.io page for Marketplaces.qml | |
| 73 | −bool FileScriptingInterface::isClaraLink(QUrl url) { | |
| 74 | − return (url.toString().contains("clara.io") && !url.toString().contains("clara.io/signup")); | |
| 75 | −} | |
| 76 | − | |
| 77 | −bool FileScriptingInterface::isZippedFbx(QUrl url) { | |
| 78 | − return (url.toString().endsWith("fbx.zip")); | |
| 79 | −} | |
| 80 | − | |
| 81 | −// checks whether a user tries to download a file that is not in .fbx format | |
| 82 | −bool FileScriptingInterface::isZipped(QUrl url) { | |
| 83 | − return (url.toString().endsWith(".zip")); | |
| 84 | −} | |
| 85 | − | |
| 86 | −// this function is not in use | |
| 87 | 70 | QString FileScriptingInterface::getTempDir() { |
| 88 | 71 | QTemporaryDir dir; |
| 89 | 72 | dir.setAutoRemove(false); |
| @@ -109,7 +92,6 @@ void FileScriptingInterface::downloadZip(QString path, const QString link) { · 19 unmodified lines | ||
| 109 | 92 | request->send(); |
| 110 | 93 | } |
| 111 | 94 | |
| 112 | − | |
| 113 | 95 | QString FileScriptingInterface::unzipFile(QString path, QString tempDir) { |
| 114 | 96 | |
| 115 | 97 | QDir dir(path); |