Adds immediate migration results in progress

This commit is contained in:
torsten committed 2026-08-19 11:18:24 +02:00
1 parent 8453e104c5
commit 3bb6e89496
2102 files changed
+17482 -15071

No files matched your search

@@ -57,7 +57,7 @@ ScriptChooser::ScriptChooser(const std::shared_ptr<Interface::Dtc> &dtc,
PresentationManagementDialogModel::Columns::Operator, QVariant(LtsSessionData::LtsSessionData::getInstance()->getOperatorId())
);
if (!bSetOperator)
WARNING_LOG() << "could not set initial operator id to " << operatorId;
WARNING_LOG(m_logger) << "could not set initial operator id to " << operatorId;
connect(m_ui->ltsDataView, &LtsDataView::LtsDataView::signalSelectionChanged,
this, &ScriptChooser::onEnaDisa, Qt::QueuedConnection);
@@ -186,7 +186,7 @@ void ScriptChooser::onDeleteScript()
req.fileStatus(fs);
req.operatorId(LtsSessionData::LtsSessionData::getInstance()->getOperatorId());
req.lastModified(QDateTime::currentMSecsSinceEpoch());
DEBUG_LOG() << "Changing status for presentation id = " << pre.id();
DEBUG_LOG(m_logger) << "Changing status for presentation id = " << pre.id();
m_requestHelper->startSingleRequest([this, req]()
{
@@ -197,7 +197,7 @@ void ScriptChooser::onDeleteScript()
m_ui->ltsDataView->proxyModel()->removeRow(srcIdx.row());
if (m_requestHelper->failed())
ERROR_LOG() << "Failed to change status for presentation-script_chooser";
ERROR_LOG(m_logger) << "Failed to change status for presentation-script_chooser";
}
}
@@ -38,6 +38,7 @@ public:
~ScriptChooser();
protected:
NGL::INGLLogger &m_logger;
void closeEvent(QCloseEvent *event) override;
void onPresentationRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
void onPresentationChangeStatusReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
@@ -41,17 +41,17 @@ bool DbReader::loadPlugin(const LtsPluginManager::PluginInstance &pi)
RecordReplay::RecordReplayPlugin *recPlugin = qobject_cast<RecordReplay::RecordReplayPlugin*>(pi.plugin);
if (!recPlugin)
{
ERROR_LOG() << "Cannot load RecordReplayPlugin " << pi.fileName;
ERROR_LOG(m_logger) << "Cannot load RecordReplayPlugin " << pi.fileName;
return false;
}
if (!recPlugin->initCopy(m_exerciseId, m_bSupportsSchemasFrom, m_bSupportsSchemasTo))
{
ERROR_LOG() << "Initialisation for RecordReplayPlugin " << pi.fileName << " failed ";
ERROR_LOG(m_logger) << "Initialisation for RecordReplayPlugin " << pi.fileName << " failed ";
return false;
}
INFO_LOG() << "Loaded record replay plugin " << recPlugin->pluginName();
INFO_LOG(m_logger) << "Loaded record replay plugin " << recPlugin->pluginName();
m_plugins += recPlugin;
return true;
@@ -89,7 +89,7 @@ bool DbReader::createTables()
if (record.isEmpty())
{
ERROR_LOG() << "Empty record for " << fqTableName;
ERROR_LOG(m_logger) << "Empty record for " << fqTableName;
return false;
}
@@ -102,7 +102,7 @@ bool DbReader::createTables()
bool DbReader::copyData(qint64 fromTime, qint64 toTime)
{
INFO_LOG() << "IN readData";
INFO_LOG(m_logger) << "IN readData";
if (!m_queryFrom || !m_queryTo)
return false;
@@ -30,8 +30,10 @@ public:
static bool createTable(NSqlQuery &q, const QString &tableName, const QSqlRecord &record, const QSqlIndex &pk, NGL::INGLLogger &logger);
private:
NGL::INGLLogger &m_logger;
bool loadPlugin(const LtsPluginManager::PluginInstance &pi);
private:
NGL::INGLLogger &m_logger;
int m_exerciseId;
QSqlDatabase m_dbFrom;
QSqlDatabase m_dbTo;
@@ -61,12 +61,12 @@ void DVDWriter::incomingDataAvailable()
while (m_dvdBurnProcess && m_dvdBurnProcess->canReadLine())
{
const QByteArray qB = m_dvdBurnProcess->readLine().trimmed();
INFO_LOG() << "qb = " << qB.data()
INFO_LOG(m_logger) << "qb = " << qB.data()
<< " m_packageDir=" << m_packageDir;
if (qB.contains(":-["))
{
ERROR_LOG() << "growisofs error: '" << qB << "'";
ERROR_LOG(m_logger) << "growisofs error: '" << qB << "'";
cleanupProcess();
QString errString = QString::fromUtf8(qB.mid(3));
@@ -108,7 +108,7 @@ void DVDWriter::incomingDataAvailable()
m_pProgressDlg->setValue(100);
else if (qB.contains("media is not recognized"))
{
ERROR_LOG() << "growisofs error: '" << qB << "'";
ERROR_LOG(m_logger) << "growisofs error: '" << qB << "'";
cleanupProcess();
if (LtsWidgets::LtsMessageDialog::showMessage(qobject_cast<QWidget *>(parent()), tr("No DVD in drive. Try again?"),
@@ -122,7 +122,7 @@ void DVDWriter::incomingDataAvailable()
}
else if (qB.contains(":-( unable to open"))
{
ERROR_LOG() << "growisofs error: '" << qB << "'";
ERROR_LOG(m_logger) << "growisofs error: '" << qB << "'";
cleanupProcess();
if (LtsWidgets::LtsMessageDialog::showMessage(qobject_cast<QWidget *>(parent()), tr("Unable to open DVD device. Try again?"),
@@ -136,7 +136,7 @@ void DVDWriter::incomingDataAvailable()
}
else if (qB.contains(":-("))
{
ERROR_LOG() << "growisofs error: '" << qB << "'";
ERROR_LOG(m_logger) << "growisofs error: '" << qB << "'";
cleanupProcess();
QString strError(tr("Unable to open DVD device"));
@@ -159,12 +159,12 @@ void DVDWriter::incomingDataAvailable()
void DVDWriter::dvdFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
INFO_LOG() << "growisofs ends with extitCode : '" << exitCode << " and ExitStatus '" << exitStatus;
INFO_LOG(m_logger) << "growisofs ends with extitCode : '" << exitCode << " and ExitStatus '" << exitStatus;
if (!m_dvdBurnProcess)
{
WARNING_LOG() << "dvdFinished with error code: " << exitCode << ", status: " << exitStatus
WARNING_LOG(m_logger) << "dvdFinished with error code: " << exitCode << ", status: " << exitStatus
<< " process is already cleaned up";
return;
}
@@ -180,7 +180,7 @@ void DVDWriter::dvdFinished(int exitCode, QProcess::ExitStatus exitStatus)
}
else
{
ERROR_LOG() << "dvdFinished with error code: " << exitCode << ", status: " << exitStatus;
ERROR_LOG(m_logger) << "dvdFinished with error code: " << exitCode << ", status: " << exitStatus;
LtsWidgets::LtsMessageDialog::showMessage(qobject_cast<QWidget *>(parent()), tr("Burning aborted with an unkown error %1").arg(exitCode));
cleanup(false);
}
@@ -33,6 +33,8 @@ private slots:
void dvdFinished(int exitCode, QProcess::ExitStatus exitStatus);
private:
NGL::INGLLogger &m_logger;
void cleanup(bool success);
void cleanupProcess();
bool checkBuringCapabilities();
@@ -112,7 +112,7 @@ void ExportProcess::slotStartExport()
auto it = m_trackEntryAssignments.constFind(QString::fromStdString(content.presentationTopicType()));
if (it == m_trackEntryAssignments.constEnd())
{
ERROR_LOG() << "Invalid content for type (" << content.presentationTopicType() << "): " << QString::fromStdString(content.presentationTopicType());
ERROR_LOG(m_logger) << "Invalid content for type (" << content.presentationTopicType() << "): " << QString::fromStdString(content.presentationTopicType());
continue;
}
@@ -147,7 +147,7 @@ void ExportProcess::slotStartExport()
if (it == m_trackEntryAssignments.constEnd())
{
ERROR_LOG() << "Invalid content for presentation type " << content.presentationTopicType();
ERROR_LOG(m_logger) << "Invalid content for presentation type " << content.presentationTopicType();
continue;
}
@@ -256,7 +256,7 @@ QVector<ExportStep *> ExportProcess::checkAdditionalExportEntries(
addData.id = parentData.id;
auto topicExportIfc = topicIfcFromType(addData.topicType, ExportOrReplay::Export);
DEBUG_LOG() << "addEntry type: " << addData.topicType << ", ifc: " << topicExportIfc;
DEBUG_LOG(m_logger) << "addEntry type: " << addData.topicType << ", ifc: " << topicExportIfc;
if (!topicExportIfc)
continue;
@@ -264,7 +264,7 @@ QVector<ExportStep *> ExportProcess::checkAdditionalExportEntries(
ret += createExportStep(realParentId, addData, topicExportIfc, allSitReplayTimes);
m_cntTopicsToExport++;
}
DEBUG_LOG() << "topic count: " << m_cntTopicsToExport;
DEBUG_LOG(m_logger) << "topic count: " << m_cntTopicsToExport;
return ret;
}
@@ -285,7 +285,7 @@ ExportStep *ExportProcess::createExportStep(
connect(pExportStep, &TakeHomePackageGenerator::ExportStep::signalExportFailed,
this, &ExportProcess::slotRunExportStep, Qt::QueuedConnection);
DEBUG_LOG() << "Adding filter step " << data.topicType;
DEBUG_LOG(m_logger) << "Adding filter step " << data.topicType;
return pExportStep;
}
@@ -294,7 +294,7 @@ TopicReplay::Interface *ExportProcess::topicIfcFromType(TopicEditorBase::TopicTy
auto it = m_trackEntryAssignments.constFind(TopicEditorBase::topicTypeString(type));
if (it == m_trackEntryAssignments.constEnd())
{
WARNING_LOG() << "Invalid content for presentation type " << type;
WARNING_LOG(m_logger) << "Invalid content for presentation type " << type;
return nullptr;
}
@@ -302,7 +302,7 @@ TopicReplay::Interface *ExportProcess::topicIfcFromType(TopicEditorBase::TopicTy
TopicReplay::Interface *topicIfc = exportOrReplay == ExportOrReplay::Export ? ta.topicExportFactory->createInterface(ta.topicType)
: ta.topicReplayFactory->createInterface(ta.topicType);
if (!topicIfc)
WARNING_LOG() << "Could not find replay interface for " << type;
WARNING_LOG(m_logger) << "Could not find replay interface for " << type;
return topicIfc;
}
@@ -319,13 +319,13 @@ void ExportProcess::slotRunExportStep()
{
if (m_logger.isDebugEnabled())
{
DEBUG_LOG() << "ExportProcess::slotRunExportStep() CALLED, m_vecExportSteps.size(): " << m_vecExportSteps.size()
DEBUG_LOG(m_logger) << "ExportProcess::slotRunExportStep() CALLED, m_vecExportSteps.size(): " << m_vecExportSteps.size()
<< ", m_vecExportStepsExecuted.size(): " << m_vecExportStepsExecuted.size();
for (const auto &s : std::as_const(m_vecExportSteps))
DEBUG_LOG() << "m_vecExportSteps: " << s << " compare: " << (s == sender());
DEBUG_LOG(m_logger) << "m_vecExportSteps: " << s << " compare: " << (s == sender());
for (const auto &s : std::as_const(m_vecExportStepsExecuted))
DEBUG_LOG() << "m_vecExportStepsExecuted: " << s << " compare: " << (s == sender());
DEBUG_LOG(m_logger) << "m_vecExportStepsExecuted: " << s << " compare: " << (s == sender());
}
if (m_pProgressDlg->wasCanceled())
@@ -346,7 +346,7 @@ void ExportProcess::slotRunExportStep()
.arg(TopicEditorBase::topicTypeString(pExportStep->m_topicData.topicType))
.arg(m_vecExportStepsExecuted.size())
.arg(m_cntTopicsToExport));
DEBUG_LOG() << strExportLabel;
DEBUG_LOG(m_logger) << strExportLabel;
m_pProgressDlg->setLabelText(strExportLabel);
QString strExportPath(contentPath() + QString::number(pExportStep->topicId()) + QLatin1Char('/'));
@@ -438,11 +438,11 @@ void ExportProcess::createDataJson(const std::shared_ptr<ExerciseManagement::Int
{
{
DEBUG_LOG() << "Add exercise to ExportRootPath";
DEBUG_LOG(m_logger) << "Add exercise to ExportRootPath";
QFile file(exportRootPath() + 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;
}
QJsonDocument doc(QJsonDocument::fromJson(file.readAll()));
@@ -453,12 +453,12 @@ void ExportProcess::createDataJson(const std::shared_ptr<ExerciseManagement::Int
obj[QStringLiteral("Exercises")] = arr;
file.resize(0);
file.write(QJsonDocument(obj).toJson(QJsonDocument::Indented));
INFO_LOG() << " file.write " << QJsonDocument(obj).toJson(QJsonDocument::Indented);
INFO_LOG(m_logger) << " file.write " << QJsonDocument(obj).toJson(QJsonDocument::Indented);
file.close();
}
QFile file(exportPath(m_pSession->exerciseId()) + QStringLiteral("data.json"));
INFO_LOG() << "ExportProcess::createDataJson " << exportPath(m_pSession->exerciseId()) + QStringLiteral("data.json");
INFO_LOG(m_logger) << "ExportProcess::createDataJson " << exportPath(m_pSession->exerciseId()) + QStringLiteral("data.json");
if (!file.open(QFile::ReadWrite))
return;
@@ -507,7 +507,7 @@ void ExportProcess::createDataJson(const std::shared_ptr<ExerciseManagement::Int
}
file.resize(0);
file.write(QJsonDocument(obj).toJson(QJsonDocument::Indented));
INFO_LOG() << " file.write " << QJsonDocument(obj).toJson(QJsonDocument::Indented);
INFO_LOG(m_logger) << " file.write " << QJsonDocument(obj).toJson(QJsonDocument::Indented);
file.close();
}
@@ -545,7 +545,7 @@ void ExportProcess::createPresentationTable()
{
if (s->exportFailed())
{
WARNING_LOG() << "Export failed for " << s->topicId();
WARNING_LOG(m_logger) << "Export failed for " << s->topicId();
continue;
}
@@ -620,9 +620,9 @@ void ExportProcess::copyStaticContent() const
QString exportPathStr = exportPath(m_pSession->exerciseId());
exportPathStr.truncate(exportPathStr.size() - 1);
if (!NGL::copyDirContentsToDir(QStringLiteral("thp"), exportPathStr, true))
WARNING_LOG() << "Could not find thp static content directory exportPath=" << exportPathStr;
WARNING_LOG(m_logger) << "Could not find thp static content directory exportPath=" << exportPathStr;
if (!NGL::copyDirContentsToDir(QStringLiteral("thp_standalone"), exportPathStr + QDir::separator() + QString::number(m_scriptId), true))
WARNING_LOG() << "Could not find thp_standalone static content directory exportPath=" << exportPathStr + QDir::separator() + QString::number(m_scriptId);
WARNING_LOG(m_logger) << "Could not find thp_standalone static content directory exportPath=" << exportPathStr + QDir::separator() + QString::number(m_scriptId);
}
@@ -70,6 +70,7 @@ private slots:
void slotRunExportStep();
private:
NGL::INGLLogger &m_logger;
QVector<ExportStep *> parseFilterSteps(
int parentTopicId, QJsonObject &detailData, const QVector<TopicReplay::Interface::SituationReplayTime> &allSitReplayTimes
);
@@ -101,6 +102,7 @@ private:
void copyStaticContent() const;
private:
NGL::INGLLogger &m_logger;
QVector<ExportStep *> m_vecExportSteps;
QVector<ExportStep *> m_vecExportStepsExecuted;
@@ -41,7 +41,7 @@ SituationExporter::~SituationExporter()
bool SituationExporter::exportStaticData(const QString &strPathToFile)
{
DEBUG_LOG() << "Exporting static data to " << strPathToFile;
DEBUG_LOG(m_logger) << "Exporting static data to " << strPathToFile;
m_dbIn.close();
m_dbOut.close();
@@ -106,7 +106,7 @@ bool SituationExporter::exportStaticData(const QString &strPathToFile)
{
if (!copyTable(t, false))
{
ERROR_LOG() << "Copying table " << t.schema << "." << t.table << " failed... ";
ERROR_LOG(m_logger) << "Copying table " << t.schema << "." << t.table << " failed... ";
return false;
}
}
@@ -123,7 +123,7 @@ bool SituationExporter::exportStaticData(const QString &strPathToFile)
{
if (!copyTable(t, true))
{
ERROR_LOG() << "Copying table " << t.schema << "." << t.table << " failed... ";
ERROR_LOG(m_logger) << "Copying table " << t.schema << "." << t.table << " failed... ";
return false;
}
}
@@ -160,11 +160,11 @@ bool SituationExporter::copyTable(const StaticTableToCopy &t, bool bOnlyCreateSc
const QString fqTableName(t.schema.isEmpty() ? t.table : (t.schema + QLatin1Char('.') + t.table));
DEBUG_LOG() << "Copying " << fqTableName << " started";
DEBUG_LOG(m_logger) << "Copying " << fqTableName << " started";
const QSqlRecord record = m_dbIn.record(fqTableName);
if (record.isEmpty())
{
ERROR_LOG() << "Empty record for " << fqTableName;
ERROR_LOG(m_logger) << "Empty record for " << fqTableName;
return false;
}
QStringList selectTableColumns;
@@ -197,17 +197,17 @@ bool SituationExporter::copyTable(const StaticTableToCopy &t, bool bOnlyCreateSc
selectTableColumns.join(QStringLiteral(", ")),
insertTablePlaceholder.join(QStringLiteral(", "))));
DEBUG_LOG() << selectTableCommand;
DEBUG_LOG() << insertTableCommand;
DEBUG_LOG(m_logger) << selectTableCommand;
DEBUG_LOG(m_logger) << insertTableCommand;
if (!qOut.prepare(insertTableCommand))
{
ERROR_LOG() << "qOut prepare failed... " << qOut.lastError().text();
ERROR_LOG(m_logger) << "qOut prepare failed... " << qOut.lastError().text();
return false;
}
if (!qIn.exec(selectTableCommand))
{
ERROR_LOG() << "qIn select failed... " << qIn.lastError().text();
ERROR_LOG(m_logger) << "qIn select failed... " << qIn.lastError().text();
return false;
}
while (qIn.next())
@@ -216,11 +216,11 @@ bool SituationExporter::copyTable(const StaticTableToCopy &t, bool bOnlyCreateSc
qOut.bindValue(insertTablePlaceholder.at(i), qIn.value(i));
if (!qOut.exec())
{
ERROR_LOG() << "qOut insert failed.. " << qOut.lastError().text();
ERROR_LOG(m_logger) << "qOut insert failed.. " << qOut.lastError().text();
return false;
}
}
DEBUG_LOG() << "Copying " << fqTableName << " finished";
DEBUG_LOG(m_logger) << "Copying " << fqTableName << " finished";
return true;
}
@@ -18,6 +18,7 @@ public:
bool exportDynamicData(qint64 fromTime, qint64 toTime);
private:
NGL::INGLLogger &m_logger;
struct StaticTableToCopy
{
QString schema;
@@ -27,6 +28,7 @@ private:
bool copyTable(const StaticTableToCopy &t, bool bOnlyCreateSchema);
private:
NGL::INGLLogger &m_logger;
int m_exerciseId;
QSqlDatabase m_dbIn;
QSqlDatabase m_dbOut;