Files
qt-migration-legatus/qt5-before/dlbo/Lts/Proxies/Buildings/BuildingControlUnit/ControlEffects/xmlreader.h
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

208 lines
4.2 KiB
C++

/**
* @RDE_HEADER@
* Xml Reader for Effect Configuration
* $Id$
* $HeadURL$
* $Author$
* Created by Gerlinde Rudolphus, SLTE, 2021-06-02
*/
#pragma once
//#include <ControlEffects/controleffects_export.h>
//#include <logger.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QXmlStreamReader>
#include <QVector>
#include <QUrl>
namespace BuildingControlUnit
{
class HandelEffect;
enum EffectType
{
// Keep in sync with EffectType from bcu_types.h
ET_Unset = 0,
ET_Relay = 1, // EGCU
ET_BackgroundSound = 2, // EGCU
ET_BsmFlash = 3, // BSM
};
enum EffectOverride
{
EO_Auto = -1,
EO_Off = 0,
EO_On = 1,
};
enum ActionType
{
AT_Off = 0,
AT_On = 1,
AT_Infinite = 2,
AT_Flash = 3
};
enum ActionClass
{
AC_Unset,
AC_Standard,
AC_Repeat,
AC_Pause,
AC_Bsm
};
enum Category
{
CT_Default = 0,
CT_BGS_Bahnhof = 1,
CT_BGS_Personen = 2,
CT_BGS_Sonstige = 3,
CT_BGS_Stadt = 4,
CT_BGS_Testsounds = 5,
CT_BGS_Aircrafts = 6,
CT_BGS_Battlefields = 7,
CT_BGS_Boats = 8,
CT_BGS_Explosions = 9,
CT_BGS_Helicopter = 10,
CT_BGS_Motors_and_urban_traffic = 11,
CT_BGS_InsideBuildings = 12,
CT_BGS_Vehicles = 13
// CT_RL_Testkategorie = 8 geht auch (RL=Relay): Dann kann man beide Namen je nach EffectType verwenden!
};
class Action
{
public:
Action(ActionClass ac = AC_Unset)
: aclass(ac)
{}
ActionClass aclass = AC_Unset;
ActionType atype = AT_Off;
QUrl url;
QString comment;
};
class RepeatAction : public Action
{
public:
RepeatAction()
: Action(AC_Repeat)
{}
// -1 => Infinite. So we can skip on (count == 0) in HandelEffect.
int count = -1;
QVector<Action *> actions;
};
class PauseAction : public Action
{
public:
PauseAction()
: Action(AC_Pause)
{}
int pause = 0;
};
class BsmAction : public Action
{
public:
bool isNull() const { return (count == 0 && pause == 0 && pulses == 0); }// Should be enough...
int count = 0;
int pause = 0;
int choplength = 0;
int pulses = 0;
int pulseduration = 0;
BsmAction() : Action(AC_Bsm) {}
};
class Range
{
public:
inline bool fits(int value) const { return (min <= value && value <= max); }
int min = 0;
int max = 100;
bool restartOnChange = false;
QVector<Action *> actions;
};
class Effect
{
public:
// QVector<Action *> getActionsByRange(int damagePercent) const;
Range* getRangeByDamagePercent(int damagePercent) const;
EffectType effectType = ET_Unset;
Category category = CT_Default;
int id = 0;
QString name;
QVector<Range *> ranges;
HandelEffect *effectHandler = nullptr;
EffectOverride override = EO_Auto;
const QVector<Range *> constRanges() const { return ranges; }
};
struct XmlContents
{
QVector<Effect *> effects;
int hitSoundVolume = 50;
int bgSoundVolume = 50;
QString username;
QString password;
int port = 80;
int updateRelayState = 1000;
const QVector<Effect *> constEffects() const { return effects; }
QString toString() const
{
QString str(QStringLiteral("User: %1, Password: %2, Port: %3, BGSound Vol: %4, HitSound Vol: %5, No of Effects: %6"));
return str.arg(username, password).arg(port).arg(bgSoundVolume).arg(hitSoundVolume).arg(effects.count());
}
};
class XmlReader : public QObject
{
Q_OBJECT
public:
explicit XmlReader(QObject *parent = nullptr);
~XmlReader() = default;
static QUrl createPreparedUrl(const XmlContents &contents, const QString &hostname = QString());
bool init(const QString &effectConfigFile);
XmlContents contents() const { return m_contents; }
private:
void createHttpRequests();
static QString categoryName(Category c);
Effect *parseEffect(QXmlStreamReader &xml);
Range *parseRange(QXmlStreamReader &xml);
Action *parseAction(QXmlStreamReader &xml);
PauseAction *parsePauseAction(QXmlStreamReader &xml);
RepeatAction *parseRepeatAction(QXmlStreamReader &xml);
BsmAction* parseBsmAction(QXmlStreamReader &xml);
Action *parseStandardAction(QXmlStreamReader &xml); // Can be BsmAction or Action alone
void generateUrls(const Effect *e, const QVector<Action *> &actions);
void generateUrl(const Effect *e, Action *a);
XmlContents m_contents;
//BuildingControlUnit::LOGGER_T m_logger;
NGL::INGLLogger &m_logger;
};
} // BuildingControlUnit