Adds Q_OBJECT and generated includes to flm custom impls

This commit is contained in:
berrux-dev committed 2026-09-18 17:47:34 +02:00
1 parent d79d89c352
commit e156fbb5e4
5 files changed
+27 -29

No files matched your search

@@ -10,17 +10,14 @@
#pragma once #pragma once
#include <FileManagement/flm_db.h> #include <FileManagement/flm_db.h>
#include <FileManagement/flm_dts.h>
#include <FileManagement/flm_dtc.h> #include <FileManagement/flm_dtc.h>
#include <FileManagement/flm_fts.h>
#include "logger.h" #include "logger.h"
namespace FileManagement namespace FileManagement
{ {
class MainHandler; class MainHandler;
namespace Interface
{
class Dts;
class Fts;
}
class Base : public QObject class Base : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -7,7 +7,6 @@
*/ */
#include "flm_db_impl_custom.h" #include "flm_db_impl_custom.h"
#include <FileManagement/flm_db_impl.h>
#include <ngldb/nsqlquery.h> #include <ngldb/nsqlquery.h>
#include <ngldb/sql_query_janitor.h> #include <ngldb/sql_query_janitor.h>
#include <QtCore/QRegularExpression> #include <QtCore/QRegularExpression>
@@ -27,7 +26,7 @@ bool DatabaseInterfaceImplCustom::updateStatus(int fileId, const FileStatus &sta
DEBUG_LOG(m_logger) << "Update statement: " << stmtUpdate; DEBUG_LOG(m_logger) << "Update statement: " << stmtUpdate;
DEBUG_LOG(m_logger) << "File Id = " << fileId; DEBUG_LOG(m_logger) << "File Id = " << fileId;
DEBUG_LOG(m_logger) << "New status = " << status; DEBUG_LOG(m_logger) << "New status = " << static_cast<int>(status);
DEBUG_LOG(m_logger) << "Operator Id = " << operatorId; DEBUG_LOG(m_logger) << "Operator Id = " << operatorId;
if (!m_query) if (!m_query)
@@ -60,9 +59,9 @@ bool DatabaseInterfaceImplCustom::updateStatus(int fileId, const FileStatus &sta
DEBUG_LOG(m_logger) << "File name before = " << fileName; DEBUG_LOG(m_logger) << "File name before = " << fileName;
if (status == 1) // Delete if (status == FileStatus::Deleted) // Delete
fileName = QStringLiteral("{")+QString::number(fileId)+QStringLiteral("}_")+fileName; fileName = QStringLiteral("{")+QString::number(fileId)+QStringLiteral("}_")+fileName;
if (status == 0 && fileName.startsWith(QStringLiteral("{"))) // Restore if (status == FileStatus::Valid && fileName.startsWith(QStringLiteral("{"))) // Restore
fileName.remove(QRegularExpression(QStringLiteral("^[{](\\d+)[}][_]"))); fileName.remove(QRegularExpression(QStringLiteral("^[{](\\d+)[}][_]")));
DEBUG_LOG(m_logger) << "File name after = " << fileName; DEBUG_LOG(m_logger) << "File name after = " << fileName;
@@ -13,6 +13,7 @@ namespace FileManagement
{ {
class DatabaseInterfaceImplCustom final : public DatabaseInterfaceImpl class DatabaseInterfaceImplCustom final : public DatabaseInterfaceImpl
{ {
Q_OBJECT
public: public:
using DatabaseInterfaceImpl::DatabaseInterfaceImpl; using DatabaseInterfaceImpl::DatabaseInterfaceImpl;
@@ -35,7 +35,7 @@ bool DtcImplCustom::getAllTemplates(QList<FileContent> &allTemplates)
waitForHistoricalDataFileContent(4000); waitForHistoricalDataFileContent(4000);
} }
for (const auto &fc : m_dtcFileContent->readAlive()) for (const auto &fc : m_dtcFileContent->readAlive())
if (fc.data().isTemplate()) if (fc.data().isTemplate)
allTemplates.append(fc); allTemplates.append(fc);
return true; return true;
} }
@@ -49,10 +49,10 @@ bool DtcImplCustom::getAllFiles(const FileType &fileType, int folderId, QStringL
waitForHistoricalDataFileContent(4000); waitForHistoricalDataFileContent(4000);
} }
for (const auto &fc : m_dtcFileContent->readAlive()) for (const auto &fc : m_dtcFileContent->readAlive())
if (fc.data().fileType() == fileType && fc.data().folderId() == folderId) if (fc.data().fileType == fileType && fc.data().folderId == folderId)
{ {
if (showHidden || !fc.data().isHidden()) if (showHidden || !fc.data().isHidden)
allFiles << QString::fromStdString(fc.data().name()); allFiles << QString::fromStdString(fc.data().name);
} }
return true; return true;
} }
@@ -66,8 +66,8 @@ bool DtcImplCustom::getFilesOperator(const FileType &fileType, int folderId, int
waitForHistoricalDataFileContent(4000); waitForHistoricalDataFileContent(4000);
} }
for (const auto &fc : m_dtcFileContent->readAlive()) for (const auto &fc : m_dtcFileContent->readAlive())
if (fc.data().fileType() == fileType && fc.data().folderId() == folderId && fc.data().operatorId() == operatorId) if (fc.data().fileType == fileType && fc.data().folderId == folderId && fc.data().operatorId == operatorId)
allFiles << QString::fromStdString(fc.data().name()); allFiles << QString::fromStdString(fc.data().name);
return true; return true;
} }
@@ -82,7 +82,7 @@ bool DtcImplCustom::getFile(const FileType &fileType, int folderId, const QStrin
const auto stdFileName = fileName.toStdString(); const auto stdFileName = fileName.toStdString();
for (const auto &fc : m_dtcFileContent->readAlive()) for (const auto &fc : m_dtcFileContent->readAlive())
{ {
if (fc.data().fileType() == fileType && fc.data().folderId() == folderId && fc.data().name() == stdFileName) if (fc.data().fileType == fileType && fc.data().folderId == folderId && fc.data().name == stdFileName)
{ {
fileMetadata = fc; fileMetadata = fc;
return true; return true;
@@ -99,12 +99,12 @@ int DtcImplCustom::findFolder(int parentId, const QString &name) const
std::string stdName = name.toStdString(); std::string stdName = name.toStdString();
for (const auto &fld : m_dtcFolder->readAlive()) for (const auto &fld : m_dtcFolder->readAlive())
{ {
if (fld.data().parentId() == parentId) if (fld.data().parentId == parentId)
{ {
if (fld.data().name() == stdName) if (fld.data().name == stdName)
return fld.data().id(); return fld.data().id;
else else
foldersVec.append(fld.data().id()); foldersVec.append(fld.data().id);
} }
} }
@@ -152,9 +152,9 @@ int DtcImplCustom::getExerciseId(int folderId)
} }
for (const auto &fld : m_dtcFolder->readAlive()) for (const auto &fld : m_dtcFolder->readAlive())
{ {
if (fld.data().id() == folderId) if (fld.data().id == folderId)
{ {
int exId = QString::fromStdString(fld.data().name()).remove(0,4).toInt(); int exId = QString::fromStdString(fld.data().name).remove(0,4).toInt();
// can be "$EX_" or "$PH_" // can be "$EX_" or "$PH_"
if (exId > 0) if (exId > 0)
return exId; return exId;
@@ -176,16 +176,16 @@ int DtcImplCustom::getFileId(const FileType &fileType, const QString &fileName,
for (const auto &fc : m_dtcFileContent->readAlive()) for (const auto &fc : m_dtcFileContent->readAlive())
{ {
const FileContent &content = fc.data(); const FileContent &content = fc.data();
bool cond = (content.fileType() == fileType && content.name() == strFileName); bool cond = (content.fileType == fileType && content.name == strFileName);
if (content.exerciseId().is_set()) if (content.exerciseId.is_set())
cond &= (content.exerciseId() == exerciseId); cond &= (content.exerciseId == exerciseId);
if (content.phaseId().is_set()) if (content.phaseId.is_set())
cond &= (content.phaseId() == phaseId); cond &= (content.phaseId == phaseId);
if (cond) if (cond)
{ {
DEBUG_LOG(m_logger) << "Found file content id = " << content.id(); DEBUG_LOG(m_logger) << "Found file content id = " << content.id;
return content.id(); return content.id;
} }
} }
return 0; return 0;
@@ -18,6 +18,7 @@ namespace Interface
{ {
class DtcImplCustom final : public Interface::DtcImpl class DtcImplCustom final : public Interface::DtcImpl
{ {
Q_OBJECT
public: public:
explicit DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector); explicit DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector);