Files
qt-migration-legatus/qt5-before/dlbo/Lts/Services/ExerciseManagement/exercise_state_base.cpp
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

123 lines
3.0 KiB
C++

/**
* @RDE_HEADER@
* Base for ExerciseState
* $Id$
* $HeadURL$
* $Author$
*/
#include "exercise_state_base.h"
#include "logger.h"
#include <time.h>
namespace ExerciseManagement
{
//----------------------------------------
ExerciseStateBase::ExerciseStateBase(const QString &objectName, const ExerciseState &exerciseState, ObjectExercise *objExe)
: QState()
, m_exercise(objExe)
, m_logger(getLogger(QLatin1String("State.") + objectName))
, m_exerciseState(exerciseState)
{
setObjectName(QLatin1String("State.") + objectName);
}
void ExerciseStateBase::onEntry(QEvent *event)
{
QState::onEntry(event);
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": onEntry Base: write exerciseState: " << m_exerciseState;
// write exerciseState to db
m_exercise->setExerciseState(m_exerciseState);
m_exercise->sendStateToServiceManagement(m_exerciseState);
}
//----------------------------------------
Unknown::Unknown(ObjectExercise *objExe)
: ExerciseStateBase(QLatin1String("Unknown"), ExerciseState::Unknown, objExe)
{}
/*
//----------------------------------------
Free::Free(ObjectExercise *objExe)
: ExerciseStateBase("Free", SYSTEM_FREI, objExe)
{}
*/
//----------------------------------------
Creation::Creation(ObjectExercise *objExe)
: ExerciseStateBase(QLatin1String("Creation"), ExerciseState::Created, objExe)
{}
void Creation::onEntry(QEvent *event)
{
// TODO: still needed?
// fill durchgef_uebungen, before base because
// we need a filled durchgef_uebungen there
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": onEntry Creation ";
ExerciseStateBase::onEntry(event);
// TODO
/*
// initialize shm
m_db->initializeSharedMemory();
// add first entry to aufz_zeiten (if not already there)
m_db->insertInitialRecordingTime();
*/
}
//----------------------------------------
Start::Start(ObjectExercise *objExe)
: ExerciseStateBase(QLatin1String("Start"), ExerciseState::Started, objExe)
{}
void Start::onEntry(QEvent *event)
{
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": onEntry Start: write exerciseState: started";
ExerciseStateBase::onEntry(event);
// TODO:
//m_db->updateRecordingTimes(true);
}
void Start::onExit(QEvent *event)
{
ExerciseStateBase::onExit(event);
//TODO
//m_db->updateRecordingTimes(false);
}
//----------------------------------------
Pause::Pause(ObjectExercise *objExe)
: ExerciseStateBase(QLatin1String("Pause"), ExerciseState::Paused, objExe)
{}
//-----------------------------------------------------------------------------------------------------
Stop::Stop(ObjectExercise *objExe)
: ExerciseStateBase(QLatin1String("Stop"), ExerciseState::Stopped, objExe)
{}
void Stop::onEntry(QEvent *event)
{
ExerciseStateBase::onEntry(event);
m_exercise->transferExerciseToEvaluationDb();
}
//-----------------------------------------------------------------------------------------------------
Terminate::Terminate(ObjectExercise *objExe)
: ExerciseStateBase(QLatin1String("Resume"), ExerciseState::Terminated, objExe)
{}
} // namespace ExerciseManagement