Files
torstenandCopilot b774f4035c Qt6 Migration: DDS-Stubs, Logger-Fixes, Export-Header Korrekturen
- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung
- 44 Export-Header Include-Pfade korrigiert (_export.h)
- 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h)
- INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros
- Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits)
- FATAL_LOG Makro hinzugefügt
- InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h)
- FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h)
- AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp)
- SymbolAppearance Klasse vollständig definiert mit content() Methode
- BuildingComponentFilter Klasse definiert mit Copy-Konstruktor
- Ftc Factory: nullptr Return (abstract class)
- AesFilter Klasse in aes.hpp hinzugefügt
- Dtc Klasse in ppm.hpp mit participantChanged Signal
- AesType Enum: alle 15 At* Werte definiert
- AesEffectState_def: EsReceived hinzugefügt
- DataModification Enum: eAdded/eModified/eRemoved
- function_reply_object.h → core_types.h Include-Pfad (72 Dateien)
- Enum-Class-Streaming Template-Operator in INGLLogger.h
- ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen
- ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge
- QRegExp → QRegularExpression in tpm_js_parser.cpp
- .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert
- Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-19 06:06:24 +02:00

199 lines
3.6 KiB
C++
Executable File

#pragma once
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QXmlStreamReader>
#include <QVector>
#include <QUrl>
namespace BuildingControlUnit
{
class HandelEffect;
enum EffectType
{
ET_Unset = 0,
ET_Relay = 1,
ET_BackgroundSound = 2,
ET_BsmFlash = 3,
};
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
};
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)
{}
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); }
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:
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);
void generateUrls(const Effect *e, const QVector<Action *> &actions);
void generateUrl(const Effect *e, Action *a);
XmlContents m_contents;
};
}