Adds Q_OBJECT and generated includes to flm custom impls
This commit is contained in:
1 parent
d79d89c352
commit
e156fbb5e4
5 files changed
+27
-29
No files matched your search
@@ -10,17 +10,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <FileManagement/flm_db.h>
|
||||
#include <FileManagement/flm_dts.h>
|
||||
#include <FileManagement/flm_dtc.h>
|
||||
#include <FileManagement/flm_fts.h>
|
||||
#include "logger.h"
|
||||
|
||||
namespace FileManagement
|
||||
{
|
||||
class MainHandler;
|
||||
namespace Interface
|
||||
{
|
||||
class Dts;
|
||||
class Fts;
|
||||
}
|
||||
class Base : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include "flm_db_impl_custom.h"
|
||||
#include <FileManagement/flm_db_impl.h>
|
||||
#include <ngldb/nsqlquery.h>
|
||||
#include <ngldb/sql_query_janitor.h>
|
||||
#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) << "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;
|
||||
|
||||
if (!m_query)
|
||||
@@ -60,9 +59,9 @@ bool DatabaseInterfaceImplCustom::updateStatus(int fileId, const FileStatus &sta
|
||||
|
||||
DEBUG_LOG(m_logger) << "File name before = " << fileName;
|
||||
|
||||
if (status == 1) // Delete
|
||||
if (status == FileStatus::Deleted) // Delete
|
||||
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+)[}][_]")));
|
||||
|
||||
DEBUG_LOG(m_logger) << "File name after = " << fileName;
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace FileManagement
|
||||
{
|
||||
class DatabaseInterfaceImplCustom final : public DatabaseInterfaceImpl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using DatabaseInterfaceImpl::DatabaseInterfaceImpl;
|
||||
|
||||
|
||||
+20
-20
@@ -35,7 +35,7 @@ bool DtcImplCustom::getAllTemplates(QList<FileContent> &allTemplates)
|
||||
waitForHistoricalDataFileContent(4000);
|
||||
}
|
||||
for (const auto &fc : m_dtcFileContent->readAlive())
|
||||
if (fc.data().isTemplate())
|
||||
if (fc.data().isTemplate)
|
||||
allTemplates.append(fc);
|
||||
return true;
|
||||
}
|
||||
@@ -49,10 +49,10 @@ bool DtcImplCustom::getAllFiles(const FileType &fileType, int folderId, QStringL
|
||||
waitForHistoricalDataFileContent(4000);
|
||||
}
|
||||
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())
|
||||
allFiles << QString::fromStdString(fc.data().name());
|
||||
if (showHidden || !fc.data().isHidden)
|
||||
allFiles << QString::fromStdString(fc.data().name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -66,8 +66,8 @@ bool DtcImplCustom::getFilesOperator(const FileType &fileType, int folderId, int
|
||||
waitForHistoricalDataFileContent(4000);
|
||||
}
|
||||
for (const auto &fc : m_dtcFileContent->readAlive())
|
||||
if (fc.data().fileType() == fileType && fc.data().folderId() == folderId && fc.data().operatorId() == operatorId)
|
||||
allFiles << QString::fromStdString(fc.data().name());
|
||||
if (fc.data().fileType == fileType && fc.data().folderId == folderId && fc.data().operatorId == operatorId)
|
||||
allFiles << QString::fromStdString(fc.data().name);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ bool DtcImplCustom::getFile(const FileType &fileType, int folderId, const QStrin
|
||||
const auto stdFileName = fileName.toStdString();
|
||||
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;
|
||||
return true;
|
||||
@@ -99,12 +99,12 @@ int DtcImplCustom::findFolder(int parentId, const QString &name) const
|
||||
std::string stdName = name.toStdString();
|
||||
for (const auto &fld : m_dtcFolder->readAlive())
|
||||
{
|
||||
if (fld.data().parentId() == parentId)
|
||||
if (fld.data().parentId == parentId)
|
||||
{
|
||||
if (fld.data().name() == stdName)
|
||||
return fld.data().id();
|
||||
if (fld.data().name == stdName)
|
||||
return fld.data().id;
|
||||
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())
|
||||
{
|
||||
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_"
|
||||
if (exId > 0)
|
||||
return exId;
|
||||
@@ -176,16 +176,16 @@ int DtcImplCustom::getFileId(const FileType &fileType, const QString &fileName,
|
||||
for (const auto &fc : m_dtcFileContent->readAlive())
|
||||
{
|
||||
const FileContent &content = fc.data();
|
||||
bool cond = (content.fileType() == fileType && content.name() == strFileName);
|
||||
if (content.exerciseId().is_set())
|
||||
cond &= (content.exerciseId() == exerciseId);
|
||||
if (content.phaseId().is_set())
|
||||
cond &= (content.phaseId() == phaseId);
|
||||
bool cond = (content.fileType == fileType && content.name == strFileName);
|
||||
if (content.exerciseId.is_set())
|
||||
cond &= (content.exerciseId == exerciseId);
|
||||
if (content.phaseId.is_set())
|
||||
cond &= (content.phaseId == phaseId);
|
||||
|
||||
if (cond)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Found file content id = " << content.id();
|
||||
return content.id();
|
||||
DEBUG_LOG(m_logger) << "Found file content id = " << content.id;
|
||||
return content.id;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Interface
|
||||
{
|
||||
class DtcImplCustom final : public Interface::DtcImpl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector);
|
||||
|
||||
|
||||
Reference in new issue
Block a user