Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Application/AarApp/databases_model.h
T
Berrux Kana 3f7beb3c7e Qt6 migration: build fixes for Groups 10/11 + missing plugin modules
Continue the Qt5->Qt6 migration so the LTS Projects (Group 10) and LTS
Application (Group 11) compile, link, and ctest runs.

Qt5->Qt6 API migration (resolves removed/deprecated Qt6 APIs) across Lts
Tools and Apps, e.g. QAction->QActionGroup, QAbstractSocket::errorOccurred,
Qt::SkipEmptyParts, QRandomGenerator, QInputDevice::DeviceType,
QRegularExpression, QLatin1Literal->QStringLiteral, and the SampleModel
m_description->description rename.

CMake build fixes:
- CMakeLists.txt: add Lts/Common to CMAKE_AUTOMOC_INCLUDE_DIRECTORIES so moc
  resolves Q_INTERFACES(ProjectPlugin::Plugin) for the migrated Projects.
- cmake/NGLMacros.cmake: NGL_COMPILE_RESOURCES - replace return() (which aborts
  the calling CMakeLists.txt) with an if/else/endif.
- OpApp/THP: guard the ArcGISQt5Hack link with $<IF:$<TARGET_EXISTS:...>> (the
  target is absent when the SituationMap viewer is stubbed); matches
  CentralEffectSimulation.
- LtsSession: prefer the in-tree svcCoreClient target over a FIND_LIBRARY in
  /usr/local/lib.
- CnrProxyTester/DotMatrixDisplay: set AUTOUIC_SEARCH_PATHS for the ui/ subdir.
- TopicDiscover: link NGLLogger.

Export-header visibility stubs (expand the empty *_EXPORT macro to
__attribute__((visibility("default"))); the build sets -fvisibility=hidden and
these stubs shadow the CMake-generated header):
- include/LtsProjectionWorkstation/ltsprojectionworkstation_export.h (fixes
  undefined reference to LtsProjectionWorkstation::getInstance /
  setProjectionOperatorPreset)
- include/LtsSession/ltssession_export.h, include/LtsUtilsGuiDds/ltsutilsguidds_export.h (same pattern)

New plugin modules (copied from legacy) so LtsAppDescriptorChecker finds the
gui:3 IIDs referenced by the Projects' apps.json:
- TakeHomePackageManager/OldTHP              gui:3:tpm.man, gui:3:tpm.usb
- PresentationManagement/.../ScriptEditor   gui:3:pre.script.edit
- Timeline/Gui/EventTimelineClassic         gui:3:tln.view

new_docker_build.sh: correct group targets to the actual CMake target names,
guard LtsReportDisplay on BUILD_CODIFICATION, and skip modules unavailable in
the prebuilt image (AsmWorkstationCertifier/botan2, TrajectoryWidget,
VideoImport, thp_viewer/VLC).
2026-10-05 10:49:34 +02:00

101 lines
2.1 KiB
C++
Executable File

/**
* @RDE_HEADER@
* PresentationManangement - Script Overview Dialog Model
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2017-03-15
*/
#pragma once
#include "logger.h"
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
#include <QtCore/QAbstractTableModel>
#include <QtCore/QSortFilterProxyModel>
class QSqlDatabase;
namespace AARApplication
{
struct Exercise
{
qint32 id = 0;
QString name;
QString dbName;
qint64 startTime = 0;
qint64 endTime = 0;
qint32 stateId = 0;
bool operator == (const Exercise &other) const { return id == other.id; }
bool operator != (const Exercise &other) const { return id != other.id; }
};
////////////////////////////////////////////////////////////////////////////////////////////////////
// DatabasesModel
//
class DatabasesModel : public QAbstractTableModel
{
Q_OBJECT
public:
enum Columns
{
Id = 0,
Name,
StartTime,
EndTime
};
explicit DatabasesModel(QObject *parent = nullptr);
~DatabasesModel() = default;
bool initModel(const QSqlDatabase &db);
QVariant data(const QModelIndex &, int) const override final;
int rowCount(const QModelIndex &parent) const override final;
int columnCount(const QModelIndex &parent) const override final;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override final;
Exercise getRowData(int row) const;
bool insertRow(const Exercise &item);
bool removeRow(const int &row);
friend class DatabasesProxyModel;
protected:
public slots:
void onDataChanged(const Exercise &data, DataModification modType);
private:
QVector<Exercise> m_vecData;
LOGGER_T m_logger;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
// DatabasesProxyModel
//
class DatabasesProxyModel final : public QSortFilterProxyModel
{
Q_OBJECT
public:
using QSortFilterProxyModel::QSortFilterProxyModel;
void setSourceModel(QAbstractItemModel *sourceModel) override;
protected:
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
private:
DatabasesModel *m_sourceModel = nullptr;
};
}