History

Merge branch 'master' of https://github.com/highfidelity/hifi into removeLogSpam

Brad Hefta-Gaub committed 9 years ago

Commit c65471e2 parents dbbed46 61c60fc45 files · +2136 −510Browse files

Showing the changes to libraries/script-engine/src/FileScriptingInterface.cpp (1 of 45 files). Show all

Unified · Split

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