Showing the changes to libraries/script-engine/src/FileScriptingInterface.cpp (1 of 84 files). Show all
Unified · Split
| @@ -22,9 +22,10 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <QFileInfo> |
| 23 | 23 | #include <quazip5/quazip.h> |
| 24 | 24 | #include <quazip5/JlCompress.h> |
| 25 | −#include "ResourceManager.h" | |
| 26 | 25 | |
| 27 | 26 | #include "FileScriptingInterface.h" |
| 27 | +#include "ResourceManager.h" | |
| 28 | +#include "ScriptEngineLogging.h" | |
| 28 | 29 | |
| 29 | 30 | |
| 30 | 31 | FileScriptingInterface::FileScriptingInterface(QObject* parent) : QObject(parent) { |
| @@ -32,26 +33,26 @@ FileScriptingInterface::FileScriptingInterface(QObject* parent) : QObject(parent · 1 unmodified line | ||
| 32 | 33 | } |
| 33 | 34 | |
| 34 | 35 | void FileScriptingInterface::runUnzip(QString path, QUrl url) { |
| 35 | − qDebug() << "Url that was downloaded: " + url.toString(); | |
| 36 | − qDebug() << "Path where download is saved: " + path; | |
| 36 | + qCDebug(scriptengine) << "Url that was downloaded: " + url.toString(); | |
| 37 | + qCDebug(scriptengine) << "Path where download is saved: " + path; | |
| 37 | 38 | QString fileName = "/" + path.section("/", -1); |
| 38 | 39 | QString tempDir = path; |
| 39 | 40 | tempDir.remove(fileName); |
| 40 | − qDebug() << "Temporary directory at: " + tempDir; | |
| 41 | + qCDebug(scriptengine) << "Temporary directory at: " + tempDir; | |
| 41 | 42 | if (!isTempDir(tempDir)) { |
| 42 | − qDebug() << "Temporary directory mismatch; risk of losing files"; | |
| 43 | + qCDebug(scriptengine) << "Temporary directory mismatch; risk of losing files"; | |
| 43 | 44 | return; |
| 44 | 45 | } |
| 45 | 46 | |
| 46 | 47 | QString file = unzipFile(path, tempDir); |
| 47 | 48 | if (file != "") { |
| 48 | − qDebug() << "Object file to upload: " + file; | |
| 49 | + qCDebug(scriptengine) << "Object file to upload: " + file; | |
| 49 | 50 | QUrl url = QUrl::fromLocalFile(file); |
| 50 | 51 | emit unzipSuccess(url.toString()); |
| 51 | 52 | } else { |
| 52 | − qDebug() << "unzip failed"; | |
| 53 | + qCDebug(scriptengine) << "unzip failed"; | |
| 53 | 54 | } |
| 54 | − qDebug() << "Removing temporary directory at: " + tempDir; | |
| 55 | + qCDebug(scriptengine) << "Removing temporary directory at: " + tempDir; | |
| 55 | 56 | QDir(tempDir).removeRecursively(); |
| 56 | 57 | } |
| 57 | 58 | |
| @@ -94,7 +95,7 @@ QString FileScriptingInterface::convertUrlToPath(QUrl url) { · 36 unmodified lines | ||
| 94 | 95 | QString newUrl; |
| 95 | 96 | QString oldUrl = url.toString(); |
| 96 | 97 | newUrl = oldUrl.section("filename=", 1, 1); |
| 97 | − qDebug() << "Filename should be: " + newUrl; | |
| 98 | + qCDebug(scriptengine) << "Filename should be: " + newUrl; | |
| 98 | 99 | return newUrl; |
| 99 | 100 | } |
| 100 | 101 | |
| @@ -116,12 +117,12 @@ QString FileScriptingInterface::unzipFile(QString path, QString tempDir) { · 15 unmodified lines | ||
| 116 | 117 | QString target = tempDir + "/model_repo"; |
| 117 | 118 | QStringList list = JlCompress::extractDir(dirName, target); |
| 118 | 119 | |
| 119 | − qDebug() << list; | |
| 120 | + qCDebug(scriptengine) << list; | |
| 120 | 121 | |
| 121 | 122 | if (!list.isEmpty()) { |
| 122 | 123 | return list.front(); |
| 123 | 124 | } else { |
| 124 | − qDebug() << "Extraction failed"; | |
| 125 | + qCDebug(scriptengine) << "Extraction failed"; | |
| 125 | 126 | return ""; |
| 126 | 127 | } |
| 127 | 128 | |
| @@ -130,13 +131,13 @@ QString FileScriptingInterface::unzipFile(QString path, QString tempDir) { · 2 unmodified lines | ||
| 130 | 131 | // this function is not in use |
| 131 | 132 | void FileScriptingInterface::recursiveFileScan(QFileInfo file, QString* dirName) { |
| 132 | 133 | /*if (!file.isDir()) { |
| 133 | − qDebug() << "Regular file logged: " + file.fileName(); | |
| 134 | + qCDebug(scriptengine) << "Regular file logged: " + file.fileName(); | |
| 134 | 135 | return; |
| 135 | 136 | }*/ |
| 136 | 137 | QFileInfoList files; |
| 137 | 138 | |
| 138 | 139 | if (file.fileName().contains(".zip")) { |
| 139 | − qDebug() << "Extracting archive: " + file.fileName(); | |
| 140 | + qCDebug(scriptengine) << "Extracting archive: " + file.fileName(); | |
| 140 | 141 | JlCompress::extractDir(file.fileName()); |
| 141 | 142 | } |
| 142 | 143 | files = file.dir().entryInfoList(); |
| @@ -146,7 +147,7 @@ void FileScriptingInterface::recursiveFileScan(QFileInfo file, QString* dirName) · 3 unmodified lines | ||
| 146 | 147 | }*/ |
| 147 | 148 | |
| 148 | 149 | foreach (QFileInfo file, files) { |
| 149 | − qDebug() << "Looking into file: " + file.fileName(); | |
| 150 | + qCDebug(scriptengine) << "Looking into file: " + file.fileName(); | |
| 150 | 151 | recursiveFileScan(file, dirName); |
| 151 | 152 | } |
| 152 | 153 | return; |