Files
qt-migration-legatus/qt5-before/dlbo/Lts/Proxies/Buildings/BuildingControlUnit/ControlEffects/handeleffect.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

140 lines
4.0 KiB
C++

/**
* @RDE_HEADER@
* One Effect Handler. Destroyed/created on Range change
* $Id$
* $HeadURL$
* $Author$
* Created by Gerlinde Rudolphus, SLTE, 2021-05-31
*/
#include "handeleffect.h"
#include <QUrlQuery>
#include <QTimer>
namespace BuildingControlUnit
{
HandelEffect::HandelEffect(QObject *parent, const QString &loggerchannel)
: QObject(parent)
, m_logger(getLogger(QStringLiteral("HandelSingleEffect.") + loggerchannel))
{
}
bool HandelEffect::init(const QVector<Action *> &actions, int repetitions = 1)
{
if (actions.isEmpty())
return false;
m_actions = actions;
m_currentAction = nullptr;
m_repeatCount = repetitions; // Usually The action list is only worked over once.
return true;
}
//void handleEffect(const Effect *effect, QVector<Action *> actions, int damage, bool background);
void HandelEffect::handleEffect()
{
// No current Action? Start over or be ready
if (!m_currentAction)
{
// Infinite Repeat Actions must start with repeatCount = -1
if (m_repeatCount != 0)
{
m_currentAction = m_actions.first();
--m_repeatCount;
}
else
{
emit effectReady();
deleteLater();
return;
}
}
else
{
int index = m_actions.indexOf(m_currentAction);
++index;
m_currentAction = m_actions.value(index, nullptr);
if (!m_currentAction)
{
QTimer::singleShot(0, this, &HandelEffect::handleEffect);
return;
}
}
switch (m_currentAction->aclass)
{
case AC_Unset:
DEBUG_LOG(m_logger) << "---- This is unset ----";
break;
case AC_Standard:
{
DEBUG_LOG(m_logger) << "---- This is a standard Action ----";
if (!m_currentAction->url.isEmpty())
{
// Todo: Is there a standard action valid for BSM? If so, we need to consider!
DEBUG_LOG(m_logger) << "---- emit newHttpRequest(a->url):" << m_currentAction->url.toString();
emit newHttpRequest(m_currentAction->url);
}
break;
}
case AC_Repeat:
{
DEBUG_LOG(m_logger) << "---- This is a Repeat Action";
const RepeatAction *ra = static_cast<const RepeatAction *>(m_currentAction);
HandelEffect *he = new HandelEffect(this);
he->init(ra->actions, ra->count);
connect(he, &HandelEffect::effectReady, this, &HandelEffect::handleEffect);
connect(he, &HandelEffect::newHttpRequest, this, &HandelEffect::newHttpRequest);
connect(he, &HandelEffect::triggerAllFlashlights, this, &HandelEffect::triggerAllFlashlights);
QTimer::singleShot(0, he, &HandelEffect::handleEffect);
// To avoid the Timer call at the end of this method:
return;
// So this instance does nothing unless child-he is ready.
}
case AC_Pause:
{
const PauseAction *pa = static_cast<const PauseAction *>(m_currentAction);
DEBUG_LOG(m_logger) << "---- This is a Pause Action Pause=" << pa->pause
<< " comment=" << pa->comment;
QTimer::singleShot(pa->pause, this, &HandelEffect::handleEffect);
// To avoid the Timer call at the end of this method:
return;
// So this instance does nothing unless timer returns.
}
case AC_Bsm:
{
DEBUG_LOG(m_logger) << "---- This is a Bsm Action ";
const BsmAction *ba = static_cast<const BsmAction*>(m_currentAction);
if (!ba->isNull())
{
DEBUG_LOG(m_logger) << "emit triggerAllFlashlights ------ atype=" << m_currentAction->atype
<< " pause=" << ba->pause
<< " choplength=" << ba->choplength
<< " pulses=" << ba->pulses
<< " pulseduration=" << ba->pulseduration
<< " comment=" << ba->comment
<< " this: " << this;
emit triggerAllFlashlights(ba->pulses, ba->pause, ba->choplength, ba->pulseduration);
}
break;
}
default:
break;
}
DEBUG_LOG(m_logger) << "--- End Action ";
// Start next action with ending this method.
QTimer::singleShot(0, this, &HandelEffect::handleEffect);
} // end printActions
} //namespace BuildingControlUnit