Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+38
-38
@@ -31,7 +31,7 @@ bool ExportedScriptsModel::init(const QString &rootDirectoryToScan)
|
||||
m_vecData.clear();
|
||||
|
||||
QVector <int> localExercises;
|
||||
DEBUG_LOG() << "ExportedScriptsModel::init rootDirectoryToScan=" << rootDirectoryToScan
|
||||
DEBUG_LOG(m_logger) << "ExportedScriptsModel::init rootDirectoryToScan=" << rootDirectoryToScan
|
||||
;
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@ bool ExportedScriptsModel::init(const QString &rootDirectoryToScan)
|
||||
|
||||
|
||||
{
|
||||
DEBUG_LOG() << "Get all local exercises rootDirectoryToScan=" << rootDirectoryToScan ;
|
||||
DEBUG_LOG(m_logger) << "Get all local exercises rootDirectoryToScan=" << rootDirectoryToScan ;
|
||||
QFile file(rootDirectoryToScan + QDir::separator() + QStringLiteral("exercises.json"));
|
||||
if (!file.open(QFile::ReadOnly))
|
||||
WARNING_LOG() << "Cannot open " << file.fileName() << " for read/write: " << file.errorString();
|
||||
WARNING_LOG(m_logger) << "Cannot open " << file.fileName() << " for read/write: " << file.errorString();
|
||||
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(file.readAll()));
|
||||
const QJsonObject obj = doc.object();
|
||||
@@ -52,7 +52,7 @@ bool ExportedScriptsModel::init(const QString &rootDirectoryToScan)
|
||||
localExercises.append(ele.toInt());
|
||||
}
|
||||
|
||||
WARNING_LOG() << "local exericses: " << localExercises.count();
|
||||
WARNING_LOG(m_logger) << "local exericses: " << localExercises.count();
|
||||
|
||||
|
||||
for (const int exId : std::as_const(localExercises))
|
||||
@@ -62,7 +62,7 @@ bool ExportedScriptsModel::init(const QString &rootDirectoryToScan)
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
WARNING_LOG() << "Cannot open " << file.fileName() << " for reading: " << file.errorString() << " - not critical";
|
||||
WARNING_LOG(m_logger) << "Cannot open " << file.fileName() << " for reading: " << file.errorString() << " - not critical";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -71,14 +71,14 @@ bool ExportedScriptsModel::init(const QString &rootDirectoryToScan)
|
||||
const QJsonObject obj = doc.object();
|
||||
const QJsonArray presentations = obj[QStringLiteral("presentations")].toArray();
|
||||
|
||||
DEBUG_LOG() << "exercise: " << exId << ", presentations: " << presentations.size();
|
||||
DEBUG_LOG(m_logger) << "exercise: " << exId << ", presentations: " << presentations.size();
|
||||
|
||||
for (const QJsonValue &val : presentations)
|
||||
{
|
||||
ExportedScriptInformation esi = ExportedScriptInformation::fromJson(val);
|
||||
DEBUG_LOG() << "obj=" << QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
DEBUG_LOG(m_logger) << "obj=" << QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
const QJsonObject presentationObj = val.toObject();
|
||||
DEBUG_LOG() << "presentationObj=" << QJsonDocument(presentationObj).toJson(QJsonDocument::Compact);
|
||||
DEBUG_LOG(m_logger) << "presentationObj=" << QJsonDocument(presentationObj).toJson(QJsonDocument::Compact);
|
||||
if (obj.contains(QStringLiteral("exerciseId")))
|
||||
{
|
||||
esi.exerciseId = obj[QStringLiteral("exerciseId")].toInt();
|
||||
@@ -90,7 +90,7 @@ bool ExportedScriptsModel::init(const QString &rootDirectoryToScan)
|
||||
}
|
||||
|
||||
esi.local = true;
|
||||
DEBUG_LOG() << "push_back "
|
||||
DEBUG_LOG(m_logger) << "push_back "
|
||||
<< " exportTime=" << esi.exportTime
|
||||
<< " scriptId=" << esi.scriptId
|
||||
<< " scriptName=" << esi.scriptName
|
||||
@@ -120,14 +120,14 @@ void ExportedScriptsModel::setServerContent(const QString &jsonArray)
|
||||
QMap<int, QVector<int>> exerciseContentScriptIds;
|
||||
QMap<int, QVector<int>> exerciseScriptIds;
|
||||
|
||||
DEBUG_LOG() << "ExportedScriptsModel::setServerContent jsonArray =" << jsonArray;
|
||||
DEBUG_LOG(m_logger) << "ExportedScriptsModel::setServerContent jsonArray =" << jsonArray;
|
||||
QJsonParseError err;
|
||||
const QJsonArray presentations = QJsonDocument::fromJson(jsonArray.toUtf8(), &err).array();
|
||||
DEBUG_LOG() << "presentations.size() =" << presentations.size();
|
||||
DEBUG_LOG(m_logger) << "presentations.size() =" << presentations.size();
|
||||
|
||||
if (err.error != QJsonParseError::NoError)
|
||||
{
|
||||
ERROR_LOG() << "json array invalid at offset " << err.offset << ": " << err.errorString();
|
||||
ERROR_LOG(m_logger) << "json array invalid at offset " << err.offset << ": " << err.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ void ExportedScriptsModel::setServerContent(const QString &jsonArray)
|
||||
for (const auto &data : std::as_const(m_vecData))
|
||||
{
|
||||
exerciseScriptIds[data.exerciseId].append(data.scriptId);
|
||||
DEBUG_LOG() << "exerciseId=" << data.exerciseId
|
||||
DEBUG_LOG(m_logger) << "exerciseId=" << data.exerciseId
|
||||
<< " modelScriptIds.append: " << data.scriptId;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ void ExportedScriptsModel::setServerContent(const QString &jsonArray)
|
||||
{
|
||||
const auto &rowData = m_vecData[i];
|
||||
const QVector<int> contentScriptIds = exerciseContentScriptIds.value(rowData.exerciseId);
|
||||
DEBUG_LOG() << "m_vecData.at(" << i << ").scriptId=" << rowData.scriptId
|
||||
DEBUG_LOG(m_logger) << "m_vecData.at(" << i << ").scriptId=" << rowData.scriptId
|
||||
<< " exerciseId=" << rowData.exerciseId
|
||||
<< " contentScriptIds.contains=" << contentScriptIds.contains(rowData.scriptId)
|
||||
<< " rowData.local=" << rowData.local
|
||||
@@ -165,7 +165,7 @@ void ExportedScriptsModel::setServerContent(const QString &jsonArray)
|
||||
{
|
||||
|
||||
|
||||
DEBUG_LOG() << "removeRow(" << i << ")"
|
||||
DEBUG_LOG(m_logger) << "removeRow(" << i << ")"
|
||||
<< " ScriptId=" << rowData.scriptId
|
||||
<< " ExerciseId=" << rowData.exerciseId;
|
||||
removeRow(i);
|
||||
@@ -185,7 +185,7 @@ void ExportedScriptsModel::setServerContent(const QString &jsonArray)
|
||||
{
|
||||
ExportedScriptInformation esi = ExportedScriptInformation::fromJson(val, false, ThpAlreadyUploaded);
|
||||
QVector<int> modelScriptIds = exerciseScriptIds.value(esi.exerciseId);
|
||||
DEBUG_LOG() << " exportTime=" << esi.exportTime
|
||||
DEBUG_LOG(m_logger) << " exportTime=" << esi.exportTime
|
||||
<< " scriptId=" << esi.scriptId
|
||||
<< " exerciseId=" << esi.exerciseId
|
||||
<< " exerciseName=" << esi.exerciseName
|
||||
@@ -196,7 +196,7 @@ void ExportedScriptsModel::setServerContent(const QString &jsonArray)
|
||||
|
||||
if (!modelScriptIds.contains(esi.scriptId))
|
||||
{
|
||||
DEBUG_LOG() << "insertRow()";
|
||||
DEBUG_LOG(m_logger) << "insertRow()";
|
||||
insertRow(esi);
|
||||
continue;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ void ExportedScriptsModel::setServerContent(const QString &jsonArray)
|
||||
if (rowData.scriptId == esi.scriptId &&
|
||||
rowData.exerciseId == esi.exerciseId)
|
||||
{
|
||||
DEBUG_LOG() << "setUploadState i=" << i
|
||||
DEBUG_LOG(m_logger) << "setUploadState i=" << i
|
||||
<< " esi.scriptId=" << esi.scriptId
|
||||
<< " esi.exerciseId=" << esi.exerciseId
|
||||
<< " esi.fileSize=" << esi.fileSize
|
||||
@@ -230,7 +230,7 @@ qint64 ExportedScriptsModel::downloadTime(const ExportedScriptInformation &val)
|
||||
return 0;
|
||||
|
||||
QString filename(QStringLiteral("%1/THP-Download/Exercise_%2/%3/index.html").arg(QDir::tempPath()).arg(val.exerciseId).arg(val.scriptId));
|
||||
DEBUG_LOG() << "downloadTime: filename " << filename;
|
||||
DEBUG_LOG(m_logger) << "downloadTime: filename " << filename;
|
||||
|
||||
QFileInfo fi(filename);
|
||||
if (!fi.exists())
|
||||
@@ -334,16 +334,16 @@ bool ExportedScriptsModel::createDataJson(const QString &rootDirectory,
|
||||
|
||||
if (!QDir().mkpath(baseDir))
|
||||
{
|
||||
ERROR_LOG() << "Failed to create path " << baseDir;
|
||||
ERROR_LOG(m_logger) << "Failed to create path " << baseDir;
|
||||
return false;
|
||||
}
|
||||
|
||||
QFile file(baseDir + QStringLiteral("data.json"));
|
||||
DEBUG_LOG() << "createDataJson=" << file.fileName();
|
||||
DEBUG_LOG(m_logger) << "createDataJson=" << file.fileName();
|
||||
if (!file.open(QFile::ReadWrite))
|
||||
{
|
||||
QString msg(tr("Could not open data file in script directory: %1").arg(file.errorString()));
|
||||
ERROR_LOG() << msg << " - " << file.fileName();
|
||||
ERROR_LOG(m_logger) << msg << " - " << file.fileName();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ bool ExportedScriptsModel::createDataJson(const QString &rootDirectory,
|
||||
QJsonObject obj = doc.object();
|
||||
if (obj[QStringLiteral("exerciseId")].toInt() == exerciseId)
|
||||
{
|
||||
DEBUG_LOG() << baseDir << " exists for exerciseId " << QString::number(exerciseId);
|
||||
DEBUG_LOG(m_logger) << baseDir << " exists for exerciseId " << QString::number(exerciseId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -381,18 +381,18 @@ void ExportedScriptsModel::addDownloadData(const ExportedScriptInformation &esi)
|
||||
|
||||
{
|
||||
|
||||
DEBUG_LOG() << "Add exercise to ExportRootPath";
|
||||
DEBUG_LOG(m_logger) << "Add exercise to ExportRootPath";
|
||||
|
||||
if (!QDir(esi.rootDirectory).exists())
|
||||
{
|
||||
ERROR_LOG() << "Cannot modify exercises.json as the info's root directory '"<<esi.rootDirectory<<"' does not exist!";
|
||||
ERROR_LOG(m_logger) << "Cannot modify exercises.json as the info's root directory '"<<esi.rootDirectory<<"' does not exist!";
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(esi.rootDirectory + QDir::separator() + QStringLiteral("exercises.json"));
|
||||
if (!file.open(QFile::ReadWrite))
|
||||
{
|
||||
WARNING_LOG() << "Can not open " << file.fileName() << " for read/write: " << file.errorString();
|
||||
WARNING_LOG(m_logger) << "Can not open " << file.fileName() << " for read/write: " << file.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -403,14 +403,14 @@ void ExportedScriptsModel::addDownloadData(const ExportedScriptInformation &esi)
|
||||
|
||||
if (!arr.contains(esi.exerciseId))
|
||||
{
|
||||
DEBUG_LOG() << "arr.append Exercise=" << esi.exerciseId;
|
||||
DEBUG_LOG(m_logger) << "arr.append Exercise=" << esi.exerciseId;
|
||||
arr.append(esi.exerciseId);
|
||||
}
|
||||
|
||||
obj.insert(key, arr);
|
||||
file.resize(0);
|
||||
file.write(QJsonDocument(obj).toJson());
|
||||
INFO_LOG() << " file.write " << QJsonDocument(obj).toJson();
|
||||
INFO_LOG(m_logger) << " file.write " << QJsonDocument(obj).toJson();
|
||||
file.close();
|
||||
}
|
||||
|
||||
@@ -419,17 +419,17 @@ void ExportedScriptsModel::addDownloadData(const ExportedScriptInformation &esi)
|
||||
const QString baseDir = exercisePath(esi.rootDirectory, esi.exerciseId);
|
||||
if (!QDir().mkpath(baseDir))
|
||||
{
|
||||
ERROR_LOG() << "Cannot create destination path " << baseDir;
|
||||
ERROR_LOG(m_logger) << "Cannot create destination path " << baseDir;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QFile file(baseDir + QDir::separator() + QStringLiteral("data.json"));
|
||||
DEBUG_LOG() << "File= " << file.fileName();
|
||||
DEBUG_LOG(m_logger) << "File= " << file.fileName();
|
||||
if (!file.open(QFile::ReadWrite))
|
||||
{
|
||||
WARNING_LOG() << "Can not open " << file.fileName() << " for read/write: " << file.errorString();
|
||||
WARNING_LOG(m_logger) << "Can not open " << file.fileName() << " for read/write: " << file.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ void ExportedScriptsModel::addDownloadData(const ExportedScriptInformation &esi)
|
||||
QJsonObject obj = doc.object();
|
||||
QJsonArray arr = obj.value(keyArray).toArray();
|
||||
bool exported = false;
|
||||
DEBUG_LOG() << "arr.size=" << arr.size();
|
||||
DEBUG_LOG(m_logger) << "arr.size=" << arr.size();
|
||||
|
||||
for (int i = 0; i < arr.size(); ++i)
|
||||
{
|
||||
@@ -454,7 +454,7 @@ void ExportedScriptsModel::addDownloadData(const ExportedScriptInformation &esi)
|
||||
|
||||
if (!exported)
|
||||
{
|
||||
DEBUG_LOG() << "info scriptId=" << esi.scriptId
|
||||
DEBUG_LOG(m_logger) << "info scriptId=" << esi.scriptId
|
||||
<< " Name=" << esi.scriptName
|
||||
<< " Exercise=" << esi.exerciseName;
|
||||
arr.append(esi.toJson());
|
||||
@@ -463,7 +463,7 @@ void ExportedScriptsModel::addDownloadData(const ExportedScriptInformation &esi)
|
||||
obj.insert(keyArray, arr);
|
||||
auto content = QJsonDocument(obj).toJson();
|
||||
|
||||
DEBUG_LOG() << "content =" << content;
|
||||
DEBUG_LOG(m_logger) << "content =" << content;
|
||||
|
||||
file.resize(0);
|
||||
file.write(content);
|
||||
@@ -478,7 +478,7 @@ bool ExportedScriptsModel::setLocalState(const int row, const bool localHost)
|
||||
data.local = localHost;
|
||||
|
||||
|
||||
DEBUG_LOG() << "setLocalState row=" << row
|
||||
DEBUG_LOG(m_logger) << "setLocalState row=" << row
|
||||
<< " scriptId=" << data.scriptId
|
||||
<< " data.scriptName=" << data.scriptName
|
||||
<< " Exercise=" << data.exerciseName;
|
||||
@@ -515,12 +515,12 @@ bool ExportedScriptsModel::removeRow(int row)
|
||||
|
||||
QString baseDir = exercisePath(data.rootDirectory, data.exerciseId);
|
||||
QString filename = baseDir + QStringLiteral("data.json");
|
||||
DEBUG_LOG() << "filename= '" << filename << "'";
|
||||
DEBUG_LOG(m_logger) << "filename= '" << filename << "'";
|
||||
QFile file(baseDir + QStringLiteral("data.json"));
|
||||
|
||||
if (!file.open(QIODevice::ReadWrite))
|
||||
{
|
||||
DEBUG_LOG() << "!file.open '" << filename << "'"
|
||||
DEBUG_LOG(m_logger) << "!file.open '" << filename << "'"
|
||||
<< " no local scripts";
|
||||
return true;
|
||||
}
|
||||
@@ -539,7 +539,7 @@ bool ExportedScriptsModel::removeRow(int row)
|
||||
obj[QStringLiteral("presentations")] = arr;
|
||||
file.resize(0);
|
||||
auto content = QJsonDocument(obj).toJson();
|
||||
DEBUG_LOG() << "content =" << content;
|
||||
DEBUG_LOG(m_logger) << "content =" << content;
|
||||
|
||||
return file.write(QJsonDocument(obj).toJson());
|
||||
}
|
||||
|
||||
+2
@@ -81,6 +81,8 @@ public:
|
||||
void addDownloadData(const ExportedScriptInformation &esi);
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
QString exercisePath(const QString &rootDirectory, const int exerciseId) const;
|
||||
qint64 downloadTime(const ExportedScriptInformation &val) const;
|
||||
|
||||
|
||||
+41
-42
@@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
#ifndef ELOG
|
||||
#define ELOG ERROR_LOG()
|
||||
#define ELOG ERROR_LOG(m_logger)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -44,17 +44,16 @@ namespace TakeHomePackageManager
|
||||
{
|
||||
|
||||
|
||||
HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent)
|
||||
: QObject(parent)
|
||||
HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent) : QObject(parent)
|
||||
, m_esi(esi)
|
||||
, m_process(new ProcessOverlay)
|
||||
, m_nam(new QNetworkAccessManager(this))
|
||||
, m_timeout(new QTimer(this))
|
||||
{
|
||||
, m_timeout(new QTimer(this)),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
connect(m_process, &ProcessOverlay::signalCancel,
|
||||
this, [this]()
|
||||
{
|
||||
DEBUG_LOG() << "m_wasCanceled!!";
|
||||
DEBUG_LOG(m_logger) << "m_wasCanceled!!";
|
||||
m_wasCanceled = true;
|
||||
m_process->setCancelEnabled(false);
|
||||
});
|
||||
@@ -71,12 +70,12 @@ HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent)
|
||||
bool k = false;
|
||||
int _timeout = timeoutVar.toInt(&k);
|
||||
|
||||
DEBUG_LOG() << "TPM.Timeout debug value set! k = " << k << "_timeout = " << _timeout;
|
||||
DEBUG_LOG(m_logger) << "TPM.Timeout debug value set! k = " << k << "_timeout = " << _timeout;
|
||||
|
||||
if (k)
|
||||
{
|
||||
timeout = _timeout;
|
||||
DEBUG_LOG() << "new timeout set to " << timeout;
|
||||
DEBUG_LOG(m_logger) << "new timeout set to " << timeout;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +88,7 @@ HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent)
|
||||
{
|
||||
stopTimeout();
|
||||
new LtsWidgets::LtsMessageDialogNew(qobject_cast<QWidget *>(this->parent()), tr("Timeout occured during the operation - aborted"));
|
||||
WARNING_LOG() << "Timeout occured during the operation - aborted";
|
||||
WARNING_LOG(m_logger) << "Timeout occured during the operation - aborted";
|
||||
m_isTimeout = true;
|
||||
|
||||
emit signalTimeout();
|
||||
@@ -99,7 +98,7 @@ HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent)
|
||||
|
||||
HttpProcess::~HttpProcess()
|
||||
{
|
||||
DEBUG_LOG() << "~HttpProcess";
|
||||
DEBUG_LOG(m_logger) << "~HttpProcess";
|
||||
delete m_process;
|
||||
|
||||
}
|
||||
@@ -175,7 +174,7 @@ QNetworkReply *HttpProcess::deleteResource(const QString &path, const QUrlQuery
|
||||
|
||||
void HttpProcess::slotSuccess()
|
||||
{
|
||||
DEBUG_LOG() << "success";
|
||||
DEBUG_LOG(m_logger) << "success";
|
||||
|
||||
stopTimeout();
|
||||
if (!m_isError && !m_wasCanceled && !m_isTimeout)
|
||||
@@ -185,7 +184,7 @@ void HttpProcess::slotSuccess()
|
||||
|
||||
void HttpProcess::slotError()
|
||||
{
|
||||
DEBUG_LOG() << "error";
|
||||
DEBUG_LOG(m_logger) << "error";
|
||||
|
||||
stopTimeout();
|
||||
|
||||
@@ -207,7 +206,7 @@ void HttpProcess::slotError()
|
||||
|
||||
void HttpProcess::slotReadyRead()
|
||||
{
|
||||
DEBUG_LOG() << "readyRead";
|
||||
DEBUG_LOG(m_logger) << "readyRead";
|
||||
resetTimeout();
|
||||
|
||||
QNetworkReply *r = qobject_cast<QNetworkReply *>(sender());
|
||||
@@ -354,23 +353,23 @@ UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformatio
|
||||
|
||||
|
||||
|
||||
DEBUG_LOG() << "TPM.TestBigFile? " << LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")).toString();
|
||||
DEBUG_LOG() << "TPM.TestBigFile check? "
|
||||
DEBUG_LOG(m_logger) << "TPM.TestBigFile? " << LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")).toString();
|
||||
DEBUG_LOG(m_logger) << "TPM.TestBigFile check? "
|
||||
<< (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")) == QVariant(true));
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")) == QVariant(true))
|
||||
#endif
|
||||
{
|
||||
DEBUG_LOG() << "TPM.TestBigFile!!";
|
||||
DEBUG_LOG(m_logger) << "TPM.TestBigFile!!";
|
||||
|
||||
if (QGuiApplication::queryKeyboardModifiers() == Qt::ControlModifier)
|
||||
{
|
||||
QFile test(QStringLiteral("%1/%2/big.file").arg(ExportedScriptsDialog::getContentFolder(m_rootDir, m_esi.exerciseId), dstDir));
|
||||
DEBUG_LOG() << ">>> BIG FILE ACTIVE ("<<test.fileName()<<")";
|
||||
DEBUG_LOG(m_logger) << ">>> BIG FILE ACTIVE ("<<test.fileName()<<")";
|
||||
|
||||
bool ret = test.open(QIODevice::ReadWrite);
|
||||
DEBUG_LOG() << "ret? " << ret;
|
||||
DEBUG_LOG(m_logger) << "ret? " << ret;
|
||||
Q_ASSERT(ret);
|
||||
|
||||
|
||||
@@ -380,7 +379,7 @@ UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformatio
|
||||
QFile rng(QStringLiteral("/dev/urandom"));
|
||||
|
||||
ret = rng.open(QIODevice::ReadOnly);
|
||||
DEBUG_LOG() << "ret? " << ret;
|
||||
DEBUG_LOG(m_logger) << "ret? " << ret;
|
||||
Q_ASSERT(ret);
|
||||
|
||||
int times = 1024 * 1024;
|
||||
@@ -391,15 +390,15 @@ UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformatio
|
||||
int _times = LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(bigFileSize).toInt(&k);
|
||||
|
||||
if (!k)
|
||||
DEBUG_LOG() << "Invalid value for " << bigFileSize;
|
||||
DEBUG_LOG(m_logger) << "Invalid value for " << bigFileSize;
|
||||
else
|
||||
{
|
||||
times = _times;
|
||||
DEBUG_LOG() << "big file size was set to " << times;
|
||||
DEBUG_LOG(m_logger) << "big file size was set to " << times;
|
||||
}
|
||||
}
|
||||
else
|
||||
DEBUG_LOG() << "TPM.TestBigFile.Size not set - using default of " << times;
|
||||
DEBUG_LOG(m_logger) << "TPM.TestBigFile.Size not set - using default of " << times;
|
||||
|
||||
|
||||
for (int i = 0; i < times; i++)
|
||||
@@ -411,7 +410,7 @@ UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformatio
|
||||
test.flush();
|
||||
|
||||
m_tempFile->setAutoRemove(false);
|
||||
DEBUG_LOG() << "big compressed file: " << m_tempFile->fileName();
|
||||
DEBUG_LOG(m_logger) << "big compressed file: " << m_tempFile->fileName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,9 +418,9 @@ UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformatio
|
||||
connect(m_compress, &NGL::Compress::finished,
|
||||
this, &UploadProcess::compressionDone);
|
||||
|
||||
DEBUG_LOG() << "compress called...";
|
||||
DEBUG_LOG(m_logger) << "compress called...";
|
||||
m_compress->compress(m_tempFile, srcDir, dstDir);
|
||||
DEBUG_LOG() << "...!";
|
||||
DEBUG_LOG(m_logger) << "...!";
|
||||
}
|
||||
|
||||
|
||||
@@ -436,17 +435,17 @@ void UploadProcess::abortCompress()
|
||||
|
||||
void UploadProcess::compressionDone()
|
||||
{
|
||||
DEBUG_LOG() << "m_wasCanceled = " << m_wasCanceled << ", compress success = " << m_compress->success();
|
||||
DEBUG_LOG(m_logger) << "m_wasCanceled = " << m_wasCanceled << ", compress success = " << m_compress->success();
|
||||
stopTimeout();
|
||||
|
||||
if (!m_compress->success() || m_wasCanceled)
|
||||
{
|
||||
DEBUG_LOG() << "compression aborted";
|
||||
DEBUG_LOG(m_logger) << "compression aborted";
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "okay";
|
||||
DEBUG_LOG(m_logger) << "okay";
|
||||
|
||||
QUrlQuery q;
|
||||
q.addQueryItem(QStringLiteral("exerciseId"), QString::number(m_esi.exerciseId));
|
||||
@@ -455,7 +454,7 @@ void UploadProcess::compressionDone()
|
||||
q.addQueryItem(QStringLiteral("name"), m_esi.scriptName);
|
||||
|
||||
|
||||
DEBUG_LOG() << "posting file of size " << m_tempFile->size();
|
||||
DEBUG_LOG(m_logger) << "posting file of size " << m_tempFile->size();
|
||||
m_tempFile->seek(0);
|
||||
|
||||
QNetworkReply *rep = post(QStringLiteral("/thp"), m_tempFile, q);
|
||||
@@ -463,7 +462,7 @@ void UploadProcess::compressionDone()
|
||||
connect(this, &HttpProcess::signalSuccess,
|
||||
this, [this]()
|
||||
{
|
||||
DEBUG_LOG() << "Uploaded script successfully";
|
||||
DEBUG_LOG(m_logger) << "Uploaded script successfully";
|
||||
new LtsWidgets::LtsMessageDialogNew(qobject_cast<QWidget *>(parent()), tr("Uploaded script successfully"));
|
||||
deleteLater();
|
||||
});
|
||||
@@ -612,7 +611,7 @@ void DownloadProcess::downloadFinished()
|
||||
{
|
||||
stopTimeout();
|
||||
|
||||
DEBUG_LOG() << "m_compress->success()? " << m_compress->success() << ", m_wasCanceled? " << m_wasCanceled << ", m_isError? " << m_isError;
|
||||
DEBUG_LOG(m_logger) << "m_compress->success()? " << m_compress->success() << ", m_wasCanceled? " << m_wasCanceled << ", m_isError? " << m_isError;
|
||||
if (m_compress->success() && !m_wasCanceled && !m_isError)
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(qobject_cast<QWidget *>(parent()), tr("Downloaded script successfully"));
|
||||
@@ -858,7 +857,7 @@ bool ExportedScriptsDialog::init(LtsSession::LtsSession *session)
|
||||
if (!QDir().mkpath(getContentFolder(m_exerciseId)))
|
||||
{
|
||||
QString msg(tr("Cannot create script folder at %1").arg(getContentFolder(m_exerciseId)));
|
||||
ERROR_LOG() << msg;
|
||||
ERROR_LOG(m_logger) << msg;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -875,7 +874,7 @@ bool ExportedScriptsDialog::init(LtsSession::LtsSession *session)
|
||||
#else
|
||||
NGL::Settings *s = new NGL::Settings(NGL::findProjectConfigFile());
|
||||
const QString hostname = s->getString(QStringLiteral("TabOC"), QStringLiteral("remoteServerHostname"), QStringLiteral("exctds01"));
|
||||
WARNING_LOG() << "Hostname used for THP: " << hostname;
|
||||
WARNING_LOG(m_logger) << "Hostname used for THP: " << hostname;
|
||||
sock->open(QUrl(QStringLiteral("ws://%1:%2/thp").arg(hostname).arg(NGL::Connections::port(NGL::Connections::eConnection::FLM_THP_SERVER))));
|
||||
delete s;
|
||||
#endif
|
||||
@@ -904,7 +903,7 @@ bool ExportedScriptsDialog::init(LtsSession::LtsSession *session)
|
||||
connect(sock, &QWebSocket::disconnected,
|
||||
this, [this, sock, openFn]()
|
||||
{
|
||||
WARNING_LOG() << "disconnected from ws... reconnecting in 3...";
|
||||
WARNING_LOG(m_logger) << "disconnected from ws... reconnecting in 3...";
|
||||
setWsConnectionStatus(WsConnectionStatus::Disconnected);
|
||||
|
||||
QTimer *t = new QTimer(sock);
|
||||
@@ -925,7 +924,7 @@ bool ExportedScriptsDialog::init(LtsSession::LtsSession *session)
|
||||
connect(sock, &QWebSocket::textMessageReceived,
|
||||
this, [this](const QString &msg)
|
||||
{
|
||||
DEBUG_LOG() << "new msg: '" << msg << "'";
|
||||
DEBUG_LOG(m_logger) << "new msg: '" << msg << "'";
|
||||
m_lastServerContent = msg;
|
||||
m_model->setServerContent(msg);
|
||||
onSelectionChanged();
|
||||
@@ -938,7 +937,7 @@ bool ExportedScriptsDialog::init(LtsSession::LtsSession *session)
|
||||
|
||||
bool ExportedScriptsDialog::initModel()
|
||||
{
|
||||
DEBUG_LOG() << "(re)initModel !!";
|
||||
DEBUG_LOG(m_logger) << "(re)initModel !!";
|
||||
|
||||
QString rootDirectory(getRootFolder());
|
||||
|
||||
@@ -1017,7 +1016,7 @@ void ExportedScriptsDialog::downloadScript()
|
||||
|
||||
if (!mi.isValid())
|
||||
{
|
||||
ERROR_LOG() << "could not update model data after download! cover up..";
|
||||
ERROR_LOG(m_logger) << "could not update model data after download! cover up..";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1053,7 +1052,7 @@ void ExportedScriptsDialog::removeScriptFromServer()
|
||||
|
||||
if (!mi.isValid())
|
||||
{
|
||||
ERROR_LOG() << "could not update model data after deletion! cover up..";
|
||||
ERROR_LOG(m_logger) << "could not update model data after deletion! cover up..";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1090,7 +1089,7 @@ void ExportedScriptsDialog::removeScriptLocal()
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false);
|
||||
|
||||
QString currentDirectory = QStringLiteral("%1/%2").arg(getContentFolder(esi.exerciseId), QString::number(esi.scriptId));
|
||||
DEBUG_LOG() << "currentDirectory=" << currentDirectory;
|
||||
DEBUG_LOG(m_logger) << "currentDirectory=" << currentDirectory;
|
||||
|
||||
QDir d(currentDirectory);
|
||||
if (!d.removeRecursively())
|
||||
@@ -1118,7 +1117,7 @@ void ExportedScriptsDialog::removeScriptLocal()
|
||||
if (err.error != QJsonParseError::NoError)
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Cannot read index file"), removingScriptFailedText);
|
||||
ERROR_LOG() << "Cannot read index file at offset" << err.offset << ": " << err.errorString();
|
||||
ERROR_LOG(m_logger) << "Cannot read index file at offset" << err.offset << ": " << err.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1145,7 +1144,7 @@ void ExportedScriptsDialog::removeScriptLocal()
|
||||
|
||||
if (scriptId == -1)
|
||||
{
|
||||
WARNING_LOG() << "cannot find scriptId in presentations array object from data.json";
|
||||
WARNING_LOG(m_logger) << "cannot find scriptId in presentations array object from data.json";
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1192,7 +1191,7 @@ void ExportedScriptsDialog::openScript()
|
||||
args.append(QStringLiteral("-t"));
|
||||
args.append(pathToScript);
|
||||
|
||||
DEBUG_LOG() << "pathToScript: " << pathToScript;
|
||||
DEBUG_LOG(m_logger) << "pathToScript: " << pathToScript;
|
||||
|
||||
#ifndef WIN32
|
||||
QProcess().startDetached(QLatin1String("./thp_viewer"), args, QCoreApplication::applicationDirPath());
|
||||
|
||||
+3
@@ -67,6 +67,9 @@ protected slots:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void doConnections(QNetworkReply *r);
|
||||
|
||||
|
||||
|
||||
+31
-31
@@ -68,7 +68,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef ELOG
|
||||
#define ELOG ERROR_LOG()
|
||||
#define ELOG ERROR_LOG(m_logger)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -431,7 +431,7 @@ void USBDialog::initUsbModel()
|
||||
if (!m_usbThpModel->init(m_usbRoot))
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("The directory '%1' doesn't contain valid THP data.").arg(m_usbRoot));
|
||||
ERROR_LOG() << "cannot initialize usb thp model from usb root" << m_usbRoot;
|
||||
ERROR_LOG(m_logger) << "cannot initialize usb thp model from usb root" << m_usbRoot;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ void USBDialog::slotChangePath()
|
||||
if (!m_usbThpModel->createDataJson(m_usbRoot, exmDtc, asmDtc, m_exerciseId))
|
||||
{
|
||||
|
||||
ERROR_LOG() << "Failed to initialize data.json";
|
||||
ERROR_LOG(m_logger) << "Failed to initialize data.json";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ void USBDialog::slotCopyMaps()
|
||||
|
||||
if (!dstDir.exists())
|
||||
{
|
||||
ERROR_LOG() << "dst dir " << m_usbRoot << " is not accessible";
|
||||
ERROR_LOG(m_logger) << "dst dir " << m_usbRoot << " is not accessible";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ void USBDialog::slotCopyMaps()
|
||||
return;
|
||||
|
||||
|
||||
DEBUG_LOG() << "mil.size()" << mil.size();
|
||||
DEBUG_LOG(m_logger) << "mil.size()" << mil.size();
|
||||
|
||||
|
||||
|
||||
@@ -602,13 +602,13 @@ void USBDialog::onNextMap()
|
||||
auto path = m_files.firstKey();
|
||||
{
|
||||
QString src(path);
|
||||
DEBUG_LOG() << "src" << src;
|
||||
DEBUG_LOG(m_logger) << "src" << src;
|
||||
|
||||
QDir srcDir(src);
|
||||
|
||||
if (!srcDir.exists())
|
||||
{
|
||||
ERROR_LOG() << "src dir " << src << " is not accessible";
|
||||
ERROR_LOG(m_logger) << "src dir " << src << " is not accessible";
|
||||
return;
|
||||
}
|
||||
QDir dstDir(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps"));
|
||||
@@ -710,12 +710,12 @@ void USBDialog::generateLayerMappingXML()
|
||||
|
||||
if (!layersMapping.open(QIODevice::WriteOnly))
|
||||
{
|
||||
WARNING_LOG() << "Couldn't open save file.";
|
||||
WARNING_LOG(m_logger) << "Couldn't open save file.";
|
||||
return;
|
||||
}
|
||||
if (!layersMappingAtMaps.open(QIODevice::WriteOnly))
|
||||
{
|
||||
WARNING_LOG() << "Couldn't open save file in folder Maps.";
|
||||
WARNING_LOG(m_logger) << "Couldn't open save file in folder Maps.";
|
||||
return;
|
||||
}
|
||||
QJsonDocument doc(layers);
|
||||
@@ -763,13 +763,13 @@ void USBDialog::slotCopyWinBin()
|
||||
|
||||
if (!srcDir.exists())
|
||||
{
|
||||
ERROR_LOG() << "src dir " << src << " is not accessible";
|
||||
ERROR_LOG(m_logger) << "src dir " << src << " is not accessible";
|
||||
return;
|
||||
}
|
||||
|
||||
QFileInfoList fil;
|
||||
fil = prepareFileInfoListForFolder(src, fil);
|
||||
DEBUG_LOG() << "XXXXXXXXXXX filsize is: " << fil.size();
|
||||
DEBUG_LOG(m_logger) << "XXXXXXXXXXX filsize is: " << fil.size();
|
||||
|
||||
auto cp = new CopyProcess(srcDir, dstDir, fil, false, this);
|
||||
setOverlay(cp->process());
|
||||
@@ -804,19 +804,19 @@ void USBDialog::slotCopyWinBinP2()
|
||||
|
||||
if (initFilePath.isEmpty())
|
||||
{
|
||||
ERROR_LOG() << "sitmap init is not accessible";
|
||||
ERROR_LOG(m_logger) << "sitmap init is not accessible";
|
||||
return;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo(initFilePath);
|
||||
QFileInfoList fil2;
|
||||
fil2.append(fileInfo);
|
||||
DEBUG_LOG() << "XXXXXXXXXXX sitmap is: " << fileInfo.absoluteFilePath();
|
||||
ERROR_LOG() << "XXXXXXXXXXX filsize is: " << fil2.size();
|
||||
DEBUG_LOG(m_logger) << "XXXXXXXXXXX sitmap is: " << fileInfo.absoluteFilePath();
|
||||
ERROR_LOG(m_logger) << "XXXXXXXXXXX filsize is: " << fil2.size();
|
||||
|
||||
|
||||
const QDir dstDir2(dstDir.absolutePath() + QDir::separator() + QStringLiteral("thp") + QDir::separator() + QStringLiteral("share") + QDir::separator() + QStringLiteral("LTS") + QDir::separator() + QStringLiteral("situation_Map")) ;
|
||||
DEBUG_LOG() << "XXXXXXXXXXX sitmap dst is: " << dstDir2.absolutePath();
|
||||
DEBUG_LOG(m_logger) << "XXXXXXXXXXX sitmap dst is: " << dstDir2.absolutePath();
|
||||
|
||||
auto cp2 = new CopyProcess(fileInfo.absoluteDir(), dstDir2, fil2, false, this);
|
||||
setOverlay(cp2->process());
|
||||
@@ -849,15 +849,15 @@ void USBDialog::slotCopyWinBinP3()
|
||||
const QString autorunFile = NGL::findFile(NGL::FileType::ConfigFile, QStringLiteral("autorun.inf"));
|
||||
if (autorunFile.isEmpty())
|
||||
{
|
||||
ERROR_LOG() << "autorunFile init is not accessible";
|
||||
ERROR_LOG(m_logger) << "autorunFile init is not accessible";
|
||||
return;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo2(autorunFile);
|
||||
QFileInfoList fil;
|
||||
fil = prepareFileInfoListForFolder(fileInfo2.absoluteDir().path(), fil);
|
||||
DEBUG_LOG() << "XXXXXXXXXXX autofinFile is: " << fileInfo2.absoluteDir().path();
|
||||
DEBUG_LOG() << "XXXXXXXXXXX filsize is: " << fil.size();
|
||||
DEBUG_LOG(m_logger) << "XXXXXXXXXXX autofinFile is: " << fileInfo2.absoluteDir().path();
|
||||
DEBUG_LOG(m_logger) << "XXXXXXXXXXX filsize is: " << fil.size();
|
||||
|
||||
auto cp3 = new CopyProcess(fileInfo2.absoluteDir(), dstDir, fil, false, this);
|
||||
setOverlay(cp3->process());
|
||||
@@ -1206,7 +1206,7 @@ void USBDialog::scriptDeleted(int scriptId)
|
||||
const QFileInfoList fil(dir.entryInfoList());
|
||||
if (fil.isEmpty())
|
||||
{
|
||||
DEBUG_LOG() << "no scripts left";
|
||||
DEBUG_LOG(m_logger) << "no scripts left";
|
||||
|
||||
|
||||
|
||||
@@ -1220,7 +1220,7 @@ void USBDialog::scriptDeleted(int scriptId)
|
||||
}
|
||||
catch (const QString &str)
|
||||
{
|
||||
ERROR_LOG() << "ExerciseJsonHandler failed: " << str;
|
||||
ERROR_LOG(m_logger) << "ExerciseJsonHandler failed: " << str;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1234,7 +1234,7 @@ void USBDialog::scriptDeleted(int scriptId)
|
||||
}
|
||||
catch (const QString &str)
|
||||
{
|
||||
ERROR_LOG() << "DataJsonHandler failed: " << str;
|
||||
ERROR_LOG(m_logger) << "DataJsonHandler failed: " << str;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1276,7 +1276,7 @@ void USBDialog::scriptCopied(int )
|
||||
}
|
||||
catch (const QString &str)
|
||||
{
|
||||
ERROR_LOG() << "DataJsonHandler failed: " << str;
|
||||
ERROR_LOG(m_logger) << "DataJsonHandler failed: " << str;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1319,7 +1319,7 @@ void USBDialog::slotCopy()
|
||||
|
||||
if (!dstDir.exists())
|
||||
{
|
||||
ERROR_LOG() << "dst dir " << m_usbRoot << " is not accessible";
|
||||
ERROR_LOG(m_logger) << "dst dir " << m_usbRoot << " is not accessible";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1327,7 +1327,7 @@ void USBDialog::slotCopy()
|
||||
|
||||
if (!dstDir.mkpath(dstDir.absolutePath()))
|
||||
{
|
||||
ERROR_LOG() << "Could not create destination path " << dstDir.absolutePath();
|
||||
ERROR_LOG(m_logger) << "Could not create destination path " << dstDir.absolutePath();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1343,14 +1343,14 @@ void USBDialog::slotCopy()
|
||||
return;
|
||||
|
||||
QString src(getScriptFolder(esi.rootDirectory, esi.exerciseId, esi.scriptId));
|
||||
DEBUG_LOG() << "src" << src;
|
||||
DEBUG_LOG(m_logger) << "src" << src;
|
||||
|
||||
QDir srcDir(src);
|
||||
QDir bldgDir( QStringLiteral("%1/BuildingModels").arg(getContentFolder(esi.rootDirectory, esi.exerciseId)));
|
||||
|
||||
if (!srcDir.exists())
|
||||
{
|
||||
ERROR_LOG() << "src dir " << src << " is not accessible";
|
||||
ERROR_LOG(m_logger) << "src dir " << src << " is not accessible";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1395,7 +1395,7 @@ void USBDialog::slotRemove()
|
||||
return;
|
||||
|
||||
|
||||
DEBUG_LOG() << "mil.size()" << mil.size();
|
||||
DEBUG_LOG(m_logger) << "mil.size()" << mil.size();
|
||||
|
||||
|
||||
for (const QModelIndex &idx : mil)
|
||||
@@ -1421,7 +1421,7 @@ void USBDialog::slotRemoveMaps()
|
||||
|
||||
if (!dir.exists())
|
||||
{
|
||||
ERROR_LOG() << "dir " << m_usbRoot << " is not accessible";
|
||||
ERROR_LOG(m_logger) << "dir " << m_usbRoot << " is not accessible";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1430,12 +1430,12 @@ void USBDialog::slotRemoveMaps()
|
||||
return;
|
||||
|
||||
|
||||
DEBUG_LOG() << "mil.size()" << mil.size();
|
||||
DEBUG_LOG(m_logger) << "mil.size()" << mil.size();
|
||||
|
||||
|
||||
for (const QModelIndex &idx : mil)
|
||||
{
|
||||
DEBUG_LOG() << "rm" << idx.data().toString();
|
||||
DEBUG_LOG(m_logger) << "rm" << idx.data().toString();
|
||||
QFile::remove(dir.absolutePath() + QDir::separator() + idx.data().toString());
|
||||
}
|
||||
|
||||
@@ -1515,7 +1515,7 @@ void USBDialog::retranslate()
|
||||
|
||||
void USBDialog::initModel()
|
||||
{
|
||||
DEBUG_LOG() << "(re)initModel !!";
|
||||
DEBUG_LOG(m_logger) << "(re)initModel !!";
|
||||
|
||||
|
||||
|
||||
|
||||
+4
@@ -91,6 +91,10 @@ private slots:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
enum class What
|
||||
{
|
||||
ScriptWasDeletedFromExercise,
|
||||
|
||||
+2
-2
@@ -208,11 +208,11 @@ void ExportedScriptsModel::setServerContent(const QString &jsonObject)
|
||||
}
|
||||
catch(const std::runtime_error &err)
|
||||
{
|
||||
ERROR_LOG() << "something went wrong: " << err.what();
|
||||
ERROR_LOG(m_logger) << "something went wrong: " << err.what();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
ERROR_LOG() << "something went wrong";
|
||||
ERROR_LOG(m_logger) << "something went wrong";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -43,6 +43,8 @@ public:
|
||||
void writeScriptsJson() noexcept(false);
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
private:
|
||||
|
||||
+2
@@ -32,5 +32,7 @@ public:
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
+17
-18
@@ -41,7 +41,7 @@
|
||||
|
||||
|
||||
#ifndef ELOG
|
||||
#define ELOG ERROR_LOG()
|
||||
#define ELOG ERROR_LOG(m_logger)
|
||||
#endif
|
||||
|
||||
using err = std::runtime_error;
|
||||
@@ -51,9 +51,8 @@ err error(const QString &msg) { return err(msg.toStdString()); }
|
||||
namespace TakeHomePackageManager
|
||||
{
|
||||
|
||||
Compressor::Compressor()
|
||||
: QObject(nullptr)
|
||||
{}
|
||||
Compressor::Compressor() : QObject(nullptr),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
|
||||
void Compressor::go(ProcessOverlay *processOverlay, QIODevice &out, const QString &sourceDir, const QString &destRootDir) noexcept(false)
|
||||
@@ -131,7 +130,7 @@ HttpProcess::HttpProcess(LtsWidgets::LtsDialog *dialog, const QString &statusMes
|
||||
connect(m_process, &ProcessOverlay::signalCancel,
|
||||
this, [this]()
|
||||
{
|
||||
DEBUG_LOG() << "m_wasCanceled!!";
|
||||
DEBUG_LOG(m_logger) << "m_wasCanceled!!";
|
||||
m_process->setCancelEnabled(false);
|
||||
emit signalCancel();
|
||||
});
|
||||
@@ -143,7 +142,7 @@ HttpProcess::HttpProcess(LtsWidgets::LtsDialog *dialog, const QString &statusMes
|
||||
|
||||
HttpProcess::~HttpProcess()
|
||||
{
|
||||
DEBUG_LOG() << "~HttpProcess";
|
||||
DEBUG_LOG(m_logger) << "~HttpProcess";
|
||||
m_process->deleteLater();
|
||||
m_nam->deleteLater();
|
||||
}
|
||||
@@ -361,7 +360,7 @@ void UploadProcess::go(const QString &rootFolder, const ExportedScriptInformatio
|
||||
connect(this, &HttpProcess::signalCancel, &compressor, &Compressor::abort);
|
||||
compressor.go(m_process, *tempFile.get(), srcDir, dstDir);
|
||||
|
||||
DEBUG_LOG() << "posting file of size " << tempFile->size();
|
||||
DEBUG_LOG(m_logger) << "posting file of size " << tempFile->size();
|
||||
tempFile->seek(0);
|
||||
|
||||
QNetworkReply *rep = post(L("/thp2"), tempFile.get(), {}, L("application/octet-stream"), { { L("x-thp-info"), QString::fromUtf8(QJsonDocument(esi.toJson().toObject()).toJson(QJsonDocument::JsonFormat::Compact)) } });
|
||||
@@ -586,7 +585,7 @@ ExportedScriptsDialog::ExportedScriptsDialog(LtsSession::LtsSession *session, QW
|
||||
connect(sock, &QWebSocket::disconnected,
|
||||
this, [this, sock, openFn]()
|
||||
{
|
||||
WARNING_LOG() << "disconnected from ws... reconnecting in 3...";
|
||||
WARNING_LOG(m_logger) << "disconnected from ws... reconnecting in 3...";
|
||||
setWsConnectionStatus(WsConnectionStatus::Disconnected);
|
||||
|
||||
QTimer *t = new QTimer(sock);
|
||||
@@ -607,7 +606,7 @@ ExportedScriptsDialog::ExportedScriptsDialog(LtsSession::LtsSession *session, QW
|
||||
connect(sock, &QWebSocket::textMessageReceived,
|
||||
this, [this](const QString &msg)
|
||||
{
|
||||
DEBUG_LOG() << "new msg: '" << msg << "'";
|
||||
DEBUG_LOG(m_logger) << "new msg: '" << msg << "'";
|
||||
m_lastServerContent = msg;
|
||||
m_model->setServerContent(msg);
|
||||
onSelectionChanged();
|
||||
@@ -757,7 +756,7 @@ void ExportedScriptsDialog::setWsConnectionStatusLabel()
|
||||
|
||||
void ExportedScriptsDialog::initModel() noexcept(false)
|
||||
{
|
||||
DEBUG_LOG() << "(re)initModel !!";
|
||||
DEBUG_LOG(m_logger) << "(re)initModel !!";
|
||||
|
||||
const QString rootDirectory(localThpDir());
|
||||
|
||||
@@ -768,7 +767,7 @@ void ExportedScriptsDialog::initModel() noexcept(false)
|
||||
catch(...)
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Couldn't Load THP(s)"));
|
||||
WARNING_LOG()<<" data corrupted path: "<< localThpDir();
|
||||
WARNING_LOG(m_logger)<<" data corrupted path: "<< localThpDir();
|
||||
}
|
||||
|
||||
m_model->setOC(isOCApp());
|
||||
@@ -805,12 +804,12 @@ void ExportedScriptsDialog::uploadScript()
|
||||
}
|
||||
catch(const std::runtime_error &err)
|
||||
{
|
||||
ERROR_LOG() << "Uploaded script FAILED: " << err.what();
|
||||
ERROR_LOG(m_logger) << "Uploaded script FAILED: " << err.what();
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Uploading script failed: %1").arg(QString::fromUtf8(err.what())));
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "Uploaded script successfully";
|
||||
DEBUG_LOG(m_logger) << "Uploaded script successfully";
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Uploaded script successfully"));
|
||||
}
|
||||
|
||||
@@ -855,7 +854,7 @@ void ExportedScriptsDialog::downloadScript()
|
||||
}
|
||||
catch(const std::runtime_error &err)
|
||||
{
|
||||
ERROR_LOG() << "Downloading script FAILED: " << err.what();
|
||||
ERROR_LOG(m_logger) << "Downloading script FAILED: " << err.what();
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Downloading script failed: %1").arg(QString::fromUtf8(err.what())));
|
||||
return;
|
||||
}
|
||||
@@ -863,7 +862,7 @@ void ExportedScriptsDialog::downloadScript()
|
||||
|
||||
|
||||
|
||||
DEBUG_LOG() << "Downloaded script successfully";
|
||||
DEBUG_LOG(m_logger) << "Downloaded script successfully";
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Downloaded script successfully"));
|
||||
}
|
||||
|
||||
@@ -888,7 +887,7 @@ void ExportedScriptsDialog::removeScriptFromServer()
|
||||
}
|
||||
catch (const std::runtime_error &err)
|
||||
{
|
||||
ERROR_LOG() << err.what();
|
||||
ERROR_LOG(m_logger) << err.what();
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Failed to remove script from server!"));
|
||||
return;
|
||||
}
|
||||
@@ -941,7 +940,7 @@ void ExportedScriptsDialog::removeScriptLocal()
|
||||
}
|
||||
catch (const std::runtime_error &err)
|
||||
{
|
||||
ERROR_LOG() << err.what();
|
||||
ERROR_LOG(m_logger) << err.what();
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Failed to remove script locally!"));
|
||||
return;
|
||||
}
|
||||
@@ -965,7 +964,7 @@ void ExportedScriptsDialog::openScript()
|
||||
const auto path(QDir(scriptHtmlLocation(localThpDir(), esi.id())).path());
|
||||
const auto url(QUrl::fromLocalFile(path));
|
||||
const bool openUrlResult = QDesktopServices::openUrl(url);
|
||||
DEBUG_LOG() << "path: " << path << " - url: " << url.toString() << " - success? " << openUrlResult;
|
||||
DEBUG_LOG(m_logger) << "path: " << path << " - url: " << url.toString() << " - success? " << openUrlResult;
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -73,6 +73,8 @@ signals:
|
||||
void signalCancel();
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void waitForAnswer(QNetworkReply *r, const int expectedResponseStatus) noexcept(false);
|
||||
|
||||
QNetworkReply *post(const QString &path, QIODevice *data, const QUrlQuery &q = QUrlQuery(), const QString &contentType = QStringLiteral("application/octet-stream"), const QMap<QString, QString> &additionalHeaders = {}) noexcept(false);
|
||||
|
||||
+12
-12
@@ -63,7 +63,7 @@ WARNING_LOG(x)
|
||||
#endif
|
||||
|
||||
#ifndef ELOG
|
||||
#define ELOG ERROR_LOG()
|
||||
#define ELOG ERROR_LOG(m_logger)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ USB2Dialog::USB2Dialog(LtsSession::LtsSession *session, QWidget *parent)
|
||||
|
||||
m_ui->setupUi(this);
|
||||
|
||||
WARNING_LOG()<<" USB2Dialog::USB2Dialog() START ";
|
||||
WARNING_LOG(m_logger)<<" USB2Dialog::USB2Dialog() START ";
|
||||
connect(m_ui->pbCHange, &QPushButton::clicked,
|
||||
this, &USB2Dialog::slotChangePath);
|
||||
|
||||
@@ -135,13 +135,13 @@ USB2Dialog::USB2Dialog(LtsSession::LtsSession *session, QWidget *parent)
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
WARNING_LOG()<<" data corrupted path: "<< localThpDir();
|
||||
WARNING_LOG(m_logger)<<" data corrupted path: "<< localThpDir();
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Couldn't Load THP(s)"));
|
||||
}
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Script_Editor-Export_Script_Administration"));
|
||||
|
||||
WARNING_LOG()<<" USB2Dialog::USB2Dialog() END ";
|
||||
WARNING_LOG(m_logger)<<" USB2Dialog::USB2Dialog() END ";
|
||||
}
|
||||
|
||||
|
||||
@@ -185,15 +185,15 @@ void USB2Dialog::unmountUSB(const QString &device)
|
||||
while (process.canReadLine())
|
||||
{
|
||||
QString outputLine = QString::fromUtf8(process.readLine());
|
||||
DEBUG_LOG() << "OutputLine: " << outputLine;
|
||||
DEBUG_LOG(m_logger) << "OutputLine: " << outputLine;
|
||||
auto outputDevicePath = outputLine.split(QStringLiteral(" ")).last();
|
||||
DEBUG_LOG() << "OutputDevicePath: " << outputDevicePath;
|
||||
DEBUG_LOG(m_logger) << "OutputDevicePath: " << outputDevicePath;
|
||||
|
||||
auto outputPathStripped = outputDevicePath.replace(QLatin1String("\\x20"), QLatin1String(" "));
|
||||
DEBUG_LOG() << "OutputPathStripped: " << outputPathStripped;
|
||||
DEBUG_LOG(m_logger) << "OutputPathStripped: " << outputPathStripped;
|
||||
|
||||
auto outputDeviceName = outputPathStripped.split(QStringLiteral("/")).last();
|
||||
DEBUG_LOG() << "OutputDeviceName: " << outputDeviceName;
|
||||
DEBUG_LOG(m_logger) << "OutputDeviceName: " << outputDeviceName;
|
||||
|
||||
if (outputDeviceName.trimmed().compare(device.trimmed()) == 0)
|
||||
{
|
||||
@@ -201,7 +201,7 @@ void USB2Dialog::unmountUSB(const QString &device)
|
||||
|
||||
auto serialPort = outputLine.split(QStringLiteral(" ")).first();
|
||||
QString absPath = QStringLiteral("/dev/") + serialPort;
|
||||
DEBUG_LOG() << "Serial Port: " << absPath;
|
||||
DEBUG_LOG(m_logger) << "Serial Port: " << absPath;
|
||||
process.start(QStringLiteral("udisksctl"), QStringList() << QStringLiteral("unmount") << QStringLiteral("-b") << absPath);
|
||||
process.waitForFinished();
|
||||
reset();
|
||||
@@ -328,7 +328,7 @@ void USB2Dialog::slotUnmount()
|
||||
|
||||
for(const auto &folder : std::as_const(folderNames))
|
||||
{
|
||||
DEBUG_LOG() << "Folder: " << folder << " USB Root: " << m_usbRoot;
|
||||
DEBUG_LOG(m_logger) << "Folder: " << folder << " USB Root: " << m_usbRoot;
|
||||
|
||||
if(m_usbRoot.contains(folder))
|
||||
{
|
||||
@@ -479,7 +479,7 @@ void USB2Dialog::slotRemove()
|
||||
if (mil.size() < 1)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "mil.size()" << mil.size();
|
||||
DEBUG_LOG(m_logger) << "mil.size()" << mil.size();
|
||||
|
||||
QStringList scriptIdList;
|
||||
for (const QModelIndex &idx : mil)
|
||||
@@ -604,7 +604,7 @@ void USB2Dialog::retranslate()
|
||||
|
||||
void USB2Dialog::initLocalModel() noexcept(false)
|
||||
{
|
||||
DEBUG_LOG() << "(re)initModel !!";
|
||||
DEBUG_LOG(m_logger) << "(re)initModel !!";
|
||||
|
||||
|
||||
|
||||
|
||||
+2
@@ -52,6 +52,8 @@ private slots:
|
||||
void slotUnmount();
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void removeScript(const QString &scriptId);
|
||||
void reset();
|
||||
void initLocalModel() noexcept(false);
|
||||
|
||||
Reference in new issue
Block a user