From 040bdd558f0eb56327faa6fe4c43f009cdab4936 Mon Sep 17 00:00:00 2001 From: berrux_dev Date: Sat, 3 Oct 2026 18:12:44 +0200 Subject: [PATCH 1/2] Remove forward-declaration stub-header directories (.forward-declarations/, forward-declarations/) Deletes the two stub-header trees (249 files) that shadowed the real rtiddsgen-generated DDS headers, and removes every reference to them. CMake (15 include-path entries): root CMakeLists.txt include_directories(.../forward-declarations); NGL_TARGET_INCLUDE_DIRECTORIES entries in 7 service CMakeLists (ServiceManagement, SoundManagement, SituationMap, ScreenRecording, SituationReplayManagement, SituationReplay, ServiceMonitor) Source includes that resolved to the root-level stubs (only 2, repointed to the module-prefixed generated headers the rest of the tree already uses): Lts/Services/AreaEffectSimulation/object_charge_effect.h -> Lts/Proxies/TrainingAreaBaseOC/websocket_handler.h -> (generic_dtc_impl.h needs no change: its quote-include "generic_dtc.h" resolves to the real Lts/DDS/DTC/generic_dtc.h in the same directory) Tests: tests/test_migration_stubs.cpp: remove the redundant root-level stub test (AesDtcCompiles) - the module-prefixed AreaEffectSimulationDtcCompiles test already exercises the same AreaEffectSimulation::Interface header. tests/test_skl_dtc.cpp: delete (removed-module compile test, already filtered out of the build) and remove its now-obsolete CMake list(FILTER) exclusion. Validation: full rebuild (build4, make -j4 -k) with the removal - 0 new compile errors vs the pre-existing base-state baseline (77 unique real-error signatures identical to baseline; all 15 'No such file' headers pre-existing). --- .../include/AdlerJson/adler_export.h | 22 - .../include/AdlerJson/aes_handler.h | 104 -- .../include/AdlerJson/asm_handler.h | 50 - .../include/AdlerJson/flm_handler.h | 67 - .../include/AdlerJson/generatetelegrams.h | 54 - .../include/AdlerJson/interface_controller.h | 15 - .../include/AdlerJson/json_dispatcher.h | 158 -- .../include/AdlerJson/json_handler_rx.h | 59 - .../include/AdlerJson/json_handler_tx.h | 107 -- .../include/AdlerJson/logger.h | 23 - .../include/AdlerJson/main_dispatcher.h | 84 - .../include/AdlerJson/pdm_handler.h | 44 - .../include/AdlerJson/plugin.h | 33 - .../include/AdlerJson/ppm_handler.h | 111 -- .../include/AdlerJson/saa_interface.h | 103 -- .../include/AdlerJson/settings.h | 33 - .../include/AdlerJson/telegrams.h | 1596 ----------------- .../include/AdlerJson/ws_handler.h | 78 - .../include/AdlerJson/ws_interface.h | 45 - .../include/AlarmManagement/alm_dtc.h | 4 - .../include/AlarmManagement/alm_translation.h | 14 - .../include/AlarmManagement/alm_types.h | 49 - .../include/AreaEffectSimulation/aes_dtc.h | 4 - .../include/AssetManagement/asm_dtc.h | 4 - .../include/AudioVideoManagement/ava_types.h | 322 ---- .../include/AudioVideoManagement/avm_dtc.h | 4 - .../include/AudioVideoManagement/avm_export.h | 13 - .../AudioVideoManagement/avm_translation.h | 77 - .../svcavmcommon_export.h | 13 - .../include/Buildings/bld_dtc.h | 4 - .../include/Buildings/bld_enums.hpp.stub | 30 - .../include/CentralEffectSimulation/ces_dtc.h | 4 - .../include/CodificationManagement/cod_dtc.h | 4 - .../include/ComponentMonitor/cmo_dtc.h | 4 - .../include/Core/core.hpp | 107 -- .../include/Core/core_dtc.h | 4 - .../include/Core/core_types.h | 144 -- .../include/DDS/DTC/generic_dtc.h | 130 -- .../include/DDS/DTC/generic_dtc_impl.h | 357 ---- .../include/DDS/Generic/ddsconnector_export.h | 32 - .../include/DDS/Generic/ddsgen_export.h | 32 - .../include/DDS/Generic/generic_base.h | 51 - .../include/DDS/Generic/generic_data_reader.h | 173 -- .../include/DDS/Generic/generic_logger.h | 84 - .../include/EffectShowClient/esc_dtc.h | 4 - .../include/EffectShowManagement/esm_dtc.h | 4 - .../include/Evaluations/evl_db_impl.h | 31 - .../include/Evaluations/evl_dtc.h | 4 - .../include/ExerciseEventManagement/eem.hpp | 10 - .../include/ExerciseEventManagement/eem_dtc.h | 4 - .../ExerciseEventManagement/eem_export.h | 11 - .../ExerciseEventManagement/eem_types.h | 37 - .../include/ExerciseManagement/exm_db.h | 165 -- .../include/ExerciseManagement/exm_dtc.h | 4 - .../include/ExerciseManagement/exm_ftc.h | 110 -- .../include/FileManagement/CMakeLists.txt | 36 - .../flm_data_plugin_interface.h | 30 - .../include/FileManagement/flm_db.h | 181 -- .../include/FileManagement/flm_db_impl.h | 104 -- .../include/FileManagement/flm_dtc.h | 4 - .../include/FileManagement/flm_dtc_impl.h | 86 - .../include/FileManagement/flm_enums.hpp.stub | 39 - .../include/FileManagement/flm_ftc.h | 20 - .../include/FileManagement/flm_translation.h | 73 - .../include/FilterManagement/flt_dts.cpp | 72 - .../include/FilterManagement/flt_dts.h | 67 - .../include/FilterManagement/flt_ftc.h | 159 -- .../include/FilterManagement/flt_fts.h | 86 - .../include/FilterManagement/logger.h | 26 - .../include/GuezIedManagement/gim_dtc.h | 4 - .../include/GuezNasat/gna_dtc.h | 4 - .../include/GuezNasat/logger.h | 18 - .../include/InfrastructureManagement/ism.hpp | 233 --- .../InfrastructureManagement/ism_db_impl.h | 46 - .../InfrastructureManagement/ism_dtc.h | 4 - .../InfrastructureManagement/ism_ftc.h | 11 - .../include/MarkerManagement/mrk_dtc.h | 4 - .../include/Messaging/msg_dtc.h | 4 - .../include/MeteoDataManagement/mdm_dtc.h | 4 - .../include/NotificationManagement/nom_dtc.h | 4 - .../include/OcSituationServer/oss_dtc.h | 4 - .../include/OperatorManagement/opm_db.h | 133 -- .../include/OperatorManagement/opm_dtc.h | 4 - .../include/OperatorManagement/opm_dtc_impl.h | 93 - .../include/OperatorManagement/opm_ftc.h | 21 - .../include/ParticipantManagement/ppm.hpp | 182 -- .../ParticipantManagement/ppm_db_impl.h | 41 - .../include/ParticipantManagement/ppm_ftc.h | 44 - .../ParticipantManagement/ppm_translation.h | 14 - .../include/ParticipantManagement/ppm_types.h | 40 - .../include/PresentationManagement/pre_dtc.h | 4 - .../ProjectDataManagement/pdm_dtc_impl.cpp | 259 --- .../ProjectDataManagement/pdm_enums.hpp | 8 - .../pdm_operator_rights.h | 34 - .../ProjectDataManagement/pdm_translation.h | 7 - .../include/ProjectDataManagement/pdm_types.h | 15 - .../include/RecordingManagement/rec_db_impl.h | 41 - .../include/ReportManagement/rep_dtc.h | 4 - .../include/ScenarioManagement/scm_dtc.h | 4 - .../Services/AreaEffectSimulation/aes.hpp | 93 - .../InfrastructureManagement/ism_dtc.h | 13 - .../InfrastructureManagement/ism_ftc.h | 11 - .../Services/PresentationManagement/pre_ftc.h | 59 - .../include/SituationReplay/srp_dtc.h | 4 - .../SituationReplayManagement/srm_dtc.h | 4 - .../include/Skeleton/skl_dtc.h | 4 - .../include/SoundManagement/som_dtc.h | 4 - .../include/TargetManagement/tgt_dtc.h | 4 - .../include/TrainingAreaBase/tab_dtc.h | 4 - .../include/TrainingAreaBaseOC/taboc_dtc.h | 4 - .../include/WarehouseGuez/whg_dtc.h | 4 - qt6-after/qt6-migrated-legatus/CMakeLists.txt | 1 - .../TrainingAreaBaseOC/websocket_handler.h | 2 +- .../object_charge_effect.h | 2 +- .../Services/ScreenRecording/CMakeLists.txt | 1 - .../Services/ServiceManagement/CMakeLists.txt | 3 - .../Services/ServiceMonitor/CMakeLists.txt | 1 - .../Lts/Services/SituationMap/CMakeLists.txt | 1 - .../Services/SituationReplay/CMakeLists.txt | 4 - .../SituationReplayManagement/CMakeLists.txt | 1 - .../Services/SoundManagement/CMakeLists.txt | 3 - .../Lts/Proxies/Buildings/bld_dtc.h | 4 - .../Lts/Proxies/Buildings/bld_ftc.h | 3 - .../Lts/Proxies/ComponentMonitor/cmo_dtc.h | 4 - .../Lts/Proxies/ComponentMonitor/cmo_ftc.h | 3 - .../Lts/Proxies/GuezNasat/gna_dtc.h | 4 - .../Lts/Proxies/GuezNasat/gna_ftc.h | 3 - .../Lts/Proxies/TrainingAreaBase/tab_dtc.h | 4 - .../Lts/Proxies/TrainingAreaBase/tab_ftc.h | 3 - .../Proxies/TrainingAreaBaseOC/taboc_dtc.h | 4 - .../Proxies/TrainingAreaBaseOC/taboc_ftc.h | 3 - .../Lts/Services/AlarmManagement/alm_dtc.h | 23 - .../Lts/Services/AlarmManagement/alm_ftc.h | 23 - .../Services/AreaEffectSimulation/aes_dtc.h | 2 - .../Services/AreaEffectSimulation/aes_ftc.h | 2 - .../Lts/Services/AssetManagement/asm_dtc.h | 2 - .../Lts/Services/AssetManagement/asm_ftc.h | 2 - .../Services/AudioVideoManagement/avm_dtc.h | 2 - .../Services/AudioVideoManagement/avm_ftc.h | 2 - .../svcavmcommon_export.h | 14 - .../CentralEffectSimulation/ces_dtc.h | 2 - .../CentralEffectSimulation/ces_ftc.h | 2 - .../Services/CodificationManagement/cod_dtc.h | 4 - .../Services/CodificationManagement/cod_ftc.h | 13 - .../Lts/Services/EffectShowClient/esc_dtc.h | 7 - .../Lts/Services/EffectShowClient/esc_ftc.h | 7 - .../Services/EffectShowManagement/esm_dtc.h | 7 - .../Services/EffectShowManagement/esm_ftc.h | 7 - .../Lts/Services/Evaluations/evl_dtc.h | 7 - .../Lts/Services/Evaluations/evl_ftc.h | 7 - .../ExerciseEventManagement/eem_dtc.h | 4 - .../ExerciseEventManagement/eem_ftc.h | 17 - .../Lts/Services/ExerciseManagement/exm_dtc.h | 7 - .../Lts/Services/ExerciseManagement/exm_ftc.h | 7 - .../Lts/Services/FileManagement/flm_dtc.h | 4 - .../Lts/Services/FileManagement/flm_ftc.h | 20 - .../Lts/Services/FilterManagement/flt_dtc.h | 7 - .../Lts/Services/FilterManagement/flt_ftc.h | 7 - .../Lts/Services/GuezIedManagement/gim_dtc.h | 7 - .../Lts/Services/GuezIedManagement/gim_ftc.h | 7 - .../GuezMinelayerProcessing/gmp_dtc.h | 17 - .../GuezMinelayerProcessing/gmp_ftc.h | 17 - .../Services/InfrastructureManagement/ism.hpp | 232 --- .../InfrastructureManagement/ism_dtc.h | 4 - .../InfrastructureManagement/ism_ftc.h | 36 - .../Lts/Services/MarkerManagement/mrk_dtc.h | 4 - .../Lts/Services/MarkerManagement/mrk_ftc.h | 17 - .../MarkerManagement/svcmrkcommon_export.h | 8 - .../Lts/Services/Messaging/msg_dtc.h | 4 - .../Lts/Services/Messaging/msg_ftc.h | 17 - .../Services/MeteoDataManagement/mdm_dtc.h | 4 - .../Services/MeteoDataManagement/mdm_ftc.h | 17 - .../Lts/Services/NmeaManagement/nme_dtc.h | 17 - .../Lts/Services/NmeaManagement/nme_ftc.h | 17 - .../Services/NotificationManagement/nom_dtc.h | 7 - .../Services/NotificationManagement/nom_ftc.h | 7 - .../Lts/Services/OcBaseDownload/obd_dtc.h | 17 - .../Lts/Services/OcBaseDownload/obd_ftc.h | 17 - .../Lts/Services/OcSituationClient/osc_dtc.h | 7 - .../Lts/Services/OcSituationClient/osc_ftc.h | 7 - .../Lts/Services/OcSituationServer/oss_dtc.h | 7 - .../Lts/Services/OcSituationServer/oss_ftc.h | 7 - .../Lts/Services/OnlineReports/ore_dtc.h | 7 - .../Lts/Services/OnlineReports/ore_ftc.h | 7 - .../Lts/Services/OperatorManagement/opm_dtc.h | 4 - .../Lts/Services/OperatorManagement/opm_ftc.h | 21 - .../Services/ParticipantManagement/ppm_dtc.h | 17 - .../Services/ParticipantManagement/ppm_ftc.h | 44 - .../Lts/Services/PlanEditor/ped_dtc.h | 17 - .../Lts/Services/PlanEditor/ped_ftc.h | 17 - .../Services/PresentationManagement/pre_dtc.h | 4 - .../Services/PresentationManagement/pre_ftc.h | 17 - .../Services/ProjectDataManagement/pdm_dtc.h | 17 - .../Services/ProjectDataManagement/pdm_ftc.h | 17 - .../Services/ProjectionWorkstation/pws_dtc.h | 7 - .../Services/ProjectionWorkstation/pws_ftc.h | 7 - .../Services/RecordingManagement/rec_dtc.h | 7 - .../Services/RecordingManagement/rec_ftc.h | 7 - .../Lts/Services/ReportManagement/rep_dtc.h | 4 - .../Lts/Services/ReportManagement/rep_ftc.h | 17 - .../Lts/Services/RoutingServiceNG/rsc_dtc.h | 17 - .../Lts/Services/RoutingServiceNG/rsc_ftc.h | 17 - .../Lts/Services/TargetManagement/tgt_dtc.h | 4 - .../Lts/Services/TargetManagement/tgt_ftc.h | 17 - .../Lts/Services/WarehouseGuez/whg_dtc.h | 4 - .../Lts/Services/WarehouseGuez/whg_ftc.h | 17 - .../forward-declarations/aes_dtc.h | 13 - .../forward-declarations/alm_dtc.h | 13 - .../forward-declarations/asm_dtc.h | 13 - .../forward-declarations/avm_dtc.h | 13 - .../forward-declarations/bld_dtc.h | 13 - .../forward-declarations/ces_dtc.h | 13 - .../forward-declarations/cmo_dtc.h | 13 - .../forward-declarations/cod_dtc.h | 13 - .../forward-declarations/core_dtc.h | 16 - .../forward-declarations/eem_dtc.h | 13 - .../forward-declarations/esc_dtc.h | 13 - .../forward-declarations/esm_dtc.h | 13 - .../forward-declarations/evl_dtc.h | 13 - .../forward-declarations/exm_dtc.h | 13 - .../forward-declarations/flm_dtc.h | 13 - .../forward-declarations/generic_dtc.h | 59 - .../forward-declarations/gim_dtc.h | 13 - .../forward-declarations/gna_dtc.h | 13 - .../forward-declarations/ism_dtc.h | 13 - .../forward-declarations/map_dtc.h | 17 - .../forward-declarations/map_ftc.h | 17 - .../forward-declarations/mdm_dtc.h | 13 - .../forward-declarations/mrk_dtc.h | 13 - .../forward-declarations/msg_dtc.h | 13 - .../forward-declarations/nom_dtc.h | 13 - .../forward-declarations/opm_dtc.h | 13 - .../forward-declarations/oss_dtc.h | 13 - .../forward-declarations/pdm_dtc.h | 13 - .../forward-declarations/pdm_dtc_types.h | 385 ---- .../forward-declarations/pdm_dts_types.h | 236 --- .../forward-declarations/pdm_ftc_types.h | 64 - .../forward-declarations/pdm_fts_types.h | 64 - .../pdm_operator_rights.h | 34 - .../forward-declarations/ppm_dtc.h | 13 - .../forward-declarations/pre_dtc.h | 13 - .../forward-declarations/rep_dtc.h | 13 - .../forward-declarations/scm_dtc.h | 13 - .../forward-declarations/scm_ftc.h | 17 - .../forward-declarations/scr_dtc.h | 17 - .../forward-declarations/scr_ftc.h | 17 - .../forward-declarations/skl_dtc.h | 13 - .../forward-declarations/smo_dtc.h | 7 - .../forward-declarations/smo_ftc.h | 7 - .../forward-declarations/som_dtc.h | 13 - .../forward-declarations/som_ftc.h | 17 - .../forward-declarations/srm_dtc.h | 13 - .../forward-declarations/srm_ftc.h | 17 - .../forward-declarations/srp_dtc.h | 13 - .../forward-declarations/srp_ftc.h | 7 - .../forward-declarations/tab_dtc.h | 13 - .../forward-declarations/taboc_dtc.h | 13 - .../forward-declarations/tgt_dtc.h | 13 - .../forward-declarations/whg_dtc.h | 13 - .../qt6-migrated-legatus/tests/CMakeLists.txt | 5 - .../tests/test_migration_stubs.cpp | 9 - .../tests/test_skl_dtc.cpp | 19 - 262 files changed, 2 insertions(+), 9887 deletions(-) delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/adler_export.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/aes_handler.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/asm_handler.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/flm_handler.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/generatetelegrams.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/interface_controller.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_dispatcher.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_handler_rx.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_handler_tx.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/logger.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/main_dispatcher.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/pdm_handler.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/plugin.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ppm_handler.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/saa_interface.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/settings.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/telegrams.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ws_handler.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ws_interface.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_translation.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_types.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AreaEffectSimulation/aes_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AssetManagement/asm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/ava_types.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_export.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_translation.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/svcavmcommon_export.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Buildings/bld_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Buildings/bld_enums.hpp.stub delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/CentralEffectSimulation/ces_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/CodificationManagement/cod_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ComponentMonitor/cmo_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core.hpp delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core_types.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/DTC/generic_dtc.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/DTC/generic_dtc_impl.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/ddsconnector_export.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/ddsgen_export.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_base.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_data_reader.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_logger.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/EffectShowClient/esc_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/EffectShowManagement/esm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Evaluations/evl_db_impl.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Evaluations/evl_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem.hpp delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_export.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_types.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_db.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/CMakeLists.txt delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_data_plugin_interface.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_db.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_db_impl.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_dtc_impl.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_enums.hpp.stub delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_translation.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_dts.cpp delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_dts.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_fts.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/logger.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezIedManagement/gim_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezNasat/gna_dtc.h delete mode 100755 qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezNasat/logger.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism.hpp delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_db_impl.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/MarkerManagement/mrk_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Messaging/msg_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/MeteoDataManagement/mdm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/NotificationManagement/nom_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/OcSituationServer/oss_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_db.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_dtc_impl.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm.hpp delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_db_impl.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_translation.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_types.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/PresentationManagement/pre_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_dtc_impl.cpp delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_enums.hpp delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_operator_rights.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_translation.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_types.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/RecordingManagement/rec_db_impl.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ReportManagement/rep_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/ScenarioManagement/scm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/AreaEffectSimulation/aes.hpp delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/InfrastructureManagement/ism_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/InfrastructureManagement/ism_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/PresentationManagement/pre_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/SituationReplay/srp_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/SituationReplayManagement/srm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/Skeleton/skl_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/SoundManagement/som_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/TargetManagement/tgt_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/TrainingAreaBase/tab_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/TrainingAreaBaseOC/taboc_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/.forward-declarations/include/WarehouseGuez/whg_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/Buildings/bld_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/Buildings/bld_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/ComponentMonitor/cmo_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/ComponentMonitor/cmo_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/GuezNasat/gna_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/GuezNasat/gna_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBase/tab_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBase/tab_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBaseOC/taboc_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBaseOC/taboc_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AlarmManagement/alm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AlarmManagement/alm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AreaEffectSimulation/aes_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AreaEffectSimulation/aes_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AssetManagement/asm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AssetManagement/asm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/avm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/avm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/svcavmcommon_export.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CentralEffectSimulation/ces_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CentralEffectSimulation/ces_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CodificationManagement/cod_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CodificationManagement/cod_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowClient/esc_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowClient/esc_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowManagement/esm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowManagement/esm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Evaluations/evl_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Evaluations/evl_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseEventManagement/eem_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseEventManagement/eem_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseManagement/exm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseManagement/exm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FileManagement/flm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FileManagement/flm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FilterManagement/flt_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FilterManagement/flt_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezIedManagement/gim_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezIedManagement/gim_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezMinelayerProcessing/gmp_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezMinelayerProcessing/gmp_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism.hpp delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/mrk_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/mrk_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/svcmrkcommon_export.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Messaging/msg_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Messaging/msg_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MeteoDataManagement/mdm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MeteoDataManagement/mdm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NmeaManagement/nme_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NmeaManagement/nme_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NotificationManagement/nom_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NotificationManagement/nom_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcBaseDownload/obd_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcBaseDownload/obd_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationClient/osc_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationClient/osc_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationServer/oss_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationServer/oss_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OnlineReports/ore_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OnlineReports/ore_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OperatorManagement/opm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OperatorManagement/opm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ParticipantManagement/ppm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ParticipantManagement/ppm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PlanEditor/ped_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PlanEditor/ped_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PresentationManagement/pre_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PresentationManagement/pre_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectDataManagement/pdm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectDataManagement/pdm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectionWorkstation/pws_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectionWorkstation/pws_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RecordingManagement/rec_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RecordingManagement/rec_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ReportManagement/rep_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ReportManagement/rep_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RoutingServiceNG/rsc_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RoutingServiceNG/rsc_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/TargetManagement/tgt_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/TargetManagement/tgt_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/WarehouseGuez/whg_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/WarehouseGuez/whg_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/aes_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/alm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/asm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/avm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/bld_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/ces_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/cmo_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/cod_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/core_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/eem_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/esc_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/esm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/evl_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/exm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/flm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/generic_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/gim_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/gna_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/ism_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/map_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/map_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/mdm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/mrk_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/msg_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/nom_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/opm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/oss_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dtc_types.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dts_types.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/pdm_ftc_types.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/pdm_fts_types.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/pdm_operator_rights.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/ppm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/pre_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/rep_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/scm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/scm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/scr_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/scr_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/skl_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/smo_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/smo_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/som_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/som_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/srm_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/srm_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/srp_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/srp_ftc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/tab_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/taboc_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/tgt_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/forward-declarations/whg_dtc.h delete mode 100644 qt6-after/qt6-migrated-legatus/tests/test_skl_dtc.cpp diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/adler_export.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/adler_export.h deleted file mode 100755 index 1636de770..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/adler_export.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Export definitions - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Hanna E. Rathje, SLSE, 2015-08-04 - */ -#pragma once - -#include - -#ifndef SAATELEGRAMS_EXPORT -# ifdef BUILD_STATIC_LIBRARIES -# define SAATELEGRAMS_EXPORT -# else -# if defined(MAKE_SAATELEGRAMS_LIB) -# define SAATELEGRAMS_EXPORT Q_DECL_EXPORT -# else -# define SAATELEGRAMS_EXPORT Q_DECL_IMPORT -# endif -# endif -#endif diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/aes_handler.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/aes_handler.h deleted file mode 100755 index c84b83183..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/aes_handler.h +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @RDE_HEADER@ - * AesHandler for AdlerJson Plugin - * $Id: aes_handler.h 62304 2024-03-21 08:17:45Z ewert_j $ - * $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/aes_handler.h $ - * $Author: ewert_j $ - * Created by Julius Ewert, ESIM, 2024-03-20 - */ - -#pragma once - -#include "Core/core_types.h" -#include "logger.h" -#include "main_dispatcher.h" -#include "telegrams.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AdlerJson -{ - -class MainDispatcher; -class AesHandler - : public QObject - , protected AreaEffectSimulation::Interface::Ftc::AirSupportImpactModifyReplyHandler - , protected AreaEffectSimulation::Interface::Ftc::OffRouteMineModifyReplyHandler - , protected AreaEffectSimulation::Interface::Ftc::EffectClusterModifyReplyHandler - , protected AreaEffectSimulation::Interface::Ftc::TrajectoryAdlerModifyReplyHandler - , protected NotificationManagement::Interface::Ftc::CreateNotificationReplyHandler -{ - Q_OBJECT - public: - explicit AesHandler(std::shared_ptr ftsTab, QObject *parent = nullptr); - - bool init(MainDispatcher *mainDispatcher); - bool sendAesModifyRequest(const QJsonObject &obj); - bool sendExplosionArea(const QJsonObject &data); - // DDS Overrides - void onAirSupportImpactModifyReply(const Core::FunctionReplyObject &reply) override; - void onOffRouteMineModifyReply(const Core::FunctionReplyObject &replyObject) override; - void onEffectClusterModifyReply(const Core::FunctionReplyObject &replyObject) override; - void onCreateNotificationReply(const Core::FunctionReplyObject &replyObject) override; - - // Internal - void onExplosionSingleChanged(const AreaEffectSimulation::ExplosionSingle &data, DataModification modType); - void onEffectClusterChanged(const AreaEffectSimulation::EffectCluster &data, DataModification modType); - - void handleCreateSingleExplosion(const TrainingAreaBase::TetraIcd::CreateSingleExplosion &data); - void handleEXFire(const Feuerkampfdaten &data, int wsId); - void handleEXDontFire(const Feuerkampfdaten &data, int wsId); - // Reald Data - void sendTrajectoryAdlerModifyRequest(const WirkfeldplanungData &data, int participantId, int wirkmittelIndex, int aesId); - void handleEffectCluster(const WirkfeldplanungData &data, int wsId); - - // - void removeAllPendingEffectCluster(int partyId); - std::shared_ptr getDtc() { return m_dtcAes; }; - std::shared_ptr getFtc() { return m_ftcAes; }; - - private: - AreaEffectSimulation::Area createMinimumRect(int zone, const QVector &points); - - signals: - void explosionSingleChanged(const QJsonObject &jsonObj); - - private: - QList findAllPendingEffectCluster(int partyId); - void handleAmmoCount(const Feuerkampfdaten &data, int saaPartyId, bool sendExVollzug = false); - - private: - MainDispatcher *m_mainDispatcher; - std::shared_ptr m_ftcAes; - std::shared_ptr m_dtcAes; - std::shared_ptr m_dtcPpm; - std::shared_ptr m_ddsHandler; - - void onTrajectoryAdlerModifyReply(const Core::FunctionReplyObject &reply) override; - - LtsUtils::RequestHelper *m_requestHelper; - - QHash m_singleExplosions; - - WirkfeldplanungData m_wirkfeldPlanungsData; - QHash m_aesIdToFeuerkampfReferenz; // key = aesId, value = feuerkampfReferenz - - QHash m_feuerkampReferenzAmmoCounter; // key = feuerkampfReferenz, value = AmmoCounter - QHash> m_feuerkampfReferenzWirkmittel; // key = feuerkampfReferenz, value = Kenner - QHash m_feuerkampfReferenzUsedFeuerHalt; // key = feuerkampfReferenz, value = boolean -> if Feuerhalt was activ - - int m_participantId; - int m_wirkmittelIndex; - int m_aesId; - QHash aesIdWsId; // key = aesId value = wsId -}; - -} // namespace AdlerJson diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/asm_handler.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/asm_handler.h deleted file mode 100755 index b8ee09015..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/asm_handler.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @RDE_HEADER@ - * $Id: $ - * $HeadURL: $ - * $Author: $ - * Created by Steve K., ESZS 12-01-2026 - */ - -#pragma once - -#include "logger.h" -#include -#include -#include "main_dispatcher.h" -#include - -namespace AssetManagement -{ - namespace Interface - { - class Dtc; - class Ftc; - } -} - -namespace AdlerJson -{ - -class MainDispatcher; -class AsmHandler : public QObject - , protected AssetManagement::Interface::Ftc::AssetModifyReplyHandler -{ - Q_OBJECT -public: - explicit AsmHandler(QObject *parent = nullptr); - bool init(MainDispatcher* mainDispatcher); - - std::shared_ptr getDtc() { return m_dtcAsm; } - std::shared_ptr getFtc() { return m_ftcAsm; } - void modifyAssetAdlerProperties(int assetId, bool isSaaConnected = false); -private: - void onAssetModifyReply(const Core::FunctionReplyObject &reply) override; - -private: - std::shared_ptr m_dtcAsm; - std::shared_ptr m_ftcAsm; - int m_exerciseId; -}; - -} // namespace AdlerJson diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/flm_handler.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/flm_handler.h deleted file mode 100755 index 31fafc453..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/flm_handler.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @RDE_HEADER@ - * FlmHandler for UFomHlaJson Plugin - * $Id: pdm_handler.h 62304 2024-03-21 08:17:45Z ewert_j $ - * $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/UFomHlaJson/pdm_handler.h $ - * $Author: ewert_j $ - * Created by Julius Ewert, ESIM, 2024-03-20 - */ - -#pragma once - -#include "logger.h" -#include -#include -#include -#include -#include -#include - -namespace FileManagement -{ -namespace Interface -{ -class Dtc; -} -} // namespace FileManagement - -namespace AdlerJson -{ - -class MainDispatcher; -class FlmHandler - : public QObject - , protected FileManagement::Interface::Ftc::FileContentModifyReplyHandler - , protected FileManagement::Interface::Ftc::PathCreateReplyHandler - , protected NotificationManagement::Interface::Ftc::CreateNotificationReplyHandler -{ - Q_OBJECT - public: - explicit FlmHandler(QObject *parent = nullptr); - - bool processHQMessage(int partyId, const QString &name, int meldungsnummer, const QJsonObject &obj); - void createHQNotification(const int partyId, const int folderId, const int fileId); - signals: - public slots: - bool init(MainDispatcher *mainDispatcher); - void initHQFolders(int partyId); - - private: - void onFileContentModifyReply(const Core::FunctionReplyObject &reply) override; - void onPathCreateReply(const Core::FunctionReplyObject &reply) override; - void onCreateNotificationReply(const Core::FunctionReplyObject &replyObject) override final; - bool parseContent(const QString &contentString, QMap &retMap); - - private: - MainDispatcher *m_mainDispatcher = nullptr; - int m_exerciseId; - int m_parentFolderId; - int m_partyId; - int m_folderHXMessagesId; - std::shared_ptr m_dtcFlm; - std::shared_ptr m_ftcFlm; - std::shared_ptr m_ftcNom; - std::shared_ptr m_opmDtc; -}; - -} // namespace AdlerJson diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/generatetelegrams.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/generatetelegrams.h deleted file mode 100755 index a91eeeca4..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/generatetelegrams.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include "telegrams.h" - -class GenerateTelegrams -{ - public: - GenerateTelegrams(); - - static void SAATELEGRAMS_EXPORT addHeaderData(AdlerJson::EXTelegramBase &tele, const int saaId, const QString referenceUuid = QString{}); - static void SAATELEGRAMS_EXPORT generateConnectResponseMessage(AdlerJson::ExAnmeldebestaetigung &exAnmeldebestaetigung); - static void SAATELEGRAMS_EXPORT generateConnectMessage(AdlerJson::EXRegistration &exRegistration, int partyId, bool isVerbund = true); - static void SAATELEGRAMS_EXPORT generateDisconnectMessage(AdlerJson::EXDeregistration &eXDeregistration, int partyId); - static void SAATELEGRAMS_EXPORT generateStatusMessage(AdlerJson::EXStatus &exStatus, AdlerJson::Szenarstatus status); - static void SAATELEGRAMS_EXPORT generateConnectionTestMessage(); - static void SAATELEGRAMS_EXPORT generateAbmeldung(AdlerJson::EXDeregistration &req); - static void SAATELEGRAMS_EXPORT generateZeit1(AdlerJson::Zeitangabe_DTG &zeit); - static void SAATELEGRAMS_EXPORT generateZeit2(AdlerJson::Zeitangabe_DTG &zeit); - - // fire - static void SAATELEGRAMS_EXPORT generateZieldaten(AdlerJson::Zieldaten &wzd); - static void SAATELEGRAMS_EXPORT generateWirkmittelFeuerkommando_Gmlrs(QVector &wfr); - static void SAATELEGRAMS_EXPORT generateEXFQBABBFK(AdlerJson::ExAwesPlanning &req); - static void SAATELEGRAMS_EXPORT generateEXFQBABBFK_Gmlrs(AdlerJson::ExAwesPlanning &req); - static void SAATELEGRAMS_EXPORT generateEXFQBABBFK_Dm72(AdlerJson::ExAwesPlanning &req); - static void SAATELEGRAMS_EXPORT generateFeuerbereit(AdlerJson::ExFeuerbereit &req); - static void SAATELEGRAMS_EXPORT generateFeuern(AdlerJson::ExFeuern &req); - static void SAATELEGRAMS_EXPORT generateFeuern_Gmlrs(AdlerJson::ExFeuern &req); - static void SAATELEGRAMS_EXPORT generateFeuern_Dm72(AdlerJson::ExFeuern &req); - static void SAATELEGRAMS_EXPORT generateNichtFeuern(AdlerJson::exNichtFeuern &req); - - static void SAATELEGRAMS_EXPORT generateAbgefeuert(AdlerJson::ExAbgefeuert &req); - static void SAATELEGRAMS_EXPORT generateVollzugsmeldung(AdlerJson::ExVollzugsmeldung &req); - // static void SAATELEGRAMS_EXPORT generateErkundungsanfrage(AdlerJson::ExErkundungsanfrage &req); - static void SAATELEGRAMS_EXPORT generateErkundungsergebnisse(AdlerJson::ExErkundungsergebnisse &req); - static void SAATELEGRAMS_EXPORT generateFeuerkampf(AdlerJson::ExFeuerkampf &req); - static void SAATELEGRAMS_EXPORT generateFeuerhalt(AdlerJson::ExFeuerhalt &req); - static void SAATELEGRAMS_EXPORT generateStellungsmeldungFS(AdlerJson::ExFeuerstellungFS &req); - static void SAATELEGRAMS_EXPORT generateStellungsmeldungWS(AdlerJson::ExFeuerstellungWS &req); - static void SAATELEGRAMS_EXPORT generateStellungsmeldungWS_Gmlrs(AdlerJson::ExFeuerstellungWS &req); - static void SAATELEGRAMS_EXPORT generateStellungsmeldungWS_Dm72(AdlerJson::ExFeuerstellungWS &req); - static void SAATELEGRAMS_EXPORT generateStellungsmeldungLP(AdlerJson::ExFeuerstellungLP &req); - static void SAATELEGRAMS_EXPORT generateStellungswechsel(AdlerJson::ExStellungswechsel &req); - static void SAATELEGRAMS_EXPORT generateKoordinierungsmassnahmen(AdlerJson::ExHqKoordinierungsmassnahmen &req); - static void SAATELEGRAMS_EXPORT generateKoordinierungsmassnahmen_EX_L25(AdlerJson::ExHqKoordinierungsmassnahmen &req, - ProjectDataManagement::L25_KindGuidingLine kind, int i); - static void SAATELEGRAMS_EXPORT generateFuehrungslinien(AdlerJson::ExHqFuehrungslinien &req); - static void SAATELEGRAMS_EXPORT generateFuehrungslinien_EX_L24(AdlerJson::ExHqFuehrungslinien &req, AdlerJson::Art_L24 art24, int meldungsnummer); - static void SAATELEGRAMS_EXPORT generateTechnischeQuittung(AdlerJson::ExTqTechnischeQuittung &req); - static void SAATELEGRAMS_EXPORT generateFreitextmeldung(AdlerJson::ExAqFreitextmeldung &req); - static void SAATELEGRAMS_EXPORT generateManuelleQuittung(AdlerJson::ExMqManuelleQuittung &req); - static void SAATELEGRAMS_EXPORT generateFlugbahnberechnung(AdlerJson::ExFlugbahnberechnung &req); - static void SAATELEGRAMS_EXPORT generateFlugbahndaten(AdlerJson::ExFlugbahndaten &req); -}; diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/interface_controller.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/interface_controller.h deleted file mode 100755 index 3ec963151..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/interface_controller.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -class InterfaceController -{ -public: - InterfaceController(); - -public Q_SLOTS: - void onRegistration(); - void onDeregistration(); - - void onNewConnection(); - void onWebSocketDisconnected(); - void onTextMessageReceived(const QByteArray &baJson); -}; diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_dispatcher.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_dispatcher.h deleted file mode 100755 index 197cd296e..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_dispatcher.h +++ /dev/null @@ -1,158 +0,0 @@ -/** - * @RDE_HEADER@ - * HlaDispatcher for AdlerJson Plugin - * $Id: hla_dispatcher.h 62304 2024-03-21 08:17:45Z ewert_j $ - * $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/hla_dispatcher.h $ - * $Author: ewert_j $ - * Created by Julius Ewert, ESIM, 2024-03-20 - */ - -#pragma once - -#include -#include -#include -#include -#include // tr_lts -#include -// #include "logger.h" -#include "aes_handler.h" -#include "asm_handler.h" -#include "flm_handler.h" -#include "pdm_handler.h" -#include "ppm_handler.h" -#include "saa_interface.h" -#include "telegrams.h" -#include "ws_interface.h" - -// #include -#include -// #include -// #include - -class QTimer; -namespace AdlerJson -{ -using namespace TrainingAreaBase; -class JsonHandlerRx; -class JsonHandlerTx; -class DdsHandler; -// class EXStatus; - -struct TrajectoryIdentifier -{ - int aesItemId; - int explosionId; -}; - -class JsonDispatcher final - : public TrainingAreaBase::Plugin::Interface - , protected TrainingAreaBase::Interface::Fts::AdlerCalculateTrajectoryRequestHandler - , protected NotificationManagement::Interface::Ftc::CreateNotificationReplyHandler -{ - Q_OBJECT - public: - JsonDispatcher(TrainingAreaBase::Plugin::DataProvider *pdp, - const std::shared_ptr &recvFromTabCb, - const std::shared_ptr &sendToTabCb, - NGL::Settings *settings, - std::shared_ptr &ddsHandler, - std::shared_ptr &flmHandler, - MainDispatcher *mainDispatcher); - - public Q_SLOTS: - bool init() override; - - public: - std::shared_ptr sendToTab() override; - bool isDebugInterface() const override { return false; } - bool canSendData() const override; - void exerciseChanged() override { return; } - const char *name() const override { return tr_lts("dds", "APHLA"); } - std::shared_ptr getSAAByParty(const int partyId); - std::shared_ptr getSAAByWs(const int wsId); - QString getSender() { return QStringLiteral("EXCON@GUEZ.DE"); } - // SendToTele - bool sendExFeuerbereit(const ExFeuerbereit &exFBDataIn, const int partyId); - bool sendExAbgefeuert(const ExAbgefeuert &exAFDataIn, int partyId); - bool sendExMqManuelleQuittung(const ExMqManuelleQuittung &exMQDataIn, int partyId); - bool sendExTqTechnischeQuittung(const ExTqTechnischeQuittung &exTQDataIn, int partyId); - bool sendExVollzugsmeldung(const ExVollzugsmeldung &exVZDataIn, int partyId); - void onAdlerCalculateTrajectoryRequest(const rti::core::SampleIdentity &cookie, const TrainingAreaBase::AdlerCalculateTrajectoryRequest &request) override; - int getAssetId(const QString &saaName) const; - // misc - void cleanupSaaInterfaces(const QString &saaName, int wsId, int partyId); - void getCreateNotificationRequestData(const int wsId, - const QString &title, - NotificationManagement::CreateNotification &data, - const QString &content = {}, - const QStringList &contentArgs = {}); - void createNotificationRequest(const int wsId, const QString &title, const NotificationManagement::MessageType messageType, const NotificationManagement::NotificationType notificationType, const QString &content = {}, const QStringList &contentArgs = {}); - - public Q_SLOTS: - void onSAARegistration(const int wsId, const int partyId, const QString &saaName, const QString &szenarName, bool isVerbund, const QString &uuid); - void onSAADeregistration(const int wsId, const int partyId); - void onSAAConnectionTest(const int wsId, const QString &uuid); - void onSAAStatus(const int wsId, const EXStatus &status); - void onSAAExceptionStatus(const int wsId, const TechnischeDaten &exceptionStatus); - void onSAASQWS(const int wsId, const Waffensystemdaten &exSQWS); - void onSAASQFS(const int wsId, const Feuerstellungsdaten &exSQFS); - void onSAASQLP(const int wsId, const Ladeplatzdaten &exSQLP); - void onSAAHXGuidingLines(const int wsId, const Koordinierungsdaten &koordinierungsdaten); - void onSAAHXGuidingLinesAndBoundaries(const int wsId, const Fuehrungsdaten &fuehrungsdaten); - void onSSAEXFIREHALT(const int wsId, const FeuerHaltDaten &feuerhaltdaten); - void onSAATrajectoryData(const int wsId, const Flugbahndaten &exFlugbahndaten, const QString referenceUuid); - - void onWebSocketConnected(); - void onNewWebsocketConnected(const int wsId, const QString &address, qint16 port); - void onWSDisconnected(const int wsId); - void onWebsocketExternalConnectionStateChanged(bool bConnected); - void onWebSocketError(); - void onRecivedTelegram(int wsId, const QJsonObject &telegramData); - void onTextMessageReceived(const QByteArray &message); - void connectWebsocket(); - void reallyConnectWebsocket() { connectWebsocket(); } - - void onKeepAliveTimerTimeout(); - void onCreateNotificationReply(const Core::FunctionReplyObject &replyObject); - Q_SIGNALS: - void broadcastTelegramsRequest(const int equipmentNumber, const int broadcastIndex, const int resetCounter); - void jsonTelegramReceived(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *tele); - void websocketConnected(quint16 port); - - private: - QUrl webSocketUrl() const; - bool isConnectionTest(QJsonDocument &doc); - QString getParticipantInfoLink(const QString &verein, const int partyId, const bool isVerbund); - - std::shared_ptr getSAAByName(const QString &saaName); - - private: - std::shared_ptr m_recvFromTabCb; - std::shared_ptr m_recvFromWebsocket; - std::shared_ptr m_sendToWebsocket; - // DDS - MainDispatcher *m_mainDispatcher; - std::shared_ptr m_flmHandler; - std::shared_ptr m_ppmHandler; - - std::shared_ptr m_ftsTab; - std::shared_ptr m_dtsTab; - std::shared_ptr m_ftcNom; - - QVector> m_saaInterfaces; - QMap m_connectionKeepaliveTimer; - - QHash m_trajectoryIdentifier; // key = exFlugbahnberechnung.uuid - QHash m_positionsLaunch; // key = exFlugbahnberechnung.uuid - - NGL::Settings *m_settings; - QWebSocket *m_webSocket; - std::shared_ptr m_webSocketInterface; - QTimer *m_webSocketReconnectTimer; - bool m_bWarnedOnce; - rti::core::SampleIdentity m_cookieCalculateTrajectoryAdler; - int m_explosionIndex; -}; - -} // namespace AdlerJson diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_handler_rx.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_handler_rx.h deleted file mode 100755 index 30f2b2ebf..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_handler_rx.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @RDE_HEADER@ - * JsonHandlerRx for AdlerJson Plugin - * $Id: hla_handler_rx.h 62304 2024-03-21 08:17:45Z ewert_j $ - * $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/hla_handler_rx.h $ - * $Author: ewert_j $ - * Created by Julius Ewert, ESIM, 2024-03-20 - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include "logger.h" - -namespace AdlerJson -{ -class AesHandler; -class PpmHandler; -class JsonDispatcher; -class JsonHandlerRx : public QObject -{ - Q_OBJECT -public: - explicit JsonHandlerRx(const std::shared_ptr &recvFromTabCb, - const std::shared_ptr &sendToTabCb, - JsonDispatcher *dispatcher, - AesHandler *aesHandler, - PpmHandler *ppmHandler); - - bool handleTelegram (const QByteArray &baJson ); - bool handleTelegram (TrainingAreaBase::TetraIcd::TrainingAreaTelegram *tabTele); - bool handleTelegram (int wsId, const QJsonObject& telegram, int &errorcode); -Q_SIGNALS: - void participantConnectionState(int equipmentNumber, bool dataCommunicationPossible); -private: - template - void rxData (const T &data ); - - template - void txData (const T &data ); - - bool checkExercise (int equipmentNumber) const; -private: - std::shared_ptr m_rxHandler; - std::shared_ptr m_txHandler; - JsonDispatcher *m_dispatcher; - bool m_bWarnedOnce; - bool m_bWarnedOnceTx; - AesHandler *m_aesHandler; - PpmHandler *m_ppmHandler; - LOGGER_T m_logger; -}; - -} // namespace AdlerJson diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_handler_tx.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_handler_tx.h deleted file mode 100755 index b44149414..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/json_handler_tx.h +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @RDE_HEADER@ - * HlaHandlerTx for AdlerJson Plugin - * $Id: hla_handler_tx.h 62304 2024-03-21 08:17:45Z ewert_j $ - * $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/hla_handler_tx.h $ - * $Author: ewert_j $ - * Created by Julius Ewert, ESIM, 2024-03-20 - */ - -#pragma once - -#include "ppm_handler.h" -#include "pdm_handler.h" -#include "logger.h" -//#include "ws_handler.h" -#include "ws_interface.h" -#include -#include -#include -#include - -class QWebSocket; -class PpmHandler; -class PdmHandler; -class AesHandler; -namespace AdlerJson -{ -class JsonHandlerTx final : public QObject, public TrainingAreaBase::SendToTab -{ - Q_OBJECT -public: - explicit JsonHandlerTx(TrainingAreaBase::Plugin::DataProvider *pdp, MainDispatcher *mainDispatcher); - - void onWebSocketConnected (QWebSocket *webSocket); - void onWebSocketDisconnected ( ); - void onWebsocketConnectedToExternalSystem (bool bConnected ); - void setWSInterface(std::shared_ptr wsInterface) {m_wsInterface = wsInterface;}; - - const char *name () const override { return "ApAdler"; } - void resetSendCounter () override; - - HandleState canHandleTelegram (int equipmentNumber, int telegramId) const override; - - bool txData (const TrainingAreaBase::TetraIcd::Acknowledge &data) override; - bool txData (const TrainingAreaBase::TetraIcd::DemandBite &data) override; - bool txData (const TrainingAreaBase::TetraIcd::Init &data) override; - bool txData (const TrainingAreaBase::TetraIcd::SetVulnerabilityModel &data) override; - bool txData (const TrainingAreaBase::TetraIcd::DemandEquipmentConfigurationReport &data) override; - bool txData (const TrainingAreaBase::TetraIcd::DemandVulnerabilityStateChange &data) override; - bool txData (const TrainingAreaBase::TetraIcd::LanguageSelection &data) override; - bool txData (const TrainingAreaBase::TetraIcd::EquipmentMessage &data) override; - bool txData (const TrainingAreaBase::TetraIcd::EquipmentMessageOC &data) override; - bool txData (const TrainingAreaBase::TetraIcd::CreateSingleExplosion &data) override; - bool txData (const TrainingAreaBase::TetraIcd::CreateAreaExplosion &data) override; - bool txData (const TrainingAreaBase::TetraIcd::CreateMineArea &data) override; - bool txData (const TrainingAreaBase::TetraIcd::MineAreaSingleMineState &data) override; - bool txData (const TrainingAreaBase::TetraIcd::CreateNContamination &data) override; - bool txData (const TrainingAreaBase::TetraIcd::CreateCContamination &data) override; - bool txData (const TrainingAreaBase::TetraIcd::DeactivateEffectSimulation &data) override; - bool txData (const TrainingAreaBase::TetraIcd::ModifyAreaEffectSimulationName &data) override; - bool txData (const TrainingAreaBase::TetraIcd::PauseEffectSimulation &data) override; - bool txData (const TrainingAreaBase::TetraIcd::ResumeEffectSimulation &data) override; - bool txData (const TrainingAreaBase::TetraIcd::MineTriggered &data) override; - bool txData (const TrainingAreaBase::TetraIcd::DusMineReactivation &data) override; - bool txData (const TrainingAreaBase::TetraIcd::CreateFunctionalArea &data) override; - bool txData (const TrainingAreaBase::TetraIcd::CreateDusSingleMine &data) override; - bool txData (const TrainingAreaBase::TetraIcd::ExerciseEnvironmentData &data) override; - bool txData (const TrainingAreaBase::TetraIcd::ExerciseStateData &data) override; - bool txData (const TrainingAreaBase::TetraIcd::OpaquePayloadDataOut &data) override; - bool txData (const TrainingAreaBase::TetraIcd::ParticipantSwVersionsRequest &data) override; - bool txData (const TrainingAreaBase::TetraIcd::CesHitInformation &data) override; - bool txData (const TrainingAreaBase::TetraIcd::TechnicalArea &data) override; - bool txData (const TrainingAreaBase::TetraIcd::CesHitRequest &data) override; - bool txData (const TrainingAreaBase::TetraIcd::ParticipantMode &data) override; - bool txData (const TrainingAreaBase::TetraIcd::DemandParticipantMode &data) override; - bool txData (const TrainingAreaBase::TetraIcd::ParticipantConfiguration &data) override; - bool txData (const TrainingAreaBase::TetraIcd::DemandParticipantConfiguration &data) override; - bool txData (const TrainingAreaBase::TetraIcd::ExerciseEquipmentAssignmentComplete &data) override; - bool txData (const TrainingAreaBase::TetraIcd::Sanitation &data) override; - bool txData (const TrainingAreaBase::TetraIcd::SelectiveReammunition &data) override; - bool txData (const TrainingAreaBase::TetraIcd::SetDevicePowerRequest &data) override; - bool txData (const TrainingAreaBase::TetraIcd::OcCommand &data) override; - bool txData (const TrainingAreaBase::TetraIcd::UAVPerformMission &data) override; - bool txData (const TrainingAreaBase::TetraIcd::UAVChangeState &data) override; - bool txData (const TrainingAreaBase::TetraIcd::ExFireReadiness &data) override; - bool txData (const TrainingAreaBase::TetraIcd::ExFiredReport&data) override; - bool txData (const TrainingAreaBase::TetraIcd::ExConfirmationReport &data) override; - - QHash dataCommunicationPossible() const; -public slots: - void onParticipantConnectionState (const int equipmentNumber, const bool dataCommunicationPossible); - void onGenericTelegram (const QJsonObject &telegram); - void onGenericTelegram1 (const int wsId, const QJsonObject &telegram); -private: - bool sendToTx(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *data, const bool bForce = false); -private: - TrainingAreaBase::Plugin::DataProvider *m_pdp; - QHash m_dataCommunicationPossible; // equioNo, reachable - MainDispatcher *m_mainDispatcher; - QWebSocket *m_webSocket; - std::shared_ptr m_wsInterface; - bool m_bWebsocketConnectedToExternalSystem; - LOGGER_T m_logger; - -}; - -}// namespace AdlerJson diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/logger.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/logger.h deleted file mode 100755 index 06d59b75f..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/logger.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @RDE_HEADER@ - * Logger for AdlerJson Plugin - * $Id: logger.h 62304 2024-03-21 08:17:45Z ewert_j $ - * $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/logger.h $ - * $Author: ewert_j $ - * Created by Julius Ewert, ESIM, 2024-03-20 - */ - -#pragma once - -#include - -namespace AdlerJson -{ -using LOGGER_T = NGL::INGLLogger&; - -LOGGER_T getLogger(const char *name); -inline LOGGER_T getLogger(const QString &loggerName) -{ - return getLogger(loggerName.toUtf8().constData()); -} -} // namespace AdlerJson diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/main_dispatcher.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/main_dispatcher.h deleted file mode 100755 index 816e3f9ed..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/main_dispatcher.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @RDE_HEADER@ - * MainDispatcher for AdlerJson Plugin - * $Id: main_dispatcher.h 62899 2024-05-29 11:08:50Z ewert_j $ - * $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/main_dispatcher.h $ - * $Author: ewert_j $ - * Created by Julius Ewert, ESIM, 2024-03-20 - */ - -#pragma once - -#include -#include -#include // tr_lts -#include -//#include "logger.h" -#include "ppm_handler.h" -#include "pdm_handler.h" -#include "aes_handler.h" -#include "flm_handler.h" -#include "asm_handler.h" - -namespace AdlerJson -{ -class JsonDispatcher; -class PpmHandler; -class PdmHandler; -class AesHandler; -class FlmHandler; -class AsmHandler; - -class MainDispatcher final : public TrainingAreaBase::Plugin::Interface -{ - Q_OBJECT -public: - MainDispatcher( TrainingAreaBase::Plugin::DataProvider *pdp, - const std::shared_ptr &recvFromTabCb, - const std::shared_ptr &sendToTabCb, - const std::shared_ptr &ddsHandler, - NGL::Settings *settings); - ~MainDispatcher(); - - std::shared_ptr ppmHandler() const { return m_ppmHandler; } - std::shared_ptr pdmHandler() const { return m_pdmHandler; } - std::shared_ptr aesHandler() const { return m_aesHandler; } - std::shared_ptr asmHandler() const { return m_asmHandler; } - JsonDispatcher* jsonDispatcher() const { return m_adlerDispatcher; } - std::shared_ptr ddsHandler() const { return m_ddsHandler; } - - int exerciseId() const { return m_exerciseId; } - -public slots: - bool init() override; - void onWebsocketConnected(quint16 port); - -public: - std::shared_ptr sendToTab() override; - bool canSendData () const override; - void exerciseChanged () override; - bool isDebugInterface () const override { return false; } - const char *name () const override { return tr_lts("dds", "ApHlaJson"); } - -private: - JsonDispatcher *m_adlerDispatcher; - - std::shared_ptr m_recvFromTabCb; - const std::shared_ptr m_sendToTab; - std::shared_ptr m_mainHandlerTx; - TrainingAreaBase::Plugin::DataProvider *m_pdp; - - NGL::Settings *m_settings; - - std::shared_ptr m_ppmHandler; - std::shared_ptr m_pdmHandler; - std::shared_ptr m_aesHandler; - std::shared_ptr m_flmHandler; - std::shared_ptr m_asmHandler; - std::shared_ptr m_ddsHandler; - - int m_domainId; - int m_exerciseId; -}; -} // namespace AdlerJson - diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/pdm_handler.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/pdm_handler.h deleted file mode 100755 index e424f4143..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/pdm_handler.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @RDE_HEADER@ - * PdmHandler for AdlerJson Plugin - * $Id: pdm_handler.h 62304 2024-03-21 08:17:45Z ewert_j $ - * $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/pdm_handler.h $ - * $Author: ewert_j $ - * Created by Julius Ewert, ESIM, 2024-03-20 - */ - -#pragma once - -#include "main_dispatcher.h" -#include "logger.h" -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AdlerJson -{ - -class MainDispatcher; -class PdmHandler : public QObject -{ - Q_OBJECT -public: - explicit PdmHandler(QObject *parent = nullptr); - void getChargeTypes(); - std::shared_ptr getDtc() { return m_dtcPdm; } -signals: - void sendChargeTypes(QJsonObject jsonObj); -public slots: - bool init(MainDispatcher* mainDispatcher); - -private: - - std::shared_ptr m_dtcPdm; -}; - -} // namespace AdlerJson diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/plugin.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/plugin.h deleted file mode 100755 index 2f83bf260..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/plugin.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @RDE_HEADER@ - * TabAdlerPlugin for AdlerJson Plugin - * $Id: plugin.h 62304 2024-03-21 08:17:45Z ewert_j $ - * $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/plugin.h $ - * $Author: ewert_j $ - * Created by Julius Ewert, ESIM, 2024-03-20 - */ - -#pragma once - -#include "TrainingAreaBase/dds_handler.h" -#include -#include - -namespace AdlerJson -{ -class TabAdlerPlugin : public QObject, public TrainingAreaBase::Plugin::Plugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "special:3:tab.aphla") - Q_INTERFACES(TrainingAreaBase::Plugin::Plugin) -public: - TabAdlerPlugin() = default; - ~TabAdlerPlugin() = default; - std::shared_ptr createInterface(TrainingAreaBase::Plugin::DataProvider *pdp, - const std::shared_ptr &recvFromTabCb, - const std::shared_ptr &sendToTab, - const std::shared_ptr &ddsHandler, - NGL::Settings *settings) override; -}; - -} // namespace AdlerJson diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ppm_handler.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ppm_handler.h deleted file mode 100755 index f23c927e9..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ppm_handler.h +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @RDE_HEADER@ - * PpmHandler for AdlerJson Plugin - * $Id: ppm_handler.h 62899 2024-05-29 11:08:50Z ewert_j $ - * $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/ppm_handler.h $ - * $Author: ewert_j $ - * Created by Julius Ewert, ESIM, 2024-03-20 - */ - -#pragma once - -#include "Core/core.hpp" -#include "main_dispatcher.h" -#include "logger.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AdlerJson -{ - -class MainDispatcher; -class PpmHandler - : public QObject - , protected ParticipantManagement::Interface::Ftc::ModifyParticipantDataReplyHandler - , protected ParticipantManagement::Interface::Ftc::ModifyPartyDataReplyHandler -{ - Q_OBJECT -public: - explicit PpmHandler(QObject *parent = nullptr); - bool init(MainDispatcher* mainDispatcher); - void getParticipants(); - bool isEqNumberInExercise(const int equipmentNumber) const; - - - std::shared_ptr getDtc() { return m_dtcPpm; } - std::shared_ptr getFtc() { return m_ftcPpm; } - - void onCreateParticipant(); - - // ModifyParticipantDataRequestHandler interface - void onModifyParticipantDataReply(const Core::FunctionReply &reply); - void onModifyPartyDataReply(const Core::FunctionReply &reply); - void modifyPartyAdlerProperties(const int wsId, const int assetId, const int partyId, const QString &saaName, const QString &szenarName, - const ParticipantManagement::ConnectState &connectState, const bool isVerbund); - - //parse functions that trigger other services - void parseSQFS(const Feuerstellungsdaten &exSQFS, const int wsId); - void parseSQWS(const Waffensystemdaten &exSQWS, const int wsId); - void parseSQLP(const Ladeplatzdaten &exSQLP, const int wsId); - - void removeAllSAAParticipants(const int partyId); - ParticipantManagement::Participant findParticipantByInternalName(const QString &internalName, const int partyId, const bool isVerbund); - -signals: - void participantChanged(const QJsonObject &jsonObj); - void participantUnmount(const QJsonObject &jsonObj); - void participantMount(const QJsonObject &jsonObj); - -private slots: - void onPartyChanged(const ParticipantManagement::Party &data, DataModification modType); - void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType); - void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType); - void onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType); - void onSendParticipantDataTimeout(); -private: - void handleParticipantPositionChangedExternal(const ParticipantManagement::ParticipantPosition &position); - void handleParticipantPositionChangedInternal(const ParticipantManagement::ParticipantPosition &position); - - void sendParticipantMount(const ParticipantManagement::Participant &part, const ParticipantManagement::Participant &partToBeMounted); - void sendParticipantUnmount(const ParticipantManagement::Participant &participant); - void sendParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &position); - void onModifyParticipantDataReply(const Core::FunctionReplyObject &reply) override; - void onModifyPartyDataReply(const Core::FunctionReplyObject &reply) override; - - QList findAllSAAParticipants(const int partyId); - ParticipantManagement::ParticipantData findParticipantDataByInternalName(int &randomNumberInOut, const QString &internalName, const bool isVerbund); - ParticipantManagement::ParticipantData findRootUnit(const int partyId); - - void sendPositionFromTempMap(int rndNmbr, const int partyId, const bool isVerbund); - void sendChargesFromTempMap(const int rndNmbr, const int partyId, const bool isVerbund); - void sendReadyMessageFromTempMap(int rndNmbr, const int partyId, const bool isVerbund); - int convertStatus_L28(const ProjectDataManagement::L28_Status &status); - - QVector sumUpAnzahlForSameGeschoss(const QVector &geschosse) const; -private: - MainDispatcher *m_mainDispatcher; - std::shared_ptr m_dtcPpm; - std::shared_ptr m_ftcPpm; - QHash m_participantIdsByEqNo; // eqNo, partId - QHash m_mountedParticipants;// participantId of passanger, participantId of Vehicle - QTimer *m_sendParticipantDataTimer; - QVector m_randomNumbers; - //maps - QMap m_mapLocationToPosition; - QMap> m_tempPositionMap; - QMap> m_tempinternalNameMap; - QMap>> m_tempChargesMap; - QMap> m_tempPartDataList; - QMap> m_tempReadyMessage; - -}; - -} // namespace AdlerJson diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/saa_interface.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/saa_interface.h deleted file mode 100755 index 69eb9f959..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/saa_interface.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once -#include -#include -#include "ppm_handler.h" -#include "aes_handler.h" -#include "pdm_handler.h" - -#include "logger.h" - -// Forward: -namespace LtsCoordTrans -{ -struct UtmCoordinate; -} - -namespace AdlerJson -{ -enum class ScenarioStatus // Szenarstatus -{ - NONE , - INACTIVE , // Inaktiv - PLANNED , // Geplant - ACTIVE , // Aktiv - STOPPED // Gestoppt -}; -QString statusToStr(ScenarioStatus status); - -ScenarioStatus strToStatus(QString status); - - -/** - * @brief Convert (relative) Flugbahnpunkt to EXCON coordinate system - * @param fbPos Flugbahnpunkt to be converted. - * @param transformMatrix QTransform to be applied (most likely rotation). - * @param utmLaunch launch coordinate for debugging purpose - * @param logger to be used. - * @return Coordinate transformed (rotated) in EXCON coordinate system. - */ -static Core::RelativePositionRelativeTime convertFlugbahnpunkt(const Flugbahnpunkt &fbPos, - const QTransform &transformMatrix, - const LtsCoordTrans::UtmCoordinate &utmLaunch, - LOGGER_T logger); - - -class JsonDispatcher; -class SAAInterface - : public QObject - , protected AreaEffectSimulation::Interface::Ftc::TrajectoryAdlerModifyReplyHandler -{ - Q_OBJECT -public: - SAAInterface(int wsId, int partyId, const QString& saaName, const QString& szenarName, bool isVerbund, QObject *parent = nullptr); - - bool init(std::shared_ptr ppmHandler, - std::shared_ptr pdmHandler, - std::shared_ptr aesHandler, - std::shared_ptr dtsTab); - - - int getWsId(){ return m_wsId; }; - void setWsId(int wsId){ m_wsId = wsId;}; - int getPartyId(){ return m_partyId; }; - void setPartyId(int partyId){ m_partyId = partyId; }; - QString getSAAName(){ return m_saaName; }; - //QString getSAAName(){ return QStringLiteral("SAA.GUEZ.DE"); }; - void setSaaName(const QString& saaName){ m_saaName = saaName; }; - //void setSaaName(const QString& saaName){ Q_UNUSED(saaName); m_saaName = QStringLiteral("SAA@GUEZ.de"); }; - QString getSzenarName() {return m_szenarName; } - void setSzenarName(const QString &szenarName) { m_szenarName = szenarName; } - Szenarstatus getStatus(){ return m_status; }; - void setStatus(Szenarstatus status); - void setIsVerbund(bool isVerbund) { m_isVerbund = isVerbund; } - bool getIsVerbund(){ return m_isVerbund; } - void setIsAlive(bool isAlive) { m_isAlive = isAlive; } - bool getIsAlive(){ return m_isAlive; } - - //parse functions that trigger other services - void parseFlugbahndaten(const Flugbahndaten &flugbahndaten, int aesItemId, int exposionId, const Core::GeoPosition &positionLaunch); - - template - void rxData (const T &data ); - -private: - void onTrajectoryAdlerModifyReply(const Core::FunctionReplyObject &reply) override; - - int m_wsId; - int m_partyId; - QString m_saaName; - QString m_szenarName; - Szenarstatus m_status; - bool m_isVerbund; - bool m_isAlive=false; - - //int m_currentRandomNumber{0}; - //DDS - std::shared_ptr m_ppmHandler; - std::shared_ptr m_pdmHandler; - std::shared_ptr m_aesHandler; - - std::shared_ptr m_ftcAes; - std::shared_ptr m_dtsTab; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/settings.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/settings.h deleted file mode 100755 index d3fda37c7..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/settings.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Settings for TetraRadio - * $Id: settings.h 63154 2024-06-25 11:19:33Z karwat $ - * $HeadURL: svn://slssvn/TDS/branches/product/features/24_adler/Lts/Proxies/TrainingAreaBase/settings.h $ - * $Author: karwat $ - * Created by Christian Ehrlicher, SLSE, 2016-04-14 - */ -#pragma once - -#include -#include - -namespace NGL -{ -class Settings; -} - -namespace TrainingAreaBase -{ - -namespace Settings -{ - -//!< The real NGL::Settings - object -NGL::Settings *settings(); - -void setIniFile(const QString &ini); -QString txDir(); -QString rxDir(); -QPair getWebSocketServerPortRange(int type); -} - -} // namespace TrainingAreaBase diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/telegrams.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/telegrams.h deleted file mode 100755 index e7317bf22..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/telegrams.h +++ /dev/null @@ -1,1596 +0,0 @@ -#pragma once -#include "saatelegrams_export.h" -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace AdlerJson -{ - -namespace JsonKeys -{ -// root keys -inline QString DATA() { return QStringLiteral("data"); } -inline QString UUID_() { return QStringLiteral("uuid"); } -inline QString TYPE() { return QStringLiteral("type"); } -inline QString TYPE_ID() { return QStringLiteral("typeId"); } -inline QString TIMESTAMP() { return QStringLiteral("timestamp"); } - -inline QString VERSION() { return QStringLiteral("version"); } -inline QString SENDER() { return QStringLiteral("sender"); } -inline QString RECEIVER() { return QStringLiteral("receiver"); } -inline QString REFERENCE_UUID() { return QStringLiteral("referenceUuid"); } -inline QString AFE() { return QStringLiteral("Afe"); } -inline QString PARTY_ID() { return QStringLiteral("partyId"); } -inline QString ADLER_VERBUND() { return QStringLiteral("adlerVerbund"); } -inline QString SZENAR() { return QStringLiteral("szenar"); } -inline QString STATUS() { return QStringLiteral("status"); } - -// SKD_SAA-EXCON - -// EX-L15 -inline QString JAHR() { return QStringLiteral("jahr"); } -inline QString MONAT() { return QStringLiteral("monat"); } -inline QString TAG() { return QStringLiteral("tag"); } -inline QString STUNDEN() { return QStringLiteral("stunden"); } -inline QString MINUTEN() { return QStringLiteral("minuten"); } -inline QString SEKUNDEN() { return QStringLiteral("sekunden"); } -inline QString ZDS() { return QStringLiteral("zds"); } -inline QString ZDM() { return QStringLiteral("zdm"); } -inline QString ZVZ() { return QStringLiteral("zvz"); } - -// Tabelle 2: Auszutauschende fachliche Meldungen - -inline QString EX_AWES_PLANNING() { return QStringLiteral(" EX-FQ(BA-BB-FK)"); } // Wirkfeldplanung -inline QString EX_MANUAL_REPLY() { return QStringLiteral("EX-MQ"); } // Manuelle Quittung -inline QString EX_READY_TO_FIRE() { return QStringLiteral("EX-FQ(FB)"); } // Feuerbereit -inline QString EX_FIRE() { return QStringLiteral("EX-FQ(FN)"); } // Feuern -inline QString EX_FIRED() { return QStringLiteral("EX-FQ(AF)"); } // Abgefeuert -inline QString EX_ENFORCEMENT() { return QStringLiteral("EX-FQ(VM)"); } // Vollzugsmeldung -inline QString EX_FIRE_HALT() { return QStringLiteral("EX-FH"); } // Feuer HALT / Einstellen -inline QString EX_DONT_FIRE() { return QStringLiteral("EX-FQ(nFN)"); } -inline QString EX_POSITION_REPORT_FIRE() { return QStringLiteral("EX-SQ(FS)"); } // Stellungsmeldung Feuerstellung -inline QString EX_POSITION_REPORT_WEAPON() { return QStringLiteral("EX-SQ(WS)"); } // Stellungsmeldung Waffensystem -inline QString EX_POSITION_REPORT_LOADING_PLACE() { return QStringLiteral("EX-SQ(LP)"); } // Stellungsmeldung Ladeplatz -inline QString EX_EXPLORATION_RESULTS() { return QStringLiteral("EX-Erkundungsergebnisse"); } // Senden Erkundungsergebnisse -inline QString EX_FIRE_FIGHT() { return QStringLiteral("EX-FQ(BA-BB)"); } // Feuerkampf (ohne ADLER Verbund) -inline QString EX_POSITION_CHANGED() { return QStringLiteral("EX-Stellungswechsel"); } // Stellungsinformationen (ohne ADLER Verbund) -inline QString EX_GUIDING_LINES() { return QStringLiteral("EX-HQ(K)"); } // Fuehrungslinien (Koordinierungsmassnahmen zur Feuerunterstuetzung) -inline QString EX_GUIDING_LINES_AND_BOUNDARIES() { return QStringLiteral("EX-HQ(G)"); } // Fuehrungslinien und Grenzen -inline QString EX_AQ() { return QStringLiteral("EX-AQ"); } // Freitextmeldung -inline QString EX_FLUGBAHNBERECHNUNG() { return QStringLiteral("EX-Flugbahnberechnung"); } // Flugbahnberechnung -inline QString EX_FLUGBAHNDATEN() { return QStringLiteral("EX-Flugbahndaten"); } // Flugbahndaten - -// 3.2 Technische Meldungen - -// Tabelle 4 -inline QString EX_REGISTRATION_REQUEST() { return QStringLiteral("EX-Anmeldung"); } -inline QString EX_REGISTRATION_CONFIRMATION() { return QStringLiteral("EX-Anmeldebestaetigung"); } -inline QString EX_DEREGISTRATION_REQUEST() { return QStringLiteral("EX-Abmeldung"); } -inline QString EX_STATUS() { return QStringLiteral("EX-Status"); } -inline QString EX_CONNECTION_TEST_REQUEST() { return QStringLiteral("EX-Verbindungsanfrage"); } -inline QString EX_CONNECTION_TEST_REPLY() { return QStringLiteral("EX-Verbindungsantwort"); } -inline QString EX_TQ() { return QStringLiteral("EX-TQ"); } - -// ====================================================================================================== -// JsonKeys fuer fachliche Meldungen - -inline QString FEUERKAMPFREFERENZ() { return QStringLiteral("feuerkampfReferenz"); } -inline QString ZIELDATEN() { return QStringLiteral("zieldaten"); } -inline QString NUMMER() { return QStringLiteral("nummer"); } -inline QString GEOMETRIE() { return QStringLiteral("geometrie"); } -inline QString KOORDINATE() { return QStringLiteral("koordinate"); } -inline QString KOORDINATEN() { return QStringLiteral("koordinaten"); } -inline QString ZIELKOORDINATE() { return QStringLiteral("zielkoordinate"); } -inline QString STANDORT() { return QStringLiteral("standort"); } -inline QString LATITUDE() { return QStringLiteral("latitude"); } -inline QString LONGITUDE() { return QStringLiteral("longitude"); } -inline QString HOEHE() { return QStringLiteral("hoehe"); } -inline QString MAXGIPFEL() { return QStringLiteral("maxGipfel"); } -inline QString RELATIV_KOORDINATE() { return QStringLiteral("relativKoordinate"); } -inline QString BREITE_RADIUS() { return QStringLiteral("breiteRadius"); } -inline QString RADIUS() { return QStringLiteral("radius"); } -inline QString TIEFE() { return QStringLiteral("tiefe"); } -inline QString ZIELACHSE() { return QStringLiteral("zielachse"); } -inline QString ZOG() { return QStringLiteral("zog"); } -inline QString ELEMENTE() { return QStringLiteral("elemente"); } -inline QString TYP() { return QStringLiteral("typ"); } -inline QString SUB_TYP() { return QStringLiteral("subTyp"); } -inline QString ABFEUERUNGSART() { return QStringLiteral("abfeuerungsArt"); } -inline QString ART() { return QStringLiteral("art"); } -inline QString FORDERUNG() { return QStringLiteral("forderung"); } -inline QString DAUER() { return QStringLiteral("dauer"); } - -inline QString FEUERKOMMANDO() { return QStringLiteral("feuerkommando"); } -inline QString VEREIN() { return QStringLiteral("verein"); } -inline QString WIRKMITTEL() { return QStringLiteral("wirkmittel"); } -inline QString WIRKMITTELRAKETE() { return QStringLiteral("wirkmittelRakete"); } -inline QString KENNER() { return QStringLiteral("kenner"); } -inline QString AUFTREFFPUNKT() { return QStringLiteral("auftreffpunkt"); } -inline QString TREFFPUNKTE() { return QStringLiteral("treffpunkte"); } -inline QString FLUGZEIT() { return QStringLiteral("flugzeit"); } -inline QString GIPFELHOEHE() { return QStringLiteral("gipfelhoehe"); } -inline QString SCHUSSRICHTUNG() { return QStringLiteral("schussrichtung"); } -inline QString GESCHOSS() { return QStringLiteral("geschoss"); } -inline QString GESCHOSSE() { return QStringLiteral("geschosse"); } -inline QString GESCHOSSSORTE() { return QStringLiteral("geschosssorte"); } -inline QString LADUNG() { return QStringLiteral("ladung"); } -inline QString LADUNGSNUMMER() { return QStringLiteral("ladungsNummer"); } -inline QString ZUENDER() { return QStringLiteral("zuender"); } -inline QString ZUENDERFUNKTION() { return QStringLiteral("zuenderFunktion"); } -inline QString ZUENDER_ZEIT() { return QStringLiteral("zuenderZeit"); } -inline QString ANZAHL() { return QStringLiteral("anzahl"); } -inline QString INTERVALL() { return QStringLiteral("intervall"); } -inline QString FLUGBAHNPUNKT() { return QStringLiteral("flugbahnpunkt"); } -inline QString SPRENGHOEHE() { return QStringLiteral("sprenghoehe"); } -inline QString ZEIT() { return QStringLiteral("zeit"); } -inline QString X_RELATIV() { return QStringLiteral("xRelativ"); } -inline QString Y_RELATIV() { return QStringLiteral("yRelativ"); } -inline QString Z_RELATIV() { return QStringLiteral("zRelativ"); } -inline QString STREUUNG() { return QStringLiteral("streuung"); } -inline QString LAENGS_STREUUNG() { return QStringLiteral("laengsstreuung"); } -inline QString SEITEN_STREUUNG() { return QStringLiteral("seitenstreuung"); } -inline QString LAENGS_STREUUNG_H() { return QStringLiteral("laengsstreuungH"); } -inline QString SEITEN_STREUUNG_H() { return QStringLiteral("seitenstreuungH"); } -inline QString EINHEIT() { return QStringLiteral("einheit"); } -inline QString FEUEREINHEIT() { return QStringLiteral("feuereinheit"); } -inline QString MITTELPUNKT() { return QStringLiteral("mittelpunkt"); } -inline QString GRUNDRICHTUNG() { return QStringLiteral("grundrichtung"); } -inline QString WINKELGRUPPE() { return QStringLiteral("winkelgruppe"); } -inline QString LINKS() { return QStringLiteral("links"); } -inline QString RECHTS() { return QStringLiteral("rechts"); } -inline QString WIRKUNGSBEREICH() { return QStringLiteral("wirkungsbereich"); } -inline QString NAME() { return QStringLiteral("name"); } -inline QString TRUPPENTEIL() { return QStringLiteral("truppenteil"); } - -inline QString MELDUNGSNUMMER() { return QStringLiteral("meldungsnummer"); } -inline QString AB() { return QStringLiteral("ab"); } -inline QString BIS() { return QStringLiteral("bis"); } -inline QString LINKERNACHBAR() { return QStringLiteral("linkerNachbar"); } -inline QString RECHTERNACHBAR() { return QStringLiteral("rechterNachbar"); } -inline QString BESCHREIBUNG() { return QStringLiteral("beschreibung"); } -inline QString FREITEXT() { return QStringLiteral("freitext"); } -inline QString KATEGORIE() { return QStringLiteral("kategorie"); } -inline QString FEUERKAMPF() { return QStringLiteral("feuerkampf"); } -inline QString ZPNUMMER() { return QStringLiteral("zpNummer"); } -inline QString OI() { return QStringLiteral("oi"); } -inline QString R() { return QStringLiteral("r"); } -inline QString WAFFENPLAETZE() { return QStringLiteral("waffenplaetze"); } -inline QString WAFFENSYSTEM() { return QStringLiteral("waffensystem"); } -inline QString STELLUNGEN() { return QStringLiteral("stellungen"); } -inline QString TEXTVAL() { return QStringLiteral("text"); } -inline QString FEHLERCODE() { return QStringLiteral("fehlercode"); } -inline QString FALLWINKEL() { return QStringLiteral("fallwinkel"); } -inline QString ERRORTEXT() { return QStringLiteral("error"); } -inline QString ANFLUG() { return QStringLiteral("anflug"); } -inline QString GPS() { return QStringLiteral("gps"); } -inline QString WIRKZEIT() { return QStringLiteral("wirkzeit"); } -inline QString ENTLADENSCHUSS() { return QStringLiteral("entladenSchuss"); } - -inline QString ABFEUERUNGSZEIT() { return QStringLiteral("abfeuerungsZeit"); } - -} // namespace JsonKeys - -namespace TelegramIds -{ -static constexpr int EX_REGISTRATION_REQUEST() { return 6007; } // Only sent by SAA (EX-Anmeldung) -static constexpr int EX_DEREGISTRATION_REQUEST() { return 6009; } // Sent by EXCON and SAA (EX-Abmeldung) -static constexpr int EX_REGISTRATION_CONFIRMATION() { return 6008; } // Only sent by EXCON (EX-Anmeldebestaetigung) -static constexpr int EX_CONNECTION_TEST_REQUEST() { return 6011; } // Only sent by SAA (EX-Verbindungsanfrage) -static constexpr int EX_CONNECTION_TEST_REPLY() { return 6012; } // Only sent by EXCON (EX-Verbindungsantwort) -static constexpr int EX_STATUS() { return 6010; } // Only sent by SAA (EX-Status) - -// Fachliche Meldungen -static constexpr int EX_AWES_PLANNING() { return 1000; } // Only sent by SAA ( EX-FQ(BA-BB-FK) Wirkfeldplanung) -static constexpr int EX_MANUAL_REPLY() { return 1001; } // Only sent by EXCON ( Manuelle Quittung) -static constexpr int EX_READY_TO_FIRE() { return 1002; } // Only sent by EXCON ( Feuerbereit) -static constexpr int EX_FIRE() { return 1003; } // Only sent by SAA ( EX-FQ(FN) Feuern) -static constexpr int EX_FIRED() { return 1004; } // Only sent by EXCON ( Abgefeuert) -static constexpr int EX_ENFORCEMENT() { return 1005; } // Only sent by EXCON ( Vollzugsmeldung) -static constexpr int EX_FIRE_HALT() { return 1006; } // sent by SAA+EXCON ( Feuer HALT / Einstellen) -static constexpr int EX_DONT_FIRE() { return 1007; } // sent by SAA (EXCON NICHT FEUERN) -static constexpr int EX_POSITION_REPORT_FIRE() { return 2000; } // Only sent by SAA ( Ex-Sq(FS) Stellungsmeldung Feuerstellung) -static constexpr int EX_POSITION_REPORT_WEAPON() { return 2001; } // Only sent by SAA ( Ex-SQ(WS) Stellungsmeldung Waffensystem) -static constexpr int EX_POSITION_REPORT_LOADING_PLACE() { return 2002; } // sent by SAA+EXCON ( EX-SQ(LP)Stellungsmeldung Ladeplatz) -static constexpr int EX_EXPLORATION_RESULTS() { return 5000; } // Only sent by SAA ( Senden Erkundungsergebnisse) -static constexpr int EX_FIRE_FIGHT() { return 19; } // Only sent by EXCON ( Feuerkampf (ohne ADLER Verbund)) -static constexpr int EX_POSITION_CHANGED() { return 20; } // Only sent by EXCON ( Stellungsinformationen (ohne ADLER Verbund)) -static constexpr int EX_GUIDING_LINES() { return 3000; } // Only sent by SAA ( EX-HQ(K) Koordinierungsmassnahmen) -static constexpr int EX_GUIDING_LINES_AND_BOUNDARIES() { return 3001; } // Only sent by SAA ( EX-HQ(G)Fuehrungslinien und Grenzen) -static constexpr int EX_TQ() { return 6013; } // Only sent by SAA EX-TQ Technische Quittierung -static constexpr int EX_AQ() { return 5001; } // Only sent by SAA ( Freitextmeldung) - -static constexpr int EX_FLUGBAHNBERECHNUNG() { return 4000; } // Only sent by SAA ( Flugbahnberechnung) -static constexpr int EX_FLUGBAHNDATEN() { return 4001; } // Only sent by SAA ( Flugbahndaten) - -} // namespace TelegramIds - -// EX-L15 Zeitangabe DTG -struct SAATELEGRAMS_EXPORT Zeitangabe_DTG -{ - int stunden; - int minuten; - int sekunden; - int tag; - int monat; - int jahr; - QString ZVz; - QString ZDS; - QString ZDM; -}; - -/** - * @brief The SAATelegram struct - */ -struct SAATELEGRAMS_EXPORT SAATelegram -{ - virtual QJsonObject toJson() = 0; - - explicit SAATelegram() {} - virtual ~SAATelegram() {} - - public: - template QJsonObject toJsonInternal(); -}; -template <> QJsonObject SAATelegram::toJsonInternal(); -/** - * @brief The EXTelegramBase struct - */ -struct SAATELEGRAMS_EXPORT EXTelegramBase : public SAATelegram -{ - QString typeName; - int typeId; - QString uuid; - QString version; - QString sender; - QString receiver; - QString referenceUuid; - QString timestamp; - - EXTelegramBase(const QString &typeName, int typeId) - : typeName(typeName) - , typeId(typeId) - , uuid(QUuid::createUuid().toString(QUuid::WithoutBraces)) - { - } - - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; -template <> QJsonObject EXTelegramBase::toJsonInternal(); -template <> QJsonObject EXTelegramBase::toJsonInternal(); - -/** - * @brief The EXRegistration struct - */ -struct SAATELEGRAMS_EXPORT EXRegistration : public EXTelegramBase -{ - int partyId; - bool adlerVerbund; - QString szenar; - - EXRegistration() - : EXTelegramBase(JsonKeys::EX_REGISTRATION_REQUEST(), TelegramIds::EX_REGISTRATION_REQUEST()) - { - } - - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject EXRegistration::toJsonInternal(); -// /** -// * @brief The EXRegistrationConfirmation struct -// */ -// struct SAATELEGRAMS_EXPORT EXRegistrationConfirmation : public EXTelegramBase -// { -// //QString Afe; -// AdlerJson::AnBestaetigungsdaten anBestaetigungsdaten; - -// EXRegistrationConfirmation() -// : EXTelegramBase(JsonKeys::EX_REGISTRATION_CONFIRMATION(), TelegramIds::EX_REGISTRATION_CONFIRMATION()) -// {} - -// QJsonObject toJson() override; -// public: -// template -// QJsonObject toJsonInternal(); -// }; - -struct SAATELEGRAMS_EXPORT EXDeregistration : EXTelegramBase -{ - int partyId; - EXDeregistration() - : EXTelegramBase(JsonKeys::EX_DEREGISTRATION_REQUEST(), TelegramIds::EX_DEREGISTRATION_REQUEST()) - { - } - - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; -template <> QJsonObject EXDeregistration::toJsonInternal(); - -struct SAATELEGRAMS_EXPORT EXConnectionTestRequest : public EXTelegramBase -{ - EXConnectionTestRequest() - : EXTelegramBase(JsonKeys::EX_CONNECTION_TEST_REQUEST(), TelegramIds::EX_CONNECTION_TEST_REQUEST()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; -struct SAATELEGRAMS_EXPORT EXConnectionTestReply : public EXTelegramBase -{ - EXConnectionTestReply() - : EXTelegramBase(JsonKeys::EX_CONNECTION_TEST_REPLY(), TelegramIds::EX_CONNECTION_TEST_REPLY()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; -// EX-L40 Szenarstatus -enum class Szenarstatus -{ - Inaktiv, // Es ist keine Szenarausfuehrung aktiv. - Geplant, // Das Szenar wird gestartet. - Aktiv, // Das Szenar wird ausgefuehrt. - Gestoppt, // Das Szenar wurde gestoppt -}; -QString SAATELEGRAMS_EXPORT szenarstatusToStr(Szenarstatus status); -Szenarstatus SAATELEGRAMS_EXPORT strToSzenarstatus(QString status); - -struct SAATELEGRAMS_EXPORT EXStatus : public EXTelegramBase -{ - Szenarstatus status; - - EXStatus() - : EXTelegramBase(JsonKeys::EX_STATUS(), TelegramIds::EX_STATUS()) - { - } - - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; -void SAATELEGRAMS_EXPORT statusFromJson(const QJsonObject &data, EXStatus &eXStatus, bool &bOk); - -///////////////////////// -// Fachliche Meldungen // -///////////////////////// - -template <> QJsonObject EXStatus::toJsonInternal(); - -// ====================================================================================================== -// fachliche Meldungen - -// EX-L13 -struct SAATELEGRAMS_EXPORT Koordinate -{ - double latitude; // -90.0…90.0 - double longitude; // -180.0…180.0 -}; - -// EX-L14 -struct SAATELEGRAMS_EXPORT KoordinateMitHoehe -{ - Koordinate koordinate; // EX-L13 - int hoehe; // EX-L5 -399…9999 Meter -}; - -// EX-L6 Abfeuerungsart -enum class SAATELEGRAMS_EXPORT Abfeuerungsart -{ - A, // TTF - B, // Bereitschaft Melden - F, // Feuern Sofort - T, // TOT - K, // Nach Kommando Feuern -}; - -// EX-L24 HQ(G) Art -enum SAATELEGRAMS_EXPORT Art_L24 -{ - AL, // Line of Departure - ANL, // Handover Line - AO, // Area of Operations - ATRZ, // Artillery Target Report Zone - BAA, // Biological Attack Area - BCA, // Biological Contaminated Area - BDRY, // Boundary - BHA, // Biological Hazard Area - CAA, // Chemical Attack Area - CCA, // Chemical Contaminated Area - CFL, // Coordinated Fire Line - CFZ, // Critical Friendly Zone - CHA, // Chemical Hazard Area - CP, // Checkpoint - CZ, // Censor Zone - EA, // Engagement Area - EZ, // Engagement Zone - FLET, // Forward Line of Enemy Troops - FLOT, // Forward Line of Own Troops - FOAZI, // Fallout Area Zone I - FOAZII, // Fallout Area Zone II - IZ, // Inhibit Zone - LZ, // Locating Zone - MA, // Mined Area - NAI, // Named Area of Interest - OA, // Objective Area - PL, // Phase Line - ROTACA, // ROT A Contaminated Area - ROTAHA, // ROT A Hazard Area - ROTARA, // ROT A Release Area - ROUTE, // Movement Route - RP, // Release Point - SP, // Starting Point - TAI, // Target Area of Interest - FEBA, // Forward Edge of the Battle Area - VZL, // Delay Line - MFLD, // Minefield - ZOF, // Zone of Fire - TAREA, // Target Area - PP, // Passage Point - AMA, // Artillery Maneuver Area - ARA // Artillery Reserved Area -}; - -// EX-L26 Waffensystemtyp -const QMap waffensystemtypMap = { - {QStringLiteral("Pzh2000"), ProjectDataManagement::L26_EffectingSystemType::Pzh2000}, - {QStringLiteral("RRohr"), ProjectDataManagement::L26_EffectingSystemType::RRohr}, - {QStringLiteral("Mars"), ProjectDataManagement::L26_EffectingSystemType::Mars}, -}; - -// EX-L27 Waffensystemkenner -const QMap waffensystemkennerMap = { - {QStringLiteral("A"), ProjectDataManagement::L27_EffectorId::A}, // A - {QStringLiteral("B"), ProjectDataManagement::L27_EffectorId::B}, // B - {QStringLiteral("C"), ProjectDataManagement::L27_EffectorId::C}, // C - {QStringLiteral("D"), ProjectDataManagement::L27_EffectorId::D}, // D - {QStringLiteral("E"), ProjectDataManagement::L27_EffectorId::E}, // E - {QStringLiteral("F"), ProjectDataManagement::L27_EffectorId::F}, // F - {QStringLiteral("G"), ProjectDataManagement::L27_EffectorId::G}, // G - {QStringLiteral("H"), ProjectDataManagement::L27_EffectorId::H}, // H - {QStringLiteral("I"), ProjectDataManagement::L27_EffectorId::I}, // I - {QStringLiteral("J"), ProjectDataManagement::L27_EffectorId::J}, // J - {QStringLiteral("K"), ProjectDataManagement::L27_EffectorId::K}, // K - {QStringLiteral("L"), ProjectDataManagement::L27_EffectorId::L}, // L - {QStringLiteral("M"), ProjectDataManagement::L27_EffectorId::M}, // M - {QStringLiteral("N"), ProjectDataManagement::L27_EffectorId::N}, // N - {QStringLiteral("O"), ProjectDataManagement::L27_EffectorId::O}, // O - {QStringLiteral("P"), ProjectDataManagement::L27_EffectorId::P}, // P - {QStringLiteral("Q"), ProjectDataManagement::L27_EffectorId::Q}, // Q - {QStringLiteral("R"), ProjectDataManagement::L27_EffectorId::R}, // R - {QStringLiteral("S"), ProjectDataManagement::L27_EffectorId::S}, // S - {QStringLiteral("T"), ProjectDataManagement::L27_EffectorId::T}, // T - {QStringLiteral("U"), ProjectDataManagement::L27_EffectorId::U}, // U - {QStringLiteral("V"), ProjectDataManagement::L27_EffectorId::V}, // V - {QStringLiteral("W"), ProjectDataManagement::L27_EffectorId::W}, // W - {QStringLiteral("X"), ProjectDataManagement::L27_EffectorId::X}, // X - {QStringLiteral("Y"), ProjectDataManagement::L27_EffectorId::Y}, // Y - {QStringLiteral("Z"), ProjectDataManagement::L27_EffectorId::Z}, // Z - {QStringLiteral("B1"), ProjectDataManagement::L27_EffectorId::B1}, // B1 - {QStringLiteral("B2"), ProjectDataManagement::L27_EffectorId::B2}, // B2 - {QStringLiteral("B3"), ProjectDataManagement::L27_EffectorId::B3}, // B3 - {QStringLiteral("B4"), ProjectDataManagement::L27_EffectorId::B4}, // B4 - {QStringLiteral("B5"), ProjectDataManagement::L27_EffectorId::B5}, // B5 - {QStringLiteral("B6"), ProjectDataManagement::L27_EffectorId::B6}, // B6 - {QStringLiteral("B7"), ProjectDataManagement::L27_EffectorId::B7}, // B7 - {QStringLiteral("B8"), ProjectDataManagement::L27_EffectorId::B8}, // B8 - {QStringLiteral("C1"), ProjectDataManagement::L27_EffectorId::C1}, // C1 - {QStringLiteral("C2"), ProjectDataManagement::L27_EffectorId::C2}, // C2 - {QStringLiteral("C3"), ProjectDataManagement::L27_EffectorId::C3}, // C3 - {QStringLiteral("C4"), ProjectDataManagement::L27_EffectorId::C4}, // C4 - {QStringLiteral("C5"), ProjectDataManagement::L27_EffectorId::C5}, // C5 - {QStringLiteral("C6"), ProjectDataManagement::L27_EffectorId::C6}, // C6 - {QStringLiteral("C7"), ProjectDataManagement::L27_EffectorId::C7}, // C7 - {QStringLiteral("C8"), ProjectDataManagement::L27_EffectorId::C8}, // C8 - {QStringLiteral("211"), ProjectDataManagement::L27_EffectorId::NO_211}, // 211 Werfer ID - {QStringLiteral("212"), ProjectDataManagement::L27_EffectorId::NO_212}, // 212 Werfer ID - {QStringLiteral("213"), ProjectDataManagement::L27_EffectorId::NO_213}, // 213 Werfer ID - {QStringLiteral("214"), ProjectDataManagement::L27_EffectorId::NO_214}, // 214 Werfer ID - {QStringLiteral("215"), ProjectDataManagement::L27_EffectorId::NO_215}, // 215 Werfer ID - {QStringLiteral("216"), ProjectDataManagement::L27_EffectorId::NO_216}, // 216 Werfer ID - {QStringLiteral("217"), ProjectDataManagement::L27_EffectorId::NO_217}, // 217 Werfer ID - {QStringLiteral("218"), ProjectDataManagement::L27_EffectorId::NO_218}, // 218 Werfer ID - {QStringLiteral("221"), ProjectDataManagement::L27_EffectorId::NO_221}, // 221 Werfer ID - {QStringLiteral("222"), ProjectDataManagement::L27_EffectorId::NO_222}, // 222 Werfer ID - {QStringLiteral("223"), ProjectDataManagement::L27_EffectorId::NO_223}, // 223 Werfer ID - {QStringLiteral("224"), ProjectDataManagement::L27_EffectorId::NO_224}, // 224 Werfer ID - {QStringLiteral("225"), ProjectDataManagement::L27_EffectorId::NO_225}, // 225 Werfer ID - {QStringLiteral("226"), ProjectDataManagement::L27_EffectorId::NO_226}, // 226 Werfer ID - {QStringLiteral("227"), ProjectDataManagement::L27_EffectorId::NO_227}, // 227 Werfer ID - {QStringLiteral("228"), ProjectDataManagement::L27_EffectorId::NO_228}, // 228 Werfer ID - {QStringLiteral("311"), ProjectDataManagement::L27_EffectorId::NO_311}, // 311 Werfer ID - {QStringLiteral("312"), ProjectDataManagement::L27_EffectorId::NO_312}, // 312 Werfer ID - {QStringLiteral("313"), ProjectDataManagement::L27_EffectorId::NO_313}, // 313 Werfer ID - {QStringLiteral("314"), ProjectDataManagement::L27_EffectorId::NO_314}, // 314 Werfer ID - {QStringLiteral("315"), ProjectDataManagement::L27_EffectorId::NO_315}, // 315 Werfer ID - {QStringLiteral("316"), ProjectDataManagement::L27_EffectorId::NO_316}, // 316 Werfer ID - {QStringLiteral("317"), ProjectDataManagement::L27_EffectorId::NO_317}, // 317 Werfer ID - {QStringLiteral("318"), ProjectDataManagement::L27_EffectorId::NO_318}, // 318 Werfer ID - {QStringLiteral("321"), ProjectDataManagement::L27_EffectorId::NO_321}, // 321 Werfer ID - {QStringLiteral("322"), ProjectDataManagement::L27_EffectorId::NO_322}, // 322 Werfer ID - {QStringLiteral("323"), ProjectDataManagement::L27_EffectorId::NO_323}, // 323 Werfer ID - {QStringLiteral("324"), ProjectDataManagement::L27_EffectorId::NO_324}, // 324 Werfer ID - {QStringLiteral("325"), ProjectDataManagement::L27_EffectorId::NO_325}, // 325 Werfer ID - {QStringLiteral("326"), ProjectDataManagement::L27_EffectorId::NO_326}, // 326 Werfer ID - {QStringLiteral("327"), ProjectDataManagement::L27_EffectorId::NO_327}, // 327 Werfer ID - {QStringLiteral("328"), ProjectDataManagement::L27_EffectorId::NO_328}, // 328 Werfer ID - {QStringLiteral("411"), ProjectDataManagement::L27_EffectorId::NO_411}, // 411 Werfer ID - {QStringLiteral("412"), ProjectDataManagement::L27_EffectorId::NO_412}, // 412 Werfer ID - {QStringLiteral("413"), ProjectDataManagement::L27_EffectorId::NO_413}, // 413 Werfer ID - {QStringLiteral("414"), ProjectDataManagement::L27_EffectorId::NO_414}, // 414 Werfer ID - {QStringLiteral("415"), ProjectDataManagement::L27_EffectorId::NO_415}, // 415 Werfer ID - {QStringLiteral("416"), ProjectDataManagement::L27_EffectorId::NO_416}, // 416 Werfer ID - {QStringLiteral("417"), ProjectDataManagement::L27_EffectorId::NO_417}, // 417 Werfer ID - {QStringLiteral("418"), ProjectDataManagement::L27_EffectorId::NO_418}, // 418 Werfer ID - {QStringLiteral("421"), ProjectDataManagement::L27_EffectorId::NO_421}, // 421 Werfer ID - {QStringLiteral("422"), ProjectDataManagement::L27_EffectorId::NO_422}, // 422 Werfer ID - {QStringLiteral("423"), ProjectDataManagement::L27_EffectorId::NO_423}, // 423 Werfer ID - {QStringLiteral("424"), ProjectDataManagement::L27_EffectorId::NO_424}, // 424 Werfer ID - {QStringLiteral("425"), ProjectDataManagement::L27_EffectorId::NO_425}, // 425 Werfer ID - {QStringLiteral("426"), ProjectDataManagement::L27_EffectorId::NO_426}, // 426 Werfer ID - {QStringLiteral("427"), ProjectDataManagement::L27_EffectorId::NO_427}, // 427 Werfer ID - {QStringLiteral("428"), ProjectDataManagement::L27_EffectorId::NO_428}, // 428 Werfer ID - {QStringLiteral("511"), ProjectDataManagement::L27_EffectorId::NO_511}, // 511 Werfer ID - {QStringLiteral("512"), ProjectDataManagement::L27_EffectorId::NO_512}, // 512 Werfer ID - {QStringLiteral("513"), ProjectDataManagement::L27_EffectorId::NO_513}, // 513 Werfer ID - {QStringLiteral("514"), ProjectDataManagement::L27_EffectorId::NO_514}, // 514 Werfer ID - {QStringLiteral("515"), ProjectDataManagement::L27_EffectorId::NO_515}, // 515 Werfer ID - {QStringLiteral("516"), ProjectDataManagement::L27_EffectorId::NO_516}, // 516 Werfer ID - {QStringLiteral("517"), ProjectDataManagement::L27_EffectorId::NO_517}, // 517 Werfer ID - {QStringLiteral("518"), ProjectDataManagement::L27_EffectorId::NO_518}, // 518 Werfer ID - {QStringLiteral("521"), ProjectDataManagement::L27_EffectorId::NO_521}, // 521 Werfer ID - {QStringLiteral("522"), ProjectDataManagement::L27_EffectorId::NO_522}, // 522 Werfer ID - {QStringLiteral("523"), ProjectDataManagement::L27_EffectorId::NO_523}, // 523 Werfer ID - {QStringLiteral("524"), ProjectDataManagement::L27_EffectorId::NO_524}, // 524 Werfer ID - {QStringLiteral("525"), ProjectDataManagement::L27_EffectorId::NO_525}, // 525 Werfer ID - {QStringLiteral("526"), ProjectDataManagement::L27_EffectorId::NO_526}, // 526 Werfer ID - {QStringLiteral("527"), ProjectDataManagement::L27_EffectorId::NO_527}, // 527 Werfer ID - {QStringLiteral("528"), ProjectDataManagement::L27_EffectorId::NO_528} // 528 Werfer ID -}; - -// EX-L32 Fehlerstatus -enum SAATELEGRAMS_EXPORT Status_L32 -{ - INV, // Meldung nicht gültig nach JSON-Schema. - DAT, // Datenkonsistenzfehler. -}; - -// EX-L40 Szenarstatus -// ist bereits definiert -// enum class SAATELEGRAMS_EXPORT Szenarstatus -// { -// Inaktiv, // Es ist keine Szenarausfuehrung aktiv. -// Geplant, // Das Szenar wird gestartet. -// Aktiv, // Das Szenar wird ausgefuehrt. -// Gestoppt, // Das Szenar wurde gestoppt. -// }; - -// EX-L43 Winkelgruppe -enum class SAATELEGRAMS_EXPORT Winkelgruppe -{ - Untere = 0, // Untere Winkelgruppe - Obere = 1 // Obere Winkelgruppe -}; - -// EX-L44 Flugbahnberechnung Fehlercode -enum class SAATELEGRAMS_EXPORT FlugbahnberechnungFehlercode -{ - Ok = 0, // Erfolg - MinimaleEntfernung = 1, // Unterhalb der minimalen Entfernung - MaximaleEntfernung = 2, // Oberhalb der maximalen Entfernung - GeschossKombination = 3, // Ungueltige Geschosskombination - Ungueltig = 4, // Ungueltig -}; - -// EX-L45 Anmeldebestätigung Fehlercode -enum class SAATELEGRAMS_EXPORT L45_AnmeldebestaetigungFehlercode -{ - Ok = 0, // OK - Doppelt = 1, // Doppelte Anmeldung - Mehrfach = 2, // Mehrfachanmeldung - Belegt = 3 // Belegte Anmeldung -}; - -// EX-L3 Einheit -struct SAATELEGRAMS_EXPORT Einheit -{ - QString verein; // EX-L2 - int r; - ProjectDataManagement::L19_Oi oi; // EX-L19 -}; - -// EX-L8 Geschosse -struct SAATELEGRAMS_EXPORT Geschoss -{ - QString geschosssorte; // EX-L9 (table pdm_charge_type) - QString ladung; // EX-L10 (table pdm_load_type) - QString zuender; // EX-L11 (table pdm_igniter_type) - int anzahl{0}; -}; - -// EX-L12 Zieldaten -struct SAATELEGRAMS_EXPORT Zieldaten -{ - int nummer{0}; - ProjectDataManagement::L4_TargetGeometry geometrie; // EX-L4 - KoordinateMitHoehe koordinate; // EX-L14 - KoordinateMitHoehe relativKoordinate; // EX-L14 - int breiteRadius{0}; - int tiefe{0}; - int zielachse{0}; - int zog{0}; - int elemente{0}; - QString typ; // EX-L20 (pdm_target_type) - QString subTyp; // EX-L21 (pdm_target_subtype) -}; - -// EX-L14 -// struct SAATELEGRAMS_EXPORT KoordinateMitHoehe ist weiter oben definiert. - -// EX-L18 Wirkungsbereich -struct SAATELEGRAMS_EXPORT Wirkungsbereich -{ - int grundrichtung; - int links; - int rechts; -}; - -// EX-L23 Feuereinheit -struct SAATELEGRAMS_EXPORT Feuereinheit -{ - QString verein; - int r; -}; - -// EX-L29 Erkundungseinheit -struct SAATELEGRAMS_EXPORT Erkundungseinheit -{ - QString verein; - int r; -}; - -// EX-L30 Erkundungsstellungen -struct SAATELEGRAMS_EXPORT Erkundungsstellungen -{ - QVector waffenplaetze; // EX-L14 - Wirkungsbereich wirkungsbereich; // EX-L18 -}; - -// EX-L36 Feuerkommando Geschosse -struct SAATELEGRAMS_EXPORT FeuerkommandoGeschosse -{ - QString geschosssorte; // EX-L9 (table pdm_charge_type) - QString ladung; // EX-L10 (table pdm_load_type) - QString zuender; // EX-L11 (table pdm_igniter_type) - QString zuenderFunktion; // EX-L41 (table pdm_igniter_function) - double zuenderZeit; // [ms] - int anzahl; - int ladungsNummer; - double intervall; // [s] -}; - -// EX-L35 Flugbahnpunkt -struct SAATELEGRAMS_EXPORT Flugbahnpunkt -{ - double zeit; - double xRelativ; - double yRelativ; - double zRelativ; -}; - -// EX-L37 Flugbahnberechnung Geschosse -struct SAATELEGRAMS_EXPORT FlugbahnberechnungGeschosse -{ - QString geschosssorte; // EX_L9 (table pdm_charge_type) - QString ladung; // EX-L10 (table pdm_load_type) - QString zuender; // EX-L11 (table pdm_igniter_type) - QString zuenderFunktion; // EX-L41 (table pdm_igniter_function) -}; - -// EX-L38 Flugbahndaten Geschosse -struct SAATELEGRAMS_EXPORT FlugbahndatenGeschosse -{ - QString geschosssorte; // EX_L9 (table pdm_charge_type) - QString ladung; // EX-L10 (table pdm_load_type) - int ladungsNummer; - QString zuender; // EX-L11 (table pdm_igniter_type) - QString zuenderFunktion; // EX-L41 (table pdm_igniter_function) - double zuenderZeit; -}; - -// EX-L39 Streuungsdaten -struct SAATELEGRAMS_EXPORT Streuungsdaten -{ - double laengsstreuung; - double seitenstreuung; - double laengsstreuungH; - double seitenstreuungH; -}; - -// EX-L34 Wirkmittel Feuerkommando -struct SAATELEGRAMS_EXPORT WirkmittelFeuerkommando -{ - ProjectDataManagement::L27_EffectorId kenner; // EX-L27 - KoordinateMitHoehe auftreffpunkt; // EX-L14 - double flugzeit; - int gipfelhoehe; - double schussrichtung; - FeuerkommandoGeschosse geschoss; // EX-L36 - QVector flugbahnpunkt; // EX-L35 - Streuungsdaten streuung; // EX-L39 -}; - -// EX-L47 Rakete Trefferpunkt -struct SAATELEGRAMS_EXPORT Treffpunkt -{ - KoordinateMitHoehe koordinate; // EX-L14 - int anzahl; -}; - -// EX-L49 Wirkmittel Feuerkommando Rakete -struct SAATELEGRAMS_EXPORT WirkmittelFeuerkommandoRakete -{ - ProjectDataManagement::L27_EffectorId kenner; // EX-L27 - QVector treffpunkte; - double flugzeit; - int gipfelhoehe; - double schussrichtung; - int fallwinkel; - ProjectDataManagement::L48_TrajectoryRocket anflug; - FeuerkommandoGeschosse geschoss; - ProjectDataManagement::L46_GpsFrequency gps; - int wirkzeit; -}; - -// EX-L33 Feuerkommando -struct SAATELEGRAMS_EXPORT Feuerkommando -{ - QString verein; // EX-L2 - ProjectDataManagement::L26_EffectingSystemType typ; // EX-L26 - QVector wirkmittel; // EX-L34 - QVector wirkmittelRakete; // EX-L49 -}; - -// ====================================================================================================== -// Strukturen und Legenden - -// EX-Wirkfelddaten -struct SAATELEGRAMS_EXPORT Wirkfelddaten -{ - QString feuerkampfReferenz; - Zieldaten zieldaten; - Abfeuerungsart abfeuerungsArt; - ProjectDataManagement::L7_Request forderung; - int dauer; - Feuerkommando feuerkommando; -}; - -// EX-Feuerkampfdaten -struct SAATELEGRAMS_EXPORT Feuerkampfdaten -{ - QString feuerkampfReferenz; // string - QString verein; // EX-L2 - ProjectDataManagement::L27_EffectorId kenner; // EX-L27 -}; - -// EX-Erkundungsdaten -struct SAATELEGRAMS_EXPORT Erkundungsdaten -{ - Erkundungseinheit einheit; // EX-L29 - KoordinateMitHoehe ladeplatz; // EX-L14 - Erkundungsstellungen stellungen; // EX-L30 -}; - -// EX-Zielmeldedaten -struct SAATELEGRAMS_EXPORT Zielmeldedaten -{ - Zieldaten zieldaten; // EX-L12 - Abfeuerungsart abfeuerungsArt; // EX-L6 - ProjectDataManagement::L7_Request forderung; // EX-L7 - int dauer; - QVector feuerkommandos; // 1…n feuerkommando M S S EX-L37 -}; - -// EX-Feuerstellungsdaten -struct SAATELEGRAMS_EXPORT Feuerstellungsdaten -{ - ProjectDataManagement::L26_EffectingSystemType typ; // EX-L26 - ProjectDataManagement::L28_Status status; // EX-L28 - Einheit feuereinheit; // EX-L3 - KoordinateMitHoehe mittelpunkt; // EX-L14 - QVector koordinaten; // EX-L14 - QVector geschosse; // EX-L8 - Wirkungsbereich wirkungsbereich; // EX-L18 -}; - -// EX-Waffensystemdaten -struct SAATELEGRAMS_EXPORT Waffensystemdaten -{ - ProjectDataManagement::L26_EffectingSystemType typ; // EX-L26 - ProjectDataManagement::L27_EffectorId kenner; // EX-L27 - ProjectDataManagement::L28_Status status; // EX-L28 - Einheit einheit; // EX-L3 - QVector geschosse; // EX-L8 - KoordinateMitHoehe koordinate; // EX-L14 - Wirkungsbereich wirkungsbereich; // EX-L18 -}; - -// EX-Ladeplatzdaten -struct SAATELEGRAMS_EXPORT Ladeplatzdaten -{ - Einheit einheit; // EX-L3 - KoordinateMitHoehe koordinate; // EX-L14 - QVector geschosse; // EX-L8 -}; - -// EX-Stellungswechseldaten -struct SAATELEGRAMS_EXPORT Stellungswechseldaten -{ - QString verein; // EX-L2 - int r; - ProjectDataManagement::L19_Oi oi; // EX-L19 -}; - -// EX-Munitionsdaten -struct SAATELEGRAMS_EXPORT Munitionsdaten -{ - QString verein; // EX-L2 -}; - -// EX-LpMunitionsdaten -struct SAATELEGRAMS_EXPORT LpMunitionsdaten -{ - Einheit einheit; // EX-L3 -}; - -// EX-Koordinierungsdaten -struct SAATELEGRAMS_EXPORT Koordinierungsdaten -{ - ProjectDataManagement::L25_KindGuidingLine art; // EX-L25 - QString name; - int meldungsnummer; - QString truppenteil; // EX-L31 - Zeitangabe_DTG ab; // EX-L15 - Zeitangabe_DTG bis; // EX-L15 - QVector koordinaten; // EX-L13 - Koordinate mittelpunkt; // EX-L13 - int radius; - int maxGipfel; // EX-L5 -}; - -// EX-Wirkfelddaten -struct SAATELEGRAMS_EXPORT WirkfeldplanungData -{ - QString feuerkampfReferenz; - Zieldaten zieldaten; // EX-L12 - Abfeuerungsart abfeuerungsArt; // EX-L6 - ProjectDataManagement::L7_Request forderung; // EX-L7 - int dauer; - Feuerkommando feuerkommando; // EX-L33 -}; - -// EX-Fuehrungsdaten -struct SAATELEGRAMS_EXPORT Fuehrungsdaten -{ - Art_L24 art; // EX-L24 - QString name; - int meldungsnummer; - Zeitangabe_DTG ab; // EX-L15 - Zeitangabe_DTG bis; // EX-L15 - QVector koordinaten; // EX-L13 - QString linkerNachbar; - QString rechterNachbar; -}; - -// EX-Anmeldedaten -struct SAATELEGRAMS_EXPORT Anmeldedaten -{ - int partyId; - bool adlerVerbund; - QString szenar; -}; -void SAATELEGRAMS_EXPORT anmeldedatenFromJson(const QJsonObject &data, Anmeldedaten &anmeldedaten, bool &bOk); - -// EX-Anmeldedaten -struct SAATELEGRAMS_EXPORT Abmeldedaten -{ - int partyId; -}; -void SAATELEGRAMS_EXPORT abmeldedatenFromJson(const QJsonObject &data, Abmeldedaten &anmeldedaten, bool &bOk); - -// EX-TechnischeDaten -struct SAATELEGRAMS_EXPORT TechnischeDaten -{ - Status_L32 status; // EX-L32 - QString beschreibung; -}; - -// EX-FreitextDaten -struct SAATELEGRAMS_EXPORT FreitextDaten -{ - QString text; -}; - -// EX-MQ Manuelle Quittung Daten -struct SAATELEGRAMS_EXPORT ManuelleQuittungDaten -{ - QString feuerkampfreferenz; -}; - -// EX-FeuerHaltDaten -struct SAATELEGRAMS_EXPORT FeuerHaltDaten -{ - QString verein; // EX-L2 - ProjectDataManagement::L27_EffectorId kenner; // EX-L27 - ProjectDataManagement::L22_FireHaltCategory kategorie; // EX-L22 - QString feuerkampfReferenz; - int zpNummer; - Koordinate koordinate; // EX-L13 - int radius; - bool entladenSchuss; -}; - -// EX-AnBestaetigungsdaten -struct SAATELEGRAMS_EXPORT AnBestaetigungsdaten -{ - L45_AnmeldebestaetigungFehlercode error; -}; - -// EX-Flugbahnberechnung -struct SAATELEGRAMS_EXPORT FlugBerechnungsDaten -{ - KoordinateMitHoehe standort; - KoordinateMitHoehe zielkoordinate; - ProjectDataManagement::L26_EffectingSystemType waffensystem; - FlugbahnberechnungGeschosse geschoss; // EX-L37 - int sprenghoehe; - Winkelgruppe winkelgruppe; -}; - -// EX-Flugbahndaten -struct SAATELEGRAMS_EXPORT Flugbahndaten -{ - FlugbahnberechnungFehlercode fehlercode; // EX-L44 - KoordinateMitHoehe zielkoordinate; - ProjectDataManagement::L26_EffectingSystemType waffensystem; - int flugzeit; - int gipfelhoehe; - int schussrichtung; - int fallwinkel; - QVector flugbahnpunkt; // EX-L35 - Streuungsdaten streuung; - FlugbahndatenGeschosse geschoss; -}; -// EX-Statusdaten -// struct SAATELEGRAMS_EXPORT Statusdaten -// { -// Szenarstatus status; // EX-L40 - -// }; -// Siehe EXStatus - -// EX-FQ(BA-BB-FK) Wirkfeldplanung (EX_AWES_PLANNING) -void SAATELEGRAMS_EXPORT wirkfeldplanungDataFromJson(const QJsonObject &data, WirkfeldplanungData &wirkfeldplanungData, bool &bOk); -struct SAATELEGRAMS_EXPORT ExAwesPlanning : public EXTelegramBase -{ - WirkfeldplanungData wirkfeldplanungData; - - ExAwesPlanning() - : EXTelegramBase(JsonKeys::EX_AWES_PLANNING(), TelegramIds::EX_AWES_PLANNING()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExAwesPlanning::toJsonInternal(); - -// 7.1.4 EX-FQ(FB) Feuerbereit -void SAATELEGRAMS_EXPORT feuerkampfdatenFromJson(const QJsonObject &data, Feuerkampfdaten &feuerkampfdaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExFeuerbereit : public EXTelegramBase -{ - Feuerkampfdaten feuerkampfdaten; - - ExFeuerbereit() - : EXTelegramBase(JsonKeys::EX_READY_TO_FIRE(), TelegramIds::EX_READY_TO_FIRE()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExFeuerbereit::toJsonInternal(); - -// 7.1.5 EX-FQ(FN) Feuern -struct SAATELEGRAMS_EXPORT ExFeuern : public EXTelegramBase -{ - Feuerkampfdaten feuerkampfdaten; - - ExFeuern() - : EXTelegramBase(JsonKeys::EX_FIRE(), TelegramIds::EX_FIRE()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExFeuern::toJsonInternal(); - -// 7.1.6 EX-FQ(AF) Abgefeuert -struct SAATELEGRAMS_EXPORT ExAbgefeuert : public EXTelegramBase -{ - Feuerkampfdaten feuerkampfdaten; - - ExAbgefeuert() - : EXTelegramBase(JsonKeys::EX_FIRED(), TelegramIds::EX_FIRED()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExFeuern::toJsonInternal(); - -// 7.1.7 EX-FQ(VM) Vollzugsmeldung -struct SAATELEGRAMS_EXPORT ExVollzugsmeldung : public EXTelegramBase -{ - Feuerkampfdaten feuerkampfdaten; - - ExVollzugsmeldung() - : EXTelegramBase(JsonKeys::EX_ENFORCEMENT(), TelegramIds::EX_ENFORCEMENT()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExFeuern::toJsonInternal(); - -// // 7.1.8 EX-Erkundungsanfrage - Anfrage Erkundungsergebnisse -// struct SAATELEGRAMS_EXPORT ExErkundungsanfrage : public EXTelegramBase -// { - -// ExErkundungsanfrage() -// : EXTelegramBase(JsonKeys::EX_REQUEST_EXPLORATION_RESULTS(), TelegramIds::EX_REQUEST_EXPLORATION_RESULTS()) -// {} -// QJsonObject toJson() override; -// public: -// template -// QJsonObject toJsonInternal(); - -// }; - -// template<> -// QJsonObject ExFeuern::toJsonInternal(); - -// 7.1.9 EX-Erkundungsergebnisse - Senden Erkundungsergebnisse -void SAATELEGRAMS_EXPORT erkundungsdatenFromJson(const QJsonObject &data, Erkundungsdaten &erkundungsdaten, bool &bOk); - -struct SAATELEGRAMS_EXPORT ExErkundungsergebnisse : public EXTelegramBase -{ - Erkundungsdaten erkundungsdaten; - - ExErkundungsergebnisse() - : EXTelegramBase(JsonKeys::EX_EXPLORATION_RESULTS(), TelegramIds::EX_EXPLORATION_RESULTS()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExFeuern::toJsonInternal(); - -// 7.1.10 EX-FQ(BA-BB) Feuerkampf -// Feuerkampf enthaelt keine Feuerkampfsdaten, sondern Zielmeldedaten. - -void SAATELEGRAMS_EXPORT zielmeldedatenFromJson(const QJsonObject &data, Zielmeldedaten &zielmeldedaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExFeuerkampf : public EXTelegramBase -{ - Zielmeldedaten zielmeldedaten; // EX-Zielmeldedaten - - ExFeuerkampf() - : EXTelegramBase(JsonKeys::EX_FIRE_FIGHT(), TelegramIds::EX_FIRE_FIGHT()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExFeuern::toJsonInternal(); - -// 7.1.11 EX-FH Feuer HALT - -void SAATELEGRAMS_EXPORT feuerHaltDatenFromJson(const QJsonObject &data, FeuerHaltDaten &feuerHaltDaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExFeuerhalt : public EXTelegramBase -{ - FeuerHaltDaten feuerHaltDaten; // - - ExFeuerhalt() - : EXTelegramBase(JsonKeys::EX_FIRE_HALT(), TelegramIds::EX_FIRE_HALT()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExFeuern::toJsonInternal(); - -// 7.1.12 EX-SQ(FS) Stellungsmeldung Feuerstellung - -void SAATELEGRAMS_EXPORT feuerstellungsdatenFromJson(const QJsonObject &data, Feuerstellungsdaten &feuerstellungsdaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExFeuerstellungFS : public EXTelegramBase -{ - Feuerstellungsdaten feuerstellungsdaten; // - - ExFeuerstellungFS() - : EXTelegramBase(JsonKeys::EX_POSITION_REPORT_FIRE(), TelegramIds::EX_POSITION_REPORT_FIRE()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExFeuerstellungFS::toJsonInternal(); - -// 7.1.13 EX-SQ(WS) Stellungsmeldung Waffensystem - -void SAATELEGRAMS_EXPORT waffensystemdatenFromJson(const QJsonObject &data, Waffensystemdaten &waffensystemdaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExFeuerstellungWS : public EXTelegramBase -{ - Waffensystemdaten waffensystemdaten; // - - ExFeuerstellungWS() - : EXTelegramBase(JsonKeys::EX_POSITION_REPORT_WEAPON(), TelegramIds::EX_POSITION_REPORT_WEAPON()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExFeuerstellungWS::toJsonInternal(); - -// 7.1.14 EX-SQ(LP) Stellungsmeldung Ladeplatz - -void SAATELEGRAMS_EXPORT ladeplatzdatenFromJson(const QJsonObject &data, Ladeplatzdaten &ladeplatzdaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExFeuerstellungLP : public EXTelegramBase -{ - Ladeplatzdaten ladeplatzdaten; // - - ExFeuerstellungLP() - : EXTelegramBase(JsonKeys::EX_POSITION_REPORT_LOADING_PLACE(), TelegramIds::EX_POSITION_REPORT_LOADING_PLACE()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExFeuerstellungLP::toJsonInternal(); - -// 7.1.15 EX-Stellungswechsel - -void SAATELEGRAMS_EXPORT stellungswechseldatenFromJson(const QJsonObject &data, Stellungswechseldaten &stellungswechseldaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExStellungswechsel : public EXTelegramBase -{ - Stellungswechseldaten stellungswechseldaten; // EX-Stellungswechseldaten - - ExStellungswechsel() - : EXTelegramBase(JsonKeys::EX_POSITION_CHANGED(), TelegramIds::EX_POSITION_CHANGED()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExStellungswechsel::toJsonInternal(); - -// 7.1.16 EX-HQ(K) Koordinierungsmassnahmen - -void SAATELEGRAMS_EXPORT koordinierungsdatenFromJson(const QJsonObject &data, Koordinierungsdaten &koordinierungsdaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExHqKoordinierungsmassnahmen : public EXTelegramBase -{ - Koordinierungsdaten koordinierungsdaten; // EX-Koordinierungsdaten - - ExHqKoordinierungsmassnahmen() - : EXTelegramBase(JsonKeys::EX_GUIDING_LINES(), TelegramIds::EX_GUIDING_LINES()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExHqKoordinierungsmassnahmen::toJsonInternal(); - -// 7.1.17 EX-HQ(G) Fuehrungslinien und Grenzen - -void SAATELEGRAMS_EXPORT fuehrungsdatenFromJson(const QJsonObject &data, Fuehrungsdaten &fuehrungsdaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExHqFuehrungslinien : public EXTelegramBase -{ - Fuehrungsdaten fuehrungsdaten; // EX-Fuehrungsdaten - - ExHqFuehrungslinien() - : EXTelegramBase(JsonKeys::EX_GUIDING_LINES_AND_BOUNDARIES(), TelegramIds::EX_GUIDING_LINES_AND_BOUNDARIES()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExHqFuehrungslinien::toJsonInternal(); - -// 7.1.22 EX-TQ Technische Quittierung - -void SAATELEGRAMS_EXPORT technischeDatenFromJson(const QJsonObject &data, TechnischeDaten &technischeDaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExTqTechnischeQuittung : public EXTelegramBase -{ - TechnischeDaten technischeDaten; // EX-TechnischeDaten - - ExTqTechnischeQuittung() - : EXTelegramBase(JsonKeys::EX_TQ(), TelegramIds::EX_TQ()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; - -template <> QJsonObject ExTqTechnischeQuittung::toJsonInternal(); - -// 7.1.23 EX-AQ Freitextmeldung - -void SAATELEGRAMS_EXPORT FreitextDatenFromJson(const QJsonObject &data, FreitextDaten &freitextDaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExAqFreitextmeldung : public EXTelegramBase -{ - FreitextDaten freitextDaten; // EX-FreitextDaten - - ExAqFreitextmeldung() - : EXTelegramBase(JsonKeys::EX_AQ(), TelegramIds::EX_AQ()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; -template <> QJsonObject ExAqFreitextmeldung::toJsonInternal(); - -// 7.2.1 EX-MQ Manuelle Quittung - -void SAATELEGRAMS_EXPORT mqManuelleQuittungDatenFromJson(const QJsonObject &data, ManuelleQuittungDaten &manuelleQuittungDaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExMqManuelleQuittung : public EXTelegramBase -{ - ManuelleQuittungDaten mqManuelleQuittungDaten; - - ExMqManuelleQuittung() - : EXTelegramBase(JsonKeys::EX_MANUAL_REPLY(), TelegramIds::EX_MANUAL_REPLY()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; -template <> QJsonObject ExMqManuelleQuittung::toJsonInternal(); - -// 7.2.5 EX-FQ(nFN) Nicht Feuern - -void SAATELEGRAMS_EXPORT exNichtFeuernFromJson(const QJsonObject &data, Feuerkampfdaten &feuerkampfdaten, bool &bOk); - -struct SAATELEGRAMS_EXPORT exNichtFeuern : public EXTelegramBase -{ - Feuerkampfdaten feuerkampfdaten; - - exNichtFeuern() - : EXTelegramBase(JsonKeys::EX_DONT_FIRE(), TelegramIds::EX_DONT_FIRE()) - { - } - - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; -template <> QJsonObject exNichtFeuern::toJsonInternal(); - -// 7.2.17 EX-Anmeldebestaetigung -void SAATELEGRAMS_EXPORT exAnmeldebestaetigungDatenFromJson(const QJsonObject &data, AnBestaetigungsdaten &anBestaetigungsdaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExAnmeldebestaetigung : public EXTelegramBase -{ - AnBestaetigungsdaten anBestaetigungsdaten; - - ExAnmeldebestaetigung() - : EXTelegramBase(JsonKeys::EX_REGISTRATION_CONFIRMATION(), TelegramIds::EX_REGISTRATION_CONFIRMATION()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; -template <> QJsonObject ExAnmeldebestaetigung::toJsonInternal(); - -// 7.2.22 EX-Flugbahnberechnung - -void SAATELEGRAMS_EXPORT exFlugbahnberechnungDatenFromJson(const QJsonObject &data, FlugBerechnungsDaten &flugBerechnungsDaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExFlugbahnberechnung : public EXTelegramBase -{ - FlugBerechnungsDaten flugbahnberechnungDaten; - - ExFlugbahnberechnung() - : EXTelegramBase(JsonKeys::EX_FLUGBAHNBERECHNUNG(), TelegramIds::EX_FLUGBAHNBERECHNUNG()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; -template <> QJsonObject ExFlugbahnberechnung::toJsonInternal(); - -// 7.2.23 EX-Flugbahndaten - -void SAATELEGRAMS_EXPORT flugbahndatenFromJson(const QJsonObject &data, Flugbahndaten &flugbahndaten, bool &bOk); -struct SAATELEGRAMS_EXPORT ExFlugbahndaten : public EXTelegramBase -{ - Flugbahndaten flugbahndaten; - - ExFlugbahndaten() - : EXTelegramBase(JsonKeys::EX_FLUGBAHNDATEN(), TelegramIds::EX_FLUGBAHNDATEN()) - { - } - QJsonObject toJson() override; - - public: - template QJsonObject toJsonInternal(); -}; -template <> QJsonObject ExFlugbahndaten::toJsonInternal(); - -// -------------------------------------------- -// Enum-Maps: -// -------------------------------------------- - -// EX-L4 Zielgeometrie -const QMap zielgeometrieMap = { - {QStringLiteral("P"), ProjectDataManagement::L4_TargetGeometry::Point}, // Punktziel - {QStringLiteral("F"), ProjectDataManagement::L4_TargetGeometry::Area}, // Flaechenziel - {QStringLiteral("R"), ProjectDataManagement::L4_TargetGeometry::Radial}, // Radialziel - {QStringLiteral("L"), ProjectDataManagement::L4_TargetGeometry::Linear} // Linearziel -}; - -// EX-L6 Abfeuerungsart -const QMap AbfeuerungsartMap = { - {QStringLiteral("A"), Abfeuerungsart::A}, // TTF - {QStringLiteral("B"), Abfeuerungsart::B}, // Bereitschaft Melden - {QStringLiteral("F"), Abfeuerungsart::F}, // Feuern Sofort - {QStringLiteral("T"), Abfeuerungsart::T}, // TOT - {QStringLiteral("K"), Abfeuerungsart::K}, // Nach Kommando Feuern -}; - -// EX-L7 Forderung -const QMap ForderungMap = { - {QStringLiteral("ABR"), ProjectDataManagement::L7_Request::ABR}, // abriegeln - {QStringLiteral("BEK"), ProjectDataManagement::L7_Request::BEK}, // bekaempfen - {QStringLiteral("BEL"), ProjectDataManagement::L7_Request::BEL}, // beleuchten - {QStringLiteral("BLE"), ProjectDataManagement::L7_Request::BLE}, // blenden - {QStringLiteral("NIE"), ProjectDataManagement::L7_Request::NIE}, // niederhalten - {QStringLiteral("SPE"), ProjectDataManagement::L7_Request::SPE}, // sperren - {QStringLiteral("STO"), ProjectDataManagement::L7_Request::STO}, // stoeren - {QStringLiteral("UBW"), ProjectDataManagement::L7_Request::UBW}, // ueberwachen - {QStringLiteral("VER"), ProjectDataManagement::L7_Request::VER}, // vernichten - {QStringLiteral("ZSL"), ProjectDataManagement::L7_Request::ZSL}, // zerschlagen - {QStringLiteral("ZER"), ProjectDataManagement::L7_Request::ZER}, // zerstoeren (Infrastruktur) - {QStringLiteral("BWL"), ProjectDataManagement::L7_Request::BWL}, // bekaempfen mit wenig letaler Munition - {QStringLiteral("MRK"), ProjectDataManagement::L7_Request::MRK}, // markieren - {QStringLiteral("WRN"), ProjectDataManagement::L7_Request::WRN}, // warnen - {QStringLiteral("BLI"), ProjectDataManagement::L7_Request::BLI}, // blenden IR - {QStringLiteral("BEI"), ProjectDataManagement::L7_Request::BEI}, // beleuchten IR - {QStringLiteral("BEW"), ProjectDataManagement::L7_Request::BEW}, // beleuchten mit Wirkung - {QStringLiteral("BEO"), ProjectDataManagement::L7_Request::BEO}, // beobachten - {QStringLiteral("BLW"), ProjectDataManagement::L7_Request::BLW}, // blenden mit Wirkung - {QStringLiteral("MBE"), ProjectDataManagement::L7_Request::MBE}, // markieren mit Leucht - {QStringLiteral("MBL"), ProjectDataManagement::L7_Request::MBL}, // markieren mit Nebel - {QStringLiteral("MIR"), ProjectDataManagement::L7_Request::MIR}, // markieren mit Leucht IR -}; - -// EX-L19 Orts ID -const QMap ortsIdMap = { - {QStringLiteral("Empty"), ProjectDataManagement::L19_Oi::Empty}, // Orts ID nicht gesetzt - {QStringLiteral("F1"), ProjectDataManagement::L19_Oi::F1}, // 1. Feuerstellung - {QStringLiteral("F2"), ProjectDataManagement::L19_Oi::F2}, // 2. Feuerstellung - {QStringLiteral("F3"), ProjectDataManagement::L19_Oi::F3}, // 3. Feuerstellung - {QStringLiteral("F4"), ProjectDataManagement::L19_Oi::F4}, // 4. Feuerstellung - {QStringLiteral("F5"), ProjectDataManagement::L19_Oi::F5}, // 5. Feuerstellung - {QStringLiteral("F6"), ProjectDataManagement::L19_Oi::F6}, // 6. Feuerstellung - {QStringLiteral("F7"), ProjectDataManagement::L19_Oi::F7}, // 7. Feuerstellung - {QStringLiteral("F8"), ProjectDataManagement::L19_Oi::F8}, // 8. Feuerstellung - {QStringLiteral("F9"), ProjectDataManagement::L19_Oi::F9}, // 9. Feuerstellung - {QStringLiteral("L"), ProjectDataManagement::L19_Oi::L} // Ladeplatz -}; - -// EX-20 TargetType -> pdm_target_type -// EX-21 TargetSubType -> pdm_target_subtype - -// EX-L22 Feuer HALT Kategorie -const QMap feuerHaltKategorieMap = { - {QStringLiteral("A"), ProjectDataManagement::L22_FireHaltCategory::A}, // Feuer HALT Allgemein - {QStringLiteral("R"), ProjectDataManagement::L22_FireHaltCategory::R}, // Feuer HALT Referenziert - {QStringLiteral("E"), ProjectDataManagement::L22_FireHaltCategory::E}, // Feuer Einstellen - {QStringLiteral("C"), ProjectDataManagement::L22_FireHaltCategory::C}, // Aufheben Feuer HALT Allgemein - {QStringLiteral("F"), ProjectDataManagement::L22_FireHaltCategory::F}, // Aufheben Feuer HALT Referenziert -}; - -// EX-L24 HQ(G) Art -const QMap art_L24Map = { - {QStringLiteral("AL"), Art_L24::AL}, // Line of Departure - {QStringLiteral("ANL"), Art_L24::ANL}, // Handover Line - {QStringLiteral("AO"), Art_L24::AO}, // Area of Operations - {QStringLiteral("ATRZ"), Art_L24::ATRZ}, // Artillery Target Report Zone - {QStringLiteral("BAA"), Art_L24::BAA}, // Biological Attack Area - {QStringLiteral("BCA"), Art_L24::BCA}, // Biological Contaminated Area - {QStringLiteral("BDRY"), Art_L24::BDRY}, // Boundary - {QStringLiteral("BHA"), Art_L24::BHA}, // Biological Hazard Area - {QStringLiteral("CAA"), Art_L24::CAA}, // Chemical Attack Area - {QStringLiteral("CCA"), Art_L24::CCA}, // Chemical Contaminated Area - {QStringLiteral("CFL"), Art_L24::CFL}, // Coordinated Fire Line - {QStringLiteral("CFZ"), Art_L24::CFZ}, // Critical Friendly Zone - {QStringLiteral("CHA"), Art_L24::CHA}, // Chemical Hazard Area - {QStringLiteral("CP"), Art_L24::CP}, // Checkpoint - {QStringLiteral("CZ"), Art_L24::CZ}, // Censor Zone - {QStringLiteral("EA"), Art_L24::EA}, // Engagement Area - {QStringLiteral("EZ"), Art_L24::EZ}, // Engagement Zone - {QStringLiteral("FLET"), Art_L24::FLET}, // Forward Line of Enemy Troops - {QStringLiteral("FLOT"), Art_L24::FLOT}, // Forward Line of Own Troops - {QStringLiteral("FOAZI"), Art_L24::FOAZI}, // Fallout Area Zone I - {QStringLiteral("FOAZII"), Art_L24::FOAZII}, // Fallout Area Zone II - {QStringLiteral("IZ"), Art_L24::IZ}, // Inhibit Zone - {QStringLiteral("LZ"), Art_L24::LZ}, // Locating Zone - {QStringLiteral("MA"), Art_L24::MA}, // Mined Area - {QStringLiteral("NAI"), Art_L24::NAI}, // Named Area of Interest - {QStringLiteral("OA"), Art_L24::OA}, // Objective Area - {QStringLiteral("PL"), Art_L24::PL}, // Phase Line - {QStringLiteral("ROTACA"), Art_L24::ROTACA}, // ROT A Contaminated Area - {QStringLiteral("ROTAHA"), Art_L24::ROTAHA}, // ROT A Hazard Area - {QStringLiteral("ROTARA"), Art_L24::ROTARA}, // ROT A Release Area - {QStringLiteral("ROUTE"), Art_L24::ROUTE}, // Movement Route - {QStringLiteral("RP"), Art_L24::RP}, // Release Point - {QStringLiteral("SP"), Art_L24::SP}, // Starting Point - {QStringLiteral("TAI"), Art_L24::TAI}, // Target Area of Interest - {QStringLiteral("FEBA"), Art_L24::FEBA}, // Forward Edge of the Battle Area - {QStringLiteral("VZL"), Art_L24::VZL}, // Delay Line - {QStringLiteral("MFLD"), Art_L24::MFLD}, // Minefield - {QStringLiteral("ZOF"), Art_L24::ZOF}, // Zone of Fire - {QStringLiteral("TAREA"), Art_L24::TAREA}, // Target Area - {QStringLiteral("PP"), Art_L24::PP}, // Passage Point - {QStringLiteral("AMA"), Art_L24::AMA}, // Artillery Maneuver Area - {QStringLiteral("ARA"), Art_L24::ARA}, // Artillery Reserved Area -}; - -// EX-L25 HQ(K) Art -const QMap art_L25Map = { - {QStringLiteral("FFA"), ProjectDataManagement::L25_KindGuidingLine::FFA}, - {QStringLiteral("NFA"), ProjectDataManagement::L25_KindGuidingLine::NFA}, - {QStringLiteral("RFA"), ProjectDataManagement::L25_KindGuidingLine::RFA}, - {QStringLiteral("FSCL"), ProjectDataManagement::L25_KindGuidingLine::FSCL}, - {QStringLiteral("RFL"), ProjectDataManagement::L25_KindGuidingLine::RFL}, - {QStringLiteral("FSSL"), ProjectDataManagement::L25_KindGuidingLine::FSSL}, - {QStringLiteral("NFL"), ProjectDataManagement::L25_KindGuidingLine::NFL}, -}; - -// EX-L28 Status -const QMap StatusL28Map = { - - {QStringLiteral("Nicht einsatzbereit"), ProjectDataManagement::L28_Status::NichtEinsatzbereit}, - {QStringLiteral("Einsatzbereit"), ProjectDataManagement::L28_Status::Einsatzbereit}}; - -// EX-L32 Status -const QMap StatusL32Map = { - {QStringLiteral("INV"), Status_L32::INV}, // Meldung nicht gültig nach JSON-Schema. - {QStringLiteral("DAT"), Status_L32::DAT}, // Datenkonsistenzfehler. -}; - -// EX-L40 Szenarstatus -const QMap szenarstatusMap = { - {QStringLiteral("Inaktiv"), Szenarstatus::Inaktiv}, // Es ist keine Szenarausfuehrung aktiv. - {QStringLiteral("Geplant"), Szenarstatus::Geplant}, // Das Szenar wird gestartet. - {QStringLiteral("Aktiv"), Szenarstatus::Aktiv}, // Das Szenar wird ausgefuehrt. - {QStringLiteral("Gestoppt"), Szenarstatus::Gestoppt}, // Das Szenar wurde gestoppt -}; - -// EX-L43 Winkelgruppe -const QMap winkelgruppeMap = { - {QStringLiteral("Untere"), Winkelgruppe::Untere}, - {QStringLiteral("Obere"), Winkelgruppe::Obere}, -}; - -// EX-L44 Flugbahnberechnung Fehlercode -const QMap FehlercodeMap = { - {QStringLiteral("ok"), FlugbahnberechnungFehlercode::Ok}, // Erfolg - {QStringLiteral("MinimaleEntfernung"), FlugbahnberechnungFehlercode::MinimaleEntfernung}, // Unterhalb der minimalen Entfernung - {QStringLiteral("MaximaleEntfernung"), FlugbahnberechnungFehlercode::MaximaleEntfernung}, // Oberhalb der maximalen Entfernung - {QStringLiteral("GeschossKombination"), FlugbahnberechnungFehlercode::GeschossKombination}, // Ungueltige Geschosskombination - {QStringLiteral("Ungueltig"), FlugbahnberechnungFehlercode::Ungueltig}, // Ungueltig -}; - -// EX-L45 Anmeldebestaetigung Fehlercode -const QMap AnmeldebestaetigungFehlercodeMap = { - {QStringLiteral("ok"), L45_AnmeldebestaetigungFehlercode::Ok}, - {QStringLiteral("doppelt"), L45_AnmeldebestaetigungFehlercode::Doppelt}, - {QStringLiteral("mehrfach"), L45_AnmeldebestaetigungFehlercode::Mehrfach}, - {QStringLiteral("belegt"), L45_AnmeldebestaetigungFehlercode::Belegt}, -}; - -// EX-L46 GPS Frequenz -const QMap GpsFrequencyMap - = {{QStringLiteral("L1"), ProjectDataManagement::L46_GpsFrequency::L1}, {QStringLiteral("L1"), ProjectDataManagement::L46_GpsFrequency::L2}}; - -// EX-L48 Rakete Trajektorie -const QMap TrajectoryRocketMap - = {{QStringLiteral("Nominal"), ProjectDataManagement::L48_TrajectoryRocket::Nominal}, - {QStringLiteral("Vertical"), ProjectDataManagement::L48_TrajectoryRocket::Vertical}}; - -// EX-Koordinierungsdaten -void SAATELEGRAMS_EXPORT koordinierungsdatenFromJson(const QJsonObject &data, Koordinierungsdaten &koordinierungsdaten, bool &bOk); -void SAATELEGRAMS_EXPORT koordinierungsdatenToJson(QJsonObject &data, const Koordinierungsdaten &koordinierungsdaten); - -// 7.1.17 EX-HQ(G) Fuehrungslinien und Grenzen -void SAATELEGRAMS_EXPORT fuehrungsdatenFromJson(const QJsonObject &data, Fuehrungsdaten &fuehrungsdaten, bool &bOk); -void SAATELEGRAMS_EXPORT fuehrungsdatenToJson(QJsonObject &data, const Fuehrungsdaten &fuehrungsdaten); - -// EX-FeuerHaltDaten -void SAATELEGRAMS_EXPORT feuerHaltDatenFromJson(const QJsonObject &data, FeuerHaltDaten &feuerHaltDaten, bool &bOk); -void SAATELEGRAMS_EXPORT feuerHaltDatenToJson(QJsonObject &data, const FeuerHaltDaten &feuerHaltDaten); - -// EX-L49 Wirkmittel Feuerkommando Rakete -void SAATELEGRAMS_EXPORT wirkmittelFeuerkommandoRaketeToJson(QJsonObject &data, const WirkmittelFeuerkommandoRakete &wirkmittelFeuerkommandoRakete); -void SAATELEGRAMS_EXPORT wirkmittelFeuerkommandoRaketeFromJson(const QJsonObject &data, WirkmittelFeuerkommandoRakete &wirkmittelFeuerkommandoRakete, bool &bOk); -int SAATELEGRAMS_EXPORT getFeuerkommandoRaketeEffectDurationMsec(const QJsonObject &data); - -} // namespace AdlerJson diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ws_handler.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ws_handler.h deleted file mode 100755 index 8d42ce1ee..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ws_handler.h +++ /dev/null @@ -1,78 +0,0 @@ -#pragma once - -#include "ws_interface.h" -#include "logger.h" - -#include -#include -#include -#include - - -namespace TrainingAreaBase -{ - class WebSocketWrapper; - - class WebSocketHandler : public WebSocketInterface - { - Q_OBJECT - public: - explicit WebSocketHandler(QObject *parent = nullptr); - ~WebSocketHandler(); - - // WSInterface interface - public: - bool init(quint16 listenPort) override; - bool isConnected() const override; - quint16 getPort() const override; - bool sendTelegram(const int typeId, const QJsonObject *data, const int exerciseId) override; - bool sendTelegram(const int wsId, const QJsonObject *data) override; - bool disconnectWs(int wsId) override; - QString getPeerAddress(int wsId) const override; - QUrl getPeerUrl(int wsId) const override; - - int getExerciseId(int wsId) const override; - - //Q_SIGNALS: - // void wsDisconnect(const int wsId); - private Q_SLOTS: - void onNewConnection(); - void onWebSocketDisconnected(); - void onTextMessageReceived(const QByteArray &baJson); - private: - bool sendTelegramInternal(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *data, const QString &type, int exerciseId); - bool sendTelegramInternal(const int wsId, const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *data, const QString &type, const int exerciseId); - int getWSIdFromWS( WebSocketWrapper* wsw ); - private: - QWebSocketServer *m_webSocketServer; - //QVector> m_webSockets; - QMap> m_connections; // key = wsId - - int m_nextWsId = 1; - AdlerJson::LOGGER_T m_logger; - }; - - class WebSocketWrapper : public QObject - { - Q_OBJECT - public: - explicit WebSocketWrapper(QWebSocket *ws); - ~WebSocketWrapper(); - - bool sendTextMessage(const QString &msg); - - void setExerciseId(int exerciseId); - void setWsId(int wsId){ m_wsId = wsId; } - int getWsId(){ return m_wsId; } - int exerciseId() const { return m_exerciseId; } - QWebSocket *webSocket() const { return m_webSocket; } - Q_SIGNALS: - void textMessageReceived(const QByteArray &data); - private Q_SLOTS: - void onTextMessageReceived(const QString &data); - private: - QWebSocket *m_webSocket; - int m_wsId; - int m_exerciseId; - }; -} diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ws_interface.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ws_interface.h deleted file mode 100755 index 4d4bb3370..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AdlerJson/ws_interface.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include - -namespace TrainingAreaBase { - - class WebSocketInterface : public QObject - { - Q_OBJECT - public: - - virtual bool init(quint16 listenPort) = 0; - bool init(const QPair &portRange) - { - for (quint16 currentPort = portRange.first; currentPort != portRange.second; ++currentPort) - { - if (init(currentPort)) - return true; - } - - return init(0); - } - virtual bool isConnected() const = 0; - virtual quint16 getPort() const = 0; - - virtual bool disconnectWs(int wsId) = 0; - - virtual bool sendTelegram(int typeId, const QJsonObject *data, int exerciseId) = 0; - virtual bool sendTelegram(int wsId, const QJsonObject *data) = 0; - virtual QString getPeerAddress(int wsId) const = 0; - virtual QUrl getPeerUrl(int wsId) const = 0; - virtual int getExerciseId(int wsId) const = 0; - Q_SIGNALS: - void recivedTelegram(int wsId, const QJsonObject& telegramData); - void newConnection(int wsId, const QString& address, qint16 port); - void wsDisconnected(int wsId); - - - public: - explicit WebSocketInterface(QObject* parent = nullptr) : QObject(parent){} - virtual ~WebSocketInterface() {} - }; - -} diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_dtc.h deleted file mode 100644 index 87a16e5ca..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_translation.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_translation.h deleted file mode 100644 index 8cc17b835..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_translation.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -// Translation Helper für AlarmManagement Module -// Wrapper für QObject::tr() in nicht-QObject Klassen - -#include -#include "svcalmcommon_export.h" - -namespace AlarmManagement -{ - -SVCALMCOMMON_EXPORT QString tr(const char *sourceText, const char *comment = nullptr, int n = -1); - -} // namespace AlarmManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_types.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_types.h deleted file mode 100644 index 27b090ab5..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AlarmManagement/alm_types.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Typ-Definitionen - -#include -#include "almcommon_export.h" - -namespace AlarmManagement -{ - -// STUB: AlarmConfig - wird durch echten DDS-Typ ersetzt -class ALMCOMMON_EXPORT AlarmConfig -{ -public: - AlarmConfig() = default; - - int eventTypeId() const { return m_eventTypeId; } - void setEventTypeId(int id) { m_eventTypeId = id; } - - bool messageWindow() const { return m_messageWindow; } - void setMessageWindow(bool value) { m_messageWindow = value; } - - bool setMarker() const { return m_setMarker; } - void setSetMarker(bool value) { m_setMarker = value; } - - int participantId() const { return m_participantId; } - void setParticipantId(int id) { m_participantId = id; } - - int id() const { return m_id; } - void setId(int id) { m_id = id; } - - bool global() const { return m_global; } - void setGlobal(bool value) { m_global = value; } - - int vulnerabilityState() const { return m_vulnerabilityState; } - void setVulnerabilityState(int value) { m_vulnerabilityState = value; } - -private: - int m_eventTypeId = 0; - bool m_messageWindow = false; - bool m_setMarker = false; - int m_participantId = 0; - int m_id = 0; - bool m_global = false; - int m_vulnerabilityState = -1; -}; - -} // namespace AlarmManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AreaEffectSimulation/aes_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AreaEffectSimulation/aes_dtc.h deleted file mode 100644 index 5fdb629ea..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AreaEffectSimulation/aes_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AssetManagement/asm_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AssetManagement/asm_dtc.h deleted file mode 100644 index 37a176144..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AssetManagement/asm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/ava_types.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/ava_types.h deleted file mode 100644 index 9829ba79b..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/ava_types.h +++ /dev/null @@ -1,322 +0,0 @@ -/** - * STUB-HEADER: Diese Datei wird normalerweise von AudioVideoManagement generiert - * Für die Migration ohne RTI erstellen wir minimale Typ-Definitionen - */ - -#pragma once - -#include -#include "svcavmcommon_export.h" -#include -#include -#include -#include -#include -#include - -namespace AudioVideoManagement -{ - -class StreamNameMapping; - -enum class AvaVisibility -{ - Visible = 1, - Hidden = 0 -}; - -enum class AvaStreamState -{ - Stop = 0, - Start = 1, - Pause = 2, - NotPossible = 3 -}; - -enum class AvaStreamType -{ - Audio = 1, - Video = 2 -}; - -enum class AvaStreamSource -{ - Interface = 1, //!< live streams - Server = 2, //!< stored streams for playback - Local = 4 -}; - -enum class AvaScriptSource -{ - ServerAudio = 1, - ServerVideo = 2, - LocalAudio = 3, - LocalVideo = 4 -}; - -enum class AvaElokaMode -{ - EndlessLoop = 0, - Once = 1 -}; - -enum class AvaQueryElokaMode -{ - Stop = 0, //!< stop previously requested asynchronous notifications - Poll = 1, //!< poll active ELOKA measures once - Push = 2 //!< request asynchronous notifications from AVS -}; - -enum class AvaSumChannel -{ - Right = 1, - Left = 2 -}; - -enum class AvaRtButtonState -{ - NotAvailable = 0, - None = 1, - Left = 2, - Right = 3, - Both = 4 -}; - -class AVM_COMMON_EXPORT AvaSpeed -{ -public: - explicit AvaSpeed(int speed = 0) : m_speed(speed) {} - - operator int() const { return m_speed; } - - static const QVector &allowedValues() - { - static const QVector values = {0, 25, 50, 75, 100, 125, 150, 175, 200}; - return values; - } - -private: - int m_speed; -}; - - -class AVM_COMMON_EXPORT AvaVolume -{ -public: - explicit AvaVolume(int db = 0) : m_db(db) {} - - operator int() const { return m_db; } - - static AvaVolume min() { return AvaVolume(-50); } - static AvaVolume max() { return AvaVolume(20); } - -private: - int m_db; -}; - - -class AVM_COMMON_EXPORT AvaAudioPrio -{ -public: - explicit AvaAudioPrio(int prio = 0) : m_prio(prio) {} - - operator int() const { return m_prio; } - - static AvaAudioPrio min() { return AvaAudioPrio(0); } - static AvaAudioPrio max() { return AvaAudioPrio(255); } - -private: - int m_prio; -}; - - -/** - * Position (index) of a radio circuit in the AVS_Workstation GUI. - * The index must be in [1, 8]. - */ -class AVM_COMMON_EXPORT AvaRtPos -{ -public: - explicit AvaRtPos(int pos = 1) : m_pos(pos) {} - - operator int() const { return m_pos; } - - static constexpr int min() { return 1; } - static constexpr int max() { return 8; } - static constexpr int count() { return max() - min() + 1; } - -private: - int m_pos; -}; - - -enum class AvaGuiStyle -{ - Light = 0, - Dark -}; - -using AvaDuration = std::chrono::duration; -using AvaTimePoint = std::chrono::time_point; - -/** - * Information about a stream in response to getStreamList. - */ -struct AVM_COMMON_EXPORT AvaStream -{ - /** - * @param nameWithSourceSpec is the AVS-internal stream name plus a source specifier that must match - * the given AvaStreamSource, "(S)" for Server, "(L)" for Local, nothing for Interface. - */ - static AvaStream create(AvaStreamType, AvaStreamSource, const QString &nameWithSourceSpec, StreamNameMapping *streamNameMapping) - { - Q_UNUSED(nameWithSourceSpec) - Q_UNUSED(streamNameMapping) - return AvaStream{}; - } - - /** - * Returns the AVS-internal stream name plus a source specifier at the end - * as described in create(). - */ - QString toString() const { return internalName; } - /** Same as toString() but for a vector of streams. */ - static QStringList toStringList(const QVector &streams) - { - QStringList result; - for (const auto &s : streams) { - result.append(s.toString()); - } - return result; - } - - bool operator==(const AvaStream &other) const - { - return type == other.type && source == other.source && - internalName == other.internalName && displayName == other.displayName; - } - bool operator!=(const AvaStream &other) const { return !(*this == other); } - - AvaStreamType type = AvaStreamType::Audio; - AvaStreamSource source = AvaStreamSource::Interface; - QString internalName; //!< AVS-internal stream name without source specifier - QString displayName; //!< name to be displayed in the GUI without source specifier -}; - -/** - * Information about a stream as contained in StreamInfo in response to chooseStream. - */ -struct AVM_COMMON_EXPORT AvaStreamInfo -{ - AvaTimePoint start; - AvaTimePoint end; - AvaDuration duration; -}; - - -using AvaTimelinePart = QPair; - -class AVM_COMMON_EXPORT AvaTimeline -{ -public: - AvaTimeline() = default; - explicit AvaTimeline(const QVector &parts) : m_parts(parts) {} - - bool isEmpty() const { return m_parts.isEmpty(); } - - const AvaTimePoint &startTime() const - { - static AvaTimePoint dummy; - return m_parts.isEmpty() ? dummy : m_parts.first().first; - } - const AvaTimePoint &endTime() const - { - static AvaTimePoint dummy; - return m_parts.isEmpty() ? dummy : m_parts.last().second; - } - - void clear() { m_parts.clear(); } - void append(const AvaTimelinePart &part) { m_parts.append(part); } - void merge(const AvaTimeline &other) - { - m_parts.append(other.m_parts); - } - - const QVector &parts() const { return m_parts; } - - bool operator==(const AvaTimeline &other) const { return m_parts == other.m_parts; } - bool operator!=(const AvaTimeline &other) const { return m_parts != other.m_parts; } - -private: - void checkConsistency() const {} - - QVector m_parts; -}; - - -/** - * Information about an eloka in response to queryEloka. - */ -struct AVM_COMMON_EXPORT AvaEloka -{ - QString signal; - QString stream; - qint32 priority = 0; - AvaTimePoint time; - - bool operator==(const AvaEloka &other) const - { - return signal == other.signal && stream == other.stream && - priority == other.priority && time == other.time; - } - bool operator!=(const AvaEloka &other) const { return !(*this == other); } -}; - -/** - * Information about a script entry. - */ -struct AVM_COMMON_EXPORT AvaScriptEntry -{ - bool operator==(const AvaScriptEntry &other) const - { - return name == other.name && speed == other.speed && - start == other.start && stop == other.stop && - db == other.db && mute == other.mute && pint == other.pint; - } - bool operator!=(const AvaScriptEntry &other) const { return !(*this == other); } - - QString name; - AvaSpeed speed{100}; - AvaTimePoint start; - AvaTimePoint stop; - AvaVolume db{0}; - bool mute = false; - bool pint = false; -}; - -/** - * Represents the JSON data for a AV script topic in a C++ way. - */ -struct AVM_COMMON_EXPORT AvaTopicData -{ -public: - explicit AvaTopicData(const QJsonObject &data) : m_isAudio(false), isValid(true) - { - Q_UNUSED(data) - } - - bool isAudio() const { return m_isAudio; } - const QString &scriptName() const { return m_scriptName; } - const QVector &streamList() const { return m_streamList; } - - bool isValid = true; - -private: - bool m_isAudio = false; - QString m_scriptName; - QVector m_streamList; -}; - -} // namespace AudioVideoManagement - -Q_DECLARE_METATYPE(AudioVideoManagement::AvaStream) \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_dtc.h deleted file mode 100644 index 4fdd1874c..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_export.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_export.h deleted file mode 100644 index 0054fbea3..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_export.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Stub export header for non-RTI builds - * When BUILD_RTI=OFF, svcAvmCommon library is not built - * This stub allows dependent code to compile - */ -#pragma once - -#include - -// Stub export macros for non-RTI builds -#define AVM_COMMON_EXPORT -#define AVM_CLIENT_EXPORT -#define AVM_SERVER_EXPORT \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_translation.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_translation.h deleted file mode 100644 index 942a90f02..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/avm_translation.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file avm_translation.h - * @brief Translation functions for AudioVideoManagement enums - * - * This file provides toString() functions for AVM enums used in CNR frequency planning. - */ - -#ifndef AVM_TRANSLATION_H -#define AVM_TRANSLATION_H - -#include -#include "avm_enums.hpp" - -namespace AudioVideoManagement { - -// RcOperatingMode toString - using actual enum values from stub -inline QString toString(RcOperatingMode mode) -{ - switch (mode.underlying()) { - case RcOperatingMode::FixedFreqEncNone: return QStringLiteral("FixedFreqEncNone"); - case RcOperatingMode::FixedFreqEncHwKr: return QStringLiteral("FixedFreqEncHwKr"); - case RcOperatingMode::FixedFreqEncHwKrKl: return QStringLiteral("FixedFreqEncHwKrKl"); - case RcOperatingMode::AkwEncNone: return QStringLiteral("AkwEncNone"); - case RcOperatingMode::AkwEncEccm: return QStringLiteral("AkwEncEccm"); - case RcOperatingMode::SIMPLEX: return QStringLiteral("SIMPLEX"); - case RcOperatingMode::HALFDUPLEX: return QStringLiteral("HALFDUPLEX"); - case RcOperatingMode::DUPLEX: return QStringLiteral("DUPLEX"); - default: return QStringLiteral("Unknown"); - } -} - -// FrequencyBand toString -inline QString toString(FrequencyBand band) -{ - switch (band.underlying()) { - case FrequencyBand::Undefined: return QStringLiteral("Undefined"); - case FrequencyBand::HF: return QStringLiteral("HF"); - case FrequencyBand::VHF: return QStringLiteral("VHF"); - case FrequencyBand::UHF: return QStringLiteral("UHF"); - case FrequencyBand::REL: return QStringLiteral("REL"); - default: return QStringLiteral("Unknown"); - } -} - -// ModulationType toString -inline QString toString(ModulationType mod) -{ - switch (mod.underlying()) { - case ModulationType::AM: return QStringLiteral("AM"); - case ModulationType::FM: return QStringLiteral("FM"); - default: return QStringLiteral("Unknown"); - } -} - -// ChannelSpacingHF toString -inline QString toString(ChannelSpacingHF spacing) -{ - switch (spacing.underlying()) { - case ChannelSpacingHF::CS_100_Hz: return QStringLiteral("CS_100_Hz"); - default: return QStringLiteral("Unknown"); - } -} - -// ChannelSpacing toString -inline QString toString(ChannelSpacing spacing) -{ - switch (spacing.underlying()) { - case ChannelSpacing::CS_25_00_kHz: return QStringLiteral("CS_25_00_kHz"); - case ChannelSpacing::CS_12_50_kHz: return QStringLiteral("CS_12_50_kHz"); - case ChannelSpacing::CS_8_33_kHz: return QStringLiteral("CS_8_33_kHz"); - default: return QStringLiteral("Unknown"); - } -} - -} // namespace AudioVideoManagement - -#endif // AVM_TRANSLATION_H \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/svcavmcommon_export.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/svcavmcommon_export.h deleted file mode 100644 index 0602f3ee7..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/AudioVideoManagement/svcavmcommon_export.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef SVCAVMCOMMON_EXPORT_H -#define SVCAVMCOMMON_EXPORT_H - -// Stub export header for non-RTI builds -// When BUILD_RTI=OFF, svcAvmCommon library is not built -// This stub allows dependent code to compile - -// Map to the actual macro names used in avm_export.h -#define AVM_COMMON_EXPORT -#define AVM_CLIENT_EXPORT -#define AVM_SERVER_EXPORT - -#endif /* SVCAVMCOMMON_EXPORT_H */ diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Buildings/bld_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Buildings/bld_dtc.h deleted file mode 100644 index 5b8a657b7..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Buildings/bld_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Buildings/bld_enums.hpp.stub b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Buildings/bld_enums.hpp.stub deleted file mode 100644 index b43d8f43d..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Buildings/bld_enums.hpp.stub +++ /dev/null @@ -1,30 +0,0 @@ -// Stub file for bld_enums.hpp - used when BUILD_RTI=OFF -#ifndef BLD_ENUMS_HPP -#define BLD_ENUMS_HPP - -#include - -namespace Buildings { - -enum class BuildingType : std::int32_t { - Residential = 0, - Commercial = 1, - Industrial = 2 -}; - -enum class BuildingStatus : std::int32_t { - Active = 0, - Inactive = 1, - UnderConstruction = 2 -}; - -struct BuildingInfo { - int id = 0; - double x = 0.0; - double y = 0.0; - double z = 0.0; -}; - -} // namespace Buildings - -#endif // BLD_ENUMS_HPP \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/CentralEffectSimulation/ces_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/CentralEffectSimulation/ces_dtc.h deleted file mode 100644 index 5401e3922..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/CentralEffectSimulation/ces_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/CodificationManagement/cod_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/CodificationManagement/cod_dtc.h deleted file mode 100644 index 456082327..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/CodificationManagement/cod_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ComponentMonitor/cmo_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ComponentMonitor/cmo_dtc.h deleted file mode 100644 index 525aa9a90..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ComponentMonitor/cmo_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core.hpp b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core.hpp deleted file mode 100644 index 6aace4c35..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core.hpp +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @file core.hpp - * @brief Core DDS Sammel-Header - * - * Beinhaltet alle Core-Typen für DDS-Integration. - * - * STUB: Diese Datei wird normalerweise von DDS generiert. - * Für die Qt6-Migration erstellen wir einen minimalen Stub. - */ - -#pragma once - -#include -#include -#include -#include - -namespace Core -{ -/** - * @brief GeoPosition - Stub für DDS GeoPosition - * - * Einfache Struktur für geographische Positionen. - */ -struct GeoPosition -{ - double longitude = 0.0; - double latitude = 0.0; - double altitude = 0.0; - - GeoPosition() = default; - - GeoPosition(double lon, double lat, double z) - : longitude(lon) - , latitude(lat) - , altitude(z) - { - } - - double lon() const { return longitude; } - double lat() const { return latitude; } - double z() const { return altitude; } - - void lon(double lon) { longitude = lon; } - void lat(double lat) { latitude = lat; } - void z(double z) { altitude = z; } - - void setLon(double lon) { longitude = lon; } - void setLat(double lat) { latitude = lat; } - void setZ(double z) { altitude = z; } -}; - -/** - * @brief GeoPosition2D - 2D GeoPosition (ohne Altitude) - * - * Wird für Koordinaten ohne Höheninformation verwendet. - * Implizite Konversion von GeoPosition ermöglicht Downcast. - */ -struct GeoPosition2D -{ - double longitude = 0.0; - double latitude = 0.0; - - GeoPosition2D() = default; - - GeoPosition2D(double lon, double lat) - : longitude(lon) - , latitude(lat) - { - } - - // Implizite Konversion von GeoPosition (Downcast ignoriert altitude) - GeoPosition2D(const GeoPosition& pos) - : longitude(pos.lon()) - , latitude(pos.lat()) - { - } - - double lon() const { return longitude; } - double lat() const { return latitude; } - - void lon(double lon) { longitude = lon; } - void lat(double lat) { latitude = lat; } - - void setLon(double lon) { longitude = lon; } - void setLat(double lat) { latitude = lat; } -}; - -/** - * @brief ostream operator für GeoPosition (Debug/Logging) - */ -inline std::ostream& operator<<(std::ostream& os, const GeoPosition& pos) -{ - os << "GeoPosition(lon=" << pos.lon() << ", lat=" << pos.lat() << ", alt=" << pos.z() << ")"; - return os; -} - -/** - * @brief ostream operator für GeoPosition2D (Debug/Logging) - */ -inline std::ostream& operator<<(std::ostream& os, const GeoPosition2D& pos) -{ - os << "GeoPosition2D(lon=" << pos.lon() << ", lat=" << pos.lat() << ")"; - return os; -} - -} // namespace Core \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core_dtc.h deleted file mode 100644 index 6d54fd308..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core_types.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core_types.h deleted file mode 100644 index db5b76f4e..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Core/core_types.h +++ /dev/null @@ -1,144 +0,0 @@ -/** - * @file core_types.h - * @brief Core DDS-Typen Stubs - * - * Minimalistische Definitionen für DDS-generierte Core-Typen. - */ - -#pragma once - -#include -#include -#include - -namespace Core -{ - -/** - * @brief FunctionReplyObject - DDS-Stub für Function Reply Handling - * - * Simuliert QString::arg() Verhalten und sammelt Argumente. - */ -class FunctionReplyObject -{ -public: - explicit FunctionReplyObject(int id = -1, const char *str = nullptr) - : m_str(str ? str : std::string()) - , m_id(id) - {} - - explicit FunctionReplyObject(const char *str) - : m_str(str ? str : std::string()) - {} - - explicit FunctionReplyObject(int id, const std::string &errStr, const std::vector &errArgs) - : m_str(errStr) - , m_args(errArgs) - , m_id(id) - {} - - explicit FunctionReplyObject(int id, std::string &&errStr, std::vector &&errArgs) - : m_str(std::move(errStr)) - , m_args(std::move(errArgs)) - , m_id(id) - {} - - explicit FunctionReplyObject(int id, const std::string &errStr, const std::vector &errArgs, const std::string &additionalInfo) - : m_str(errStr) - , m_additionalInfo(additionalInfo) - , m_args(errArgs) - , m_id(id) - {} - - explicit FunctionReplyObject(int id, std::string &&errStr, std::vector &&errArgs, std::string &&additionalInfo) - : m_str(std::move(errStr)) - , m_additionalInfo(std::move(additionalInfo)) - , m_args(std::move(errArgs)) - , m_id(id) - {} - - ~FunctionReplyObject() = default; - - // simulate QString::arg() behaviour - FunctionReplyObject &arg(qint64 val) { (void)val; return *this; } - FunctionReplyObject &arg(const std::string &str) { m_args.push_back(str); return *this; } - FunctionReplyObject &arg(const QString &str) { m_args.push_back(str.toStdString()); return *this; } - - /** - * @brief true if the object contains an error description - */ - bool error() const { return !m_str.empty(); } - void setId(int id) { m_id = id; } - FunctionReplyObject &setStr(const char *str) { m_str = str; return *this; } - FunctionReplyObject &setAdditionalInfo(const char *additionalInfo) { m_additionalInfo = additionalInfo; return *this; } - - int id() const { return m_id; } - std::string str() const { return m_str; } - std::string additionalInfo() const { return m_additionalInfo; } - - std::vector args() const { return m_args; } - - /** - * @brief convert the error string and arguments to an untranslated std::string - */ - std::string operator()() const { return m_str; } - - /** - * @brief convert and translate the error string and arguments to a translated QString - */ - QString translated() const { return QString::fromStdString(m_str); } - - int64_t uniqueId() const { return m_uniqueId; } - void setUniqueId(int64_t uniqueId) { m_uniqueId = uniqueId; } - -private: - std::string m_str; - std::string m_additionalInfo; - std::vector m_args; - int64_t m_uniqueId = 0; - int m_id = -1; -}; - -/** - * @brief FunctionReply - Stub für DDS Function Reply bei BUILD_RTI=OFF - * - * Minimaler Stub der API-Kompatibilität für request_helper.h bietet. - */ -class FunctionReply -{ -public: - FunctionReply() = default; - - // Konstruktor für Kompatibilität mit FunctionReplyObject - FunctionReply(int id, const std::string& str, const std::vector& args = {}, const std::string& additionalInfo = {}) - : m_str(str) - , m_args(args) - , m_additionalInfo(additionalInfo) - , m_id(id) - {} - - ~FunctionReply() = default; - - int id() const { return m_id; } - void setId(int id) { m_id = id; } - - std::string str() const { return m_str; } - void setStr(const std::string& str) { m_str = str; } - - bool error() const { return !m_str.empty(); } - - int64_t uniqueId() const { return m_uniqueId; } - void setUniqueId(int64_t uniqueId) { m_uniqueId = uniqueId; } - - std::vector args() const { return m_args; } - std::string additionalInfo() const { return m_additionalInfo; } - -private: - std::string m_str; - std::vector m_args; - std::string m_additionalInfo; - int m_id = -1; - int64_t m_uniqueId = 0; -}; - -} // namespace Core \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/DTC/generic_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/DTC/generic_dtc.h deleted file mode 100644 index 63eeb6ff3..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/DTC/generic_dtc.h +++ /dev/null @@ -1,130 +0,0 @@ - - -#pragma once - -// Include Qt headers FIRST to prevent namespace pollution when RTI DDS headers include Qt -#include -#include -#include -#include -#include - -namespace NGLLogger -{ -class INGLLogger; -} - -namespace DTC -{ -class SubscriberListener; - -template class GenericDtcSC -{ - public: - using DataReaderObject = DRO_OBJECT; - using SubscriberCallback = SC; - using TopicType = typename DRO_OBJECT::TopicType; - - GenericDtcSC() = default; - virtual ~GenericDtcSC() = default; - - virtual bool setSubscriberCallback(const SubscriberCallback& subscriberCallback) = 0; - virtual dds::sub::LoanedSamples readAlive() const = 0; - virtual bool readAlive(TopicType& data) = 0; - virtual dds::sub::LoanedSamples takeAlive() const = 0; - virtual bool takeAlive(TopicType& data) = 0; - virtual dds::sub::LoanedSamples takeDisposed() const = 0; - virtual bool takeDisposed(TopicType& data) = 0; - virtual bool hasSamples() const = 0; - virtual DataReaderObject* dataReader() const = 0; - virtual bool waitForHistoricalData(int timeoutMSec) = 0; -}; - -template -class GenericDtc - : public GenericDtcSC> -{ - public: - using BaseClass = GenericDtcSC>; - using TopicType = typename BaseClass::TopicType; - - // Explicitly expose base class methods for accessibility through smart pointers - using BaseClass::readAlive; - using BaseClass::takeAlive; - using BaseClass::takeDisposed; - using BaseClass::SubscriberCallback; - bool setSubscriberCallback(const typename BaseClass::SubscriberCallback& callback) override { return BaseClass::setSubscriberCallback(callback); } - bool readAlive(TopicType& data) { return BaseClass::readAlive(data); } - bool takeAlive(TopicType& data) { return BaseClass::takeAlive(data); } - bool takeDisposed(TopicType& data) { return BaseClass::takeDisposed(data); } - bool hasSamples() const { return BaseClass::hasSamples(); } - std::shared_ptr dataReader() { return BaseClass::dataReader(); } - bool waitForHistoricalData(int timeoutMSec) { return BaseClass::waitForHistoricalData(timeoutMSec); } -}; - -template -class GenericDtcSampleInfo - : public GenericDtcSC> -{ - public: - using BaseClass = GenericDtcSC>; - using TopicType = typename BaseClass::TopicType; - - // Explicitly expose base class methods for accessibility through smart pointers - using BaseClass::readAlive; - using BaseClass::takeAlive; - using BaseClass::takeDisposed; - void setSubscriberCallback(std::function callback) { BaseClass::setSubscriberCallback(callback); } - bool readAlive(TopicType& data) { return BaseClass::readAlive(data); } - bool takeAlive(TopicType& data) { return BaseClass::takeAlive(data); } - bool takeDisposed(TopicType& data) { return BaseClass::takeDisposed(data); } - bool hasSamples() const { return BaseClass::hasSamples(); } - std::shared_ptr dataReader() { return BaseClass::dataReader(); } - bool waitForHistoricalData(int timeoutMSec) { return BaseClass::waitForHistoricalData(timeoutMSec); } -}; - -template -class Ddtc - : public GenericDtcSC< - DRO_OBJECT, std::function> -{ - public: - using BaseClass = GenericDtcSC>; - using TopicType = typename BaseClass::TopicType; - - // Explicitly expose base class methods for accessibility through smart pointers - using BaseClass::readAlive; - using BaseClass::takeAlive; - using BaseClass::takeDisposed; - void setSubscriberCallback(std::function callback) { BaseClass::setSubscriberCallback(callback); } - bool readAlive(TopicType& data) { return BaseClass::readAlive(data); } - bool takeAlive(TopicType& data) { return BaseClass::takeAlive(data); } - bool takeDisposed(TopicType& data) { return BaseClass::takeDisposed(data); } - bool hasSamples() const { return BaseClass::hasSamples(); } - std::shared_ptr dataReader() { return BaseClass::dataReader(); } - bool waitForHistoricalData(int timeoutMSec) { return BaseClass::waitForHistoricalData(timeoutMSec); } -}; - -template -class DdtcSampleInfo - : public GenericDtcSC> -{ - public: - using BaseClass = GenericDtcSC>; - using TopicType = typename BaseClass::TopicType; - - // Explicitly expose base class methods for accessibility through smart pointers - using BaseClass::readAlive; - using BaseClass::takeAlive; - using BaseClass::takeDisposed; - void setSubscriberCallback(std::function callback) { BaseClass::setSubscriberCallback(callback); } - bool readAlive(TopicType& data) { return BaseClass::readAlive(data); } - bool takeAlive(TopicType& data) { return BaseClass::takeAlive(data); } - bool takeDisposed(TopicType& data) { return BaseClass::takeDisposed(data); } - bool hasSamples() const { return BaseClass::hasSamples(); } - std::shared_ptr dataReader() { return BaseClass::dataReader(); } - bool waitForHistoricalData(int timeoutMSec) { return BaseClass::waitForHistoricalData(timeoutMSec); } -}; -} // namespace DTC diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/DTC/generic_dtc_impl.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/DTC/generic_dtc_impl.h deleted file mode 100755 index 60b14a683..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/DTC/generic_dtc_impl.h +++ /dev/null @@ -1,357 +0,0 @@ -/** - * @RDE_HEADER@ - * DataTopicClient (DTC) - Generic - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#pragma once - -// Include Qt headers FIRST to prevent namespace pollution when RTI DDS headers include Qt -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "generic_dtc.h" - - -namespace DDSGeneric -{ -class DynamicDataReader; -} // namespace DDSGeneric - -namespace DTC -{ - -template -class GenericDtcImplSubscriberTemplate : public DDSGeneric::SubscriberListenerCallback, public SuperClass -{ -public: - using DataReaderObject = typename SuperClass::DataReaderObject; - using SubscriberCallback = typename SuperClass::SubscriberCallback; - using TopicTypeRead = typename DataReaderObject::TopicType; - using TopicTypeSubscribe = typename DataReaderObject::TopicType; - using DataReader = typename DataReaderObject::DataReader; - - GenericDtcImplSubscriberTemplate(const dds::domain::DomainParticipant &domainParticipant, - const dds::sub::Subscriber &ddsSubscriber, - DDSGeneric::SubscriberListener *subscriberListener, - const std::string &topicName = DDS::Helper::getShortTopicName(DDS::topic_type_name::value())) - : m_subscriberListener(subscriberListener) - , m_dataReaderObject(new DataReaderObject) - , m_subscriberCallback(nullptr) - , m_writerState(0) - , m_logger(DDS::getLogger(DDS::topic_type_name::value(), DDS::DataType::DATA_TOPIC_CLIENT)) - { - createInternal(m_dataReaderObject->create(domainParticipant, ddsSubscriber, topicName)); - } - - GenericDtcImplSubscriberTemplate(const dds::domain::DomainParticipant &domainParticipant, - const dds::sub::Subscriber &ddsSubscriber, - DDSGeneric::SubscriberListener *subscriberListener, - const dds::topic::Filter &filter, - const std::string &topicName) - : m_subscriberListener(subscriberListener) - , m_dataReaderObject(new DataReaderObject) - , m_subscriberCallback(nullptr) - , m_writerState(0) - , m_logger(DDS::getLogger(DDS::topic_type_name::value(), DDS::DataType::DATA_TOPIC_CLIENT)) - { - createInternal(m_dataReaderObject->create(domainParticipant, ddsSubscriber, topicName, filter)); - } - - GenericDtcImplSubscriberTemplate(const dds::domain::DomainParticipant &domainParticipant, - const dds::sub::Subscriber &ddsSubscriber, - DDSGeneric::SubscriberListener *subscriberListener, - const dds::core::xtypes::StructType &structType, - const std::string &topicName) - : m_subscriberListener(subscriberListener) - , m_dataReaderObject(new DataReaderObject) - , m_subscriberCallback(nullptr) - , m_logger(DDS::getLogger(DDS::topic_type_name::value(), DDS::DataType::DATA_TOPIC_CLIENT)) - { - createInternal(m_dataReaderObject->create(domainParticipant, ddsSubscriber, topicName, structType)); - } - - ~GenericDtcImplSubscriberTemplate() - { - if (m_dataReaderObject && m_subscriberCallback) - m_subscriberListener->removeCallback(m_dataReaderObject->getDataReader(), this); - delete m_dataReaderObject; - } - - bool setSubscriberCallback(const SubscriberCallback &subscriberCallback) override final - { - if (m_subscriberCallback) - { - WARNING_LOG(m_logger) << "Can not set subscriber callback - already set ..."; - return false; - } - if (!m_subscriberListener) - { - WARNING_LOG(m_logger) << "Can not set subscriber callback - no subscriber listener ..."; - return false; - } - - m_subscriberCallback = subscriberCallback; - - if (!m_dataReaderObject) - { - WARNING_LOG(m_logger) << "Can not set subscriber callback - no data reader object ..."; - return false; - } - - m_dataReaderObject->setHaveSubscriberCallback(m_subscriberCallback != nullptr); - - return true; - } - - dds::sub::LoanedSamples readAlive() const override final - { - if (!m_dataReaderObject) - return dds::sub::LoanedSamples(); - - bool bSeenUnreadSamples = false; - auto ret = m_dataReaderObject->readAlive(bSeenUnreadSamples); - if (bSeenUnreadSamples) - QTimer::singleShot(0, this, &GenericDtcImplSubscriberTemplate::unreadSamplesDuringRead); - - return ret; - } - - bool readAlive(TopicTypeRead& data) override final - { - auto samples = readAlive(); - if (samples.length() > 0) - { - data = samples[0].data(); - return true; - } - return false; - } - - dds::sub::LoanedSamples takeAlive() const override final - { - if (!m_dataReaderObject) - return dds::sub::LoanedSamples(); - - bool bSeenUnreadSamples = false; - auto ret = m_dataReaderObject->takeAlive(bSeenUnreadSamples); - if (bSeenUnreadSamples) - QTimer::singleShot(0, this, &GenericDtcImplSubscriberTemplate::unreadSamplesDuringRead); - - return ret; - } - - bool takeAlive(TopicTypeRead& data) override final - { - auto samples = takeAlive(); - if (samples.length() > 0) - { - data = samples[0].data(); - return true; - } - return false; - } - - dds::sub::LoanedSamples takeDisposed() const override final - { - if (!m_dataReaderObject) - return dds::sub::LoanedSamples(); - - return m_dataReaderObject->takeDisposed(); - } - - bool takeDisposed(TopicTypeRead& data) override final - { - auto samples = takeDisposed(); - if (samples.length() > 0) - { - data = samples[0].data(); - return true; - } - return false; - } - - bool hasSamples() const override final - { - if (!m_dataReaderObject) - return false; - - return m_dataReaderObject->hasSamples(); - } - - DataReaderObject *dataReader() const override final - { - return m_dataReaderObject; - } - - bool waitForHistoricalData(int timeoutMSec) override - { - if (m_dataReaderObject == nullptr || - m_dataReaderObject->getDataReader() == nullptr) - return false; - - const bool bWaitForever = (timeoutMSec < 0); - auto dr = m_dataReaderObject->getDataReader(); - try - { - if (dr.subscription_matched_status().current_count() == 0) - { - dds::core::cond::WaitSet ws; - auto cond = dds::core::cond::StatusCondition(dr); - cond.enabled_statuses(dds::core::status::StatusMask::subscription_matched()); - ws.attach_condition(cond); - const dds::core::Duration waitTimeout(bWaitForever ? dds::core::Duration::infinite() : dds::core::Duration::from_millisecs(timeoutMSec)); - const dds::core::cond::WaitSet::ConditionSeq seq(ws.wait(waitTimeout)); - // empty sequence -> timeout - if (seq.empty()) - return false; - } - dr.wait_for_historical_data(dds::core::Duration(1)); - } - catch (const dds::core::Exception &) - { - // timeout - return false; - } - return true; - } - -protected: - void unreadSamplesDuringRead() - { - droDataAvailable(DDS::topic_type_name::value(), m_dataReaderObject->topicName()); - } - - void droDataAvailable(const std::string &topicType, const std::string &topicName) override final - { - Q_UNUSED(topicType); - if (m_writerState.testAndSetRelaxed(1, 0)) - { - DEBUG_LOG(m_logger) << "Recreate Reader for topic " << topicName - << ", type name " << DDS::topic_type_name::value(); - if (m_subscriberListener) - m_subscriberListener->removeCallback(m_dataReaderObject->getDataReader(), this); - m_dataReaderObject->recreateReader(); - if (m_subscriberListener) - m_subscriberListener->addCallback(m_dataReaderObject->getDataReader(), this); - } - - DEBUG_LOG(m_logger) << "IN droDataAvailable(), topic name: " << topicName - << ", type name " << DDS::topic_type_name::value() - << ", this: " << this - << ", m_dataReaderObject: " << m_dataReaderObject - << ", hasSamples: " << (m_dataReaderObject ? m_dataReaderObject->hasSamples() : -1); - - if (m_subscriberListener) - m_subscriberListener->enableCallback(m_dataReaderObject->getDataReader(), this); - - if (!m_dataReaderObject || !m_subscriberCallback) - return; - - m_dataReaderObject->read(m_subscriberCallback); - } - - void noWriterAnymore(const std::string &topicType, const std::string &topicName) override - { - Q_UNUSED(topicType); - Q_UNUSED(topicName); - m_writerState = -1; - } - - void writerAvailable(const std::string &topicType, const std::string &topicName) override - { - Q_UNUSED(topicType); - Q_UNUSED(topicName); - m_writerState.testAndSetRelaxed(-1, 1); - } - - bool createInternal(bool droInitOk) - { - if (!droInitOk) - { - ERROR_LOG(m_logger) << "Error initializing DRO for type " << DDS::topic_type_name::value(); - delete m_dataReaderObject; - m_dataReaderObject = nullptr; - return false; - } - - if (m_subscriberListener) - { - DEBUG_LOG(m_logger) << "subscriberListener exists, adding type " - << DDS::topic_type_name::value(); - m_subscriberListener->addCallback(m_dataReaderObject->getDataReader(), this); - } - else - { - DEBUG_LOG(m_logger) << "Cannot add DTC to subscriberListener callback - type: " - << DDS::topic_type_name::value(); - } - m_dataReaderObject->setHaveSubscriberCallback(m_subscriberListener != nullptr); - return true; - } - -private: - DDSGeneric::SubscriberListener *m_subscriberListener; - - // DataReaderObjects (DROs) - DataReaderObject *m_dataReaderObject; - - // Callback for data processing - SubscriberCallback m_subscriberCallback; - - QAtomicInt m_writerState; - - NGL::INGLLogger &m_logger; -}; - -// Typed topic callback (DataReader) -template -class GenericDtcImpl final - : public GenericDtcImplSubscriberTemplate> -{ - using BaseClass = GenericDtcImplSubscriberTemplate>; -public: - using BaseClass::BaseClass; -}; - -// Typed topic callback (DataReader) with SampleInfo -template -class GenericDtcImplSampleInfo final - : public GenericDtcImplSubscriberTemplate> -{ - using BaseClass = GenericDtcImplSubscriberTemplate>; -public: - using BaseClass::BaseClass; -}; - -// Dynamic topic callback (DynamicDataReader) -template -class DdtcImpl final - : public GenericDtcImplSubscriberTemplate> -{ - using BaseClass = GenericDtcImplSubscriberTemplate>; -public: - using BaseClass::BaseClass; -}; - -// Dynamic topic callback (DynamicDataReader) with SampleInfo -template -class DdtcImplSampleInfo final - : public GenericDtcImplSubscriberTemplate> -{ - using BaseClass = GenericDtcImplSubscriberTemplate>; -public: - using BaseClass::BaseClass; -}; - -} // namespace DTC diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/ddsconnector_export.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/ddsconnector_export.h deleted file mode 100644 index e542f867e..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/ddsconnector_export.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -// Stub header for BUILD_RTI=OFF -// Original ddsconnector_export.h is generated by CMake when BUILD_RTI=ON - -// For BUILD_RTI=OFF, we don't need DLL export/import macros -// Define DDSCONNECTOR_EXPORT as empty -#ifndef DDSCONNECTOR_EXPORT -#define DDSCONNECTOR_EXPORT -#endif - -#ifndef DDSCONNECTOR_NO_EXPORT -#define DDSCONNECTOR_NO_EXPORT -#endif - -// Static library marker (not used for BUILD_RTI=OFF) -#ifndef DDSCONNECTOR_STATIC_DEFINE -#define DDSCONNECTOR_STATIC_DEFINE -#endif - -// Deprecated marker (optional, can be empty) -#ifndef DDSCONNECTOR_DEPRECATED -#define DDSCONNECTOR_DEPRECATED -#endif - -#ifndef DDSCONNECTOR_DEPRECATED_EXPORT -#define DDSCONNECTOR_DEPRECATED_EXPORT DDSCONNECTOR_DEPRECATED DDSCONNECTOR_EXPORT -#endif - -#ifndef DDSCONNECTOR_DEPRECATED_NO_EXPORT -#define DDSCONNECTOR_DEPRECATED_NO_EXPORT DDSCONNECTOR_DEPRECATED DDSCONNECTOR_NO_EXPORT -#endif \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/ddsgen_export.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/ddsgen_export.h deleted file mode 100644 index 818f6bde7..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/ddsgen_export.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -// Stub header for BUILD_RTI=OFF -// Original ddsgen_export.h comes from RTI Connext DDS code generation - -// For BUILD_RTI=OFF, we don't need DLL export/import macros -// Define DDSGEN_EXPORT as empty -#ifndef DDSGEN_EXPORT -#define DDSGEN_EXPORT -#endif - -#ifndef DDSGEN_NO_EXPORT -#define DDSGEN_NO_EXPORT -#endif - -// Static library marker (not used for BUILD_RTI=OFF) -#ifndef DDSGEN_STATIC_DEFINE -#define DDSGEN_STATIC_DEFINE -#endif - -// Deprecated marker (optional, can be empty) -#ifndef DDSGEN_DEPRECATED -#define DDSGEN_DEPRECATED -#endif - -#ifndef DDSGEN_DEPRECATED_EXPORT -#define DDSGEN_DEPRECATED_EXPORT DDSGEN_DEPRECATED DDSGEN_EXPORT -#endif - -#ifndef DDSGEN_DEPRECATED_NO_EXPORT -#define DDSGEN_DEPRECATED_NO_EXPORT DDSGEN_DEPRECATED DDSGEN_NO_EXPORT -#endif \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_base.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_base.h deleted file mode 100644 index 8819487c9..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_base.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -// Stub header for BUILD_RTI=OFF -// Original generic_base.h uses RTI Connext DDS types - -#include -#include -#include - -// Forward declarations for Qt types used in getMethod -class QObject; - -// Forward declaration for NGL logger -namespace NGL { -class INGLLogger; -} - -namespace DDS -{ - -// Template for topic type name - returns empty string for BUILD_RTI=OFF -template -struct topic_type_name { - static std::string value() { - return ""; - } -}; - -namespace Helper -{ -// Stub implementations for BUILD_RTI=OFF -DDSGEN_EXPORT inline std::string getFunctionTopicName(const std::string &fqName) { - return fqName; -} - -DDSGEN_EXPORT inline std::string getShortTopicName(const std::string &fqName) { - return fqName; -} - -// Stub for getMethod - returns default-constructed QMetaMethod -DDSGEN_EXPORT inline QMetaMethod getMethod(NGL::INGLLogger & /*logger*/, - QObject * /*objectToInform*/, - const char * /*slotToExecute*/, - const char * /*signalSignature*/, - bool /*bWarnOnEmptySlot*/ = true) { - // Stub implementation - returns default QMetaMethod - return QMetaMethod(); -} -} - -} // namespace DDS \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_data_reader.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_data_reader.h deleted file mode 100644 index 1ea629df4..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_data_reader.h +++ /dev/null @@ -1,173 +0,0 @@ -#pragma once - -/** - * @file generic_data_reader.h - * @brief Generic Data Reader wrapper for DDS - * - * Provides GenericDataReader template class that wraps RTI DataReader - * when BUILD_RTI=ON, or provides stub implementation when BUILD_RTI=OFF. - */ - -#include -#include - -#ifdef BUILD_RTI -// RTI DDS is available - include full implementation from Lts -// MUST be included BEFORE namespace DDSGeneric to avoid namespace pollution -#include -#include - -namespace DDSGeneric -{ -// Full implementation is in Lts/DDS/Generic/generic_data_reader.h -// This file just provides the include path redirection -} // namespace DDSGeneric - -#else -// BUILD_RTI=OFF: Provide minimal stub definitions for RTI types - -namespace dds { -namespace sub { -namespace detail { - -// Dummy delegate class to serve as default template parameter -template -class DataReaderImpl { - // Empty stub implementation -}; - -} // namespace detail - -// Forward declaration stub for DataReader -// Must match RTI 7.7 signature for compatibility -template class DELEGATE = detail::DataReaderImpl> -class DataReader { -public: - // Minimal stub interface - add methods as needed by the codebase - T read() { return T{}; } - void take() {} -}; - -} // namespace sub -} // namespace dds - -namespace DDSGeneric -{ - -// GenericDataReader stub template (only when BUILD_RTI=OFF) -template -class GenericDataReader { -public: - using TopicType = T; - using TopicTypeRead = T; - using DataReader = void*; - using DataTopic = void*; - using DataReaderQos = void*; - using SubscriberCallback = std::function; - using SubscriberCallbackWithSampleInfo = std::function; - - GenericDataReader() - : m_dataReader(nullptr), m_ddsTopic(nullptr), m_bHaveSubscriberCallback(false) - { - } - - virtual ~GenericDataReader() - { - m_ddsTopic = nullptr; - m_dataReader = nullptr; - } - - DataReader getDataReader() const - { - return m_dataReader; - } - - bool create(const void* domainParticipant, const void* ddsSubscriber, - const std::string& topicName = std::string(), - bool bCreateDataReader = true) - { - return false; - } - - bool hasSamples() const - { - return false; - } - - void* readAlive(bool& bSeenNewSamples) - { - bSeenNewSamples = false; - return nullptr; - } - - void* takeAlive(bool& bSeenNewSamples) - { - bSeenNewSamples = false; - return nullptr; - } - - void* takeDisposed() - { - return nullptr; - } - - template bool read(C callbackFunc) - { - return false; - } - - void setHaveSubscriberCallback(bool bHave) - { - m_bHaveSubscriberCallback = bHave; - } - - std::string topicName() const - { - return std::string(); - } - - DataReader dataReader() const - { - return m_dataReader; - } - - virtual void recreateReader() - { - } - -protected: - DataReader m_dataReader; - DataReaderQos m_dataReaderQos; - DataTopic m_ddsTopic; - bool m_bHaveSubscriberCallback; -}; - -template -class GenericDataReaderContentFilter { -public: - using DataType = T; - // Minimal stub - extend as needed -}; - -// DynamicDataReader stub for BUILD_RTI=OFF -class DynamicDataReader { -public: - using TopicType = void*; - using DataReader = void*; - using DataTopic = void*; - - DynamicDataReader() {} - ~DynamicDataReader() {} - - bool create(const void* domainParticipant, const void* ddsSubscriber, - const std::string& specialTopicName, const void* structType) - { - return false; - } - - bool hasSamples() const { return false; } -}; - -} // namespace DDSGeneric - -#endif // BUILD_RTI \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_logger.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_logger.h deleted file mode 100644 index c51e009d3..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/DDS/Generic/generic_logger.h +++ /dev/null @@ -1,84 +0,0 @@ -#pragma once - -#ifdef BUILD_RTI -// Real implementation with RTI NGL logger -#include -#include -#include - -namespace DDS -{ - -enum class DataType -{ - DATA_TYPE_UNKNOWN = 0, - - DATA_WRITER = 1, - DATA_READER = 2, - - DYNAMIC_DATA_WRITER = 3, - DYNAMIC_DATA_READER = 4, - - DATA_TOPIC_SERVER = 8, - DATA_TOPIC_CLIENT = 9, - - FUNCTION_TOPIC_SERVER = 12, - FUNCTION_TOPIC_CLIENT = 13 -}; - -using LOGGER_T = NGL::INGLLogger&; - -DDSGEN_EXPORT LOGGER_T getLogger(const char *name, DataType dt); -inline LOGGER_T getLogger(const std::string &loggerName, DataType dt) -{ - return getLogger(loggerName.data(), dt); -} - -} // namespace DDS -#else -// Stub header for BUILD_RTI=OFF -#include -#include -#include - -namespace DDS -{ - -// DataType enum - same as original, no RTI dependency -enum class DataType -{ - DATA_TYPE_UNKNOWN = 0, - - DATA_WRITER = 1, - DATA_READER = 2, - - DYNAMIC_DATA_WRITER = 3, - DYNAMIC_DATA_READER = 4, - - DATA_TOPIC_SERVER = 8, - DATA_TOPIC_CLIENT = 9, - - FUNCTION_TOPIC_SERVER = 12, - FUNCTION_TOPIC_CLIENT = 13 -}; - -// Logger type alias -using LOGGER_T = NGL::INGLLogger&; - -// Stub implementation for getLogger -// Returns a dummy logger reference - in real usage, this would need proper initialization -DDSGEN_EXPORT inline LOGGER_T getLogger(const char *name, DataType dt) { - // Stub: return a static dummy logger - // In production code with BUILD_RTI=OFF, this should be replaced with actual logger - static NGL::INGLLogger* dummy_logger = nullptr; - return *dummy_logger; -} - -// Inline overload for std::string -inline LOGGER_T getLogger(const std::string &loggerName, DataType dt) -{ - return getLogger(loggerName.data(), dt); -} - -} // namespace DDS -#endif \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/EffectShowClient/esc_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/EffectShowClient/esc_dtc.h deleted file mode 100644 index d4ce1ca75..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/EffectShowClient/esc_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/EffectShowManagement/esm_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/EffectShowManagement/esm_dtc.h deleted file mode 100644 index 2a375f081..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/EffectShowManagement/esm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Evaluations/evl_db_impl.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Evaluations/evl_db_impl.h deleted file mode 100644 index 2d74e86d2..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Evaluations/evl_db_impl.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @RDE_HEADER@ - * Stub header for CODEGEN_DATABASE generated code (BUILD_RTI=OFF) - * This file is generated by CODEGEN_DATABASE macro when BUILD_RTI=ON - * For BUILD_RTI=OFF builds, this stub provides the minimal interface - */ -#pragma once - -#include - -namespace Evaluations -{ - -/** - * @brief Base class for database interface implementation - * - * This class is normally generated by CODEGEN_DATABASE macro. - * This stub provides minimal interface for BUILD_RTI=OFF builds. - */ -class DatabaseInterfaceImpl : public QObject -{ - Q_OBJECT -public: - explicit DatabaseInterfaceImpl(QObject *parent = nullptr) : QObject(parent) {} - virtual ~DatabaseInterfaceImpl() = default; - - // Virtual methods that can be overridden by custom implementations - virtual bool removeCategoryLinesPerNineLiner(qint64 nineLinerId) = 0; -}; - -} // namespace Evaluations \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Evaluations/evl_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Evaluations/evl_dtc.h deleted file mode 100644 index 98fe82526..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Evaluations/evl_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem.hpp b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem.hpp deleted file mode 100644 index 078ecb677..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -// Convenience header for ExerciseEventManagement -// Includes all common types and enums - -#include -#include -#include - -// Additional forward declarations and common types can be added here \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_dtc.h deleted file mode 100644 index 2539cd69a..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_export.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_export.h deleted file mode 100644 index 95115ec9a..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_export.h +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Stub export header for ExerciseEventManagement non-RTI builds - * When BUILD_RTI=OFF, svcEemCommon library is not built - * This stub allows dependent code to compile - */ -#pragma once - -#include - -// Stub export macros for non-RTI builds -#define EEM_EXPORT \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_types.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_types.h deleted file mode 100644 index 0cbaa483f..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseEventManagement/eem_types.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Stub type definitions for ExerciseEventManagement - * When BUILD_RTI=OFF, DDS-generated types are not available - * This stub allows dependent code to compile - */ -#pragma once - -#include -#include -#include -#include - -namespace ExerciseEventManagement -{ - -/** - * @brief Stub Event type for non-RTI builds - */ -struct EEM_EXPORT Event -{ - Event() = default; - ~Event() = default; - - // Basic fields - adjust based on actual usage - QString id; - QString type; - QDateTime timestamp; - QString description; - - // Copy/move operations - Event(const Event&) = default; - Event(Event&&) = default; - Event& operator=(const Event&) = default; - Event& operator=(Event&&) = default; -}; - -} // namespace ExerciseEventManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_db.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_db.h deleted file mode 100644 index 3b2ed3e47..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_db.h +++ /dev/null @@ -1,165 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von DDS/RTI Codegen generiert -// Für die Migration mit BUILD_RTI=OFF erstellen wir minimale Implementierungen - -#include "exm_enums.hpp" -#include -#include -#include -#include -#include -#include -#include - -namespace ExerciseManagement -{ - -// Forward declarations -class Exercise; -class ExercisePhase; - -/** - * @brief Exercise class - Stub für DDS-generierten Code - * - * Diese Klasse wird normalerweise von DDS aus exm_service.xml generiert. - * Für BUILD_RTI=OFF verwenden wir diese minimale Implementierung. - */ -class Exercise -{ -public: - Exercise() - : m_id(0) - , m_stateId(0) - , m_operatorId(0) - , m_workstationId(0) - , m_trainingAreaId(0) - , m_radioGroupId(std::nullopt) - , m_activePhaseId(std::nullopt) - , m_symbolFillTypeId(0) - , m_linkedExerciseId(std::nullopt) - , m_sendToWms(false) - , m_transferred(false) - , m_hasHlaInterface(false) - {} - - // Getter - int32_t id() const { return m_id; } - std::string name() const { return m_name.toStdString(); } - QString nameQString() const { return m_name; } - int32_t stateId() const { return m_stateId; } - int32_t operatorId() const { return m_operatorId; } - int32_t workstationId() const { return m_workstationId; } - QDateTime beginTime() const { return m_beginTime; } - QDateTime endTime() const { return m_endTime; } - QDateTime created() const { return m_created; } - QDateTime startTime() const { return m_startTime; } - QDateTime stopTime() const { return m_stopTime; } - int32_t trainingAreaId() const { return m_trainingAreaId; } - std::optional radioGroupId() const { return m_radioGroupId; } - std::optional activePhaseId() const { return m_activePhaseId; } - int32_t symbolFillTypeId() const { return m_symbolFillTypeId; } - std::optional linkedExerciseId() const { return m_linkedExerciseId; } - QString defaultTimeZone() const { return m_defaultTimeZone; } - bool sendToWms() const { return m_sendToWms; } - QString forces() const { return m_forces; } - QString description() const { return m_description; } - bool transferred() const { return m_transferred; } - bool hasHlaInterface() const { return m_hasHlaInterface; } - - // Setter - void setId(int32_t id) { m_id = id; } - void setName(const QString& name) { m_name = name; } - void setName(const std::string& name) { m_name = QString::fromStdString(name); } - void setStateId(int32_t stateId) { m_stateId = stateId; } - void setOperatorId(int32_t operatorId) { m_operatorId = operatorId; } - void setWorkstationId(int32_t workstationId) { m_workstationId = workstationId; } - void setBeginTime(const QDateTime& time) { m_beginTime = time; } - void setEndTime(const QDateTime& time) { m_endTime = time; } - void setCreated(const QDateTime& time) { m_created = time; } - void setStartTime(const QDateTime& time) { m_startTime = time; } - void setStopTime(const QDateTime& time) { m_stopTime = time; } - void setTrainingAreaId(int32_t id) { m_trainingAreaId = id; } - void setRadioGroupId(std::optional id) { m_radioGroupId = id; } - void setActivePhaseId(std::optional id) { m_activePhaseId = id; } - void setSymbolFillTypeId(int32_t id) { m_symbolFillTypeId = id; } - void setLinkedExerciseId(std::optional id) { m_linkedExerciseId = id; } - void setDefaultTimeZone(const QString& tz) { m_defaultTimeZone = tz; } - void setSendToWms(bool send) { m_sendToWms = send; } - void setForces(const QString& forces) { m_forces = forces; } - void setDescription(const QString& desc) { m_description = desc; } - void setTransferred(bool transferred) { m_transferred = transferred; } - void setHasHlaInterface(bool has) { m_hasHlaInterface = has; } - - // Utility - bool isValid() const { return m_id > 0; } - -private: - int32_t m_id; - QString m_name; - int32_t m_stateId; - int32_t m_operatorId; - int32_t m_workstationId; - QDateTime m_beginTime; - QDateTime m_endTime; - QDateTime m_created; - QDateTime m_startTime; - QDateTime m_stopTime; - int32_t m_trainingAreaId; - std::optional m_radioGroupId; - std::optional m_activePhaseId; - int32_t m_symbolFillTypeId; - std::optional m_linkedExerciseId; - QString m_defaultTimeZone; - bool m_sendToWms; - QString m_forces; - QString m_description; - bool m_transferred; - bool m_hasHlaInterface; -}; - -/** - * @brief ExercisePhase class - Stub für DDS-generierten Code - * - * Diese Klasse wird normalerweise von DDS aus exm_service.xml generiert. - * Für BUILD_RTI=OFF verwenden wir diese minimale Implementierung. - */ -class ExercisePhase -{ -public: - ExercisePhase() - : m_id(0) - , m_exerciseId(0) - {} - - // Getter - int32_t id() const { return m_id; } - std::string name() const { return m_name.toStdString(); } - QString nameQString() const { return m_name; } - QString description() const { return m_description; } - QDateTime beginTime() const { return m_beginTime; } - QDateTime endTime() const { return m_endTime; } - int32_t exerciseId() const { return m_exerciseId; } - - // Setter - void setId(int32_t id) { m_id = id; } - void setName(const QString& name) { m_name = name; } - void setName(const std::string& name) { m_name = QString::fromStdString(name); } - void setDescription(const QString& desc) { m_description = desc; } - void setBeginTime(const QDateTime& time) { m_beginTime = time; } - void setEndTime(const QDateTime& time) { m_endTime = time; } - void setExerciseId(int32_t id) { m_exerciseId = id; } - - // Utility - bool isValid() const { return m_id > 0; } - -private: - int32_t m_id; - QString m_name; - QString m_description; - QDateTime m_beginTime; - QDateTime m_endTime; - int32_t m_exerciseId; -}; - -} // namespace ExerciseManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_dtc.h deleted file mode 100644 index 923f9d915..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_ftc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_ftc.h deleted file mode 100644 index 6ddc80050..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ExerciseManagement/exm_ftc.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - * ExerciseManagement Function Topic Client interface - * STUB-HEADER: Diese Datei wird normalerweise von DDS generiert - * Für die Migration erstellen wir minimale Implementierungen - */ - -#pragma once - -#include -#include -#include - -namespace DDSConnector -{ -class DdsConnector; -} - -namespace ExerciseManagement -{ -namespace Interface -{ - -// Forward declaration -class Ftc; - -// Reply Handler stub classes for Function Topics -// These are normally generated from DDS IDL definitions - -class GetExerciseDataReplyHandler -{ -public: - GetExerciseDataReplyHandler() = default; - virtual ~GetExerciseDataReplyHandler() = default; - virtual void onGetExerciseData(const void* /*reply*/) {} -}; - -class ModifyExerciseDataReplyHandler -{ -public: - ModifyExerciseDataReplyHandler() = default; - virtual ~ModifyExerciseDataReplyHandler() = default; - virtual void onModifyExerciseData(const void* /*reply*/) {} -}; - -class GetExercisePhaseDataReplyHandler -{ -public: - GetExercisePhaseDataReplyHandler() = default; - virtual ~GetExercisePhaseDataReplyHandler() = default; - virtual void onGetExercisePhaseData(const void* /*reply*/) {} -}; - -// Ftc - Function Topic Client interface for ExerciseManagement -class Ftc : public QObject -{ - Q_OBJECT - -public: - virtual ~Ftc() = default; - - /** - * Create a new instance for ExerciseManagement::Interface::Ftc. - * STUB: Returns nullptr - actual implementation would require DDS - */ - static std::shared_ptr create(const std::shared_ptr& /*ddsConnector*/, bool /*forceCreate*/ = false) - { - return nullptr; - } - - /** - * A unique identifier for this FTC - */ - static inline const char* identifier() { return "ExerciseManagement.Interface.Ftc"; } - - /** - * Initialize this Ftc instance with all function topic clients - */ - virtual bool enableAll(bool /*enable*/ = true) { return false; } - - /** - * Enable/disable specific function topic clients - */ - virtual bool enableGetExerciseData(bool /*enable*/ = true) { return false; } - virtual bool isGetExerciseDataEnabled() const { return false; } - - virtual bool enableModifyExerciseData(bool /*enable*/ = true) { return false; } - virtual bool isModifyExerciseDataEnabled() const { return false; } - - virtual bool enableGetExercisePhaseData(bool /*enable*/ = true) { return false; } - virtual bool isGetExercisePhaseDataEnabled() const { return false; } - - /** - * Request methods with reply handlers - * STUB: Return -1 to indicate no request was sent - */ - virtual int64_t requestGetExerciseData(const void* /*request*/, GetExerciseDataReplyHandler* /*handler*/) { return -1; } - virtual int64_t requestGetExerciseData(const void* /*request*/, const std::function& /*cb*/) { return -1; } - virtual int64_t lastGetExerciseDataUniqueId() const { return -1; } - - virtual int64_t requestModifyExerciseData(const void* /*request*/, ModifyExerciseDataReplyHandler* /*handler*/) { return -1; } - virtual int64_t requestModifyExerciseData(const void* /*request*/, const std::function& /*cb*/) { return -1; } - virtual int64_t lastModifyExerciseDataUniqueId() const { return -1; } - - virtual int64_t requestGetExercisePhaseData(const void* /*request*/, GetExercisePhaseDataReplyHandler* /*handler*/) { return -1; } - virtual int64_t requestGetExercisePhaseData(const void* /*request*/, const std::function& /*cb*/) { return -1; } - virtual int64_t lastGetExercisePhaseDataUniqueId() const { return -1; } -}; - -} // namespace Interface -} // namespace ExerciseManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/CMakeLists.txt deleted file mode 100644 index 10f9360d1..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Stub CMakeLists.txt für FileManagement Headers -# Diese Datei stellt eine leere Library bereit damit andere Module linken können -# ohne die vollständigen DDS-basierten Services zu benötigen - -# FileManagement Stub Library mit Dtc-Implementierung -add_library(FileManagement_Stub STATIC - flm_dtc.cpp -) -target_include_directories(FileManagement_Stub - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} -) -target_link_libraries(FileManagement_Stub - PUBLIC - Qt6::Core -) -set_target_properties(FileManagement_Stub PROPERTIES - AUTOMOC ON -) - -# svcFlmCommon als ALIAS zu FileManagement_Stub für Kompatibilität -add_library(svcFlmCommon ALIAS FileManagement_Stub) - -# Leere Header-Only Library als Platzhalter für svcOpmCommon -add_library(svcOpmCommon INTERFACE) -target_include_directories(svcOpmCommon - INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/../OperatorManagement/ -) - -# Leere Header-Only Library als Platzhalter für svcExmCommon -add_library(svcExmCommon INTERFACE) -target_include_directories(svcExmCommon - INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/../ExerciseManagement/ -) diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_data_plugin_interface.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_data_plugin_interface.h deleted file mode 100755 index a2e264418..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_data_plugin_interface.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @RDE_HEADER@ - * FileManagement Explorer Interface for access from other Plugins - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Mike Wille, SLSE, 2017-03-31 - */ - -#pragma once - -#include -#include -#include - -namespace FileManagement -{ -/** - * @brief The DataInterface class provides the Topics Clients only for the GUI Plugins - */ -class DataInterface : public DataPluginBase::Interface -{ -public: - using DataPluginBase::Interface::Interface; - - virtual std::shared_ptr getDtc() = 0; - virtual std::shared_ptr getFtc() = 0; -}; - -} // namespace FileManagement diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_db.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_db.h deleted file mode 100644 index 3de373870..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_db.h +++ /dev/null @@ -1,181 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von DDS/RTI Codegen generiert -// Für die Migration mit BUILD_RTI=OFF erstellen wir minimale Implementierungen - -#include "flm_enums.hpp" -#include -#include -#include -#include -#include -#include -#include - -namespace FileManagement -{ - -// Forward declarations -class Folder; -class FileContent; - -/** - * @brief Folder class - Stub für DDS-generierten Code - * - * Diese Klasse wird normalerweise von DDS aus flm_service.xml generiert. - * Für BUILD_RTI=OFF verwenden wir diese minimale Implementierung. - */ -class Folder -{ -public: - Folder() : m_id(0), m_parentId(0), m_mainFolder(MainFolder::None), m_operatorId(0) {} - - // Getter - int32_t id() const { return m_id; } - std::string name() const { return m_name.toStdString(); } - int32_t parentId() const { return m_parentId; } - std::vector path() const { return m_path; } - QDateTime created() const { return m_created; } - QDateTime modified() const { return m_modified; } - MainFolder mainFolder() const { return m_mainFolder; } - int32_t operatorId() const { return m_operatorId; } - bool isHidden() const { return m_hidden; } - bool isEditable() const { return m_editable; } - bool isDeleted() const { return m_deleted; } - - // Setter - void setId(int32_t id) { m_id = id; } - void setName(const QString& name) { m_name = name; } - void setName(const std::string& name) { m_name = QString::fromStdString(name); } - void setParentId(int32_t parentId) { m_parentId = parentId; } - void setPath(const std::vector& path) { m_path = path; } - void setCreated(const QDateTime& created) { m_created = created; } - void setModified(const QDateTime& modified) { m_modified = modified; } - void setMainFolder(MainFolder mainFolder) { m_mainFolder = mainFolder; } - void setOperatorId(int32_t operatorId) { m_operatorId = operatorId; } - void setHidden(bool hidden) { m_hidden = hidden; } - void setEditable(bool editable) { m_editable = editable; } - void setDeleted(bool deleted) { m_deleted = deleted; } - - // Utility - bool isValid() const { return m_id > 0; } - -private: - int32_t m_id; - QString m_name; - int32_t m_parentId; - std::vector m_path; - QDateTime m_created; - QDateTime m_modified; - MainFolder m_mainFolder; - int32_t m_operatorId; - bool m_hidden = false; - bool m_editable = true; - bool m_deleted = false; -}; - -/** - * @brief FileContent class - Stub für DDS-generierten Code - * - * Diese Klasse wird normalerweise von DDS aus flm_service.xml generiert. - * Für BUILD_RTI=OFF verwenden wir diese minimale Implementierung. - */ -class FileContent -{ -public: - FileContent() - : m_id(0) - , m_fileId(0) - , m_folderId(0) - , m_operatorId(0) - , m_exerciseId(std::nullopt) - , m_phaseId(std::nullopt) - , m_size(0) - , m_fileStatus(FileStatus::Valid) - , m_fileCategory(FileCategory::Global) - , m_fileType(FileType::Unknown) - , m_isTemplate(false) - , m_mainFolder(MainFolder::None) - , m_hidden(false) - , m_used(false) - { - } - - // Getter - int32_t id() const { return m_id; } - int32_t fileId() const { return m_fileId; } - int32_t folderId() const { return m_folderId; } - int32_t operatorId() const { return m_operatorId; } - std::optional exerciseId() const { return m_exerciseId; } - std::optional phaseId() const { return m_phaseId; } - QString name() const { return m_fileName; } - QString fileName() const { return m_fileName; } - QString mimeType() const { return m_mimeType; } - int64_t size() const { return m_size; } - QByteArray content() const { return m_content; } - std::string properties() const { return m_properties; } - QDateTime created() const { return m_created; } - QDateTime modified() const { return m_modified; } - QDateTime lastModified() const { return m_modified; } - FileStatus fileStatus() const { return m_fileStatus; } - FileCategory fileCategory() const { return m_fileCategory; } - FileType fileType() const { return m_fileType; } - bool isTemplate() const { return m_isTemplate; } - bool isDeleted() const { return m_fileStatus == FileStatus::Deleted; } - bool isHidden() const { return m_hidden; } - bool isUsedBy() const { return m_used; } - std::string usedBy() const { return m_usedBy; } - MainFolder mainFolder() const { return m_mainFolder; } - - // Setter - void setId(int32_t id) { m_id = id; } - void setFileId(int32_t fileId) { m_fileId = fileId; } - void setFolderId(int32_t folderId) { m_folderId = folderId; } - void setOperatorId(int32_t operatorId) { m_operatorId = operatorId; } - void setExerciseId(std::optional exerciseId) { m_exerciseId = exerciseId; } - void setPhaseId(std::optional phaseId) { m_phaseId = phaseId; } - void setName(const QString& fileName) { m_fileName = fileName; } - void setFileName(const QString& fileName) { m_fileName = fileName; } - void setMimeType(const QString& mimeType) { m_mimeType = mimeType; } - void setSize(int64_t size) { m_size = size; } - void setContent(const QByteArray& content) { m_content = content; } - void setProperties(const std::string& properties) { m_properties = properties; } - void setCreated(const QDateTime& created) { m_created = created; } - void setModified(const QDateTime& modified) { m_modified = modified; } - void setFileStatus(FileStatus status) { m_fileStatus = status; } - void setFileCategory(FileCategory category) { m_fileCategory = category; } - void setFileType(FileType type) { m_fileType = type; } - void setTemplate(bool isTemplate) { m_isTemplate = isTemplate; } - void setHidden(bool hidden) { m_hidden = hidden; } - void setUsedBy(bool used) { m_used = used; } - void setUsedBy(const std::string& usedBy) { m_usedBy = usedBy; m_used = !usedBy.empty(); } - void setMainFolder(MainFolder mainFolder) { m_mainFolder = mainFolder; } - - // Utility - bool isValid() const { return m_id > 0; } - -private: - int32_t m_id; - int32_t m_fileId; - int32_t m_folderId; - int32_t m_operatorId; - std::optional m_exerciseId; - std::optional m_phaseId; - QString m_fileName; - QString m_mimeType; - int64_t m_size; - QByteArray m_content; - std::string m_properties; - QDateTime m_created; - QDateTime m_modified; - FileStatus m_fileStatus; - FileCategory m_fileCategory; - FileType m_fileType; - bool m_isTemplate; - MainFolder m_mainFolder; - bool m_hidden; - bool m_used; - std::string m_usedBy; -}; - -} // namespace FileManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_db_impl.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_db_impl.h deleted file mode 100644 index 075bd09f5..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_db_impl.h +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @RDE_HEADER@ - * Stub header for CODEGEN_DATABASE generated code (BUILD_RTI=OFF) - * This file is generated by CODEGEN_DATABASE macro when BUILD_RTI=ON - * For BUILD_RTI=OFF builds, this stub provides the minimal interface - */ -#pragma once - -#include -#include -#include - -// Minimal Logger stub for BUILD_RTI=OFF -namespace NGL -{ -enum class LogLevel -{ - Undefined = 0, - Trace = 64, - Debug = 96, - Info = 128, - Warning = 150, - Error = 182, - Fatal = 214, -}; - -class Logger -{ -public: - bool isTraceEnabled() const { return false; } - bool isDebugEnabled() const { return true; } - bool isInfoEnabled() const { return true; } - bool isWarningEnabled() const { return true; } - bool isErrorEnabled() const { return true; } - bool isFatalEnabled() const { return true; } -}; -} - -// Logger macros (simplified for Qt6) - work with pointer -#define LOGFUNCTION Q_FUNC_INFO - -#ifdef LTS_DEBUG -#define TRACE_LOG(logger) \ - for (bool log_level_enabled = (logger)->isDebugEnabled(); log_level_enabled; log_level_enabled = false) \ - qDebug() << "[TRACE]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO -#else -#define TRACE_LOG(logger) \ - if (false) qDebug() -#endif - -#define DEBUG_LOG(logger) \ - if (!(logger)->isDebugEnabled()) {} else qDebug() << "[DEBUG]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO - -#define INFO_LOG(logger) \ - if (!(logger)->isInfoEnabled()) {} else qDebug() << "[INFO]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO - -#define WARNING_LOG(logger) \ - if (!(logger)->isWarningEnabled()) {} else qWarning() << "[WARNING]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO - -#define ERROR_LOG(logger) \ - if (!(logger)->isErrorEnabled()) {} else qCritical() << "[ERROR]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO - -#define FATAL_LOG(logger) \ - if (!(logger)->isFatalEnabled()) {} else qCritical() << "[FATAL]" << __FILE__ << ":" << __LINE__ << Q_FUNC_INFO - -namespace FileManagement -{ - -/** - * @brief Base class for database interface implementation - * - * This class is normally generated by CODEGEN_DATABASE macro. - * This stub provides minimal interface for BUILD_RTI=OFF builds. - */ -class DatabaseInterfaceImpl -{ -public: - DatabaseInterfaceImpl() - : m_logger(nullptr) - , m_query(nullptr) - { - m_logger = new NGL::Logger(); - m_query = new NSqlQuery(QSqlDatabase()); - } - virtual ~DatabaseInterfaceImpl() - { - delete m_logger; - delete m_query; - } - - // Virtual methods that can be overridden by custom implementations - virtual bool updateStatus(int fileId, const FileStatus &status, int operatorId) = 0; - virtual bool setUsedBy(int fileId, const bool &usedBy, int usedNo, int operatorId) = 0; - -protected: - // Member variables expected by custom implementations - NGL::Logger* m_logger; - NSqlQuery* m_query; - - // Helper methods expected by custom implementations - QString getTableName(const QString &baseName) const { return baseName; } -}; - -} // namespace FileManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_dtc.h deleted file mode 100644 index 59167a11e..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_dtc_impl.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_dtc_impl.h deleted file mode 100644 index 2e4496d1b..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_dtc_impl.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @RDE_HEADER@ - * FileManagement DTC Implementation - * $Id$ - * $HeadURL$ - * $Author$ - * Stub-Header für Qt6-Migration - ersetzt DDS-generierten Header - */ -#pragma once - -#include -#include -#include - -// Forward declarations für DDS -namespace DDSConnector -{ -class DdsConnector; -} - -// Stub für DDS DataReader - wird normalerweise von DDS generiert -template -class DdsDataReaderStub -{ -public: - struct LoanedSamplesWrapper - { - auto begin() { return m_samples.begin(); } - auto end() { return m_samples.end(); } - std::vector m_samples; - }; - - LoanedSamplesWrapper readAlive() { return LoanedSamplesWrapper{}; } -}; - -//------------------------------------------------------------------------------------------------------------- -namespace FileManagement -{ -namespace Interface -{ -/** - * @brief DtcImpl - Basisklasse für FileManagement DTC - * - * Stellt Logger und DDS-DataReader für Custom-Implementierungen bereit - * Erbt von DatabaseInterfaceImpl für Datenbank-Zugriff - */ -class DtcImpl : public DatabaseInterfaceImpl -{ -public: - explicit DtcImpl(const std::shared_ptr &ddsConnector) - : DatabaseInterfaceImpl() - , m_ddsConnector(ddsConnector) - , m_dtcFileContent(std::make_unique>()) - , m_dtcFolder(std::make_unique>()) - { - // Logger wird von DatabaseInterfaceImpl bereitgestellt - // m_logger ist in DatabaseInterfaceImpl definiert - } - - ~DtcImpl() override = default; - - // Virtuelle Methoden für Custom-Implementierung - virtual bool getAllTemplates(QList &allTemplates) = 0; - virtual bool getAllFiles(const FileType &fileType, int folderId, QStringList &allFiles, bool showHidden = false) = 0; - virtual bool getFilesOperator(const FileType &fileType, int folderId, int operatorId, QStringList &allFiles) = 0; - virtual bool getFile(const FileType &fileType, int folderId, const QString &fileName, FileContent &fileMetadata) = 0; - virtual int getExerciseId(int folderId) = 0; - virtual int getFileId(const FileType &fileType, const QString &fileName, int exerciseId, int phaseId) = 0; - virtual int findFolder(int parentId, const QString &name) const = 0; - virtual int getExerciseFolderId(int exerciseId) const = 0; - virtual int getPhaseFolderId(int exerciseId, int phaseId) const = 0; - virtual int getPartyFolderId(int exerciseId, int partyId) const = 0; - - // Default-Implementierungen für Namen-Helper - virtual QString getExerciseFolderName(int exerciseId) const { return QLatin1String("$EX_") + QString::number(exerciseId); } - virtual QString getPartyFolderName(int partyId) const { return QLatin1String("$PY_") + QString::number(partyId); } - virtual QString getPhaseFolderName(int phaseId) const { return QLatin1String("$PH_") + QString::number(phaseId); } - -protected: - std::shared_ptr m_ddsConnector; - std::unique_ptr> m_dtcFileContent; - std::unique_ptr> m_dtcFolder; -}; - -} // namespace Interface -} // namespace FileManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_enums.hpp.stub b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_enums.hpp.stub deleted file mode 100644 index 8623c02f3..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_enums.hpp.stub +++ /dev/null @@ -1,39 +0,0 @@ -// Stub file for flm_enums.hpp - used when BUILD_RTI=OFF -#ifndef FLM_ENUMS_HPP -#define FLM_ENUMS_HPP - -#include - -namespace FileManagement { - -enum class FileType : std::int32_t { - Unknown = 0, - Document = 1, - Image = 2, - Video = 3, - Audio = 4 -}; - -enum class FileStatus : std::int32_t { - Available = 0, - Downloading = 1, - Error = 2, - Valid = 3, - Deleted = 4 -}; - -enum class MainFolder : std::int32_t { - None = 0, - Global = 1, - Local = 2 -}; - -enum class FileCategory : std::int32_t { - Global = 0, - Local = 1, - Personal = 2 -}; - -} // namespace FileManagement - -#endif // FLM_ENUMS_HPP \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_ftc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_ftc.h deleted file mode 100644 index da7303e1c..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_ftc.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @RDE_HEADER@ - * FileManagement Topic Client Stub (BUILD_RTI=OFF) - * Normally generated from flm_service.xml by DDS Code Generator - */ - -#pragma once - -#include - -namespace FileManagement -{ -namespace Interface -{ - -// Forward declaration - actual implementation provided by DDS when BUILD_RTI=ON -class Ftc; - -} // namespace Interface -} // namespace FileManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_translation.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_translation.h deleted file mode 100644 index f1ae3da4b..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FileManagement/flm_translation.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @RDE_HEADER@ - * Convert DSS enumerations to translatable strings - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#pragma once - -// filename: flm_translation.h - -#include "flm_enums.hpp" -#include - -namespace FileManagement -{ -// Translatable enumerations: -inline QString toString(FileType state) -{ - switch (state) { - case FileType::Unknown: return QStringLiteral("Unknown"); - case FileType::Text: return QStringLiteral("Text"); - case FileType::Xml: return QStringLiteral("XML"); - case FileType::Pdf: return QStringLiteral("PDF"); - case FileType::Jpg: return QStringLiteral("Image"); - case FileType::Png: return QStringLiteral("Image"); - case FileType::Gif: return QStringLiteral("Image"); - case FileType::Bmp: return QStringLiteral("Image"); - case FileType::Tiff: return QStringLiteral("Image"); - case FileType::Video: return QStringLiteral("Video"); - case FileType::Audio: return QStringLiteral("Audio"); - case FileType::MSOfficeDocument: - case FileType::MSOfficeDocument97: - case FileType::OpenOfficeDocument: - case FileType::Doc: - case FileType::Odt: - case FileType::Ods: - case FileType::Odp: - return QStringLiteral("Document"); - case FileType::TacticalPlan: return QStringLiteral("TacticalPlan"); - case FileType::OperatorFavourite: return QStringLiteral("OperatorFavourite"); - case FileType::OperatorDefinedSymbol: return QStringLiteral("OperatorDefinedSymbol"); - default: return QStringLiteral("Unknown"); - } -} - -inline QString toString(FileCategory state) -{ - switch (state) { - case FileCategory::Global: return QStringLiteral("Global"); - case FileCategory::Exercise: return QStringLiteral("Exercise"); - case FileCategory::User: return QStringLiteral("User"); - default: return QStringLiteral("Unknown"); - } -} - -inline QString toString(FileStatus state) -{ - switch (state) { - case FileStatus::Valid: return QStringLiteral("Valid"); - case FileStatus::Deleted: return QStringLiteral("Deleted"); - default: return QStringLiteral("Unknown"); - } -} - -// Translatable struct members: -inline QString trFolderName(const QString &text) -{ - return text; -} - -} // namespace FileManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_dts.cpp b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_dts.cpp deleted file mode 100644 index f3690910d..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_dts.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/** - * DDS Stub Implementation for FilterManagement DTS/FTS - * - * This is a minimal stub implementation to enable building without - * the actual DDS-generated code. - */ - -#include "flt_dts.h" -#include "flt_fts.h" -#include - -namespace FilterManagement -{ -namespace Interface -{ - -// Dts Stub Implementation -class DtsImpl : public Dts -{ -public: - explicit DtsImpl(const std::shared_ptr & /*connector*/) - {} - - bool enableAll() override - { - // Stub - always succeeds - return true; - } - - void publish(const AesFilter & /*filter*/) override - { - // Stub - no-op - } - - void removeAesFilterByKey(int /*key*/) override - { - // Stub - no-op - } -}; - -std::shared_ptr Dts::create(const std::shared_ptr &connector) -{ - return std::make_shared(connector); -} - -// Fts Stub Implementation -class FtsImpl : public Fts -{ -public: - explicit FtsImpl(const std::shared_ptr & /*connector*/) - {} - - bool enableAll() override - { - // Stub - always succeeds - return true; - } - - void aesFilterUpdateReply(const rti::core::SampleIdentity & /*cookie*/, - const Core::FunctionReplyObject & /*reply*/) override - { - // Stub - no-op - } -}; - -std::shared_ptr Fts::create(const std::shared_ptr &connector) -{ - return std::make_shared(connector); -} - -} // namespace Interface -} // namespace FilterManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_dts.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_dts.h deleted file mode 100644 index c75b330a3..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_dts.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * DDS Stub Header for FilterManagement DTS (Data Transfer Service) - * - * This is a minimal stub header to enable building without the actual - * DDS-generated headers. The real flt_dts.h would be generated by RTI DDS - * from IDL definitions. - */ - -#pragma once - -#include -#include -#include -#if BUILD_RTI -#include -#include -#endif - -namespace FilterManagement -{ - -// Forward declaration -class AesFilter; - -namespace Interface -{ - -/** - * @brief Dts - DDS Data Transfer Service interface for FilterManagement - * - * Stub implementation - real type would be DDS-generated - */ -class Dts -{ -public: - static std::shared_ptr create(const std::shared_ptr &connector); - - virtual ~Dts() = default; - - virtual bool enableAll() = 0; - - // AesFilter operations - virtual void publish(const AesFilter &filter) = 0; - virtual void removeAesFilterByKey(int key) = 0; -}; - -/** - * @brief Fts - DDS Filter Tasking Service interface for FilterManagement - * - * Stub implementation - real type would be DDS-generated - */ -class Fts -{ -public: - static std::shared_ptr create(const std::shared_ptr &connector); - - virtual ~Fts() = default; - - virtual bool enableAll() = 0; - - // AesFilter operations - virtual void aesFilterUpdateReply(const rti::core::SampleIdentity &cookie, - const Core::FunctionReplyObject &reply) = 0; -}; - -} // namespace Interface -} // namespace FilterManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_ftc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_ftc.h deleted file mode 100644 index ee4013910..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_ftc.h +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @file flt_ftc.h - * @brief DDS-generated Stub-Header für FilterManagement FTC (Filter Topic Client) - * - * Dieser Header ist ein Stub für den von RTI DDS Generator erzeugten Header. - * Ermöglicht Build ohne echte DDS-Codegenerierung. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -namespace rti { -namespace core { - class SampleIdentity; -} -} - -namespace FilterManagement { - -// Forward declarations -class AesFilter -{ -public: - AesFilter() = default; - ~AesFilter() = default; - - // Placeholder members for AesFilter functionality - QString getName() const { return m_name; } - void setName(const QString &name) { m_name = name; } - - bool isActive() const { return m_active; } - void setActive(bool active) { m_active = active; } - -private: - QString m_name; - bool m_active = false; -}; - -/** - * @brief SymbolAppearance - DDS-Stub für Symbol Appearance Filter - */ -class SymbolAppearance -{ -public: - SymbolAppearance() = default; - ~SymbolAppearance() = default; - - // Placeholder members for SymbolAppearance functionality - QString getName() const { return m_name; } - void setName(const QString &name) { m_name = name; } - - // Content getter/setter (wird von symbol_appearance_settings_impl.cpp verwendet) - QString content() const { return m_content; } - void setContent(const QString &c) { m_content = c; } - -private: - QString m_name; - QString m_content; -}; - -/** - * @brief BuildingComponentFilter - DDS-Stub für Building Component Filter - * - * Minimaler Stub der die im Code verwendeten Methoden bereitstellt. - */ -class BuildingComponentFilter -{ -public: - BuildingComponentFilter() = default; - BuildingComponentFilter(const BuildingComponentFilter &) = default; - BuildingComponentFilter &operator=(const BuildingComponentFilter &) = default; - ~BuildingComponentFilter() = default; - - const std::string& content() const { return m_content; } - void content(const std::string &c) { m_content = c; } - -private: - std::string m_content; -}; - -namespace Interface { - -/** - * @brief FTC (Filter Topic Client) Interface - * - * DDS-generierte Klasse für Filter-Client-Operationen. - * Diese Stub-Implementation ermöglicht Build ohne DDS. - */ -class Ftc -{ -public: - virtual ~Ftc() = default; - - /** - * @brief Factory-Methode zur Erstellung einer Ftc-Instanz - * @param connector DDS-Connector (wird im Stub ignoriert) - * @return Shared Pointer zur Ftc-Instanz (nullptr im Stub) - */ - static std::shared_ptr create(void* /*connector*/) - { - return nullptr; // Stub returns nullptr - actual implementation requires DDS - } - - // Reply-Handler Methoden (DDS Request/Reply Pattern) - virtual void aesFilterUpdateReply(const rti::core::SampleIdentity& cookie, - const Core::FunctionReplyObject& ret) = 0; - - virtual void symbolAppearanceUpdateReply(const rti::core::SampleIdentity& cookie, - const Core::FunctionReplyObject& ret) = 0; - - virtual void buildingComponentFilterUpdateReply(const rti::core::SampleIdentity& cookie, - const Core::FunctionReplyObject& ret) = 0; - - // Weitere FTC-Methoden nach Bedarf - virtual void enableAll() = 0; -}; - -/** - * @brief AesFilterUpdateReplyHandler - Callback Interface für AesFilter Updates - */ -class AesFilterUpdateReplyHandler -{ -public: - virtual ~AesFilterUpdateReplyHandler() = default; - virtual void aesFilterUpdateReply(const rti::core::SampleIdentity& cookie, - const Core::FunctionReplyObject& ret) = 0; -}; - -/** - * @brief SymbolAppearanceUpdateReplyHandler - Callback Interface für SymbolAppearance Updates - */ -class SymbolAppearanceUpdateReplyHandler -{ -public: - virtual ~SymbolAppearanceUpdateReplyHandler() = default; - virtual void symbolAppearanceUpdateReply(const rti::core::SampleIdentity& cookie, - const Core::FunctionReplyObject& ret) = 0; -}; - -/** - * @brief BuildingComponentFilterUpdateReplyHandler - Callback Interface für BuildingComponentFilter Updates - */ -class BuildingComponentFilterUpdateReplyHandler -{ -public: - virtual ~BuildingComponentFilterUpdateReplyHandler() = default; - virtual void buildingComponentFilterUpdateReply(const rti::core::SampleIdentity& cookie, - const Core::FunctionReplyObject& ret) = 0; -}; - -} // namespace Interface -} // namespace FilterManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_fts.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_fts.h deleted file mode 100644 index de00130dd..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/flt_fts.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * DDS Stub Header for FilterManagement FTS (Filter Tasking Service) - * - * This is a minimal stub header to enable building without the actual - * DDS-generated headers. The real flt_fts.h would be generated by RTI DDS - * from IDL definitions. - */ - -#pragma once - -#include -#include -#if BUILD_RTI -#include -#endif - -namespace FilterManagement -{ - -/** - * @brief AesFilter - DDS type for AES filter data - * - * Stub implementation - real type would be DDS-generated - */ -class AesFilter -{ -public: - AesFilter() = default; - AesFilter(int id, int operatorId, qint64 sampleTime, const std::string &content, const std::string &ctx) - : m_id(id) - , m_operatorId(operatorId) - , m_sampleTime(sampleTime) - , m_content(content) - , m_ctx(ctx) - {} - - // Copy constructor from AesFilter (for DDS compatibility) - AesFilter(const AesFilter &other) = default; - AesFilter &operator=(const AesFilter &other) = default; - - // Getters - int id() const { return m_id; } - int operatorId() const { return m_operatorId; } - qint64 sampleTime() const { return m_sampleTime; } - const std::string &content() const { return m_content; } - const std::string &ctx() const { return m_ctx; } - - // Setters - void id(int id) { m_id = id; } - void operatorId(int operatorId) { m_operatorId = operatorId; } - void sampleTime(qint64 sampleTime) { m_sampleTime = sampleTime; } - void content(const std::string &content) { m_content = content; } - void ctx(const std::string &ctx) { m_ctx = ctx; } - -private: - int m_id = 0; - int m_operatorId = 0; - qint64 m_sampleTime = 0; - std::string m_content; - std::string m_ctx; -}; - -} // namespace FilterManagement - -namespace Interface -{ -namespace Fts -{ - -/** - * @brief AesFilterUpdateRequestHandler - DDS request handler interface - * - * Stub implementation - real type would be DDS-generated - */ -class AesFilterUpdateRequestHandler -{ -public: - virtual ~AesFilterUpdateRequestHandler() = default; - -protected: - virtual void onAesFilterUpdateRequest(const rti::core::SampleIdentity &cookie, - const FilterManagement::AesFilter &request) = 0; -}; - -} // namespace Fts -} // namespace Interface \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/logger.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/logger.h deleted file mode 100644 index 31938f43c..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/FilterManagement/logger.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @RDE_HEADER@ - * Logging Stub for FilterManagement - * Placeholder for DDS-generated logger - */ - -#pragma once - -#include -#include - -namespace FilterManagement -{ -using LOGGER_T = NGL::INGLLogger &; - -inline LOGGER_T getLogger(const char *name) -{ - (void)name; // Unused in stub - return NGL::getMemoryLogger(); -} - -inline LOGGER_T getLogger(const QString &loggerName) -{ - return getLogger(loggerName.toUtf8().constData()); -} -} // namespace FilterManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezIedManagement/gim_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezIedManagement/gim_dtc.h deleted file mode 100644 index a70d726b0..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezIedManagement/gim_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezNasat/gna_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezNasat/gna_dtc.h deleted file mode 100644 index a49ea0f66..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezNasat/gna_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezNasat/logger.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezNasat/logger.h deleted file mode 100755 index 60ce0a3b1..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/GuezNasat/logger.h +++ /dev/null @@ -1,18 +0,0 @@ - - - -#pragma once - -#include -#include "gna_export.h" - -namespace GuezNasat -{ -using LOGGER_T = NGL::INGLLogger &; - -GNA_COMMON_EXPORT LOGGER_T getLogger(const char *name); -inline LOGGER_T getLogger(const QString &loggerName) -{ - return getLogger(loggerName.toUtf8().constData()); -} -} diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism.hpp b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism.hpp deleted file mode 100644 index f5cee0a24..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism.hpp +++ /dev/null @@ -1,233 +0,0 @@ -/** - * @file ism.hpp - * @brief DDS-Stub-Header für InfrastructureManagement - * - * Dieser Header ersetzt die von RTI DDS Generator erzeugten Typen. - */ - -#ifndef ISM_HPP -#define ISM_HPP - -#include -#include -#include -#include -#include -#include -#include -#include "InfrastructureManagement/ism_enums.hpp" -#include "ParticipantManagement/ppm.hpp" -#include "ParticipantManagement/ppm_enums.hpp" - -namespace InfrastructureManagement { - -// Using-declaration for DataModification in InfrastructureManagement namespace -using ParticipantManagement::DataModification; - -// Core namespace mit GeoPosition und RelativePosition -namespace Core { - -class GeoPosition { -public: - GeoPosition() : latitude_(0.0), longitude_(0.0), altitude_(0.0) {} - double latitude() const { return latitude_; } - double longitude() const { return longitude_; } - double altitude() const { return altitude_; } - void latitude(double v) { latitude_ = v; } - void longitude(double v) { longitude_ = v; } - void altitude(double v) { altitude_ = v; } -private: - double latitude_; - double longitude_; - double altitude_; -}; - -class RelativePosition { -public: - RelativePosition() : x_(0.0), y_(0.0), z_(0.0) {} - double x() const { return x_; } - double y() const { return y_; } - double z() const { return z_; } - void x(double v) { x_ = v; } - void y(double v) { y_ = v; } - void z(double v) { z_ = v; } -private: - double x_; - double y_; - double z_; -}; - -} // namespace Core - -// StructureElement Stub-Klasse -class StructureElement { -public: - StructureElement() : id_(0), mainStructureElementId_(0), mountingPointTypeId_(MountingPointType::Undefined), mountingPointId_(0) {} - - int32_t id() const { return id_; } - void id(int32_t v) { id_ = v; } - - int32_t mainStructureElementId() const { return mainStructureElementId_; } - void mainStructureElementId(int32_t v) { mainStructureElementId_ = v; } - - MountingPointType mountingPointTypeId() const { return mountingPointTypeId_; } - void mountingPointTypeId(MountingPointType v) { mountingPointTypeId_ = v; } - - // Für Kompatibilität: structureElementTypeId() als Alias - MountingPointType structureElementTypeId() const { return mountingPointTypeId_; } - void structureElementTypeId(MountingPointType v) { mountingPointTypeId_ = v; } - - // mountingPointId() für Sub-ID - int32_t mountingPointId() const { return mountingPointId_; } - void mountingPointId(int32_t v) { mountingPointId_ = v; } - - Core::GeoPosition geoPosition() const { return geoPosition_; } - void geoPosition(const Core::GeoPosition& v) { geoPosition_ = v; } - - Core::RelativePosition relPosition() const { return relPosition_; } - void relPosition(const Core::RelativePosition& v) { relPosition_ = v; } - - std::string properties() const { return properties_; } - void properties(const std::string& v) { properties_ = v; } - - std::string name() const { return name_; } - void name(const std::string& v) { name_ = v; } - - std::string displayName() const { return displayName_; } - void displayName(const std::string& v) { displayName_ = v; } - - // path() returns vector of IDs im Hierarchie-Pfad - const std::vector& path() const { return path_; } - void path(const std::vector& v) { path_ = v; } - -private: - int32_t id_; - int32_t mainStructureElementId_; - MountingPointType mountingPointTypeId_; - int32_t mountingPointId_; - Core::GeoPosition geoPosition_; - Core::RelativePosition relPosition_; - std::string properties_; - std::string name_; - std::string displayName_; - std::vector path_; -}; - -// MainStructureElement - Stub für DDS-generierten Typ -class MainStructureElement { -public: - MainStructureElement() : id_(0), groupId_(0) {} - - int32_t id() const { return id_; } - void id(int32_t v) { id_ = v; } - - int32_t groupId() const { return groupId_; } - void groupId(int32_t v) { groupId_ = v; } - - std::string name() const { return name_; } - void name(const std::string& v) { name_ = v; } - - std::string displayName() const { return displayName_; } - void displayName(const std::string& v) { displayName_ = v; } - - Core::GeoPosition geoPosition() const { return geoPosition_; } - void geoPosition(const Core::GeoPosition& v) { geoPosition_ = v; } - - // For compatibility: elements() returns empty vector by default - const std::vector& elements() const { return elements_; } - void elements(const std::vector& v) { elements_ = v; } - -private: - int32_t id_; - int32_t groupId_; - std::string name_; - std::string displayName_; - Core::GeoPosition geoPosition_; - std::vector elements_; -}; - -// MountingPointAsset - Stub für DDS-generierten Typ -class MountingPointAsset { -public: - MountingPointAsset() : id_(0), mountingPointId_(0), assetId_(0) {} - - int32_t id() const { return id_; } - void id(int32_t v) { id_ = v; } - - int32_t mountingPointId() const { return mountingPointId_; } - void mountingPointId(int32_t v) { mountingPointId_ = v; } - - int32_t assetId() const { return assetId_; } - void assetId(int32_t v) { assetId_ = v; } - - std::string name() const { return name_; } - void name(const std::string& v) { name_ = v; } - - // For compatibility: structureElementId() alias for mountingPointId() - int32_t structureElementId() const { return mountingPointId_; } - void structureElementId(int32_t v) { mountingPointId_ = v; } - -private: - int32_t id_; - int32_t mountingPointId_; - int32_t assetId_; - std::string name_; -}; - -// Forward declaration - full definition in ism_mounting_point.h -class MountingPoint; - -// FootprintElement - für Footprint-Daten -class FootprintElement { -public: - FootprintElement() : isGroundLevel_(false) {} - - bool isGroundLevel() const { return isGroundLevel_; } - void isGroundLevel(bool v) { isGroundLevel_ = v; } - - Core::RelativePosition relPosition() const { return relPosition_; } - void relPosition(const Core::RelativePosition& v) { relPosition_ = v; } - -private: - bool isGroundLevel_; - Core::RelativePosition relPosition_; -}; - -// MainFootprint - Footprint-Daten für MainStructureElement -class MainFootprint { -public: - MainFootprint() : id_(0) {} - - int32_t id() const { return id_; } - void id(int32_t v) { id_ = v; } - - const std::vector& elements() const { return elements_; } - void elements(const std::vector& v) { elements_ = v; } - -private: - int32_t id_; - std::vector elements_; -}; - -// InstrumentationAsset - Stub für DDS-generierten Typ -class InstrumentationAsset { -public: - InstrumentationAsset() : id_(0) {} - - int32_t id() const { return id_; } - void id(int32_t v) { id_ = v; } - - std::string name() const { return name_; } - void name(const std::string& v) { name_ = v; } - -private: - int32_t id_; - std::string name_; -}; - -// StructureElementType Enum (Alias für MountingPointType für Kompatibilität) -using StructureElementType = MountingPointType; - -} // namespace InfrastructureManagement - -#endif // ISM_HPP diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_db_impl.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_db_impl.h deleted file mode 100644 index 3f88295fa..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_db_impl.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @RDE_HEADER@ - * Stub header for CODEGEN_DATABASE generated code (BUILD_RTI=OFF) - * This file is generated by CODEGEN_DATABASE macro when BUILD_RTI=ON - * For BUILD_RTI=OFF builds, this stub provides the minimal interface - */ -#pragma once - -#include -#include - -namespace Database -{ -// Stub struct for IsmMountingPointPlan -struct IsmMountingPointPlan -{ - int scheduleId = 0; - int mountingPointId = 0; - MountingPointState mountingPointState = MountingPointState::Unknown; -}; -} // namespace Database - -namespace InfrastructureManagement -{ - -/** - * @brief Base class for database interface implementation - * - * This class is normally generated by CODEGEN_DATABASE macro. - * This stub provides minimal interface for BUILD_RTI=OFF builds. - */ -class DatabaseInterfaceImpl : public QObject -{ - Q_OBJECT -public: - explicit DatabaseInterfaceImpl(QObject *parent = nullptr) : QObject(parent) {} - virtual ~DatabaseInterfaceImpl() = default; - - // Virtual methods that can be overridden by custom implementations - virtual int copySchedule(int scheduleId) = 0; - virtual bool updateMountingPointPlan(int scheduleId, int mountingPointId, MountingPointState mountingPointState) = 0; - virtual bool deleteMountingPointPlan(int scheduleId, int mountingPointId) = 0; - virtual bool insertMountingPointPlans(const std::vector &mpps) = 0; -}; - -} // namespace InfrastructureManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_dtc.h deleted file mode 100644 index 4a0054ac9..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_ftc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_ftc.h deleted file mode 100644 index 9687b5cff..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/InfrastructureManagement/ism_ftc.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once -// STUB-HEADER: Diese Datei wird normalerweise von ddsftc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace InfrastructureManagement -{ -namespace Interface -{ - class Ftc; -} -} \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/MarkerManagement/mrk_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/MarkerManagement/mrk_dtc.h deleted file mode 100644 index 05ee78b6b..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/MarkerManagement/mrk_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Messaging/msg_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Messaging/msg_dtc.h deleted file mode 100644 index 099ec0f75..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Messaging/msg_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/MeteoDataManagement/mdm_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/MeteoDataManagement/mdm_dtc.h deleted file mode 100644 index c73533537..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/MeteoDataManagement/mdm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/NotificationManagement/nom_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/NotificationManagement/nom_dtc.h deleted file mode 100644 index db2ef45df..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/NotificationManagement/nom_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OcSituationServer/oss_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OcSituationServer/oss_dtc.h deleted file mode 100644 index 199261dd5..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OcSituationServer/oss_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_db.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_db.h deleted file mode 100644 index e9a127637..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_db.h +++ /dev/null @@ -1,133 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von DDS/RTI Codegen generiert -// Für die Migration mit BUILD_RTI=OFF erstellen wir minimale Implementierungen - -#include "opm_enums.hpp" -#include -#include -#include -#include -#include -#include -#include - -namespace OperatorManagement -{ - -// Forward declarations -class Operator; -class Group; - -/** - * @brief Operator class - Stub für DDS-generierten Code - * - * Diese Klasse wird normalerweise von DDS aus opm_service.xml generiert. - * Für BUILD_RTI=OFF verwenden wir diese minimale Implementierung. - */ -class Operator -{ -public: - Operator() - : m_id(0) - , m_groupId(0) - , m_accessLevel(0) - , m_isActive(false) - , m_isHidden(false) - {} - - // Getter - int32_t id() const { return m_id; } - std::string name() const { return m_name.toStdString(); } - QString nameQString() const { return m_name; } - int32_t groupId() const { return m_groupId; } - std::string description() const { return m_description.toStdString(); } - QByteArray image() const { return m_image; } - int32_t accessLevel() const { return m_accessLevel; } - bool isActive() const { return m_isActive; } - bool isHidden() const { return m_isHidden; } - QDateTime created() const { return m_created; } - QDateTime modified() const { return m_modified; } - - // Setter - void setId(int32_t id) { m_id = id; } - void setName(const QString& name) { m_name = name; } - void setName(const std::string& name) { m_name = QString::fromStdString(name); } - void setGroupId(int32_t groupId) { m_groupId = groupId; } - void setDescription(const QString& description) { m_description = description; } - void setImage(const QByteArray& image) { m_image = image; } - void setAccessLevel(int32_t accessLevel) { m_accessLevel = accessLevel; } - void setIsActive(bool active) { m_isActive = active; } - void setIsHidden(bool hidden) { m_isHidden = hidden; } - void setCreated(const QDateTime& created) { m_created = created; } - void setModified(const QDateTime& modified) { m_modified = modified; } - - // Utility - bool isValid() const { return m_id > 0; } - -private: - int32_t m_id; - QString m_name; - int32_t m_groupId; - QString m_description; - QByteArray m_image; - int32_t m_accessLevel; - bool m_isActive; - bool m_isHidden; - QDateTime m_created; - QDateTime m_modified; -}; - -/** - * @brief Group class - Stub für DDS-generierten Code - * - * Diese Klasse wird normalerweise von DDS aus opm_service.xml generiert. - * Für BUILD_RTI=OFF verwenden wir diese minimale Implementierung. - */ -class Group -{ -public: - Group() - : m_id(0) - , m_typeId(0) - , m_isHidden(false) - {} - - // Getter - int32_t id() const { return m_id; } - std::string name() const { return m_name.toStdString(); } - QString nameQString() const { return m_name; } - std::string description() const { return m_description.toStdString(); } - int32_t typeId() const { return m_typeId; } - bool isHidden() const { return m_isHidden; } - std::vector memberIds() const { return m_memberIds; } - - // Setter - void setId(int32_t id) { m_id = id; } - void setName(const QString& name) { m_name = name; } - void setName(const std::string& name) { m_name = QString::fromStdString(name); } - void setDescription(const QString& description) { m_description = description; } - void setTypeId(int32_t typeId) { m_typeId = typeId; } - void setIsHidden(bool hidden) { m_isHidden = hidden; } - void setMemberIds(const std::vector& ids) { m_memberIds = ids; } - - // Utility - bool isValid() const { return m_id > 0; } - void addMember(int32_t operatorId) { m_memberIds.push_back(operatorId); } - void removeMember(int32_t operatorId) - { - m_memberIds.erase( - std::remove(m_memberIds.begin(), m_memberIds.end(), operatorId), - m_memberIds.end()); - } - -private: - int32_t m_id; - QString m_name; - QString m_description; - int32_t m_typeId; - bool m_isHidden; - std::vector m_memberIds; -}; - -} // namespace OperatorManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_dtc.h deleted file mode 100644 index 5a104445e..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_dtc_impl.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_dtc_impl.h deleted file mode 100644 index 7be83491c..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_dtc_impl.h +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @RDE_HEADER@ - * OperatorManagement DTC Implementation - * $Id$ - * $HeadURL$ - * $Author$ - * Stub-Header für Qt6-Migration - ersetzt DDS-generierten Header - */ -#pragma once - -#include -#include -#include - -// Forward declarations für DDS -namespace DDSConnector -{ -class DdsConnector; -} - -// User-Klasse Stub für Qt6-Migration -// Hinweis: Diese Klasse wird normalerweise von DDS generiert -// Dieser Stub stellt die benötigten Methoden für opm_dtc_impl_custom.cpp bereit -class User -{ -public: - int id() const { return m_id; } - QString name() const { return m_name; } - QVector effectiveAcls() const { return m_effectiveAcls; } - - struct VisiblePartyByExercise - { - int exerciseId() const { return m_exerciseId; } - std::optional> visibleParties() const { return m_visibleParties; } - std::optional> hiddenParties() const { return m_hiddenParties; } - QString properties() const { return m_properties; } - - int m_exerciseId = 0; - std::optional> m_visibleParties; - std::optional> m_hiddenParties; - QString m_properties; - }; - - QVector visiblePartiesByExercise() const { return m_visiblePartiesByExercise; } - QVector exerciseIds() const { return m_exerciseIds; } - QString properties() const { return m_properties; } - -private: - int m_id = 0; - QString m_name; - QVector m_effectiveAcls; - QVector m_visiblePartiesByExercise; - QVector m_exerciseIds; - QString m_properties; -}; - -//------------------------------------------------------------------------------------------------------------- -namespace OperatorManagement -{ -namespace Interface -{ -/** - * @brief DtcImpl - Basisklasse für OperatorManagement DTC - * - * Stellt Logger und User-Container für Custom-Implementierungen bereit - * Erbt von FileManagement::DatabaseInterfaceImpl für Datenbank-Zugriff - */ -class DtcImpl : public FileManagement::DatabaseInterfaceImpl -{ -public: - explicit DtcImpl(const std::shared_ptr &ddsConnector) - : FileManagement::DatabaseInterfaceImpl() - , m_ddsConnector(ddsConnector) - { - // Logger wird von DatabaseInterfaceImpl bereitgestellt - // m_logger ist in DatabaseInterfaceImpl definiert - } - - ~DtcImpl() override = default; - - // Virtuelle Methoden für Custom-Implementierung - virtual std::vector getOperatorsByOperatorRight(int operatorRight) = 0; - virtual std::vector operatorForExerciseParty(int exerciseId, int partyId) = 0; - virtual std::vector getNotificationRecipents(int exerciseId, int partyId, int operatorRight, int notificationType) = 0; - virtual bool isAdlerAllowedParty(int exerciseId, int partyId, int operatorId) = 0; - -protected: - std::shared_ptr m_ddsConnector; - QHash m_userCont; // User-Container für Operator-Daten -}; - -} // namespace Interface -} // namespace OperatorManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_ftc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_ftc.h deleted file mode 100644 index f5c6ff045..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/OperatorManagement/opm_ftc.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef OPM_FTC_H -#define OPM_FTC_H - -// Stub header for OperatorManagement FTC functionality -// This file is part of FilterManagement which is excluded from build -// For non-FilterManagement builds, we provide this stub - -#include -#include - -// Forward declarations and stubs for FTC (Filter/Translation/Conversion) -// Actual implementation is in FilterManagement plugin - -class OpmFtc -{ -public: - virtual ~OpmFtc() = default; - // Stub methods - actual implementation in FilterManagement -}; - -#endif // OPM_FTC_H \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm.hpp b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm.hpp deleted file mode 100644 index 378336276..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm.hpp +++ /dev/null @@ -1,182 +0,0 @@ -#pragma once -// STUB-HEADER: Diese Datei wird normalerweise von DDS generiert -// Für die Migration erstellen wir minimale Typ-Definitionen - -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace ParticipantManagement -{ - -// Type - Struct mit id und typeClass (nicht nur Alias!) -struct Type { - int id = 0; - TypeClass typeClass = TypeClass::eUninitialized; - - // Helper methods für Kompatibilität (andere Namen als Member!) - int getId() const { return id; } - TypeClass getTypeClass() const { return typeClass; } -}; - -// Participant - Basisdaten eines Teilnehmers -struct Participant { - int m_id = 0; - QString internalName; - QString externalName; - int typeId = 0; - int partyId = 0; - bool isVerbund = false; - int superiorId = 0; - - // Additional fields as needed - double x = 0.0; - double y = 0.0; - double z = 0.0; - double heading = 0.0; - - // Optional fields (für DDS-Kompatibilität) - std::optional equipmentNumber; - QString m_designator; - QString m_tacticalIdentifier; - - // Helper methods - QString name() const { return internalName; } - QString designator() const { return m_designator; } - QString tacticalIdentifier() const { return m_tacticalIdentifier; } - std::optional getEquipmentNumber() const { return equipmentNumber; } - int id() const { return m_id; } -}; - -// Party - Gruppe/Organisation von Teilnehmern -struct Party { - int id = 0; - QString name; - QString shortName; - int color() const { return 0xFF000000; } // Default schwarz als QRgb -}; - -// ParticipantPosition - Position eines Teilnehmers -struct ParticipantPosition { - int participantId = 0; - double x = 0.0; - double y = 0.0; - double z = 0.0; - double heading = 0.0; - double speed = 0.0; - qint64 timestamp = 0; -}; - -// DynamicParticipantData - Dynamische Teilnehmerdaten -struct DynamicParticipantData { - int participantId = 0; - QString status; - QString role; - qint64 lastUpdate = 0; -}; - -// MainSchedule - Stub für DDS-generierten Typ -struct MainSchedule { - int32_t id = 0; - QString name; - QString description; - qint64 startTime = 0; - qint64 endTime = 0; - bool isActive = false; -}; - -namespace Interface -{ - -// Using-Declaration für DataModification aus Parent-Namespace -using ParticipantManagement::DataModification; - -// Dtc - Data Transfer Component für Participant Management -// DDS-generierte Klasse mit participantChanged Signal -class Dtc : public QObject { - Q_OBJECT - -public: - Dtc() = default; - ~Dtc() override = default; - - // Teilnehmer-Liste abrufen (Callback-basiert wie im Original) - void participants(const std::function& callback) const { - for (const auto& p : m_participants) { - callback(p); - } - } - - // Teilnehmer-Liste als QList (für direkten Zugriff) - QList participantsList() const { return m_participants; } - - // Teilnehmer hinzufügen/entfernen/ändern - void addParticipant(const Participant& p) { - m_participants.append(p); - emit participantChanged(p, DataModification::eAdded); - } - - void updateParticipant(const Participant& p) { - for (auto& existing : m_participants) { - if (existing.m_id == p.m_id) { - existing = p; - emit participantChanged(p, DataModification::eModified); - return; - } - } - addParticipant(p); - } - - void removeParticipant(int id) { - for (auto it = m_participants.begin(); it != m_participants.end(); ++it) { - if (it->m_id == id) { - Participant removed = *it; - m_participants.erase(it); - emit participantChanged(removed, DataModification::eRemoved); - return; - } - } - } - - // Hierarchy-Methoden (STUB) - QString hierarchyFromParticipant(int participantId) const { - Q_UNUSED(participantId); - return QString(); - } - - // Party-Methoden (STUB) - Party party(int partyId) const { - Q_UNUSED(partyId); - return Party(); - } - -signals: - // Signal für Teilnehmer-Änderungen - void participantChanged(const Participant& participant, DataModification modificationType); - -private: - QList m_participants; - QMap m_hierarchies; - QMap m_parties; -}; - -} // namespace Interface - -// Stream operator for logging -inline std::ostream& operator<<(std::ostream& os, const Type& t) { - os << "Type(id=" << t.id << ", typeClass=" << t.typeClass << ")"; - return os; -} - -inline std::ostream& operator<<(std::ostream& os, const Participant& p) { - os << "Participant(id=" << p.m_id << ", name=" << p.name().toStdString() << ")"; - return os; -} - -} // namespace ParticipantManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_db_impl.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_db_impl.h deleted file mode 100644 index 6983236a3..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_db_impl.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @RDE_HEADER@ - * Stub header for CODEGEN_DATABASE generated code (BUILD_RTI=OFF) - * This file is generated by CODEGEN_DATABASE macro when BUILD_RTI=ON - * For BUILD_RTI=OFF builds, this stub provides the minimal interface - */ -#pragma once - -#include - -namespace Database -{ -// Stub struct for EquipmentExerciseMapping -struct EquipmentExerciseMapping -{ - int equipmentId = 0; - int exerciseId = 0; -}; -} // namespace Database - -namespace ParticipantManagement -{ - -/** - * @brief Base class for database interface implementation - * - * This class is normally generated by CODEGEN_DATABASE macro. - * This stub provides minimal interface for BUILD_RTI=OFF builds. - */ -class DatabaseInterfaceImpl : public QObject -{ - Q_OBJECT -public: - explicit DatabaseInterfaceImpl(QObject *parent = nullptr) : QObject(parent) {} - virtual ~DatabaseInterfaceImpl() = default; - - // Virtual methods that can be overridden by custom implementations - virtual bool removeEquipmentExerciseMapping(const Database::EquipmentExerciseMapping &equipmentExerciseMapping) = 0; -}; - -} // namespace ParticipantManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_ftc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_ftc.h deleted file mode 100644 index c01ee6063..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_ftc.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -// DDS-Stub-Header für ParticipantManagement FTC (Filter Topic Client) -// Generiert für Qt6-Migration ohne RTI DDS - -#include -#include -#include -#include -#include - -namespace ParticipantManagement -{ -namespace Interface -{ - -class Ftc -{ -public: - class ModifyTypeReplyHandler - { - public: - virtual ~ModifyTypeReplyHandler() = default; - virtual void onModifyTypeReply(const Core::FunctionReplyObject &replyObject) = 0; - }; - - Ftc() = default; - virtual ~Ftc() = default; - - virtual std::map getTypes() const - { - return std::map(); - } - - virtual Type type(int32_t typeId) const - { - Type t; - t.id = typeId; - return t; - } -}; - -} // namespace Interface -} // namespace ParticipantManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_translation.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_translation.h deleted file mode 100644 index 7a206602f..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_translation.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -// Translation Helper für ParticipantManagement Module -// Wrapper für QObject::tr() in nicht-QObject Klassen - -#include -#include "ppmcommon_export.h" - -namespace ParticipantManagement -{ - -PPMCOMMON_EXPORT QString tr(const char *sourceText, const char *comment = nullptr, int n = -1); - -} // namespace ParticipantManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_types.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_types.h deleted file mode 100644 index 0f41e5471..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ParticipantManagement/ppm_types.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Typ-Definitionen - -#include -#include -#include - -namespace ParticipantManagement -{ - -// STUB: Type - wird durch echten DDS-Typ ersetzt -struct Type -{ - int id = 0; - QString name; - TypeClass typeClass = TypeClass::eUninitialized; - // Weitere Felder werden bei Bedarf ergänzt -}; - -// STUB: Participant - wird durch echten DDS-Typ ersetzt -struct Participant -{ - int id = 0; - QString name; - QString callsign; - Type type; - // Weitere Felder werden bei Bedarf ergänzt -}; - -// Stream-Operator für Logger-Unterstützung -inline std::ostream& operator<<(std::ostream& os, const Participant& participant) -{ - os << "Participant(id=" << participant.id << ", name=" << participant.name.toStdString() - << ", callsign=" << participant.callsign.toStdString() << ")"; - return os; -} - -} // namespace ParticipantManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/PresentationManagement/pre_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/PresentationManagement/pre_dtc.h deleted file mode 100644 index 3e62c25a5..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/PresentationManagement/pre_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_dtc_impl.cpp b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_dtc_impl.cpp deleted file mode 100644 index f65706c09..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_dtc_impl.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/** - * Stub implementation for DtcImpl base class - * Qt6 Migration - provides minimal stub implementations - */ - -#include "pdm_dtc_impl.h" -#include - -namespace ProjectDataManagement -{ -namespace Interface -{ - -DtcImpl::DtcImpl(const std::shared_ptr &ddsConnector) - : m_ddsConnector(ddsConnector) -{ -} - -DtcImpl::~DtcImpl() = default; - -// Data access methods - stub implementations -ChargeTypeData DtcImpl::chargeType(int /*chargeTypeId*/) -{ - return ChargeTypeData(); -} - -IgniterType DtcImpl::igniterType(int /*igniterTypeId*/) -{ - return IgniterType(); -} - -IgniterFunction DtcImpl::igniterFunction(int /*igniterFunctionId*/) -{ - return IgniterFunction(); -} - -LoadType DtcImpl::loadType(int /*loadTypeId*/) -{ - return LoadType(); -} - -GearType DtcImpl::gearType(int /*gearTypeId*/) -{ - return GearType(); -} - -int DtcImpl::targetType(int /*targetTypeId*/) -{ - return 0; -} - -TargetSubType DtcImpl::targetSubType(int /*targetSubTypeId*/) -{ - return TargetSubType(); -} - -// Collection getters - stub implementations -QMap DtcImpl::chargeTypes() -{ - return QMap(); -} - -QVector DtcImpl::igniterTypes() -{ - return QVector(); -} - -QVector DtcImpl::igniterFunctions() -{ - return QVector(); -} - -QVector DtcImpl::loadTypes() -{ - return QVector(); -} - -QVector DtcImpl::gearTypes() -{ - return QVector(); -} - -QVector DtcImpl::targetTypes() -{ - return QVector(); -} - -QVector DtcImpl::targetSubTypes() -{ - return QVector(); -} - -QVector DtcImpl::chargeTypeIgniterTypeIgniterFunctions() -{ - return QVector(); -} - -QVector DtcImpl::chargeTypeLoadTypes() -{ - return QVector(); -} - -QVector DtcImpl::gearTypeChargeTypes() -{ - return QVector(); -} - -QVector DtcImpl::buildingChargeEffects() -{ - return QVector(); -} - -// isEnabled checks - stub implementations -bool DtcImpl::isChargeTypeEnabled() -{ - return false; -} - -bool DtcImpl::isIgniterTypeEnabled() -{ - return false; -} - -bool DtcImpl::isIgniterFunctionEnabled() -{ - return false; -} - -bool DtcImpl::isLoadTypeEnabled() -{ - return false; -} - -bool DtcImpl::isGearTypeEnabled() -{ - return false; -} - -bool DtcImpl::isTargetTypeEnabled() -{ - return false; -} - -bool DtcImpl::isTargetSubTypeEnabled() -{ - return false; -} - -bool DtcImpl::isChargeTypeIgniterTypeIgniterFunctionEnabled() -{ - return false; -} - -bool DtcImpl::isChargeTypeLoadTypeEnabled() -{ - return false; -} - -bool DtcImpl::isGearTypeChargeTypeEnabled() -{ - return false; -} - -bool DtcImpl::isBuildingChargeEffectEnabled() -{ - return false; -} - -// waitForHistoricalData methods - stub implementations -void DtcImpl::waitForHistoricalDataChargeType(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataIgniterType(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataIgniterFunction(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataLoadType(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataGearType(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataTargetType(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataTargetSubType(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataChargeTypeIgniterTypeIgniterFunction(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataChargeTypeLoadType(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataGearTypeChargeType(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataBuildingChargeEffect(int /*timeout_ms*/) -{ -} - -// Additional enable methods for pdm_handler.cpp -void DtcImpl::enableGearType(bool /*enable*/) -{ -} - -void DtcImpl::enableGearTypeChargeType(bool /*enable*/) -{ -} - -void DtcImpl::enableTargetTypeTargetSubType(bool /*enable*/) -{ -} - -void DtcImpl::enableRadioGroup(bool /*enable*/) -{ -} - -void DtcImpl::enableVulnerabilityKind(bool /*enable*/) -{ -} - -void DtcImpl::enableBuildingChargeEffect(bool /*enable*/) -{ -} - -// Additional waitForHistoricalData methods for pdm_handler.cpp -void DtcImpl::waitForHistoricalDataTargetTypeTargetSubType(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataRadioGroup(int /*timeout_ms*/) -{ -} - -void DtcImpl::waitForHistoricalDataVulnerabilityKind(int /*timeout_ms*/) -{ -} - -// Helper methods -QJsonObject DtcImpl::propertiesToJson(const std::string & /*properties*/) -{ - return QJsonObject(); -} - -} // namespace Interface -} // namespace ProjectDataManagement diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_enums.hpp b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_enums.hpp deleted file mode 100644 index 2026b715d..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_enums.hpp +++ /dev/null @@ -1,8 +0,0 @@ -// Stub file for pdm_enums.hpp - includes generated file from build directory -#ifndef PDM_ENUMS_HPP -#define PDM_ENUMS_HPP - -// Include generated enums from build directory -#include - -#endif // PDM_ENUMS_HPP \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_operator_rights.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_operator_rights.h deleted file mode 100644 index 63929e2fc..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_operator_rights.h +++ /dev/null @@ -1,34 +0,0 @@ - -/** -* Operator Rights definitions -*/ - -// warning: this file is generated with command -// Lts/Common/CodeGen/codegen_simple.py ALL Lts/Services/ProjectDataManagement/pdm_service.xml build/Lts/Services/ProjectDataManagement/ -// at Sun Sep 6 18:00:15 2026 -// it will be overwritten by next run - do not modify! - -#pragma once - -namespace ProjectDataManagement -{ - static const int Offset = 29; -} - -namespace OperatorRights -{ -enum Charges -{ - ChargeVisibilityEdit = 0x1d010001, -}; - -enum Groups_ProjectDataManagement -{ - GroupChargeVisibility = 0x1d010000, -}; - -enum Plugins_ProjectDataManagement -{ - PluginCharges = 0x1d010000, -}; -} // namespace OperatorRights diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_translation.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_translation.h deleted file mode 100644 index 47f5b0753..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_translation.h +++ /dev/null @@ -1,7 +0,0 @@ -// Stub file for pdm_translation.h - used when BUILD_GRANTLEE=OFF -#ifndef PDM_TRANSLATION_H -#define PDM_TRANSLATION_H - -// Minimal stub - actual translation generated by codegen when BUILD_GRANTLEE=ON - -#endif // PDM_TRANSLATION_H \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_types.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_types.h deleted file mode 100644 index 0ceaae0c6..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ProjectDataManagement/pdm_types.h +++ /dev/null @@ -1,15 +0,0 @@ -// Stub file for pdm_types.h - used when BUILD_GRANTLEE=OFF -#ifndef PDM_TYPES_H -#define PDM_TYPES_H - -#include - -namespace ProjectDataManagement { - -enum class EventType : std::int32_t { - Unknown = 0 -}; - -} // namespace ProjectDataManagement - -#endif // PDM_TYPES_H \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/RecordingManagement/rec_db_impl.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/RecordingManagement/rec_db_impl.h deleted file mode 100644 index 0d0c218f1..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/RecordingManagement/rec_db_impl.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @RDE_HEADER@ - * Stub header for CODEGEN_DATABASE generated code (BUILD_RTI=OFF) - * This file is generated by CODEGEN_DATABASE macro when BUILD_RTI=ON - * For BUILD_RTI=OFF builds, this stub provides the minimal interface - */ -#pragma once - -#include - -namespace Database -{ -// Stub struct for RecSnapshot -struct RecSnapshot -{ - qint64 id = 0; - // Add other fields as needed -}; -} // namespace Database - -namespace RecordingManagement -{ - -/** - * @brief Base class for database interface implementation - * - * This class is normally generated by CODEGEN_DATABASE macro. - * This stub provides minimal interface for BUILD_RTI=OFF builds. - */ -class DatabaseInterfaceImpl : public QObject -{ - Q_OBJECT -public: - explicit DatabaseInterfaceImpl(QObject *parent = nullptr) : QObject(parent) {} - virtual ~DatabaseInterfaceImpl() = default; - - // Virtual methods that can be overridden by custom implementations - virtual bool removeNewerEqual(const Database::RecSnapshot &data) = 0; -}; - -} // namespace RecordingManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ReportManagement/rep_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ReportManagement/rep_dtc.h deleted file mode 100644 index 80cef325f..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ReportManagement/rep_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ScenarioManagement/scm_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ScenarioManagement/scm_dtc.h deleted file mode 100644 index 6d134cc5b..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/ScenarioManagement/scm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/AreaEffectSimulation/aes.hpp b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/AreaEffectSimulation/aes.hpp deleted file mode 100644 index 78bdb280b..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/AreaEffectSimulation/aes.hpp +++ /dev/null @@ -1,93 +0,0 @@ -#pragma once -// STUB-HEADER: Diese Datei wird normalerweise von DDS generiert -// Für die Migration erstellen wir minimale Typ-Definitionen - -#include -#include -#include - -namespace AreaEffectSimulation -{ - -// Forward declarations -struct ExplosionSingle; -struct EffectCluster; -struct AirSupportImpact; -struct OffRouteMine; -struct TrajectoryAdler; - -// ExplosionSingle - Einzelne Explosion -struct ExplosionSingle { - int id = 0; - double x = 0.0; - double y = 0.0; - double z = 0.0; - double radius = 0.0; - double damage = 0.0; - qint64 timestamp = 0; - QString type; -}; - -// EffectCluster - Gruppe von Effekten -struct EffectCluster { - int id = 0; - QString name; - double x = 0.0; - double y = 0.0; - double z = 0.0; - QList effectIds; - qint64 timestamp = 0; -}; - -// AirSupportImpact - Luftunterstützungseffekt -struct AirSupportImpact { - int id = 0; - double x = 0.0; - double y = 0.0; - double z = 0.0; - QString aircraftType; - QString weaponType; - qint64 timestamp = 0; -}; - -// OffRouteMine - Abseits-Mine -struct OffRouteMine { - int id = 0; - double x = 0.0; - double y = 0.0; - double z = 0.0; - bool active = true; - QString mineType; - qint64 timestamp = 0; -}; - -// TrajectoryAdler - Flugbahn für Adler -struct TrajectoryAdler { - int id = 0; - QList xPoints; - QList yPoints; - QList zPoints; - qint64 timestamp = 0; - QString trajectoryType; -}; - -// AesFilter - Filter für Area Effect Simulation Entities -class AesFilter { -public: - AesFilter() = default; - virtual ~AesFilter() = default; - - // ID getter/setter - int id() const { return m_id; } - void setId(int id) { m_id = id; } - - // Content getter/setter für DDS-Daten - QString content() const { return m_content; } - void setContent(const QString& content) { m_content = content; } - -private: - int m_id = 0; - QString m_content; -}; - -} // namespace AreaEffectSimulation \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/InfrastructureManagement/ism_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/InfrastructureManagement/ism_dtc.h deleted file mode 100644 index b62a281ef..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/InfrastructureManagement/ism_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace InfrastructureManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace InfrastructureManagement diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/InfrastructureManagement/ism_ftc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/InfrastructureManagement/ism_ftc.h deleted file mode 100644 index 9687b5cff..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/InfrastructureManagement/ism_ftc.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once -// STUB-HEADER: Diese Datei wird normalerweise von ddsftc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace InfrastructureManagement -{ -namespace Interface -{ - class Ftc; -} -} \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/PresentationManagement/pre_ftc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/PresentationManagement/pre_ftc.h deleted file mode 100644 index 5750d3dab..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Services/PresentationManagement/pre_ftc.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @file pre_ftc.h - * @brief Stub-Header für PresentationManagement FTC (Filter Topic Client) - * - * Dieser Header ist ein Stub für den von RTI DDS Generator erzeugten Header. - * Ermöglicht Build ohne echte DDS-Codegenerierung wenn BUILD_RTI=OFF. - */ - -#pragma once - -#include -#include - -namespace PresentationManagement -{ - -// Forward declarations -struct Presentation; -struct PresentationContent; -struct GetPresentationContentReply; - -namespace Interface -{ - -/** - * @brief Ftc - Filter Topic Client für Presentation Management - * - * Stub-Implementation für DDS-generierten FTC. - * Gibt nullptr zurück da keine echte DDS-Verbindung verfügbar. - */ -class Ftc -{ - public: - using ModifyTypeReplyHandler = std::function; - - virtual ~Ftc() = default; - - /** - * @brief Factory-Methode zur Erstellung einer Ftc-Instanz - * @param connector DDS-Connector (wird im Stub ignoriert) - * @return Shared Pointer zur Ftc-Instanz (nullptr im Stub) - */ - static std::shared_ptr create(void* /*connector*/) - { - return nullptr; // Stub returns nullptr - actual implementation requires DDS - } - - // PresentationModify Reply Handler - virtual void presentationModifyReply(ModifyTypeReplyHandler /*handler*/) = 0; - - // PresentationRemove Reply Handler - virtual void presentationRemoveReply(ModifyTypeReplyHandler /*handler*/) = 0; - - // GetPresentationContent Reply Handler - virtual void getPresentationContentReply(const GetPresentationContentReply& /*reply*/) = 0; -}; - -} // namespace Interface -} // namespace PresentationManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/SituationReplay/srp_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/SituationReplay/srp_dtc.h deleted file mode 100644 index d781fcfe4..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/SituationReplay/srp_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/SituationReplayManagement/srm_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/SituationReplayManagement/srm_dtc.h deleted file mode 100644 index d89264a56..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/SituationReplayManagement/srm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Skeleton/skl_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Skeleton/skl_dtc.h deleted file mode 100644 index 4bf981988..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/Skeleton/skl_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/SoundManagement/som_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/SoundManagement/som_dtc.h deleted file mode 100644 index e6d35ffcb..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/SoundManagement/som_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/TargetManagement/tgt_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/TargetManagement/tgt_dtc.h deleted file mode 100644 index 8672dd574..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/TargetManagement/tgt_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/TrainingAreaBase/tab_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/TrainingAreaBase/tab_dtc.h deleted file mode 100644 index 0183d35ef..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/TrainingAreaBase/tab_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/TrainingAreaBaseOC/taboc_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/TrainingAreaBaseOC/taboc_dtc.h deleted file mode 100644 index 1f38f39f4..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/TrainingAreaBaseOC/taboc_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/WarehouseGuez/whg_dtc.h b/qt6-after/qt6-migrated-legatus/.forward-declarations/include/WarehouseGuez/whg_dtc.h deleted file mode 100644 index 3ce68dcc2..000000000 --- a/qt6-after/qt6-migrated-legatus/.forward-declarations/include/WarehouseGuez/whg_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/CMakeLists.txt index 0f7d3a0d2..153b4a572 100755 --- a/qt6-after/qt6-migrated-legatus/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/CMakeLists.txt @@ -161,7 +161,6 @@ include_directories(${CMAKE_BINARY_DIR}/Lts/Services/OperatorManagement) # before: every include that resolves today is found in an earlier directory, so no existing # resolution can change. include_directories(${CMAKE_SOURCE_DIR}/Lts/Plugins) -include_directories(${CMAKE_SOURCE_DIR}/forward-declarations) SET(CMAKE_CXX_STANDARD 17) SET(CMAKE_CXX_STANDARD_REQUIRED ON) SET(CMAKE_VISIBILITY_INLINES_HIDDEN ON) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBaseOC/websocket_handler.h b/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBaseOC/websocket_handler.h index 3b3872f4c..009bd0d90 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBaseOC/websocket_handler.h +++ b/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBaseOC/websocket_handler.h @@ -2,7 +2,7 @@ #include "dds_handler.h" #include "logger.h" -#include +#include #include class QTimer; diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/AreaEffectSimulation/object_charge_effect.h b/qt6-after/qt6-migrated-legatus/Lts/Services/AreaEffectSimulation/object_charge_effect.h index 975f25d85..cf4099066 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/AreaEffectSimulation/object_charge_effect.h +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/AreaEffectSimulation/object_charge_effect.h @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/ScreenRecording/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Services/ScreenRecording/CMakeLists.txt index 7525aa5bf..f6d78b9c2 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/ScreenRecording/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/ScreenRecording/CMakeLists.txt @@ -23,6 +23,5 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcScrDummy PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_INSTALL_TARGET(svcScrDummy) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/ServiceManagement/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Services/ServiceManagement/CMakeLists.txt index 092f0516c..25b910f42 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/ServiceManagement/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/ServiceManagement/CMakeLists.txt @@ -47,7 +47,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcScmCommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_TARGET_LINK_LIBRARIES(svcScmCommon PRIVATE @@ -76,7 +75,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcScmClient PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_TARGET_LINK_LIBRARIES(svcScmClient @@ -105,7 +103,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcScmServer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_TARGET_LINK_LIBRARIES(svcScmServer diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/ServiceMonitor/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Services/ServiceMonitor/CMakeLists.txt index 43be5f84c..d1bf0482d 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/ServiceMonitor/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/ServiceMonitor/CMakeLists.txt @@ -23,6 +23,5 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcSmoDummy PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_INSTALL_TARGET(svcSmoDummy) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/SituationMap/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Services/SituationMap/CMakeLists.txt index 0301be17c..308c9ba8b 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/SituationMap/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/SituationMap/CMakeLists.txt @@ -23,6 +23,5 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcMapDummy PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_INSTALL_TARGET(svcMapDummy) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/SituationReplay/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Services/SituationReplay/CMakeLists.txt index 9bf333e00..9afd6b181 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/SituationReplay/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/SituationReplay/CMakeLists.txt @@ -84,7 +84,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcSrpCommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_TARGET_LINK_LIBRARIES(svcSrpCommon PRIVATE @@ -113,7 +112,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcSrpClient PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_TARGET_LINK_LIBRARIES(svcSrpClient @@ -142,7 +140,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcSrpServer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_TARGET_LINK_LIBRARIES(svcSrpServer @@ -231,7 +228,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(SituationReplaySqlite PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/.. - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_TARGET_LINK_LIBRARIES(SituationReplaySqlite $,ddsconnector,> diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/SituationReplayManagement/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Services/SituationReplayManagement/CMakeLists.txt index e041d2b28..db0eb422a 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/SituationReplayManagement/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/SituationReplayManagement/CMakeLists.txt @@ -43,7 +43,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcSrmCommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_TARGET_LINK_LIBRARIES(svcSrmCommon PRIVATE diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/SoundManagement/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Services/SoundManagement/CMakeLists.txt index 823e470fb..6740ce899 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/SoundManagement/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/SoundManagement/CMakeLists.txt @@ -47,7 +47,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcSomCommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_TARGET_LINK_LIBRARIES(svcSomCommon PRIVATE @@ -76,7 +75,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcSomClient PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_TARGET_LINK_LIBRARIES(svcSomClient @@ -106,7 +104,6 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcSomServer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ - ${CMAKE_SOURCE_DIR}/forward-declarations ) NGL_TARGET_LINK_LIBRARIES(svcSomServer diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/Buildings/bld_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/Buildings/bld_dtc.h deleted file mode 100644 index 859411d68..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/Buildings/bld_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -// Stub file for BUILD_GRANTLEE=OFF -// Auto-generated during Qt6 migration -namespace DDS { class Topic; } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/Buildings/bld_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/Buildings/bld_ftc.h deleted file mode 100644 index 5ac72ce7b..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/Buildings/bld_ftc.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -// Stub file for BUILD_GRANTLEE=OFF -// Auto-generated during Qt6 migration diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/ComponentMonitor/cmo_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/ComponentMonitor/cmo_dtc.h deleted file mode 100644 index 859411d68..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/ComponentMonitor/cmo_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -// Stub file for BUILD_GRANTLEE=OFF -// Auto-generated during Qt6 migration -namespace DDS { class Topic; } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/ComponentMonitor/cmo_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/ComponentMonitor/cmo_ftc.h deleted file mode 100644 index 5ac72ce7b..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/ComponentMonitor/cmo_ftc.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -// Stub file for BUILD_GRANTLEE=OFF -// Auto-generated during Qt6 migration diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/GuezNasat/gna_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/GuezNasat/gna_dtc.h deleted file mode 100644 index 859411d68..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/GuezNasat/gna_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -// Stub file for BUILD_GRANTLEE=OFF -// Auto-generated during Qt6 migration -namespace DDS { class Topic; } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/GuezNasat/gna_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/GuezNasat/gna_ftc.h deleted file mode 100644 index 5ac72ce7b..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/GuezNasat/gna_ftc.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -// Stub file for BUILD_GRANTLEE=OFF -// Auto-generated during Qt6 migration diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBase/tab_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBase/tab_dtc.h deleted file mode 100644 index 859411d68..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBase/tab_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -// Stub file for BUILD_GRANTLEE=OFF -// Auto-generated during Qt6 migration -namespace DDS { class Topic; } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBase/tab_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBase/tab_ftc.h deleted file mode 100644 index 5ac72ce7b..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBase/tab_ftc.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -// Stub file for BUILD_GRANTLEE=OFF -// Auto-generated during Qt6 migration diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBaseOC/taboc_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBaseOC/taboc_dtc.h deleted file mode 100644 index 859411d68..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBaseOC/taboc_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -// Stub file for BUILD_GRANTLEE=OFF -// Auto-generated during Qt6 migration -namespace DDS { class Topic; } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBaseOC/taboc_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBaseOC/taboc_ftc.h deleted file mode 100644 index 5ac72ce7b..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Proxies/TrainingAreaBaseOC/taboc_ftc.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -// Stub file for BUILD_GRANTLEE=OFF -// Auto-generated during Qt6 migration diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AlarmManagement/alm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AlarmManagement/alm_dtc.h deleted file mode 100644 index c703ca8e4..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AlarmManagement/alm_dtc.h +++ /dev/null @@ -1,23 +0,0 @@ -// Stub DTC header for AlarmManagement service -// Pre-generated for BUILD_GRANTLEE=OFF - -#ifndef ALM_DTC_H -#define ALM_DTC_H - -#include -#include "alm_export.h" - -namespace AlarmManagement { -namespace Interface { - -class ALM_EXPORT Dtc : public QObject { - Q_OBJECT -public: - explicit Dtc(QObject* parent = nullptr); - virtual ~Dtc(); -}; - -} // namespace Interface -} // namespace AlarmManagement - -#endif // ALM_DTC_H \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AlarmManagement/alm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AlarmManagement/alm_ftc.h deleted file mode 100644 index d045a8bd4..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AlarmManagement/alm_ftc.h +++ /dev/null @@ -1,23 +0,0 @@ -// Stub FTC header for AlarmManagement service -// Pre-generated for BUILD_GRANTLEE=OFF - -#ifndef ALM_FTC_H -#define ALM_FTC_H - -#include -#include "alm_export.h" - -namespace AlarmManagement { -namespace Interface { - -class ALM_EXPORT Ftc : public QObject { - Q_OBJECT -public: - explicit Ftc(QObject* parent = nullptr); - virtual ~Ftc(); -}; - -} // namespace Interface -} // namespace AlarmManagement - -#endif // ALM_FTC_H \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AreaEffectSimulation/aes_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AreaEffectSimulation/aes_dtc.h deleted file mode 100644 index 0fa5c7eda..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AreaEffectSimulation/aes_dtc.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -namespace AreaEffectSimulation { namespace Interface { class Dtc; class Ftc; } } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AreaEffectSimulation/aes_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AreaEffectSimulation/aes_ftc.h deleted file mode 100644 index 0fa5c7eda..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AreaEffectSimulation/aes_ftc.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -namespace AreaEffectSimulation { namespace Interface { class Dtc; class Ftc; } } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AssetManagement/asm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AssetManagement/asm_dtc.h deleted file mode 100644 index 9c62b350a..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AssetManagement/asm_dtc.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -namespace AssetManagement { namespace Interface { class Dtc; class Ftc; } } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AssetManagement/asm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AssetManagement/asm_ftc.h deleted file mode 100644 index 9c62b350a..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AssetManagement/asm_ftc.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -namespace AssetManagement { namespace Interface { class Dtc; class Ftc; } } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/avm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/avm_dtc.h deleted file mode 100644 index d04c4def2..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/avm_dtc.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -namespace AudioVideoManagement { namespace Interface { class Dtc; class Ftc; } } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/avm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/avm_ftc.h deleted file mode 100644 index d04c4def2..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/avm_ftc.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -namespace AudioVideoManagement { namespace Interface { class Dtc; class Ftc; } } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/svcavmcommon_export.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/svcavmcommon_export.h deleted file mode 100644 index 9d3568212..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/AudioVideoManagement/svcavmcommon_export.h +++ /dev/null @@ -1,14 +0,0 @@ -// Stub export header for non-RTI builds -// When BUILD_RTI=OFF, svcAvmCommon library is not built -// This stub allows dependent code to compile -#ifndef SVCAVMCOMMON_EXPORT_H -#define SVCAVMCOMMON_EXPORT_H - -// Map to the actual macro names used in the code -#define SVCAVMCOMMON_EXPORT -#define SVCAVMCOMMON_NO_EXPORT -#define AVM_COMMON_EXPORT -#define AVM_CLIENT_EXPORT -#define AVM_SERVER_EXPORT - -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CentralEffectSimulation/ces_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CentralEffectSimulation/ces_dtc.h deleted file mode 100644 index c4ed6a80f..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CentralEffectSimulation/ces_dtc.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -namespace CentralEffectSimulation { namespace Interface { class Dtc; class Ftc; } } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CentralEffectSimulation/ces_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CentralEffectSimulation/ces_ftc.h deleted file mode 100644 index c4ed6a80f..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CentralEffectSimulation/ces_ftc.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -namespace CentralEffectSimulation { namespace Interface { class Dtc; class Ftc; } } diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CodificationManagement/cod_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CodificationManagement/cod_dtc.h deleted file mode 100644 index 456082327..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CodificationManagement/cod_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CodificationManagement/cod_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CodificationManagement/cod_ftc.h deleted file mode 100644 index 0aad572f6..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/CodificationManagement/cod_ftc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace CodificationManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace CodificationManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowClient/esc_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowClient/esc_dtc.h deleted file mode 100644 index 7344ff4bc..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowClient/esc_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace ESC { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowClient/esc_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowClient/esc_ftc.h deleted file mode 100644 index b21427e1c..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowClient/esc_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace ESC { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowManagement/esm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowManagement/esm_dtc.h deleted file mode 100644 index 038725933..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowManagement/esm_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace ESM { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowManagement/esm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowManagement/esm_ftc.h deleted file mode 100644 index bdbc05f7d..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/EffectShowManagement/esm_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace ESM { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Evaluations/evl_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Evaluations/evl_dtc.h deleted file mode 100644 index 2af4ccb91..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Evaluations/evl_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace EVL { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Evaluations/evl_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Evaluations/evl_ftc.h deleted file mode 100644 index 780b39919..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Evaluations/evl_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace EVL { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseEventManagement/eem_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseEventManagement/eem_dtc.h deleted file mode 100644 index 2539cd69a..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseEventManagement/eem_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseEventManagement/eem_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseEventManagement/eem_ftc.h deleted file mode 100644 index b0144ef7e..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseEventManagement/eem_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef EEM_FTC_H -#define EEM_FTC_H - -// Stub file for eem_ftc.h - generated code placeholder -// This file is auto-generated from eem_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace ExerciseEventManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace ExerciseEventManagement - -#endif // EEM_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseManagement/exm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseManagement/exm_dtc.h deleted file mode 100644 index c4b473296..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseManagement/exm_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace EXM { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseManagement/exm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseManagement/exm_ftc.h deleted file mode 100644 index 8fd2beb67..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ExerciseManagement/exm_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace EXM { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FileManagement/flm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FileManagement/flm_dtc.h deleted file mode 100644 index 59167a11e..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FileManagement/flm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FileManagement/flm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FileManagement/flm_ftc.h deleted file mode 100644 index da7303e1c..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FileManagement/flm_ftc.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @RDE_HEADER@ - * FileManagement Topic Client Stub (BUILD_RTI=OFF) - * Normally generated from flm_service.xml by DDS Code Generator - */ - -#pragma once - -#include - -namespace FileManagement -{ -namespace Interface -{ - -// Forward declaration - actual implementation provided by DDS when BUILD_RTI=ON -class Ftc; - -} // namespace Interface -} // namespace FileManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FilterManagement/flt_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FilterManagement/flt_dtc.h deleted file mode 100644 index 0c5fecf05..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FilterManagement/flt_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace FLT { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FilterManagement/flt_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FilterManagement/flt_ftc.h deleted file mode 100644 index c383b6ecd..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/FilterManagement/flt_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace FLT { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezIedManagement/gim_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezIedManagement/gim_dtc.h deleted file mode 100644 index b18bb76df..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezIedManagement/gim_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace GIM { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezIedManagement/gim_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezIedManagement/gim_ftc.h deleted file mode 100644 index 2350a0176..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezIedManagement/gim_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace GIM { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezMinelayerProcessing/gmp_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezMinelayerProcessing/gmp_dtc.h deleted file mode 100644 index e5791f170..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezMinelayerProcessing/gmp_dtc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GMP_DTC_H -#define GMP_DTC_H - -// Stub file for gmp_dtc.h - generated code placeholder -// This file is auto-generated from gmp_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace GuezMinelayerProcessing { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Dtc; - -} // namespace Dds -} // namespace GuezMinelayerProcessing - -#endif // GMP_DTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezMinelayerProcessing/gmp_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezMinelayerProcessing/gmp_ftc.h deleted file mode 100644 index cab5c2426..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/GuezMinelayerProcessing/gmp_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GMP_FTC_H -#define GMP_FTC_H - -// Stub file for gmp_ftc.h - generated code placeholder -// This file is auto-generated from gmp_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace GuezMinelayerProcessing { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace GuezMinelayerProcessing - -#endif // GMP_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism.hpp b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism.hpp deleted file mode 100644 index 7fa924fdf..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism.hpp +++ /dev/null @@ -1,232 +0,0 @@ -/** - * @file ism.hpp - * @brief DDS-Stub-Header für InfrastructureManagement - * - * Dieser Header ersetzt die von RTI DDS Generator erzeugten Typen. - */ - -#ifndef ISM_HPP -#define ISM_HPP - -#include -#include -#include -#include -#include -#include -#include -#include "ism_enums.hpp" -#include "ParticipantManagement/ppm_enums.hpp" - -// Using-declaration for DataModification -using DataModification = ParticipantManagement::DataModification; - -namespace InfrastructureManagement { - -// Core namespace mit GeoPosition und RelativePosition -namespace Core { - -class GeoPosition { -public: - GeoPosition() : latitude_(0.0), longitude_(0.0), altitude_(0.0) {} - double latitude() const { return latitude_; } - double longitude() const { return longitude_; } - double altitude() const { return altitude_; } - void latitude(double v) { latitude_ = v; } - void longitude(double v) { longitude_ = v; } - void altitude(double v) { altitude_ = v; } -private: - double latitude_; - double longitude_; - double altitude_; -}; - -class RelativePosition { -public: - RelativePosition() : x_(0.0), y_(0.0), z_(0.0) {} - double x() const { return x_; } - double y() const { return y_; } - double z() const { return z_; } - void x(double v) { x_ = v; } - void y(double v) { y_ = v; } - void z(double v) { z_ = v; } -private: - double x_; - double y_; - double z_; -}; - -} // namespace Core - -// StructureElement Stub-Klasse -class StructureElement { -public: - StructureElement() : id_(0), mainStructureElementId_(0), mountingPointTypeId_(MountingPointType::Undefined), mountingPointId_(0) {} - - int32_t id() const { return id_; } - void id(int32_t v) { id_ = v; } - - int32_t mainStructureElementId() const { return mainStructureElementId_; } - void mainStructureElementId(int32_t v) { mainStructureElementId_ = v; } - - MountingPointType mountingPointTypeId() const { return mountingPointTypeId_; } - void mountingPointTypeId(MountingPointType v) { mountingPointTypeId_ = v; } - - // Für Kompatibilität: structureElementTypeId() als Alias - MountingPointType structureElementTypeId() const { return mountingPointTypeId_; } - void structureElementTypeId(MountingPointType v) { mountingPointTypeId_ = v; } - - // mountingPointId() für Sub-ID - int32_t mountingPointId() const { return mountingPointId_; } - void mountingPointId(int32_t v) { mountingPointId_ = v; } - - Core::GeoPosition geoPosition() const { return geoPosition_; } - void geoPosition(const Core::GeoPosition& v) { geoPosition_ = v; } - - Core::RelativePosition relPosition() const { return relPosition_; } - void relPosition(const Core::RelativePosition& v) { relPosition_ = v; } - - std::string properties() const { return properties_; } - void properties(const std::string& v) { properties_ = v; } - - std::string name() const { return name_; } - void name(const std::string& v) { name_ = v; } - - std::string displayName() const { return displayName_; } - void displayName(const std::string& v) { displayName_ = v; } - - // path() returns vector of IDs im Hierarchie-Pfad - const std::vector& path() const { return path_; } - void path(const std::vector& v) { path_ = v; } - -private: - int32_t id_; - int32_t mainStructureElementId_; - MountingPointType mountingPointTypeId_; - int32_t mountingPointId_; - Core::GeoPosition geoPosition_; - Core::RelativePosition relPosition_; - std::string properties_; - std::string name_; - std::string displayName_; - std::vector path_; -}; - -// MainStructureElement - Stub für DDS-generierten Typ -class MainStructureElement { -public: - MainStructureElement() : id_(0), groupId_(0) {} - - int32_t id() const { return id_; } - void id(int32_t v) { id_ = v; } - - int32_t groupId() const { return groupId_; } - void groupId(int32_t v) { groupId_ = v; } - - std::string name() const { return name_; } - void name(const std::string& v) { name_ = v; } - - std::string displayName() const { return displayName_; } - void displayName(const std::string& v) { displayName_ = v; } - - Core::GeoPosition geoPosition() const { return geoPosition_; } - void geoPosition(const Core::GeoPosition& v) { geoPosition_ = v; } - - // For compatibility: elements() returns empty vector by default - const std::vector& elements() const { return elements_; } - void elements(const std::vector& v) { elements_ = v; } - -private: - int32_t id_; - int32_t groupId_; - std::string name_; - std::string displayName_; - Core::GeoPosition geoPosition_; - std::vector elements_; -}; - -// MountingPointAsset - Stub für DDS-generierten Typ -class MountingPointAsset { -public: - MountingPointAsset() : id_(0), mountingPointId_(0), assetId_(0) {} - - int32_t id() const { return id_; } - void id(int32_t v) { id_ = v; } - - int32_t mountingPointId() const { return mountingPointId_; } - void mountingPointId(int32_t v) { mountingPointId_ = v; } - - int32_t assetId() const { return assetId_; } - void assetId(int32_t v) { assetId_ = v; } - - std::string name() const { return name_; } - void name(const std::string& v) { name_ = v; } - - // For compatibility: structureElementId() alias for mountingPointId() - int32_t structureElementId() const { return mountingPointId_; } - void structureElementId(int32_t v) { mountingPointId_ = v; } - -private: - int32_t id_; - int32_t mountingPointId_; - int32_t assetId_; - std::string name_; -}; - -// Forward declaration - full definition in ism_mounting_point.h -class MountingPoint; - -// FootprintElement - für Footprint-Daten -class FootprintElement { -public: - FootprintElement() : isGroundLevel_(false) {} - - bool isGroundLevel() const { return isGroundLevel_; } - void isGroundLevel(bool v) { isGroundLevel_ = v; } - - Core::RelativePosition relPosition() const { return relPosition_; } - void relPosition(const Core::RelativePosition& v) { relPosition_ = v; } - -private: - bool isGroundLevel_; - Core::RelativePosition relPosition_; -}; - -// MainFootprint - Footprint-Daten für MainStructureElement -class MainFootprint { -public: - MainFootprint() : id_(0) {} - - int32_t id() const { return id_; } - void id(int32_t v) { id_ = v; } - - const std::vector& elements() const { return elements_; } - void elements(const std::vector& v) { elements_ = v; } - -private: - int32_t id_; - std::vector elements_; -}; - -// InstrumentationAsset - Stub für DDS-generierten Typ -class InstrumentationAsset { -public: - InstrumentationAsset() : id_(0) {} - - int32_t id() const { return id_; } - void id(int32_t v) { id_ = v; } - - std::string name() const { return name_; } - void name(const std::string& v) { name_ = v; } - -private: - int32_t id_; - std::string name_; -}; - -// StructureElementType Enum (Alias für MountingPointType für Kompatibilität) -using StructureElementType = MountingPointType; - -} // namespace InfrastructureManagement - -#endif // ISM_HPP diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism_dtc.h deleted file mode 100644 index 4a0054ac9..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism_ftc.h deleted file mode 100644 index e20321d57..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/InfrastructureManagement/ism_ftc.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once -// STUB-HEADER: Diese Datei wird normalerweise von ddsftc generiert -// Für die Migration erstellen wir minimale Implementierungen - -#include -#include "ism.hpp" - -namespace InfrastructureManagement -{ -namespace Interface -{ - -// Ftc - Function Transfer Component -class Ftc : public QObject -{ - Q_OBJECT - -public: - Ftc(QObject* parent = nullptr) : QObject(parent) {} - ~Ftc() override = default; - - // MainStructureElement operations - virtual void setMainStructureElement(const MainStructureElement& data) = 0; - virtual void removeMainStructureElement(int32_t id) = 0; - - // MainSchedule operations - virtual void setMainSchedule(const MainSchedule& data) = 0; - virtual void removeMainSchedule(int32_t id) = 0; - - // MountingPointAsset operations - virtual void setMountingPointAsset(const MountingPointAsset& data) = 0; - virtual void removeMountingPointAsset(int32_t id) = 0; -}; - -} // namespace Interface -} // namespace InfrastructureManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/mrk_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/mrk_dtc.h deleted file mode 100644 index 05ee78b6b..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/mrk_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/mrk_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/mrk_ftc.h deleted file mode 100644 index f95a9d333..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/mrk_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MRK_FTC_H -#define MRK_FTC_H - -// Stub file for mrk_ftc.h - generated code placeholder -// This file is auto-generated from mrk_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace MarkerManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace MarkerManagement - -#endif // MRK_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/svcmrkcommon_export.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/svcmrkcommon_export.h deleted file mode 100644 index e17b6e31b..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MarkerManagement/svcmrkcommon_export.h +++ /dev/null @@ -1,8 +0,0 @@ -// Stub export header for non-RTI builds -#ifndef SVCMRKCOMMON_EXPORT_H -#define SVCMRKCOMMON_EXPORT_H - -#define SVCMRKCOMMON_EXPORT -#define SVCMRKCOMMON_NO_EXPORT - -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Messaging/msg_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Messaging/msg_dtc.h deleted file mode 100644 index 099ec0f75..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Messaging/msg_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Messaging/msg_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Messaging/msg_ftc.h deleted file mode 100644 index cf94d39ad..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/Messaging/msg_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MSG_FTC_H -#define MSG_FTC_H - -// Stub file for msg_ftc.h - generated code placeholder -// This file is auto-generated from msg_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace Messaging { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace Messaging - -#endif // MSG_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MeteoDataManagement/mdm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MeteoDataManagement/mdm_dtc.h deleted file mode 100644 index c73533537..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MeteoDataManagement/mdm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MeteoDataManagement/mdm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MeteoDataManagement/mdm_ftc.h deleted file mode 100644 index 297c3e14b..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/MeteoDataManagement/mdm_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MDM_FTC_H -#define MDM_FTC_H - -// Stub file for mdm_ftc.h - generated code placeholder -// This file is auto-generated from mdm_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace MeteoDataManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace MeteoDataManagement - -#endif // MDM_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NmeaManagement/nme_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NmeaManagement/nme_dtc.h deleted file mode 100644 index 8b4130862..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NmeaManagement/nme_dtc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef NME_DTC_H -#define NME_DTC_H - -// Stub file for nme_dtc.h - generated code placeholder -// This file is auto-generated from nme_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace NmeaManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Dtc; - -} // namespace Dds -} // namespace NmeaManagement - -#endif // NME_DTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NmeaManagement/nme_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NmeaManagement/nme_ftc.h deleted file mode 100644 index e1c7f5bda..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NmeaManagement/nme_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef NME_FTC_H -#define NME_FTC_H - -// Stub file for nme_ftc.h - generated code placeholder -// This file is auto-generated from nme_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace NmeaManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace NmeaManagement - -#endif // NME_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NotificationManagement/nom_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NotificationManagement/nom_dtc.h deleted file mode 100644 index 79d7b43e9..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NotificationManagement/nom_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace NOM { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NotificationManagement/nom_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NotificationManagement/nom_ftc.h deleted file mode 100644 index 496bb11a5..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/NotificationManagement/nom_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace NOM { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcBaseDownload/obd_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcBaseDownload/obd_dtc.h deleted file mode 100644 index 762795109..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcBaseDownload/obd_dtc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef OBD_DTC_H -#define OBD_DTC_H - -// Stub file for obd_dtc.h - generated code placeholder -// This file is auto-generated from obd_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace OcBaseDownload { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Dtc; - -} // namespace Dds -} // namespace OcBaseDownload - -#endif // OBD_DTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcBaseDownload/obd_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcBaseDownload/obd_ftc.h deleted file mode 100644 index e006e5857..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcBaseDownload/obd_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef OBD_FTC_H -#define OBD_FTC_H - -// Stub file for obd_ftc.h - generated code placeholder -// This file is auto-generated from obd_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace OcBaseDownload { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace OcBaseDownload - -#endif // OBD_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationClient/osc_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationClient/osc_dtc.h deleted file mode 100644 index 77f1cb2ea..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationClient/osc_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace OSC { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationClient/osc_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationClient/osc_ftc.h deleted file mode 100644 index 8b56f9854..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationClient/osc_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace OSC { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationServer/oss_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationServer/oss_dtc.h deleted file mode 100644 index 6695a5a57..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationServer/oss_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace OSS { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationServer/oss_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationServer/oss_ftc.h deleted file mode 100644 index 29af724ca..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OcSituationServer/oss_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace OSS { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OnlineReports/ore_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OnlineReports/ore_dtc.h deleted file mode 100644 index a54fd2cfd..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OnlineReports/ore_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace ORE { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OnlineReports/ore_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OnlineReports/ore_ftc.h deleted file mode 100644 index d53867deb..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OnlineReports/ore_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace ORE { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OperatorManagement/opm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OperatorManagement/opm_dtc.h deleted file mode 100644 index 5a104445e..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OperatorManagement/opm_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OperatorManagement/opm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OperatorManagement/opm_ftc.h deleted file mode 100644 index f5c6ff045..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/OperatorManagement/opm_ftc.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef OPM_FTC_H -#define OPM_FTC_H - -// Stub header for OperatorManagement FTC functionality -// This file is part of FilterManagement which is excluded from build -// For non-FilterManagement builds, we provide this stub - -#include -#include - -// Forward declarations and stubs for FTC (Filter/Translation/Conversion) -// Actual implementation is in FilterManagement plugin - -class OpmFtc -{ -public: - virtual ~OpmFtc() = default; - // Stub methods - actual implementation in FilterManagement -}; - -#endif // OPM_FTC_H \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ParticipantManagement/ppm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ParticipantManagement/ppm_dtc.h deleted file mode 100644 index fb62c60ef..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ParticipantManagement/ppm_dtc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef PPM_DTC_H -#define PPM_DTC_H - -// Stub file for ppm_dtc.h - generated code placeholder -// This file is auto-generated from ppm_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace ParticipantManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Dtc; - -} // namespace Dds -} // namespace ParticipantManagement - -#endif // PPM_DTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ParticipantManagement/ppm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ParticipantManagement/ppm_ftc.h deleted file mode 100644 index c01ee6063..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ParticipantManagement/ppm_ftc.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -// DDS-Stub-Header für ParticipantManagement FTC (Filter Topic Client) -// Generiert für Qt6-Migration ohne RTI DDS - -#include -#include -#include -#include -#include - -namespace ParticipantManagement -{ -namespace Interface -{ - -class Ftc -{ -public: - class ModifyTypeReplyHandler - { - public: - virtual ~ModifyTypeReplyHandler() = default; - virtual void onModifyTypeReply(const Core::FunctionReplyObject &replyObject) = 0; - }; - - Ftc() = default; - virtual ~Ftc() = default; - - virtual std::map getTypes() const - { - return std::map(); - } - - virtual Type type(int32_t typeId) const - { - Type t; - t.id = typeId; - return t; - } -}; - -} // namespace Interface -} // namespace ParticipantManagement \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PlanEditor/ped_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PlanEditor/ped_dtc.h deleted file mode 100644 index fd52b4efb..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PlanEditor/ped_dtc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef PED_DTC_H -#define PED_DTC_H - -// Stub file for ped_dtc.h - generated code placeholder -// This file is auto-generated from ped_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace PlanEditor { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Dtc; - -} // namespace Dds -} // namespace PlanEditor - -#endif // PED_DTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PlanEditor/ped_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PlanEditor/ped_ftc.h deleted file mode 100644 index b9dc828b7..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PlanEditor/ped_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef PED_FTC_H -#define PED_FTC_H - -// Stub file for ped_ftc.h - generated code placeholder -// This file is auto-generated from ped_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace PlanEditor { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace PlanEditor - -#endif // PED_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PresentationManagement/pre_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PresentationManagement/pre_dtc.h deleted file mode 100644 index 3e62c25a5..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PresentationManagement/pre_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PresentationManagement/pre_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PresentationManagement/pre_ftc.h deleted file mode 100644 index 7fc492f0e..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/PresentationManagement/pre_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef PRE_FTC_H -#define PRE_FTC_H - -// Stub file for pre_ftc.h - generated code placeholder -// This file is auto-generated from pre_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace PresentationManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace PresentationManagement - -#endif // PRE_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectDataManagement/pdm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectDataManagement/pdm_dtc.h deleted file mode 100644 index d422dcdf6..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectDataManagement/pdm_dtc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef PDM_DTC_H -#define PDM_DTC_H - -// Stub file for pdm_dtc.h - generated code placeholder -// This file is auto-generated from pdm_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace ProjectDataManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Dtc; - -} // namespace Dds -} // namespace ProjectDataManagement - -#endif // PDM_DTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectDataManagement/pdm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectDataManagement/pdm_ftc.h deleted file mode 100644 index 587bf0734..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectDataManagement/pdm_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef PDM_FTC_H -#define PDM_FTC_H - -// Stub file for pdm_ftc.h - generated code placeholder -// This file is auto-generated from pdm_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace ProjectDataManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace ProjectDataManagement - -#endif // PDM_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectionWorkstation/pws_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectionWorkstation/pws_dtc.h deleted file mode 100644 index 9f76c9653..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectionWorkstation/pws_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace PWS { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectionWorkstation/pws_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectionWorkstation/pws_ftc.h deleted file mode 100644 index 2b2bb6f74..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ProjectionWorkstation/pws_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace PWS { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RecordingManagement/rec_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RecordingManagement/rec_dtc.h deleted file mode 100644 index 7edbe9cbf..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RecordingManagement/rec_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace REC { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RecordingManagement/rec_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RecordingManagement/rec_ftc.h deleted file mode 100644 index 4fb8bd0f2..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RecordingManagement/rec_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace REC { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ReportManagement/rep_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ReportManagement/rep_dtc.h deleted file mode 100644 index 80cef325f..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ReportManagement/rep_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ReportManagement/rep_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ReportManagement/rep_ftc.h deleted file mode 100644 index 7a7d4b46d..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/ReportManagement/rep_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef REP_FTC_H -#define REP_FTC_H - -// Stub file for rep_ftc.h - generated code placeholder -// This file is auto-generated from rep_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace ReportManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace ReportManagement - -#endif // REP_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RoutingServiceNG/rsc_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RoutingServiceNG/rsc_dtc.h deleted file mode 100644 index eaaabc0ea..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RoutingServiceNG/rsc_dtc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef RSC_DTC_H -#define RSC_DTC_H - -// Stub file for rsc_dtc.h - generated code placeholder -// This file is auto-generated from rsc_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace RoutingServiceNG { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Dtc; - -} // namespace Dds -} // namespace RoutingServiceNG - -#endif // RSC_DTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RoutingServiceNG/rsc_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RoutingServiceNG/rsc_ftc.h deleted file mode 100644 index cc8867fe5..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/RoutingServiceNG/rsc_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef RSC_FTC_H -#define RSC_FTC_H - -// Stub file for rsc_ftc.h - generated code placeholder -// This file is auto-generated from rsc_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace RoutingServiceNG { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace RoutingServiceNG - -#endif // RSC_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/TargetManagement/tgt_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/TargetManagement/tgt_dtc.h deleted file mode 100644 index 8672dd574..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/TargetManagement/tgt_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/TargetManagement/tgt_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/TargetManagement/tgt_ftc.h deleted file mode 100644 index 52f874580..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/TargetManagement/tgt_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef TGT_FTC_H -#define TGT_FTC_H - -// Stub file for tgt_ftc.h - generated code placeholder -// This file is auto-generated from tgt_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace TargetManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace TargetManagement - -#endif // TGT_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/WarehouseGuez/whg_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/WarehouseGuez/whg_dtc.h deleted file mode 100644 index 3ce68dcc2..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/WarehouseGuez/whg_dtc.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// STUB-HEADER: Include generated file from build directory -#include diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/WarehouseGuez/whg_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/WarehouseGuez/whg_ftc.h deleted file mode 100644 index 20f40eab6..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/Lts/Services/WarehouseGuez/whg_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef WHG_FTC_H -#define WHG_FTC_H - -// Stub file for whg_ftc.h - generated code placeholder -// This file is auto-generated from whg_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace WarehouseGuez { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace WarehouseGuez - -#endif // WHG_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/aes_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/aes_dtc.h deleted file mode 100644 index 53d8cdb02..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/aes_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace AreaEffectSimulation -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace AreaEffectSimulation diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/alm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/alm_dtc.h deleted file mode 100644 index 48fc0cc57..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/alm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace AlarmManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace AlarmManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/asm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/asm_dtc.h deleted file mode 100644 index 085fecaf1..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/asm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace AssetManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace AssetManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/avm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/avm_dtc.h deleted file mode 100644 index 6ebbe52b0..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/avm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace AudioVideoManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace AudioVideoManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/bld_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/bld_dtc.h deleted file mode 100644 index 1a97ff37a..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/bld_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace Buildings -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace Buildings diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/ces_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/ces_dtc.h deleted file mode 100644 index afdb06c40..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/ces_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace CentralEffectSimulation -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace CentralEffectSimulation diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/cmo_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/cmo_dtc.h deleted file mode 100644 index 451073155..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/cmo_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace ComponentMonitor -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace ComponentMonitor diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/cod_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/cod_dtc.h deleted file mode 100644 index 0aad572f6..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/cod_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace CodificationManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace CodificationManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/core_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/core_dtc.h deleted file mode 100644 index 47120f2bd..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/core_dtc.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace DDS -{ -namespace Core -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace Core -} // namespace DDS diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/eem_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/eem_dtc.h deleted file mode 100644 index ce5c860f8..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/eem_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace ExerciseEventManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace ExerciseEventManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/esc_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/esc_dtc.h deleted file mode 100644 index d91be8274..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/esc_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace EffectShowClient -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace EffectShowClient diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/esm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/esm_dtc.h deleted file mode 100644 index d73623e87..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/esm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace EffectShowManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace EffectShowManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/evl_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/evl_dtc.h deleted file mode 100644 index 89207e684..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/evl_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace Evaluations -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace Evaluations diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/exm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/exm_dtc.h deleted file mode 100644 index d9f59111e..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/exm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace ExerciseManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace ExerciseManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/flm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/flm_dtc.h deleted file mode 100644 index 9a997306f..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/flm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace FileManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace FileManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/generic_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/generic_dtc.h deleted file mode 100644 index 32e9318f2..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/generic_dtc.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once -#include -#include - -namespace NGLLogger -{ -class INGLLogger; -} - -namespace DTC -{ -class SubscriberListener; - -template class GenericDtcSC -{ - public: - using DataReaderObject = DRO_OBJECT; - using SubscriberCallback = SC; - using TopicType = typename DRO_OBJECT::TopicType; - - GenericDtcSC() = default; - virtual ~GenericDtcSC() = default; - - virtual bool setSubscriberCallback(const SubscriberCallback& subscriberCallback) = 0; - virtual dds::sub::LoanedSamples readAlive() const = 0; - virtual dds::sub::LoanedSamples takeAlive() const = 0; - virtual dds::sub::LoanedSamples takeDisposed() const = 0; - virtual bool hasSamples() const = 0; - virtual DataReaderObject* dataReader() const = 0; - virtual bool waitForHistoricalData(int timeoutMSec) = 0; -}; - -template -class GenericDtc - : public GenericDtcSC> -{ -}; - -template -class GenericDtcSampleInfo - : public GenericDtcSC> -{ -}; - -template -class Ddtc - : public GenericDtcSC< - DRO_OBJECT, std::function> -{ -}; - -template -class DdtcSampleInfo - : public GenericDtcSC> -{ -}; -} // namespace DTC diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/gim_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/gim_dtc.h deleted file mode 100644 index 1f16e4e83..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/gim_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace GuezIedManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace GuezIedManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/gna_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/gna_dtc.h deleted file mode 100644 index 47d51ae59..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/gna_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace GuezNasat -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace GuezNasat diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/ism_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/ism_dtc.h deleted file mode 100644 index b62a281ef..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/ism_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace InfrastructureManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace InfrastructureManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/map_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/map_dtc.h deleted file mode 100644 index d25533e40..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/map_dtc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MAP_DTC_H -#define MAP_DTC_H - -// Stub file for map_dtc.h - generated code placeholder -// This file is auto-generated from map_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace SituationMap { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Dtc; - -} // namespace Dds -} // namespace SituationMap - -#endif // MAP_DTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/map_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/map_ftc.h deleted file mode 100644 index bcda59da6..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/map_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MAP_FTC_H -#define MAP_FTC_H - -// Stub file for map_ftc.h - generated code placeholder -// This file is auto-generated from map_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace SituationMap { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace SituationMap - -#endif // MAP_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/mdm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/mdm_dtc.h deleted file mode 100644 index 9efa8bfc7..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/mdm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace MeteoDataManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace MeteoDataManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/mrk_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/mrk_dtc.h deleted file mode 100644 index d9dc88001..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/mrk_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace MarkerManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace MarkerManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/msg_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/msg_dtc.h deleted file mode 100644 index e6a935b68..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/msg_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace Messaging -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace Messaging diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/nom_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/nom_dtc.h deleted file mode 100644 index 62a762723..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/nom_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace NotificationManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace NotificationManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/opm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/opm_dtc.h deleted file mode 100644 index c69e9ca0e..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/opm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace OperatorManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace OperatorManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/oss_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/oss_dtc.h deleted file mode 100644 index cd1ffb381..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/oss_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace OcSituationServer -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace OcSituationServer diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dtc.h deleted file mode 100644 index 9002af552..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace ProjectDataManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace ProjectDataManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dtc_types.h b/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dtc_types.h deleted file mode 100644 index d8e1354c7..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dtc_types.h +++ /dev/null @@ -1,385 +0,0 @@ - -/** -* DTC definitions -*/ - -// warning: this file is generated with command -// Lts/Common/CodeGen/codegen_simple.py ALL Lts/Services/ProjectDataManagement/pdm_service.xml build/Lts/Services/ProjectDataManagement/ -// at Sun Sep 6 18:00:15 2026 -// it will be overwritten by next run - do not modify! - -#pragma once - -#include "pdm.hpp" - -/** - * Type definitions - * => DataTopicClients (DTCs) - */ - -namespace DDSGeneric -{ -template -class GenericDataReader; -template -class GenericDataReaderContentFilter; -class DynamicDataReader; -} - -namespace DTC -{ - template class GenericDtc; - template class GenericDtcImpl; - template class GenericDtcSampleInfo; - template class GenericDtcImplSampleInfo; - - // Topic ProjectDataManagement::BiteComponentText - using DroBiteComponentText = DDSGeneric::GenericDataReader; - using BiteComponentText = GenericDtc; - using BiteComponentTextImpl = GenericDtcImpl; - using DroBiteComponentTextCF = DDSGeneric::GenericDataReaderContentFilter; - using BiteComponentTextCF = GenericDtc; - using BiteComponentTextCFImpl = GenericDtcImpl; - namespace SampleInfo { - using BiteComponentText = GenericDtcSampleInfo; - using BiteComponentTextImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::BuildingChargeEffect - using DroBuildingChargeEffect = DDSGeneric::GenericDataReader; - using BuildingChargeEffect = GenericDtc; - using BuildingChargeEffectImpl = GenericDtcImpl; - using DroBuildingChargeEffectCF = DDSGeneric::GenericDataReaderContentFilter; - using BuildingChargeEffectCF = GenericDtc; - using BuildingChargeEffectCFImpl = GenericDtcImpl; - namespace SampleInfo { - using BuildingChargeEffect = GenericDtcSampleInfo; - using BuildingChargeEffectImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::CanComponentString - using DroCanComponentString = DDSGeneric::GenericDataReader; - using CanComponentString = GenericDtc; - using CanComponentStringImpl = GenericDtcImpl; - using DroCanComponentStringCF = DDSGeneric::GenericDataReaderContentFilter; - using CanComponentStringCF = GenericDtc; - using CanComponentStringCFImpl = GenericDtcImpl; - namespace SampleInfo { - using CanComponentString = GenericDtcSampleInfo; - using CanComponentStringImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::ChargeType - using DroChargeType = DDSGeneric::GenericDataReader; - using ChargeType = GenericDtc; - using ChargeTypeImpl = GenericDtcImpl; - using DroChargeTypeCF = DDSGeneric::GenericDataReaderContentFilter; - using ChargeTypeCF = GenericDtc; - using ChargeTypeCFImpl = GenericDtcImpl; - namespace SampleInfo { - using ChargeType = GenericDtcSampleInfo; - using ChargeTypeImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunction - using DroChargeTypeIgniterTypeIgniterFunction = DDSGeneric::GenericDataReader; - using ChargeTypeIgniterTypeIgniterFunction = GenericDtc; - using ChargeTypeIgniterTypeIgniterFunctionImpl = GenericDtcImpl; - using DroChargeTypeIgniterTypeIgniterFunctionCF = DDSGeneric::GenericDataReaderContentFilter; - using ChargeTypeIgniterTypeIgniterFunctionCF = GenericDtc; - using ChargeTypeIgniterTypeIgniterFunctionCFImpl = GenericDtcImpl; - namespace SampleInfo { - using ChargeTypeIgniterTypeIgniterFunction = GenericDtcSampleInfo; - using ChargeTypeIgniterTypeIgniterFunctionImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::ChargeTypeLoadType - using DroChargeTypeLoadType = DDSGeneric::GenericDataReader; - using ChargeTypeLoadType = GenericDtc; - using ChargeTypeLoadTypeImpl = GenericDtcImpl; - using DroChargeTypeLoadTypeCF = DDSGeneric::GenericDataReaderContentFilter; - using ChargeTypeLoadTypeCF = GenericDtc; - using ChargeTypeLoadTypeCFImpl = GenericDtcImpl; - namespace SampleInfo { - using ChargeTypeLoadType = GenericDtcSampleInfo; - using ChargeTypeLoadTypeImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::EquipmentSystemEventFilter - using DroEquipmentSystemEventFilter = DDSGeneric::GenericDataReader; - using EquipmentSystemEventFilter = GenericDtc; - using EquipmentSystemEventFilterImpl = GenericDtcImpl; - using DroEquipmentSystemEventFilterCF = DDSGeneric::GenericDataReaderContentFilter; - using EquipmentSystemEventFilterCF = GenericDtc; - using EquipmentSystemEventFilterCFImpl = GenericDtcImpl; - namespace SampleInfo { - using EquipmentSystemEventFilter = GenericDtcSampleInfo; - using EquipmentSystemEventFilterImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::EventFilterHgrMineSearch - using DroEventFilterHgrMineSearch = DDSGeneric::GenericDataReader; - using EventFilterHgrMineSearch = GenericDtc; - using EventFilterHgrMineSearchImpl = GenericDtcImpl; - using DroEventFilterHgrMineSearchCF = DDSGeneric::GenericDataReaderContentFilter; - using EventFilterHgrMineSearchCF = GenericDtc; - using EventFilterHgrMineSearchCFImpl = GenericDtcImpl; - namespace SampleInfo { - using EventFilterHgrMineSearch = GenericDtcSampleInfo; - using EventFilterHgrMineSearchImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::FirePurpose - using DroFirePurpose = DDSGeneric::GenericDataReader; - using FirePurpose = GenericDtc; - using FirePurposeImpl = GenericDtcImpl; - using DroFirePurposeCF = DDSGeneric::GenericDataReaderContentFilter; - using FirePurposeCF = GenericDtc; - using FirePurposeCFImpl = GenericDtcImpl; - namespace SampleInfo { - using FirePurpose = GenericDtcSampleInfo; - using FirePurposeImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::GearType - using DroGearType = DDSGeneric::GenericDataReader; - using GearType = GenericDtc; - using GearTypeImpl = GenericDtcImpl; - using DroGearTypeCF = DDSGeneric::GenericDataReaderContentFilter; - using GearTypeCF = GenericDtc; - using GearTypeCFImpl = GenericDtcImpl; - namespace SampleInfo { - using GearType = GenericDtcSampleInfo; - using GearTypeImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::GearTypeChargeType - using DroGearTypeChargeType = DDSGeneric::GenericDataReader; - using GearTypeChargeType = GenericDtc; - using GearTypeChargeTypeImpl = GenericDtcImpl; - using DroGearTypeChargeTypeCF = DDSGeneric::GenericDataReaderContentFilter; - using GearTypeChargeTypeCF = GenericDtc; - using GearTypeChargeTypeCFImpl = GenericDtcImpl; - namespace SampleInfo { - using GearTypeChargeType = GenericDtcSampleInfo; - using GearTypeChargeTypeImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::IgniterFunction - using DroIgniterFunction = DDSGeneric::GenericDataReader; - using IgniterFunction = GenericDtc; - using IgniterFunctionImpl = GenericDtcImpl; - using DroIgniterFunctionCF = DDSGeneric::GenericDataReaderContentFilter; - using IgniterFunctionCF = GenericDtc; - using IgniterFunctionCFImpl = GenericDtcImpl; - namespace SampleInfo { - using IgniterFunction = GenericDtcSampleInfo; - using IgniterFunctionImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::IgniterType - using DroIgniterType = DDSGeneric::GenericDataReader; - using IgniterType = GenericDtc; - using IgniterTypeImpl = GenericDtcImpl; - using DroIgniterTypeCF = DDSGeneric::GenericDataReaderContentFilter; - using IgniterTypeCF = GenericDtc; - using IgniterTypeCFImpl = GenericDtcImpl; - namespace SampleInfo { - using IgniterType = GenericDtcSampleInfo; - using IgniterTypeImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::LanguageHmi - using DroLanguageHmi = DDSGeneric::GenericDataReader; - using LanguageHmi = GenericDtc; - using LanguageHmiImpl = GenericDtcImpl; - using DroLanguageHmiCF = DDSGeneric::GenericDataReaderContentFilter; - using LanguageHmiCF = GenericDtc; - using LanguageHmiCFImpl = GenericDtcImpl; - namespace SampleInfo { - using LanguageHmi = GenericDtcSampleInfo; - using LanguageHmiImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::LanguageXdu - using DroLanguageXdu = DDSGeneric::GenericDataReader; - using LanguageXdu = GenericDtc; - using LanguageXduImpl = GenericDtcImpl; - using DroLanguageXduCF = DDSGeneric::GenericDataReaderContentFilter; - using LanguageXduCF = GenericDtc; - using LanguageXduCFImpl = GenericDtcImpl; - namespace SampleInfo { - using LanguageXdu = GenericDtcSampleInfo; - using LanguageXduImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::LoadType - using DroLoadType = DDSGeneric::GenericDataReader; - using LoadType = GenericDtc; - using LoadTypeImpl = GenericDtcImpl; - using DroLoadTypeCF = DDSGeneric::GenericDataReaderContentFilter; - using LoadTypeCF = GenericDtc; - using LoadTypeCFImpl = GenericDtcImpl; - namespace SampleInfo { - using LoadType = GenericDtcSampleInfo; - using LoadTypeImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::NuclearPreset - using DroNuclearPreset = DDSGeneric::GenericDataReader; - using NuclearPreset = GenericDtc; - using NuclearPresetImpl = GenericDtcImpl; - using DroNuclearPresetCF = DDSGeneric::GenericDataReaderContentFilter; - using NuclearPresetCF = GenericDtc; - using NuclearPresetCFImpl = GenericDtcImpl; - namespace SampleInfo { - using NuclearPreset = GenericDtcSampleInfo; - using NuclearPresetImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::RadioGroup - using DroRadioGroup = DDSGeneric::GenericDataReader; - using RadioGroup = GenericDtc; - using RadioGroupImpl = GenericDtcImpl; - using DroRadioGroupCF = DDSGeneric::GenericDataReaderContentFilter; - using RadioGroupCF = GenericDtc; - using RadioGroupCFImpl = GenericDtcImpl; - namespace SampleInfo { - using RadioGroup = GenericDtcSampleInfo; - using RadioGroupImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::SanitationInjury - using DroSanitationInjury = DDSGeneric::GenericDataReader; - using SanitationInjury = GenericDtc; - using SanitationInjuryImpl = GenericDtcImpl; - using DroSanitationInjuryCF = DDSGeneric::GenericDataReaderContentFilter; - using SanitationInjuryCF = GenericDtc; - using SanitationInjuryCFImpl = GenericDtcImpl; - namespace SampleInfo { - using SanitationInjury = GenericDtcSampleInfo; - using SanitationInjuryImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::SanitationInjuryKind - using DroSanitationInjuryKind = DDSGeneric::GenericDataReader; - using SanitationInjuryKind = GenericDtc; - using SanitationInjuryKindImpl = GenericDtcImpl; - using DroSanitationInjuryKindCF = DDSGeneric::GenericDataReaderContentFilter; - using SanitationInjuryKindCF = GenericDtc; - using SanitationInjuryKindCFImpl = GenericDtcImpl; - namespace SampleInfo { - using SanitationInjuryKind = GenericDtcSampleInfo; - using SanitationInjuryKindImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::SanitationInjuryPlace1 - using DroSanitationInjuryPlace1 = DDSGeneric::GenericDataReader; - using SanitationInjuryPlace1 = GenericDtc; - using SanitationInjuryPlace1Impl = GenericDtcImpl; - using DroSanitationInjuryPlace1CF = DDSGeneric::GenericDataReaderContentFilter; - using SanitationInjuryPlace1CF = GenericDtc; - using SanitationInjuryPlace1CFImpl = GenericDtcImpl; - namespace SampleInfo { - using SanitationInjuryPlace1 = GenericDtcSampleInfo; - using SanitationInjuryPlace1Impl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::SanitationInjuryPlace2 - using DroSanitationInjuryPlace2 = DDSGeneric::GenericDataReader; - using SanitationInjuryPlace2 = GenericDtc; - using SanitationInjuryPlace2Impl = GenericDtcImpl; - using DroSanitationInjuryPlace2CF = DDSGeneric::GenericDataReaderContentFilter; - using SanitationInjuryPlace2CF = GenericDtc; - using SanitationInjuryPlace2CFImpl = GenericDtcImpl; - namespace SampleInfo { - using SanitationInjuryPlace2 = GenericDtcSampleInfo; - using SanitationInjuryPlace2Impl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::SanitationMaterial - using DroSanitationMaterial = DDSGeneric::GenericDataReader; - using SanitationMaterial = GenericDtc; - using SanitationMaterialImpl = GenericDtcImpl; - using DroSanitationMaterialCF = DDSGeneric::GenericDataReaderContentFilter; - using SanitationMaterialCF = GenericDtc; - using SanitationMaterialCFImpl = GenericDtcImpl; - namespace SampleInfo { - using SanitationMaterial = GenericDtcSampleInfo; - using SanitationMaterialImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::SanitationProcedure - using DroSanitationProcedure = DDSGeneric::GenericDataReader; - using SanitationProcedure = GenericDtc; - using SanitationProcedureImpl = GenericDtcImpl; - using DroSanitationProcedureCF = DDSGeneric::GenericDataReaderContentFilter; - using SanitationProcedureCF = GenericDtc; - using SanitationProcedureCFImpl = GenericDtcImpl; - namespace SampleInfo { - using SanitationProcedure = GenericDtcSampleInfo; - using SanitationProcedureImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::TargetSubType - using DroTargetSubType = DDSGeneric::GenericDataReader; - using TargetSubType = GenericDtc; - using TargetSubTypeImpl = GenericDtcImpl; - using DroTargetSubTypeCF = DDSGeneric::GenericDataReaderContentFilter; - using TargetSubTypeCF = GenericDtc; - using TargetSubTypeCFImpl = GenericDtcImpl; - namespace SampleInfo { - using TargetSubType = GenericDtcSampleInfo; - using TargetSubTypeImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::TargetType - using DroTargetType = DDSGeneric::GenericDataReader; - using TargetType = GenericDtc; - using TargetTypeImpl = GenericDtcImpl; - using DroTargetTypeCF = DDSGeneric::GenericDataReaderContentFilter; - using TargetTypeCF = GenericDtc; - using TargetTypeCFImpl = GenericDtcImpl; - namespace SampleInfo { - using TargetType = GenericDtcSampleInfo; - using TargetTypeImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::TargetTypeTargetSubType - using DroTargetTypeTargetSubType = DDSGeneric::GenericDataReader; - using TargetTypeTargetSubType = GenericDtc; - using TargetTypeTargetSubTypeImpl = GenericDtcImpl; - using DroTargetTypeTargetSubTypeCF = DDSGeneric::GenericDataReaderContentFilter; - using TargetTypeTargetSubTypeCF = GenericDtc; - using TargetTypeTargetSubTypeCFImpl = GenericDtcImpl; - namespace SampleInfo { - using TargetTypeTargetSubType = GenericDtcSampleInfo; - using TargetTypeTargetSubTypeImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::TranslationBlob - using DroTranslationBlob = DDSGeneric::GenericDataReader; - using TranslationBlob = GenericDtc; - using TranslationBlobImpl = GenericDtcImpl; - using DroTranslationBlobCF = DDSGeneric::GenericDataReaderContentFilter; - using TranslationBlobCF = GenericDtc; - using TranslationBlobCFImpl = GenericDtcImpl; - namespace SampleInfo { - using TranslationBlob = GenericDtcSampleInfo; - using TranslationBlobImpl = GenericDtcImplSampleInfo; - } - - // Topic ProjectDataManagement::VulnerabilityKind - using DroVulnerabilityKind = DDSGeneric::GenericDataReader; - using VulnerabilityKind = GenericDtc; - using VulnerabilityKindImpl = GenericDtcImpl; - using DroVulnerabilityKindCF = DDSGeneric::GenericDataReaderContentFilter; - using VulnerabilityKindCF = GenericDtc; - using VulnerabilityKindCFImpl = GenericDtcImpl; - namespace SampleInfo { - using VulnerabilityKind = GenericDtcSampleInfo; - using VulnerabilityKindImpl = GenericDtcImplSampleInfo; - } - -} // namespace DTC - diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dts_types.h b/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dts_types.h deleted file mode 100644 index 20eb10a2d..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_dts_types.h +++ /dev/null @@ -1,236 +0,0 @@ - -/** -* DTS definitions -*/ - -// warning: this file is generated with command -// Lts/Common/CodeGen/codegen_simple.py ALL Lts/Services/ProjectDataManagement/pdm_service.xml build/Lts/Services/ProjectDataManagement/ -// at Sun Sep 6 18:00:15 2026 -// it will be overwritten by next run - do not modify! - -#pragma once - -#include "pdm.hpp" - -/** - * Type definitions - * => DataWriterObjects (DWOs) - * => DataTopicServers (DTSs) - */ - -namespace DDSGeneric -{ -template -class GenericDataWriter; -} - -namespace DTS -{ - template class GenericDts; - template class GenericDtsImpl; - - // Topic ProjectDataManagement::BiteComponentText - // Interface - using BiteComponentText = GenericDts; - // Interface impl - using DwoBiteComponentText = DDSGeneric::GenericDataWriter; - using BiteComponentTextImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::BuildingChargeEffect - // Interface - using BuildingChargeEffect = GenericDts; - // Interface impl - using DwoBuildingChargeEffect = DDSGeneric::GenericDataWriter; - using BuildingChargeEffectImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::CanComponentString - // Interface - using CanComponentString = GenericDts; - // Interface impl - using DwoCanComponentString = DDSGeneric::GenericDataWriter; - using CanComponentStringImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::ChargeType - // Interface - using ChargeType = GenericDts; - // Interface impl - using DwoChargeType = DDSGeneric::GenericDataWriter; - using ChargeTypeImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunction - // Interface - using ChargeTypeIgniterTypeIgniterFunction = GenericDts; - // Interface impl - using DwoChargeTypeIgniterTypeIgniterFunction = DDSGeneric::GenericDataWriter; - using ChargeTypeIgniterTypeIgniterFunctionImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::ChargeTypeLoadType - // Interface - using ChargeTypeLoadType = GenericDts; - // Interface impl - using DwoChargeTypeLoadType = DDSGeneric::GenericDataWriter; - using ChargeTypeLoadTypeImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::EquipmentSystemEventFilter - // Interface - using EquipmentSystemEventFilter = GenericDts; - // Interface impl - using DwoEquipmentSystemEventFilter = DDSGeneric::GenericDataWriter; - using EquipmentSystemEventFilterImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::EventFilterHgrMineSearch - // Interface - using EventFilterHgrMineSearch = GenericDts; - // Interface impl - using DwoEventFilterHgrMineSearch = DDSGeneric::GenericDataWriter; - using EventFilterHgrMineSearchImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::FirePurpose - // Interface - using FirePurpose = GenericDts; - // Interface impl - using DwoFirePurpose = DDSGeneric::GenericDataWriter; - using FirePurposeImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::GearType - // Interface - using GearType = GenericDts; - // Interface impl - using DwoGearType = DDSGeneric::GenericDataWriter; - using GearTypeImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::GearTypeChargeType - // Interface - using GearTypeChargeType = GenericDts; - // Interface impl - using DwoGearTypeChargeType = DDSGeneric::GenericDataWriter; - using GearTypeChargeTypeImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::IgniterFunction - // Interface - using IgniterFunction = GenericDts; - // Interface impl - using DwoIgniterFunction = DDSGeneric::GenericDataWriter; - using IgniterFunctionImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::IgniterType - // Interface - using IgniterType = GenericDts; - // Interface impl - using DwoIgniterType = DDSGeneric::GenericDataWriter; - using IgniterTypeImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::LanguageHmi - // Interface - using LanguageHmi = GenericDts; - // Interface impl - using DwoLanguageHmi = DDSGeneric::GenericDataWriter; - using LanguageHmiImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::LanguageXdu - // Interface - using LanguageXdu = GenericDts; - // Interface impl - using DwoLanguageXdu = DDSGeneric::GenericDataWriter; - using LanguageXduImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::LoadType - // Interface - using LoadType = GenericDts; - // Interface impl - using DwoLoadType = DDSGeneric::GenericDataWriter; - using LoadTypeImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::NuclearPreset - // Interface - using NuclearPreset = GenericDts; - // Interface impl - using DwoNuclearPreset = DDSGeneric::GenericDataWriter; - using NuclearPresetImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::RadioGroup - // Interface - using RadioGroup = GenericDts; - // Interface impl - using DwoRadioGroup = DDSGeneric::GenericDataWriter; - using RadioGroupImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::SanitationInjury - // Interface - using SanitationInjury = GenericDts; - // Interface impl - using DwoSanitationInjury = DDSGeneric::GenericDataWriter; - using SanitationInjuryImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::SanitationInjuryKind - // Interface - using SanitationInjuryKind = GenericDts; - // Interface impl - using DwoSanitationInjuryKind = DDSGeneric::GenericDataWriter; - using SanitationInjuryKindImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::SanitationInjuryPlace1 - // Interface - using SanitationInjuryPlace1 = GenericDts; - // Interface impl - using DwoSanitationInjuryPlace1 = DDSGeneric::GenericDataWriter; - using SanitationInjuryPlace1Impl = GenericDtsImpl; - - // Topic ProjectDataManagement::SanitationInjuryPlace2 - // Interface - using SanitationInjuryPlace2 = GenericDts; - // Interface impl - using DwoSanitationInjuryPlace2 = DDSGeneric::GenericDataWriter; - using SanitationInjuryPlace2Impl = GenericDtsImpl; - - // Topic ProjectDataManagement::SanitationMaterial - // Interface - using SanitationMaterial = GenericDts; - // Interface impl - using DwoSanitationMaterial = DDSGeneric::GenericDataWriter; - using SanitationMaterialImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::SanitationProcedure - // Interface - using SanitationProcedure = GenericDts; - // Interface impl - using DwoSanitationProcedure = DDSGeneric::GenericDataWriter; - using SanitationProcedureImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::TargetSubType - // Interface - using TargetSubType = GenericDts; - // Interface impl - using DwoTargetSubType = DDSGeneric::GenericDataWriter; - using TargetSubTypeImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::TargetType - // Interface - using TargetType = GenericDts; - // Interface impl - using DwoTargetType = DDSGeneric::GenericDataWriter; - using TargetTypeImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::TargetTypeTargetSubType - // Interface - using TargetTypeTargetSubType = GenericDts; - // Interface impl - using DwoTargetTypeTargetSubType = DDSGeneric::GenericDataWriter; - using TargetTypeTargetSubTypeImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::TranslationBlob - // Interface - using TranslationBlob = GenericDts; - // Interface impl - using DwoTranslationBlob = DDSGeneric::GenericDataWriter; - using TranslationBlobImpl = GenericDtsImpl; - - // Topic ProjectDataManagement::VulnerabilityKind - // Interface - using VulnerabilityKind = GenericDts; - // Interface impl - using DwoVulnerabilityKind = DDSGeneric::GenericDataWriter; - using VulnerabilityKindImpl = GenericDtsImpl; - -} // namespace DTS - diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_ftc_types.h b/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_ftc_types.h deleted file mode 100644 index 027049819..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_ftc_types.h +++ /dev/null @@ -1,64 +0,0 @@ - -/** -* FTC definitions -*/ - -// warning: this file is generated with command -// Lts/Common/CodeGen/codegen_simple.py ALL Lts/Services/ProjectDataManagement/pdm_service.xml build/Lts/Services/ProjectDataManagement/ -// at Sun Sep 6 18:00:15 2026 -// it will be overwritten by next run - do not modify! - -#pragma once - -#include "pdm.hpp" - -namespace FTC -{ -template class GenericFtcImpl; -template struct TopicNames; -} -namespace ProjectDataManagement -{ - // TypeDefinitions for Replies that are not implemented => using Core::FunctionReply - using InsertUpdateTranslationReply = Core::FunctionReply; - using UpdateChargeNamesReply = Core::FunctionReply; - using UpdateChargeTypeRequest = ProjectDataManagement::ChargeType; - using UpdateChargeTypeReply = Core::FunctionReply; -} // namespace ProjectDataManagement - - -namespace FTC -{ - // TypeDefinitions for GenericFtcImpl - class InsertUpdateTranslationTemplateHelperDummy; - using InsertUpdateTranslation = GenericFtcImpl; - template<> struct TopicNames { - static constexpr const char *functionTopicName() { return "InsertUpdateTranslation"; } - static constexpr const char *replyTopicName() { return "LTS_InsertUpdateTranslationReply"; } - static constexpr const char *replyTopicTypeName() { return "ProjectDataManagement::InsertUpdateTranslationReply"; } - static constexpr const char *requestTopicName() { return "LTS_InsertUpdateTranslationRequest"; } - static constexpr const char *requestTopicTypeName() { return "ProjectDataManagement::InsertUpdateTranslationRequest"; } - }; - - class UpdateChargeNamesTemplateHelperDummy; - using UpdateChargeNames = GenericFtcImpl; - template<> struct TopicNames { - static constexpr const char *functionTopicName() { return "UpdateChargeNames"; } - static constexpr const char *replyTopicName() { return "LTS_UpdateChargeNamesReply"; } - static constexpr const char *replyTopicTypeName() { return "ProjectDataManagement::UpdateChargeNamesReply"; } - static constexpr const char *requestTopicName() { return "LTS_UpdateChargeNamesRequest"; } - static constexpr const char *requestTopicTypeName() { return "ProjectDataManagement::UpdateChargeNamesRequest"; } - }; - - class UpdateChargeTypeTemplateHelperDummy; - using UpdateChargeType = GenericFtcImpl; - template<> struct TopicNames { - static constexpr const char *functionTopicName() { return "UpdateChargeType"; } - static constexpr const char *replyTopicName() { return "LTS_UpdateChargeTypeReply"; } - static constexpr const char *replyTopicTypeName() { return "ProjectDataManagement::UpdateChargeTypeReply"; } - static constexpr const char *requestTopicName() { return "LTS_UpdateChargeTypeRequest"; } - static constexpr const char *requestTopicTypeName() { return "ProjectDataManagement::UpdateChargeTypeRequest"; } - }; - -} // namespace FTC - diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_fts_types.h b/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_fts_types.h deleted file mode 100644 index 3734eb039..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_fts_types.h +++ /dev/null @@ -1,64 +0,0 @@ - -/** -* FTS definitions -*/ - -// warning: this file is generated with command -// Lts/Common/CodeGen/codegen_simple.py ALL Lts/Services/ProjectDataManagement/pdm_service.xml build/Lts/Services/ProjectDataManagement/ -// at Sun Sep 6 18:00:15 2026 -// it will be overwritten by next run - do not modify! - -#pragma once - -#include "pdm.hpp" - -namespace FTS -{ -template class GenericFtsImpl; -template struct TopicNames; -} -namespace ProjectDataManagement -{ - // TypeDefinitions for Replies that are not implemented => using Core::FunctionReply - using InsertUpdateTranslationReply = Core::FunctionReply; - using UpdateChargeNamesReply = Core::FunctionReply; - using UpdateChargeTypeRequest = ProjectDataManagement::ChargeType; - using UpdateChargeTypeReply = Core::FunctionReply; -} // namespace ProjectDataManagement - - -namespace FTS -{ - // TypeDefinitions for GenericFtsImpl - class InsertUpdateTranslationTemplateHelperDummy; - using InsertUpdateTranslation = GenericFtsImpl; - template<> struct TopicNames { - static constexpr const char *functionTopicName() { return "InsertUpdateTranslation"; } - static constexpr const char *replyTopicName() { return "LTS_InsertUpdateTranslationReply"; } - static constexpr const char *replyTopicTypeName() { return "ProjectDataManagement::InsertUpdateTranslationReply"; } - static constexpr const char *requestTopicName() { return "LTS_InsertUpdateTranslationRequest"; } - static constexpr const char *requestTopicTypeName() { return "ProjectDataManagement::InsertUpdateTranslationRequest"; } - }; - - class UpdateChargeNamesTemplateHelperDummy; - using UpdateChargeNames = GenericFtsImpl; - template<> struct TopicNames { - static constexpr const char *functionTopicName() { return "UpdateChargeNames"; } - static constexpr const char *replyTopicName() { return "LTS_UpdateChargeNamesReply"; } - static constexpr const char *replyTopicTypeName() { return "ProjectDataManagement::UpdateChargeNamesReply"; } - static constexpr const char *requestTopicName() { return "LTS_UpdateChargeNamesRequest"; } - static constexpr const char *requestTopicTypeName() { return "ProjectDataManagement::UpdateChargeNamesRequest"; } - }; - - class UpdateChargeTypeTemplateHelperDummy; - using UpdateChargeType = GenericFtsImpl; - template<> struct TopicNames { - static constexpr const char *functionTopicName() { return "UpdateChargeType"; } - static constexpr const char *replyTopicName() { return "LTS_UpdateChargeTypeReply"; } - static constexpr const char *replyTopicTypeName() { return "ProjectDataManagement::UpdateChargeTypeReply"; } - static constexpr const char *requestTopicName() { return "LTS_UpdateChargeTypeRequest"; } - static constexpr const char *requestTopicTypeName() { return "ProjectDataManagement::UpdateChargeTypeRequest"; } - }; - -} // namespace FTS - diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_operator_rights.h b/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_operator_rights.h deleted file mode 100644 index 63929e2fc..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/pdm_operator_rights.h +++ /dev/null @@ -1,34 +0,0 @@ - -/** -* Operator Rights definitions -*/ - -// warning: this file is generated with command -// Lts/Common/CodeGen/codegen_simple.py ALL Lts/Services/ProjectDataManagement/pdm_service.xml build/Lts/Services/ProjectDataManagement/ -// at Sun Sep 6 18:00:15 2026 -// it will be overwritten by next run - do not modify! - -#pragma once - -namespace ProjectDataManagement -{ - static const int Offset = 29; -} - -namespace OperatorRights -{ -enum Charges -{ - ChargeVisibilityEdit = 0x1d010001, -}; - -enum Groups_ProjectDataManagement -{ - GroupChargeVisibility = 0x1d010000, -}; - -enum Plugins_ProjectDataManagement -{ - PluginCharges = 0x1d010000, -}; -} // namespace OperatorRights diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/ppm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/ppm_dtc.h deleted file mode 100644 index 6b29b3f6c..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/ppm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace ParticipantManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace ParticipantManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/pre_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/pre_dtc.h deleted file mode 100644 index ad127f9d8..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/pre_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace PresentationManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/rep_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/rep_dtc.h deleted file mode 100644 index a5c0fbce0..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/rep_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace ReportManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace ReportManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/scm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/scm_dtc.h deleted file mode 100644 index 22d8d9a43..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/scm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace ServiceManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace ServiceManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/scm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/scm_ftc.h deleted file mode 100644 index b36ed360b..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/scm_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef SCM_FTC_H -#define SCM_FTC_H - -// Stub file for scm_ftc.h - generated code placeholder -// This file is auto-generated from scm_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace ServiceManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace ServiceManagement - -#endif // SCM_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/scr_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/scr_dtc.h deleted file mode 100644 index 46daa6d12..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/scr_dtc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef SCR_DTC_H -#define SCR_DTC_H - -// Stub file for scr_dtc.h - generated code placeholder -// This file is auto-generated from scr_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace ScreenRecording { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Dtc; - -} // namespace Dds -} // namespace ScreenRecording - -#endif // SCR_DTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/scr_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/scr_ftc.h deleted file mode 100644 index a261845fb..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/scr_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef SCR_FTC_H -#define SCR_FTC_H - -// Stub file for scr_ftc.h - generated code placeholder -// This file is auto-generated from scr_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace ScreenRecording { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace ScreenRecording - -#endif // SCR_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/skl_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/skl_dtc.h deleted file mode 100644 index 313cf92cd..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/skl_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace Skeleton -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace Skeleton diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/smo_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/smo_dtc.h deleted file mode 100644 index ac58c6768..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/smo_dtc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_DTC_H -#define _STUB_DTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace SMO { - class Dtc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/smo_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/smo_ftc.h deleted file mode 100644 index aa0bfc0d7..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/smo_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace SMO { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/som_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/som_dtc.h deleted file mode 100644 index 0956c4a91..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/som_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace SoundManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace SoundManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/som_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/som_ftc.h deleted file mode 100644 index 2b354ecfc..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/som_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef SOM_FTC_H -#define SOM_FTC_H - -// Stub file for som_ftc.h - generated code placeholder -// This file is auto-generated from som_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace SoundManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace SoundManagement - -#endif // SOM_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/srm_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/srm_dtc.h deleted file mode 100644 index 452338f5e..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/srm_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace SituationReplayManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace SituationReplayManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/srm_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/srm_ftc.h deleted file mode 100644 index 144295c5f..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/srm_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef SRM_FTC_H -#define SRM_FTC_H - -// Stub file for srm_ftc.h - generated code placeholder -// This file is auto-generated from srm_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace SituationReplayManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace SituationReplayManagement - -#endif // SRM_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/srp_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/srp_dtc.h deleted file mode 100644 index 71662d223..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/srp_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace SituationReplay -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace SituationReplay diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/srp_ftc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/srp_ftc.h deleted file mode 100644 index 3fba1cd96..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/srp_ftc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STUB_FTC_H -#define _STUB_FTC_H -// Stub file for BUILD_GRANTLEE=OFF -namespace SRP { - class Ftc {}; -} -#endif diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/tab_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/tab_dtc.h deleted file mode 100644 index c81da3ffd..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/tab_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace TrainingAreaBase -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace TrainingAreaBase diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/taboc_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/taboc_dtc.h deleted file mode 100644 index 5e5e69eb8..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/taboc_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace TrainingAreaBaseOC -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace TrainingAreaBaseOC diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/tgt_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/tgt_dtc.h deleted file mode 100644 index e105df868..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/tgt_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace TargetManagement -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace TargetManagement diff --git a/qt6-after/qt6-migrated-legatus/forward-declarations/whg_dtc.h b/qt6-after/qt6-migrated-legatus/forward-declarations/whg_dtc.h deleted file mode 100644 index 6bdff0ea4..000000000 --- a/qt6-after/qt6-migrated-legatus/forward-declarations/whg_dtc.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// STUB-HEADER: Diese Datei wird normalerweise von ddsdtc generiert -// Für die Migration erstellen wir minimale Forward-Declarations - -namespace WarehouseGuez -{ -namespace Interface -{ -class Dtc; -class Ftc; -} // namespace Interface -} // namespace WarehouseGuez diff --git a/qt6-after/qt6-migrated-legatus/tests/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/tests/CMakeLists.txt index 87b1a30c7..24a910068 100644 --- a/qt6-after/qt6-migrated-legatus/tests/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/tests/CMakeLists.txt @@ -65,11 +65,6 @@ if(BUILD_TESTING) list(FILTER EXISTING_SOURCES EXCLUDE REGEX "test_lts_app_descriptor_editor\\.cpp") # Exclude Qt Test-based tests (conflict with gtest main()) list(FILTER EXISTING_SOURCES EXCLUDE REGEX "test_lts_app_descriptor\\.cpp") - # Exclude test_skl_dtc: "Skeleton" is a placeholder service (no source - # dir, no svcSklCommon target, no codegen output). Its stub header was - # converted to a build-dir wrapper (commit 5501d1e5) that includes a - # non-existent generated file, so the compilation test cannot resolve. - list(FILTER EXISTING_SOURCES EXCLUDE REGEX "test_skl_dtc\\.cpp") # Exclude Grantlee-related tests when BUILD_GRANTLEE is OFF if(NOT BUILD_GRANTLEE) diff --git a/qt6-after/qt6-migrated-legatus/tests/test_migration_stubs.cpp b/qt6-after/qt6-migrated-legatus/tests/test_migration_stubs.cpp index 60537fbe1..164475162 100644 --- a/qt6-after/qt6-migrated-legatus/tests/test_migration_stubs.cpp +++ b/qt6-after/qt6-migrated-legatus/tests/test_migration_stubs.cpp @@ -216,12 +216,3 @@ TEST(MigrationStubs, GenericDtcCompiles) // Verify GenericDtc template is accessible EXPECT_TRUE(true); } - -// AES DTC (root level) - uses AreaEffectSimulation::Interface namespace -#include "aes_dtc.h" - -TEST(MigrationStubs, AesDtcCompiles) -{ - using namespace AreaEffectSimulation::Interface; - EXPECT_TRUE(true); -} diff --git a/qt6-after/qt6-migrated-legatus/tests/test_skl_dtc.cpp b/qt6-after/qt6-migrated-legatus/tests/test_skl_dtc.cpp deleted file mode 100644 index c6ac37a24..000000000 --- a/qt6-after/qt6-migrated-legatus/tests/test_skl_dtc.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @file test_skl_dtc.cpp - * @brief Compilation test for the Skeleton forward-declaration stub - * - * This test verifies that the migrated header compiles correctly with Qt6/C++23. - * Skeleton has no build target in the merged tree (module removed), so the - * header is the forward-declaration stub in the allowed stub directory - * (relocated from include/ by the merge; content unchanged). - */ - -#include "../.forward-declarations/include/Skeleton/skl_dtc.h" - -#include - -TEST(skl_dtc_Compilation, HeaderCompiles) -{ - // This test verifies that the header compiles without errors - EXPECT_TRUE(true); -} From 3f7beb3c7e5e23002830abc7c630a468e687bf50 Mon Sep 17 00:00:00 2001 From: Berrux Kana Date: Mon, 5 Oct 2026 10:44:49 +0200 Subject: [PATCH 2/2] 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 $> (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). --- qt6-after/qt6-migrated-legatus/CMakeLists.txt | 10 + .../Application/AarApp/databases_model.cpp | 10 +- .../Lts/Application/AarApp/databases_model.h | 4 +- .../Lts/Application/OpApp/CMakeLists.txt | 2 +- .../Lts/Application/OpApp/main.cpp | 12 +- .../Lts/Application/THP/CMakeLists.txt | 2 +- .../Lts/Application/THP/thp_viewer.cpp | 7 +- .../THP/thpwidgets/thp_html_widget.cpp | 7 +- .../Common/LtsAppManager/lts_app_manager.cpp | 2 +- .../Common/LtsLogin/logout_info_dialog.cpp | 2 +- .../Lts/Common/LtsLogin/lts_login.cpp | 8 +- .../LtsPluginManager/lts_plugin_manager.cpp | 2 +- .../Lts/Common/LtsSession/CMakeLists.txt | 9 +- .../Gui/Script/ScriptEditor/CMakeLists.txt | 81 + .../Gui/Script/ScriptEditor/filter_topic.cpp | 17 + .../Gui/Script/ScriptEditor/filter_topic.h | 28 + .../ScriptEditor/pre_journal_dialog.cpp | 81 + .../Script/ScriptEditor/pre_journal_dialog.h | 37 + .../Script/ScriptEditor/pre_journal_dialog.ui | 49 + .../Script/ScriptEditor/pre_journal_types.cpp | 90 + .../Script/ScriptEditor/pre_journal_types.h | 131 + .../Gui/Script/ScriptEditor/pre_screen.cpp | 35 + .../Gui/Script/ScriptEditor/pre_screen.h | 18 + .../Script/ScriptEditor/pre_script_dialog.cpp | 3377 +++++++++++++++++ .../Script/ScriptEditor/pre_script_dialog.h | 402 ++ .../Script/ScriptEditor/pre_script_dialog.ui | 320 ++ .../ScriptEditor/pre_script_gui_plugin.cpp | 376 ++ .../ScriptEditor/pre_script_gui_plugin.h | 100 + .../Script/ScriptEditor/pre_storyboard.cpp | 152 + .../Gui/Script/ScriptEditor/pre_storyboard.h | 50 + .../Gui/Script/ScriptEditor/pre_storyboard.ui | 49 + .../pre_topic_designer_dialog.cpp | 69 + .../ScriptEditor/pre_topic_designer_dialog.h | 57 + .../ScriptEditor/pre_topic_designer_dialog.ui | 122 + .../OldTHP/CMakeLists.txt | 17 + .../OldTHP/Common/CMakeLists.txt | 43 + .../OldTHP/Common/logger.cpp | 37 + .../OldTHP/Common/logger.h | 22 + .../Common/tpm_exported_scripts_model.cpp | 632 +++ .../Common/tpm_exported_scripts_model.h | 99 + .../OldTHP/Common/tpm_process_dialog.cpp | 66 + .../OldTHP/Common/tpm_process_dialog.h | 32 + .../OldTHP/Common/tpm_process_dialog.ui | 174 + .../OldTHP/ThpManagement/CMakeLists.txt | 48 + .../OldTHP/ThpManagement/logger.cpp | 37 + .../OldTHP/ThpManagement/logger.h | 22 + .../tpm_exported_scripts_dialog.cpp | 1244 ++++++ .../tpm_exported_scripts_dialog.h | 214 ++ .../tpm_exported_scripts_dialog.ui | 77 + .../OldTHP/ThpManagement/tpm_gui_plugin.cpp | 60 + .../OldTHP/ThpManagement/tpm_gui_plugin.h | 51 + .../OldTHP/ThpUsbManagement/CMakeLists.txt | 44 + .../OldTHP/ThpUsbManagement/logger.cpp | 37 + .../OldTHP/ThpUsbManagement/logger.h | 22 + .../ThpUsbManagement/tpm_usb_dialog.cpp | 1699 +++++++++ .../OldTHP/ThpUsbManagement/tpm_usb_dialog.h | 138 + .../OldTHP/ThpUsbManagement/tpm_usb_dialog.ui | 274 ++ .../ThpUsbManagement/tpm_usb_gui_plugin.cpp | 102 + .../ThpUsbManagement/tpm_usb_gui_plugin.h | 52 + .../OldTHP/tpm_gui_plugin_interface.h | 25 + .../Gui/EventTimelineClassic/CMakeLists.txt | 135 + .../EventFilter/AttributeEditingModeUI.cpp | 226 ++ .../EventFilter/AttributeEditingModeUI.h | 50 + .../EventFilter/AttributeSelectionModeUI.cpp | 80 + .../EventFilter/AttributeSelectionModeUI.h | 59 + .../EventFilter/FilterTableEntry.cpp | 334 ++ .../EventFilter/FilterTableEntry.h | 84 + .../EventFilter/FilterTableEntryAttribute.cpp | 244 ++ .../EventFilter/FilterTableEntryAttribute.h | 59 + .../EventFilter/FilterWindow.cpp | 326 ++ .../EventFilter/FilterWindow.h | 88 + .../interpreter/FilterEquationFunctions.cpp | 309 ++ .../interpreter/FilterEquationFunctions.h | 26 + .../interpreter/FilterValueInterpreter.cpp | 174 + .../interpreter/FilterValueInterpreter.h | 64 + .../EventFilter/interpreter/FilterWorker.cpp | 319 ++ .../EventFilter/interpreter/FilterWorker.h | 119 + .../EventFilter/interpreter/InfoWindow.cpp | 134 + .../EventFilter/interpreter/InfoWindow.h | 67 + .../EventFilter/ui/FilterEditorUi.ui | 1357 +++++++ .../EventFilter/ui/FilterWindowUi.ui | 81 + .../widgets/AbstractAttributeWidget.cpp | 44 + .../widgets/AbstractAttributeWidget.h | 42 + .../EventFilter/widgets/AreaWidget.cpp | 77 + .../EventFilter/widgets/AreaWidget.h | 36 + .../EventFilter/widgets/CheckBoxWidget.cpp | 73 + .../EventFilter/widgets/CheckBoxWidget.h | 37 + .../EventFilter/widgets/ComboBox.cpp | 108 + .../EventFilter/widgets/ComboBox.h | 42 + .../widgets/DefaultRangeWidget.cpp | 99 + .../EventFilter/widgets/DefaultRangeWidget.h | 44 + .../EventFilter/widgets/RadiusWidget.cpp | 70 + .../EventFilter/widgets/RadiusWidget.h | 35 + .../EventFilter/widgets/TimeRangeWidget.cpp | 109 + .../EventFilter/widgets/TimeRangeWidget.h | 41 + .../attribute_value_lookup.cpp | 303 ++ .../attribute_value_lookup.h | 138 + .../Gui/EventTimelineClassic/detail_data.cpp | 928 +++++ .../Gui/EventTimelineClassic/detail_data.h | 343 ++ .../Gui/EventTimelineClassic/excon_filter.cpp | 218 ++ .../Gui/EventTimelineClassic/excon_filter.h | 22 + .../Gui/EventTimelineClassic/logger.cpp | 37 + .../Gui/EventTimelineClassic/logger.h | 23 + .../EventTimelineClassic/tln_cache_dialog.cpp | 111 + .../EventTimelineClassic/tln_cache_dialog.h | 48 + .../EventTimelineClassic/tln_cache_dialog.ui | 134 + .../Gui/EventTimelineClassic/tln_dialog.cpp | 1085 ++++++ .../Gui/EventTimelineClassic/tln_dialog.h | 174 + .../Gui/EventTimelineClassic/tln_dialog.ui | 215 ++ .../EventTimelineClassic/tln_dialog_model.cpp | 1722 +++++++++ .../EventTimelineClassic/tln_dialog_model.h | 209 + .../EventTimelineClassic/tln_event_list.cpp | 274 ++ .../Gui/EventTimelineClassic/tln_event_list.h | 83 + .../EventTimelineClassic/tln_event_list.ui | 46 + .../tln_event_list_columns.cpp | 213 ++ .../tln_event_list_columns.h | 96 + .../tln_event_list_columns.ui | 217 ++ .../tln_event_list_model.cpp | 268 ++ .../tln_event_list_model.h | 86 + .../Gui/EventTimelineClassic/tln_legend.cpp | 327 ++ .../Gui/EventTimelineClassic/tln_legend.h | 58 + .../Gui/EventTimelineClassic/tln_legend.ui | 53 + .../EventTimelineClassic/tln_show_details.cpp | 521 +++ .../EventTimelineClassic/tln_show_details.h | 96 + .../EventTimelineClassic/tln_show_details.ui | 304 ++ .../tln_view_gui_plugin.cpp | 167 + .../tln_view_gui_plugin.h | 94 + .../WebSocketSimulator/awss_base_layout.cpp | 2 +- .../Lts/Tools/CnrProxyTester/CMakeLists.txt | 3 + .../DataSampleGenerator/initialisation.cpp | 24 +- .../Lts/Tools/DataSampleReceiver/main.cpp | 12 +- .../Tools/DataSampleReceiver/topic_data.cpp | 20 +- .../Lts/Tools/DdsView/rw/rwwidgets.cpp | 2 +- .../Lts/Tools/DdsView/samplemodel.cpp | 16 +- .../Lts/Tools/DdsView/sampleview.cpp | 4 +- .../sequences/abstractsequencewidget.cpp | 2 +- .../Lts/Tools/DotMatrixDisplay/CMakeLists.txt | 4 + .../Lts/Tools/LogViewer/logviewtablemodel.cpp | 2 +- .../Lts/Tools/LogViewer/logviewtableview.cpp | 2 +- .../Lts/Tools/LogViewer/mainwindow.cpp | 4 +- .../ParticipantDataGenerator/main_handler.cpp | 59 +- .../proxy_emulator.cpp | 66 +- .../ProjectSettingsEditor/main_window.cpp | 2 +- .../Lts/Tools/QLedLine/qledline.cpp | 1 - .../Lts/Tools/TextEditorTest/textedit.cpp | 8 +- .../Lts/Tools/TopicDiscover/CMakeLists.txt | 1 + .../Tools/WlsRandomPositions/mainwindow.cpp | 2 +- .../Lts/Tools/WlsRandomPositions/settings.cpp | 4 +- .../Lts/Tools/WlsRandomPositions/worker.cpp | 2 +- .../cmake/NGLMacros.cmake | 11 +- .../ltsprojectionworkstation_export.h | 18 +- .../include/LtsSession/ltssession_export.h | 13 +- .../LtsUtilsGuiDds/ltsutilsguidds_export.h | 13 +- .../qt6-migrated-legatus/new_docker_build.sh | 37 +- 154 files changed, 24958 insertions(+), 167 deletions(-) create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/CMakeLists.txt create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/CMakeLists.txt create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/CMakeLists.txt create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/CMakeLists.txt create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/CMakeLists.txt create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/tpm_gui_plugin_interface.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/CMakeLists.txt create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterEditorUi.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterWindowUi.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.h create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.ui create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.cpp create mode 100755 qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.h diff --git a/qt6-after/qt6-migrated-legatus/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/CMakeLists.txt index 153b4a572..002ecd75e 100755 --- a/qt6-after/qt6-migrated-legatus/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/CMakeLists.txt @@ -676,6 +676,16 @@ IF(BUILD_RTI) # the AutogenInfo MOC_INCLUDES. SET(CMAKE_AUTOMOC_INCLUDE_DIRECTORIES ${CMAKE_AUTOMOC_INCLUDE_DIRECTORIES} ${CMAKE_SOURCE_DIR}/include/Viewer/SituationMap/ElevationMap) + # The migrated Projects declare Q_INTERFACES(ProjectPlugin::Plugin) and include + # . That include dir + # (Lts/Common/PluginInterfaces/..) is only a target-level PUBLIC include of + # ProjectPluginInterface and is NOT part of the global include_directories that + # reach the AutogenInfo MOC_INCLUDES, so moc fails with "Undefined interface". + # Add the Lts/Common root explicitly (mirrors the Lts append above) so moc can + # resolve the interface. Must be set at root scope - subdir appends do not + # reach the AutogenInfo MOC_INCLUDES. + SET(CMAKE_AUTOMOC_INCLUDE_DIRECTORIES ${CMAKE_AUTOMOC_INCLUDE_DIRECTORIES} ${CMAKE_SOURCE_DIR}/Lts/Common) + # IMPORTED Targets für RTI Libraries erstellen # Debug und Release Varianten korrekt konfigurieren FOREACH(lib nddsc nddscore nddscpp nddscpp2 nddsctesthelpers) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/AarApp/databases_model.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/AarApp/databases_model.cpp index 72aebf169..efbbdcf1f 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/AarApp/databases_model.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Application/AarApp/databases_model.cpp @@ -56,13 +56,13 @@ bool DatabasesModel::initModel(const QSqlDatabase &db) } Exercise exercise; - exercise.m_id = q.value(0).toInt(); + exercise.id = q.value(0).toInt(); exercise.name = q.value(1).toString(); exercise.startTime = q.value(2).toLongLong(); exercise.endTime = q.value(3).toLongLong(); - exercise.dbName = QStringLiteral("lts_db_") + QString::number(exercise.m_id); + exercise.dbName = QStringLiteral("lts_db_") + QString::number(exercise.id); exercise.stateId = q.value(4).toInt(); - TRACE_LOG(m_logger) << "Found exercise with id=" << exercise.m_id << ", name=" << exercise.name << ", startTime=" + TRACE_LOG(m_logger) << "Found exercise with id=" << exercise.id << ", name=" << exercise.name << ", startTime=" << exercise.startTime << ", endTime=" << exercise.endTime << ", dbName=" << exercise.dbName << ", stateId=" << exercise.stateId; if (exercise.stateId != 6) @@ -86,7 +86,7 @@ QVariant DatabasesModel::data(const QModelIndex &index, int role) const switch (index.column()) { case Id: - return e.m_id; + return e.id; case Name: return QString(e.name); case StartTime: @@ -176,7 +176,7 @@ void DatabasesModel::onDataChanged(const Exercise &data, DataModification modTyp row = m_vecData.indexOf(data); if (row != -1) if (removeRow(row)) - emit dataChanged(index(std::min(row, m_vecData.size()-1), Columns::Id), index(m_vecData.size()-1, Columns::EndTime)); + emit dataChanged(index(std::min(row, m_vecData.size() - 1), Columns::Id), index(m_vecData.size()-1, Columns::EndTime)); return; } // switch } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/AarApp/databases_model.h b/qt6-after/qt6-migrated-legatus/Lts/Application/AarApp/databases_model.h index 9c9ccdf2b..a43fb748f 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/AarApp/databases_model.h +++ b/qt6-after/qt6-migrated-legatus/Lts/Application/AarApp/databases_model.h @@ -32,8 +32,8 @@ struct Exercise qint64 endTime = 0; qint32 stateId = 0; - bool operator == (const Exercise &other) { return id == other.m_id; } - bool operator != (const Exercise &other) { return id != other.m_id; } + bool operator == (const Exercise &other) const { return id == other.id; } + bool operator != (const Exercise &other) const { return id != other.id; } }; diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/OpApp/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Application/OpApp/CMakeLists.txt index 31c1fba93..53afefb75 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/OpApp/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Application/OpApp/CMakeLists.txt @@ -38,7 +38,7 @@ ENDIF() if(QT6_GUI_AVAILABLE) NGL_TARGET_LINK_LIBRARIES(OperatorApplication - ArcGISQt5Hack # make sure it's loaded *before* libEsriCommonQt.so + $,ArcGISQt5Hack,> # make sure it's loaded *before* libEsriCommonQt.so (guard: only linked when the SituationMap viewer is built, matching CentralEffectSimulation) ${Qt6_Widgets} Qt6::Network nglapplication diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/OpApp/main.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/OpApp/main.cpp index b95e103fd..799b0d113 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/OpApp/main.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Application/OpApp/main.cpp @@ -36,6 +36,9 @@ #include #include #include +#include +#include +#include class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser @@ -157,7 +160,7 @@ public: bool isForcedTabletMode() const { return isSet(QStringLiteral("x")); } bool isForcedWSMode() const { return isSet(QStringLiteral("w")); } QString langIsoCode() const { return value(QStringLiteral("l")); } - QStringList ignoredPlugins() const { return value(QStringLiteral("ignore-plugins")).split(QLatin1Char(','), QString::SkipEmptyParts); } + QStringList ignoredPlugins() const { return value(QStringLiteral("ignore-plugins")).split(QLatin1Char(','), Qt::SkipEmptyParts); } bool checkRequirements() const { return isSet(QStringLiteral("check-requirements")); } QString skipScreen() const { return value(QStringLiteral("k")); } QString qosFile() const { return value(QStringLiteral("q")).size() > 0 ? value(QStringLiteral("q")) : QString(); } @@ -172,7 +175,7 @@ public: // ------------------------------------------------------------------ int main(int argc, char **argv) // TODO: json strings to lower { - qsrand(time(nullptr)); + QRandomGenerator::global()->seed(time(nullptr)); QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL); @@ -380,7 +383,7 @@ int main(int argc, char **argv) // TODO: json strings to lower if (!skipScreen.isEmpty()) { - QStringList skipScreenList(skipScreen.split(QLatin1Char('.'), QString::SkipEmptyParts)); + QStringList skipScreenList(skipScreen.split(QLatin1Char('.'), Qt::SkipEmptyParts)); int skipScreenListCount = skipScreenList.count(); @@ -431,7 +434,8 @@ int main(int argc, char **argv) // TODO: json strings to lower sessionData->setAsTablet(); else if (options.isForcedWSMode()) sessionData->setAsTablet(false); - else if (!QTouchDevice::devices().isEmpty()) + else if (std::any_of(QInputDevice::devices().cbegin(), QInputDevice::devices().cend(), + [](const QInputDevice *dev) { return dev && dev->type() == QInputDevice::DeviceType::TouchScreen; })) sessionData->setAsTablet(); LtsWidgets::LtsComboBox::setUseSelectionDialog(sessionData->isTablet()); diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/CMakeLists.txt index a1fa02a8d..8a68aa6cc 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/CMakeLists.txt @@ -72,7 +72,7 @@ NGL_TARGET_COMPILE_DEFINITIONS(thp_viewer ${VLC_DEFINES} ) NGL_TARGET_LINK_LIBRARIES(thp_viewer - ArcGISQt5Hack # make sure it's loaded *before* libEsriCommonQt.so + $,ArcGISQt5Hack,> # make sure it's loaded *before* libEsriCommonQt.so (guard: only linked when the SituationMap viewer is built, matching CentralEffectSimulation) ${VLC_LIBRARIES} Qt6::Core diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.cpp index 35cb2d1a6..532e6093f 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.cpp @@ -258,8 +258,9 @@ void ThpViewer::onLinkClicked(const QUrl &url) const QString path = url.path(); const QString lpath = path.toLower(); - const QStringRef ext = lpath.splitRef(QLatin1Char('.')).last(); - const QStringRef ext2Chars = ext.left(2); + // Qt6: QStringRef/QString::splitRef were removed; QStringView::split provides zero-copy access + const QStringView ext = QStringView{lpath}.split(QLatin1Char('.')).last(); + const QStringView ext2Chars = ext.left(2); ui->audioWidget->stop(); ui->videoWidget->stop(); @@ -370,7 +371,7 @@ void ThpViewer::onLinkClicked(const QUrl &url) ui->backButton->setEnabled(true); } else if (ext == QLatin1String("html") && - lpath.midRef(lpath.lastIndexOf(QLatin1Char('/')) + 1).startsWith(QLatin1String("combined_"))) + QStringView{lpath}.mid(lpath.lastIndexOf(QLatin1Char('/')) + 1).startsWith(QLatin1String("combined_"))) { // Kombiniert QHash urls = getCombinedPlaybackDetails(url); diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.cpp index 56a399671..d6fb08ea5 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.cpp @@ -32,10 +32,11 @@ public: bool needsToBeOpenedExternally(const QUrl &url) { const QString lpath = url.toString(); - const QStringRef ext = lpath.splitRef(QLatin1Char('.')).last(); - const QStringRef ext2Chars = ext.left(2); + // Qt6: QStringRef/QString::splitRef and QString::midRef were removed; use QStringView + const QStringView ext = QStringView{lpath}.split(QLatin1Char('.')).last(); + const QStringView ext2Chars = ext.left(2); if (ext == QLatin1String("html") && - lpath.midRef(lpath.lastIndexOf(QLatin1Char('/')) + 1).startsWith(QLatin1String("combined_"))) + QStringView{lpath}.mid(lpath.lastIndexOf(QLatin1Char('/')) + 1).startsWith(QLatin1String("combined_"))) return true; // PDF if (ext == QLatin1String("pdf")) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsAppManager/lts_app_manager.cpp b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsAppManager/lts_app_manager.cpp index 6739a7e46..ffb0eff43 100644 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsAppManager/lts_app_manager.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsAppManager/lts_app_manager.cpp @@ -140,7 +140,7 @@ void LtsAppManager::slotStartDebugServer() QString commandStr( QString::fromUtf8(client->readLine(100)).remove(QStringLiteral("\r")).remove(QStringLiteral("\n"))); - QStringList argList = commandStr.split(QLatin1Char(' '), QString::SplitBehavior::SkipEmptyParts); + QStringList argList = commandStr.split(QLatin1Char(' '), Qt::SkipEmptyParts); if (argList.count() < 1) return; diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsLogin/logout_info_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsLogin/logout_info_dialog.cpp index da081cbb0..261b86754 100644 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsLogin/logout_info_dialog.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsLogin/logout_info_dialog.cpp @@ -16,7 +16,7 @@ LogoutInformationDialog::LogoutInformationDialog(int timeOut, AssetManagement::S { m_ui->setupUi(this); QString actionText; - switch (shutdownAction.underlying()) + switch (shutdownAction) { case AssetManagement::ShutdownAction::NoAction: case AssetManagement::ShutdownAction::Logout: diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsLogin/lts_login.cpp b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsLogin/lts_login.cpp index ac5b7b45d..dd5cd2d48 100644 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsLogin/lts_login.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsLogin/lts_login.cpp @@ -154,13 +154,13 @@ void LtsLogin::slotLogoutShutdown(const AssetManagement::WorkstationLogout& data if (!m_asmDtc->isAssetEnabled()) m_asmDtc->enableAsset(); - for (int id : data.ids()) + for (int id : data.ids) { - if (QString::fromStdString(m_asmDtc->asset(id).name()) + if (QString::fromStdString(m_asmDtc->asset(id).name) .compare(LtsSession::LtsSession::workstationName(), Qt::CaseInsensitive) == 0) { m_isInLogoutDialog = true; - showLogoutInformationDialog(data.shutdownAction()); + showLogoutInformationDialog(data.shutdownAction); break; } } @@ -250,7 +250,7 @@ void LtsLogin::logoff() m_loginApp = nullptr; QString cmd; - switch (m_shutdownAction.underlying()) + switch (m_shutdownAction) { case AssetManagement::ShutdownAction::Shutdown: #ifdef LTS_DEBUG diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsPluginManager/lts_plugin_manager.cpp b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsPluginManager/lts_plugin_manager.cpp index 51f7060fd..fdfac12cc 100644 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsPluginManager/lts_plugin_manager.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsPluginManager/lts_plugin_manager.cpp @@ -21,7 +21,7 @@ namespace LtsPluginManager LtsPluginManager::LtsPluginManager() : m_sessionManager(new LtsSession::LtsSessionManager) - .getNGLLogger("LtsPluginManager")) + , m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("LtsPluginManager")) , m_markedForDeletion(false) { connect(m_sessionManager, &LtsSession::LtsSessionManager::signalQuit, this, &LtsPluginManager::signalQuit); diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/CMakeLists.txt index 0b9815fac..8de54826d 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/CMakeLists.txt @@ -79,7 +79,14 @@ NGL_TARGET_INCLUDE_DIRECTORIES(LtsSession ) # Optional external dependencies -FIND_LIBRARY(SVCCORECLIENT_LIBRARY NAMES svcCoreClient PATHS /usr/local/lib /usr/lib NO_DEFAULT_PATH) +# Prefer the in-tree target: a fresh build tree does not have svcCoreClient +# installed in /usr/local/lib, and the Core::Interface::Ftc::create symbols +# referenced at link time live in libsvcCoreClient.so +IF(TARGET svcCoreClient) + SET(SVCCORECLIENT_LIBRARY svcCoreClient) +ELSE() + FIND_LIBRARY(SVCCORECLIENT_LIBRARY NAMES svcCoreClient PATHS /usr/local/lib /usr/lib NO_DEFAULT_PATH) +ENDIF() FIND_LIBRARY(OHPONLINEHELP_LIBRARY NAMES OhpOnlineHelpViewerGuiPluginInterface PATHS /usr/local/lib /usr/lib NO_DEFAULT_PATH) SET(LtsSession_PRIVATE_LIBS diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/CMakeLists.txt new file mode 100755 index 000000000..7057aa0ef --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/CMakeLists.txt @@ -0,0 +1,81 @@ +# +# $Id$ +# $HeadURL$ +# $Author$ +# +# Created by Mike Wille, SLSE, 2016-03-17 +# + +SET(pre_script_gui_SRCS + pre_script_gui_plugin.cpp + pre_script_gui_plugin.h + pre_script_dialog.h + pre_script_dialog.cpp + pre_storyboard.cpp + pre_storyboard.h + pre_journal_types.h + pre_journal_types.cpp + pre_journal_dialog.h + pre_journal_dialog.cpp + pre_screen.h + pre_screen.cpp + filter_topic.h + filter_topic.cpp +) + +QT5_WRAP_UI(pre_script_gui_SRCS + pre_storyboard.ui + pre_script_dialog.ui + pre_journal_dialog.ui +) + +NGL_ADD_LIBRARY(WS PreScriptGuiPlugin MODULE ${pre_script_gui_SRCS}) +NGL_TARGET_LINK_LIBRARIES(PreScriptGuiPlugin + NGLLogger + LtsSession + PreDataPluginInterface + PrePresentationGuiPluginInterface + PreGuiCommon + PreGuiScriptCommon + svcPreCommon + Qt5::Widgets + LtsWidgets + LtsDataView + LtsUtilsGuiDds + LtsSessionData + ProjectConfig + LtsScriptTimeline + LtsMultiMonitor + + LtsAppManager # start replay app + LtsSessionData # set partition preset for replay app + TopicEditorInterface + TopicEditorBase + LtsPluginManager # manipulate apps + + # for Topics + EvlGuiPluginInterface + + + SrmDataPluginInterface # start playback + LtsPrinting + SituationMapGuiPluginInterface + + # Script Player Controls: + SrpGuiPluginInterface + + # file topic + FlmExplorerGuiPluginInterface + # building topic + BdvViewerGuiPluginInterface + # report topic + RepGuiPluginInterface + LtsReportDisplay + MrkCommon # for ApplyFilter @ SitmapFilter + LtsUtilsSettings + ngltools # DTG + situationMap # set time string on map + ExportBdvTopicSetting +) + +NGL_INSTALL_TARGET(PreScriptGuiPlugin) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.cpp new file mode 100755 index 000000000..3dc12a68e --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.cpp @@ -0,0 +1,17 @@ +#include "filter_topic.h" + + +namespace PresentationManagement +{ +FilterTopic::~FilterTopic() +{ + //delete filterTopic; +} + + +FilterTopic::FilterTopic(const FilterTopic &other) +{ + mainTopicId = other.mainTopicId; + filterTopic = other.filterTopic;//new LtsScriptTimeline::TrackEntry(other.filterTopic); +} +} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.h new file mode 100755 index 000000000..f4abede9a --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.h @@ -0,0 +1,28 @@ +#pragma once + +#include + + +namespace PresentationManagement +{ +class FilterTopic +{ +public: + FilterTopic() + : mainTopicId(-1) + , filterTopic(nullptr) + {} + + FilterTopic(int _mainTopicId, LtsScriptTimeline::TrackEntry *_filterTopic) + : mainTopicId(_mainTopicId) + , filterTopic(_filterTopic) + {} + + FilterTopic(const FilterTopic &other); + + ~FilterTopic(); + + int mainTopicId; + LtsScriptTimeline::TrackEntry *filterTopic; +}; +} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.cpp new file mode 100755 index 000000000..4f5befb59 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.cpp @@ -0,0 +1,81 @@ +#include "pre_journal_dialog.h" +#include "ui_pre_journal_dialog.h" + +#include + + +namespace PresentationManagement +{ + +JournalDialog::JournalDialog(LtsSession::LtsSession *session, QWidget *parent) + : LtsWidgets::LtsDialog(parent) + , m_ui(new Ui::JournalDialog) + , m_journal(nullptr) + , m_session(session) +{ + m_ui->setupUi(this); + + m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &JournalDialog::slotPrint); +} + + +JournalDialog::~JournalDialog() +{ + delete m_ui; +} + + +void JournalDialog::slotPrint() +{ + LtsPrinting::printView(m_session, this, m_ui->listWidget); +} + + +bool JournalDialog::init(MainJournal *journal) +{ + m_journal = journal; + + return true; +} + + +void JournalDialog::retranslate() +{ + translate(m_ui, tr("Script Journal")); + fillJournal(); +} + + +void JournalDialog::fillJournal() +{ + m_ui->listWidget->clear(); + + if (!m_journal) + return; + + m_ui->listWidget->addItem(m_journal->getText()); + for (const Journal *j : qAsConst(m_journal->journalList)) + m_ui->listWidget->addItem(j->getText()); +} + +} // namespace PresentationManagement + + + + + + + + + + + + + + + + + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.h new file mode 100755 index 000000000..f59dabf12 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.h @@ -0,0 +1,37 @@ +#pragma once + +#include "pre_journal_types.h" + +#include +#include + + +namespace Ui +{ +class JournalDialog; +} + +namespace PresentationManagement +{ + +class JournalDialog : public LtsWidgets::LtsDialog +{ + Q_OBJECT +public: + explicit JournalDialog(LtsSession::LtsSession *session, QWidget *parent); + ~JournalDialog(); + bool init(MainJournal *journal); + void retranslate() override final; + +private slots: + void slotPrint(); + +private: + void fillJournal(); + + Ui::JournalDialog *m_ui; + MainJournal *m_journal; + LtsSession::LtsSession *m_session; +}; + +} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.ui new file mode 100755 index 000000000..07ae0fb45 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.ui @@ -0,0 +1,49 @@ + + + JournalDialog + + + + 0 + 0 + 707 + 464 + + + + + 0 + 0 + + + + Script Editor + + + + 9 + + + 9 + + + 9 + + + 9 + + + 9 + + + + + true + + + + + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.cpp new file mode 100755 index 000000000..845e34021 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.cpp @@ -0,0 +1,90 @@ +#include "pre_journal_types.h" + +#include +#include + + +namespace PresentationManagement +{ + +QString ttt(qint64 msecsSinceEpoch) +{ + return DTG::toStringMSec(msecsSinceEpoch); +} + + +QString pttt(int presentationTime) +{ + return QTime::fromMSecsSinceStartOfDay(presentationTime * 1000).toString(); +} + + +Journal::Journal() + : m_started(QDateTime::currentMSecsSinceEpoch()) +{} + + +QString Journal::started() const +{ + return ttt(m_started); +} + + +MainJournal::~MainJournal() +{ + qDeleteAll(journalList); +} + + +QString MainJournal::getText() const +{ + return Journal::tr("Script Player started on %1").arg(ttt(started)); +} + + +NextTopicJournal::NextTopicJournal(int presentationTime, bool isFilter, const QString &topicTypeName, int length) + : Journal() + , m_isFilter(isFilter) + , m_topicTypeName(topicTypeName) + , m_length(length) + , m_presentationTime(presentationTime) +{} + + +QString NextTopicJournal::getText() const +{ + return Journal::tr("%1 '%2' started at %3 for %4 seconds on %5").arg(m_isFilter ? tr("FilterTopic") : tr("Topic"), + m_topicTypeName, pttt(m_presentationTime)).arg(m_length).arg(started()); +} + + +QString PlayJournal::getText() const +{ + return Journal::tr("Started / resumed script at %1 on %2").arg(pttt(m_presentationTime), started()); +} + + +QString PauseJournal::getText() const +{ + return Journal::tr("Paused script at %1 on %2").arg(pttt(m_presentationTime), started()); +} + + +QString EndedJournal::getText() const +{ + return Journal::tr("Script ended at %1 on %2").arg(pttt(m_presentationTime), started()); +} + + +QString StopJournal::getText() const +{ + return Journal::tr("Script stopped at %1 on %2").arg(pttt(m_presentationTime), started()); +} + + +QString SetTimeJournal::getText() const +{ + return Journal::tr("Position time set to %1 on %2").arg(pttt(m_toPresentationTime), started()); +} + +} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.h new file mode 100755 index 000000000..8de77cbfa --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.h @@ -0,0 +1,131 @@ +#pragma once + +#include +#include + + +namespace PresentationManagement +{ + +class Journal +{ + Q_DECLARE_TR_FUNCTIONS(Journal) + +public: + Journal(); + virtual ~Journal() = default; + QString started() const; + virtual QString getText() const = 0; + qint64 m_started; +}; + + +class MainJournal +{ +public: + ~MainJournal(); + QString getText() const; + + qint64 started = 0; + QVector journalList; +}; + + +class NextTopicJournal : public Journal +{ +public: + NextTopicJournal(int presentationTime, bool isFilter, /*int topicId, */const QString &topicTypeName, int length); + QString getText() const override final; + + bool m_isFilter; + //int m_topicId; + QString m_topicTypeName; + int m_length; + int m_presentationTime; +}; + + +class PlayJournal : public Journal +{ +public: + explicit PlayJournal(int presentationTime) + : Journal() + , m_presentationTime(presentationTime) + {} + + QString getText() const override final; + + int m_presentationTime; +}; + + +class PauseJournal : public Journal +{ +public: + explicit PauseJournal(int presentationTime) + : Journal() + , m_presentationTime(presentationTime) + {} + + QString getText() const override final; + + int m_presentationTime; +}; + + +class EndedJournal : public Journal +{ +public: + explicit EndedJournal(int presentationTime) + : Journal() + , m_presentationTime(presentationTime) + {} + + QString getText() const override final; + + int m_presentationTime; +}; + + +class StopJournal : public Journal +{ +public: + explicit StopJournal(int presentationTime) + : Journal() + , m_presentationTime(presentationTime) + {} + + QString getText() const override final; + + int m_presentationTime; +}; + + +class SetTimeJournal : public Journal +{ +public: + explicit SetTimeJournal(int toPresentationTime) + : Journal() + , m_toPresentationTime(toPresentationTime) + {} + + QString getText() const override final; + + int m_toPresentationTime; +}; + +} // namespace PresentationManagement + + + + + + + + + + + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.cpp new file mode 100755 index 000000000..b1e85bb05 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.cpp @@ -0,0 +1,35 @@ +#include "pre_screen.h" + +#include +#include + + +Screen::Screen() + : QWidget() +{ + setBgColor(QColor("black")); + setContentsMargins(0, 0, 0, 0); +} + + +Screen::~Screen() +{ + const auto p1Widgets = findChildren(QString(), Qt::FindDirectChildrenOnly); + for (QWidget *w : p1Widgets) + w->setParent(nullptr); +} + + +void Screen::setBgColor(const QColor &color) +{ + setStyleSheet(QStringLiteral("Screen { background: %1; background-color: %1; }").arg(color.name())); +} + + +void Screen::paintEvent(QPaintEvent *) // needed to apply the style sheet........... +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.h new file mode 100755 index 000000000..4b24686ef --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.h @@ -0,0 +1,18 @@ +#pragma once + +#include + + +class Screen : public QWidget +{ + Q_OBJECT + +public: + Screen(); + virtual ~Screen(); + + void setBgColor(const QColor &color); + +private: + void paintEvent(QPaintEvent *) override; +}; diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.cpp new file mode 100755 index 000000000..d64bb8d92 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.cpp @@ -0,0 +1,3377 @@ +/** + * @RDE_HEADER@ + * PresentationManagement - Script Editor + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-03-17 + */ + +// NOTE: topic editors => exercise session; topic ifcs => replay session + + +#include "pre_script_dialog.h" +#include "ui_pre_script_dialog.h" +#include "pre_journal_dialog.h" +#include "pre_screen.h" +#include "pre_storyboard.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // set time string on map +#include // set time string on map + +// Script Chooser for Load Script +#include +#include + +// THP STUFF FROM GUI PLUGIN +#include +#include +#include + +// Control- & Widget-Ifcs: +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace LtsScriptTimeline; + + +namespace PresentationManagement +{ +class BoolHelper +{ +public: + BoolHelper(bool *myBool) + : m_myBool(myBool) + { + if (m_myBool) + *m_myBool = true; + } + + ~BoolHelper() + { + if (m_myBool) + *m_myBool = false; + } + +private: + bool *m_myBool; +}; + +ScriptDialog::ScriptDialog(const QString &menuGroup, QWidget *parent) + : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel, false /* not closable */) + , m_ui(new Ui::ScriptDialog) + , m_essentialsViewSession(nullptr) + , m_menuGroup(menuGroup) + , m_requestHelper(nullptr) + , m_selectedTeId(-1) + , m_currentTopicEditor(nullptr) + , m_scriptId(0) // invalid + , m_essentialsViewApp(nullptr) + , m_exportProcess(nullptr) + , m_exerciseSession(nullptr) + , m_replaySession(nullptr) + , m_presentationTimer(new QTimer(this)) + , m_lowestTime(-1) + , m_highestTime(-1) + , m_positionTime(-1) + , m_duration(-1) + , m_nextPauseTime(-1) + , m_projectionWidget1(nullptr) + , m_projectionWidget2(nullptr) + , m_scriptsExerciseId(0) + , m_exerciseName(QString()) + , m_sitMapApp(nullptr) + , m_sitMapSession(nullptr) + , m_currentlyFreestandingTopicsScreen1(false) + , m_currentlyFreestandingTopicsScreen2(false) + , m_sitMapTopicIfc(nullptr) + , m_firstPlayAfterStop(true) + , m_enableApply(true) + , m_stopAfterPlayingFilterTopic(false) + , m_previousParentForScreen1(nullptr) + , m_previousParentForScreen2(nullptr) + , m_ignoreTopicForReplay(-1) + , m_currentTopicDesigner(nullptr) + , m_avsVisibilityHackActive(false) + , m_ignoreChanges(false) + , m_scriptRunning(false) + , m_bTimerTickRecursionGuard(false) + , m_isPlayTopicMethodStillRunning(false) + , m_logger(getLogger("ScriptDialogDialog")) +{ + m_ui->setupUi(this); + + connect(m_ui->widget, &ScriptTimeline::signalSave, + this, [this]() + { + QPushButton *b = m_buttonBox->getButton(LtsWidgets::DialogButton::Apply); + if (b->isEnabled()) + b->click(); + else + QApplication::beep(); + }); + + + m_buttonBox->connectButton(LtsWidgets::DialogButton::Export, this, &ScriptDialog::slotShowStoryboard); + m_buttonBox->connectButton(LtsWidgets::DialogButton::Import, this, &ScriptDialog::slotShowJournal); + m_buttonBox->connectButton(LtsWidgets::DialogButton::Hide, this, &ScriptDialog::slotDiscard); + m_buttonBox->connectButton(LtsWidgets::DialogButton::Load, this, &ScriptDialog::slotStartEssentialsView); + m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &ScriptDialog::slotEditSelectedEntry); + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false); + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Hide, false); + +#ifdef LTS_DEBUG + m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &ScriptDialog::slotAddFakeLegacyPlanTopic); +#endif + + setOnlineHelpFilename(QStringLiteral("Script_Editor-Application")); + + connect(m_ui->widget, &ScriptTimeline::signalTrackEntrySelectionChanged, + this, &ScriptDialog::slotTrackEntrySelectionChanged); + + connect(m_ui->widget, &ScriptTimeline::signalTrackEntryDeleted, + this, &ScriptDialog::slotTrackEntryDeleted); + + connect(m_ui->widget, &ScriptTimeline::signalEditEntry, + this, &ScriptDialog::slotEditEntry); + + connect(m_ui->widget, &ScriptTimeline::signalTrackEntryAdded, + this, [this]() + { + fillTopicVector(); + }); + + connect(m_ui->pbPlay, &QPushButton::clicked, + this, &ScriptDialog::slotPlay); + + connect(m_ui->pbPause, &QPushButton::clicked, + this, &ScriptDialog::slotPause); + + connect(m_ui->pbStop, &QPushButton::clicked, + this, &ScriptDialog::slotStop); + + connect(m_ui->posSlider, &QSlider::sliderMoved, + this, [this]() + { + setPositionTime(m_ui->posSlider->value(), true); + }); + + connect(m_ui->widget, &ScriptTimeline::signalHeaderIndicatorTimeUserChanged, + this, [this](int time) + { + setPositionTime(time, true); + }); + + connect(m_ui->widget, &ScriptTimeline::signalChangesMade, + this, &ScriptDialog::slotChangesWereMade); + + // replay controls hidden on first start + m_ui->replayControls->setChecked(false); + m_ui->replayControlsWidget->setVisible(false); + + connect(m_ui->replayControls, &QGroupBox::toggled, + this, [this](bool toggled) + { + m_ui->replayControlsWidget->setVisible(toggled); + }); + + m_ui->lblPos->setText(toReadableTime(0)); +} + + +ScriptDialog::~ScriptDialog() +{ + LtsSessionData::LtsSessionData::getInstance()->setScriptIdPreset(-1); + + deleteProjectionWidget(&m_projectionWidget1); + deleteProjectionWidget(&m_projectionWidget2); + + + for (const FilterTopic &ft : qAsConst(m_filterTopicVector)) + delete ft.filterTopic; + + delete m_sitMapTopicIfc; + + for (const TopicAssignment &ta : qAsConst(m_trackEntryAssignments)) + ta.m_topicEditorIfc->finishTopicEditor(); + + if (m_essentialsViewApp != nullptr) + m_essentialsViewApp->deleteLater(); + + if (m_sitMapApp != nullptr) + m_sitMapApp->deleteLater(); + + if (m_replaySession != nullptr) +#ifdef MIKE_CODE + m_replaySession->slotClose(); +#else + emit m_replaySession->signalClose(); +#endif + + delete m_ui; +} + + +void ScriptDialog::aboutToClose() +{ + stop(false, true /* no need to set something to a map that is going to be deleted anyways - plus that did crash in guez */); +} + + +void ScriptDialog::retranslate() +{ + translate(m_ui, tr("Script Editor")); + + m_buttonBox->setText(LtsWidgets::DialogButton::Export, tr("Show Storyboard")); + m_buttonBox->setText(LtsWidgets::DialogButton::Import, tr("Show Journal")); + m_buttonBox->setText(LtsWidgets::DialogButton::Hide, tr("Discard")); + m_buttonBox->setText(LtsWidgets::DialogButton::Load, tr("Show Essentials View")); + m_buttonBox->setText(LtsWidgets::DialogButton::Apply, tr("Save")); +} + + +void ScriptDialog::slotChangesMade() +{ + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Hide, true); + LtsWidgets::LtsDialog::slotChangesMade(); +} + + +void ScriptDialog::slotEditSelectedEntry() +{ + if (m_selectedTeId != -1) + slotEditEntry(m_selectedTeId); +} + + +bool ScriptDialog::importTrackEntries(const QVector &tes) +{ + if (m_scriptRunning) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Stop replay first.")); + return false; + } + + return m_ui->widget->importTrackEntries(tes); +} + + +void ScriptDialog::slotTrackEntryDeleted(const int topicId) +{ + if (m_selectedTeId == topicId) + m_selectedTeId = -1; + + if (m_currentTopicEditor != nullptr && m_currentTopicEditor->topicId() == topicId) + { + ERROR_LOG(m_logger) << "slotTrackEntryDeleted" << topicId << "editor" << m_currentTopicEditor->topicId(); + m_currentTopicEditor->deleteLater(); + m_currentTopicEditor = nullptr; + } + + fillTopicVector(); +} + + +void ScriptDialog::slotEditEntry(const int topicId) +{ + if (m_currentTopicEditor != nullptr) + m_currentTopicEditor->deleteLater(); + + // TODO: use getTrackEntriesFilterEntries instead converting them to json and, here, back to TEs + QVector tes = m_ui->widget->getTrackEntriesWithFiltersAsEntries(); // get all topics + + for (TrackEntry *te : qAsConst(tes)) + { + //ERROR_LOG(m_logger) << " > id: " << te->m_topicId << ", fpc: " << te->m_filterParentChannel; + if (te->m_topicId == topicId) + { + m_currentTopicEditor = createTopicEditor(te); + + if (!m_currentTopicEditor) + { + //ERROR_LOG(m_logger) << "Cannot create Topic Editor for te->topicId " << te->m_topicId; + return; + } + + addDialog(m_currentTopicEditor, m_menuGroup, QStringLiteral("EditTopic.%1.%2").arg(te->m_topicId).arg((int)te->m_type), + LtsWidgets::LayoutArea::eDialogTab, + true, true /* do not focus */); + + return; // found, done + } + } + + ERROR_LOG(m_logger) << "could not find coresponding track entry with id " << topicId; +} + + +void ScriptDialog::slotAddFakeLegacyPlanTopic() +{ + TrackEntry *te = new TrackEntry(m_ui->widget->nextUniqueId(), 0, 30, TrackEntryType::TacticalPlan, QJsonObject({{QStringLiteral("FileId"), 1002}}), QStringLiteral("Screen 1"), QString()); + TrackEntryPreviewWidget *w = new TrackEntryPreviewWidget; + + w->setTopicEnabled(true); + w->setTrackEntry(te); + + layout()->addWidget(w); +} + + +void ScriptDialog::startEssentialsViewStage2(const Core::ReplayPartition &replay) +{ + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Load, false); // already started or failed, TODO: but unrecoverably.. + + m_exerciseSession->baseLayout()->setIrreplaceableOnce(); + + bool oldFlagValue = LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl")).toBool(); + LtsSessionData::LtsSessionData::getInstance()->setDebugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl"), true); // HACK: ! + LtsSession::DdsConnectionParams params(replay); + m_essentialsViewApp = LtsAppManager::LtsAppManager::getInstance()->createApp(LtsAppDescriptor::App::ScriptEditorEssentialsView, + params); + + if (m_essentialsViewApp == nullptr) + { + LtsSessionData::LtsSessionData::getInstance()->setDebugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl"), oldFlagValue); // reset if sit map app cannot load + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Essentials View app could not be started")); + m_exerciseSession->baseLayout()->irreplaceableReset(); + return; + } + + connect(m_essentialsViewApp, &LtsPluginManager::LtsPluginManager::destroyed, + this, [this, params]() + { + if (static_cast(m_essentialsViewApp) == sender()) + { + // m_srmForeign->replayPartitionRemoveRequest(params.partitionId, + // LtsSessionData::LtsSessionData::getInstance()->getWorkstationId(), + // LtsSessionData::LtsSessionData::getInstance()->getOperatorId(), + // this); + + m_essentialsViewApp = nullptr; + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Load, true); + } + }); + + connect(m_essentialsViewApp, &LtsPluginManager::LtsPluginManager::signalInitializationFinished, + this, [this, params]() + { + disconnect(m_essentialsViewApp, &LtsPluginManager::LtsPluginManager::signalInitializationFinished, + this, nullptr); + + m_essentialsViewSession = m_essentialsViewApp->getSession(params.partitionType, params.partitionId); + + if (m_essentialsViewSession == nullptr) + { + WARNING_LOG(m_logger) << "no session for m_essentialsViewSession"; + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Essentials View was not properly initialized"), tr("Essentials View Session")); + m_essentialsViewApp->deleteLater(); + m_essentialsViewApp = nullptr; + m_exerciseSession->baseLayout()->irreplaceableReset(); + return; + } + + + { + // give topic editor (inside SITMAPfilter ifc which is inside exerciseSession) access to essentials view's filter ifc (to get the map's filter settings) + std::shared_ptr essentialsFltIfc; // essentials view's flt ifc + + if (m_essentialsViewSession->getForeignGuiInterface(essentialsFltIfc)) + { + std::shared_ptr sitMapFilterIfc; // topic editor's flt ifc + + if (m_exerciseSession->getForeignGuiInterface(sitMapFilterIfc)) + { + MarkerManagement::MarkerManagementApplyFilter *applyFilterPtr = new MarkerManagement::MarkerManagementApplyFilter(m_essentialsViewSession, essentialsFltIfc); + QPointer applyFilter(applyFilterPtr); + connect(m_exerciseSession, &LtsSession::LtsSession::destroyed, applyFilterPtr, [applyFilter]() { delete applyFilter; }); + connect(m_essentialsViewSession, &LtsSession::LtsSession::destroyed, applyFilterPtr, [applyFilter]() { delete applyFilter; }); + + sitMapFilterIfc->setApplyFilter(applyFilter); + DEBUG_LOG(m_logger) << "set filter topic editor's flt ifc to essentials view's flt ifc"; + } + else + WARNING_LOG(m_logger) << "cannot set filter topic editor's flt ifc to essentials view's flt ifc - cannot find topic editor"; + } + else + WARNING_LOG(m_logger) << "cannot set filter topic editor's flt ifc to essentials view's flt ifc - cannot find essentials view's flt ifc"; + } + + + { + // set THIS SituationMapFilter Topic's Situation Map Gui Ifc to the Essential View's Situation Map Gui Ifc + // aka. SituationMapFilter needs SituationMap from Essentials View, not from this Script Editor, as the Script Editor has no SitMap and will never get one + std::shared_ptr sitMapGuiIfc; + if (m_essentialsViewSession->getForeignGuiInterface(sitMapGuiIfc)) + { + std::shared_ptr sitMapFilterGuiIfc; + if (m_exerciseSession->getForeignGuiInterface(sitMapFilterGuiIfc)) + { + sitMapFilterGuiIfc->setSitMapGuiIfc(sitMapGuiIfc.get()); + connect(m_essentialsViewSession, &LtsSession::LtsSession::destroyed, this, [sitMapFilterGuiIfc]() + { + sitMapFilterGuiIfc->setSitMapGuiIfc(nullptr); + }); + + DEBUG_LOG(m_logger) << "set sit map filter gui ifc's sit map gui ifc to essential view's sit map gui ifc"; + } + else + WARNING_LOG(m_logger) << "unable to initialize situation map filter gui plugin - sit map filter gui ifc"; + } + else + WARNING_LOG(m_logger) << "unable to initialize situation map filter gui plugin - sit map gui ifc missing!"; + } + + + // set THIS SituationReplay Topic's SituationReplay Gui Ifc to the Essential View's SituationReplay Gui Ifc + // aka. SituationReplay needs Replay from Essentials View, not from this Script Editor, as the Script Editor has no Replay and will never get one + if (m_essentialsViewSession->getForeignGuiInterface(m_essentialsViewsSrpGuiIfc)) + { + std::shared_ptr thisSrpGuiIfc; + if (m_exerciseSession->getForeignGuiInterface(thisSrpGuiIfc)) + { + thisSrpGuiIfc->setSrpIfc(m_essentialsViewsSrpGuiIfc.get()); + connect(m_essentialsViewSession, &LtsSession::LtsSession::destroyed, this, [thisSrpGuiIfc]() { thisSrpGuiIfc->setSrpIfc(nullptr); }); + connect(m_essentialsViewSession, &LtsSession::LtsSession::signalClose, this, [this]() { m_essentialsViewsSrpGuiIfc = nullptr; }); + DEBUG_LOG(m_logger) << "set srp gui ifc's srp gui ifc to essential view's srp gui ifc"; + } + else + WARNING_LOG(m_logger) << "unable to initialize srp gui plugin - this srp gui ifc missing!"; + } + else + WARNING_LOG(m_logger) << "unable to initialize srp gui plugin - essentials view's srp gui ifc missing!"; + + + // give this Plan Topic Editor the map from essentials view & give this plan overlay the plan overlay from essentials view, to share the plan overlays dialog + std::shared_ptr thisPlanOverlayGuiIfc; + if (m_exerciseSession->getForeignGuiInterface(thisPlanOverlayGuiIfc)) + { + std::shared_ptr essentialsViewPlanOverlaysGuiIfc; + if (m_essentialsViewSession->getForeignGuiInterface(essentialsViewPlanOverlaysGuiIfc)) + { + thisPlanOverlayGuiIfc->setForeignPlanOverlaysGuiIfc(essentialsViewPlanOverlaysGuiIfc.get()); + connect(m_essentialsViewSession, &LtsSession::LtsSession::destroyed, this, [thisPlanOverlayGuiIfc]() { thisPlanOverlayGuiIfc->setForeignPlanOverlaysGuiIfc(nullptr); }); + WARNING_LOG(m_logger) << "set this plan overlay's own gui ifc to essential view's plan overlays gui ifc"; + } + else + WARNING_LOG(m_logger) << "unable to initialize plan overlays gui plugin - essential view's plan overlays gui ifc missing!"; + + + std::shared_ptr essentialsViewSitMapGuiIfc; + if (m_essentialsViewSession->getForeignGuiInterface(essentialsViewSitMapGuiIfc)) + { + thisPlanOverlayGuiIfc->setForeignSitMapGuiIfc(essentialsViewSitMapGuiIfc.get()); + connect(m_essentialsViewSession, &LtsSession::LtsSession::destroyed, this, [thisPlanOverlayGuiIfc]() { thisPlanOverlayGuiIfc->setForeignSitMapGuiIfc(nullptr); }); + DEBUG_LOG(m_logger) << "set this plan overlay's sitMap gui ifc to essential view's sitMap gui ifc"; + } + else + WARNING_LOG(m_logger) << "unable to initialize sitMap gui plugin - essential view's sitMap gui ifc missing!"; + } + else + WARNING_LOG(m_logger) << "unable to initialize plan overlay gui plugin - this plan overlay gui ifc missing!"; + + + // Tell the Building Viewer to use the current replay session + std::shared_ptr bgvIfc; + if (m_essentialsViewSession->getForeignGuiInterface(bgvIfc)) + { + bgvIfc->initTopicEditor(); + DEBUG_LOG(m_logger) << "set bgv gui ifc's session"; + } + else + WARNING_LOG(m_logger) << "unable to set bgv gui ifc's session - essentials view's bgv ifc missing!"; + }); +} + + +void ScriptDialog::slotStartEssentialsView() +{ + if (!m_exerciseSession) + return; + + const int exerciseId = m_exerciseSession->exerciseId(); + // create essentials view app as replay + + m_requestHelper = new LtsUtils::RequestHelper(this); + + if (!m_requestHelper->startSingleRequest([this, exerciseId]() +{ + return m_srmForeign->replayPartitionCreateRequest(exerciseId, + LtsSessionData::LtsSessionData::getInstance()->getWorkstationId(), + LtsSessionData::LtsSessionData::getInstance()->getOperatorId(), + Core::ReplayType_def::SituationData, + this); + })) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Cannot start Essentials View because replay partition could not be created")); + return; + } + + int replayId = m_requestHelper->getRepliedId(); + + // blocking, so this is safe: + m_requestHelper->deleteLater(); + m_requestHelper = nullptr; + + + LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(tr("Starting essentials view ..")); + QTimer *t = new QTimer(this); + t->setInterval(250); + t->setProperty("tries", 0); // HACK + connect(t, &QTimer::timeout, + this, [this, replayId, t]() + { + int tries = t->property("tries").toInt(); + INFO_LOG(m_logger) << "try # " << tries; + + Core::ReplayPartition replay = m_coreDtc->replayPartition(replayId); + + if (replay.id() > 0) + { + LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); + startEssentialsViewStage2(replay); // => ! + t->stop(); + return; + } + + if (tries > 30) + { + LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Cannot start Essentials View because Replay Partition timed out")); + t->stop(); + return; + } + + t->setProperty("tries", ++tries); + }); + t->start(); +} + + +void ScriptDialog::slotDiscard() +{ + if (LtsWidgets::LtsMessageDialog::showMessage(this, tr("Are you sure you want to discard all unsaved changes?"), tr("Discard unsaved changes?"), + LtsWidgets::Behaviour::Modal, LtsWidgets::Button::Discard | LtsWidgets::Button::Cancel) + == LtsWidgets::Button::Discard) + { + getPresentationContent(); + __unchange__(); + m_ui->widget->setReadonly(false); // TODO: why do I have to "un-readonly" after discarding?! + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Hide, false); + } +} + + +bool ScriptDialog::topicTypeOnEssentialsView(TrackEntryType tet) const +{ + switch (tet) + { + case TrackEntryType::Building: + return true; + + default: + break; + } + + return false; +} + + +void ScriptDialog::previewSecond(int time, int ignoreTopicForReplay) +{ + if (!m_enableApply) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Stop replay first.")); + return; + } + + m_positionTime = time; + m_stopAfterPlayingFilterTopic = true; + m_ignoreTopicForReplay = ignoreTopicForReplay; + + slotPlay(); +} + + +void ScriptDialog::slotSetTopicPosition(QWidget *previewWidget, int ignoreTopicForReplay) +{ + TopicEditorBase::TopicEditor *topicEditor = qobject_cast(sender()); + + if (topicEditor == nullptr) + { + //qWarning() << "slotSetTopicPosition: topic editor invalid"; + return; + } + + TrackEntry *te = topicEditor->trackEntry(); + + if (te == nullptr) + { + //qWarning() << "slotSetTopicPosition: topic editor's track entry is invalid"; + return; + } + + int topicId = te->m_topicId; + + // need to get the TE from the timeline, not the topic editor + TrackEntry *thaRealTe = m_ui->widget->getTrackEntry(topicId); + int previewTime = -1; + + if (thaRealTe == nullptr) + { + // maybe it's a filter topic? + + thaRealTe = m_ui->widget->getTrackEntryWithFiltersAsEntries(topicId); + + if (thaRealTe == nullptr) + { + ERROR_LOG(m_logger) << "te not found: " << topicId; + return; + } + + previewTime = m_ui->widget->getFilterTrackEntryRealTime(thaRealTe); + } + else + previewTime = thaRealTe->m_startTime; + + previewSecond(previewTime, ignoreTopicForReplay); + + // show topic positioner on the coherant playback screen where the preview currently is + Screen *screen = getProjectionWidget(identifyProjectionWidget(thaRealTe)); + if (screen == nullptr) + return; + + if (m_currentTopicDesigner != nullptr) + m_currentTopicDesigner->deleteLater(); + + TopicDesigner *td = new TopicDesigner(screen, previewWidget); + td->loadTopicList({ thaRealTe }); // don't copy - directly affect ! + td->selectTopic(te->m_topicId); + td->setGeometry(0, 0, screen->width(), screen->height()); + td->show(); + td->setFocus(); + td->raise(); + + previewWidget->update(); + + connect(td, &TopicDesigner::signalChangesMade, + this, &ScriptDialog::slotChangesMade); + + m_currentTopicDesigner = td; + + connect(topicEditor, &TopicEditorBase::TopicEditor::destroyed, + td, &TopicDesigner::deleteLater); // remove topic designer if topic editor was closed +} + + +void ScriptDialog::slotCheckNewTopicLength(int newLength, LtsUtils::Promise *promise) +{ + TopicEditorBase::TopicEditor *topicEditor = qobject_cast(sender()); + + if (topicEditor == nullptr) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("A check has failed...")); + return; + } + + if (m_ui->widget->checkNewLength(topicEditor->trackEntry(), newLength)) + promise->resolve(); + else + promise->reject(); +} + + +TopicEditorBase::TopicEditor *ScriptDialog::createTopicEditor(TrackEntry *te) // TODO: do not return, should set 'm_currentTopicEditor' ! +{ + for (const TopicAssignment &ta : qAsConst(m_trackEntryAssignments)) + { + if (ta.m_trackEntryType == te->m_type) + { + if (topicTypeOnEssentialsView(te->m_type) && m_essentialsViewApp == nullptr) + { + LtsWidgets::LtsMessageDialog::showMessage(this, + tr("Please start the Essentials View first to work with this topic", "'Hilfsansicht benoetigt'"), + tr("Unable to start topic editor")); + + return nullptr; + } + + TopicEditorBase::TopicEditor *_newTopicEditor = ta.m_topicEditorIfc->createTopicEditor(te); + if (_newTopicEditor == nullptr) + { + LtsWidgets::LtsMessageDialog::showMessage(this, + tr("Cannot add Topic '%1' as there was an error while initializing the Topic").arg(ta.m_topicName), + tr("Unable to create Topic")); + + return nullptr; + } + + LtsWidgets::LtsDialog *newTopicEditor = qobject_cast(_newTopicEditor); + if (!newTopicEditor) + { + LtsWidgets::LtsMessageDialog::showMessage(this, + tr("Cannot add Topic '%1' as it is invalid").arg(ta.m_topicName), + tr("Unable to create Topic Editor")); + + return nullptr; + } + + connect(newTopicEditor, &LtsWidgets::LtsDialog::destroyed, + this, &ScriptDialog::slotNull); //[this]() { m_currentTopicEditor = nullptr; }); // FIXME: * + + connect(_newTopicEditor, &TopicEditorBase::TopicEditor::signalTrackEntryModified, + this, &ScriptDialog::slotTrackEntryModified); + + connect(_newTopicEditor, &TopicEditorBase::TopicEditor::signalSetTopicPosition, + this, &ScriptDialog::slotSetTopicPosition); + + connect(_newTopicEditor, &TopicEditorBase::TopicEditor::signalCheckNewTopicLength, + this, &ScriptDialog::slotCheckNewTopicLength); + + TrackEntryPreviewWidget *tepw = _newTopicEditor->trackEntryPreviewWidget(); + + + if (LtsUtils::OperatorSettings::getInstance()->value(QStringLiteral("Scripts"), QStringLiteral("HideOnDrag"), true) == QVariant(true)) + { + connect(tepw, &TrackEntryPreviewWidget::signalStartDrag, + m_exerciseSession->baseLayout(), &LtsWidgets::LtsBaseLayoutWidget::onHideAnimated); + connect(tepw, &TrackEntryPreviewWidget::signalStopDrag, + m_exerciseSession->baseLayout(), &LtsWidgets::LtsBaseLayoutWidget::onReShowAnimated); + } + + _newTopicEditor->updateData(te); + + return _newTopicEditor; + } + } + + return nullptr; +} + + +void ScriptDialog::slotNull(QObject *obj) +{ + if (static_cast(m_currentTopicEditor) == obj) // the dialog should only remove ITSELF - if anyone has already overwritten this variable, then do nothing + m_currentTopicEditor = nullptr; +} + + +void ScriptDialog::slotTrackEntryModified() +{ + m_ui->widget->updateEverything(); + slotChangesMade(); +} + + +TopicEditorBase::TopicEditor *ScriptDialog::createTopic(const TopicAssignment &ta) +{ + TrackEntry *te = new TrackEntry(ta.m_trackEntryType); // this leaks according to valgrind + te->m_startTime = -1; // ....... + te->m_length = 30; + te->m_topicId = m_ui->widget->nextUniqueId(); + te->index = te->m_topicId; // FIXME: worx? + + TopicEditorBase::TopicEditor *diag = createTopicEditor(te); + if (diag) + { + connect(diag, &TopicEditorBase::TopicEditor::addNewTopicEditor, this, &ScriptDialog::createTopicFromTrackEntry); + addDialog(diag, m_menuGroup, QString(), LtsWidgets::LayoutArea::eDialogTab); + } + else + delete te; + + return diag; +} + + +TopicEditorBase::TopicEditor *ScriptDialog::createTopic(const LtsScriptTimeline::TrackEntry &data) +{ + TrackEntry *te = new TrackEntry(data.m_type); // this leaks according to valgrind + te->m_startTime = data.m_startTime; // ....... + te->m_length = data.m_length > 0 ? data.m_length : 30; + te->m_detailData = data.m_detailData; + te->m_topicId = m_ui->widget->nextUniqueId(); + te->index = te->m_topicId; // FIXME: worx? + + TopicEditorBase::TopicEditor *diag = createTopicEditor(te); + if (diag) + { + connect(diag, &TopicEditorBase::TopicEditor::addNewTopicEditor, this, &ScriptDialog::createTopicFromTrackEntry); + addDialog(diag, m_menuGroup, QString(), LtsWidgets::LayoutArea::eDialogTab); + } + else + delete te; + + return diag; +} + + +void ScriptDialog::createTopicFromTrackEntry(TrackEntry *data) +{ + TopicEditorBase::TopicEditor *diag = createTopic(*data); +// TopicEditorBase::TopicEditor *diag = createTopic(m_trackEntryToTopicAssignment.value(data->m_type)); + diag->updateData(data); + //diag->apply2(); +} + + +void ScriptDialog::getPresentationContent() // TODO: make async +{ + LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Waiting for script content ...")); + setUnchangeable(true); + m_ui->widget->clear(); + prepareScriptTimeline(m_ui->widget, tr("Screen 1"), tr("Screen 2"), tr("Replay"), tr("Audio")); + + + std::function handlePresentationContent = [this](const Core::FunctionReply & baseReply) + { + const GetPresentationContentReply &reply = static_cast(baseReply); + const dds::core::vector &contentList = reply.content(); + + if (contentList.size() < 1) + { + WARNING_LOG(m_logger) << "No content for Script Id = " << m_scriptId; + setUnchangeable(false); + return; + } + + m_ignoreChanges = true; + + int highestId = 0; + + for (const PresentationManagement::PresentationContent &content : contentList) + { + auto tea = m_trackEntryAssignments.constFind(QString::fromStdString(content.presentationTopicType())); // FIXME: tr'd keys will ruin this !! + if (tea == m_trackEntryAssignments.constEnd()) + { + ERROR_LOG(m_logger) << "Invalid content for type " << QString::fromStdString(content.presentationTopicType()); + ///*DEBUG_LOG*/WARNING_LOG(m_logger) << "Available keys:" << m_trackEntryAssignments.keys().join(QStringLiteral(", ")); + continue; + } + + const TopicAssignment &ta = *tea; + int topicId = content.id(); + TrackEntry *te = trackEntryFromContent(content, topicId, ta.m_trackEntryType); + + if (topicId > highestId) + highestId = topicId; + + if (!m_ui->widget->addTopic(te)) + { + WARNING_LOG(m_logger) << "couldn't load topic #" << te->m_topicId; + delete te; + } + } + + m_ignoreChanges = false; + + if (m_ui->widget->nextUniqueId() /* waste 1 id */ < highestId) + m_ui->widget->setUniqueIdCounter(highestId + 1); + + fillTopicVector(); + setUnchangeable(false); + }; + + + m_requestHelper = new LtsUtils::RequestHelper(this); + + DEBUG_LOG(m_logger) << "waiting for script content.."; + if (!m_requestHelper->startSingleRequest([this]() // blocking! TODO: async! +{ + return m_ftc->getPresentationContentRequest(GetPresentationContentRequest(m_scriptId), this); + }, handlePresentationContent)) + { + ERROR_LOG(m_logger) << "Cannot retrieve Presentation Content for ScriptId = " << m_scriptId; + //return false; TODO: + setUnchangeable(false); + } + + // blocking, so this is safe: + m_requestHelper->deleteLater(); + m_requestHelper = nullptr; +} + + +bool ScriptDialog::tryAddTopics(QStringList &resultList /* out */) +{ + // Special Topics + if (!tryAddTopic + (TrackEntryType::SituationReplay, resultList, SpecialTopicType::ReplayTopic)) + return false; + + if (!tryAddTopic + (TrackEntryType::TacticalPlan, resultList, SpecialTopicType::FilterTopic)) + return false; + + if (!tryAddTopic + (TrackEntryType::SituationMapFilter, resultList, SpecialTopicType::FilterTopic)) + return false; + + if (!tryAddTopic + (TrackEntryType::Snapshot, resultList, SpecialTopicType::ReplayTopic)) + return false; + + + + // Standard Topics + if (!tryAddTopic + (TrackEntryType::SituationMap, resultList)) + return false; + + if (!tryAddTopic + (TrackEntryType::Situation, resultList)) + return false; + + // optional: + /*if (!*/tryAddTopic + (TrackEntryType::Audio, resultList);/*) + return false;*/ + /*if (!*/tryAddTopic + (TrackEntryType::Video, resultList);/*) + return false;*/ + + if (!tryAddTopic + (TrackEntryType::Image, resultList)) + return false; + if (!tryAddTopic + (TrackEntryType::Pdf, resultList)) + return false; + if (!tryAddTopic + (TrackEntryType::Text, resultList)) + return false; + + /*if (!*/tryAddTopic + (TrackEntryType::Building, resultList);/*) + return false;*/ + + if (!tryAddTopic + (TrackEntryType::Evaluation, resultList)) + return false; + + if (!tryAddTopic + (TrackEntryType::Report, resultList)) + return false; + + return true; +} + + +void ScriptDialog::startReplaySession() +{ + LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Starting replay session ...")); + + // start replay + const int partitionId = m_exerciseSession->partitionId(); + + auto success = [this]() + { + // join replay + int replayId = m_requestHelper->getRepliedId(); + + // the request helper this function was called from can now be deleted + m_requestHelper->deleteLater(); + m_requestHelper = nullptr; + + if (replayId < 1) + { + ERROR_LOG(m_logger) << "replayId < 1"; + initFailed(__LINE__); + return; + } + + + // wait until replay is available (kinda hacky) + QTimer *t = new QTimer(this); + t->setInterval(1000); + t->setProperty("tries", 0); + connect(t, &QTimer::timeout, // => ! + this, [this, t, replayId]() + { + int tries = t->property("tries").toInt(); + + if (tries > 7) + { + t->stop(); + initFailed(__LINE__); + return; + } + + t->setProperty("tries", tries++); + + + LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Waiting for replay session ...")); + + + Core::ReplayPartition rp(m_coreDtc->replayPartition(replayId)); + + if (rp.id() == 0) // not available yet, wait for next turn + return; + // replay available now! + + + t->stop(); + + if (rp.id() != replayId) + { + ERROR_LOG(m_logger) << "Script Player: replay ids do not match!!! cannot start app"; + initFailed(__LINE__); + return; + } + + LtsSession::DdsConnectionParams connParams(rp); + m_replaySession = m_exerciseSession->getSessionManager()->createSession(connParams, true, false, true /* hide blw */); + + if (m_replaySession == nullptr) + { + ERROR_LOG(m_logger) << "m_replaySession == nullptr"; + initFailed(__LINE__); + return; + } + + connect(m_replaySession, &LtsSession::LtsSession::destroyed, + this, [this](QObject * obj) + { + if (m_replaySession == static_cast(obj)) + m_replaySession = nullptr; + }); + + connect(m_replaySession, &LtsSession::LtsSession::signalDoneInitializingSession, // => ! + this, [this]() + { + disconnect(m_replaySession, &LtsSession::LtsSession::signalDoneInitializingSession, + this, nullptr); + + QStringList resultList; + bool r = tryAddTopics(resultList); // creates topic assignments + + QString result(resultList.join(QStringLiteral("
- "))); + + if (r && !result.isEmpty()) + WARNING_LOG(m_logger) << "At least one optional widget & control interface failed to load: " << result; + + if (!r) + { + ERROR_LOG(m_logger) << "At least one widget & control interface failed to load: " << result; + initFailed(__LINE__); + return; + } + + loadScript(); + createSitMapApp(); // => ! + }); + }); + t->start(); + }; + + + auto failure = [this]() + { + // the request helper this function was called from can now be deleted + m_requestHelper->deleteLater(); + m_requestHelper = nullptr; + + ERROR_LOG(m_logger) << "replayPartitionCreateRequest failed"; + initFailed(__LINE__); + }; + + + m_requestHelper = new LtsUtils::RequestHelper(this, true /* quiet, we handle errors ourselves */, success, failure); // gets deleted on success / failure callbacks + + m_requestHelper->startSingleBackgroundRequest([this, partitionId]() // => ! + { + return m_srmForeign->replayPartitionCreateRequest(partitionId, + LtsSessionData::LtsSessionData::getInstance()->getWorkstationId(), + LtsSessionData::LtsSessionData::getInstance()->getOperatorId(), + Core::ReplayType::SituationData, + this); + }); + + // NOTE: non-blocking!! +} + + +void ScriptDialog::initFailed(int reason) +{ + LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); + connect(new LtsWidgets::LtsMessageDialogNew(this, tr("Scripts app could not be initialized. Reason id: %1").arg(QString::number(reason, 16 /* hex */)), tr("Initialization failed")), &LtsWidgets::LtsMessageDialogNew::destroyed, + this, [this]() + { +#ifdef MIKE_CODE + m_exerciseSession->slotClose(); // close scripts app +#else + emit m_replaySession->signalClose(); +#endif + }); +} + + +void ScriptDialog::loadScript() +{ + m_scriptsExerciseId = m_scriptId; // for ScriptPlayer code + m_scriptName = QString::fromStdString(m_dtc->presentation(m_scriptId).name()); + int ownerId = m_dtc->presentation(m_scriptId).operatorId(); + m_scriptOwner = QString::fromStdString(m_opmDtc->user(ownerId).name()); + m_lastModified = m_dtc->presentation(m_scriptId).lastModified(); + m_exerciseName = m_exerciseSession->exerciseData()->exName; + + m_exerciseSession->baseLayout()->setCustomText(tr("Script: %1").arg(m_scriptName)); + + QJsonObject savegame = m_exerciseSession->getSavegame(); + savegame[QStringLiteral("ScriptId")] = m_scriptId; + m_exerciseSession->setSavegame(savegame); + + getPresentationContent(); // TODO: make fn async +} + + +bool ScriptDialog::init(LtsSession::LtsSession *session, + const int scriptId, + const std::shared_ptr &dtc, + const std::shared_ptr &ftc, + const std::shared_ptr &srmForeign, + const std::shared_ptr &coreDtc, + const std::shared_ptr &opmDtc) +{ + LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(tr("Initializing script ...")); + + m_exerciseSession = session; + m_dtc = dtc; + m_ftc = ftc; + m_srmForeign = srmForeign; + m_coreDtc = coreDtc; + m_scriptId = scriptId; + m_opmDtc = opmDtc; + + startReplaySession(); // => ! + + connect(m_presentationTimer, &QTimer::timeout, + this, &ScriptDialog::slotTimerTick); + + m_presentationTimer->setInterval(1024 /* One Kilosecond :) */); + + + + m_ui->pbInitScr1->setEnabled(true); + connect(m_ui->pbInitScr1, &QPushButton::clicked, + this, [this]() + { + initProjectionWidget(&m_projectionWidget1); + }); + + + m_ui->pbInitScr2->setEnabled(true); + connect(m_ui->pbInitScr2, &QPushButton::clicked, + this, [this]() + { + initProjectionWidget(&m_projectionWidget2); + }); + + m_ui->pbNextTopic->setEnabled(false); + connect(m_ui->pbNextTopic, &QPushButton::clicked, + this, &ScriptDialog::slotToNextTopic); + + m_ui->pbPreviousTopic->setEnabled(false); + connect(m_ui->pbPreviousTopic, &QPushButton::clicked, + this, &ScriptDialog::slotToPreviousTopic); + + connect(m_ui->pbUntilNextTopic, &QPushButton::clicked, + this, &ScriptDialog::slotPlayUntilNextTopic); + + //m_ui->pbInit->click(); // Debug to create playback window immediately + m_ui->pbPlay->setEnabled(true); + + + QTimer *duration = new QTimer(this); + duration->setInterval(1000); + connect(duration, &QTimer::timeout, + this, [this] + { + m_duration++; + m_ui->lblDuration->setText(toReadableTime(m_duration)); + }); + duration->start(); + + // foreach (TrackEntry *te, topicVector) + // { + // m_topicMap.insert(te->m_startTime, te); + // } + + m_journal.started = QDateTime::currentMSecsSinceEpoch(); // TODO: time source & format ? + + + { + LtsWidgets::PluginData data; + data.menuGroup = m_menuGroup; + data.identifier = QLatin1String("PresentationManagement.ScriptDialog.ExportScript"); + data.menuIcon = QIcon(QLatin1String("icon:export_documents.svg")); + data.menuText = tr("Export Script"); + data.operatorRight = OperatorRights::ScriptEditorEdit; + data.directFunc = [this](const LtsWidgets::PluginData &) + { + return slotExportScript(); + }; + data.createWidgetFunc = nullptr; + + m_exerciseSession->addAction(data); + } + + { + LtsWidgets::PluginData data; + data.menuGroup = m_menuGroup; + data.identifier = QLatin1String("PresentationManagement.ScriptDialog.LoadScript"); + data.menuIcon = QIcon(QLatin1String("icon:import_documents.svg")); + data.menuText = tr("Load Script"); + data.operatorRight = OperatorRights::ScriptEditorEdit; + data.directFunc = [this](const LtsWidgets::PluginData &) + { + return slotLoadScript(); + }; + data.createWidgetFunc = nullptr; + + m_exerciseSession->addAction(data); + } + + return true; +} + + +void ScriptDialog::createSitMapApp() +{ + LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Starting replay app ...")); + + // TODO: works for single SituationMap only + // Replay SitMap must have a BaseLayout... + bool oldFlagValue = LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl")).toBool(); + LtsSessionData::LtsSessionData::getInstance()->setDebugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl"), true); // HACK: ! + m_sitMapApp = LtsAppManager::LtsAppManager::getInstance()->createApp(LtsAppDescriptor::App::Situation, + m_replaySession->connParams(), QString(), true /* start app hidden */); + if (m_sitMapApp == nullptr) + { + LtsSessionData::LtsSessionData::getInstance()->setDebugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl"), oldFlagValue); // reset if sit map app cannot load + ERROR_LOG(m_logger) << "createApp returned nullptr for m_sitMapApp"; + initFailed(__LINE__); + return; + } + + if (m_sitMapApp != nullptr) + { + connect(m_sitMapApp, &LtsPluginManager::LtsPluginManager::destroyed, + this, [this](QObject * obj) + { + if (static_cast(m_sitMapApp) == obj) + m_sitMapApp = nullptr; + }); + + connect(m_sitMapApp, &LtsPluginManager::LtsPluginManager::signalInitializationFinished, + this, [this]() + { + LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Getting interfaces from replay app ...")); + + disconnect(m_sitMapApp, &LtsPluginManager::LtsPluginManager::signalInitializationFinished, this, nullptr); + + LtsSession::LtsSession *appSession = m_sitMapApp->getSession(m_replaySession->partitionType(), m_replaySession->partitionId()); + + if (appSession != nullptr) + { + // connect(appSession, &LtsSession::LtsSession::signalInitializationFinished, + // this, [this, appSession]() session is ready if app is ready, we asked for readyness on m_sitMapApp already! + + m_sitMapSession = appSession; + + m_sitMapSession->baseLayout()->collapseMenu(); + +#ifndef LTS_DEBUG + m_sitMapSession->baseLayout()->setTopBarVisible(false); +#endif + + connect(m_sitMapSession, &LtsSession::LtsSession::destroyed, + this, [this](QObject * obj) + { + if (static_cast(m_sitMapSession) == obj) + m_sitMapSession = nullptr; + }); + + //disconnect(appSession, &LtsSession::LtsSession::signalInitializationFinished, this, 0); + + // SituationMapFilter must be fed the to-be-filtered SituationMap ifc !!! + std::shared_ptr sitMapIfc; + if (m_sitMapSession->getForeignGuiInterface(sitMapIfc)) + { + // set sitmap for filter + std::shared_ptr sitMapFilterIfc; + if (m_replaySession->getForeignGuiInterface(sitMapFilterIfc)) + { + SituationMap::ForeignGuiInterface *sitMapIfcPtr = sitMapIfc.get(); + sitMapFilterIfc->setSitMapGuiIfc(sitMapIfcPtr); + } + else + { + ERROR_LOG(m_logger) << "setting SitMapFilterIfc's SitMapPtr to this SitMapIfc failed, because the SitMapFilterIfc could not be found !!"; + initFailed(__LINE__); + return; + } + + + // set sitmap for replac control (for the all-in-one 'Situation' topic) + std::shared_ptr replayControlIfc; + if (m_replaySession->getForeignGuiInterface(replayControlIfc)) + { + SituationMap::ForeignGuiInterface *sitMapIfcPtr = sitMapIfc.get(); + replayControlIfc->setSitMapIfc(sitMapIfcPtr); + } + else + { + ERROR_LOG(m_logger) << "setting ReplayControlIfc's SitMapPtr to this SitMapIfc failed, because the ReplayControlIfc could not be found !!"; + initFailed(__LINE__); + return; + } + } + else + { + ERROR_LOG(m_logger) << "setting SitMapFilterIfc's SitMapPtr to this SitMapIfc failed, because the SitMapIfc could not be found !!"; + initFailed(__LINE__); + return; + } + + + + + + // give replay's filter ifc an ApplyFilter to the SitMapSession + { + std::shared_ptr fltIfc; // map's flt ifc + if (m_sitMapSession->getForeignGuiInterface(fltIfc)) + { + MarkerManagement::MarkerManagementApplyFilter *applyFilterPtr = new MarkerManagement::MarkerManagementApplyFilter(m_sitMapSession, fltIfc); + QPointer applyFilter(applyFilterPtr); + connect(m_replaySession, &LtsSession::LtsSession::destroyed, applyFilterPtr, [applyFilter]() { delete applyFilter; }); + connect(m_sitMapSession, &LtsSession::LtsSession::destroyed, applyFilterPtr, [applyFilter]() { delete applyFilter; }); + + + std::shared_ptr sitMapFilterGuiIfc; // filter topic's ifc + if (m_replaySession->getForeignGuiInterface(sitMapFilterGuiIfc)) + { + sitMapFilterGuiIfc->setApplyFilter(applyFilter); + DEBUG_LOG(m_logger) << "set sit map filter ifc's apply filter"; + } + else + WARNING_LOG(m_logger) << "cannot set sit map filter ifc's apply filter - cannot find filter topic's ifc"; + + + std::shared_ptr sitRepIfc; // filter topic's ifc + if (m_replaySession->getForeignGuiInterface(sitRepIfc)) + { + sitRepIfc->setApplyFilter(applyFilter); + DEBUG_LOG(m_logger) << "set sit replay ifc's apply filter"; + } + else + WARNING_LOG(m_logger) << "cannot set sit replay ifc's apply filter - cannot find filter topic's ifc"; + } + else + WARNING_LOG(m_logger) << "cannot set sit map filter ifc's apply filter - cannot find map's flt ifc"; + } + + + // PlanOverlay needs map of SitMapApp + std::shared_ptr planOverlayIfc; + if (m_replaySession->getForeignGuiInterface(planOverlayIfc)) + { + std::shared_ptr sitMapIfc; + if (m_sitMapSession->getForeignGuiInterface(sitMapIfc)) + { + SituationMap::ForeignGuiInterface *sitMapIfcPtr = sitMapIfc.get(); + planOverlayIfc->setForeignSitMapGuiIfc(sitMapIfcPtr); + } + else + { + DEBUG_LOG(m_logger) << "setting planOverlayIfc's SitMapPtr to this SitMapIfc failed, because the SitMapIfc could not be found !!"; + initFailed(__LINE__); + return; + } + } + else + { + DEBUG_LOG(m_logger) << "setting planOverlayIfc's SitMapPtr to this SitMapIfc failed, because the SitMapFilterIfc could not be found !!"; + initFailed(__LINE__); + return; + } + + + // playbackInit on mrkIfc needs to redirect the Snapshot data to the sitMapApp's mrkIfc so that the Snapshot data can be applied on the sitmap of the sitMapApp ! + std::shared_ptr thisMrkIfc; // this app's replay session's mrk ifc + if (m_replaySession->getForeignGuiInterface(thisMrkIfc)) + { + std::shared_ptr sitMapMrkIfc; // sitMapApp's replay session's mrk ifc (where the data needs to be redirected to) + if (m_sitMapSession->getForeignGuiInterface(sitMapMrkIfc)) + thisMrkIfc->setScriptsMrkIfc(sitMapMrkIfc.get()); + else + { + DEBUG_LOG(m_logger) << "setting mrkIfc redirection failed - sitMap mrkIfc not found !"; + initFailed(__LINE__); + return; + } + } + else + { + DEBUG_LOG(m_logger) << "setting mrkIfc redirection failed - this mrkIfc not found !"; + initFailed(__LINE__); + return; + } + + + // NOTE: this is the point when all this initialization is successfully done! + m_ui->widget->updateEverything(); + LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); + changelogCheck(); + } + else + { + ERROR_LOG(m_logger) << "could not start situation map app !!"; + initFailed(__LINE__); + return; + } + }); + } + else + { + ERROR_LOG(m_logger) << "Failed to start Situation App!"; + initFailed(__LINE__); + return; + } +} + + +void ScriptDialog::changelogCheck() +{ + // Patrick said the message is not needed anymore + return; + + LtsUtils::OperatorSettings *opSettings = LtsUtils::OperatorSettings::getInstance(); + + bool ok = false; + static QString key(QStringLiteral("ScriptEditor")); + static QString val(QStringLiteral("LastChangeLog")); + int lastChangelog = opSettings->value(key, val).toInt(&ok); + + static int currentChangelog = 2; + if (!ok || lastChangelog < currentChangelog) + { + opSettings->setValue(key, val, currentChangelog); + + // TODO: setOverlay instead of a parent-less message that clocks the monitor selection in MMM mode + new LtsWidgets::LtsMessageDialogNew(this, tr("New topic available: 'Situation'
" + "You can now have a replay, a map and a map filter inside one single topic,
" + "instead of creating all three topics separately.
" + "
" + "To simplify naming, the 'Situation Map' topic is now the 'Map' topic.
" + "The 'Situation Replay' topic becomes the 'Replay' topic.
" + "For clarification: the 'Map Filter' topic stays the same.")); + } +} + + +void ScriptDialog::slotChangesWereMade() // imagine the length of the topic has changed and the coherant editor is opened => give him the new length +{ + fillTopicVector(); + slotChangesMade(); + + if (m_currentTopicEditor == nullptr)// || m_selectedTeId == -1) + return; + + TrackEntry *te = m_ui->widget->getTrackEntryWithFiltersAsEntries(m_currentTopicEditor->topicId()); + + if (te == nullptr) + return; + + m_currentTopicEditor->updateLength(te->m_length); +} + + +bool ScriptDialog::topicStringToType(const QString &typeName, TrackEntryType &tet) const +{ + for (const TopicAssignment &tea : m_trackEntryAssignments) + { + if (tea.m_topicName == typeName) + { + tet = tea.m_trackEntryType; + return true; + } + } + return false; +} + + +int ScriptDialog::getCurrentScriptEndTime() const +{ + return m_ui->widget->getCurrentScriptEndTime(); +} + + +bool ScriptDialog::isEssentialsViewOpened() const +{ + return !m_buttonBox->isButtonEnabled(LtsWidgets::DialogButton::Load); +} + + +TrackEntry *ScriptDialog::trackEntryFromContent(const PresentationManagement::PresentationContent &content, + int topicId, + TrackEntryType trackType) +{ + TrackEntry *te = new TrackEntry; + + te->m_topicId = topicId; + te->m_startTime = content.startTime(); + te->m_length = content.duration(); + te->m_type = trackType; + te->index = content.index(); + + te->x = content.x(); + te->y = content.y(); + te->h = content.height(); + te->w = content.width(); + + te->m_detailData = QJsonDocument::fromJson(QByteArray(content.attributes().c_str(), content.attributes().size())).object(); + te->m_channelName = QString::fromStdString(content.channel()); + te->m_description = QString::fromStdString(content.description()); + + return te; +} + + +bool ScriptDialog::apply() +{ + if (m_scriptRunning) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Stop replay first.")); + return false; + } + + int32_t opId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId(); + int64_t lastModified = QDateTime::currentMSecsSinceEpoch(); + + PresentationManagement::Presentation p = m_dtc->presentation(m_scriptId); + QString name = QString::fromStdString(p.name()); + QString description = QString::fromStdString(p.description()); + if (p.operatorId() != opId) + { + bool notSave = (LtsWidgets::Button::No == LtsWidgets::LtsMessageDialog::showMessage(this + , tr("Do you want to save a copy of the existing script from another user?
Yes: Copy script and save the changes
No: Cancel and give up changes") + , tr("Copy script") + , LtsWidgets::Behaviour::Modal + , LtsWidgets::Button::Yes | LtsWidgets::Button::No)); + if (notSave) + return false; + else + { + ERROR_LOG(m_logger) << "Creating a copy of script " << m_scriptId; + m_scriptId = 0; + name = tr("Copy of ")+ name; + } + + } + if (p.id() < 1) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Unknown script!")); + return false; + } + + int32_t id = m_scriptId; + + const QMap > trackList = m_ui->widget->getTrackEntriesWithFilters(); // get all topics + + int size = 0; + + for (const auto &trackEntryList : qAsConst(trackList)) + size += trackEntryList.count(); + + PresentationModifyRequest req; + auto &content = req.content(); + content.resize(size); + + size_t cp = 0; + for (auto i1 = trackList.constBegin(); i1 != trackList.constEnd(); ++i1) + { + const QVector &trackEntryList = *i1; + const QString &trackName = i1.key(); + + for (const TrackEntry *te : trackEntryList) + { + QString typeName = trackEntryTypeName(te->m_type); + if (!typeName.size()) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Unknown topic type!")); + return false; + } + + PresentationManagement::PresentationContent &pc = content.at(cp++); + + pc.id(te->m_topicId); + pc.presentationId(m_scriptId); + pc.presentationTopicType(typeName.toStdString()); + pc.channel(trackName.toStdString()); + pc.startTime(te->m_startTime); + pc.duration(te->m_length); + + // add Filters to detail data + + const QByteArray detailData = QJsonDocument(te->m_detailData).toJson(QJsonDocument::Compact); + pc.attributes(detailData.data()); + pc.description(te->m_description.toStdString()); + pc.x(te->x); + pc.y(te->y); + pc.height(te->h); + pc.width(te->w); + } // for i2 + } // for i1 + + req.id(id); + req.name(name.toStdString()); + req.description(description.toStdString()); + req.operatorId(opId); + req.lastModified(lastModified); + req.fileStatus(FileStatus::Valid); + req.content(content); + + + m_requestHelper = new LtsUtils::RequestHelper(this); + + bool result = m_requestHelper->startSingleRequest([req, this]() + { + return m_ftc->presentationModifyRequest(req, this); + }); + + m_scriptId = m_requestHelper->getRepliedId(); + + // blocking, so this is safe: + m_requestHelper->deleteLater(); + m_requestHelper = nullptr; + + if (result) + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); // allow the user to start the presentation now (after saving) + + fillTopicVector(); + + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Hide, false); + + return result; +} + + +void ScriptDialog::slotTrackEntrySelectionChanged(TrackEntry *) +{ + QVector selectedTrackEntries(m_ui->widget->getTrackEntries(true)); + selectedTrackEntries += m_ui->widget->getSelectedFilterEntries(); + int count = selectedTrackEntries.count(); + + if (count == 1) // single selection + { + TrackEntry *te = selectedTrackEntries.at(0); + int time = te->m_startTime; + + m_ui->widget->setIndicatorTime(time); + m_positionTime = time; + m_selectedTeId = te->m_topicId; + } + else // multi selection + m_selectedTeId = -1; + + m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setEnabled(count == 1); + + return; +} + + +void ScriptDialog::setPositionTime(int positionTime, bool setByUser) +{ + m_positionTime = positionTime; + m_ui->posSlider->setValue(m_positionTime); + m_ui->widget->setIndicatorTime(m_positionTime); + m_ui->lblPos->setText(toReadableTime(m_positionTime)); + + if (setByUser) + { + if (!m_presentationTimer->isActive()) + m_journal.journalList.append(new SetTimeJournal(m_positionTime)); + } + + m_ui->pbPreviousTopic->setEnabled(hasPreviousTopic()); + m_ui->pbNextTopic->setEnabled(hasNextTopic()); +} + + +void ScriptDialog::slotShowJournal() +{ + addDialog(LtsWidgets::initDialog(new JournalDialog(m_exerciseSession, this), &m_journal), + m_menuGroup, QStringLiteral("ScriptPlayer.Journal")); +} + + +void ScriptDialog::setPositionTimeActive(int positionTime, bool setByUser) +{ + setPositionTime(positionTime, setByUser); // set time to topic time + + if (!m_presentationTimer->isActive()) // not paused + return; + + m_presentationTimer->start(); // restart timer, prevent double ticks + slotTimerTick(); +} + + +int ScriptDialog::nextTopicTime() const +{ + const auto &topicMap = m_topicMap; + + auto nextTopicIter = topicMap.upperBound(m_positionTime); // get next topic after the current one + if (nextTopicIter == topicMap.constEnd()) // if pos is inside the last topic. values higher than the highest topic start time would return end() .. + { + DEBUG_LOG(m_logger) << "There is no next topic!"; + return -1; + } + + return nextTopicIter.key(); +} + + +void ScriptDialog::slotToNextTopic() +{ + int topicTime = nextTopicTime(); + + if (topicTime < 0) + return; + + if (m_presentationTimer->isActive()) // because slotTimerTick increases topicTime, and prev/next get useless while playing + { + topicTime -= 1; + + if (topicTime < 0) + topicTime = 0; + } + + setPositionTimeActive(topicTime); +} + + +void ScriptDialog::slotPlayUntilNextTopic() +{ + if (!m_presentationTimer->isActive()) + slotPlay(); + + int topicTime = nextTopicTime(); + + if (topicTime < 0) + { + DEBUG_LOG(m_logger) << "There is no next topic to play until!"; + return; + } + + m_nextPauseTime = topicTime; +} + + +int ScriptDialog::previousTopicTime() const +{ + if (m_topicMap.isEmpty()) + { + DEBUG_LOG(m_logger) << "There are no topics while checking for previous topic!"; + return -1; + } + + const auto &topicMap = m_topicMap; + auto prevTopicIter = topicMap.lowerBound(m_positionTime); // get current or next entry at pos + if (prevTopicIter == topicMap.constEnd()) // if pos is inside the last topic. values higher than the highest topic start time would return end() .. + { + // .. so set it to end and sub one + prevTopicIter = topicMap.lowerBound(topicMap.lastKey()); // ugly.. complicated way to say: "give me the first occurance of the last available iterator" + + if (prevTopicIter == topicMap.constEnd()) + { + Q_ASSERT(prevTopicIter != topicMap.constEnd()); + return -1; + } + } + + if (prevTopicIter == topicMap.constBegin()) + { + DEBUG_LOG(m_logger) << "There is no previous topic! (1)"; + return -1; + } + + prevTopicIter--; // go one back to get the previous topic + + if (prevTopicIter == topicMap.constEnd()) + { + DEBUG_LOG(m_logger) << "There is no previous topic! (2)"; + return -1; + } + + return prevTopicIter.key(); +} + + +void ScriptDialog::slotToPreviousTopic() +{ + int topicTime = previousTopicTime(); + + if (topicTime < 0) + return; + + if (m_presentationTimer->isActive()) // because slotTimerTick increases topicTime, and prev/next get useless while playing + { + topicTime -= 1; + + if (topicTime < 0) + topicTime = 0; + } + + setPositionTimeActive(topicTime); +} + + +bool ScriptDialog::isFilter(TrackEntryType tet) +{ + return (tet == TrackEntryType::TacticalPlan || + tet == TrackEntryType::SituationMapFilter); +} + + +Screen *ScriptDialog::getProjectionWidget(const ScriptDialog::ProjectionWidget &projectionWidget) +{ + switch (projectionWidget) + { + case ScriptDialog::ProjectionWidget::Unknown: + return nullptr; + case ScriptDialog::ProjectionWidget::Screen1: + return m_projectionWidget1; + case ScriptDialog::ProjectionWidget::Screen2: + return m_projectionWidget2; + } + Q_ASSERT(false); + return nullptr; +} + + +ScriptDialog::ProjectionWidget ScriptDialog::identifyProjectionWidget(TrackEntry *topic) const +{ + DEBUG_LOG(m_logger) << "identifyProjectionWidget: channel name: " << topic->m_channelName << ", filter parent channel name: " << topic->m_filterParentChannel; + + if (topic->m_channelName == QStringLiteral("Screen 2")) + return ProjectionWidget::Screen2; + if (topic->m_channelName == QStringLiteral("Screen 1")) + return ProjectionWidget::Screen1; + + // for filter topics: + if (topic->m_filterParentChannel == QStringLiteral("Screen 2")) + return ProjectionWidget::Screen2; + if (topic->m_filterParentChannel == QStringLiteral("Screen 1")) + return ProjectionWidget::Screen1; + + return ProjectionWidget::Unknown; +} + + +bool ScriptDialog::_tryAddTopic(TrackEntryType trackEntryType, + const std::shared_ptr &topicEditorIfc, + const std::shared_ptr &topicReplayFactory, + const std::shared_ptr &topicExportFactory, + QStringList &resultList, + const SpecialTopicType &specialTopicType) +{ + QString typeName = trackEntryTypeName(trackEntryType); + + TopicAssignment ta; + ta.m_topicName = typeName; + ta.m_trackEntryType = trackEntryType; + + ta.m_topicEditorIfc = topicEditorIfc; + ta.m_topicReplayFactory = topicReplayFactory; + ta.m_topicExportFactory = topicExportFactory; + + + if (ta.m_topicEditorIfc != nullptr) + { + if (!ta.m_topicEditorIfc->initTopicEditor()) + { + ERROR_LOG(m_logger) << "Cannot add topic type " << typeName << " since 'initTopicEditor' failed"; + resultList.append(typeName); + return false; + } + } + + m_trackEntryAssignments.insert(typeName, ta); + m_trackEntryToTopicAssignment.insert(trackEntryType, ta); + + if (topicEditorIfc) + { + // function for menu action + std::function f = [this](const LtsWidgets::PluginData & pd) + { + QString ident = pd.identifier; + ident.remove(QStringLiteral("AddTopic.")); + + auto teaIt = m_trackEntryAssignments.constFind(ident); + + if (teaIt == m_trackEntryAssignments.constEnd()) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Topic '%1' not found!").arg(ident)); + return; + } + + const TopicAssignment &tea = *teaIt; + + createTopic(tea); + }; + + // create menu action + LtsWidgets::PluginData plData; + + switch (specialTopicType) + { + case SpecialTopicType::FilterTopic: + { + plData.menuGroup = tr("Filter Topics"); + break; + } + + case SpecialTopicType::ReplayTopic: + { + plData.menuGroup = tr("Replay Topics"); + break; + } + + default: + { + plData.menuGroup = tr("Display Topics"); // zu deutsch: "Anzeige Topics" + break; + } + } + + plData.menuText = tr("Add %1 Topic").arg(translateTrackEntryType(trackEntryType)); + plData.identifier = QStringLiteral("AddTopic.%1").arg(typeName); + plData.menuIcon = appToIcon(trackEntryType); + plData.directFunc = f; + + m_exerciseSession->addAction(plData); + } + + return true; +} + + +bool ScriptDialog::usesAvsWindow(TrackEntryType trackEntryType) const +{ + return //trackEntryType == TrackEntryType::Audio || TODO: FIXME: window still visible for audio? + trackEntryType == TrackEntryType::Video; +} + + +void ScriptDialog::setReplayWidgetPosition(PlayingTopic *playingTopic) +{ + ScriptDialog::ProjectionWidget projectionWidgetType = identifyProjectionWidget(playingTopic->topic); + QWidget *projectionWidget = getProjectionWidget(projectionWidgetType); + + if (projectionWidget == nullptr) + { + ERROR_LOG(m_logger) << "screen for topic #" << playingTopic->topic->m_topicId << " not found"; + return; + } + + int projectionWidth = projectionWidget->width(); + int projectionHeight = projectionWidget->height(); + + DEBUG_LOG(m_logger) << "projection w: " << projectionWidth << ", h: " << projectionHeight; + + TrackEntry *topic = playingTopic->topic; + + // TESTS: +// topic->x = 0.7; +// topic->y = 0.7; +// topic->w = 0.15; +// topic->h = 0.15; + + int x = 0; + int y = 0; + + if (isScreenFreestanding(projectionWidgetType)) + { + QPoint pos2(projectionWidget->mapToGlobal(projectionWidget->pos())); + x = pos2.x(); + y = pos2.y(); + } + + QWidget *replayWidget = playingTopic->replayWidget; + + if (replayWidget == nullptr) + { + WARNING_LOG(m_logger) << "no replay widget for topic" << topic->m_topicId; + return; + } + + // without topic designer, x, w, y, h are -1 + if ((topic->x <= 0 && topic->w <= 0 && topic->y <= 0 && topic->h <= 0) // if *all* are 0 or smaller .. + || (topic->x < 0 || topic->w < 0 || topic->y < 0 || topic->h < 0)) // .. OR if minimum *one* is -1 (invalid) + { + replayWidget->setGeometry(x, y, projectionWidth, projectionHeight); + ERROR_LOG(m_logger) << "set geo of replay widget !! #1 x" << x << "y" << y; + } + else + { + double projectionX = projectionWidth; projectionX *= topic->x; + double projectionY = projectionHeight; projectionY *= topic->y; + double projectionW = projectionWidth; projectionW *= topic->w; + double projectionH = projectionHeight; projectionH *= topic->h; + + replayWidget->setGeometry(x + qRound(projectionX), y + qRound(projectionY), qRound(projectionW), qRound(projectionH)); + } + + DEBUG_LOG(m_logger) << "final widget geo: " << replayWidget->geometry().x() + << ", " << replayWidget->geometry().y() + << ", " << replayWidget->geometry().width() + << ", " << replayWidget->geometry().height(); + + replayWidget->show(); +} + + +void ScriptDialog::setReplayWidgetFreestanding(PlayingTopic *playingTopic, bool freestanding) +{ + QWidget *replayWidget = playingTopic->replayWidget; + + if (replayWidget == nullptr) + return; + + QWidget *projectionWidget = getProjectionWidget(identifyProjectionWidget(playingTopic->topic)); + + if (projectionWidget == nullptr) + { + ERROR_LOG(m_logger) << "screen for topic #" << playingTopic->topic->m_topicId << " not found"; + return; + } + + if (freestanding) + { + replayWidget->setParent(nullptr); // make replay widget a discrete window + replayWidget->hide(); + + replayWidget->setWindowFlags(Qt::Window | Qt::FramelessWindowHint); + replayWidget->setWindowModality(Qt::WindowModality::NonModal); + + replayWidget->show(); + replayWidget->activateWindow(); // make sure it is shown as its own window + } + else // 'unfreestand' + replayWidget->setParent(projectionWidget); + + //assignReplayWidgetToProjectionWidget(playingTopic->topic, replayWidget, projectionWidget, freestanding); // NOTE: m_currentlyFreestandingTopics has to be altered before calling this + + replayWidget->setContentsMargins(0, 0, 0, 0); + + replayWidget->show(); + replayWidget->raise(); + + setReplayWidgetPosition(playingTopic); // show first, then set position, otherwise avs screen placement would be visible +} + + +void ScriptDialog::avsVisibilityHack(QWidget *parentForScreen, bool visible) +{ + bool wasAlreadyActive = (visible != m_avsVisibilityHackActive); + + if (!wasAlreadyActive && parentForScreen != nullptr) + { + parentForScreen->setVisible(visible); + if (parentForScreen->parentWidget()) // HACK + { + parentForScreen->parentWidget()->setVisible(visible); + if (parentForScreen->parentWidget()->parentWidget()) // DOUBLE HACK + parentForScreen->parentWidget()->parentWidget()->setVisible(visible); + } + } + + m_avsVisibilityHackActive = !visible; + + if (!wasAlreadyActive && m_avsVisibilityHackActive && m_currentTopicDesigner != nullptr && m_currentTopicDesigner->parentWidget() != nullptr) // make TopicDesigner freestanding, too if it exists and was not already set freestanding + { + QWidget *widget = new QWidget(nullptr); + widget->activateWindow(); // make it a window + + QRect geo(m_currentTopicDesigner->parentWidget()->geometry()); + QSize s(geo.size()); + QPoint pos(m_currentTopicDesigner->parentWidget()->mapToGlobal(geo.topLeft())); // get pos on window manager, not on a parent + + widget->setGeometry(QRect(pos, s)); // same position as the now invisible screen + ERROR_LOG(m_logger) << "geo x" << widget->geometry().x() << "geo y" << widget->geometry().y() << "geo h" << widget->geometry().height() << "geo w" << widget->geometry().width(); + + // make widget transparent + widget->setWindowFlags(Qt::FramelessWindowHint/* | Qt::Popup*/); + widget->setAttribute(Qt::WA_TranslucentBackground); + + // make widget stay on top of everything as it floats + widget->setWindowFlag(Qt::WindowStaysOnTopHint); + widget->setWindowFlag(Qt::X11BypassWindowManagerHint); + + widget->show(); + widget->raise(); + + connect(m_currentTopicDesigner.data(), &TopicDesigner::destroyed, + widget, &QWidget::deleteLater); // remove the topic designer's floating container if topic designer was deleted + + // keep the widget in front of avs, always + QTimer *t = new QTimer(widget); + t->setInterval(500); + connect(t, &QTimer::timeout, + this, [widget]() + { + widget->raise(); + }); + t->start(); + + m_currentTopicDesigner->setParent(widget); + m_currentTopicDesigner->show(); + + ERROR_LOG(m_logger) << "made freestanding"; + } +} + + +void ScriptDialog::avsFreestandingHack(bool freestanding, QWidget *projectionWidget, QWidget **parentForScreen) +{ + if (freestanding && projectionWidget) + { + (*parentForScreen) = projectionWidget->parentWidget(); + + connect((*parentForScreen), &QWidget::destroyed, + this, [parentForScreen](QObject * obj) + { + if (static_cast((*parentForScreen)) == obj) + (*parentForScreen) = nullptr; + }); + + avsVisibilityHack(*parentForScreen, false); + } + else // recover + avsVisibilityHack(*parentForScreen, true); +} + + +void ScriptDialog::setFreestanding(bool freestanding, const ProjectionWidget &pw) // special case, avs window positioned above playback screens, preventing filter widgets to overlay videos +{ + switch (pw) + { + case ProjectionWidget::Screen1: + { + m_currentlyFreestandingTopicsScreen1 = freestanding; + avsFreestandingHack(freestanding, m_projectionWidget1, &m_previousParentForScreen1); + break; + } + + case ProjectionWidget::Screen2: + { + m_currentlyFreestandingTopicsScreen2 = freestanding; + avsFreestandingHack(freestanding, m_projectionWidget2, &m_previousParentForScreen2); + break; + } + + case ProjectionWidget::Unknown: + { + ERROR_LOG(m_logger) << "trying to set freestanding with unknown projection widget - cannot set freestanding"; + return; + } + } + + for (PlayingTopic *playingTopic : qAsConst(m_currentlyPlayingTopics)) + { + if (identifyProjectionWidget(playingTopic->topic) != pw) // only set topics freestanding that are on the same projection widget + continue; + + setReplayWidgetFreestanding(playingTopic, freestanding); + } +} + + +bool ScriptDialog::isScreenFreestanding(const ProjectionWidget &pw) const +{ + switch (pw) + { + case ProjectionWidget::Screen1: + return m_currentlyFreestandingTopicsScreen1; + case ProjectionWidget::Screen2: + return m_currentlyFreestandingTopicsScreen2; + case ProjectionWidget::Unknown: + ERROR_LOG(m_logger) << "projection widget unknown"; + return false; + } + return true; +} + + +void ScriptDialog::addReplayWidget(PlayingTopic *playingTopic, QWidget *replayWidget) +{ + playingTopic->replayWidget = replayWidget; + + bool alreadyAdded = false; // NOTE: this topic is already in the currently playing topics list, so others AND this topic get set freestanding - should not be added twice + bool freestandingTopic = usesAvsWindow(playingTopic->trackEntryType); + ProjectionWidget projectionWidgetType = identifyProjectionWidget(playingTopic->topic); + + switch (projectionWidgetType) + { + case ProjectionWidget::Screen1: + { + if (m_currentlyFreestandingTopicsScreen1 == false && + freestandingTopic == true) + { + setFreestanding(true, projectionWidgetType); + alreadyAdded = true; + } + + break; + } + + case ProjectionWidget::Screen2: + { + if (m_currentlyFreestandingTopicsScreen2 == false && + freestandingTopic == true) + { + setFreestanding(true, projectionWidgetType); + alreadyAdded = true; + } + + break; + } + + case ProjectionWidget::Unknown: + { + ERROR_LOG(m_logger) << "projection widget unknown - cannot add replay widget"; + return; + } + } + + if (alreadyAdded) + return; + + setReplayWidgetFreestanding(playingTopic, isScreenFreestanding(projectionWidgetType)); // NOTE: calls assignReplayWidgetToProjectionWidget +} + + +bool ScriptDialog::enableFireEventFlash(bool enable) +{ + bool success = false; + std::shared_ptr sitMapIfc; + if (m_sitMapSession->getForeignGuiInterface(sitMapIfc)) + success = sitMapIfc->enableFireEventFlashing(enable); + else + WARNING_LOG(m_logger) << LOGFUNCTION << " Cannot execute enableFireEventFlashing with enable=" << enable; + return success; +} + + +void ScriptDialog::playTopic(TrackEntry *topic) +{ + if (m_ignoreTopicForReplay == topic->m_topicId) + return; + + if (m_isPlayTopicMethodStillRunning) + return; + + BoolHelper bh(&m_isPlayTopicMethodStillRunning); + + std::shared_ptr sitMapIfc; + // stop updates for sitmap when a snapshot or replay is played + if (topic->m_type == TrackEntryType::Snapshot || + topic->m_type == TrackEntryType::SituationReplay || + topic->m_type == TrackEntryType::Situation) + m_sitMapSession->getForeignGuiInterface(sitMapIfc); + SituationMap::SitMapUpdatesEnabledHelper sitMapHelper(sitMapIfc); + + PlayingTopic *playingTopic = new PlayingTopic(); + playingTopic->topic = topic; + playingTopic->isFilter = isFilter(topic->m_type); + if (topic->m_type == TrackEntryType::Situation) // Complete Situation Playback including filters + playingTopic->isFilter = true; + + m_currentlyPlayingTopics.append(playingTopic); // add in any case (useful for memory management and playTopic not calling a failing playbackInit every second...) + + for (const TopicAssignment &ta : qAsConst(m_trackEntryAssignments)) + { + DEBUG_LOG(m_logger) << LOGFUNCTION << " ta.m_topicName = " << ta.m_topicName; + + if (topic->m_type == ta.m_trackEntryType) + { + DEBUG_LOG(m_logger) << LOGFUNCTION << " createInterface"; + + playingTopic->topicTypeName = ta.m_topicName; + playingTopic->trackEntryType = ta.m_trackEntryType; + playingTopic->topicReplayIfc = ta.m_topicReplayFactory->createInterface(playingTopic->trackEntryType); + } + } + + if (playingTopic->topicTypeName.isEmpty() || playingTopic->topicReplayIfc == nullptr) + { + WARNING_LOG(m_logger) << "Topic could not be assigned!! type name: " << playingTopic->topicTypeName << "replay ifc: " << (void *)playingTopic->topicReplayIfc; + //LtsWidgets::LtsMessageDialog::showMessage(this, tr("Topic #%1 could not be assigned! Replay skipped!").arg(topic->m_topicId)); + return; + } + + DEBUG_LOG(m_logger) << LOGFUNCTION << " playingTopic->trackEntryType " << playingTopic->trackEntryType; + + if (playingTopic->trackEntryType == TrackEntryType::SituationMap || + playingTopic->trackEntryType == TrackEntryType::Situation) // special case, uses own session + BLW, do not use createWidget from the topic replay ifc !! + { + DEBUG_LOG(m_logger) << LOGFUNCTION << " addReplayWidget"; + + m_sitMapSession->baseLayout()->setAutoFillBackground(true); // paint over black background + addReplayWidget(playingTopic, m_sitMapSession->baseLayout()); + + if (sitMapIfc || m_sitMapSession->getForeignGuiInterface(sitMapIfc)) + sitMapIfc->forceUpdate(); + else + WARNING_LOG(m_logger) << "Cannot force update on Situation Map - map might be stuck!"; + + if (playingTopic->trackEntryType == TrackEntryType::Situation) + { + DEBUG_LOG(m_logger) << LOGFUNCTION << " Situation -> ENable FireEventFlashing"; + if (!enableFireEventFlash(true)) + WARNING_LOG(m_logger) << LOGFUNCTION << " Cannot enableFireEventFlashing at Situation Map"; + } + } + else // non-sitmap: + { + DEBUG_LOG(m_logger) << LOGFUNCTION << " non-sitmap"; + + // + // Enable / Disable FireEventFlashing @ sitMap : + // + if (playingTopic->trackEntryType == TrackEntryType::Snapshot) + { + DEBUG_LOG(m_logger) << LOGFUNCTION << " Snapshot -> DISable FireEventFlashing"; + if (!enableFireEventFlash(false)) + WARNING_LOG(m_logger) << LOGFUNCTION << " Cannot disableFireEventFlashing at Situation Map"; + } + else if (playingTopic->trackEntryType == TrackEntryType::SituationReplay) + { + DEBUG_LOG(m_logger) << LOGFUNCTION << " SituationReplay -> ENable FireEventFlashing"; + if (!enableFireEventFlash(true)) + WARNING_LOG(m_logger) << LOGFUNCTION << " Cannot enableFireEventFlashing at Situation Map"; + } + + + bool isAvs = usesAvsWindow(playingTopic->trackEntryType); + ProjectionWidget projectionWidgetType = identifyProjectionWidget(playingTopic->topic); + bool isProjectionWidgetAvailable = (getProjectionWidget(projectionWidgetType) != nullptr); + + QWidget *replayWidget = nullptr; + + if (!isAvs || (isAvs && isProjectionWidgetAvailable)) + replayWidget = playingTopic->topicReplayIfc->createWidget(); + + if (replayWidget != nullptr) + { + addReplayWidget(playingTopic, replayWidget); + + /* + * Another BuildingViewer workaround. For unknown reasons the replayWidget of the BuildingViewer is not displayed fullscreen + * on the projection widget. All BuildingViewer topics need a refresh after a short amound of time. Since the ScriptPlayer + * uses a tick length of 1 second 100ms are fine (topic will definitely not be deleted before timer shot). + */ + if (topic->m_type == TrackEntryType::Building) + { + QTimer::singleShot(100, this, [this, playingTopic, replayWidget]() + { + addReplayWidget(playingTopic, replayWidget); + }); + } + } + else + WARNING_LOG(m_logger) << "topic #" << playingTopic->topic->m_topicId << " has no widget to show on presentation screen"; + } + + + // check (and if available) parse saved TrackEntry data + if (topic->m_detailData.isEmpty()) + { + WARNING_LOG(m_logger) << "Note: Topic id " << topic->m_topicId << " has no JSON data"; +// LtsWidgets::LtsMessageDialog::showMessage(this, tr("Topic #%1 has no valid detail data! Replay skipped!").arg(topic->topicId)); +// return; + } + + QString descriptionText; + if (!topic->m_description.isEmpty()) + descriptionText = tr("\n Description: %1").arg(topic->m_description); + + // TODO: extend playbackInit with an exercise id + QJsonObject obj = topic->m_detailData; + obj[QStringLiteral("scriptsExerciseId")] = m_scriptsExerciseId; + obj[QStringLiteral("exerciseId")] = m_exerciseName; + + if (!playingTopic->topicReplayIfc->playbackInit(obj)) + { + WARNING_LOG(m_logger) << "Playing topic # " << topic->m_topicId << " playback init failed! Playback of this topic failed!"; + //LtsWidgets::LtsMessageDialog::showMessage(this, tr("Topic #%1 (type: %2) playback initialization failed! Replay skipped!").arg(topic->topicId).arg((int)topic->type)); + return; + } + + /* + * And the award for the most ugly workaround goes to... BuildingViewer. + * If a skript has been opened and started the BgViewer might not be ready to display + * 3D models (building display might stay black). By re-initializing the currently playing + * topic we enforce reloading of the 3D model data. initCnt could also be set to "1". However, + * if the first Building-topic is very short, e.g., 1 second, directly followed by another Building + * topic the following topic would still be black since BgViewer initialization stuff has not been finished. + */ + static int initCnt = 4; + + if (initCnt && (topic->m_type == TrackEntryType::Building)) + { + --initCnt; + QTimer::singleShot(500, this, [obj, playingTopic]() + { + playingTopic->topicReplayIfc->playbackInit(obj); + }); + } + + DEBUG_LOG(m_logger) << "playbackStart at offset" << m_positionTime - topic->m_startTime; + if (!playingTopic->topicReplayIfc->playbackStart(m_positionTime - topic->m_startTime /* offset (!) in seconds after the topic start, as the user could play a topic from any position */)) + WARNING_LOG(m_logger) << "Playing topic # " << topic->m_topicId << " playback start failed! Playback of this topic failed!"; + + m_journal.journalList.append(new NextTopicJournal(m_positionTime, playingTopic->isFilter, playingTopic->topicTypeName, topic->m_length)); +} + + +void ScriptDialog::deletePlayingTopic(PlayingTopic *playingTopic) // WARNING: use a mutable iterator while iterating over m_currentlyPlayingTopics and remove the entry before calling this method! +{ + std::shared_ptr sitMapIfc; + // stop updates for sitmap when a snapshot or replay is deleted + if (playingTopic->topic->m_type == TrackEntryType::Snapshot || + playingTopic->topic->m_type == TrackEntryType::SituationReplay) + m_sitMapSession->getForeignGuiInterface(sitMapIfc); + SituationMap::SitMapUpdatesEnabledHelper sitMapHelper(sitMapIfc); + + // no need to call playbackStop here as the PlayingTopic d_tor calls it already + + /*if (playingTopic->trackEntryType == TrackEntryType::SituationMap) // has no widget, has session w/ BLW + { + m_sitMapSession->baseLayout()->setParent(nullptr); + } + else */ + if (playingTopic->replayWidget != nullptr) + { + if (usesAvsWindow(playingTopic->trackEntryType)) + { + ProjectionWidget projectionWidgetType = identifyProjectionWidget(playingTopic->topic); + + if (isScreenFreestanding(projectionWidgetType)) // exit freestanding mode for that projection widget + setFreestanding(false, projectionWidgetType); + } + + playingTopic->replayWidget->hide(); + playingTopic->replayWidget->setParent(nullptr); + // TODO: remove replayWidget BUT not if it's the situation map + playingTopic->replayWidget = nullptr; + } + + delete playingTopic; + printCurrentlyPlayingTopics(); +} + + +void ScriptDialog::slotTimerTick() +{ + if (!m_scriptRunning) // in case a signal was stuck in the event loop backlog but STOP was already clicked and the stuck event is now calling this method, but the script is already stopped + return; + + if (m_bTimerTickRecursionGuard) + return; + BoolHelper bh(&m_bTimerTickRecursionGuard); + + if (m_positionTime == -1) // script just started! + m_positionTime = 0; + + // remove after playing topics & filter topics - otherwise a topic that was deleted gets replayed (FIXME: reason: weird math) + { + //first check for stop in current playing: + QMutableVectorIterator i(m_currentlyPlayingTopics); + + while (i.hasNext()) + { + PlayingTopic *playingTopic = i.next(); + // qWarning() << ">> startTime" << playingTopic->topic->time << "endTime" << playingTopic->topic->time+playingTopic->topic->length << "current pos" << m_positionTime; + /* + * E.g., start time is 1s and length is 8 seconds: + * Topic plays from second 1 to second 8 (8 is included). Hence, we must substract '1', otherwisethe topic must be removed + * if + */ + if (m_positionTime < (playingTopic->topic->m_startTime + playingTopic->topic->m_length)) + continue; // do not delete it + + // smaller than position time? then delete it: + i.remove(); + deletePlayingTopic(playingTopic); + } + } + + + // look for topics that have to be played for NOW [slow but ok] + for (TrackEntry *topic : qAsConst(m_topicVector)) + { + // is topic already playing? + bool found = false; + for (const PlayingTopic *pt : qAsConst(m_currentlyPlayingTopics)) + { + if (pt->topic->m_topicId == topic->m_topicId) + { + found = true; + break; + } + } + if (found) + continue; // is already playing, skip this topic + + if (m_positionTime >= topic->m_startTime && m_positionTime < (topic->m_startTime + topic->m_length)) // only play if inside of position time + { + //qWarning() << "topic->time" << topic->time << "m_positionTime" << m_positionTime << "topic type" << (int)topic->type; + DEBUG_LOG(m_logger) << "Playing topic id " << topic->m_topicId << " with description " << topic->m_description; + playTopic(topic); + } + } + + + // prevent filter topics to be played at the same second as other topics - always a second later (loading issues - TODO: FIXME: slow topics must return a 'ready' signal before playing should continue) + if (m_firstPlayAfterStop) + m_firstPlayAfterStop = false; + else + { + // look for filter topics at the same second to 'play' + for (const FilterTopic &filterTopic : qAsConst(m_filterTopicVector)) + { + TrackEntry *filterTe = filterTopic.filterTopic; + + bool found = false; + for (const PlayingTopic *pt : qAsConst(m_currentlyPlayingTopics)) + { + if (pt->topic->m_topicId == filterTe->m_topicId) + { + found = true; + break; + } + } + + if (found) + continue; // is already playing, skip this topic + + int realFilterTime = /*mainTopicTime + */filterTe->m_startTime; // there is also no need to get the main topic anymore, because the time is NOT an offset, but the absolute time !! + if (m_positionTime >= (realFilterTime + 1) && m_positionTime <= (realFilterTime + filterTe->m_length)) // only play if inside of position time [HACK: play 1 second later, for caching reasons + { + DEBUG_LOG(m_logger) << "Playing filter topic id " << filterTe->m_topicId << " with description " << filterTe->m_description; + + // TODO: give originator topic id for filter playback !! + playTopic(filterTe); + } + } + + if (m_stopAfterPlayingFilterTopic) // if true, previewSecond was called, main topic must be played, then wait a second until playing the filters, after playing the filters PAUSE + { + slotPause(); + m_stopAfterPlayingFilterTopic = false; + } + } + + + if ((m_positionTime + 1) > m_highestTime) + { + m_journal.journalList.append(new EndedJournal(m_positionTime)); + stop(true); // done + return; + } + + if (m_nextPauseTime > 0 && (m_nextPauseTime <= m_positionTime + 1)) + { + m_nextPauseTime = -1; + m_journal.journalList.append(new PauseJournal(m_positionTime)); + slotPause(); + } + + setPositionTime(m_positionTime + 1); + printCurrentlyPlayingTopics(); +} + + +void ScriptDialog::printCurrentlyPlayingTopics() +{ + m_ui->lwStatus->clear(); + + for (const PlayingTopic *playingTopic : qAsConst(m_currentlyPlayingTopics)) + { + if (!playingTopic->topicTypeName.isEmpty() && playingTopic->topicReplayIfc != nullptr) // ignore invalid topics (e.g. his init failed) + { + QString status = tr("Playing topic '%1' from second %2 to second %3 %4").arg(translateTrackEntryType(playingTopic->trackEntryType)) + .arg(playingTopic->topic->m_startTime).arg(playingTopic->topic->m_startTime + playingTopic->topic->m_length) + .arg(playingTopic->topic->m_description); + + m_ui->lwStatus->addItem(status); + } + } +} + + +void ScriptDialog::slotPlay() +{ + if (qobject_cast(sender()) == m_ui->pbPlay) + m_ignoreTopicForReplay = -1; // if this is a REAL play, reset the previewSecond mode + +// if (hasUnsavedChanges()) +// { +// new LtsWidgets::LtsMessageDialogNew(this, tr("Please apply changes of your script before playing it")); +// m_stopAfterPlayingFilterTopic = false; +// return; +// } + + /* if script is in STOP state (NOT pause!), then refill the vector - if the script is just paused, then don't touch + * the topic vectors as 1. they can't have changed (because the user cannot edit topics in this state) and + * 2. currentlyPlayingTopics contains topics that get destroyed by fillTopicVector!! */ + if (m_currentlyPlayingTopics.isEmpty()) + fillTopicVector(); // just fill topic vector, no need for the user to save (apply) first + + if (m_currentTopicEditor != nullptr) + { + if (m_currentTopicEditor->hasUnsavedChanges()) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Please apply changes of the selected topic before playing the script.")); + m_stopAfterPlayingFilterTopic = false; + return; + } + } + + if (m_currentTopicDesigner != nullptr) + m_currentTopicDesigner->deleteLater(); + + m_enableApply = false; + + m_ui->widget->slotUnselectAll(); // calls slotTrackEntrySelectionChanged(nullptr); // unselect and destroy all topic editors + m_ui->widget->setReadonly(true); + m_ui->widget->lockIndicator(true); + + m_ui->pbPlay->setEnabled(false); + m_ui->pbPause->setEnabled(true); + m_ui->pbStop->setEnabled(true); + m_ui->posSlider->setEnabled(false); + m_ui->pbPreviousTopic->setEnabled(false); + m_ui->pbNextTopic->setEnabled(false); + m_ui->pbUntilNextTopic->setEnabled(false); + m_ui->pbInitScr1->setEnabled(false); + m_ui->pbInitScr2->setEnabled(false); + + + if (!m_currentlyPlayingTopics.isEmpty()) // was paused before! => resume + { + // are these topics still in between the position time? + QMutableVectorIterator i(m_currentlyPlayingTopics); + + while (i.hasNext()) + { + PlayingTopic *pt = i.next(); + TrackEntry *topic = pt->topic; + //qWarning () << "CHECKING: topic time" << topic->time << "topic length" << topic->length << "position time" << m_positionTime; + if (m_positionTime < topic->m_startTime || m_positionTime > (topic->m_startTime + topic->m_length)) // between position time? + { + //qWarning () << "CHECKING: REMOVING!"; + // not playing anymore, stop playback and delete topic replay ifc + //pt->topicReplayIfc->playbackStop(); + i.remove(); + deletePlayingTopic(pt); + } + /*else + qWarning() << "CHECKING: not deleted";*/ + } + + //qWarning() << "CHECKING: stuff left" << m_currentlyPlayingTopics.count(); + + + // start playback for recently playing topics (now free of topics that are not between position time anymore) + for (const PlayingTopic *playingTopic : qAsConst(m_currentlyPlayingTopics)) + { + if (playingTopic->topicReplayIfc != nullptr && m_ignoreTopicForReplay != playingTopic->topic->m_topicId) + { + DEBUG_LOG(m_logger) << "playbackStart (resume) at offset" << m_positionTime - playingTopic->topic->m_startTime; + if (!playingTopic->topicReplayIfc->playbackStart(m_positionTime - playingTopic->topic->m_startTime + /* offset in seconds after the topic start, as the user could play a topic from any position */)) + WARNING_LOG(m_logger) << "Playing topic # " << playingTopic->topic->m_topicId << " playback start failed! Re-playback of this topic failed!"; + } + + // + // Enable / Disable FireEventFlashing @ sitMap : + // + if (playingTopic->trackEntryType == TrackEntryType::Snapshot) + { + DEBUG_LOG(m_logger) << LOGFUNCTION << " Snapshot -> DISable FireEventFlashing"; + if (!enableFireEventFlash(false)) + WARNING_LOG(m_logger) << LOGFUNCTION << " Cannot disableFireEventFlashing at Situation Map"; + } + else if (playingTopic->trackEntryType == TrackEntryType::SituationReplay) + { + DEBUG_LOG(m_logger) << LOGFUNCTION << " Snapshot -> ENable FireEventFlashing"; + if (!enableFireEventFlash(true)) + WARNING_LOG(m_logger) << LOGFUNCTION << " Cannot enableFireEventFlashing at Situation Map"; + } + + //qWarning() << "CHECKING: starting!"; + } + + m_nextPauseTime = -1; // do not stop at next topic + } + + + LtsWidgets::LtsGlobalWaitDialog::getInstance()->setVisible(false); // avoid wait screen, we have the splash for this reason! + + m_presentationTimer->start(); + + m_journal.journalList.append(new PlayJournal(m_positionTime)); + + m_buttonBox->getButton(LtsWidgets::DialogButton::Hide)->setEnabled(false); + m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setEnabled(false); + +// std::shared_ptr sitMapIfc; +// if (m_sitMapSession->getForeignGuiInterface(sitMapIfc)) +// sitMapIfc->enableFireEventFlashing(true); // Schlaegt meist fehl!!! +// else +// WARNING_LOG(m_logger) << "Cannot update sit map fire event flashing"; + + + m_scriptRunning = true; +} + + +void ScriptDialog::slotPause() +{ + m_firstPlayAfterStop = true; + m_ui->pbPlay->setEnabled(true); + m_ui->pbPause->setEnabled(false); + m_ui->posSlider->setEnabled(true); + m_ui->widget->lockIndicator(false); + m_ui->pbPreviousTopic->setEnabled(hasPreviousTopic()); + m_ui->pbNextTopic->setEnabled(hasNextTopic()); + m_ui->pbUntilNextTopic->setEnabled(true); + + LtsWidgets::LtsGlobalWaitDialog::getInstance()->setVisible(true); + + m_presentationTimer->stop(); + + pausePlayingTopics(); + + m_journal.journalList.append(new PauseJournal(m_positionTime)); + + std::shared_ptr sitMapIfc; + if (m_sitMapSession->getForeignGuiInterface(sitMapIfc)) + sitMapIfc->enableFireEventFlashing(false); + else + WARNING_LOG(m_logger) << "Cannot update sit map fire event flashing"; +} + + +void ScriptDialog::stop(bool ended, bool ignoreFireEventFlashing) +{ + if (m_isPlayTopicMethodStillRunning) // playTopic()'s playbackStart did a processEvents(), a slotStop() signal was in event queue - this needs to be prevented, because slotStop() deletes all PlayingTopic. After slotStop()'s execution, playTopic() continues execution and creates a NextTopicJournal on a deleted PlayingTopic + return; + + m_scriptRunning = false; + m_presentationTimer->stop(); + + m_enableApply = true; + m_firstPlayAfterStop = true; + m_ui->pbPlay->setEnabled(true); + m_ui->pbPause->setEnabled(false); + m_ui->pbStop->setEnabled(false); + m_ui->posSlider->setEnabled(true); + m_ui->widget->lockIndicator(false); + m_ui->pbInitScr1->setEnabled(true); + m_ui->pbInitScr2->setEnabled(true); + + m_ignoreTopicForReplay = -1; + + LtsWidgets::LtsGlobalWaitDialog::getInstance()->setVisible(true); + + + QMutableVectorIterator i(m_currentlyPlayingTopics); + while (i.hasNext()) + { + PlayingTopic *pt = i.next(); + i.remove(); + deletePlayingTopic(pt); // calls delete, but entry is still in list + } + + setPositionTime(-1); + m_ui->lblPos->setText(toReadableTime(0)); + + if (ended) + m_journal.journalList.append(new EndedJournal(m_positionTime)); + else + m_journal.journalList.append(new StopJournal(m_positionTime)); + + m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setEnabled(true); + m_buttonBox->getButton(LtsWidgets::DialogButton::Hide)->setEnabled(true); + + m_ui->widget->setReadonly(false); + + + if (!ignoreFireEventFlashing && m_sitMapSession != nullptr) + { + std::shared_ptr sitMapIfc; + if (m_sitMapSession->getForeignGuiInterface(sitMapIfc)) + sitMapIfc->enableFireEventFlashing(true); + else + WARNING_LOG(m_logger) << "Cannot update sit map fire event flashing"; + } +} + + +void ScriptDialog::slotStop() +{ + stop(); +} + + +void ScriptDialog::pausePlayingTopics() +{ + m_ui->lwStatus->clear(); + + for (PlayingTopic *playingTopic : qAsConst(m_currentlyPlayingTopics)) + { + if (playingTopic->topicReplayIfc != nullptr) + { + DEBUG_LOG(m_logger) << "Pause topic: " << playingTopic->topicTypeName; + playingTopic->topicReplayIfc->playbackPause(); + + QString status = tr("Currently paused topic '%1' %2") + .arg(translateTrackEntryType(playingTopic->trackEntryType), playingTopic->topic->m_description); + + m_ui->lwStatus->addItem(status); + } + else + DEBUG_LOG(m_logger) << "Topic not paused: " << playingTopic->topicTypeName; + } +} + + +void ScriptDialog::slotShowStoryboard() +{ + if (m_currentlyPlayingTopics.isEmpty()) // only fill vector when there is no replay! 1. on a replay, topics don't change (so no need to re-fill) 2. re-filling deletes topics that are currently playing (to recreate them) + fillTopicVector(); + + static QString id(QStringLiteral("ScriptPlayer.StoryBoard")); + + if (m_exerciseSession->baseLayout()->focusTab(m_menuGroup, id, LtsWidgets::LayoutArea::eDialogTab)) + return; + + StoryboardDialog *dialog = LtsWidgets::initDialog(new StoryboardDialog(this, m_exerciseSession), m_topicVector, m_filterTopicVector, m_scriptName, m_scriptOwner, m_lastModified, toReadableTime(m_highestTime) ); // nullptr if init failed + m_storyboardDialog = dialog; // guarded + m_exerciseSession->addWidget(dialog, m_menuGroup, id, LtsWidgets::LayoutArea::eDialogTab); +} + + +QString ScriptDialog::toReadableTime(qint64 seconds) +{ + return QTime::fromMSecsSinceStartOfDay(seconds * 1000).toString(); +} + + +void ScriptDialog::deleteProjectionWidget(Screen **pointerToWidgetPointer) +{ + if (*pointerToWidgetPointer == nullptr) + return; + + // unparent all widgets created with 'createWidget' as they do not belong to us and must be deleted by its creator + const auto p1Widgets = (*pointerToWidgetPointer)->findChildren(QString(), Qt::FindDirectChildrenOnly); + + for (QWidget *w : p1Widgets) + w->setParent(nullptr); + + (*pointerToWidgetPointer)->deleteLater(); + *pointerToWidgetPointer = nullptr; +} + + +void ScriptDialog::initProjectionWidget(Screen **pointerToWidgetPointer) +{ + if (*pointerToWidgetPointer != nullptr) + deleteProjectionWidget(pointerToWidgetPointer); + + Screen *projWindow = new Screen(); + projWindow->setWindowTitle(tr("Playback")); + projWindow->setObjectName(QStringLiteral("Playback")); + projWindow->resize(1280, 900); // Debug + + + connect(projWindow, &QWidget::destroyed, + this, [this, pointerToWidgetPointer] + { + if (static_cast(*pointerToWidgetPointer) == sender()) + *pointerToWidgetPointer = nullptr; // is done by deleteProjectionWidget, but safety means safety + INFO_LOG(m_logger) << "a projection windows was destroyed"; + }); + + *pointerToWidgetPointer = projWindow; + + m_exerciseSession->baseLayout()->setIrreplaceableOnce(); // do not replace + LtsMultiMonitor::LtsMultiMonitor::getInstance()->selectScreen(*pointerToWidgetPointer); +} + + +void ScriptDialog::fillTopicVector() +{ + if (m_ignoreChanges) + return; + + for (const LtsScriptTimeline::TrackEntry *trackEntry : qAsConst(m_topicVector)) + { + DEBUG_LOG(m_logger) << "m_topicVector index=" << trackEntry->index + << " topicId=" << trackEntry->m_topicId + << " type=" << trackEntry->m_type; + //<< " description=" << trackEntry->m_description; + } + + // Do not rely on this map's value content! +// QMultiMap::iterator it; +// for (it = m_topicMap.begin(); it != m_topicMap.end(); ++it) +// { +// LtsScriptTimeline::TrackEntry* trackEntry = it.value(); +// DEBUG_LOG(m_logger) << "m_topicMap key=" << it.key() +// << " index=" << trackEntry->index +// << " topicId=" << trackEntry->m_topicId +// << " type=" << trackEntry->m_type +// //<< " description=" << trackEntry->m_description +// << " startTime=" << trackEntry->m_startTime +// << " length=" << trackEntry->m_length; + +// } + + for (const FilterTopic &filterTopic : qAsConst(m_filterTopicVector)) + { + const LtsScriptTimeline::TrackEntry *trackEntry = filterTopic.filterTopic; + DEBUG_LOG(m_logger) << "m_filterTopicVector mainTopicId=" << filterTopic.mainTopicId + << " index=" << trackEntry->index + << " topicId=" << trackEntry->m_topicId + << " type=" << trackEntry->m_type + << " isSet=" << trackEntry->isSet + //<< " description=" << trackEntry->m_description + << " startTime=" << trackEntry->m_startTime + << " length=" << trackEntry->m_length + << " filterParentChannel=" << trackEntry->m_filterParentChannel; + } + + Q_ASSERT(m_currentlyPlayingTopics.isEmpty()); // never will topic vectors if m_currentlyPlayingTopics is not empty (script not stopped), because an item in m_currentlyPlayingTopics is based on the topic vector - changing the topic vector will probably crash the application + + m_topicVector.clear(); + + for (const FilterTopic &ft : qAsConst(m_filterTopicVector)) + delete ft.filterTopic; + m_filterTopicVector.clear(); + + m_topicMap.clear(); + m_ui->lwStatus->clear(); + + const QMap > trackList = m_ui->widget->getTrackEntriesWithFilters(); // get all topics + + for (const QVector &trackEntryList : qAsConst(trackList)) + { + m_topicVector += trackEntryList; + for (TrackEntry *te : trackEntryList) + m_topicMap.insert(te->m_startTime, nullptr); // do not rely on this map's value contents! topics may be deleted at any time TODO + } + + m_highestTime = -1; // reset highest time (if last topic is deleted, the script ends sooner) + + if (!m_topicVector.isEmpty()) + { + m_ui->lwStatus->addItem(tr("Initialized with %1 Entries").arg(m_topicVector.count())); + + for (const TrackEntry *topic : qAsConst(m_topicVector)) + { + if (topic->m_startTime < m_lowestTime || m_lowestTime == -1) + m_lowestTime = topic->m_startTime; + + int end = topic->m_startTime + topic->m_length; + if (end > m_highestTime) + m_highestTime = end; + } + + if (m_lowestTime < 0 || m_highestTime < 1 || m_highestTime <= m_lowestTime) // there should at least be SOMETHING + m_ui->lwStatus->addItem(tr("ERROR: At least one available topic has invalid timing !")); + + for (const TrackEntry *topic : qAsConst(m_topicVector)) + { + //qWarning() << "topic time" << topic->time; + + + ////// CODE DUPLICATE + // take filters from TEs detail data and put these filters on the filter lines (after creating them) + + // check if there is a json + if (topic->m_detailData.isEmpty()) + continue; + + // look for filters + + const QJsonArray filterLines = topic->m_detailData.value(QStringLiteral("Filters")).toArray(); + //qWarning() << "filterLines count" << filterLines.count(); + + if (filterLines.isEmpty()) + continue; // no filters, nothing to do + + // create filter-TEs from TE + + for (const QJsonValue &filterLineValue : filterLines) + { + const QJsonArray filterLine = filterLineValue.toArray(); + + for (const QJsonValue &filter : filterLine) + { + TrackEntry *filterTe = new TrackEntry; + filterTe->fromJson(filter.toObject()); + + filterTe->m_startTime = filterTe->m_startTime /* add main topic time, because filter time is an offset only */ + topic->m_startTime; + filterTe->m_filterParentChannel = topic->m_channelName; + + // add filter-TEs to coresponding filter line + m_filterTopicVector.append(FilterTopic(/* main topic id */ topic->m_topicId, filterTe)); + } + } + } + } + else + m_ui->lwStatus->addItem(tr("INFO: This Presentation has no content !")); + + + m_ui->posSlider->setMaximum(m_highestTime); + m_ui->lblPos->setText(toReadableTime(0)); + m_ui->lblMax->setText(toReadableTime(m_highestTime)); + + if (m_storyboardDialog) + { + m_storyboardDialog->init(m_topicVector, m_filterTopicVector, m_scriptName, m_scriptOwner, m_lastModified, toReadableTime(m_highestTime)); + m_storyboardDialog->fillStoryboard(); + } +} + + +// export functionality from script gui plugin: + + +void ScriptDialog::exportPresentationContent(const Core::FunctionReply &baseReply) +{ + const GetPresentationContentReply &reply = static_cast(baseReply); + const dds::core::vector &contentList = reply.content(); + + if (contentList.size() < 1) + { + ERROR_LOG(m_logger) << "No Presentation Content for Script Id " << reply.id(); + LtsWidgets::LtsMessageDialog::showMessage(this, tr("No presentation content, nothing to export!")); + return; + } + + + if (!isEssentialsViewOpened()) + { + // check if essentials view is needed (building viewer only) (NOTE: would not respect Building topics exported by additionalTrackEntries method) + for (const PresentationManagement::PresentationContent &content : contentList) + { + TrackEntryType tet = TrackEntryType::INVALID; + + if (!topicStringToType(QString::fromStdString(content.presentationTopicType()), tet) || tet == TrackEntryType::INVALID) + { + ERROR_LOG(m_logger) << "Topic ignored at export - invalid topic type for presentation's content id " << content.id(); + continue; + } +#ifndef EXPORT_BDV_TOPIC_AS_JSON + if (tet == TrackEntryType::Building) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Please start the Essentials View which is required for export with building topics.")); + return; + } +#endif + } + } + else + { + // Prepare essentialsview widget by hiding menus so that creating bgViewer videos works properly + disableSessionDialog(eVSession(), true); + + // Bring BuildingViewer to front to that video recording works properly + std::shared_ptr bgvIfc; + if (eVSession()->getForeignGuiInterface(bgvIfc)) + { + GuiPluginBase::Interface *pBaseGuiIfc = dynamic_cast(bgvIfc.get()); + if (pBaseGuiIfc) + eVSession()->baseLayout()->focusTab(pBaseGuiIfc->menuGroup(), QStringLiteral("bdvShowBdv"), LtsWidgets::LayoutArea::eMainTab); + } + else + ERROR_LOG(m_logger) << "Fetching ForeignGuiInterface of BuildingViewer failed!"; + } + + + QProgressDialog *pProgressDlg = new QProgressDialog(tr("Export in progress..."), tr("Cancel"), 0, 0, this); + + + m_exportProcess = new TakeHomePackageGenerator::ExportProcess(m_exerciseSession, + getReplayGuiIfc(), + pProgressDlg, + m_scriptName, + m_exerciseName, + m_scriptId, + contentList, + m_trackEntryAssignments, + this); + + /* + * We could immediately start the export with the following line (with timeout = 0 seconds). + * However, 'disableSessionDialog(eVSession(), true);' as called above has not been processed + * so far. Hence, we use a delay to ensure that all menu's are hidden which allows BgViewer to create a proper video + */ + QTimer::singleShot(1500, m_exportProcess, &TakeHomePackageGenerator::ExportProcess::slotStartExport); + QObject::connect(m_exportProcess, &TakeHomePackageGenerator::ExportProcess::exportSuccessful, this, &ScriptDialog::slotExportSuccessful); + + pProgressDlg->setWindowModality(Qt::WindowModal); + pProgressDlg->show(); +} + +void ScriptDialog::slotExportSuccessful(const QString &path, const QString &failedTopics) +{ + Q_UNUSED(path) + m_exportProcess->disconnect(); + m_exportProcess->deleteLater(); + + if (failedTopics.isEmpty()) + new LtsWidgets::LtsMessageDialogNew(this, tr("Export was successful."), tr("Success")); + else + new LtsWidgets::LtsMessageDialogNew(this, tr("The following topics failed to export:
%1").arg(failedTopics), tr("Failed Topics")); + + if (isEssentialsViewOpened()) + disableSessionDialog(eVSession(), false); +} + +void ScriptDialog::slotBurnDvD(const QString &strExportPath) +{ + m_exportProcess->disconnect(); + m_exportProcess->deleteLater(); + + if (LtsWidgets::LtsMessageDialog::showMessage(this, + tr("Do you want to burn the takehome package on DVD?"), + tr("Start burning DVD?"), + LtsWidgets::Behaviour::Modal, + LtsWidgets::Button::Yes | LtsWidgets::Button::No) == LtsWidgets::Button::Yes) + { + if (isEssentialsViewOpened()) + disableSessionDialog(eVSession(), true); + //disableSessionDialog(m_session, true); // ?? + + TakeHomePackageGenerator::DVDWriter *pWriter = new TakeHomePackageGenerator::DVDWriter(strExportPath, this); + QObject::connect(pWriter, &TakeHomePackageGenerator::DVDWriter::signalBurningFinished, + this, [this, pWriter](bool success) + { + slotBurningFinished(success); + delete pWriter; + }, Qt::QueuedConnection); + QTimer::singleShot(0, pWriter, &TakeHomePackageGenerator::DVDWriter::slotWriteDVD); + } + else + { + if (isEssentialsViewOpened()) + disableSessionDialog(eVSession(), false); + } +} + + +void ScriptDialog::slotBurningFinished(bool success) +{ + Q_UNUSED(success); + if (isEssentialsViewOpened()) + disableSessionDialog(eVSession(), false); + //disableSessionDialog(m_session, false); // ?? +} + + +void ScriptDialog::disableSessionDialog(LtsSession::LtsSession *pSession, bool disable) +{ + if (disable) + { + pSession->baseLayout()->getMenu()->hide(); + pSession->baseLayout()->onHideAnimated(); + pSession->baseLayout()->setEnabled(false); + } + else + { + pSession->baseLayout()->getMenu()->show(); + pSession->baseLayout()->onReShowAnimated(); + pSession->baseLayout()->setEnabled(true); + } +} + + +void ScriptDialog::slotLoadScript() +{ + if (m_scriptRunning) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Stop replay first.")); + return; + } + + auto load = [this]() + { + std::shared_ptr opmDtc; + if (!m_exerciseSession->getDtc(opmDtc)) + { + ERROR_LOG(m_logger) << "opm dtc missing for script chooser ..."; + return; + } + + ScriptChooser *scriptChooser = new ScriptChooser(m_dtc, opmDtc, false); + scriptChooser->setAttribute(Qt::WA_DeleteOnClose); + + connect(scriptChooser, &ScriptChooser::signalSelectScript, + this, [this](int scriptId) + { + m_scriptId = scriptId; + loadScript(); + }, Qt::QueuedConnection); + + connect(scriptChooser, &ScriptChooser::signalNewScript, + this, [this, opmDtc]() + { + PresentationEditDialog *dialog = new PresentationEditDialog(nullptr); + if (!dialog->init(-1 /* new presentation */, m_dtc, m_ftc, opmDtc)) + { + delete dialog; + return; + } + + QObject::connect(dialog, &PresentationEditDialog::rejected, dialog, &PresentationEditDialog::deleteLater); + + dialog->show(); + }); + + if (!LtsSessionData::LtsSessionData::getInstance()->isTablet()) + scriptChooser->setModal(true); + + scriptChooser->show(); + }; + + + if (hasUnsavedChanges()) + connect(new LtsWidgets::LtsMessageDialogNew(this, tr("There are unsaved changes. \nDo you really want to discard these changes and load another script?"), tr("Unsaved changes"), LtsWidgets::Behaviour::Modal, LtsWidgets::Button::Yes | LtsWidgets::Button::No), + &LtsWidgets::LtsMessageDialogNew::yes, + this, load); + else + load(); +} + + +void ScriptDialog::slotExportScript() +{ + PresentationManagement::Presentation preSource = m_dtc->presentation(m_scriptId); + + if (preSource.id() < 1) + return; + + QString exportPath = TakeHomePackageGenerator::ExportProcess::exportPath(m_exerciseSession->exerciseId()) + QString::number(m_scriptId); + DEBUG_LOG(m_logger) << "exportPath: " << exportPath; + + QDir dir(exportPath); + if (!dir.exists()) + { + if (!dir.mkpath(exportPath)) + { + LtsWidgets::LtsMessageDialog::showMessage(this, + tr("Can not create temporary directory '%1'").arg(exportPath), + tr("Export Script"), + LtsWidgets::Behaviour::Modal, + LtsWidgets::Button::Ok); + return; + } + } + + if (dir.exists() && !dir.isEmpty()) + { + INFO_LOG(m_logger) << "slotExportScript: dir.exists() && !dir.isEmpty()" ; + LtsWidgets::Button button = LtsWidgets::LtsMessageDialog::showMessage(this, + tr("Specified folder already exists and is not empty. Do you want to overwrite this folder?"), + tr("Information: %1").arg(dir.absolutePath()), + LtsWidgets::Behaviour::Modal, LtsWidgets::Button::Yes | LtsWidgets::Button::No); + + if (button == LtsWidgets::Button::Yes) + dir.removeRecursively(); + else + return; + } + + //+ preSource.description(); + std::function exportLambda = [&](const Core::FunctionReply & baseReply) + { + exportPresentationContent(baseReply); + }; + + m_requestHelper = new LtsUtils::RequestHelper(this); + + if (!m_requestHelper->startSingleRequest([this]() +{ + return m_ftc->getPresentationContentRequest(GetPresentationContentRequest(m_scriptId), this); + }, exportLambda)) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("There is no content to export for this script.")); + } + + // blocking, so this is safe: + m_requestHelper->deleteLater(); + m_requestHelper = nullptr; +} + +} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.h new file mode 100755 index 000000000..66f0c464d --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.h @@ -0,0 +1,402 @@ +/** + * @RDE_HEADER@ + * PresentationManagement - Script Editor + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-03-17 + */ + +#pragma once + +#include "pre_screen.h" +#include "pre_journal_types.h" +#include "pre_storyboard.h" // QPointer +#include "filter_topic.h" + +#include +#include +#include +#include +#include +#include // TET +#include +#include +#include +#include +#include +#include +#include +#include + + +// foreign gui plugins for the topic playback +#include +#include + +#include +#include +#include +#include +#include + + +namespace TakeHomePackageGenerator +{ +class ExportProcess; +} +namespace Ui +{ +class ScriptDialog; +} +namespace LtsScriptTimeline +{ +class TrackEntry; +} +namespace SituationReplayManagement +{ +class ForeignDataInterface; +} +namespace LtsPluginManager +{ +class LtsPluginManager; +} +namespace Ui +{ +class ScriptPlayerDialog; +} +namespace LtsScriptTimeline +{ +class TrackEntry; +} +namespace LtsUtils +{ +class Promise; +} + + +namespace PresentationManagement +{ +class TopicDesigner; + +namespace Interface +{ +class Ftc; +} + + +class ScriptDialog : public LtsWidgets::LtsDialog + , protected PresentationManagement::Interface::Ftc::PresentationModifyReplyHandler + , protected PresentationManagement::Interface::Ftc::GetPresentationContentReplyHandler + , protected SituationReplayManagement::Interface::Ftc::ReplayPartitionCreateReplyHandler + , protected SituationReplayManagement::Interface::Ftc::ReplayPartitionRemoveReplyHandler +{ +public: + Q_OBJECT + +public: + explicit ScriptDialog(const QString &menuGroup, QWidget *parent = nullptr); + ~ScriptDialog(); + + LtsSession::LtsSession *eVSession() { return m_essentialsViewSession; } + + bool init(LtsSession::LtsSession *session, + const int scriptId, + const std::shared_ptr &dtc, + const std::shared_ptr &ftc, + const std::shared_ptr &srmForeign, + const std::shared_ptr &coreDtc, + const std::shared_ptr &opmDtc); + + void loadScript(); + TopicEditorBase::TopicEditor *createTopic(const TopicAssignment &ta); + TopicEditorBase::TopicEditor *createTopic(const LtsScriptTimeline::TrackEntry &data); + void createTopicFromTrackEntry(LtsScriptTimeline::TrackEntry *data); + + bool topicStringToType(const QString &typeName, LtsScriptTimeline::TrackEntryType &tet) const; + int getCurrentScriptEndTime() const; + bool isEssentialsViewOpened() const; + + static LtsScriptTimeline::TrackEntry *trackEntryFromContent(const PresentationManagement::PresentationContent &content, + int topicId, + LtsScriptTimeline::TrackEntryType trackType); + + bool importTrackEntries(const QVector &tes); + + std::shared_ptr getReplayGuiIfc() const + { + return m_essentialsViewsSrpGuiIfc; + } + +private: + enum class ProjectionWidget + { + Unknown = 0, + Screen1, + Screen2, + }; + + + enum class SpecialTopicType + { + NonSpecial = 0, + ReplayTopic, + FilterTopic, + }; + + + class PlayingTopic + { + public: + PlayingTopic() = default; + + ~PlayingTopic() + { + if (topicReplayIfc != nullptr) + { + topicReplayIfc->playbackStop(); + delete topicReplayIfc; + } +// if (replayWidget) HACK: FIXME: trading memory for security BUT dont delete if it's the situation map app's base layout ! +// delete replayWidget; + } + + QString topicTypeName; + LtsScriptTimeline::TrackEntry *topic = nullptr; + TopicReplay::Interface *topicReplayIfc = nullptr; // 1 instance per 1 currently playing topic + QWidget *replayWidget = nullptr; + LtsScriptTimeline::TrackEntryType trackEntryType = LtsScriptTimeline::TrackEntryType::INVALID; + bool isFilter = false; + }; + + + void onPresentationModifyReply(const Core::FunctionReplyObject &replyObject) override { if (m_requestHelper != nullptr) m_requestHelper->requestReply(replyObject); } + void onGetPresentationContentReply(const GetPresentationContentReply &reply) override { if (m_requestHelper != nullptr) m_requestHelper->requestReply(reply); } + void onReplayPartitionCreateReply(const Core::FunctionReplyObject &reply) override { if (m_requestHelper != nullptr) m_requestHelper->requestReply(reply); } + void onReplayPartitionRemoveReply(const Core::FunctionReplyObject &) override { /* ignore */ } + + void retranslate() override; + bool apply() override; + void aboutToClose() override; + void getPresentationContent(); // tryAddTopics has to be called first to populate m_trackEntryAssignments + TopicEditorBase::TopicEditor *createTopicEditor(LtsScriptTimeline::TrackEntry *te); + bool topicTypeOnEssentialsView(LtsScriptTimeline::TrackEntryType tet) const; + void startEssentialsViewStage2(const Core::ReplayPartition &replay); + bool tryAddTopics(QStringList &resultList); + void fillTopicVector(); + void createSitMapApp(); + void startReplaySession(); + void exportPresentationContent(const Core::FunctionReply &baseReply); + void disableSessionDialog(LtsSession::LtsSession *pSession, bool disable); + void deletePlayingTopic(PlayingTopic *playingTopic); // WARNING: use a mutable iterator while iterating over m_currentlyPlayingTopics and remove the entry before calling this method! + static QString toReadableTime(qint64 seconds); + ProjectionWidget identifyProjectionWidget(LtsScriptTimeline::TrackEntry *topic) const; + bool usesAvsWindow(LtsScriptTimeline::TrackEntryType trackEntryType) const; + void playTopic(LtsScriptTimeline::TrackEntry *topic); + bool enableFireEventFlash(bool enable); + void pausePlayingTopics(); + static bool isFilter(LtsScriptTimeline::TrackEntryType tet); + void initProjectionWidget(Screen **pointerToWidgetPointer); + void deleteProjectionWidget(Screen **pointerToWidgetPointer); + bool _tryAddTopic(LtsScriptTimeline::TrackEntryType trackEntryType, + const std::shared_ptr &topicEditorIfc, + const std::shared_ptr &topicReplayFactory, + const std::shared_ptr &topicExportFactory, + QStringList &resultList, + const SpecialTopicType &specialTopicType = SpecialTopicType::NonSpecial); + void initFailed(int reason); + void setFreestanding(bool freestanding, const ProjectionWidget &pw); + void setReplayWidgetFreestanding(PlayingTopic *playingTopic, bool freestanding); + void printCurrentlyPlayingTopics(); + void addReplayWidget(PlayingTopic *playingTopic, QWidget *replayWidget); + Screen *getProjectionWidget(const ScriptDialog::ProjectionWidget &projectionWidget); + bool isScreenFreestanding(const ProjectionWidget &pw) const; + void previewSecond(int time, int ignoreTopicForReplay = -1); + void setReplayWidgetPosition(PlayingTopic *playingTopic); + void avsFreestandingHack(bool freestanding, QWidget *projectionWidget, QWidget **parentForScreen); + void avsVisibilityHack(QWidget *parentForScreen, bool visible); + void stop(bool ended = false, bool ignoreFireEventFlashing = false); + void changelogCheck(); + int previousTopicTime() const; + bool hasPreviousTopic() const { return previousTopicTime() > -1; } + int nextTopicTime() const; + bool hasNextTopic() const { return nextTopicTime() > -1; } + void setPositionTime(int positionTime, bool setByUser = false); + void setPositionTimeActive(int positionTime, bool setByUser = false); // setPositionTime, but, if playing, also ticks and resets timeout + + + template + std::shared_ptr getTopicEditorIfc(LtsScriptTimeline::TrackEntryType trackEntryType) + { + std::shared_ptr topicEditorIfc; + + if (!m_exerciseSession->interfaceFromGui(topicEditorIfc)) + { + ERROR_LOG(m_logger) << "getTopicEditorIfc failed: Cannot add topic type " + << LtsScriptTimeline::trackEntryTypeName(trackEntryType) + << " because topic editor ifc is missing."; + return nullptr; + } + + return topicEditorIfc; + } + + + template + std::shared_ptr getTopicReplayFactory(LtsScriptTimeline::TrackEntryType trackEntryType) + { + std::shared_ptr topicReplayFactory; + + if (!m_replaySession->interfaceFromGui(topicReplayFactory)) + { + ERROR_LOG(m_logger) << "getTopicIfcFactory failed: Cannot add topic type " + << LtsScriptTimeline::trackEntryTypeName(trackEntryType) + << " because topic ifc factory is missing."; + return nullptr; + } + + return topicReplayFactory; + } + + + template + bool tryAddTopic(LtsScriptTimeline::TrackEntryType trackEntryType, + QStringList &resultList, + const SpecialTopicType &specialTopicType = SpecialTopicType::NonSpecial) + { + std::shared_ptr topicEditorIfc; + std::shared_ptr topicReplayFactory; + std::shared_ptr topicExportFactory; + + if (!std::is_same::value) + { + topicEditorIfc = getTopicEditorIfc(trackEntryType); + + if (topicEditorIfc == nullptr) + { + resultList.append(LtsScriptTimeline::trackEntryTypeName(trackEntryType)); + return false; + } + } + + if (!std::is_same::value) + { + topicReplayFactory = getTopicReplayFactory(trackEntryType); + + if (topicReplayFactory == nullptr) + { + resultList.append(LtsScriptTimeline::trackEntryTypeName(trackEntryType)); + return false; + } + } + + if (!std::is_same::value) + { + topicExportFactory = getTopicReplayFactory(trackEntryType); + + if (topicExportFactory == nullptr) + { + resultList.append(LtsScriptTimeline::trackEntryTypeName(trackEntryType)); + return false; + } + } + else + topicExportFactory = topicReplayFactory; + + return _tryAddTopic(trackEntryType, topicEditorIfc, topicReplayFactory, topicExportFactory, resultList, specialTopicType); + } + + + Ui::ScriptDialog *m_ui; + LtsSession::LtsSession *m_essentialsViewSession; + std::shared_ptr m_essentialsViewsSrpGuiIfc; + std::shared_ptr m_dtc; + std::shared_ptr m_ftc; + std::shared_ptr m_srmForeign; + std::shared_ptr m_coreDtc; + std::shared_ptr m_opmDtc; + QString m_menuGroup; + LtsUtils::RequestHelper *m_requestHelper; + int m_selectedTeId; + TopicEditorBase::TopicEditor *m_currentTopicEditor; + int m_scriptId; + QMap m_trackEntryAssignments; + QMap m_trackEntryToTopicAssignment; + LtsPluginManager::LtsPluginManager *m_essentialsViewApp; + QString m_scriptName; + QString m_scriptOwner; + qint64 m_lastModified = 0; + QVector m_topicVector; + QMultiMap m_topicMap; // + QVector m_filterTopicVector; + TakeHomePackageGenerator::ExportProcess *m_exportProcess; + LtsSession::LtsSession *m_exerciseSession; // aka. script editor app + LtsSession::LtsSession *m_replaySession; + QTimer *m_presentationTimer; + int m_lowestTime; + int m_highestTime; + int m_positionTime; + int m_duration; + int m_nextPauseTime; + QVector m_currentlyPlayingTopics; // also indicates that the script is either playing or in paused state if NOT empty + Screen *m_projectionWidget1; + Screen *m_projectionWidget2; + MainJournal m_journal; + int m_scriptsExerciseId; + QString m_exerciseName; + LtsPluginManager::LtsPluginManager *m_sitMapApp; + LtsSession::LtsSession *m_sitMapSession; + bool m_currentlyFreestandingTopicsScreen1; + bool m_currentlyFreestandingTopicsScreen2; + TopicReplay::Interface *m_sitMapTopicIfc; + bool m_firstPlayAfterStop; + bool m_enableApply; + bool m_stopAfterPlayingFilterTopic; + QWidget *m_previousParentForScreen1; + QWidget *m_previousParentForScreen2; + int m_ignoreTopicForReplay; + QPointer m_currentTopicDesigner; + bool m_avsVisibilityHackActive; + QPointer m_storyboardDialog; + bool m_ignoreChanges; + bool m_scriptRunning; + bool m_bTimerTickRecursionGuard; + bool m_isPlayTopicMethodStillRunning; + + LOGGER_T m_logger; + +private slots: + void slotEditEntry(const int topicId); + void slotTrackEntrySelectionChanged(LtsScriptTimeline::TrackEntry *); + void slotChangesWereMade(); + void slotTrackEntryModified(); + void slotNull(QObject *obj); + void slotDiscard(); + void slotStartEssentialsView(); + void slotLoadScript(); + void slotExportScript(); + void slotExportSuccessful(const QString &path, const QString &failedTopics); + void slotBurnDvD(const QString &strExportPath); + void slotBurningFinished(bool success); + void slotPlay(); + void slotPause(); + void slotStop(); + void slotTimerTick(); + void slotShowStoryboard(); + void slotShowJournal(); + void slotToNextTopic(); + void slotToPreviousTopic(); + void slotPlayUntilNextTopic(); + void slotSetTopicPosition(QWidget *previewWidget, int ignoreTopicForReplay); + void slotTrackEntryDeleted(const int topicId); + void slotEditSelectedEntry(); + void slotCheckNewTopicLength(int newLength, LtsUtils::Promise *promise); + void slotAddFakeLegacyPlanTopic(); + + void slotChangesMade(); +}; + +} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.ui new file mode 100755 index 000000000..04303c1a0 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.ui @@ -0,0 +1,320 @@ + + + ScriptDialog + + + + 0 + 0 + 1010 + 587 + + + + + 0 + 0 + + + + Script Editor + + + + 0 + + + 9 + + + 9 + + + 9 + + + 9 + + + + + + 0 + 0 + + + + + + + + Replay Controls + + + true + + + + + + + + + + + + + + + false + + + Set Screen 1 + + + + + + + false + + + Set Screen 2 + + + + + + + + + false + + + Stop + + + + + + + false + + + Pause + + + + + + + false + + + Play + + + + + + + + + + + Play Until Next Topic + + + + + + + Previous Topic + + + + + + + Next Topic + + + + + + + + + + + 9 + + + 9 + + + 9 + + + 9 + + + 9 + + + 9 + + + + + Presentation duration: + + + + + + + - + + + + + + + Pos: + + + + + + + false + + + + 0 + 0 + + + + Qt::Horizontal + + + QSlider::TicksBelow + + + true + + + + + + + Current position: + + + + + + + + + 0 + + + + + + + / + + + + + + + 0 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + Status: + + + + + + + + 0 + 0 + + + + QAbstractScrollArea::AdjustToContentsOnFirstShow + + + QAbstractItemView::NoEditTriggers + + + false + + + true + + + QAbstractItemView::NoSelection + + + QAbstractItemView::ScrollPerPixel + + + QListView::Free + + + false + + + + + + + + + + + + + + + + LtsScriptTimeline::ScriptTimeline + QWidget +
LtsScriptTimeline/script_timeline.h
+ 1 +
+
+ + +
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.cpp new file mode 100755 index 000000000..0bb9bf774 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.cpp @@ -0,0 +1,376 @@ +/** + * @RDE_HEADER@ + * GUI Plugin for Script Editor + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-03-17 + */ + +#include "pre_script_gui_plugin.h" +#include "pre_script_dialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Control- & Widget-Ifcs: +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include // for abort + + +namespace PresentationManagement +{ +std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) +{ + return std::make_shared(session); +} + + +InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) + : GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Pre.Script")) + , m_dtc(nullptr) + , m_opmDtc(nullptr) + , m_ftc(nullptr) + , m_repForeign(nullptr) + , m_scriptDialog(nullptr) + , m_scriptId(0) // invalid + , m_requestHelper(new LtsUtils::RequestHelper(this)) +{ + connect(this, &InterfaceImpl::signalSuccess, m_session, &LtsSession::LtsSession::slotExecuteNextPayload, Qt::QueuedConnection); +} + + +QVector InterfaceImpl::getActions() +{ + QVector ret; + { + LtsWidgets::PluginData data; + data.menuGroup = menuGroup(); + data.identifier = QStringLiteral("PresentationManagement.ScriptDialog"); + data.menuText = tr("Show Script Editor"); + + if (getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::MAIN)) + { + data.layoutArea = LtsWidgets::LayoutArea::eMainTab; + data.createInstant = LtsWidgets::CreateInstantType::CreateInstantAndDiscardAction; + data.closable = false; + } + else // (as dialog) = rather unlikely.. + { + data.layoutArea = LtsWidgets::LayoutArea::eDialogTab; + } + data.operatorRight = OperatorRights::ScriptEditorShow; + data.createWidgetFunc = [this](QWidget *parent) + { + return onShowScriptDialog(parent); + }; + + ret.append(data); + } + + { + LtsWidgets::PluginData data; + data.menuGroup = menuGroup(); + data.identifier = QLatin1String("PresentationManagement.ScriptDialog.ImportScript"); + data.menuIcon = QIcon(QLatin1String("icon:import_documents.svg")); + data.menuText = tr("Insert Script"); + data.operatorRight = OperatorRights::ScriptEditorEdit; + data.directFunc = [this](const LtsWidgets::PluginData &) + { + return onImportScript(); + }; + data.createWidgetFunc = nullptr; + + ret.append(data); + } + + return ret; +} + + +bool InterfaceImpl::fetchInterfaces() +{ + if (!m_session->getDtc(m_dtc)) + { + DEBUG_LOG(m_logger) << "getDtc for PresentationManagement::DataInterface failed."; + return false; + } + if (!m_session->getFtc(m_ftc)) + { + DEBUG_LOG(m_logger) << "getFtc for PresentationManagement::DataInterface failed."; + return false; + } + if (!m_session->getDtc(m_opmDtc)) + { + DEBUG_LOG(m_logger) << "getDtc for OperatorManagement::DataInterface failed."; + return false; + } + if (!m_session->getDtc(m_coreDtc)) + { + DEBUG_LOG(m_logger) << "getDtc for SituationReplayManagement::DataInterface failed."; + return false; + } + if (!m_session->getForeignDataInterface(m_repForeign)) + { + WARNING_LOG(m_logger) << "getForeignDataInterface for SituationReplayManagement::DataInterface failed."; + return false; + } + + return true; +} + + +void InterfaceImpl::clearInterfaces() +{ + m_repForeign = nullptr; + m_coreDtc = nullptr; + m_opmDtc = nullptr; + m_ftc = nullptr; + m_dtc = nullptr; +} + + +QString InterfaceImpl::menuGroup() const +{ + return tr("Presentation"); +} + + +LtsWidgets::LtsDialog *InterfaceImpl::onShowScriptDialog(QWidget *parent) +{ + m_scriptDialog = new ScriptDialog(menuGroup(), parent); + + if (!m_scriptDialog->init(m_session, m_scriptId, m_dtc, m_ftc, m_repForeign, m_coreDtc, m_opmDtc)) + { + m_scriptDialog->deleteLater(); + m_scriptDialog = nullptr; + + // dialog is app's main dialog, close app if dialog cannot initialize + emit m_session->signalClose(); + } + + return m_scriptDialog.data(); +} + + +void InterfaceImpl::onImportScript() +{ + ScriptChooser *scriptChooser = new ScriptChooser(m_dtc, m_opmDtc, false, true); + scriptChooser->setAttribute(Qt::WA_DeleteOnClose); + + connect(scriptChooser, &ScriptChooser::signalSelectScript, + this, &InterfaceImpl::slotImportScript, Qt::QueuedConnection); + + connect(scriptChooser, &ScriptChooser::signalQuit, + m_session, &LtsSession::LtsSession::signalQuit); + + if (!LtsSessionData::LtsSessionData::getInstance()->isTablet()) + scriptChooser->setModal(true); + scriptChooser->show(); +} + + +void InterfaceImpl::slotNewScript() +{ + // prepare request + PresentationModifyRequest req; + req.name(tr("New Script").toStdString()); + req.description(tr("No description available.").toStdString()); + req.operatorId(LtsSessionData::LtsSessionData::getInstance()->getOperatorId()); + req.lastModified(QDateTime::currentMSecsSinceEpoch()); + req.fileStatus(FileStatus::Valid); + + if (m_requestHelper->startSingleRequest([this, req]() + { + return m_ftc->presentationModifyRequest(req, this); +})) + { + //slotSelectScript(m_requestHelper->getRepliedId()); + } +} + + +void InterfaceImpl::slotAddScript() +{ + PresentationEditDialog *dialog = new PresentationEditDialog(nullptr); + if (!dialog->init(-1 /* new presentation */, m_dtc, m_ftc, m_opmDtc)) + { + delete dialog; + return; + } + + QObject::connect(dialog, &PresentationEditDialog::rejected, dialog, &PresentationEditDialog::deleteLater); + + dialog->show(); +} + + +void InterfaceImpl::executePayload(LtsWidgets::LtsBackgroundWidget *mainBackground) +{ + Q_UNUSED(mainBackground); + + if (m_session->partitionType() != IDL::PartitionType::Exercise) // only on valid exercise + { + emit signalSuccess(); + return; + } + + int scriptId = m_session->getSavegame()[QStringLiteral("ScriptId")].toInt(); + if (scriptId > 0) + { + slotSelectScript(scriptId); + return; + } + + ScriptChooser *scriptChooser = new ScriptChooser(m_dtc, m_opmDtc, false, false, mainBackground); + scriptChooser->setAttribute(Qt::WA_DeleteOnClose); + + connect(scriptChooser, &ScriptChooser::signalSelectScript, + this, &InterfaceImpl::slotSelectScript, Qt::QueuedConnection); + + connect(scriptChooser, &ScriptChooser::signalQuit, + m_session, &LtsSession::LtsSession::signalQuit); + + connect(scriptChooser, &ScriptChooser::signalNewScript, + this, &InterfaceImpl::slotAddScript); + + if (!LtsSessionData::LtsSessionData::getInstance()->isTablet()) + scriptChooser->setModal(true); + + scriptChooser->show(); +} + + +void InterfaceImpl::slotSelectScript(int scriptId) +{ + m_scriptId = scriptId; + + // std::shared_ptr preGuiIfc; + + // if (!m_session->getForeignGuiInterface(preGuiIfc)) + // { + // // TODO: MSG !!1 + // return; + // } + + // preGuiIfc->setScriptId(scriptId); + + emit signalSuccess(); +} + + +void InterfaceImpl::slotImportScript(int scriptId) +{ + if (m_scriptId == scriptId) + { + ERROR_LOG(m_logger) << "Not possible to import same script!"; + LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("Not possible to import same script!")); + return; + } + + if (!importScript(scriptId)) + { + ERROR_LOG(m_logger) << "Failed to import script Id " << scriptId; + LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("Failed to import Script Id %1").arg(scriptId)); + return; + } + + DEBUG_LOG(m_logger) << "Succesfully imported script Id " << scriptId ; + + //LtsWidgets::LtsMessageDialog::showMessage(nullptr, tr("Successfully imported Script Id %1").arg(scriptId)); +} + + +bool InterfaceImpl::importScript(int idSource) +{ + if (!m_scriptDialog) + { + ERROR_LOG(m_logger) << "no script dialog open for import script"; + return false; + } + + PresentationManagement::Presentation preSource = m_dtc->presentation(idSource); + + if (preSource.id() < 1) + return false; + + // import topics + std::function importPresentationContent = [&](const Core::FunctionReply &baseReply) + { + const GetPresentationContentReply &reply = static_cast(baseReply); + const auto &contentList = reply.content(); + + if (contentList.size() < 1) + { + ERROR_LOG(m_logger) << "No Presentation Content for Script Id " << reply.id(); + return; + } + + LtsScriptTimeline::TemporaryPointerVector importedTes; + + for (const PresentationManagement::PresentationContent &content : contentList) + { + LtsScriptTimeline::TrackEntryType tet = LtsScriptTimeline::TrackEntryType::INVALID; + + if (!m_scriptDialog->topicStringToType(QString::fromStdString(content.presentationTopicType()), tet)) + { + ERROR_LOG(m_logger) << "Topic ignored - invalid topic type for presentation's content id " << content.id(); + continue; + } + + importedTes.append(ScriptDialog::trackEntryFromContent(content, 0, tet)); + } + + if (m_scriptDialog->importTrackEntries(importedTes)) + importedTes.setDiscardable(false); // don't delete tes if they could be imported and finally be managed by the script timeline + }; + + + GetPresentationContentRequest req(idSource); + req.presentationId(idSource); + + if (!m_requestHelper->startSingleRequest([req, this]() + { + return m_ftc->getPresentationContentRequest(req, this); + }, importPresentationContent)) + { + LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("There is no content to import for this script.")); + return false; + } + + return true; +} + +} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.h new file mode 100755 index 000000000..227c3ef58 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.h @@ -0,0 +1,100 @@ +/** + * @RDE_HEADER@ + * GUI Plugin for Script Editor + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-03-17 + */ + +#pragma once + +#include +#include +#include +#include +#include // reply handler +#include +#include +#include +#include + +// test: +#include +#include "pre_script_dialog.h" +#include +#include +#include +#include + + +namespace PresentationManagement +{ +class GuiPlugin final : public QObject, public GuiPluginBase::Plugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "gui:3:pre.script.edit") + Q_INTERFACES(GuiPluginBase::Plugin) + +public: + explicit GuiPlugin() = default; + ~GuiPlugin() = default; + + QString pluginName() override { return ForeignScriptDialogGuiInterface::pluginName(); } + std::shared_ptr createGuiInterface(LtsSession::LtsSession *session) override; + bool availableInPartition(IDL::PartitionType partition) const override + { return (partition == IDL::PartitionType::Exercise); } +}; + + +class InterfaceImpl final : public QObject, public GuiPluginBase::Interface + , protected PresentationManagement::Interface::Ftc::PresentationModifyReplyHandler + , protected PresentationManagement::Interface::Ftc::GetPresentationContentReplyHandler +{ + Q_OBJECT + +public: + explicit InterfaceImpl(LtsSession::LtsSession *session); + + QVector getActions() override; + QString menuGroup() const override; + bool fetchInterfaces() override; + void clearInterfaces() override; + bool availableInPartition(IDL::PartitionType partition) const override + { return partition == IDL::PartitionType::Exercise; } + + // be able to show script chooser + int executionPriority() const override { return 9999; } + void executePayload(LtsWidgets::LtsBackgroundWidget *mainBackground) override; + +protected: + void onPresentationModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); } + void onGetPresentationContentReply(const GetPresentationContentReply &reply) override { m_requestHelper->requestReply(reply); } + +private: + LtsWidgets::LtsDialog *onShowScriptDialog(QWidget *parent); + void onImportScript(); + bool importScript(/*int idDest, */int idSource); + + std::shared_ptr m_dtc; + std::shared_ptr m_opmDtc; + std::shared_ptr m_ftc; + std::shared_ptr m_repForeign; + std::shared_ptr m_coreDtc; + + QPointer m_scriptDialog; + int m_scriptId; + LtsUtils::RequestHelper *m_requestHelper; + +signals: + void signalSuccess(); + +private slots: + void slotSelectScript(int scriptId); + void slotNewScript(); + void slotImportScript(int scriptId); + void slotAddScript(); +}; + +} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.cpp new file mode 100755 index 000000000..b4b03429b --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.cpp @@ -0,0 +1,152 @@ +#include "pre_storyboard.h" +#include "ui_pre_storyboard.h" + +#include +#include +#include + +using namespace LtsScriptTimeline; + + +namespace PresentationManagement +{ + +StoryboardDialog::StoryboardDialog(QWidget *parent, LtsSession::LtsSession *session) + : LtsWidgets::LtsDialog(parent) + , m_ui(new Ui::StoryboardDialog) + , m_session(session) + , m_alreadyTranslated(false) +{ + m_ui->setupUi(this); + m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &StoryboardDialog::slotPrint); +} + + +StoryboardDialog::~StoryboardDialog() +{ + delete m_ui; +} + + +void StoryboardDialog::slotPrint() +{ + QString headingHtml = (QStringLiteral("

")); + headingHtml.append (tr("Scriptname:")); + headingHtml.append(m_scriptName); + headingHtml.append(QStringLiteral("

")); + headingHtml.append(QStringLiteral("

")); + headingHtml.append(tr("Script Owner: ")); + headingHtml.append(m_scriptOwner); + headingHtml.append(QStringLiteral("

")); + headingHtml.append(QStringLiteral("

")); + headingHtml.append(tr("Last modified: ")); + headingHtml.append(DTG::toStringMSec(m_lastModified)); + headingHtml.append(QStringLiteral("
")); + headingHtml.append(tr("Duration: ")); + QString durationStr = m_duration; + headingHtml.append(durationStr); + headingHtml.append(QStringLiteral("


")); + + LtsPrinting::printView(m_session, this, m_ui->listWidget, headingHtml); +} + + +bool StoryboardDialog::init(const QVector &topicVector, + const QVector &filterTopicVector, + const QString &scriptName, + const QString &scriptOwner, + const qint64 lastModified, + const QString duration) +{ + m_topicVector = topicVector; // cpy + m_filterTopicVector = filterTopicVector; // cpy + m_scriptName = scriptName; // cpy + m_scriptOwner = scriptOwner; + m_lastModified = lastModified; + m_duration = duration; + + // sort storyboard by time + std::sort(m_topicVector.begin(), m_topicVector.end(), [](const TrackEntry *a, const TrackEntry *b) -> bool + { + return a->m_startTime < b->m_startTime; + }); + + return true; +} + + +void StoryboardDialog::retranslate() +{ + translate(m_ui, tr("Script Storyboard")); + + if (m_alreadyTranslated) + return; + + fillStoryboard(); + m_alreadyTranslated = true; +} + + +void StoryboardDialog::fillStoryboard() +{ + m_ui->listWidget->clear(); + + QVector correspondingFilterTopics; + int ii1 = 1; + for (const LtsScriptTimeline::TrackEntry *te : qAsConst(m_topicVector)) + { + QString itemText = tr("Topic %1: %2 - %3 (%4 seconds)\n Type: %5").arg( + ii1).arg(QTime::fromMSecsSinceStartOfDay(te->m_startTime * 1000).toString(), + QTime::fromMSecsSinceStartOfDay((te->m_startTime + te->m_length) * 1000).toString()).arg( + te->m_length).arg(LtsScriptTimeline::translateTrackEntryType(te->m_type)); + + if (!te->m_description.isEmpty()) + itemText += QStringLiteral("\n ") + tr("Description: %1").arg(te->m_description); + + m_ui->listWidget->addItem(itemText); + + + // look for filters for this topic: + correspondingFilterTopics.clear(); + for (const FilterTopic &_ft : qAsConst(m_filterTopicVector)) + { + if (_ft.mainTopicId != te->m_topicId) + continue; + + correspondingFilterTopics.append(_ft); + } + + + // sort filter topics by start time + std::sort(correspondingFilterTopics.begin(), correspondingFilterTopics.end(), [](const FilterTopic &a, const FilterTopic &b) -> bool + { + return a.filterTopic->m_startTime < b.filterTopic->m_startTime; + }); + + + int ii2 = 1; + for (const FilterTopic &_ft : qAsConst(correspondingFilterTopics)) + { + if (_ft.mainTopicId != te->m_topicId) + continue; + + const LtsScriptTimeline::TrackEntry *fte = _ft.filterTopic; + + QString filterItemText = tr(" > Filter %1: %2 - %3 (%4 seconds)\n Type: %5").arg( + ii2).arg(QTime::fromMSecsSinceStartOfDay(fte->m_startTime * 1000).toString(), + QTime::fromMSecsSinceStartOfDay((fte->m_startTime + te->m_length) * 1000).toString()).arg( + fte->m_length).arg(LtsScriptTimeline::translateTrackEntryType(te->m_type)); + + if (!fte->m_description.isEmpty()) + filterItemText += QStringLiteral("\n ") + tr("Description: %1").arg(fte->m_description); + + m_ui->listWidget->addItem(filterItemText); + + ii2++; + } + + ii1++; + } +} + +} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.h new file mode 100755 index 000000000..feb9205b9 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.h @@ -0,0 +1,50 @@ +#pragma once + +#include "filter_topic.h" + +#include +#include +#include + +#include + + +namespace Ui +{ +class StoryboardDialog; +} + +namespace PresentationManagement +{ + +class StoryboardDialog : public LtsWidgets::LtsDialog +{ + Q_OBJECT +public: + StoryboardDialog(QWidget *parent, LtsSession::LtsSession *session); + ~StoryboardDialog(); + bool init(const QVector &topicVector, + const QVector &filterTopicVector, + const QString &scriptName, + const QString &scriptOwner, + const qint64 lastModified, + const QString duration); + void fillStoryboard(); + void retranslate() override final; + +private: + Ui::StoryboardDialog *m_ui; + QVector m_topicVector; + QVector m_filterTopicVector; + LtsSession::LtsSession *m_session; + QString m_scriptName = QString(); + QString m_scriptOwner = QString(); + qint64 m_lastModified = 0; + QString m_duration = QString(); + bool m_alreadyTranslated; + +public slots: + void slotPrint(); +}; + +} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.ui new file mode 100755 index 000000000..f3189fd83 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.ui @@ -0,0 +1,49 @@ + + + StoryboardDialog + + + + 0 + 0 + 707 + 464 + + + + + 0 + 0 + + + + Script Editor + + + + 9 + + + 9 + + + 9 + + + 9 + + + 9 + + + + + true + + + + + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.cpp new file mode 100755 index 000000000..ae3c2ec5f --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.cpp @@ -0,0 +1,69 @@ +/** + * @RDE_HEADER@ + * Dialog for the Topic Designer + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-06-09 + */ + +#include "pre_topic_designer_dialog.h" +#include "ui_pre_topic_designer_dialog.h" + + +namespace PresentationManagement +{ + +TopicDesignerDialog::TopicDesignerDialog(QWidget *parent) + : LtsDialog(parent) + , m_ui(new Ui::TopicDesignerDialog) +{ + m_ui->setupUi(this); + setFocusPolicy(Qt::StrongFocus); + + connect(m_ui->widget, &TopicDesigner::signalTopicSelected, + this, &TopicDesignerDialog::signalTopicSelected); + connect(m_ui->widget, &TopicDesigner::signalDeleteTrackEntry, + this, &TopicDesignerDialog::signalDeleteTrackEntry); + connect(m_ui->widget, &TopicDesigner::signalUnselect, + this, &TopicDesignerDialog::signalUnselect); + connect(m_ui->widget, &TopicDesigner::signalChangesMade, + this, &LtsWidgets::LtsDialog::signalChangesMade); + +// connect(m_ui->pbToFront, &QPushButton::clicked, +// m_ui->widget, &TopicDesigner::to) +} + + +void TopicDesignerDialog::retranslate() +{ + translate(m_ui, tr("Topic Designer")); +} + + +TopicDesignerDialog::~TopicDesignerDialog() +{ + delete m_ui; +} + + +QVector TopicDesignerDialog::exportTopicList() const +{ + return m_ui->widget->exportTopicList(); +} + + +void TopicDesignerDialog::selectTopic(int topicId) +{ + m_ui->widget->selectTopic(topicId); +} + + +void TopicDesignerDialog::loadTopicList(const QVector &topicsList) +{ + m_ui->widget->loadTopicList(topicsList); +} + +} // namespace PresentationManagement + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.h new file mode 100755 index 000000000..77fd192a8 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.h @@ -0,0 +1,57 @@ +/** + * @RDE_HEADER@ + * Dialog for the Topic Designer + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-06-09 + */ + +#pragma once + +#include + +#include + + +namespace Ui +{ +class TopicDesignerDialog; +} + +namespace LtsScriptTimeline +{ +class TrackEntry; +} + + +namespace PresentationManagement +{ + +class TopicDesignerDialog : public LtsWidgets::LtsDialog +{ +public: + Q_OBJECT + +public: + explicit TopicDesignerDialog(QWidget *parent = nullptr); + ~TopicDesignerDialog(); + + void loadTopicList(const QVector &topicsList); + QVector exportTopicList() const; + void selectTopic(int topicId); + +signals: + void signalTopicSelected(int topicId); + void signalDeleteTrackEntry(int topicId); + void signalUnselect(); + +private: + void retranslate() override; + + Ui::TopicDesignerDialog *m_ui; + +}; + +} // namespace PresentationManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.ui new file mode 100755 index 000000000..c0c57548d --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.ui @@ -0,0 +1,122 @@ + + + TopicDesignerDialog + + + + 0 + 0 + 600 + 338 + + + + + 0 + 0 + + + + Script Editor + + + + 0 + + + 9 + + + 9 + + + 9 + + + 9 + + + + + Some text + + + + + + + + + + + To Front + + + + + + + Inc Idx + + + + + + + Dec Idx + + + + + + + To Back + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 0 + 0 + + + + + 0 + 300 + + + + + + + + + + + PresentationManagement::TopicDesigner + QWidget +
topic_designer.h
+ 1 +
+
+ + +
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/CMakeLists.txt new file mode 100755 index 000000000..6702c5cfd --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/CMakeLists.txt @@ -0,0 +1,17 @@ +# +# $Id$ +# $HeadURL$ +# $Author$ +# +# Created by Mike Wille, SLTE, 2020-03-23 +# + +ADD_SUBDIRECTORY(Common) +ADD_SUBDIRECTORY(ThpManagement) +ADD_SUBDIRECTORY(ThpUsbManagement) + +ADD_INTERFACE_LIBRARY(TpmGuiPluginInterface + ${CMAKE_CURRENT_SOURCE_DIR}/tpm_gui_plugin_interface.h + ${CMAKE_CURRENT_SOURCE_DIR}/.. + GuiPluginInterface +) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/CMakeLists.txt new file mode 100755 index 000000000..c3f253719 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/CMakeLists.txt @@ -0,0 +1,43 @@ +# +# $Id: CMakeLists.txt 51804 2020-07-31 04:47:28Z fritsche_h $ +# $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/CMakeLists.txt $ +# $Author: fritsche_h $ +# +# Created by Mike Wille, SLTE, 2020-03-23 +# + +SET(src + logger.cpp + logger.h + tpm_exported_scripts_model.cpp + tpm_exported_scripts_model.h + tpm_process_dialog.cpp + tpm_process_dialog.h +) + +QT5_WRAP_UI(src + tpm_process_dialog.ui +) + +NGL_ADD_LIBRARY2(WS ThpCommon SHARED ${src}) +NGL_TARGET_INCLUDE_DIRECTORIES(ThpCommon + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/../ + ${CMAKE_CURRENT_BINARY_DIR}/../ # export file +) +NGL_TARGET_LINK_LIBRARIES(ThpCommon + Qt6::Core + Qt6::Concurrent + NGLLogger + LtsSession + AsmDataPluginInterface + ExmDataPluginInterface + #nglcompression + #nglsettings + #ngltools + #LtsSessionData + #httq +) + +NGL_INSTALL_TARGET(ThpCommon) + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.cpp new file mode 100755 index 000000000..a4066a755 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.cpp @@ -0,0 +1,37 @@ +/** + * @RDE_HEADER@ + * Building Config - logging facility + * $Id: logger.cpp 46225 2019-03-25 13:59:56Z rudolphus_g $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/logger.cpp $ + * $Author: rudolphus_g $ + */ + +#include "logger.h" + +#include + +namespace TakeHomePackageManager +{ + +LOGGER_T getLogger(const char *name) +{ + static const char ns[] = "TPM.Common."; + std::string loggerName; + const size_t len = strlen(name); + loggerName.reserve(sizeof(ns) + len); + loggerName.append(ns, sizeof(ns) - 1); + loggerName.append(name, len); + + try + { + return NGL::NGLLoggerBootstrap::getNGLRootLogger(). + getNGLLogger(loggerName); + } + catch (const std::exception &ex) + { + fprintf(stderr, "Error retrieving logger: %s", ex.what()); + abort(); + } +} + +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.h new file mode 100755 index 000000000..d2c571f29 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.h @@ -0,0 +1,22 @@ +/** + * @RDE_HEADER@ + * Logging for CentralEffectSimulation + * $Id: logger.h 46225 2019-03-25 13:59:56Z rudolphus_g $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/logger.h $ + * $Author: rudolphus_g $ + */ + +#pragma once + +#include + +namespace TakeHomePackageManager +{ +typedef NGL::INGLLogger &LOGGER_T; + +LOGGER_T getLogger(const char *name); +inline LOGGER_T getLogger(const QString &loggerName) +{ + return getLogger(loggerName.toUtf8().constData()); +} +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.cpp new file mode 100755 index 000000000..900b3b8ba --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.cpp @@ -0,0 +1,632 @@ +/** + * @RDE_HEADER@ + * Show the exported scripts and allow them to upload them to the server + * $Id: tpm_exported_scripts_model.cpp 53111 2021-03-22 08:21:29Z wille_m $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/tpm_exported_scripts_model.cpp $ + * $Author: wille_m $ + * Created by Gerlinde Rudolphus, NLE, 2019-03-25 + */ + +#include "tpm_exported_scripts_model.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + + +namespace TakeHomePackageManager +{ + +ExportedScriptsModel::ExportedScriptsModel(QObject *parent) + : LtsWidgets::LtsAbstractTableModel( + { tr("id"), tr("Exercise"), tr("Name"), tr("Created"), tr("Last downloaded"), tr("Location"), tr("Last uploaded"), tr("Server")}, parent) + , m_logger(getLogger("ExportedScriptsModel")) +{} + +bool ExportedScriptsModel::init(const QString &rootDirectoryToScan) +{ + std::shared_ptr _(nullptr, [this](int *) { endResetModel(); }); // TODO: QScopeGuard + m_rootDirectoryToScan = rootDirectoryToScan; + beginResetModel(); + m_vecData.clear(); + + QVector localExercises; + DEBUG_LOG(m_logger) << "ExportedScriptsModel::init rootDirectoryToScan=" << rootDirectoryToScan + /*<< " directoryToScan=" << directoryToScan*/; + + //clear(); multiple inits needed, don't clear + + // die Skripte aller Uebungen auf der lokalen Workstation anzeigen. + // Die Uebungen sind in der Datei /tmp/THP-xxxxxxx/data.json im Array Exercises enthalten. + { + DEBUG_LOG(m_logger) << "Get all local exercises rootDirectoryToScan=" << rootDirectoryToScan ; + QFile file(rootDirectoryToScan + QDir::separator() + QStringLiteral("exercises.json")); + if (!file.open(QFile::ReadOnly)) // file only exists after a first download, but that's okay + WARNING_LOG(m_logger) << "Cannot open " << file.fileName() << " for read/write: " << file.errorString(); + + const QJsonDocument doc(QJsonDocument::fromJson(file.readAll())); + const QJsonObject obj = doc.object(); // okay to be empty + const QJsonArray arr = obj[QStringLiteral("Exercises")].toArray(); + localExercises.reserve(arr.size()); + for (const auto &ele : arr) + localExercises.append(ele.toInt()); + } + + WARNING_LOG(m_logger) << "local exericses: " << localExercises.count(); + + // Alle lokalen Übungen: + for (const int exId : qAsConst(localExercises)) + { + const QString baseDir = exercisePath(rootDirectoryToScan, exId); + QFile file(baseDir + QDir::separator() + QStringLiteral("data.json")); + + if (!file.open(QIODevice::ReadOnly)) + { + WARNING_LOG(m_logger) << "Cannot open " << file.fileName() << " for reading: " << file.errorString() << " - not critical"; + // There are no local scripts but maybe some are on the server + return true; + } + + const QJsonDocument doc(QJsonDocument::fromJson(file.readAll())); + const QJsonObject obj = doc.object(); + const QJsonArray presentations = obj[QStringLiteral("presentations")].toArray(); + + DEBUG_LOG(m_logger) << "exercise: " << exId << ", presentations: " << presentations.size(); + + for (const QJsonValue &val : presentations) + { + ExportedScriptInformation esi = ExportedScriptInformation::fromJson(val); + DEBUG_LOG(m_logger) << "obj=" << QJsonDocument(obj).toJson(QJsonDocument::Compact); + const QJsonObject presentationObj = val.toObject(); + DEBUG_LOG(m_logger) << "presentationObj=" << QJsonDocument(presentationObj).toJson(QJsonDocument::Compact); + if (obj.contains(QStringLiteral("exerciseId"))) + { + esi.exerciseId = obj[QStringLiteral("exerciseId")].toInt(); + esi.exerciseName = obj[QStringLiteral("exerciseName")].toString(); + if (presentationObj.contains(QStringLiteral("name")) ) + esi.scriptName = presentationObj[QStringLiteral("name")].toString(); + if (presentationObj.contains(QStringLiteral("displayName")) ) + esi.scriptName = presentationObj[QStringLiteral("displayName")].toString(); + } + + esi.local = true; + DEBUG_LOG(m_logger) << "push_back " + << " exportTime=" << esi.exportTime + << " scriptId=" << esi.scriptId + << " scriptName=" << esi.scriptName + << " exerciseId=" << esi.exerciseId + << " exerciseName=" << esi.exerciseName + << " local=" << esi.local; + esi.uploaded = ThpUnknownUploadState; + + esi.rootDirectory = rootDirectoryToScan; // to determine if this script is from THP-Download or THP-Export directory (for USB Management, which can copy from both dirs) + + m_vecData.push_back(esi); + } + } + + return true; +} + +/** + * @brief ExportedScriptsModel::setServerContent fills the table with local and + * server scripts and deletes rows of deleted scripts. + * @param jsonArray of scripts from the server + * @return true if jsonArray could be parsed and was processed, false if + * jsonArray could not be parsed + */ +void ExportedScriptsModel::setServerContent(const QString &jsonArray) +{ + if (jsonArray.isEmpty()) // no content received yet? no problem, just return + return; + + /* these vectors are needed to compare which scripts are already + * on the server or are local or are both on the server and local + * e.g. if the script was downloaded after it was once uploaded + * to the server */ + QMap> exerciseContentScriptIds; // scripts from server - Key = ExerciseId, value = script ids of exercise + QMap> exerciseScriptIds; // scripts from local data.json file - Key = ExerciseId, value = script ids of exercise + + DEBUG_LOG(m_logger) << "ExportedScriptsModel::setServerContent jsonArray =" << jsonArray; + QJsonParseError err; + const QJsonArray presentations = QJsonDocument::fromJson(jsonArray.toUtf8(), &err).array(); + DEBUG_LOG(m_logger) << "presentations.size() =" << presentations.size(); + + if (err.error != QJsonParseError::NoError) + { + ERROR_LOG(m_logger) << "json array invalid at offset " << err.offset << ": " << err.errorString(); + return; + } + + // put local scripts into local scripts list + for (const auto &data : qAsConst(m_vecData)) + { + exerciseScriptIds[data.exerciseId].append(data.scriptId); + DEBUG_LOG(m_logger) << "exerciseId=" << data.exerciseId + << " modelScriptIds.append: " << data.scriptId; + } + + // put server scripts into server scripts list + for (const QJsonValue &val : presentations) + { + const ExportedScriptInformation esi = ExportedScriptInformation::fromJson(val, false, ThpAlreadyUploaded); + exerciseContentScriptIds[esi.exerciseId].append(esi.scriptId); + } + + /* look for scripts that are on the server but also on the local side to + * either remove the corresponding row from the table if the script is not on + * the server and not set as local (that makes it non-local and non-existant + * on the server, which means it was at one point on the server, but was + * deleted from it after the server script list was received here some + * minutes ago) - + * or to add the not-uploaded state to the table row if it's local only + * (but what about local scripts that were uploaded? => This is handeled at + * the next main for-loop below) + */ + for (int i = m_vecData.size() - 1; i >= 0; --i) // scriptId ist nur im Modell aber nicht im content + { + const auto &rowData = m_vecData[i]; + const QVector contentScriptIds = exerciseContentScriptIds.value(rowData.exerciseId); + DEBUG_LOG(m_logger) << "m_vecData.at(" << i << ").scriptId=" << rowData.scriptId + << " exerciseId=" << rowData.exerciseId + << " contentScriptIds.contains=" << contentScriptIds.contains(rowData.scriptId) + << " rowData.local=" << rowData.local + << " contentScriptIds.size()=" << contentScriptIds.size(); + + if (!contentScriptIds.contains(rowData.scriptId)) + { + // the script already in the table is not available on the server side + if (rowData.local == false) + { + /* script already in table is marked as non-loal, which means - in + * combination with the script not being on the server (anymore) - that + * the script was removed from the server after the server script list + * was received from the server and added to the table. So remove it + * from the table */ + DEBUG_LOG(m_logger) << "removeRow(" << i << ")" + << " ScriptId=" << rowData.scriptId + << " ExerciseId=" << rowData.exerciseId; + removeRow(i); + } + else + { + /* otherwise, if it's marked as local, that means - in combination + * with he script not being on the server (anymore) - that the script + * is only locally available */ + setUploadState(i, ThpUploadNotActive, 0, 0); + } + } + } + + /* get all server scripts and add them to the table if they're not already in + * the table.LtsUtils::ProjectSettings *ps = L + * if the corresponding row already exist then set the uploaded-state to + * uploaded, because they came from the server list, which means they were + * obviously uploaded at some point */ + for (const QJsonValue &val : presentations) + { + ExportedScriptInformation esi = ExportedScriptInformation::fromJson(val, false, ThpAlreadyUploaded); + QVector modelScriptIds = exerciseScriptIds.value(esi.exerciseId); + DEBUG_LOG(m_logger) << " exportTime=" << esi.exportTime + << " scriptId=" << esi.scriptId + << " exerciseId=" << esi.exerciseId + << " exerciseName=" << esi.exerciseName + << " scriptName=" << esi.scriptName + << " fileSize=" << esi.fileSize + << " modelScriptIds.size=" << modelScriptIds.size(); + + // if a new script was added on the server and not available in this model already, then add it to the model + if (!modelScriptIds.contains(esi.scriptId)) + { + DEBUG_LOG(m_logger) << "insertRow()"; + insertRow(esi); + continue; + } + + // update model + for (int i = 0; i < m_vecData.size(); i++) + { + const auto &rowData = m_vecData[i]; + if (rowData.scriptId == esi.scriptId && + rowData.exerciseId == esi.exerciseId) + { + DEBUG_LOG(m_logger) << "setUploadState i=" << i + << " esi.scriptId=" << esi.scriptId + << " esi.exerciseId=" << esi.exerciseId + << " esi.fileSize=" << esi.fileSize + << " esi.uploadTime=" << esi.uploadTime; + setUploadState(i, ThpAlreadyUploaded, esi.uploadTime, esi.fileSize); + break; // can only match 1 time + } + } + } + + update(); + return; +} + + +qint64 ExportedScriptsModel::downloadTime(const ExportedScriptInformation &val) const +{ + if (!val.local) // can't be downloaded if it's not local + return 0; + + QString filename(QStringLiteral("%1/THP-Download/Exercise_%2/%3/index.html").arg(QDir::tempPath()).arg(val.exerciseId).arg(val.scriptId)); + DEBUG_LOG(m_logger) << "downloadTime: filename " << filename; + + QFileInfo fi(filename); + if (!fi.exists()) + return 0; + + return fi.lastModified().toMSecsSinceEpoch(); +} + + +QVariant ExportedScriptsModel::data(const QModelIndex &index, int role) const +{ + if (!indexIsValid(index)) + return QVariant(); + + const ExportedScriptInformation &val = m_vecData[index.row()]; + + switch (role) + { + case Qt::FontRole: + { + if (!m_isOC + /* because non-oc app has no "downloaded" column, telling the + * user he has a newer version to download (by making the uploaded + * cell fat) makes no sense */ + + || !val.local + /* non-downloaded scripts can't be older than the script on the server + * because there obviously is no downloaded (local) script */ + + || index.column() != ColUploadedTime + + || val.uploadTime <= (downloadTime(val) + (10 * 1000) /* 10 second grace */)) + /* if the script was downloaded from the server before the script was + * updated / uploaded to the server again, mark the uploaded time cell + * as fat to indicate the local, downloaded script is outdated */ + break; + + QFont font; + font.setBold(true); + return font; + } + + case Qt::DisplayRole: + { + switch (index.column()) + { + case ColId: + return val.scriptId; + case ColExercise: + return val.exerciseName; + case ColName: + return val.scriptName; + case ColCreated: + return QDateTime::fromMSecsSinceEpoch(val.exportTime); + case ColDownloaded: + { + qint64 dlTime = downloadTime(val); + if (dlTime == 0) + return QVariant(); + return QDateTime::fromMSecsSinceEpoch(dlTime); + } + case ColUploadedTime: + return QDateTime::fromMSecsSinceEpoch(val.uploadTime); + case ColLocation: + return val.local ? tr("Local") : tr("Server"); + case ColUploaded: + switch (val.uploaded) + { + case ThpConnectToHost: + return tr("Connect to host"); + case ThpUploadActive: + return tr("Upload Active"); + case ThpUploadError: + return tr("Upload Error"); + case ThpUploadNotActive: + return tr("Not uploaded"); + case ThpUnknownUploadState: + return tr("Unknown upload status"); + case ThpAlreadyUploaded: + return tr("Already uploaded"); + } + } + + case Qt::UserRole: + { + return val.scriptId; + break; + } + + break; + } + } + + return QVariant(); +} + +bool ExportedScriptsModel::createDataJson(const QString &rootDirectory, + const std::shared_ptr &exmDtc, + const std::shared_ptr &asmDtc, + int exerciseId) const // TODO: static, static logger +{ + const QString baseDir = exercisePath(rootDirectory, exerciseId); + + if (!QDir().mkpath(baseDir)) // NOTE: returns true if already exists + { + ERROR_LOG(m_logger) << "Failed to create path " << baseDir; + return false; + } + + QFile file(baseDir + QStringLiteral("data.json")); + DEBUG_LOG(m_logger) << "createDataJson=" << file.fileName(); + if (!file.open(QFile::ReadWrite)) + { + QString msg(tr("Could not open data file in script directory: %1").arg(file.errorString())); + ERROR_LOG(m_logger) << msg << " - " << file.fileName(); + return false; + } + + QJsonDocument doc(QJsonDocument::fromJson(file.readAll())); + QJsonObject obj = doc.object(); + if (obj[QStringLiteral("exerciseId")].toInt() == exerciseId) + { + DEBUG_LOG(m_logger) << baseDir << " exists for exerciseId " << QString::number(exerciseId); + return true; + } + + const ExerciseManagement::Exercise exercise = exmDtc->exercise(exerciseId); + const AssetManagement::TrainingArea ta = asmDtc->trainingArea(exercise.trainingAreaId()); + + obj[QStringLiteral("title")] = QString::fromStdString(exercise.name()); + obj[QStringLiteral("exerciseId")] = exercise.id(); + obj[QStringLiteral("exerciseName")] = QString::fromStdString(exercise.name()); + obj[QStringLiteral("exerciseArea")] = QString::fromStdString(ta.name()); + obj[QStringLiteral("cycleTime")] = QString(QDateTime::fromMSecsSinceEpoch(exercise.beginTime()).toString() + + QStringLiteral(" - ") + QDateTime::fromMSecsSinceEpoch(exercise.endTime()).toString()); + obj[QStringLiteral("exerciseStart")] = exercise.beginTime(); + obj[QStringLiteral("exerciseEnd")] = exercise.endTime(); + obj[QStringLiteral("exercisingForces")] = QString::fromStdString(exercise.forces()); + obj[QStringLiteral("exercisingPurpose")] = QString::fromStdString(exercise.description()); + + file.resize(0); + file.write(QJsonDocument(obj).toJson()); + + return true; +} + + +void ExportedScriptsModel::addDownloadData(const ExportedScriptInformation &esi) +{ + // Add exercise to ExportRootPath + { + // modify exercises.json + DEBUG_LOG(m_logger) << "Add exercise to ExportRootPath"; + + if (!QDir(esi.rootDirectory).exists()) + { + ERROR_LOG(m_logger) << "Cannot modify exercises.json as the info's root directory '"<::removeRow(row)) + return false; + + QString baseDir = exercisePath(data.rootDirectory, data.exerciseId); + QString filename = baseDir + QStringLiteral("data.json"); + DEBUG_LOG(m_logger) << "filename= '" << filename << "'"; + QFile file(baseDir + QStringLiteral("data.json")); + + if (!file.open(QIODevice::ReadWrite)) + { + DEBUG_LOG(m_logger) << "!file.open '" << filename << "'" + << " no local scripts"; + return true; + } + + const QJsonDocument doc(QJsonDocument::fromJson(file.readAll())); + QJsonObject obj = doc.object(); + const int exId = obj.value(QStringLiteral("exerciseId")).toInt(); + QJsonArray arr; + + for (const auto &esi : qAsConst(m_vecData)) + { + if (esi.exerciseId == exId) + arr += esi.toJson(); + } + + obj[QStringLiteral("presentations")] = arr; + file.resize(0); + auto content = QJsonDocument(obj).toJson(); + DEBUG_LOG(m_logger) << "content =" << content; + + return file.write(QJsonDocument(obj).toJson()); +} + +QString ExportedScriptsModel::exercisePath(const QString &rootDirectory, const int exerciseId) const +{ + QString path = QStringLiteral("%1/Exercise_%2/").arg(rootDirectory).arg(exerciseId); +#ifndef WIN32 + path.prepend(QStringLiteral("/")); +#endif + return path; +} + +// +// ExportedScriptInformation +// +QJsonValue ExportedScriptInformation::toJson() const +{ + return QJsonObject({ + { QStringLiteral("displayName"), scriptName }, + { QStringLiteral("path"), jsonPath }, + { QStringLiteral("scriptId"), scriptId }, + { QStringLiteral("exportTime"), exportTime }, + { QStringLiteral("fileSize"), fileSize }, + { QStringLiteral("uploadTime"), uploadTime }, + { QStringLiteral("exerciseName"), exerciseName }, + { QStringLiteral("exerciseId"), exerciseId } + }); +} + +ExportedScriptInformation ExportedScriptInformation::fromJson(const QJsonValue &val, + const bool local, + const UploadState uploadState) +{ + const QJsonObject obj = val.toObject(); + + ExportedScriptInformation esi; + esi.local = local; + esi.scriptName = obj[QStringLiteral("displayName")].toString(); + if (esi.scriptName.isEmpty()) + esi.scriptName = obj[QStringLiteral("name")].toString(); + esi.jsonPath = obj[QStringLiteral("path")].toString(); + esi.scriptId = obj[QStringLiteral("scriptId")].toInt(); + esi.exportTime = qRound64(obj[QStringLiteral("exportTime")].toDouble()); + esi.fileSize = obj[QStringLiteral("fileSize")].toInt(); + esi.uploaded = uploadState; + esi.uploadTime = qRound64(obj[QStringLiteral("uploadTime")].toDouble()); + esi.exerciseName = obj[QStringLiteral("exerciseName")].toString(); + esi.exerciseId = obj[QStringLiteral("exerciseId")].toInt(); + + Q_ASSERT(esi.scriptId != -1); + Q_ASSERT(esi.exerciseId != -1); + + if (esi.scriptId != -1 && esi.exerciseId != -1) + esi.valid = true; + + return esi; +} + +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.h new file mode 100755 index 000000000..5f41bdb0e --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.h @@ -0,0 +1,99 @@ +/** + * @RDE_HEADER@ + * Show the exported scripts and allow them to upload them to the server + * $Id: tpm_exported_scripts_model.h 53111 2021-03-22 08:21:29Z wille_m $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/tpm_exported_scripts_model.h $ + * $Author: wille_m $ + * Created by Gerlinde Rudolphus, NLE, 2019-03-25 + */ +#pragma once + +#include + +#include +#include +#include +#include + + +namespace TakeHomePackageManager +{ + +enum UploadState +{ + ThpUnknownUploadState, + ThpUploadNotActive, + ThpConnectToHost, + ThpUploadActive, + ThpAlreadyUploaded, + ThpUploadError, +}; + +struct ExportedScriptInformation +{ + bool valid { false }; + + QString exerciseName; + QString scriptName; + QString jsonPath; + QString rootDirectory; // temp + qint64 exerciseId = -1; + qint64 exportTime = 0; + qint64 fileSize = 0; + bool local = true; // On local Host + UploadState uploaded = ThpUnknownUploadState; + qint64 uploadTime = 0; + int scriptId = -1; + + int id() const { return scriptId; } + + QJsonValue toJson() const; + static ExportedScriptInformation fromJson(const QJsonValue &val, + const bool local = true, + const UploadState uploadStates = ThpUnknownUploadState); +}; + + + +class THPCOMMON_EXPORT ExportedScriptsModel : public LtsWidgets::LtsAbstractTableModel +{ + Q_OBJECT +public: + enum Columns + { + ColId, + ColExercise, + ColName, + ColCreated, + ColDownloaded, + ColLocation, + ColUploadedTime, + ColUploaded, + }; + explicit ExportedScriptsModel(QObject *parent = nullptr); + + bool init(const QString &rootDirectoryToScan); + void setServerContent(const QString &jsonArray); + void setOC(bool isOC) { m_isOC = isOC; } + + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool removeRow(int row) override; + bool setLocalState(const int row, const bool localHost); + bool setUploadState(const int row, const UploadState uploadState, const qint64 uploadTime, const qint64 fileSize); + bool createDataJson(const QString &rootDirectory, const std::shared_ptr &exmDtc, + const std::shared_ptr &asmDtc, + int exerciseId) const; + void addDownloadData(const ExportedScriptInformation &esi); + +private: + QString exercisePath(const QString &rootDirectory, const int exerciseId) const; + qint64 downloadTime(const ExportedScriptInformation &val) const; + +private: + bool m_isOC { false }; + QString m_rootDirectoryToScan; + NGL::INGLLogger &m_logger; + +}; +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.cpp new file mode 100755 index 000000000..0b41c20f2 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.cpp @@ -0,0 +1,66 @@ +#include "tpm_process_dialog.h" +#include "ui_tpm_process_dialog.h" + + +namespace TakeHomePackageManager +{ +ProcessOverlay::ProcessOverlay(QWidget *parent) + : QWidget(parent) + , m_ui(new Ui::ProcessOverlay) +{ + m_ui->setupUi(this); + + connect(m_ui->pbCancel, &QPushButton::clicked, + this, [this]() + { + m_ui->pbCancel->setEnabled(false); + emit signalCancel(); + }); +} + + +ProcessOverlay::~ProcessOverlay() +{ + delete m_ui; +} + + +void ProcessOverlay::setCancelEnabled(bool enabled) +{ + m_ui->pbCancel->setEnabled(enabled); +} + + +void ProcessOverlay::setStatus(const QString &text, qint64 totalFiles, qint64 curFile, qint64 totalSize, qint64 curPos, const QString &curName) +{ + if (!text.isEmpty()) // only set new text if not empty (we dont want to send the text on every update.. + m_ui->lblStatus->setText(text); + + if (!curName.isEmpty()) // only set new text if not empty (we dont want to send the text on every update.. + m_ui->lblFilename->setText(curName); + + double progressBytes = (totalSize == 0) ? (double)0 : ((double)curPos / (double)totalSize); + double progressFiles = (((double)curFile - 1) / (double)totalFiles); + double progressTotal = progressFiles + (progressBytes / (double)totalFiles); + + progressBytes = qRound(progressBytes * 100); + progressFiles = qRound(progressFiles * 100); + progressTotal = qRound(progressTotal * 100); + + m_ui->pbarFiles->setValue(progressFiles); + m_ui->pbarBytes->setValue(progressBytes); + m_ui->pbarProgress->setValue(progressTotal); + + QLocale l; + + if (curFile == 0) + m_ui->lblFiles->setText(QStringLiteral(" - ")); + else + m_ui->lblFiles->setText(QStringLiteral("%1 / %2").arg(l.toString(curFile)).arg(l.toString(totalFiles))); + + if (curPos == 0) + m_ui->lblBytes->setText(QStringLiteral(" - ")); + else + m_ui->lblBytes->setText(QStringLiteral("%1 / %2").arg(l.toString(curPos)).arg(l.toString(totalSize))); +} +} // namespace TakehomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.h new file mode 100755 index 000000000..22893a514 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.h @@ -0,0 +1,32 @@ +#pragma once + +#include + +#include + + +namespace Ui +{ +class ProcessOverlay; +} + +namespace TakeHomePackageManager +{ +class THPCOMMON_EXPORT ProcessOverlay : public QWidget +{ + Q_OBJECT +public: + ProcessOverlay(QWidget *parent = nullptr); + ~ProcessOverlay(); + + void setStatus(const QString &text = QString(), qint64 totalFiles = 1, qint64 curFile = 1, qint64 totalSize = 0, qint64 curPos = 0, const QString &curName = QString()); + void setCancelEnabled(bool enabled = true); + +signals: + void signalCancel(); + +private: + Ui::ProcessOverlay *m_ui; + bool m_decompressing { false }; +}; +} // namespace TakehomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.ui new file mode 100755 index 000000000..5a0ef934d --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.ui @@ -0,0 +1,174 @@ + + + ProcessOverlay + + + + 0 + 0 + 700 + 220 + + + + + 0 + 0 + + + + + 700 + 0 + + + + Form + + + + + + - + + + + + + + Progress + + + + + + + + 0 + 0 + + + + 0 + + + + + + + - + + + + + + + Preparing ... + + + + + + + Files + + + + + + + + 0 + 0 + + + + 0 + + + + + + + 0 + + + + + + 0 + 0 + + + + Cancel + + + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + + + + + - + + + + + + + Bytes + + + + + + + + 0 + 0 + + + + 0 + + + + + + + Filename + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + + + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/CMakeLists.txt new file mode 100755 index 000000000..dce196664 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/CMakeLists.txt @@ -0,0 +1,48 @@ +# +# $Id: CMakeLists.txt 51804 2020-07-31 04:47:28Z fritsche_h $ +# $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/CMakeLists.txt $ +# $Author: fritsche_h $ +# +# Created by Gerlinde Rudolphus, NLE, 2019-03-25 +# + +# +# Common +# +SET(thp_SRCS + tpm_gui_plugin.cpp + tpm_gui_plugin.h + tpm_exported_scripts_dialog.cpp + tpm_exported_scripts_dialog.h + logger.cpp + logger.h +) + +QT5_WRAP_UI(thp_SRCS + tpm_exported_scripts_dialog.ui +) + +#TODO: auto-remove "libTakeHomePackageManagerGuiPlugin.so" from lib as this lib replaces it + +NGL_ADD_LIBRARY2(WS ThpManagementGuiPlugin MODULE ${thp_SRCS}) +NGL_TARGET_LINK_LIBRARIES(ThpManagementGuiPlugin + ThpCommon + TpmGuiPluginInterface + Qt6::Widgets + Qt6::Network + Qt6::WebSockets + NGLLogger + LtsWidgets + LtsSession + LtsDataView + nglcompression + nglsettings + ngltools + AsmDataPluginInterface + ExmDataPluginInterface + LtsSessionData + httq +) + +NGL_INSTALL_TARGET(ThpManagementGuiPlugin) + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.cpp new file mode 100755 index 000000000..a47ac9e87 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.cpp @@ -0,0 +1,37 @@ +/** + * @RDE_HEADER@ + * Building Config - logging facility + * $Id: logger.cpp 46225 2019-03-25 13:59:56Z rudolphus_g $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/logger.cpp $ + * $Author: rudolphus_g $ + */ + +#include "logger.h" + +#include + +namespace TakeHomePackageManager +{ + +LOGGER_T getLogger(const char *name) +{ + static const char ns[] = "TPM."; + std::string loggerName; + const size_t len = strlen(name); + loggerName.reserve(sizeof(ns) + len); + loggerName.append(ns, sizeof(ns) - 1); + loggerName.append(name, len); + + try + { + return NGL::NGLLoggerBootstrap::getNGLRootLogger(). + getNGLLogger(loggerName); + } + catch (const std::exception &ex) + { + fprintf(stderr, "Error retrieving logger: %s", ex.what()); + abort(); + } +} + +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.h new file mode 100755 index 000000000..d2c571f29 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.h @@ -0,0 +1,22 @@ +/** + * @RDE_HEADER@ + * Logging for CentralEffectSimulation + * $Id: logger.h 46225 2019-03-25 13:59:56Z rudolphus_g $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/logger.h $ + * $Author: rudolphus_g $ + */ + +#pragma once + +#include + +namespace TakeHomePackageManager +{ +typedef NGL::INGLLogger &LOGGER_T; + +LOGGER_T getLogger(const char *name); +inline LOGGER_T getLogger(const QString &loggerName) +{ + return getLogger(loggerName.toUtf8().constData()); +} +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.cpp new file mode 100755 index 000000000..e1b77b1f2 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.cpp @@ -0,0 +1,1244 @@ +/** + * @RDE_HEADER@ + * Show the exported scripts and allow them to upload them to the server + * $Id: tpm_exported_scripts_dialog.cpp 53111 2021-03-22 08:21:29Z wille_m $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/tpm_exported_scripts_dialog.cpp $ + * $Author: wille_m $ + * + * Created by Gerlinde Rudolphus, NLE, 2019-03-25 + * Rebuilt to use httq by Mike Wille, NLE, 2020-07-07 + */ + +/* TODO: FIXME: adjust data.json when uploading file, as data.json contains ALL + * scripts, but we only upload ONE script at a time - so remove all scripts but + * the one to be uploaded from data.json (but don't touch the main data.json!!) + */ + +#include "ui_tpm_exported_scripts_dialog.h" +#include "tpm_exported_scripts_dialog.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifndef ELOG +#define ELOG ERROR_LOG(m_logger) // polyfill +#endif + + +namespace TakeHomePackageManager +{ +/*/ + * every process needs to deleteLater itself + * every process must listen to signalTimeout & signalCancel (+ call deleteLater in them!) + * only connect to signalDone & signalError when using a request + * disconnect signalTimeout & signalCancel before you do another step + * a QNetworkReply will always call either signalDone or signalError - call deleteLater in both of them! + * aborting a QNetworkReply finally calls signalError, so call deleteLater at this point + * nglcompress will always call finished, it doesn't matter if it failed or not - call deleteLater at this point +/*/ +HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent) + : QObject(parent) + , m_esi(esi) + , m_logger(getLogger("ExportedScriptsDialog.HttpProcess")) + , m_process(new ProcessOverlay) + , m_nam(new QNetworkAccessManager(this)) + , m_timeout(new QTimer(this)) +{ + connect(m_process, &ProcessOverlay::signalCancel, + this, [this]() + { + DEBUG_LOG(m_logger) << "m_wasCanceled!!"; + m_wasCanceled = true; + m_process->setCancelEnabled(false); + }); + connect(m_process, &ProcessOverlay::signalCancel, + this, &HttpProcess::signalCancel); + + //LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(waitDialogText); + + int timeout = 30 * 1000; // timeout after 30 seconds + QVariant timeoutVar(LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.Timeout"))); + + if (timeoutVar.canConvert(QMetaType::Int)) + { + bool k = false; + int _timeout = timeoutVar.toInt(&k); + + DEBUG_LOG(m_logger) << "TPM.Timeout debug value set! k = " << k << "_timeout = " << _timeout; + + if (k) + { + timeout = _timeout; + DEBUG_LOG(m_logger) << "new timeout set to " << timeout; + } + } + + m_timeout->setInterval(timeout); + m_timeout->setSingleShot(true); + m_timeout->start(); + + connect(m_timeout, &QTimer::timeout, + this, [this]() + { + stopTimeout(); + new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), tr("Timeout occured during the operation - aborted")); + WARNING_LOG(m_logger) << "Timeout occured during the operation - aborted"; + m_isTimeout = true; + + emit signalTimeout(); + }); +} + + +HttpProcess::~HttpProcess() +{ + DEBUG_LOG(m_logger) << "~HttpProcess"; + delete m_process; + //LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); +} + + +void HttpProcess::doConnections(QNetworkReply *r) +{ + connect(r, &QNetworkReply::readyRead, + this, &HttpProcess::slotReadyRead); + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + connect(r, &QNetworkReply::errorOccurred, + this, &HttpProcess::slotError); +#else + connect(r, QOverload::of(&QNetworkReply::error), + this, &HttpProcess::slotError); +#endif + + connect(r, &QNetworkReply::finished, + this, &HttpProcess::slotSuccess); + connect(r, &QNetworkReply::uploadProgress, + this, &HttpProcess::resetTimeout); + connect(r, &QNetworkReply::downloadProgress, + this, &HttpProcess::resetTimeout); +} + + +QNetworkRequest HttpProcess::forgeRequest(const QString &path, const QUrlQuery &q, const QString &contentType) +{ + +#ifndef WIN32 + QUrl url(QStringLiteral("http://%1:%2%3").arg(NGL::Connections::hostName(NGL::Connections::eConnection::FLM_THP_SERVER)).arg(NGL::Connections::port(NGL::Connections::eConnection::FLM_THP_SERVER)).arg(path)); +#else + NGL::Settings *s = new NGL::Settings(NGL::findProjectConfigFile()); + const QString hostname = s->getString(QStringLiteral("TabOC"), QStringLiteral("remoteServerHostname"), QStringLiteral("exctds01")); + QUrl url(QStringLiteral("http://%1:%2%3").arg(hostname).arg(NGL::Connections::port(NGL::Connections::eConnection::FLM_THP_SERVER)).arg(path)); + delete s; +#endif + url.setQuery(q); + + QNetworkRequest r; + if (!contentType.isEmpty()) + r.setHeader(QNetworkRequest::KnownHeaders::ContentTypeHeader, contentType); + r.setUrl(url); + + return std::move(r); +} + + +QNetworkReply *HttpProcess::post(const QString &path, QIODevice *data, const QUrlQuery &q, const QString &contentType) +{ + QNetworkReply *r = m_nam->post(forgeRequest(path, q, contentType), data); + doConnections(r); + return r; +} + + +QNetworkReply *HttpProcess::get(const QString &path, const QUrlQuery &q) +{ + QNetworkReply *r = m_nam->get(forgeRequest(path, q)); + doConnections(r); + return r; +} + + +QNetworkReply *HttpProcess::deleteResource(const QString &path, const QUrlQuery &q) +{ + QNetworkReply *r = m_nam->deleteResource(forgeRequest(path, q)); // hahah, because 'delete' is a reserved keyword in c++ + doConnections(r); + return r; +} + + +void HttpProcess::slotSuccess() +{ + DEBUG_LOG(m_logger) << "success"; + + stopTimeout(); + if (!m_isError && !m_wasCanceled && !m_isTimeout) + emit signalSuccess(); +} + + +void HttpProcess::slotError() +{ + DEBUG_LOG(m_logger) << "error"; + + stopTimeout(); + + if (!m_wasCanceled && !m_isTimeout && !m_isError /* could aready be set by readyRead - server error instead of network error */) + { + m_isError = true; + + QNetworkReply *r = qobject_cast(sender()); + if (r != nullptr) + { + ELOG << "network error: " << r->errorString(); + new LtsWidgets::LtsMessageDialogNew(qobject_cast(parent()), tr("Operation failed because of a network error")); + } + } + + emit signalError(); +} + + +void HttpProcess::slotReadyRead() +{ + DEBUG_LOG(m_logger) << "readyRead"; + resetTimeout(); + + QNetworkReply *r = qobject_cast(sender()); + if (r == nullptr) + return; + + r->startTransaction(); + + QByteArray data(r->readAll()); + + if (r->attribute(QNetworkRequest::HttpStatusCodeAttribute) == 200) + { + r->rollbackTransaction(); + emit signalReadyRead(); + return; + } + + // error at this point + m_isError = true; + stopTimeout(); + r->commitTransaction(); + + ELOG << "server error: data = '" << data << "' http status: " << r->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + + QJsonParseError err; + QJsonDocument doc(QJsonDocument::fromJson(data, &err)); + + if (err.error != QJsonParseError::NoError) + { + ELOG << "didn't receive a valid json from server at " << err.offset << ": " << err.errorString() << " - message was: '" << data << "'"; + return; + } + + QString errorMsg(doc.object()[QStringLiteral("error")].toString()); + + if (errorMsg.isEmpty()) + ELOG << "server sent empty error"; + else + ELOG << "server sent error: " << errorMsg; + + new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), tr("The server failed to process the operation")); +} + + +void HttpProcess::resetTimeout() +{ + if (m_timeout->isActive()) + m_timeout->start(); // restart +} + + +void HttpProcess::stopTimeout() +{ + m_timeout->stop(); +} + + + +// UploadProcess +UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformation &&esi, QObject *parent) + : HttpProcess(std::move(esi), parent) + , m_tempFile(new QTemporaryFile(this)) + , m_compress(new NGL::Compress(this)) + , m_rootDir(rootFolder) +{ + // No error & done here - as not a request, but only nglcompress + + m_process->setStatus(tr("Preparing Script upload ...")); + // TODO maybe: setUploadState(m_uploadRowId, ThpUploadActive, 0, 0); + + connect(m_compress, &NGL::Compress::compressInfoEx, + this, [this](qint64 totalFiles, qint64 curFile, qint64 totalSize, qint64 curPos, const QString &curName, qint64 ) + { + resetTimeout(); + m_process->setStatus(tr("Compressing files ..."), totalFiles, curFile, totalSize, curPos, curName); + +// LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(QStringLiteral( // wow +// "Compressing files ..." +// "
" +// "" +// " " +// " " +// " " + +// " " +// " " +// " " + +// " " +// " " +// " " + +// " " +// " " +// " " +// "
Filename %1" +// "
Bytes %2 / %3 (%4 %)" +// "
Files %5 / %6 (%7 %)" +// "
Progress %8 %" +// "
").arg(curName, // file name +// l.toString(curPos), l.toString(totalSize), QString::number(progressBytes), // bytes +// l.toString(curFile), l.toString(totalFiles), QString::number(progressFiles), // files +// QString::number(progressTotal) // progress +// ) +// ); + }); + + connect(m_compress, &NGL::Compress::error, // finished is ALWAYS called by nglcompress! delete on finished! + this, [this](const QString &errStr) + { + stopTimeout(); + new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), tr("Error during compression of script directory: %1").arg(errStr)); + + abortCompress(); + }); + + connect(this, &UploadProcess::signalTimeout, + this, [this]() + { + abortCompress(); + }); + + connect(this, &UploadProcess::signalCancel, + this, [this]() + { + abortCompress(); + }); + + + if (!m_tempFile->open()) + { + stopTimeout(); + QString msg(tr("Cannot open temporary file: %1").arg(m_tempFile->errorString())); + ELOG << msg << " (" << m_tempFile->fileName() << ")"; + new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), msg); + deleteLater(); + return; + } + + + QString dstDir(QString::number(m_esi.scriptId)); // this is the destination directory where bzip2 is going to extract it to (that is, when the user later downloads the thp on his machine) - this can be a relative path! + QString srcDir(QStringLiteral("%1/%2").arg(ExportedScriptsDialog::getContentFolder(m_rootDir, m_esi.exerciseId), dstDir)); + + +// puts a big file into the to-be-compressed directory to beef things up a little (test timeouts, big file transport handling) + + DEBUG_LOG(m_logger) << "TPM.TestBigFile? " << LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")).toString(); + DEBUG_LOG(m_logger) << "TPM.TestBigFile check? " + << (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")) == QVariant(true)); + +#ifndef LTS_DEBUG + if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")) == QVariant(true)) +#endif + { + DEBUG_LOG(m_logger) << "TPM.TestBigFile!!"; + + if (QGuiApplication::queryKeyboardModifiers() == Qt::ControlModifier) + { + QFile test(QStringLiteral("%1/%2/big.file").arg(ExportedScriptsDialog::getContentFolder(m_rootDir, m_esi.exerciseId), dstDir)); + DEBUG_LOG(m_logger) << ">>> BIG FILE ACTIVE ("<hasDebugFlag(bigFileSize)) // in KB + { + bool k = false; + int _times = LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(bigFileSize).toInt(&k); + + if (!k) + DEBUG_LOG(m_logger) << "Invalid value for " << bigFileSize; + else + { + times = _times; + DEBUG_LOG(m_logger) << "big file size was set to " << times; + } + } + else + DEBUG_LOG(m_logger) << "TPM.TestBigFile.Size not set - using default of " << times; + + + for (int i = 0; i < times; i++) + { + rng.waitForReadyRead(10000); // forced entropy + test.write(rng.read(1024)); + } + + test.flush(); + + m_tempFile->setAutoRemove(false); + DEBUG_LOG(m_logger) << "big compressed file: " << m_tempFile->fileName(); + } + } + + + connect(m_compress, &NGL::Compress::finished, + this, &UploadProcess::compressionDone); // => + + DEBUG_LOG(m_logger) << "compress called..."; + m_compress->compress(m_tempFile, srcDir, dstDir); + DEBUG_LOG(m_logger) << "...!"; +} + + +void UploadProcess::abortCompress() +{ + m_process->setCancelEnabled(false); + m_compress->abort(); + connect(m_compress, &NGL::Compress::finished, + this, &QObject::deleteLater); +} + + +void UploadProcess::compressionDone() +{ + DEBUG_LOG(m_logger) << "m_wasCanceled = " << m_wasCanceled << ", compress success = " << m_compress->success(); + stopTimeout(); + + if (!m_compress->success() || m_wasCanceled) // no isError, because no request made yet, only nglcompress + { + DEBUG_LOG(m_logger) << "compression aborted"; + deleteLater(); + return; + } + + DEBUG_LOG(m_logger) << "okay"; + + QUrlQuery q; + q.addQueryItem(QStringLiteral("exerciseId"), QString::number(m_esi.exerciseId)); + q.addQueryItem(QStringLiteral("scriptId"), QString::number(m_esi.scriptId)); + q.addQueryItem(QStringLiteral("exerciseName"), m_esi.exerciseName); + q.addQueryItem(QStringLiteral("name"), m_esi.scriptName); + // { QStringLiteral("md5sumHex"), QString::number(m_esi.exerciseId) }, Not needed with TCP + HTTP + + DEBUG_LOG(m_logger) << "posting file of size " << m_tempFile->size(); + m_tempFile->seek(0); + + QNetworkReply *rep = post(QStringLiteral("/thp"), m_tempFile, q); + + connect(this, &HttpProcess::signalSuccess, // => + this, [this]() + { + DEBUG_LOG(m_logger) << "Uploaded script successfully"; + new LtsWidgets::LtsMessageDialogNew(qobject_cast(parent()), tr("Uploaded script successfully")); + deleteLater(); + }); + + + disconnect(this, &UploadProcess::signalCancel, + this, nullptr); + connect(this, &UploadProcess::signalCancel, + rep, &QNetworkReply::abort); + + + disconnect(this, &UploadProcess::signalTimeout, + this, nullptr); + connect(this, &UploadProcess::signalTimeout, + rep, &QNetworkReply::abort); + + + connect(this, &UploadProcess::signalError, + this, &UploadProcess::deleteLater); + + + connect(rep, &QNetworkReply::uploadProgress, + this, [this](qint64 bytesSent, qint64 bytesTotal) + { + //LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Uploading: %1/%2 bytes").arg(QLocale().toString(bytesSent)).arg(QLocale().toString(bytesTotal))); + m_process->setStatus(tr("Uploading ..."), 1, 1, bytesTotal, bytesSent); + }); +} + + + +// DownloadProcess +DownloadProcess::DownloadProcess(const QString &rootFolder, int modelRowId, ExportedScriptInformation &&esi, QObject *parent) + : HttpProcess(std::move(esi), parent) + , m_tempFile(new QTemporaryFile(this)) + , m_modelRowId(modelRowId) + , m_rootFolder(rootFolder) +{ + m_process->setStatus(tr("Preparing Script download ...")); + + if (!m_tempFile->open()) + { + stopTimeout(); + QString msg(tr("Cannot open temporary file: %1 - aborted").arg(m_tempFile->errorString())); + ELOG << msg << " (" << m_tempFile->fileName() << ")"; + new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), msg); + deleteLater(); + return; + } + + + QUrlQuery q; + q.addQueryItem(QStringLiteral("exerciseId"), QString::number(m_esi.exerciseId)); + q.addQueryItem(QStringLiteral("scriptId"), QString::number(m_esi.scriptId)); + + QNetworkReply *rep = get(QStringLiteral("/thp"), q); + + + connect(this, &HttpProcess::signalReadyRead, + this, [this, rep]() + { + m_tempFile->write(rep->readAll()); + }); + + + connect(rep, &QNetworkReply::downloadProgress, + this, [this](qint64 bytesSent, qint64 bytesTotal) + { + m_process->setStatus(tr("Downloading ..."), 1, 1, bytesTotal, bytesSent); + //LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Downloading: %1/%2 bytes").arg(QLocale().toString(bytesSent)).arg(QLocale().toString(bytesTotal))); + }); + + + connect(this, &DownloadProcess::signalCancel, + rep, &QNetworkReply::abort); + + + connect(this, &DownloadProcess::signalTimeout, + rep, &QNetworkReply::abort); + + + connect(this, &DownloadProcess::signalError, + this, &DownloadProcess::deleteLater); + + + connect(this, &DownloadProcess::signalSuccess, + this, &DownloadProcess::downloadFinished); // => +} + + +void DownloadProcess::downloadFinished() +{ + m_process->setStatus(tr("Preparing Script decompression ...")); + m_compress = new NGL::Compress(this); + + + connect(m_compress, &NGL::Compress::uncompressInfo, + this, [this](qint64 size, qint64 pos, const QString &file) + { + resetTimeout(); + m_process->setStatus(tr("Decompressing ..."), 1, 1, size, pos, file); + //LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Decompressing file '%3': %1/%2").arg(QLocale().toString(pos)).arg(QLocale().toString(size)).arg(file)); + }); + + + connect(m_compress, &NGL::Compress::error, // finished is ALWAYS called by nglcompress! delete on finished + this, [this](const QString &errStr) + { + stopTimeout(); + new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), tr("Error during decompression of script directory: %1").arg(errStr)); + + // abort first, wait until cancelation point is reached, wait until last reads/write were written, then delete process + m_compress->abort(); + connect(m_compress, &NGL::Compress::finished, + this, &QObject::deleteLater); + }); + + + disconnect(this, &DownloadProcess::signalTimeout, + nullptr, nullptr); // disconnect the signalTimeout signal from rep... + connect(this, &DownloadProcess::signalTimeout, + this, [this]() + { + // abort first, wait until cancelation point is reached, wait until last reads/write were written, then delete process + m_compress->abort(); + connect(m_compress, &NGL::Compress::finished, + this, &QObject::deleteLater); + }); + + + + disconnect(this, &DownloadProcess::signalCancel, + nullptr, nullptr); // disconnect the signalCancel signal from rep... + connect(this, &DownloadProcess::signalCancel, + this, [this]() + { + // abort first, wait until cancelation point is reached, wait until last reads/write were written, then delete process + m_compress->abort(); + connect(m_compress, &NGL::Compress::finished, + this, &QObject::deleteLater); + }); + + + connect(m_compress, &NGL::Compress::finished, + this, [this] + { + stopTimeout(); + + DEBUG_LOG(m_logger) << "m_compress->success()? " << m_compress->success() << ", m_wasCanceled? " << m_wasCanceled << ", m_isError? " << m_isError; + if (m_compress->success() && !m_wasCanceled && !m_isError) + { + new LtsWidgets::LtsMessageDialogNew(qobject_cast(parent()), tr("Downloaded script successfully")); + emit signalDone(); // => + } + + deleteLater(); + }); + + + m_tempFile->seek(0); + m_compress->uncompress(m_tempFile, ExportedScriptsDialog::getContentFolder(m_rootFolder, m_esi.exerciseId)); +} + + + +// RemoveProcess +RemoveProcess::RemoveProcess(int modelRowId, ExportedScriptInformation &&esi, QObject *parent) + : HttpProcess(std::move(esi), parent) + , m_modelRowId(modelRowId) +{ + m_process->setStatus(tr("Requesting Script deletion on server ...")); + + QUrlQuery q; + q.addQueryItem(QStringLiteral("exerciseId"), QString::number(m_esi.exerciseId)); + q.addQueryItem(QStringLiteral("scriptId"), QString::number(m_esi.scriptId)); + + QNetworkReply *rep = deleteResource(QStringLiteral("/thp"), q); + + + connect(this, &RemoveProcess::signalTimeout, + rep, &QNetworkReply::abort); + + + connect(this, &RemoveProcess::signalCancel, + rep, &QNetworkReply::abort); + + + connect(this, &RemoveProcess::signalError, + this, &RemoveProcess::deleteLater); + + + connect(this, &HttpProcess::signalSuccess, + this, [this]() + { + new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), tr("Script was removed from server successfully")); + deleteLater(); + }); +} + + + +// ExportedScriptsDialog +ExportedScriptsDialog::ExportedScriptsDialog(QWidget *parent) + : LtsWidgets::LtsDialog(parent) + , m_model(new ExportedScriptsModel(this)) + , m_ui(new Ui::ExportedScriptsDialog) + , m_session(nullptr) + , m_fsWatcher(new QFileSystemWatcher(this)) + , m_logger(getLogger("ExportedScriptsDialog")) +{ + m_ui->setupUi(this); + + m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &ExportedScriptsDialog::removeScriptLocal); + + m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false); // Show presentation Button + m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); // local remove Button + m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(false); // download from Server + m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(false); // Remove from Server Button + + connect(m_ui->ltsDataView, &LtsDataView::LtsDataView::signalSelectionChanged, this, &ExportedScriptsDialog::onSelectionChanged); + + connect(m_fsWatcher, &QFileSystemWatcher::directoryChanged, + this, &ExportedScriptsDialog::initModel); + connect(m_fsWatcher, &QFileSystemWatcher::fileChanged, + this, &ExportedScriptsDialog::initModel); + + + setOnlineHelpFilename(QStringLiteral("Script_Editor-Export_Script_Administration")); +} + + +ExportedScriptsDialog::~ExportedScriptsDialog() +{ + delete m_ui; +} + + +void ExportedScriptsDialog::onSelectionChanged() +{ + const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); + + if (mil.size() != 1) + { + m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false); // Show presentation Button + m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); // local remove Button + m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(false); // download from Server + m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(false); // Remove from Server Button + return; + } + + const ExportedScriptInformation esi = m_model->getRowData(mil.first().row()); + if (m_session->app() != LtsAppDescriptor::App::OC) + { + if (esi.local) + { + m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(true); // local remove Button + m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(true); // upload to Server + } + else + { + m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); // local remove Button + m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(false); // upload to Server + } + if (esi.uploaded == ThpAlreadyUploaded) + { + m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(true); // Remove from Server Button + } + else + { + m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(false); // Remove from Server Button + } + } + else // OC + { + if (esi.uploaded == ThpAlreadyUploaded) + { + m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(true); // download from Server + m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(true); // Remove from Server Button + } + else + { + m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(false); // Remove from Server Button + } + if (esi.local) + { + m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(true); // Show presentation Button + m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(true); // local remove Button + } + else + { + m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false); // Show presentation Button + m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); // local remove Button + } + } +} + + +void ExportedScriptsDialog::retranslate() +{ + translate(m_ui, tr("Manage exported scripts")); + m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setText(tr("Remove local")); + + Q_ASSERT(m_session != nullptr); + + if (m_session->app() != LtsAppDescriptor::App::OC) + { + m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setText(tr("Upload to Server")); + m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setText(tr("Remove from Server")); + } + else + { + m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setText(tr("Download from Server")); + } + + setWsConnectionStatusLabel(); +} + + +void ExportedScriptsDialog::setWsConnectionStatus(WsConnectionStatus status) +{ + m_wsStatus = status; + setWsConnectionStatusLabel(); +} + + +void ExportedScriptsDialog::setWsConnectionStatusLabel() +{ + QString str; + QColor color; + + switch (m_wsStatus) + { + case WsConnectionStatus::NotConnected: + { + str = tr("Not connected"); + color = QColor::fromRgb(100, 100, 100); + break; + } + + case WsConnectionStatus::Disconnected: + { + str = tr("Disconnected"); + color = QColor::fromRgb(100, 100, 100); + break; + } + + case WsConnectionStatus::Error: + { + str = tr("Connection error"); + color = QColor::fromRgb(200, 55, 0); + break; + } + + case WsConnectionStatus::Connecting: + { + str = tr("Connecting ..."); + color = QColor::fromRgb(100, 100, 0); + break; + } + + case WsConnectionStatus::Connected: + { + str = tr("Connected"); + color = QColor::fromRgb(50, 200, 50); + break; + } + } + + m_ui->lblWsStatus->setText(QStringLiteral("%1").arg(str, color.name())); +} + + +bool ExportedScriptsDialog::init(LtsSession::LtsSession *session) +{ + m_session = session; + m_exerciseId = m_session->exerciseId(); + + m_fsWatcher->addPath(getRootFolder()); + m_fsWatcher->addPath(getContentFolder(m_session->exerciseId())); + + if (m_session->app() != LtsAppDescriptor::App::OC) + { + m_buttonBox->connectButton(LtsWidgets::DialogButton::Save, this, &ExportedScriptsDialog::uploadScript); // upload to Server + m_buttonBox->connectButton(LtsWidgets::DialogButton::Import, this, &ExportedScriptsDialog::removeScriptFromServer); + } + else + { + m_buttonBox->connectButton(LtsWidgets::DialogButton::Save, this, &ExportedScriptsDialog::downloadScript); // download from Server + m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &ExportedScriptsDialog::openScript); + } + + + if (!QDir().mkpath(getContentFolder(m_exerciseId))) + { + QString msg(tr("Cannot create script folder at %1").arg(getContentFolder(m_exerciseId))); + ERROR_LOG(m_logger) << msg; + return false; + } + + + //LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(); + QWebSocket *sock = new QWebSocket(); + sock->setParent(this); + + auto openFn = [this, sock]() + { + setWsConnectionStatus(WsConnectionStatus::Connecting); +#ifndef WIN32 + sock->open(QUrl(QStringLiteral("ws://%1:%2/thp").arg(NGL::Connections::hostName(NGL::Connections::eConnection::FLM_THP_SERVER)).arg(NGL::Connections::port(NGL::Connections::eConnection::FLM_THP_SERVER)))); +#else + NGL::Settings *s = new NGL::Settings(NGL::findProjectConfigFile()); + const QString hostname = s->getString(QStringLiteral("TabOC"), QStringLiteral("remoteServerHostname"), QStringLiteral("exctds01")); + WARNING_LOG(m_logger) << "Hostname used for THP: " << hostname; + sock->open(QUrl(QStringLiteral("ws://%1:%2/thp").arg(hostname).arg(NGL::Connections::port(NGL::Connections::eConnection::FLM_THP_SERVER)))); + delete s; +#endif + }; + + openFn(); + + + connect(sock, &QWebSocket::connected, + this, [this]() + { + setWsConnectionStatus(WsConnectionStatus::Connected); + //LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); + }); + + + connect(sock, QOverload::of(&QWebSocket::error), + this, [this, sock]() + { + setWsConnectionStatus(WsConnectionStatus::Error); + ELOG << "ws error: " << sock->errorString(); + //LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); + }, Qt::QueuedConnection /* prevent crash */); + + + connect(sock, &QWebSocket::disconnected, + this, [this, sock, openFn]() + { + WARNING_LOG(m_logger) << "disconnected from ws... reconnecting in 3..."; + setWsConnectionStatus(WsConnectionStatus::Disconnected); + + QTimer *t = new QTimer(sock); + t->setInterval(3000); + t->setSingleShot(true); + + connect(t, &QTimer::timeout, + sock, [this, t, sock, openFn]() + { + openFn(); + t->deleteLater(); + }); + + t->start(); + }, Qt::QueuedConnection /* prevent crash */); + + + connect(sock, &QWebSocket::textMessageReceived, + this, [this](const QString &msg) + { + DEBUG_LOG(m_logger) << "new msg: '" << msg << "'"; + m_lastServerContent = msg; + m_model->setServerContent(msg); + onSelectionChanged(); // aka. enaDisa + }); + + + return initModel(); +} + + +bool ExportedScriptsDialog::initModel() +{ + DEBUG_LOG(m_logger) << "(re)initModel !!"; + + QString rootDirectory(getRootFolder()); + + if (!m_model->init(rootDirectory))//, getContentFolder(m_exerciseId))) + return false; + + //create data.json if it doesn't exist + std::shared_ptr exmDtc; + std::shared_ptr asmDtc; + if (m_session->app() == LtsAppDescriptor::App::OC && + m_session->getDtc(asmDtc) && + m_session->getDtc(exmDtc)) + { + if (!m_model->createDataJson(rootDirectory, exmDtc, asmDtc, m_session->exerciseId())) + { + return false; + } + } + + + m_model->setOC(m_session->app() == LtsAppDescriptor::App::OC); // important to call *before* setting model + + + m_ui->ltsDataView->setModel(m_model); + if (m_session->app() == LtsAppDescriptor::App::OC) + m_ui->ltsDataView->hideColumn(ExportedScriptsModel::Columns::ColUploaded); + // MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW + // important to call *after* setting model +#ifndef LTS_DEBUG + m_ui->ltsDataView->hideColumn(ExportedScriptsModel::ColId); +#endif + + if (m_session->app() == LtsAppDescriptor::App::OC) + m_ui->ltsDataView->hideColumn(ExportedScriptsModel::ColCreated); + else + m_ui->ltsDataView->hideColumn(ExportedScriptsModel::ColDownloaded); + // MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW + + + m_model->setServerContent(m_lastServerContent); + + onSelectionChanged(); // aka. enaDisa + + return true; +} + + +void ExportedScriptsDialog::uploadScript() +{ + const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); + if (mil.size() != 1) + return; + ExportedScriptInformation esi = m_model->getRowData(mil.first().row()); + + auto up = new UploadProcess(getRootFolder(), std::move(esi), this); + setOverlay(up->process()); +} + + +void ExportedScriptsDialog::downloadScript() +{ + const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); + if (mil.size() != 1) + return; + const QModelIndex mi = mil.first(); + ExportedScriptInformation esi = m_model->getRowData(mi.row()); + + auto dp = new DownloadProcess(getRootFolder(), m_model->getId(mi), std::move(esi), this); + setOverlay(dp->process()); + + + connect(dp, &DownloadProcess::signalDone, + this, [this, dp]() + { + const QModelIndex mi = m_model->findIndexForId(dp->modelRowId()); + + if (!mi.isValid()) + { + ERROR_LOG(m_logger) << "could not update model data after download! cover up.."; + return; + } + + int row = mi.row(); + ExportedScriptInformation esi = m_model->getRowData(row); + + m_model->setRowData(row, esi); + m_model->setLocalState(row, true); // does rewrite data.json + m_model->init(getRootFolder()); + m_model->setServerContent(m_lastServerContent); + + onSelectionChanged(); // aka. enaDisa + }); +} + + +void ExportedScriptsDialog::removeScriptFromServer() +{ + const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); + if (mil.size() != 1) + return; + const QModelIndex mi(mil.first()); + ExportedScriptInformation esi = m_model->getRowData(mi.row()); + + RemoveProcess *rp = new RemoveProcess(m_model->getId(mi), std::move(esi), this); + setOverlay(rp->process()); + + + connect(rp, &RemoveProcess::signalDone, + this, [this, rp]() + { + const QModelIndex mi = m_model->findIndexForId(rp->modelRowId()); + + if (!mi.isValid()) + { + ERROR_LOG(m_logger) << "could not update model data after deletion! cover up.."; + return; + } + + int row = mi.row(); + ExportedScriptInformation esi = m_model->getRowData(row); + + if (!esi.local) + m_model->removeRow(mi.row()); + + onSelectionChanged(); // aka. enaDisa + }); +} // removefromServerScript + + +void ExportedScriptsDialog::removeScriptLocal() +{ + const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); + if (mil.size() != 1) + return; + const ExportedScriptInformation esi = m_model->getRowData(mil.first().row()); + + static QString removingScriptFailedText(tr("Removing script failed")); + const auto iRet = LtsWidgets::LtsMessageDialog::showMessage( + this, + tr("Do you really want to remove the exported script '%1' from the local harddisk?").arg(esi.scriptName), + tr("Remove exported script"), + LtsWidgets::Behaviour::Modal, + LtsWidgets::Button::Yes | LtsWidgets::Button::No); + if (iRet != LtsWidgets::Button::Yes) + return; + + m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(false); // upload to Server + m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); // local remove Button + m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false); + + QString currentDirectory = QStringLiteral("%1/%2").arg(getContentFolder(esi.exerciseId), QString::number(esi.scriptId)); + DEBUG_LOG(m_logger) << "currentDirectory=" << currentDirectory; + + QDir d(currentDirectory); + if (!d.removeRecursively()) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Cannot remove local directory '%1'").arg(currentDirectory), removingScriptFailedText); + return; + } + + // remove script from data.json of exercise by "scriptId" + QFile dataJson(QStringLiteral("%1/data.json").arg(getContentFolder(esi.exerciseId))); + if (!dataJson.open(QIODevice::ReadWrite)) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Cannot remove script from index: %1").arg(dataJson.errorString()), removingScriptFailedText); + return; + } + + QJsonParseError err; + QJsonObject root(QJsonDocument::fromJson(dataJson.readAll(), &err).object()); + if (root.isEmpty()) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Unknown error while reading root from index"), removingScriptFailedText); + return; + } + + if (err.error != QJsonParseError::NoError) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Cannot read index file"), removingScriptFailedText); + ERROR_LOG(m_logger) << "Cannot read index file at offset" << err.offset << ": " << err.errorString(); + return; + } + + QJsonValueRef presentationsRef(root[QStringLiteral("presentations")]); + if (!presentationsRef.isArray()) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Unknown error while reading presentations value from index"), removingScriptFailedText); + return; + } + + QJsonArray presentations(presentationsRef.toArray()); + if (presentations.isEmpty()) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Unknown error while reading presentations array from index"), removingScriptFailedText); + return; + } + + bool deleted = false; + for (auto it = presentations.begin(); it != presentations.end(); ++it) + { + QJsonObject pre((*it).toObject()); + + int scriptId = pre[QStringLiteral("scriptId")].toInt(-1); + + if (scriptId == -1) + { + WARNING_LOG(m_logger) << "cannot find scriptId in presentations array object from data.json"; + continue; + } + + if (scriptId == esi.scriptId) + { + presentations.erase(it); // iterator dead at this point - exit + deleted = true; + break; // exit + } + } + + if (!deleted) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("Cannot find script in index"), removingScriptFailedText); + return; + } + + presentationsRef = presentations; + + + // write altered json back to data.json + dataJson.seek(0); + dataJson.resize(0); + dataJson.write(QJsonDocument(root).toJson()); + dataJson.close(); + + + if (esi.uploadTime < 1) + m_model->removeRow(mil.first().row()); + else + m_model->setLocalState(mil.first().row(), false); +} + + +void ExportedScriptsDialog::openScript() +{ + const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); + if (mil.size() != 1) + return; + const ExportedScriptInformation esi = m_model->getRowData(mil.first().row()); + + const QString pathToScript = getContentFolder(esi.exerciseId) + QDir::separator() + QString::number(esi.id()) + QDir::separator(); + QStringList args; + args.append(QStringLiteral("-t")); + args.append(pathToScript); + + DEBUG_LOG(m_logger) << "pathToScript: " << pathToScript; + +#ifndef WIN32 + QProcess().startDetached(QLatin1String("./thp_viewer"), args, QCoreApplication::applicationDirPath()); +#else + QProcess().startDetached(QLatin1String("thp_viewer.exe"), args, qApp->applicationDirPath()); +#endif +} + + +QString ExportedScriptsDialog::getContentFolder(const QString &rootFolder, int exerciseId) +{ + return rootFolder + QStringLiteral("Exercise_%1").arg(exerciseId); +} + + +QString ExportedScriptsDialog::getContentFolder(int exerciseId) const +{ + return getContentFolder(getRootFolder(), exerciseId); +} + + +QString ExportedScriptsDialog::getRootFolder() const +{ + if (m_session->app() == LtsAppDescriptor::App::OC) + return QDir::tempPath() + QStringLiteral("/THP-Download/"); + + return QDir::tempPath() + QStringLiteral("/THP-Export/"); +} + +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.h new file mode 100755 index 000000000..593e6615b --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.h @@ -0,0 +1,214 @@ +/** + * @RDE_HEADER@ + * Show the exported scripts and allow them to upload them to the server + * $Id: tpm_exported_scripts_dialog.h 51804 2020-07-31 04:47:28Z fritsche_h $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/tpm_exported_scripts_dialog.h $ + * $Author: fritsche_h $ + * + * Created by Gerlinde Rudolphus, NLE, 2019-03-25 + * Rebuilt to use httq by Mike Wille, NLE, 2020-07-07 + */ +#pragma once + + +#include "logger.h" + +#include +#include + +#include + + +namespace Ui +{ +class ExportedScriptsDialog; +} +namespace NGL +{ +class Compress; +} +namespace LtsSession +{ +class LtsSession; +} + +class QTemporaryFile; +class QNetworkAccessManager; +class QNetworkReply; +class QNetworkRequest; +class QFileSystemWatcher; + + +namespace TakeHomePackageManager +{ +class ProcessOverlay; + +class HttpProcess : public QObject +{ + Q_OBJECT + +public: + HttpProcess(ExportedScriptInformation &&esi, QObject *parent); + virtual ~HttpProcess(); + + ProcessOverlay *process() const { return m_process; } + + +signals: + void signalReadyRead(); + //void signalFailed(int status, const QString &msg); + void signalSuccess(); + void signalTimeout(); + void signalCancel(); + void signalError(); + + +private slots: + void slotReadyRead(); + void slotError(); + void slotSuccess(); + + +protected slots: + void stopTimeout(); + void resetTimeout(); + + +private: + void doConnections(QNetworkReply *r); + + +protected: + // do not connect to QNetworkReply's readyRead, connect to this classe's signalReadyRead + QNetworkReply *post(const QString &path, QIODevice *data, const QUrlQuery &q = QUrlQuery(), const QString &contentType = QStringLiteral("application/octet-stream")); + QNetworkReply *get(const QString &path, const QUrlQuery &q = QUrlQuery()); + QNetworkReply *deleteResource(const QString &path, const QUrlQuery &q = QUrlQuery()); + + ExportedScriptInformation m_esi; + bool m_isError { false }; + NGL::INGLLogger &m_logger; + ProcessOverlay *m_process; + bool m_wasCanceled { false }; + bool m_isTimeout { false }; + + +private: + static QNetworkRequest forgeRequest(const QString &path, const QUrlQuery &q, const QString &contentType = QString()); + + QNetworkAccessManager *m_nam; + QTimer *m_timeout; +}; + + + +class UploadProcess : public HttpProcess +{ + Q_OBJECT + +public: + UploadProcess(const QString &rootFolder, ExportedScriptInformation &&esi, QObject *parent); + +signals: + //void signalDone(); + +private slots: + void compressionDone(); + +private: + void abortCompress(); + + QTemporaryFile *m_tempFile; + NGL::Compress *m_compress; + QString m_rootDir; +}; + + + +class DownloadProcess : public HttpProcess +{ + Q_OBJECT + +public: + DownloadProcess(const QString &rootFolder, int modelRowId, ExportedScriptInformation &&esi, QObject *parent); + + int modelRowId() const { return m_modelRowId; } + +private slots: + void downloadFinished(); + +signals: + void signalDone(); + +private: + QTemporaryFile *m_tempFile; + NGL::Compress *m_compress { nullptr }; + int m_modelRowId { -1 }; + QString m_rootFolder; +}; + + + +class RemoveProcess : public HttpProcess +{ + Q_OBJECT + +public: + RemoveProcess(int modelRowId, ExportedScriptInformation &&esi, QObject *parent); + int modelRowId() const { return m_modelRowId; } + +signals: + void signalDone(); + +private: + int m_modelRowId { -1 }; +}; + + + +class ExportedScriptsDialog : public LtsWidgets::LtsDialog +{ + Q_OBJECT +public: + explicit ExportedScriptsDialog(QWidget *parent = nullptr); + ~ExportedScriptsDialog(); + + void retranslate() override; + bool init(LtsSession::LtsSession *session); + static QString getContentFolder(const QString &rootFolder, int exerciseId); + +private slots: + void uploadScript(); + void downloadScript(); + void removeScriptFromServer(); + void removeScriptLocal(); + void openScript(); + void onSelectionChanged(); + +private: + enum class WsConnectionStatus + { + NotConnected, + Connecting, + Disconnected, + Error, + Connected, + }; + + void startUpload(); + QString getContentFolder(int exerciseId) const; + QString getRootFolder() const; + bool initModel(); + void setWsConnectionStatus(WsConnectionStatus status); + void setWsConnectionStatusLabel(); + +private: + ExportedScriptsModel *m_model; + Ui::ExportedScriptsDialog *m_ui; + LtsSession::LtsSession *m_session; + int m_exerciseId; + QFileSystemWatcher *m_fsWatcher; + QString m_lastServerContent; + WsConnectionStatus m_wsStatus { WsConnectionStatus::NotConnected }; + NGL::INGLLogger &m_logger; +}; +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.ui new file mode 100755 index 000000000..550e24ddf --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.ui @@ -0,0 +1,77 @@ + + + ExportedScriptsDialog + + + + 0 + 0 + 834 + 491 + + + + Form + + + + + + The following Scripts are already exported. You can remove them from your local hard disk or upload them to the server here. + + + + + + + + + Server connection status: + + + + + + + - + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + false + + + false + + + + + + + + LtsDataView::LtsDataView + QWidget +
LtsDataView/lts_data_view.h
+ 1 +
+
+ + +
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.cpp new file mode 100755 index 000000000..3d069a630 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.cpp @@ -0,0 +1,60 @@ +/** + * @RDE_HEADER@ + * GUI Plugin for ExerciseManangement + * $Id: tpm_gui_plugin.cpp 48572 2019-10-02 11:47:04Z rudolphus_g $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/tpm_gui_plugin.cpp $ + * $Author: rudolphus_g $ + * Created by Christian Ehrlicher, SLSE, 2016-02-29 + */ + +#include "tpm_gui_plugin.h" +#include "tpm_exported_scripts_dialog.h" +#include "logger.h" + +namespace TakeHomePackageManager +{ +std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) +{ + return std::make_shared(session); +} + + +InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) + : GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Tpm")) +{} + + +bool InterfaceImpl::fetchInterfaces() +{ + return true; +} + + +QString InterfaceImpl::menuGroup() const +{ + return tr("Presentation"); +} + +QVector InterfaceImpl::getActions() +{ + QVector ret; + LtsWidgets::PluginData plData; + plData.menuGroup = menuGroup(); + if (m_session->app() == LtsAppDescriptor::App::Scripts) + plData.exercisePart = LtsWidgets::ExercisePart::eSpecial; + else + plData.exercisePart = LtsWidgets::ExercisePart::eAfterAction; + plData.identifier = QLatin1String("PresentationManagement.ScriptDialog.ManageExportedScripts"); + plData.menuIcon = QIcon(QLatin1String("icon:export_documents.svg")); + plData.menuText = tr("Manage Exported Scripts"); + // plData.operatorRight = OperatorRights::ScriptEditorEdit; + plData.createWidgetFunc = [this](QWidget *) + { + return LtsWidgets::initDialog(new ExportedScriptsDialog(), m_session); + }; + ret.append(plData); + + return ret; +} + +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.h new file mode 100755 index 000000000..269377bc7 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.h @@ -0,0 +1,51 @@ +/** + * @RDE_HEADER@ + * Gui Plugin for MarkerManagement + * $Id: tpm_gui_plugin.h 49807 2020-02-06 09:53:16Z ehrlicher $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/tpm_gui_plugin.h $ + * $Author: ehrlicher $ + * Created by Christian Ehrlicher, SLSE, 2016-02-29 + */ + +#pragma once +#include + +#include "logger.h" +#include +#include + +namespace TakeHomePackageManager +{ +class GuiPlugin final : public QObject, public GuiPluginBase::Plugin +{ + Q_PLUGIN_METADATA(IID "gui:3:tpm.man") + Q_INTERFACES(GuiPluginBase::Plugin) + + Q_OBJECT +public: + GuiPlugin() = default; + ~GuiPlugin() = default; + + QString pluginName() override { return QLatin1String("TakeHomePackageManager"); } + std::shared_ptr createGuiInterface(LtsSession::LtsSession *session) override; + bool availableInPartition(IDL::PartitionType partition) const override + { + return partition == IDL::PartitionType::Exercise; + } +}; + +class InterfaceImpl final : public QObject, public GuiPluginBase::Interface, public ForeignTpmGuiInterface +{ + Q_OBJECT +public: + explicit InterfaceImpl(LtsSession::LtsSession *session); + + bool fetchInterfaces() override; + QString menuGroup() const override; + QVector getActions() override; + bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise; } +private: + +}; + +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/CMakeLists.txt new file mode 100755 index 000000000..68fae2722 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/CMakeLists.txt @@ -0,0 +1,44 @@ +# +# $Id: CMakeLists.txt 51804 2020-07-31 04:47:28Z fritsche_h $ +# $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/CMakeLists.txt $ +# $Author: fritsche_h $ +# +# Created by Mike Wille, SLTE, 2020-03-23 +# + +SET(src + tpm_usb_gui_plugin.cpp + tpm_usb_gui_plugin.h + tpm_usb_dialog.cpp + tpm_usb_dialog.h + logger.cpp + logger.h +) + +QT5_WRAP_UI(src + tpm_usb_dialog.ui +) + +NGL_ADD_LIBRARY2(WS ThpUsbManagementGuiPlugin MODULE ${src}) +NGL_TARGET_LINK_LIBRARIES(ThpUsbManagementGuiPlugin + ThpCommon + TpmGuiPluginInterface + Qt6::Widgets + Qt6::Network + Qt6::WebSockets + NGLLogger + LtsWidgets + LtsSession + LtsDataView + nglcompression + nglsettings + ngltools + LtsSessionData + + # for creating data.json + AsmDataPluginInterface + ExmDataPluginInterface +) + +NGL_INSTALL_TARGET(ThpUsbManagementGuiPlugin) + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.cpp new file mode 100755 index 000000000..747a28115 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.cpp @@ -0,0 +1,37 @@ +/** + * @RDE_HEADER@ + * Building Config - logging facility + * $Id: logger.cpp 46225 2019-03-25 13:59:56Z rudolphus_g $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/logger.cpp $ + * $Author: rudolphus_g $ + */ + +#include "logger.h" + +#include + +namespace TakeHomePackageManager +{ + +LOGGER_T getLogger(const char *name) +{ + static const char ns[] = "TPM.USB."; + std::string loggerName; + const size_t len = strlen(name); + loggerName.reserve(sizeof(ns) + len); + loggerName.append(ns, sizeof(ns) - 1); + loggerName.append(name, len); + + try + { + return NGL::NGLLoggerBootstrap::getNGLRootLogger(). + getNGLLogger(loggerName); + } + catch (const std::exception &ex) + { + fprintf(stderr, "Error retrieving logger: %s", ex.what()); + abort(); + } +} + +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.h new file mode 100755 index 000000000..d2c571f29 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.h @@ -0,0 +1,22 @@ +/** + * @RDE_HEADER@ + * Logging for CentralEffectSimulation + * $Id: logger.h 46225 2019-03-25 13:59:56Z rudolphus_g $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/logger.h $ + * $Author: rudolphus_g $ + */ + +#pragma once + +#include + +namespace TakeHomePackageManager +{ +typedef NGL::INGLLogger &LOGGER_T; + +LOGGER_T getLogger(const char *name); +inline LOGGER_T getLogger(const QString &loggerName) +{ + return getLogger(loggerName.toUtf8().constData()); +} +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.cpp new file mode 100755 index 000000000..9b9199414 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.cpp @@ -0,0 +1,1699 @@ +/** + * @RDE_HEADER@ + * Show the exported scripts and allow them to upload them to the server + * $Id: tpm_exported_scripts_dialog.cpp 53111 2021-03-22 08:21:29Z wille_m $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/tpm_exported_scripts_dialog.cpp $ + * $Author: wille_m $ + * + * Created by Gerlinde Rudolphus, NLE, 2019-03-25 + * Rebuilt to use httq by Mike Wille, NLE, 2020-07-07 + */ + +/* TODO: FIXME: sme problem here! + * adjust data.json when uploading file, as data.json contains ALL + * scripts, but we only upload ONE script at a time - so remove all scripts but + * the one to be uploaded from data.json (but don't touch the main data.json!!) + */ + +/* + * + * TODO: + * index.html that searches all exercises instead of stuff + * copy everything in exercise folder for now until above is done + * copy situation_map init into share folder + * + */ + +#include "ui_tpm_usb_dialog.h" +#include "tpm_usb_dialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef Q_OS_UNIX +#include +#endif + +#include + +#ifdef Q_OS_UNIX +#define _compiler_warning(x) _Pragma(#x) +#define compiler_warning(x) _compiler_warning(GCC warning x) +#define TMP_WARNING_LOG(x) compiler_warning("Temporary warning log active!") \ + WARNING_LOG(x) +#else +#define compiler_warning(x) +#define TMP_WARNING_LOG(x) WARNING_LOG(x) +#endif + +#ifndef ELOG +#define ELOG ERROR_LOG(m_logger) // polyfill +#endif + + +namespace TakeHomePackageManager +{ + +// TODO: mv to LtsCommon +class AsyncFileCopy : public QObject +{ + Q_OBJECT + +public: + static const int s_chunkSize = 1 * 1024 * 1024; + + static AsyncFileCopy *createAsyncFileCopy(const QDir &src, const QDir &dst, const QFileInfoList &fil = {}, bool cdUp = true) // to prevent the user from thinking having to delete the class (which it does itself) + { + return new AsyncFileCopy(src, dst, fil, cdUp); + } + + ~AsyncFileCopy() = default; + +private: + AsyncFileCopy(const QDir &src, const QDir &dst, const QFileInfoList &fil, bool cdUp) + + { + QFutureWatcher *fw = new QFutureWatcher(this); + connect(fw, &QFutureWatcher::finished, + this, [this, fw]() + { + emit finished(fw->result()); + }); + connect(fw, &QFutureWatcher::finished, + this, &QObject::deleteLater); // self-deleting + fw->setFuture(QtConcurrent::run(this, &AsyncFileCopy::copy, src, dst, fil, cdUp)); + } + +private: +#define cancelationPoint if (m_wasCanceled) { qWarning() << "canceled"; return false; } (void)m_wasCanceled + + bool copy(const QDir &src, const QDir &dst, const QFileInfoList &fil, bool cdUp) + { + qint64 totalAll = 0, writtenAll = 0; + int fileCount = 0; + + //TODO + { + QDirIterator it(src.absolutePath(), QDir::Files | QDir::NoDotAndDotDot, + QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); + while (it.hasNext()) + { + const QFileInfo fi(it.next()); + + //qWarning() << "size fi 1" << fi; + + // copy only files in fil (only if fil is not optional aka. empty) + + // operator== doesn't work as intended, so no fil.contains(fi) :( + + if (!fil.isEmpty()) + { + auto it = std::find_if(fil.constBegin(), fil.constEnd(), [fi](const QFileInfo &_fi) + { + // qWarning() << "does" << fi.absoluteFilePath() << "and" << _fi.absoluteFilePath() << "match?"; + return (fi.absoluteFilePath() == _fi.absoluteFilePath()); + }); + + if (it == fil.constEnd()) + continue; + } + + //qWarning() << "size fi 2" << fi; + + totalAll += fi.size(); + fileCount++; + } + } + + //qWarning() << "fileList size" << fileList.size() << fileList; + //qWarning() << "src for it" << src; + + int currentFile = 0; + QDirIterator it(src.absolutePath(), QDir::Files | QDir::NoDotAndDotDot, + QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); + while (it.hasNext()) + { + cancelationPoint; + + const QFileInfo fi(it.next()); + + + + //qWarning() << "copy fi 1" << fi; + + // copy only files in fil (only if fil is not optional aka. empty) + + // operator== doesn't work as intended, so no fil.contains(fi) :( + + if (!fil.isEmpty()) + { + auto it = std::find_if(fil.constBegin(), fil.constEnd(), [fi](const QFileInfo &_fi) + { + return (fi.absoluteFilePath() == _fi.absoluteFilePath()); + }); + + if (it == fil.constEnd()) + continue; + } + + //qWarning() << "copy fi 2" << fi; + + + + currentFile++; + qint64 totalFile = fi.size(), writtenFile = 0; + + QDir x(src); + if (cdUp) + x.cdUp(); + + QString srcFilePath(fi.absolutePath()); + QString dstFilePath(dst.absolutePath() + QDir::separator() + srcFilePath.remove(x.absolutePath())); + + if (!QDir().mkpath(dstFilePath) /* why is this not static, Qt? Directory validation? */) + { + qWarning() << "cannot create path"; + return false; + } + + QFile srcFile(fi.absoluteFilePath()); + QFile dstFile(dstFilePath + QDir::separator() + fi.fileName()); + + // qWarning() << "fi" << fi.absolutePath() + // << "src" << src.absolutePath() + // << "x" << x.absolutePath() + // << "srcFilePath" << srcFilePath + // << "dstFilePath" << dstFilePath + // << "srcFile" << fi.absoluteFilePath() + // << "dstFile" << dstFilePath + QDir::separator() + fi.fileName() + // ; + + if (!srcFile.open(QIODevice::ReadOnly)) + { + qWarning() << QStringLiteral("failed to open src '%1' (error: %2)").arg(srcFile.fileName(), srcFile.errorString()); + continue; + } + + if (!dstFile.open(QIODevice::ReadWrite | QIODevice::Truncate)) + { + qWarning() << QStringLiteral("failed to open dst '%1' (error: %2)").arg(dstFile.fileName(), dstFile.errorString()); + continue; + } + + // not needed with mode truncate: dstFile.seek(0); // if file exists, overwrite + + + + qint64 fileSize = srcFile.size(); + while (fileSize) + { + cancelationPoint; + + const auto data = srcFile.read(s_chunkSize); + + cancelationPoint; + + const auto _written = dstFile.write(data); + qWarning() << "progress" << writtenFile << totalFile << writtenAll << totalAll << currentFile << fileCount; + emit newAction(tr("Copying...")); + emit progress(writtenFile, totalFile, writtenAll, totalAll, currentFile, fileCount); + + + // TODO: windoofs +#ifdef Q_OS_UNIX + //qWarning() << "flushing..."; + emit newAction(tr("Writing...")); + + QElapsedTimer t; + t.start(); + + fsync(dstFile.handle()); // fsync(2): "The call blocks until the device reports that the transfer has completed." + + //qWarning() << "took" << t.elapsed() << "ms"; +#endif + + + if (data.size() == _written) + { + writtenFile += _written; + fileSize -= data.size(); + } + else + { + qWarning() << "cannot write to" << dstFile.fileName() << ":" << dstFile.errorString(); + fileSize = 0; + break; // skip this operation + } + } + + writtenAll += writtenFile; + } + + + if (totalAll == writtenAll) + { + qWarning() << "done - " << writtenAll << "/" << totalAll << "bytes"; + return true; + } + else + { + qWarning() << "failed....."; + return false; + } + } + + bool m_wasCanceled { false }; + +public slots: + void slotCancel() + { + m_wasCanceled = true; + } + +signals: + void newAction(const QString &newAction); + void progress(qint64 bytesCopiedFile, qint64 bytesTotalFile, qint64 bytesCopiedAll, qint64 bytesTotalAll, int currentFile, int fileCount); + void finished(bool success); +}; + + + +class CopyProcess : public QObject +{ + Q_OBJECT + +public: + CopyProcess(const QDir &src, const QDir &dst, const QFileInfoList &fil = {}, bool cdUp = true, QObject *parent = nullptr) + : QObject(parent) + , m_process(new ProcessOverlay) + { + connect(m_process, &ProcessOverlay::signalCancel, + this, [this]() + { + //DEBUG_LOG(m_logger) << "m_wasCanceled!!"; + m_wasCanceled = true; + m_process->setCancelEnabled(false); + }); + connect(m_process, &ProcessOverlay::signalCancel, + this, &CopyProcess::signalCancel); + + AsyncFileCopy *afc = AsyncFileCopy::createAsyncFileCopy(src, dst, fil, cdUp); + + connect(m_process, &ProcessOverlay::signalCancel, + afc, &AsyncFileCopy::slotCancel); + + connect(afc, &AsyncFileCopy::progress, + this, [this](qint64 bytesCopiedFile, qint64 bytesTotalFile, + qint64 bytesCopiedAll, qint64 bytesTotalAll, + int currentFile, int fileCount) + { + m_process->setStatus(m_currentAction, fileCount, currentFile, bytesTotalFile, bytesCopiedFile); + }); + + connect(afc, &AsyncFileCopy::newAction, + this, [this](const QString &newAction) + { + m_currentAction = newAction; + }); + + connect(afc, &AsyncFileCopy::finished, + this, &QObject::deleteLater); + + connect(afc, &AsyncFileCopy::finished, + this, &CopyProcess::finished); + } + + ~CopyProcess() + { + //DEBUG_LOG(m_logger) << "~CopyProcess"; + delete m_process; + } + + QWidget *process() { return m_process; } + +signals: + void signalCancel(); + void finished(bool success); + +private: + ProcessOverlay *m_process; + bool m_wasCanceled { false }; + QString m_currentAction; + +}; + + +// USBDialog +USBDialog::USBDialog(LtsSession::LtsSession *session, QWidget *parent) + : LtsWidgets::LtsDialog(parent) + , m_localThpModel(new ExportedScriptsModel(this)) + , m_usbThpModel(new ExportedScriptsModel(this)) + , m_ui(new Ui::USBDialog) + , m_session(session) + //, m_fsWatcher(new QFileSystemWatcher(this)) + , m_exerciseId(m_session->exerciseId()) + , m_paths(0) + , m_logger(getLogger("USBDialog")) +{ + m_ui->setupUi(this); + + connect(m_ui->pbCHange, &QPushButton::clicked, + this, &USBDialog::slotChangePath); + + connect(m_ui->pbCopy, &QPushButton::clicked, + this, &USBDialog::slotCopy); + connect(m_ui->pbRemove, &QPushButton::clicked, + this, &USBDialog::slotRemove); + connect(this, &USBDialog::nextMap, + this, &USBDialog::onNextMap); + + connect(m_ui->pbCopyMaps, &QPushButton::clicked, + this, &USBDialog::slotCopyMaps); + connect(m_ui->pbRemoveMaps, &QPushButton::clicked, + this, &USBDialog::slotRemoveMaps); + connect(m_ui->tvLocal->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &USBDialog::slotSelectionChanged); + + // compiler_warning("TODO") + // auto initModelFn = [this]() + // { + // try + // { + // initModel(); + // } + // catch() + // { + // ERROR_LOG(m_logger) << "initModel failed"; + // } + // }; + + // connect(m_fsWatcher, &QFileSystemWatcher::directoryChanged, + // this, initModelFn); + // connect(m_fsWatcher, &QFileSystemWatcher::fileChanged, + // this, initModelFn); + + initModel(); // throws! + + setOnlineHelpFilename(QStringLiteral("Script_Editor-Export_Script_Administration")); +} + + +USBDialog::~USBDialog() +{ + delete m_ui; +} + + +void USBDialog::initUsbModel() +{ + m_usbThpModel->clear(); + + if (!m_usbThpModel->init(m_usbRoot)) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("The directory '%1' doesn't contain valid THP data.").arg(m_usbRoot)); + ERROR_LOG(m_logger) << "cannot initialize usb thp model from usb root" << m_usbRoot; + return; + } + + + QDir tmp; + tmp.mkpath(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps")); //getContentFolder + + m_ui->tvUSB->setModel(m_usbThpModel); + + m_ui->tvUSB->hideColumn(ExportedScriptsModel::ColId); + m_ui->tvUSB->hideColumn(ExportedScriptsModel::ColLocation); + m_ui->tvUSB->hideColumn(ExportedScriptsModel::ColUploaded); + m_ui->tvUSB->hideColumn(ExportedScriptsModel::ColUploadedTime); + + m_ui->lblPath->setText(m_usbRoot); + + + // fill usb maps + { + m_ui->tvUSBMaps->setRowCount(0); + m_ui->tvUSBMaps->clearContents(); + QDirIterator it(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps"), QDir::Files | QDir::NoDotAndDotDot, + QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); + while (it.hasNext()) + { + QFileInfo fi(it.next()); + m_ui->tvUSBMaps->insertRow(m_ui->tvUSBMaps->rowCount()); + m_ui->tvUSBMaps->setItem(m_ui->tvUSBMaps->rowCount() - 1, 0, new QTableWidgetItem(fi.fileName())); + if (fi.fileName().endsWith(QStringLiteral("json")) || + fi.fileName().endsWith(QStringLiteral("tif"))) + m_ui->tvUSBMaps->hideRow(m_ui->tvUSBMaps->rowCount() -1); + + } + } +} + + +void USBDialog::slotChangePath() +{ + QFileDialog *dlg = new QFileDialog(this); + dlg->setFileMode(QFileDialog::Directory); + dlg->setOption(QFileDialog::ShowDirsOnly); + dlg->setAttribute(Qt::WA_DeleteOnClose); + dlg->show(); + + connect(dlg, &QFileDialog::accepted, + this, [this, dlg]() + { + QStringList selected(dlg->selectedFiles()); + + if (selected.count() > 1) + return; + + m_usbRoot = selected.first(); + + + if (!QFile::exists(m_usbRoot + QDir::separator() + QStringLiteral("exercises.json"))) + { + auto m = new LtsWidgets::LtsMessageDialogNew(this, tr("The selected directory '%1' doesn't contain THPs yet.
Do you want to initialize the directory now?").arg(m_usbRoot), + {}, LtsWidgets::Behaviour::Modal, LtsWidgets::Button::Yes | LtsWidgets::Button::Cancel); + + connect(m, &LtsWidgets::LtsMessageDialogNew::yes, + this, [this]() + { + + QFile exerciseJsonFile(m_usbRoot + QDir::separator() + QStringLiteral("exercises.json")); + if (!exerciseJsonFile.open(QIODevice::WriteOnly)) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("The selected directory '%1' can't be written to and the initialization was aborted.").arg(m_usbRoot)); + return; + } + + exerciseJsonFile.write(QString(QStringLiteral("{ \"Exercises\": [ %1 ] }\n").arg(m_exerciseId)).toUtf8()); // meh... but quick + exerciseJsonFile.close(); + + slotCopyWinBin(); + + + //create data.json if it doesn't exist + std::shared_ptr exmDtc; + std::shared_ptr asmDtc; + if (m_session->getDtc(asmDtc) && + m_session->getDtc(exmDtc)) + { + if (!m_usbThpModel->createDataJson(m_usbRoot, exmDtc, asmDtc, m_exerciseId)) + { + // TODO: user msg + ERROR_LOG(m_logger) << "Failed to initialize data.json"; + return; + } + + TMP_WARNING_LOG(m_logger) << "DONE!"; + } + else + TMP_WARNING_LOG(m_logger) << "Failed to get dtcs :( !"; + }); + + return; + } + + initUsbModel(); + generateLayerMappingXML(); + }); + + +} + +void USBDialog::slotCopyMaps() +{ + if (m_usbRoot.isEmpty()) + return; + + m_finished_mapCopys = 0; + + QDir dstDir(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps")); //getContentFolder for now + + if (!dstDir.exists()) + { + ERROR_LOG(m_logger) << "dst dir " << m_usbRoot << " is not accessible"; + return; + } + + const QModelIndexList mil = m_ui->tvLocalMaps->selectionModel()->selectedRows(); + if (mil.size() < 1) + return; + + + DEBUG_LOG(m_logger) << "mil.size()" << mil.size(); + + + + for (const QModelIndex &idx : mil) + { + // qWarning() << "added fi" << idx.data().toString(); + QString abs = m_ui->tvLocalMaps->item(idx.row(), 2)->text() + QDir::separator() + m_ui->tvLocalMaps->item(idx.row(), 1)->text(); + m_files[m_ui->tvLocalMaps->item(idx.row(), 2)->text()] += abs; + // qWarning() << "the fi" << QFileInfo(idx.data().toString()); + } + //add elevations + //Eleveation + // We will copy all elevations every time! + QDirIterator eleit(QStringLiteral("/usr/share/arcgis/resources/elevation/"), QDir::Files | QDir::NoDotAndDotDot, + QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); + while (eleit.hasNext()) + { + QString file = eleit.next(); + QFileInfo eleFile(file); + if (!eleFile.fileName().toLower().endsWith(QStringLiteral(".tif"))) + continue; + m_files[eleFile.absolutePath()] += eleFile.absoluteFilePath(); + } + + m_paths = m_files.count(); + + //ProcessOverlay* overlay = new ProcessOverlay(); + //setOverlay(overlay); + + //overlay->setStatus(QStringLiteral("Copy Maps"), paths, 1); + //overlay->setCancelEnabled(false); + + + emit nextMap(); + +} + +void USBDialog::onNextMap() +{ + auto path = m_files.firstKey(); + { + QString src(path); + DEBUG_LOG(m_logger) << "src" << src; + + QDir srcDir(src); + + if (!srcDir.exists()) + { + ERROR_LOG(m_logger) << "src dir " << src << " is not accessible"; + return; + } + QDir dstDir(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps")); //getContentFolder for now + + auto cp = new CopyProcess(srcDir, dstDir, m_files[path], false, this); + setOverlay(cp->process()); + connect(cp, &CopyProcess::finished, + this, [this, path](bool success) + { + if (!success) + new LtsWidgets::LtsMessageDialogNew(this, tr("The files could not be copied successfully from path! ") + path); + m_finished_mapCopys++; + m_files.remove(path); + // overlay->setStatus(QStringLiteral("Copy Maps"), paths, m_finished_mapCopys); + if(m_paths == m_finished_mapCopys) + { + // overlay->deleteLater(); + new LtsWidgets::LtsMessageDialogNew(this, tr("The files were copied successfully from path: ") + path); + initUsbModel(); + generateLayerMappingXML(); + m_finished_mapCopys = 0; + }else + emit nextMap(); + }); + } +} + + +void USBDialog::generateLayerMappingXML() +{ + QJsonObject layers; + + QJsonArray elevationUrls; + QJsonArray mapUrls; + QJsonArray sceneObjectUrls; + QJsonArray sceneUrls; + + + for(int i = 0; i < m_ui->tvUSBMaps->rowCount(); ++i) + { + QFileInfo fileInfo = QFileInfo(m_usbRoot + QDir::separator() + m_ui->tvUSBMaps->item(i,0)->text()); + + if(fileInfo.suffix() == QStringLiteral("tif") || fileInfo.suffix() == QStringLiteral("dt2")) + { + QJsonObject elavation; + elavation.insert(QStringLiteral("description"), QJsonValue(QStringLiteral("Elevation"))); + elavation.insert(QStringLiteral("maxScale"), QJsonValue(-1)); + elavation.insert(QStringLiteral("minScale"), QJsonValue(-1)); + elavation.insert(QStringLiteral("name"), QJsonValue(fileInfo.baseName())); + elavation.insert(QStringLiteral("url"), QJsonValue(fileInfo.fileName())); + elevationUrls.push_back(elavation); + } + else if (fileInfo.suffix() == QStringLiteral("slpk")) + { + QJsonObject objectScene; + objectScene.insert(QStringLiteral("description"), QJsonValue(QStringLiteral("ObjectScene"))); + objectScene.insert(QStringLiteral("maxScale"), QJsonValue(125)); + objectScene.insert(QStringLiteral("minScale"), QJsonValue(-1)); + objectScene.insert(QStringLiteral("altitudeOffset"), QJsonValue(0.5)); + objectScene.insert(QStringLiteral("name"), QJsonValue(fileInfo.baseName())); + objectScene.insert(QStringLiteral("url"), QJsonValue(fileInfo.fileName())); + sceneObjectUrls.push_back(objectScene); + } + else if(fileInfo.suffix() == QStringLiteral("tpk")) + { + //Maps when WebMerc dann Scene sonst map + if(fileInfo.fileName().contains(QStringLiteral("WebMerc"))) + { + QJsonObject scene; + scene.insert(QStringLiteral("description"), QJsonValue(QStringLiteral("Scene"))); + scene.insert(QStringLiteral("maxScale"), QJsonValue(125)); + scene.insert(QStringLiteral("minScale"), QJsonValue(-1)); + scene.insert(QStringLiteral("name"), QJsonValue(fileInfo.baseName())); + scene.insert(QStringLiteral("url"), QJsonValue(fileInfo.fileName())); + sceneUrls.push_back(scene); + + } + else + { + QJsonObject map; + map.insert(QStringLiteral("description"), QJsonValue(QStringLiteral("Map"))); + map.insert(QStringLiteral("maxScale"), QJsonValue(125)); + map.insert(QStringLiteral("minScale"), QJsonValue(-1)); + map.insert(QStringLiteral("name"), QJsonValue(fileInfo.baseName())); + map.insert(QStringLiteral("url"), QJsonValue(fileInfo.fileName())); + mapUrls.push_back(map); + } + } + } + + + layers.insert(QStringLiteral("elevationUrls"), elevationUrls); + layers.insert(QStringLiteral("mapUrls"), mapUrls); + layers.insert(QStringLiteral("sceneObjectUrls"), sceneObjectUrls); + layers.insert(QStringLiteral("sceneUrls"), sceneUrls); + + QFile layersMapping(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("layerMapping.json"));//getContentFolder + QFile layersMappingAtMaps(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps") + QDir::separator() + QStringLiteral("layerMapping.json")); + + if (!layersMapping.open(QIODevice::WriteOnly)) + { + WARNING_LOG(m_logger) << "Couldn't open save file."; + return; + } + if (!layersMappingAtMaps.open(QIODevice::WriteOnly)) + { + WARNING_LOG(m_logger) << "Couldn't open save file in folder Maps."; + return; + } + QJsonDocument doc(layers); + + layersMapping.write(doc.toJson()); + layersMappingAtMaps.write(doc.toJson()); +} + +QFileInfoList USBDialog::prepareFileInfoListForFolder(QString src, QFileInfoList fil) +{ + + QDir dir(src); + if (! dir.exists()) + return fil; + + for (QString d : dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) + { + fil = prepareFileInfoListForFolder(src+ QDir::separator() + d, fil); + } + + for (QString f : dir.entryList(QDir::Files)) + { + fil += QString(src + QDir::separator() + f); + } + return fil; +} + +void USBDialog::slotCopyWinBin() +{ + if (m_usbRoot.isEmpty()) + return; + + QDir dstDir(getContentFolder(m_usbRoot) + QDir::separator()); //getContentFolder + + if (!dstDir.exists()) + { + dstDir.mkpath(QStringLiteral(".")); + } + + + //TODO richtiger Pfad + QString src(QStringLiteral("/opt/THP/")); + + QDir srcDir(src); + + if (!srcDir.exists()) + { + ERROR_LOG(m_logger) << "src dir " << src << " is not accessible"; + return; + } + + QFileInfoList fil; + fil = prepareFileInfoListForFolder(src, fil); + DEBUG_LOG(m_logger) << "XXXXXXXXXXX filsize is: " << fil.size(); + + auto cp = new CopyProcess(srcDir, dstDir, fil, false, this); + setOverlay(cp->process()); + + connect(cp, &CopyProcess::finished, + this, [this](bool success) + { + if (success) + { + // new LtsWidgets::LtsMessageDialogNew(this, tr("The files were copied successfully")); + slotCopyWinBinP2(); + } + else + new LtsWidgets::LtsMessageDialogNew(this, tr("The files could not be copied successfully!")); + }); + + +} + +void USBDialog::slotCopyWinBinP2() +{ + if (m_usbRoot.isEmpty()) + return; + + QDir dstDir(getContentFolder(m_usbRoot) + QDir::separator()); //getContentFolder + + if (!dstDir.exists()) + { + dstDir.mkpath(QStringLiteral(".")); + } + const QString initFilePath = NGL::findFile(NGL::FileType::ConfigFile, QStringLiteral("situation_map_defaults.ini")); + + if (initFilePath.isEmpty()) + { + ERROR_LOG(m_logger) << "sitmap init is not accessible"; + return; + } + + QFileInfo fileInfo(initFilePath); + QFileInfoList fil2; + fil2.append(fileInfo); + DEBUG_LOG(m_logger) << "XXXXXXXXXXX sitmap is: " << fileInfo.absoluteFilePath(); + ERROR_LOG(m_logger) << "XXXXXXXXXXX filsize is: " << fil2.size(); + // QString x = QDir::separator() + QStringLiteral("thp") + QDir::separator() + QStringLiteral("share") + QDir::separator() + QStringLiteral("situation_Map"); + + const QDir dstDir2(dstDir.absolutePath() + QDir::separator() + QStringLiteral("thp") + QDir::separator() + QStringLiteral("share") + QDir::separator() + QStringLiteral("LTS") + QDir::separator() + QStringLiteral("situation_Map")) ; + DEBUG_LOG(m_logger) << "XXXXXXXXXXX sitmap dst is: " << dstDir2.absolutePath(); + + auto cp2 = new CopyProcess(fileInfo.absoluteDir(), dstDir2, fil2, false, this); + setOverlay(cp2->process()); + + connect(cp2, &CopyProcess::finished, + this, [this](bool success) + { + if (success) + { + // new LtsWidgets::LtsMessageDialogNew(this, tr("The files were copied successfully")); + slotCopyWinBinP3(); + } + else + new LtsWidgets::LtsMessageDialogNew(this, tr("The files could not be copied successfully!")); + }); +} + +void USBDialog::slotCopyWinBinP3() +{ + if (m_usbRoot.isEmpty()) + return; + + QDir dstDir(getContentFolder(m_usbRoot) + QDir::separator()); //getContentFolder + + if (!dstDir.exists()) + { + dstDir.mkpath(QStringLiteral(".")); + } + + const QString autorunFile = NGL::findFile(NGL::FileType::ConfigFile, QStringLiteral("autorun.inf")); + if (autorunFile.isEmpty()) + { + ERROR_LOG(m_logger) << "autorunFile init is not accessible"; + return; + } + + QFileInfo fileInfo2(autorunFile); + QFileInfoList fil; + fil = prepareFileInfoListForFolder(fileInfo2.absoluteDir().path(), fil); + DEBUG_LOG(m_logger) << "XXXXXXXXXXX autofinFile is: " << fileInfo2.absoluteDir().path(); + DEBUG_LOG(m_logger) << "XXXXXXXXXXX filsize is: " << fil.size(); + + auto cp3 = new CopyProcess(fileInfo2.absoluteDir(), dstDir, fil, false, this); + setOverlay(cp3->process()); + + connect(cp3, &CopyProcess::finished, + this, [this](bool success) + { + if (success) + { + // new LtsWidgets::LtsMessageDialogNew(this, tr("The files were copied successfully")); + initUsbModel(); + } + else + new LtsWidgets::LtsMessageDialogNew(this, tr("The files could not be copied successfully!")); + }); + + +} + + +class JsonHandler +{ +public: + JsonHandler() // invalid + {} + + + // JsonHandler(JsonHandler &&o) + // { + // m_changesMade = o.m_changesMade; + // m_exists = o.m_exists; + // m_root = o.m_root; + // m_f = o.m_f; + // m_filepath = o.m_filepath; + // m_filename = o.m_filename; + // } + + + JsonHandler(const QString &filename, const QString &root, bool mustExist = true) + : m_f(new QFile) + , m_filename(filename) + { + m_filepath = QString(root + QDir::separator() + filename); + + if (!QFile::exists(m_filepath) && mustExist) + throw QStringLiteral("%1 does not exist in given root").arg(filename); + + m_f->setFileName(m_filepath); + + if (!m_f->open(QIODevice::ReadWrite)) + throw QStringLiteral("Cannot open %1").arg(filename); + + qint64 s = m_f->size(); + if (s == 0 && mustExist) + throw QStringLiteral("%1 is empty").arg(filename); + + if (s == 0) + return; + + QJsonParseError err; + QJsonDocument doc(QJsonDocument::fromJson(m_f->readAll(), &err)); + + if (err.error != QJsonParseError::NoError) + throw QStringLiteral("Json malformed: %1 - offset %2").arg(err.errorString(), err.offset); + + m_root = doc.object(); + + if (m_root.isEmpty()) + throw QStringLiteral("%1's object is empty").arg(filename); + + m_exists = true; + // } + // else // since exericses.json is empty / did not exist, create the 'Exercises' array now + // m_root[s_exercisesObjectIdentifier] = QJsonObject(); + + // QJsonValue exercisesArrayValue = m_root[s_exercisesObjectIdentifier]; + + // if (s > 0 && exercisesArrayValue.isUndefined()) // aka. not found (even though the json file has valid json in it) + // throw "exercises.json's object is missing the 'Exercises' array"; + + // if (s == 0 && !mustExist) + // m_changesMade = true; // NOTE: can only be set if no throw might follow as the d_tor would write to the file is changesMade == true, despite an error + } + + + virtual ~JsonHandler() + { + std::shared_ptr _(nullptr, [this](int *) { delete m_f; }); // TODO: QScopeGuard + + if (m_f == nullptr || !m_f->isOpen() || !m_changesMade) + return; + + //m_root[s_exercisesObjectIdentifier] = m_exercisesArray; + + // move to start of file and set file size to zero + m_f->reset(); + m_f->resize(0); + + m_f->write(QJsonDocument(m_root).toJson(QJsonDocument::JsonFormat::Compact)); + } + + +protected: + bool m_changesMade { false }; + bool m_exists { false }; + QJsonObject m_root; + + +private: + QFile *m_f { nullptr }; + QString m_filepath; + QString m_filename; +}; + + +class ExerciseJsonHandler : public JsonHandler +{ +public: + ExerciseJsonHandler(const QString &root, bool mustExist = true) + : JsonHandler(QStringLiteral("exercises.json"), root, mustExist) + { + QJsonValue exercisesArrayValue(m_root[s_exercisesArrayIdentifier]); + + if (m_exists && exercisesArrayValue.isUndefined()) // aka. not found (even though the json file has valid json in it) + throw "exercises.json's object is missing the 'Exercises' array"; + + m_exercisesArray = m_root[s_exercisesArrayIdentifier].toArray(); + + if (!m_exists) + m_changesMade = true; // NOTE: can only be set if no throw might follow as the d_tor would write to the file if changesMade == true, despite an error + } + + + ~ExerciseJsonHandler() + { + m_root[s_exercisesArrayIdentifier] = m_exercisesArray; + } + + + void addExercise(int exerciseId) + { + m_exercisesArray.append(exerciseId); + m_changesMade = true; + } + + + bool removeExercise(int exerciseId) + { + auto it = std::find_if(m_exercisesArray.begin(), m_exercisesArray.end(), + [exerciseId](const QJsonValue &val) + { + bool k = false; + int v = val.toVariant().toInt(&k); + if (!k) + return false; // ouch + + return (v == exerciseId); + }); + + bool ret = (it != m_exercisesArray.end()); + if (ret) + { + m_exercisesArray.erase(it); + m_changesMade = true; + } + + return ret; + } + +private: + static const QString s_exercisesArrayIdentifier; + QJsonArray m_exercisesArray; // sadly a QJsonValueRef cannot be used here :( +}; + + +const QString ExerciseJsonHandler::s_exercisesArrayIdentifier = QStringLiteral("Exercises"); + + +class DataJsonHandler : public JsonHandler +{ +public: + DataJsonHandler() // invalid + {} + + + // DataJsonHandler(DataJsonHandler &&o) + // { + // m_presentationsArray = o.m_presentationsArray; + // } + + + DataJsonHandler(const QString &root, int exerciseId/*, bool mustExist = true*/) + : JsonHandler(QStringLiteral("data.json"), QStringLiteral("%1/%2").arg(root).arg(USBDialog::exerciseDirectoryName(exerciseId)), true) + { + QJsonValue scriptsArrayValue(m_root[s_presentationsArrayIdentifier]); + + if (m_exists && scriptsArrayValue.isUndefined()) // aka. not found (even though the json file has valid json in it) + throw "data.json's object is missing the 'presentations' array"; + + m_presentationsArray = m_root[s_presentationsArrayIdentifier].toArray(); + + if (!m_exists) + m_changesMade = true; // NOTE: can only be set if no throw might follow as the d_tor would write to the file if changesMade == true, despite an error + } + + + ~DataJsonHandler() + { + m_root[s_presentationsArrayIdentifier] = m_presentationsArray; + } + + + // void addScript(int scriptId) nah... once deleted, data cannot be restored - re-copy data.json instead + // { + // m_presentationsArray.append(scriptId); + // m_changesMade = true; + // } + + + QVector scripts() + { + QVector ret; + + for (const QJsonValue &val : qAsConst(m_presentationsArray)) + { + QJsonObject scriptObject(val.toObject()); + + bool k = false; + int v = scriptObject[QStringLiteral("scriptId")].toVariant().toInt(&k); + if (!k) + continue; // ouch + + ret += v; + } + + return ret; + } + + + bool removeScript(int scriptId) + { + auto it = std::find_if(m_presentationsArray.begin(), m_presentationsArray.end(), + [scriptId](const QJsonValue &val) + { + QJsonObject scriptObject(val.toObject()); + + bool k = false; + int v = scriptObject[QStringLiteral("scriptId")].toVariant().toInt(&k); + if (!k) + return false; // ouch + + return (v == scriptId); + }); + + bool ret = (it != m_presentationsArray.end()); + if (ret) + { + m_presentationsArray.erase(it); + m_changesMade = true; + } + + return ret; + } + +private: + static const QString s_presentationsArrayIdentifier; + QJsonArray m_presentationsArray; // sadly a QJsonValueRef cannot be used here :( +}; + + +const QString DataJsonHandler::s_presentationsArrayIdentifier = QStringLiteral("presentations"); + + +void USBDialog::adjustJsonFiles(What what) +{ + /* Problem: data.json has a weird location and has to be updated if a script was copied. + * As it has all presentations in it that were ever exported, data.json needs to be adjusted + * if a script was deleted or copied. + * + * Use-cases: + * + * Script was deleted from exercise: + * Check if other scripts exists in exercise, otherwise delete exercise directory, delete exercise from exercises.json + * + * Exercise diretory was deleted (by removing the last existing script from an exericse): + * New exercise directory was created (by copying a script): + * Rewrite exercises.json by checking what exercise directories exist + * + * Script was copied to an existing exercise: + * re-copy exercise's data.json and remove all scripts that don't exist in the exercise's directory + * + */ + + switch (what) + { + case What::ScriptWasDeletedFromExercise: + { + // // look into exercise folder and check if there are script dirs left + // QDir dir(getContentFolder(m_usbRoot)); + // dir.setFilter(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot); + + // const QFileInfoList fil(dir.entryInfoList()); + // if (fil.isEmpty()) + // { + // DEBUG_LOG(m_logger) << "no scripts left"; + // /* ... determined by checking if there are directories, as scripts are + // * in their own directories and scripts are the only directories in an + // * exercise directory */ + + // // delete exercise directory + // dir.removeRecursively(); // TODO: hangs.. should be async?? + error handling + + // // finally remove exercise from exercise.json + // try + // { + // ExerciseJsonHandler(m_usbRoot).removeExercise(m_exerciseId); + // } + // catch (const QString &str) + // { + // ERROR_LOG(m_logger) << "ExerciseJsonHandler failed: " << str; + // break; + // } + + // break; + // } + + // // there are scripts left, only remove script from exercise dir's data.json + // try + // { + // DataJsonHandler(m_usbRoot, m_exerciseId).removeScript(m_exerciseId); + // } + // catch (const QString &str) + // { + // ERROR_LOG(m_logger) << "ExerciseJsonHandler failed: " << str; + // break; + // } + + // break; + } + + case What::ExerciseDirectoryWasDeleted: + case What::NewExerciseDirectoryWasCreated: + { + + + break; + } + + case What::ScriptWasCopiedToExercise: + break; + } +} + + +void USBDialog::scriptDeleted(int scriptId) +{ + // look into exercise folder and check if there are script dirs left + QDir dir(m_usbRoot); + dir.setFilter(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot); + + const QFileInfoList fil(dir.entryInfoList()); + if (fil.isEmpty()) + { + DEBUG_LOG(m_logger) << "no scripts left"; + /* ... determined by checking if there are directories, as scripts are + * in their own directories and scripts are the only directories in an + * exercise directory */ + + // delete exercise directory + dir.removeRecursively(); // TODO: hangs.. should be async?? + error handling + + // finally remove exercise from exercise.json + try + { + ExerciseJsonHandler(m_usbRoot).removeExercise(m_exerciseId); + } + catch (const QString &str) + { + ERROR_LOG(m_logger) << "ExerciseJsonHandler failed: " << str; + return; + } + + return; + } + + // there are scripts left, only remove script from exercise dir's data.json + try + { + DataJsonHandler(m_usbRoot, m_exerciseId).removeScript(scriptId); + } + catch (const QString &str) + { + ERROR_LOG(m_logger) << "DataJsonHandler failed: " << str; + } +} + + +void USBDialog::scriptCopied(int /*scriptId*/) +{ + compiler_warning("TODO: re-copy data.json ???") + // open data.json and remove all 'presentation's that do not exist on the USB + + // get list of scripts that exist on the USB + QDir dir(getContentFolder(m_usbRoot)); + dir.setFilter(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot); + + const QFileInfoList fil(dir.entryInfoList()); + Q_ASSERT_X(!fil.isEmpty(), "", "no scripts on USB"); // Logic failure: No scripts on the USB, but missing presentations in data.json isn't possible as a deleted script would have triggered a deletion of the whole exercise directory + + + QVector existingScripts; + + for (const QFileInfo &fi : fil) + { + bool k = false; + int val = fi.fileName().toInt(&k); + + if (!k) + continue; // hmm.. the only allowed directories are script directories, which have integer-convertible filenames + + existingScripts += val; + } + + + QVector usbScripts; + DataJsonHandler djh; // invalid + + try + { + // get list of scripts on usb + djh = DataJsonHandler(m_usbRoot, m_exerciseId); + } + catch (const QString &str) + { + ERROR_LOG(m_logger) << "DataJsonHandler failed: " << str; + return; + } + + usbScripts = djh.scripts(); + + // delete all scripts from data.json that do not exist on USB + // prepare usbScripts list to only have the script ids now that DON'T exist on usb + usbScripts.erase(std::remove_if(usbScripts.begin(), usbScripts.end(), + [existingScripts](int id) + { + return (std::find(existingScripts.begin(), existingScripts.end(), id) != existingScripts.end()); + }), usbScripts.end()); + + + // now really delete scripts from data.json + for (const int scriptId : qAsConst(usbScripts)) + djh.removeScript(scriptId); + + + // delete all script directories of scripts that do not exist on USB + for (const QFileInfo &fi : fil) + { + bool k = false; + int val = fi.fileName().toInt(&k); + + if (!k || !usbScripts.contains(val)) + continue; + + fi.absoluteDir().removeRecursively(); + } +} + + +void USBDialog::slotCopy() +{ + if (m_usbRoot.isEmpty()) + return; + + QDir dstDir(m_usbRoot); + + if (!dstDir.exists()) + { + ERROR_LOG(m_logger) << "dst dir " << m_usbRoot << " is not accessible"; + return; + } + + dstDir = QDir(getContentFolder(m_usbRoot)); + + if (!dstDir.mkpath(dstDir.absolutePath())) // NOTE: returns true if path already exists + { + ERROR_LOG(m_logger) << "Could not create destination path " << dstDir.absolutePath(); + return; + } + + qWarning() << "dst" << dstDir.absolutePath(); + + const QModelIndexList mil = m_ui->tvLocal->selectionModel()->selectedRows(); + if (mil.size() != 1) + return; + + ExportedScriptInformation esi = m_localThpModel->getRowData(mil.first().row()); + + if (!QDir(esi.rootDirectory).exists()) + return; + + QString src(getScriptFolder(esi.rootDirectory, esi.exerciseId, esi.scriptId)); + DEBUG_LOG(m_logger) << "src" << src; + + QDir srcDir(src); + QDir bldgDir( QStringLiteral("%1/BuildingModels").arg(getContentFolder(esi.rootDirectory, esi.exerciseId))); + + if (!srcDir.exists()) + { + ERROR_LOG(m_logger) << "src dir " << src << " is not accessible"; + return; + } + + auto cp = new CopyProcess(srcDir, dstDir, {}, true, this); + //copy buildings secretly + auto cpBuildings = new CopyProcess(bldgDir, dstDir, {}, true, this); + cpBuildings->process(); + + setOverlay(cp->process()); + + connect(cp, &CopyProcess::finished, + this, [this, esi](bool success) + { + if (!success) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("The files could not be copied successfully!")); + return; + } + + new LtsWidgets::LtsMessageDialogNew(this, tr("The files were copied successfully")); + + TMP_WARNING_LOG(m_logger) << "GO GO GO"; + ExportedScriptInformation esi2(esi); + esi2.rootDirectory = m_usbRoot; // edit esi to point to the new rootdir (the usb) + m_localThpModel->addDownloadData(esi2); + initUsbModel(); // fill ! + + // scriptCopied(esi.scriptId); + }); +} + + +void USBDialog::slotRemove() +{ + // this operation is fast enough to NOT do it async + + if (m_usbRoot.isEmpty()) + return; + + const QModelIndexList mil = m_ui->tvUSB->selectionModel()->selectedRows(); + if (mil.size() < 1) + return; + + + DEBUG_LOG(m_logger) << "mil.size()" << mil.size(); + + + for (const QModelIndex &idx : mil) + { + int scriptId = idx.data(Qt::UserRole).toInt(); + // qWarning() << "rm" << scriptId; + // qWarning() << "rm'd?" << QDir(getScriptFolder(m_usbRoot, m_exerciseId, scriptId)).removeRecursively(); + scriptDeleted(scriptId); + } + + initUsbModel(); // instead of deleting the rows, just reinit the whole model... ugh, but quickly done +} + + +void USBDialog::slotRemoveMaps() +{ + // this operation is fast enough to NOT do it async + + if (m_usbRoot.isEmpty()) + return; + + QDir dir(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps")); //getContentFolder + + if (!dir.exists()) + { + ERROR_LOG(m_logger) << "dir " << m_usbRoot << " is not accessible"; + return; + } + + const QModelIndexList mil = m_ui->tvUSBMaps->selectionModel()->selectedRows(); + if (mil.size() < 1) + return; + + + DEBUG_LOG(m_logger) << "mil.size()" << mil.size(); + + + for (const QModelIndex &idx : mil) + { + DEBUG_LOG(m_logger) << "rm" << idx.data().toString(); + QFile::remove(dir.absolutePath() + QDir::separator() + idx.data().toString()); + } + + + + initUsbModel(); // instead of deleting the rows, just reinit the whole model... ugh, but quickly done + generateLayerMappingXML(); +} + + +void USBDialog::slotSelectionChanged() +{ + const QModelIndexList mil = m_ui->tvLocal->selectionModel()->selectedRows(); + + // compiler_warning("TODO") + // if (mil.size() != 1) + // { + // m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false); // Show presentation Button + // m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); // local remove Button + // m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(false); // download from Server + // m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(false); // Remove from Server Button + // return; + // } + + // const ExportedScriptInformation esi = m_localThpModel->getRowData(mil.first().row()); + // if (m_session->app() != LtsAppDescriptor::App::OC) + // { + // if (esi.local) + // { + // m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(true); // local remove Button + // m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(true); // upload to Server + // } + // else + // { + // m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); // local remove Button + // m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(false); // upload to Server + // } + // if (esi.uploaded == ThpAlreadyUploaded) + // { + // m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(true); // Remove from Server Button + // } + // else + // { + // m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(false); // Remove from Server Button + // } + // } + // else // OC + // { + // if (esi.uploaded == ThpAlreadyUploaded) + // { + // m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(true); // download from Server + // m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(true); // Remove from Server Button + // } + // else + // { + // m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(false); // Remove from Server Button + // } + // if (esi.local) + // { + // m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(true); // Show presentation Button + // m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(true); // local remove Button + // } + // else + // { + // m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false); // Show presentation Button + // m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); // local remove Button + // } + // } +} + + +void USBDialog::retranslate() +{ + translate(m_ui, tr("Manage exported scripts")); +} + + +void USBDialog::initModel() +{ + DEBUG_LOG(m_logger) << "(re)initModel !!"; + + // TODO: move to model + // compiler_warning("TODO") + // m_fsWatcher->addPath(getRootFolder()); + // m_fsWatcher->addPath(getContentFolder(m_session->exerciseId())); + + if (!m_localThpModel->init(getRootFolder())) + { + throw "init model failed for Export"; + if (!m_localThpModel->init(getRootFolder(true))) // Download directory + throw "init model failed for Download"; + } + + m_ui->tvLocal->setModel(m_localThpModel); // important to set model before setting hidden columns + + m_ui->tvLocal->hideColumn(ExportedScriptsModel::ColId); + m_ui->tvLocal->hideColumn(ExportedScriptsModel::ColLocation); + m_ui->tvLocal->hideColumn(ExportedScriptsModel::ColUploaded); + m_ui->tvLocal->hideColumn(ExportedScriptsModel::ColUploadedTime); + + + + // fill local maps + { + m_ui->tvLocalMaps->setRowCount(0); + m_ui->tvLocalMaps->clearContents(); + + + //Maps when WebMerc dann Scene sonst map + QDirIterator tpit(QStringLiteral("/usr/share/arcgis/resources/TilePackage/"), QDir::Files | QDir::NoDotAndDotDot, + QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); + while (tpit.hasNext()) + { + QString file = tpit.next(); + m_ui->tvLocalMaps->insertRow(m_ui->tvLocalMaps->rowCount()); + QFileInfo mapFile(file); + m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 0, mapFile.fileName().contains(QStringLiteral("WebMerc")) ? new QTableWidgetItem(tr("3D Map")) : new QTableWidgetItem(tr("2D Map")) ); + m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 1, new QTableWidgetItem(mapFile.fileName())); + m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 2, new QTableWidgetItem(QFileInfo(file).absolutePath())); + } + + //ObjectScene + QDirIterator slpkit(QStringLiteral("/usr/share/arcgis/resources/slpk/"), QDir::Files | QDir::NoDotAndDotDot, + QDirIterator::Subdirectories); + while (slpkit.hasNext()) + { + QString file = slpkit.next(); + if (!file.endsWith(QStringLiteral(".slpk"))) + continue; + QFileInfo fi(file); + if(fi.isSymLink()) + continue; + + m_ui->tvLocalMaps->insertRow(m_ui->tvLocalMaps->rowCount()); + m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 0, new QTableWidgetItem(tr("3D Object"))); + m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 1, new QTableWidgetItem(QFileInfo(file).fileName())); + m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 2, new QTableWidgetItem(QFileInfo(file).absolutePath())); + } + + //Eleveation + // We will copy all elevations every time! + // QDirIterator eleit(QStringLiteral("/usr/share/arcgis/resources/elevation/"), QDir::Files | QDir::NoDotAndDotDot, + // QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); + // while (eleit.hasNext()) + // { + // QString file = eleit.next(); + // m_ui->tvLocalMaps->insertRow(m_ui->tvLocalMaps->rowCount()); + // m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 0, new QTableWidgetItem(QStringLiteral("Eleveation"))); + // m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 1, new QTableWidgetItem(QFileInfo(file).fileName())); + // // m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 2, new QTableWidgetItem(QFileInfo(file).absolutePath())); + // } + + + } + m_ui->tvLocalMaps->sortItems(0); + + m_ui->tvLocalMaps->hideColumn(2); + slotSelectionChanged(); // aka. enaDisa +} + + +QString USBDialog::getContentFolder(const QString &rootFolder) const +{ + return QStringLiteral("%1/%2").arg(rootFolder, exerciseDirectoryName()); +} + + +QString USBDialog::getContentFolder() const +{ + return getContentFolder(getRootFolder(), m_exerciseId); +} + + +/*static*/ QString USBDialog::exerciseDirectoryName(int exerciseId) +{ + return QStringLiteral("Exercise_%1").arg(exerciseId); +} + + +QString USBDialog::exerciseDirectoryName() const +{ + return exerciseDirectoryName(m_exerciseId); +} + + +/*static*/ QString USBDialog::getContentFolder(const QString &rootFolder, int exerciseId) +{ + return QStringLiteral("%1/%2").arg(rootFolder, exerciseDirectoryName(exerciseId)); +} + + +QString USBDialog::getContentFolder(int exerciseId) const +{ + return getContentFolder(getRootFolder(), exerciseId); +} + + +/* static */ QString USBDialog::getScriptFolder(const QString &rootFolder, int exerciseId, int scriptId) +{ + return QStringLiteral("%1/%2").arg(getContentFolder(rootFolder, exerciseId)).arg(scriptId); +} + + +QString USBDialog::getScriptFolder(const QString &rootFolder, int scriptId) const +{ + return getScriptFolder(rootFolder, m_exerciseId, scriptId); +} + + +QString USBDialog::getScriptFolder(int scriptId) const +{ + return getScriptFolder(getRootFolder(), m_exerciseId, scriptId); +} + + +QString USBDialog::getRootFolder(bool forceDownloadDir) const +{ + if (m_session->app() == LtsAppDescriptor::App::OC || forceDownloadDir) + return QDir::tempPath() + QStringLiteral("/THP-Download/"); + + return QDir::tempPath() + QStringLiteral("/THP-Export/"); +} + + +} // namespace TakeHomePackageManager + + +#include "tpm_usb_dialog.moc" diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.h new file mode 100755 index 000000000..c3ba2a0f3 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.h @@ -0,0 +1,138 @@ +/** + * @RDE_HEADER@ + * Show the exported scripts and allow them to upload them to the server + * $Id: tpm_exported_scripts_dialog.h 51804 2020-07-31 04:47:28Z fritsche_h $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/tpm_exported_scripts_dialog.h $ + * $Author: fritsche_h $ + * + * Created by Mike Wille, SLTE, 2020-03-23 + */ +#pragma once + +#include "logger.h" + +#include + +#include + +namespace Ui +{ +class USBDialog; +} +namespace LtsSession +{ +class LtsSession; +} + +namespace TakeHomePackageManager +{ +class ExportedScriptsModel; + +enum eLayerType +{ + elevation, + map, + sceneObject, + scene +}; + +struct layerMappinEntry +{ + eLayerType type; + QString description; + int maxScale; + int minScale; + QString name; + QString url; + +public: + + layerMappinEntry() + : type(eLayerType::map), description(QStringLiteral("NOTSET")), maxScale(125), minScale(-1), name(QStringLiteral("_name")), url(QStringLiteral("_url")) + { + + } + layerMappinEntry(eLayerType _type, QString _description, int _maxScale, int _minScale, QString _name, QString _url) + : type(_type), description(_description), maxScale(_maxScale), minScale(_minScale), name(_name), url(_url) + { + + } +}; + +class USBDialog : public LtsWidgets::LtsDialog +{ + Q_OBJECT +public: + /** + * @brief USBDialog => WARNING: throws! catch exception! + * @param session + * @param parent + */ + explicit USBDialog(LtsSession::LtsSession *session, QWidget *parent = nullptr); + ~USBDialog(); + + void retranslate() override; + + static QString getContentFolder(const QString &rootFolder, int exerciseId); + QString getContentFolder(const QString &rootFolder) const; + + static QString exerciseDirectoryName(int exerciseId); + static QString getScriptFolder(const QString &rootFolder, int exerciseId, int scriptId); + +signals: + void nextMap(); + +private slots: + void slotSelectionChanged(); + + void slotCopy(); + void slotCopyMaps(); + void slotCopyWinBin(); + void slotCopyWinBinP2(); + void slotCopyWinBinP3(); + + void slotRemove(); + void slotRemoveMaps(); + + void slotChangePath(); + void onNextMap(); + void generateLayerMappingXML(); + + + +private: + enum class What + { + ScriptWasDeletedFromExercise, + ExerciseDirectoryWasDeleted, + NewExerciseDirectoryWasCreated, + ScriptWasCopiedToExercise, + }; + + void adjustJsonFiles(What what); + void initModel(); + void initUsbModel(); + void scriptDeleted(int scriptId); + void scriptCopied(int scriptId); + QFileInfoList prepareFileInfoListForFolder(QString src, QFileInfoList fil); + + QString getContentFolder(int exerciseId) const; + QString getContentFolder() const; + QString getRootFolder(bool forceDownloadDir = false) const; + QString exerciseDirectoryName() const; + QString getScriptFolder(const QString &rootFolder, int scriptId) const; + QString getScriptFolder(int scriptId) const; + + ExportedScriptsModel *m_localThpModel; + ExportedScriptsModel *m_usbThpModel; + Ui::USBDialog *m_ui; + LtsSession::LtsSession *m_session; + int m_exerciseId; + int m_paths; + QMap m_files; + + QString m_usbRoot; + NGL::INGLLogger &m_logger; + int m_finished_mapCopys; +}; +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.ui new file mode 100755 index 000000000..4b3ad469d --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.ui @@ -0,0 +1,274 @@ + + + USBDialog + + + + 0 + 0 + 1081 + 541 + + + + Form + + + + + + Qt::Vertical + + + + Local + + + + + + Qt::Horizontal + + + + + + + THPs + + + + + + + true + + + QAbstractItemView::ExtendedSelection + + + + + + + + 0 + 0 + + + + Copy selected THPs to USB + + + + + + + + + + + Maps + + + + + + + true + + + QAbstractItemView::SelectRows + + + true + + + false + + + + Type + + + + + Name + + + + + Path + + + + + + + + + 0 + 0 + + + + Copy selected Maps to USB + + + + + + + + + + + + On USB + + + + + + + + Path: + + + + + + + (none) + + + + + + + + 0 + 0 + + + + Change path + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Horizontal + + + + + 0 + + + + + THPs + + + + + + + true + + + QAbstractItemView::ExtendedSelection + + + QAbstractItemView::SelectRows + + + + + + + + 0 + 0 + + + + Remove selected THPs from USB + + + + + + + + + + + Maps + + + + + + + true + + + QAbstractItemView::SelectRows + + + true + + + false + + + + Name + + + + + + + + + 0 + 0 + + + + Remove selected Maps from USB + + + + + + + + + + + + + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.cpp new file mode 100755 index 000000000..8807923a0 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.cpp @@ -0,0 +1,102 @@ +/** + * @RDE_HEADER@ + * GUI Plugin for ExerciseManangement + * $Id: tpm_gui_plugin.cpp 48572 2019-10-02 11:47:04Z rudolphus_g $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/tpm_gui_plugin.cpp $ + * $Author: rudolphus_g $ + * + * Created by Mike Wille, SLTE, 2020-03-23 + */ + +#include "tpm_usb_gui_plugin.h" +#include "tpm_usb_dialog.h" +#include "logger.h" + + + + +#include + + + + +namespace TakeHomePackageManager +{ +std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) +{ + return std::make_shared(session); +} + + +InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) + : GuiPluginBase::Interface(session, getLogger("Plugin")) +{ +} + + +bool InterfaceImpl::fetchInterfaces() +{ + return true; +} + + +QString InterfaceImpl::menuGroup() const +{ + return tr("Presentation"); +} + +QVector InterfaceImpl::getActions() +{ + + QVector ret; + + LtsWidgets::PluginData plData; + plData.menuGroup = menuGroup(); + + if (m_session->app() == LtsAppDescriptor::App::Scripts) + plData.exercisePart = LtsWidgets::ExercisePart::eSpecial; + else + plData.exercisePart = LtsWidgets::ExercisePart::eAfterAction; + + plData.identifier = QLatin1String("THP.USB.Dialog"); + plData.menuIcon = QIcon(QLatin1String("icon:export_documents.svg")); + plData.menuText = tr("USB Management"); + // plData.operatorRight = OperatorRights::ScriptEditorEdit; + plData.createWidgetFunc = [this](QWidget *) + { + return LtsWidgets::createThrowableDialog(m_session); + }; + ret.append(plData); + + return ret; +} + +} // namespace TakeHomePackageManager + + + + + + + + + + + + + + + + + + + + + + + + + + + +// diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.h new file mode 100755 index 000000000..ac44e1aed --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.h @@ -0,0 +1,52 @@ +/** + * @RDE_HEADER@ + * Gui Plugin for MarkerManagement + * $Id: tpm_gui_plugin.h 49807 2020-02-06 09:53:16Z ehrlicher $ + * $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/tpm_gui_plugin.h $ + * $Author: ehrlicher $ + * + * Created by Mike Wille, SLTE, 2020-03-23 + */ + +#pragma once +#include + +#include "logger.h" +#include +#include + +namespace TakeHomePackageManager +{ +class GuiPlugin final : public QObject, public GuiPluginBase::Plugin +{ + Q_PLUGIN_METADATA(IID "gui:3:tpm.usb") + Q_INTERFACES(GuiPluginBase::Plugin) + + Q_OBJECT +public: + GuiPlugin() = default; + ~GuiPlugin() = default; + + QString pluginName() override { return QLatin1String("ThpUsbManager"); } + std::shared_ptr createGuiInterface(LtsSession::LtsSession *session) override; + bool availableInPartition(IDL::PartitionType partition) const override + { + return partition == IDL::PartitionType::Exercise; + } +}; + +class InterfaceImpl final : public QObject, public GuiPluginBase::Interface, public ForeignTpmGuiInterface +{ + Q_OBJECT +public: + explicit InterfaceImpl(LtsSession::LtsSession *session); + + bool fetchInterfaces() override; + QString menuGroup() const override; + QVector getActions() override; + bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise; } +private: + +}; + +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/tpm_gui_plugin_interface.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/tpm_gui_plugin_interface.h new file mode 100755 index 000000000..ec9e2c224 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/tpm_gui_plugin_interface.h @@ -0,0 +1,25 @@ +/** + * @RDE_HEADER@ + * HMI Plugin for Exercisemanagemt (Interface for access from other Plugins) + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Christian Ehrlicher, SLSE, 2016-02-29 + */ + +#pragma once +#include + + +namespace TakeHomePackageManager +{ + +class ForeignTpmGuiInterface +{ +public: + ForeignTpmGuiInterface() = default; + virtual ~ForeignTpmGuiInterface() = default; + static QString pluginName() { return QStringLiteral("TpmGuiPlugin"); } +}; + +} // namespace TakeHomePackageManager diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/CMakeLists.txt new file mode 100755 index 000000000..fb88d1d8d --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/CMakeLists.txt @@ -0,0 +1,135 @@ +# +# $Id$ +# $HeadURL$ +# $Author$ +# +# Created by Mike Wille, SLSE, 2017-02-10 +# + + +# EventFilter +SET(EventFilter_SRCS + EventFilter/AttributeEditingModeUI.h + EventFilter/AttributeEditingModeUI.cpp + EventFilter/AttributeSelectionModeUI.h + EventFilter/AttributeSelectionModeUI.cpp + + EventFilter/FilterWindow.h + EventFilter/FilterWindow.cpp + EventFilter/FilterTableEntry.h + EventFilter/FilterTableEntry.cpp + EventFilter/FilterTableEntryAttribute.h + EventFilter/FilterTableEntryAttribute.cpp + + EventFilter/interpreter/FilterWorker.h + EventFilter/interpreter/FilterWorker.cpp + + EventFilter/widgets/AbstractAttributeWidget.cpp + EventFilter/widgets/ComboBox.cpp + EventFilter/widgets/TimeRangeWidget.cpp + EventFilter/widgets/AreaWidget.cpp + EventFilter/widgets/DefaultRangeWidget.cpp + EventFilter/widgets/CheckBoxWidget.cpp + EventFilter/widgets/RadiusWidget.cpp + + EventFilter/interpreter/InfoWindow.h + EventFilter/interpreter/InfoWindow.cpp + EventFilter/interpreter/FilterEquationFunctions.cpp + EventFilter/interpreter/FilterValueInterpreter.cpp + + EventFilter/widgets/AbstractAttributeWidget.h + EventFilter/widgets/ComboBox.h + EventFilter/widgets/TimeRangeWidget.h + EventFilter/widgets/AreaWidget.h + EventFilter/widgets/DefaultRangeWidget.h + EventFilter/widgets/CheckBoxWidget.h + EventFilter/widgets/RadiusWidget.h + + EventFilter/interpreter/FilterEquationFunctions.h + EventFilter/interpreter/FilterValueInterpreter.h + + detail_data.h + detail_data.cpp + excon_filter.h + excon_filter.cpp + logger.h + logger.cpp +) + +SET(EventFilter_UICS + EventFilter/ui/FilterWindowUi.ui +) + + +# Timeline +SET(tln_view_gui_SRCS + attribute_value_lookup.cpp + attribute_value_lookup.h + tln_view_gui_plugin.cpp + tln_view_gui_plugin.h + tln_dialog.cpp + tln_dialog.h + tln_dialog_model.cpp + tln_dialog_model.h + tln_cache_dialog.cpp + tln_cache_dialog.h + tln_show_details.cpp + tln_show_details.h + tln_event_list.h + tln_event_list.cpp + tln_event_list_model.h + tln_event_list_model.cpp + tln_event_list_columns.h + tln_event_list_columns.cpp + tln_legend.h + tln_legend.cpp + + ${EventFilter_SRCS} +) + +NGL_WRAP_UI(tln_view_gui_SRCS + tln_dialog.ui + tln_cache_dialog.ui + tln_show_details.ui + tln_event_list.ui + tln_event_list_columns.ui + tln_legend.ui + + ${EventFilter_UICS} +) + +NGL_ADD_LIBRARY(WS TlnViewGuiPlugin MODULE ${tln_view_gui_SRCS}) +NGL_TARGET_LINK_LIBRARIES(TlnViewGuiPlugin + Qt5::Widgets + Qt5::WebSockets + + LtsAppManager + LtsDataView + LtsTimelineClassic + LtsPrinting + LtsSession + LtsSessionData + LtsUtilsCore # data mod + LtsUtilsGuiDds + LtsUtilsSettings + LtsWidgets + NGLLogger + ngltools # dtg + + AvmDataPluginInterface + ExmDataPluginInterface + IsmDataPluginInterface + MrkDataPluginInterface + OpmDataPluginInterface + PdmDataPluginInterface + PpmDataPluginInterface + + FlmExplorerGuiPluginInterface + FltAesGuiPluginInterface # SitMap Filter + TlnDataPluginInterface + TlnViewGuiPluginInterface + + MrkCommon # SitMap Filter Helper +) + +NGL_INSTALL_TARGET(TlnViewGuiPlugin) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.cpp new file mode 100755 index 000000000..cc6902c24 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.cpp @@ -0,0 +1,226 @@ +/** + * @RDE_HEADER@ + * provides user-management for attributes for a filter in filter table entry + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +//#include "FilterWindow.h" // for debug messagebox +#include "AttributeEditingModeUI.h" +#include "../detail_data.h" + +#include "widgets/TimeRangeWidget.h" +#include "widgets/DefaultRangeWidget.h" +#include "widgets/ComboBox.h" +#include "widgets/CheckBoxWidget.h" +#include "widgets/AreaWidget.h" +#include "widgets/RadiusWidget.h" + +#include "logger.h" + +#include +#include +#include + +namespace Timeline +{ + +AbstractAttributeWidget *EditingModeUI::createAttributeUIWidget(DetailData *detailData, const QString &attributeType, + int eventType, const QString &initialValue) // create a widget, suitable for the attribute +{ + AbstractAttributeWidget *resultWidget = nullptr; + QString concreteAttributeType = detailData->attributeRedirectionLookup.getRedirection(attributeType); + int attributeUIType = detailData->attributeUITypeLookup.getUIType(concreteAttributeType); + + if (attributeUIType == -1) // not found? abort! + return nullptr; + + //WARNING_LOG(m_logger) << "createAttributeUIWidget: for attributeType " << attributeType << " with string " << initialValue << " and attribute ui type " << attributeUIType; + + const DetailData::AttributeParameterLookup::ParameterMap &pm = detailData->attributeParameterLookup.getParameterMap(concreteAttributeType); //const DetailData::UIInitialValuesLookup::ParameterValuesMap& pvm = filterData->uiInitialValuesLookup.getUIInitialValuesMap(attributeUIType); // initial values to be used to create widgets with intiaial values..... + + switch (attributeUIType) + { + case DetailData::ATTRIBUTE_UI_TYPE_COMBO_BOX: // do not use pm ! + { + resultWidget = new ComboBox(detailData, concreteAttributeType, eventType, initialValue); // get the combobox for the attribute (which is then filled with possible values) + break; + } + + case DetailData::ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET: + { + bool minb = false; + unsigned int min = pm.value(DetailData::UI_PARAM_TYPE_MIN).toUInt(&minb); + + bool maxb = false; + unsigned int max = pm.value(DetailData::UI_PARAM_TYPE_MAX).toUInt(&maxb); + + QString prefix = pm.value(DetailData::UI_PARAM_TYPE_PREFIX).toString(); + + QString suffix = pm.value(DetailData::UI_PARAM_TYPE_SUFFIX).toString(); + + + if (!minb || !maxb) // || prefix.isEmpty() || suffix.isEmpty()) + { + WARNING_LOG(m_logger) << "createAttributeUIWidget: !minb (" << minb << ") || !maxb (" << maxb << ")"; // || prefix.isEmpty ("<createRetrieveCurrentTimeCallback(trw->m_edit1); + detailData->createRetrieveCurrentTimeCallback(trw->m_edit2); + resultWidget = trw; + break; + } + + default: // invalid attribute type! + { + WARNING_LOG(m_logger) << "createAttributeUIWidget: invalid attribute type #" << attributeUIType << "!"; + //return 0; + break; + } + } + + //resultWidget->setStyleSheet("background-color:#CC9B97;"); // layer 3 + return resultWidget; +} + +void EditingModeUI::addAttributeContainer(int eventType, const QString &initialValue) +{ + //attributeValuesLayout->addWidget(createAttributeUIWidget(attributeType), 0, Qt::AlignTop); + + AbstractAttributeWidget *attributeUIWidget = createAttributeUIWidget(m_detailData, attributeType, eventType, initialValue); + + if (attributeUIWidget == nullptr) + { + DEBUG_LOG(m_logger) << "addAttributeContainer: !attributeUIWidget"; + return; + } + + connect(attributeUIWidget, &AbstractAttributeWidget::destroyed, this, &EditingModeUI::signalChanges); + connect(attributeUIWidget, &AbstractAttributeWidget::signalChanges, this, &EditingModeUI::signalChanges); + + attributeValuesLayout->insertWidget(0, attributeUIWidget, 0, Qt::AlignTop); + attributeUIWidget->setFocus(); // set focus to new widget +} + +EditingModeUI::EditingModeUI(DetailData *detailData, const QString &attributeType, QWidget *parent) + : QWidget(parent) + , attributeType(attributeType) + , m_detailData(detailData) + , m_logger(getLogger("EventFilter.EditingModeUI")) +{ + QVBoxLayout *editingModeLayout = new QVBoxLayout; + + QWidget *filterTextWidget = new QWidget; // contains the filter text + widget to delete whole filter + QHBoxLayout *filterTextLayout = new QHBoxLayout; + filterTextWidget->setLayout(filterTextLayout); + + pbDelete = new QPushButton(QStringLiteral("-")); + pbDelete->setToolTip(tr("Delete this attribute and all its values")); + pbDelete->setPalette(QPalette(QColor("red"))); + pbDelete->setMaximumWidth(30); + + lbFilterText = new QLabel; + + filterTextLayout->addWidget(lbFilterText, 0, Qt::AlignLeft); + filterTextLayout->addWidget(pbDelete, 1, Qt::AlignLeft); + + + QWidget *attributeValuesWidget = new QWidget; + attributeValuesLayout = new QVBoxLayout(); + attributeValuesWidget->setLayout(attributeValuesLayout); // add layout to widget + pbAddAttributeContainer = new QPushButton(tr("Add Value")); + pbAddAttributeContainer->setPalette(QPalette(QColor("green"))); + + // add all widgets to editing mode main widget + setLayout(editingModeLayout); + editingModeLayout->addWidget(filterTextWidget, 0, Qt::AlignTop); + + // horizontal line after filter text + QWidget *horizontalLineWidget = new QWidget; + horizontalLineWidget->setFixedHeight(2); + horizontalLineWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + horizontalLineWidget->setStyleSheet(QStringLiteral("background-color: #c0c0c0;")); + editingModeLayout->addWidget(horizontalLineWidget, 0, Qt::AlignTop); + + editingModeLayout->addWidget(pbAddAttributeContainer, 0, Qt::AlignTop | Qt::AlignLeft); + editingModeLayout->addWidget(attributeValuesWidget, 0, Qt::AlignTop); // add attribute values "list" to this, so it can be searched through for attribute values +} + +EditingModeUI::~EditingModeUI() +{ + const auto children = findChildren(); + for (auto child : children) + child->disconnect(this); +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.h new file mode 100755 index 000000000..d34a08792 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.h @@ -0,0 +1,50 @@ +/** + * @RDE_HEADER@ + * provides user-management for attributes for a filter in filter table entry + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + +#pragma once + +#include +#include + +class QLabel; +class QPushButton; +class QVBoxLayout; +namespace Timeline +{ +class DetailData; +class AbstractAttributeWidget; + + +class EditingModeUI : public QWidget +{ + Q_OBJECT +public: + explicit EditingModeUI(DetailData *detailData, const QString &attributeType, QWidget *parent); + ~EditingModeUI(); + + void addAttributeContainer(int eventType, const QString &initialValue = QString()); // 0 = default val (do not set -1 invalid !) + + QLabel *lbFilterText; + QPushButton *pbDelete; + QVBoxLayout *attributeValuesLayout; + QPushButton *pbAddAttributeContainer; // does not end this mode, adds an attribute container + +private: + Timeline::AbstractAttributeWidget *createAttributeUIWidget(DetailData *detailData, const QString &attributeType, + int eventType, const QString &initialValue); + +signals: + void signalChanges(); +private: + QString attributeType; + DetailData *m_detailData; + NGL::INGLLogger &m_logger; +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.cpp new file mode 100755 index 000000000..ff918a8df --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.cpp @@ -0,0 +1,80 @@ +/** + * @RDE_HEADER@ + * provides user-management for events for a filter in filter table entry + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "../detail_data.h" +#include "AttributeSelectionModeUI.h" +#include "logger.h" + +namespace Timeline +{ + +QComboBox *SelectionModeUI::createAttributesComboBox(int eventType) +{ + QComboBox *cbAttributes = new QComboBox(); + + // 1. get all event type's attribute types! + // 2. get all attribute type's attribute texts! getAttributeText(..) + + DetailData::AttributeEventLookup::AttributeList attributeList = m_detailData->attributeEventLookup.getEventsAttributeList(eventType); + + for (auto i = attributeList.constBegin(); i != attributeList.constEnd(); ++i) + { + const QString &attributeKey = m_detailData->attributeRedirectionLookup.getRedirection(*i); // key (derefd')! + + // Do not allow filtering for INTERPRETER_TYPE_NONE (e.g. Marker) + if (m_detailData->attributeInterpreterLookup.getInterpreterType(attributeKey) == DetailData::INTERPRETER_TYPE_NONE) + continue; + + QString cbAttribute = m_detailData->attributeTypeLookup.getAttributeText(attributeKey); + + if (cbAttribute.isEmpty()) + { + WARNING_LOG(m_logger) << "SelectionModeUI::createAttributesComboBox: event type " << eventType << " has no attribute text for attribute " << attributeKey << " for attribute event lookup - not added"; + } + else + { + cbAttributes->addItem(cbAttribute); + } + } + + return cbAttributes; +} + + +SelectionModeUI::SelectionModeUI(DetailData *detailData, const int eventType) + : eventType(eventType) + , m_detailData(detailData) + , m_logger(getLogger("EventFilter.AttributeEditingModeUI")) +{ + selectionModeWidget = new QWidget(); + selectionModeLayout = new QHBoxLayout(); + + lbFilterText = new QLabel(tr("Select attribute type to filter:")); + cbAttributeType = createAttributesComboBox(eventType); // create a combobox with all attributes for the given event type + + pbAddEditingMode = new QPushButton(tr("OK")); + pbAddEditingMode->setToolTip(tr("Add this attribute and start adding values")); + pbAddEditingMode->setPalette(QPalette(QColor("green"))); + pbAddEditingMode->setMaximumWidth(30); + + pbDeleteFilter = new QPushButton(QStringLiteral("-")); + pbDeleteFilter->setPalette(QPalette(QColor("red"))); + pbDeleteFilter->setToolTip(tr("Delete this attribute and all its values")); + pbDeleteFilter->setMaximumWidth(30); + + selectionModeLayout->addWidget(lbFilterText, 0, Qt::AlignCenter); + selectionModeLayout->addWidget(cbAttributeType, 0, Qt::AlignTop); + selectionModeLayout->addWidget(pbAddEditingMode, 0, Qt::AlignTop); + selectionModeLayout->addWidget(pbDeleteFilter, 1, Qt::AlignTop); + + selectionModeWidget->setLayout(selectionModeLayout); +} + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.h new file mode 100755 index 000000000..0b50dbc96 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.h @@ -0,0 +1,59 @@ +/** + * @RDE_HEADER@ + * provides user-management for events for a filter in filter table entry + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#pragma once + +#include + +#include +#include +#include +#include +#include + + +namespace Timeline +{ +class DetailData; + +class SelectionModeUI : public QObject +{ + Q_OBJECT +private: + SelectionModeUI &operator=(const SelectionModeUI &); // no implementation + +public: + QComboBox *createAttributesComboBox(int eventType); + + // >>>>>>> (EVENT_TYPE has (ATTRIBUTE_TYPE has (FilterData::ATTRIBUTE_UI_TYPE and POSSIBLE_VALUES))) + + explicit SelectionModeUI(DetailData *detailData, const int eventType); + + ~SelectionModeUI() + { + delete lbFilterText; + delete cbAttributeType; + delete pbAddEditingMode; + delete selectionModeLayout; + delete selectionModeWidget; + } + + int eventType; + QWidget *selectionModeWidget; + QHBoxLayout *selectionModeLayout; + QLabel *lbFilterText; + QComboBox *cbAttributeType; + QPushButton *pbAddEditingMode; + QPushButton *pbDeleteFilter; + DetailData *m_detailData; + NGL::INGLLogger &m_logger; +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.cpp new file mode 100755 index 000000000..3c201f103 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.cpp @@ -0,0 +1,334 @@ +/** + * @RDE_HEADER@ + * entry to manage a specific filter + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "FilterTableEntry.h" +#include "FilterTableEntryAttribute.h" +#include "interpreter/FilterWorker.h" +#include "../detail_data.h" +#include "logger.h" + +#include +#include +#include + +#include + + +namespace Timeline +{ + +FilterTableEntry::FilterTableEntry(DetailData *detailData, const int &eventType, const bool &active, QWidget *parent) // directly creates ftw with selected event type + : QGroupBox(parent) + , m_logger(getLogger("EventFilter.FilterTableEntry")) + , m_eventType(eventType) + + // ui + , m_mainLayout(new QVBoxLayout()) + , m_topLayout(new QHBoxLayout()) + , m_centerLayout(new QHBoxLayout()) + , m_cbEventSelector(nullptr) // prepare cb + , m_pbDelete(new QPushButton(QStringLiteral("-"))) + , m_pbFoundEvents(new QPushButton(tr("Show Events"))) + , m_pbFilterActive(new QPushButton(tr("Active"))) + , m_pbOK(new QPushButton(tr("OK"))) + , m_lbSelectText(new QLabel(tr("Select event type to filter:"))) + , m_detailData(detailData) +{ + m_cbEventSelector = getEventTypesComboBox(); + + m_pbDelete->setPalette(QPalette(QColor("red"))); + m_pbDelete->setToolTip(tr("Delete this filter and all its attributes")); + + m_pbFilterActive->setPalette(QPalette(QColor("orange"))); + m_pbFoundEvents->setPalette(QPalette(QColor("orange"))); + m_pbOK->setPalette(QPalette(QColor("green"))); + + m_pbOK->setToolTip(tr("Add this filter and start adding attributes (when needed)")); + connect(m_pbFilterActive, &QPushButton::clicked, this, &FilterTableEntry::signalChanges); + + // soft init: only init cb & ok-button (mini-selection mode) + + + setLayout(m_mainLayout); + + + // top layout + QWidget *topLayoutWidget = new QWidget(this); + //topLayoutWidget->setStyleSheet("background-color:#97B0CC"); //#D6FFFF;"); // layer 1 + + topLayoutWidget->setLayout(m_topLayout); + + m_mainLayout->addWidget(topLayoutWidget, 0, Qt::AlignTop); // add top widget with top alingment + + + // start mini-selection mode + m_topLayout->addWidget(m_lbSelectText, 0, Qt::AlignLeft); + m_topLayout->addWidget(m_cbEventSelector, 0, Qt::AlignLeft); + + m_pbOK->setMinimumWidth(30); + m_pbOK->setMaximumWidth(30); + m_topLayout->addWidget(m_pbOK, 0, Qt::AlignLeft); + connect(m_pbOK, &QPushButton::clicked, this, &FilterTableEntry::slotSelectEventType); // end selection mode => start editing mode + + connect(m_pbDelete, &QPushButton::clicked, this, &FilterTableEntry::deleteLater); + m_pbDelete->setMinimumWidth(30); + m_pbDelete->setMaximumWidth(30); + m_topLayout->addWidget(m_pbDelete, 1, Qt::AlignLeft); + + QWidget *centerLayoutWidget = new QWidget(this); + centerLayoutWidget->setStyleSheet(topLayoutWidget->styleSheet()); + centerLayoutWidget->setLayout(m_centerLayout); + m_mainLayout->addWidget(centerLayoutWidget, 0); + + if (m_eventType > -1) + slotSelectEventType(); // start making it a ready to use event filter for a specific event + + m_pbFoundEvents->setEnabled(active); + m_pbFilterActive->setCheckable(true); + m_pbFilterActive->setChecked(active); + m_pbFilterActive->setToolTip(m_pbFilterActive->isChecked() ? tr("Filter is active") : tr("Filter is inactive")); +} + +FilterTableEntry::~FilterTableEntry() +{ + const auto children = findChildren(); + for (auto child : children) + child->disconnect(this); +} + +void FilterTableEntry::updateData() +{ + for (int i = 0; i < m_centerLayout->count(); i++) + { + FilterTableEntryAttribute *ftec = dynamic_cast(m_centerLayout->itemAt(i)->widget()); // try to convert to fte + + if (!ftec) // not an ftec + { + WARNING_LOG(m_logger) << "FilterTableEntry::filterText(): !ftec"; + continue; + } + + ftec->updateData(m_detailData); + } +} + + +QComboBox *FilterTableEntry::getEventTypesComboBox() +{ + QComboBox *cbEventTypes = new QComboBox(); + cbEventTypes->addItems(m_detailData->eventTypeLookup.getEventTexts()); + cbEventTypes->model()->sort(0); + connect(cbEventTypes, static_cast(&QComboBox::currentIndexChanged), this, &FilterTableEntry::signalChanges); + + return cbEventTypes; +} + + +const QJsonObject FilterTableEntry::filter(bool typeSafe) const +{ + // get all attribute filters + + if (m_eventType == -1/* || !m_filterActive*/) + { + WARNING_LOG(m_logger) << "FilterTableEntry has no event type."; + //warn("fte: fte has no event type (still in selection mode?)"); + return {}; + } + + if (!m_centerLayout->count()) // if there are no children, do not worry, it should be possible to just filter by the event type + { + //info("fte: empty"); + } + + + QJsonObject result; + + QString eventTypeString; + + if (typeSafe) + eventTypeString = QString::number(m_eventType); + else + eventTypeString = m_detailData->eventTypeLookup.getEventText(m_eventType); // getEventTypeString(eventType); + + if (!eventTypeString.length()) + return QJsonObject(); + + //info("fte: event type #" + QString::number(eventType) + " = " + eventTypeString); + + + result[QStringLiteral("EventType")] = eventTypeString; + + QJsonArray attributes; + for (int i = 0; i < m_centerLayout->count(); i++) + { + FilterTableEntryAttribute *ftec = dynamic_cast(m_centerLayout->itemAt(i)->widget()); // try to convert to fte + + if (!ftec) // not an ftec + { + WARNING_LOG(m_logger) << "FilterTableEntry::filterText(): !ftec"; + continue; + } + + //info("fte: ftec found"); + + QJsonObject filterTile = ftec->filter(typeSafe); // the typeSafe parameter kills off the STR_COMPARE as we only safe ID's or ints, so do not implement it + + if (filterTile.isEmpty()) // ftec has no result, continue! + continue; + + attributes.append(filterTile); + } + + result[QStringLiteral("Attributes")] = attributes; + result[QStringLiteral("Active")] = m_pbFilterActive->isChecked(); + + return result; +} + + +void FilterTableEntry::slotSelectEventType() // end selection mode => start editing mode +{ + delete m_lbSelectText; // delete help text (not needed anymore) + + // end selection mode + if (m_cbEventSelector) // if there are no attribute filters yet.. + { + if (m_eventType == -1) // do not reload if already set (set by constructor when set-function is used) + { + m_eventType = m_detailData->eventTypeLookup.getEventType(m_cbEventSelector->currentText()); // DOES NOT WORK ANYMORE: m_cbEventSelector->currentIndex(); + } + + m_lbEventName = new QLabel(QString(tr("Filter by event type: %1")).arg(m_detailData->eventTypeLookup.getEventText(m_eventType))); //m_cbEventSelector->currentText()); // get event name + m_lbEventName->setMinimumWidth(m_cbEventSelector->width()); // gets the optics straight! FIXME: width was never set + + delete m_cbEventSelector; // event type is now fixed, replace cb with lb + m_cbEventSelector = nullptr; // don't forget to set to 0 or this if-clause can't see that cb is already deleted => crash + + m_topLayout->insertWidget(0, m_lbEventName); // add where the cb was + } + + if (m_eventType == -1) + { + WARNING_LOG(m_logger) << "slotSelectEventType: m_eventType == -1"; + return; + } + + delete m_pbOK; // delete ok button + + + + + // start editing mode + + // horizontal line under add button + QWidget *horizontalLineWidget = new QWidget(); + horizontalLineWidget->setFixedHeight(2); + horizontalLineWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + horizontalLineWidget->setStyleSheet(QStringLiteral("background-color: #c0c0c0;")); + m_mainLayout->insertWidget(1, horizontalLineWidget, 0, Qt::AlignTop); + + delete m_pbDelete; // must be recreated because of the stretch at the end whil in selection mode + m_pbDelete = new QPushButton(QStringLiteral("-")); + m_pbDelete->setToolTip(tr("Delete this filter and all its attributes")); + m_pbDelete->setPalette(QPalette(QColor("red"))); + connect(m_pbDelete, &QPushButton::clicked, this, &FilterTableEntry::deleteLater); + m_pbDelete->setMinimumWidth(30); + m_pbDelete->setMaximumWidth(30); + m_topLayout->addWidget(m_pbDelete, 0, Qt::AlignLeft); + + m_topLayout->addWidget(m_pbFilterActive, 0, Qt::AlignLeft); + connect(m_pbFilterActive, &QPushButton::clicked, this, &FilterTableEntry::slotFilterActiveClicked); + + connect(m_pbFoundEvents, &QPushButton::clicked, this, &FilterTableEntry::slotShowEvents); + m_pbFoundEvents->setToolTip(tr("Show all events that fit to this filter")); + m_topLayout->addWidget(m_pbFoundEvents, 1, Qt::AlignLeft); + + + + + // do not add attributes if there are none + DetailData::AttributeEventLookup::AttributeList attributeList = m_detailData->attributeEventLookup.getEventsAttributeList(m_eventType); + + + // remove unfilterables: + QMutableListIterator it(attributeList); + + while (it.hasNext()) + { + const QString attributeType = it.next(); + + if (m_detailData->attributeInterpreterLookup.getInterpreterType(attributeType) == DetailData::INTERPRETER_TYPE_NONE) + it.remove(); + } + + if (attributeList.isEmpty()) + return; + + + QPushButton *pbAddAttribute = new QPushButton(tr("Add Attribute")); + pbAddAttribute->setPalette(QPalette(QColor("green"))); + connect(pbAddAttribute, &QPushButton::clicked, this, &FilterTableEntry::slotAddAttribute); + //pbAddFilter->setMinimumWidth(30); + //pbAddFilter->setMaximumWidth(30); + m_mainLayout->insertWidget(2, pbAddAttribute, 0, Qt::AlignLeft); +} + + +void FilterTableEntry::slotShowEvents() +{ + QJsonArray a; + a.append(filter(true /* type safe! */)); + emit signalShowEvents(a); +} + + +void FilterTableEntry::slotFilterActiveClicked() +{ + if (m_pbFilterActive->isChecked()) + { + m_pbFilterActive->setPalette(QPalette(QColor("orange"))); + m_pbFilterActive->setToolTip(tr("Filter is active")); + m_pbFoundEvents->setPalette(QPalette(QColor("orange"))); + m_pbFoundEvents->setEnabled(true); + } + else + { + m_pbFilterActive->setPalette(QPalette(QColor("grey"))); + m_pbFilterActive->setToolTip(tr("Filter is inactive")); + m_pbFoundEvents->setPalette(QPalette(QColor("grey"))); + m_pbFoundEvents->setEnabled(false); + } +} + + +void FilterTableEntry::slotAddAttribute() +{ + addAttribute(); +} + + +bool FilterTableEntry::hasAttributes() const +{ + qWarning() << "hasAttributes? children: " << m_centerLayout->children().count(); + return !!m_centerLayout->children().count(); +} + + +FilterTableEntryAttribute *FilterTableEntry::addAttribute(const QString &attributeType) +{ + FilterTableEntryAttribute *ftec = new FilterTableEntryAttribute(m_detailData, m_eventType, attributeType, this); + connect(ftec, &FilterTableEntryAttribute::signalChanges, this, &FilterTableEntry::signalChanges); + connect(ftec, &FilterTableEntryAttribute::destroyed, this, &FilterTableEntry::signalChanges); + m_centerLayout->insertWidget(0, ftec, 1, Qt::AlignLeft); // add all FTECs to the left + + return ftec; +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.h new file mode 100755 index 000000000..35a0c86f0 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.h @@ -0,0 +1,84 @@ +/** + * @RDE_HEADER@ + * entry to manage a specific filter + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#pragma once + +#include "FilterTableEntryAttribute.h" + +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace Timeline +{ +class DetailData; + +class FilterTableEntry : public QGroupBox //QWidget +{ + Q_OBJECT + +public: + explicit FilterTableEntry(DetailData *detailData, const int &eventType = -1, const bool &active = true, QWidget *parent = nullptr); + ~FilterTableEntry(); + const QJsonObject filter(bool typeSafe = false) const; + /** + * @brief addFilter adds a filter to the filter table layout and returns the new pointer (for set-functionality) + * @return new created ftw pointer + */ + FilterTableEntryAttribute *addAttribute(const QString &attributeType = QString()); + bool hasAttributes() const; + void updateData(); + + +private: + NGL::INGLLogger &m_logger; + QComboBox *getEventTypesComboBox(); + + int m_eventType; + + // ui + QVBoxLayout *m_mainLayout{nullptr}; // for topLayout, + QHBoxLayout *m_topLayout{nullptr}; // for event, delete, show events + QHBoxLayout *m_centerLayout{nullptr}; // for many filtering types + QComboBox *m_cbEventSelector{nullptr}; + QLabel *m_lbEventName{nullptr}; + QPushButton *m_pbDelete{nullptr}; + QPushButton *m_pbFoundEvents{nullptr}; + QPushButton *m_pbFilterActive{nullptr}; + QPushButton *m_pbOK{nullptr}; + QLabel *m_lbSelectText{nullptr}; + DetailData *m_detailData{nullptr}; + +signals: + void signalShowEvents(const QJsonArray &filter); // provided by filter text (use filter, get all fitting events by setting SHOW/HIDE to false and returning only the list of affected events) + void signalChanges(); + +private slots: + void slotAddAttribute(); + void slotFilterActiveClicked(); + void slotSelectEventType(); + void slotShowEvents(); + +public slots: + /** + * @brief slotSetFoundEventsCount sets the variable for how much events could be found with this filter (called by parent, holding this fte) + * @param foundEvents count of events found with this filter + */ + + //void slotSetFoundEventsCount(int foundEvents); +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.cpp new file mode 100755 index 000000000..6e3fe7eda --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.cpp @@ -0,0 +1,244 @@ +/** + * @RDE_HEADER@ + * attribute entry to manage a specific attribute + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "interpreter/FilterWorker.h" +#include "FilterTableEntryAttribute.h" +#include "widgets/AbstractAttributeWidget.h" +#include "logger.h" +#include "../detail_data.h" + +#include +#include +#include + + +namespace Timeline +{ + +FilterTableEntryAttribute::FilterTableEntryAttribute(DetailData *detailData, int eventType, const QString &attributeType, QWidget *parent) + : QGroupBox(parent) + , m_eventType(eventType) + , m_attributeType(attributeType) // CAN be invalid + , m_selectionModeUI(nullptr) + , m_editionModeUI(nullptr) + , m_attributesLayout(new QVBoxLayout()) + , m_detailData(detailData) + , m_logger(getLogger("EventFilter.FilterTableEntryAttribute")) +{ + //this->setStyleSheet("background-color:#436C99;"); // layer 2 + this->setTitle(QString()); + + setLayout(m_attributesLayout); + + + /* Selection Mode Explanation: + * + * 1. Mode: Empty Mode DEPRECATED & DELETED! + * + * > Empty Widget + * > PushButton "+" to end Empty Mode and goto Selection Mode + * > goes onto 2. Mode + * + * + * 2. Mode: Selection Mode + * + * > ComboBox with Event-specific types: (Munition, Players, etc.) + * > PushButton "+" to END Selection Mode (turns ComboBox to QLabel, so that Event-specific Type is FIXED) + * + * + * 3. Mode: Editing Mode + * + * > Useable Widget + * > Label with chosen Event-specific Type + * > ComboBox with Type-specific attributes: (adding Munition-Types if the Event-specific type was Munition) + * >> (has to load Type-specific attributes relating to the selected Event-specific type! Munition -> Munition types) + * > PushButton "+" to add another Type-specific attribute: + * >> adds another ComboBox and PushButton for further adding more attributes + * + */ + + + //setStyleSheet("FilterTableEntryAttribute { border: 1px solid black }"); + + slotAddSelectionMode(); + + if (!attributeType.isEmpty()) + { + m_selectionModeUI->cbAttributeType->setCurrentIndex(m_selectionModeUI->cbAttributeType->findData(QVariant::fromValue(attributeType))); // set initial value by id + slotAddEditingMode(false); + } +} + +FilterTableEntryAttribute::~FilterTableEntryAttribute() +{ + delete m_editionModeUI; // not a widget, not parented +} + +void FilterTableEntryAttribute::updateData(DetailData *detailData) +{ + if (!m_editionModeUI) + return; + + for (int i = 0; i < m_editionModeUI->attributeValuesLayout->count(); i++) // now get values for attribute value(s) list (from attribute layout, only available in editing mode) + { + AbstractAttributeWidget *aaw = /*qobject_cast*/dynamic_cast(m_editionModeUI->attributeValuesLayout->itemAt(i)->widget()); + + if (!aaw) // not a aaw derived class + continue; + + aaw->updateData(detailData); + connect(aaw, &AbstractAttributeWidget::deleteClicked, this, [this]() + { + emit attributeChanged(false); + }); + } +} + + +const QJsonObject FilterTableEntryAttribute::filter(bool typeSafe) const // ftea alias "ftec" +{ + if (m_attributeType.isEmpty()) + { + WARNING_LOG(m_logger) << "filterText: m_attributeType == -1"; + //warn("ftec: missing attribute type while getting filter text from attribute (still in selection mode?)"); + return QJsonObject(); + } + + + QString attributeTypeName; + + if (typeSafe) + attributeTypeName = m_attributeType; + else + { + attributeTypeName = m_detailData->attributeTypeLookup.getAttributeText(m_attributeType); //getAttributeTypeString(m_attributeType); + } + + if (attributeTypeName.isEmpty()) + { + WARNING_LOG(m_logger) << "filterText: !attributeTypeName.length()"; + //warn("ftec: missing attribute text while getting filter text from attribute"); + return QJsonObject(); + } + + + QJsonObject result; + result[QStringLiteral("AttributeType")] = attributeTypeName; + + // translate all attributes + their value(s) + // must be: * Attributes : [Attr Type]{[Attr Value],[Attr Value], ...} + + + QJsonArray values; + + if (m_editionModeUI) + { + for (int i = 0; i < m_editionModeUI->attributeValuesLayout->count(); i++) // now get values for attribute value(s) list (from attribute layout, only available in editing mode) + { + AbstractAttributeWidget *aaw = /*qobject_cast*/dynamic_cast(m_editionModeUI->attributeValuesLayout->itemAt(i)->widget()); + + if (!aaw) // not a aaw derived class + continue; + + //info("ftec: aaw derived class found"); + + QString value = aaw->filterText(typeSafe); // ishygddt without a derived class + + if (value.isEmpty()) + continue; + + values.append(value); + } + } + + + result[QStringLiteral("AttributeValues")] = values; + + return result; +} + +void FilterTableEntryAttribute::slotAddSelectionMode() +{ + // end Empty Mode + /*if (!m_emptyModeUI) + return; + + delete m_emptyModeUI; + m_emptyModeUI = 0;*/ + + // 2. Mode: Selection Mode + m_selectionModeUI = new SelectionModeUI(m_detailData, m_eventType); + + connect(m_selectionModeUI->pbAddEditingMode, &QPushButton::clicked, this, &FilterTableEntryAttribute::slotAddEditingMode); + connect(m_selectionModeUI->pbDeleteFilter, &QPushButton::clicked, this, &FilterTableEntryAttribute::slotDeleteAttributeContainer); + + m_attributesLayout->addWidget(m_selectionModeUI->selectionModeWidget, 0, Qt::AlignTop); +} + +void FilterTableEntryAttribute::slotAddEditingMode(bool createBlankContainer) +{ + // end selection mode + if (!m_selectionModeUI) + return; + + // 3. Mode: Editing Mode + QString attributeTypeString; + + if (m_attributeType.isEmpty()) // get text from combobox, when attribute type not given + { + attributeTypeString = m_selectionModeUI->cbAttributeType->currentText(); + m_attributeType = m_detailData->attributeTypeLookup.getAttributeType(attributeTypeString); + } + else // get text from filter data, when attribute type given by set-function + { + attributeTypeString = m_detailData->attributeTypeLookup.getAttributeText(m_attributeType); + // do not set attribute type when it is already given! + } + + delete m_selectionModeUI; + m_selectionModeUI = nullptr; + + if (m_attributeType.isEmpty()) + { + WARNING_LOG(m_logger) << "slotAddEditingMode: invalid attribute type string!"; + return; + } + + m_editionModeUI = new EditingModeUI(m_detailData, m_attributeType, nullptr); // munition + + connect(m_editionModeUI, &EditingModeUI::signalChanges, this, &FilterTableEntryAttribute::signalChanges); + connect(m_editionModeUI, &EditingModeUI::destroyed, this, &FilterTableEntryAttribute::signalChanges); + + connect(m_editionModeUI->pbAddAttributeContainer, &QPushButton::clicked, this, &FilterTableEntryAttribute::slotAddAttributeContainer); + connect(m_editionModeUI->pbDelete, &QPushButton::clicked, this, &FilterTableEntryAttribute::slotDeleteAttributeContainer); + m_editionModeUI->lbFilterText->setText(tr("Filter by attribute type: %1").arg(attributeTypeString)); + + m_attributesLayout->addWidget(m_editionModeUI, 0, Qt::AlignTop); + + // add first attribute container to events layout + if (createBlankContainer) + slotAddAttributeContainer(); +} + +void FilterTableEntryAttribute::slotDeleteAttributeContainer() // delete attribute (munition, player, etc.) +{ + emit attributeChanged(false); + deleteLater(); +} + +void FilterTableEntryAttribute::slotAddAttributeContainer() +{ + emit signalChanges(); + emit attributeChanged(true); + if (m_editionModeUI != nullptr) + m_editionModeUI->addAttributeContainer(m_eventType); +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.h new file mode 100755 index 000000000..4901f2d88 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.h @@ -0,0 +1,59 @@ +/** + * @RDE_HEADER@ + * attribute entry to manage a specific attribute + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#pragma once + +#include "AttributeEditingModeUI.h" +#include "AttributeSelectionModeUI.h" +#include + +class QLabel; +class QVBoxLayout; +namespace Timeline +{ +class DetailData; + +class FilterTableEntryAttribute : public QGroupBox //QWidget +{ + Q_OBJECT + +public: + explicit FilterTableEntryAttribute(DetailData *detailData, int eventType, const QString &attributeType, QWidget *parent = nullptr); + ~FilterTableEntryAttribute(); + const QJsonObject filter(bool typeSafe = false) const; + void updateData(DetailData *detailData); + + int m_eventType; + QString m_attributeType; + + // ui + //EmptyModeUI* m_emptyModeUI; + SelectionModeUI *m_selectionModeUI; + EditingModeUI *m_editionModeUI; + + QVBoxLayout *m_attributesLayout; + QLabel *m_lbSelectText; + DetailData *m_detailData; + +signals: + void signalChanges(); + void attributeChanged(const bool &hasAttribute); + +private: + NGL::INGLLogger &m_logger; + +private slots: + void slotAddAttributeContainer(); + void slotDeleteAttributeContainer(); // delete attribute (munition, player, etc.) + void slotAddSelectionMode(); // to end Empty Mode + void slotAddEditingMode(bool createBlankContainer = true); // to end Selection Mode +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.cpp new file mode 100755 index 000000000..014f4ea8a --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.cpp @@ -0,0 +1,326 @@ +/** + * @RDE_HEADER@ + * table widget to manage filters + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "FilterWindow.h" +#include "ui_FilterWindowUi.h" +#include "FilterTableEntry.h" +#include "interpreter/FilterWorker.h" +#include "../detail_data.h" +#include "logger.h" +#include + +#include +#include +#include +#include +#include + +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) +#include +#endif + + +#include + + +namespace Timeline +{ + +FilterWindow::FilterWindow(DetailData *detailData, + const std::shared_ptr &flmIfc, + LtsSession::LtsSession *session, + QWidget *parent) + : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel) + , m_flmIfc(flmIfc) + , m_ui(new Ui::FilterWindow) + , updateTimer(new QTimer(this)) + , m_detailData(detailData) + //, m_filterWorker(new FilterWorker(detailData)) + , m_logger(getLogger("EventFilter.FilterWindow")) + , m_session(session) +{ + m_ui->setupUi(this); + setMinimumSize(1500, 800); + + m_buttonBox->getButton(LtsWidgets::DialogButton::Ok)->hide(); + + m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, + this, &FilterWindow::slotAddNewFilter); + + m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, + this, &FilterWindow::slotShowEvents); + + m_buttonBox->connectButton(LtsWidgets::DialogButton::Save, + this, &FilterWindow::slotSave); + + m_buttonBox->connectButton(LtsWidgets::DialogButton::Load, + this, &FilterWindow::slotLoad); + +// m_buttonBox->connectButton(LtsWidgets::DialogButton::Hide, +// this, &FilterWindow::slotHide); + + + // UPDATER + connect(updateTimer, &QTimer::timeout, this, &FilterWindow::slotUpdate); + updateTimer->setInterval(5000); + updateTimer->start(); + +// // HACK: but works good for FAT +// QTimer *hack = new QTimer(this); +// hack->setInterval(750); +// // NOTE: super difficult to track changes, so make apply always available +// connect(hack, &QTimer::timeout, this, &FilterWindow::slotChangesMade); +// hack->start(); + + setOnlineHelpFilename(QStringLiteral("Timeline-Filter_Functions")); +} + + +FilterWindow::~FilterWindow() +{ + const QList lst = findChildren(); + for (FilterTableEntry *fte : lst) + fte->disconnect(this); + updateTimer->stop(); + delete m_ui; +} + + +void FilterWindow::retranslate() +{ + translate(m_ui, tr("Filters")); + + m_buttonBox->getButton(LtsWidgets::DialogButton::Add)->setText(tr("Add Filter")); + m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setText(tr("Show Events")); +} + + +void FilterWindow::slotSave() +{ + int fileId = m_flmIfc->saveFileContent(this, FileManagement::FileType::Xml, m_session->exerciseId(), + filterToDoc(exportFilter())); + if (fileId > 0) + { + DEBUG_LOG(m_logger) << "Saved file with id = " << fileId; + __unchange__(); + } + else + ERROR_LOG(m_logger) << "Could not save file in library "; +} + + +void FilterWindow::slotUpdate() +{ + for (int i = 0; i < m_ui->filterContainer->count(); i++) + { + FilterTableEntry *fte = qobject_cast(m_ui->filterContainer->itemAt(i)->widget()); // try to convert to fte + + if (!fte) // not an fte (e.g. ignore add button) + continue; + + fte->updateData(); + } +} + + +FilterTableEntry *FilterWindow::addNewFilter(const int eventType, bool active) +{ + FilterTableEntry *fte = new FilterTableEntry(m_detailData, eventType, active, this); + + connect(fte, &FilterTableEntry::signalChanges, this, &FilterWindow::slotChangesMade); + connect(fte, &FilterTableEntry::destroyed, this, &FilterWindow::slotChangesMade); + connect(fte, &FilterTableEntry::signalShowEvents, this, &FilterWindow::signalShowEvents); + //m_ui->filterContainer->insertWidget(1, fte); // after the ADD button ! + m_ui->filterContainer->addWidget(fte); + + slotChangesMade(); + + return fte; +} + + +void FilterWindow::slotAddNewFilter() +{ + addNewFilter(); +} + + +const QJsonArray FilterWindow::exportFilter() const +{ + if (!m_ui->filterContainer->count()) + return QJsonArray(); + + QJsonArray result; + + for (int i = 0; i < m_ui->filterContainer->count(); i++) + { + FilterTableEntry *fte = qobject_cast(m_ui->filterContainer->itemAt(i)->widget()); // try to convert to fte + + if (!fte) // not an fte (e.g. ignore add button) + continue; + + const QJsonObject filterTile = fte->filter(true /* type safe !! */); + if (filterTile.isEmpty()) // fte has no result, continue! + continue; + + result.append(filterTile); + } + + //filterTextEdit->setText(filterText); + qWarning() << "filter text:" << result; + + return result; +} + + +const QByteArray FilterWindow::filterToDoc(const QJsonArray &flt) +{ + QJsonObject obj; + obj[QStringLiteral("XmlType")] = FileManagement::toString(FileManagement::XmlType::TLNTimelineFilter); + obj[QStringLiteral("Filter")] = flt; + + QJsonDocument doc(obj); + return doc.toJson(QJsonDocument::Compact); +} + +bool FilterWindow::apply() +{ + slotApplyFilter(); + return true; +} + + +void FilterWindow::aboutToClose() +{ + //emit signalApplyFilter(QString()); +} + + +void FilterWindow::slotApplyFilter() +{ + emit signalApplyFilter(exportFilter()); + //emit signalChangesMade(); // => slotChangesMade(); // NOTE: super difficult to track changes, so make apply always available +} + + +void FilterWindow::slotShowEvents() +{ + emit signalShowEvents(exportFilter()); +} + + +void FilterWindow::slotLoad() +{ + QByteArray content; + int fileId = m_flmIfc->loadFileContent(this, content, {FileManagement::FileType::Xml}, m_session->exerciseId(), FileManagement::toString(FileManagement::XmlType::TLNTimelineFilter)); + if (fileId > 0) + { + // first ask if filters can be replaced by loaded ones + int msgResult = QMessageBox::question(this, + tr("Load filter set"), + tr("Do you really want to discard current filter set to load the requested filter set?\n" + "\n" + "Yes, discard current filter set and load a filter set.\n" + "No, do not make any changes."), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No); + + if (msgResult != QMessageBox::Yes) + return; + + if (!m_flmIfc->isXmlType(content, FileManagement::toString(FileManagement::XmlType::TLNTimelineFilter))) + { + QHash texts({{LtsWidgets::Button::Yes, tr("Ok")}}); + LtsWidgets::LtsMessageDialog::showMessage(this, + tr("Invalid xml file content"), + windowTitle(), + LtsWidgets::Behaviour::Modal, + LtsWidgets::Button::Yes, + texts); + } + else + { + const QJsonDocument doc(QJsonDocument::fromJson(content)); + const QJsonObject obj(doc.object()); + const QJsonArray tlnFilter(obj.value(QStringLiteral("Filter")).toArray()); + + loadFilters(tlnFilter); + slotChangesMade(); + } + } +} + + +bool FilterWindow::loadFilters(const QJsonArray &filter) +{ + setUnchangeable(); + + // call setUnchangeable(false) before the scope (whenever) of this fn endsq +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) + auto unchangableReset = qScopeGuard([this] { setUnchangeable(false); }); +#else + std::shared_ptr unchangeableReset(nullptr, [this](int *) { setUnchangeable(false); }); +#endif + + + // get model filter lsit by filter text + FilterWorker::GetModelFilterListResult result = FilterWorker::getModelFilterList(m_detailData, filter, true); + if (!FilterWorker::getInstance()->handleResultValues(result.resultValueList, this, true)) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("The selected filter set is invalid and cannot be loaded."), tr("Cannot load filter")); + return false; + } + + + // now, after we know that the filter set is valid: first remove all old filters from Filter Set + while (m_ui->filterContainer->count()) + { + delete m_ui->filterContainer->itemAt(0)->widget(); // delete (removes them from the layout automatically) + } + + + const ModelFilterList &modelFilterList = result.result; + + // now create all new filters and add to laoyut + int lastEventType = -1; + FilterTableEntry *lastFTW = nullptr; + + QString lastAttributeType; // empty = events only + FilterTableEntryAttribute *lastFTEA = nullptr; + + for (const FilterWorker::ModelFilter &mf : modelFilterList) + { + if (lastEventType != mf.eventType || lastEventType == -1 || !lastFTW) // create a new FTE when we are not the same event type anymore (or there never was a fte) + { + lastEventType = mf.eventType; + lastFTW = addNewFilter(mf.eventType, mf.active); // create a new event filter + } + + if (mf.attributeType == QString()) // attribute type 0 = EVENT_ONLY (create event, but do not add attribute entry ! + continue; + + if (lastAttributeType != mf.attributeType || lastAttributeType.isEmpty() || !lastFTEA) + { + lastAttributeType = mf.attributeType; + lastFTEA = lastFTW->addAttribute(mf.attributeType); // create a new attribute filter + } + + EditingModeUI *emui = lastFTEA->m_editionModeUI; + + if (!emui) + continue; + + emui->addAttributeContainer(mf.eventType, mf.attributeValue); // create a new attribute container witht he given value + } + + return true; +} + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.h new file mode 100755 index 000000000..b4a12821d --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.h @@ -0,0 +1,88 @@ +/** + * @RDE_HEADER@ + * table widget to manage filters + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + +#pragma once + +#include +#include +#include +#include + +#include +#include + + + +namespace Ui +{ +class FilterWindow; +} + + +namespace Timeline +{ +class DetailData; +class FilterTableEntry; +class FilterWorker; + +class FilterWindow : public LtsWidgets::LtsDialog +{ + Q_OBJECT +public: + explicit FilterWindow(DetailData *detailData, + const std::shared_ptr &flmIfc, + LtsSession::LtsSession *session, + QWidget *parent = nullptr); + ~FilterWindow(); + FilterTableEntry *addNewFilter(const int eventType = -1, bool active = true); // invalid + + //void addFilterToTable(const NGLDAO::EventFilter &eventFilter); + void clearSavedFiltersList(); + void updateData(); + const QJsonArray exportFilter() const; + const QByteArray filterToDoc(const QJsonArray &flt); + bool loadFilters(const QJsonArray &filter); + +private: + void retranslate() override; + bool apply() override; + void aboutToClose() override; + + std::shared_ptr m_flmIfc; + Ui::FilterWindow *m_ui; + QTimer *updateTimer; + DetailData *m_detailData; + //FilterWorker *m_filterWorker; + NGL::INGLLogger &m_logger; + LtsSession::LtsSession *m_session; + +signals: + void signalConvertFilterText(const QString &); + void signalShowEvents(const QJsonArray &events); + void signalApplyFilter(const QJsonArray &filter); + void signalReloadSavedFiltersList(); + void signalDeleteFilter(int); + void signalReplaceFilter(int); + void signalReplaceFilterNow(int, const QString &); + //void signalFilterInTableChanged(const NGLDAO::EventFilter &); // redirection + //void signalNewFilter(const NGLDAO::EventFilter &); // redirection + +public slots: + void slotLoad(); + void slotSave(); + void slotUpdate(); + void slotAddNewFilter(); + +private slots: + void slotApplyFilter(); + void slotShowEvents(); + +}; + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.cpp new file mode 100755 index 000000000..87ffaf7e0 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.cpp @@ -0,0 +1,309 @@ +/** + * @RDE_HEADER@ + * equations methods for filter/interpreter + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "logger.h" +#include "FilterEquationFunctions.h" +#include "FilterValueInterpreter.h" +#include "../../detail_data.h" + +#include +#include +#include + +namespace Timeline +{ +static bool inTime(DetailData *detailData, const QVariant &value, const QString &interpreterText) +{ + NGL::INGLLogger &logger(getLogger("FilterEquationFunctions")); + bool ok = false; + + unsigned int time = value.toUInt(&ok); + + if (!ok) + { + WARNING_LOG(logger) << "inTime: value error!" << value.toString(); + return false; + } + + InterpreterResult ir = interpretValue(detailData, DetailData::INTERPRETER_TYPE_RANGE, interpreterText); + + if (ir.resultType == InterpreterResult::InterpreterResultTypes::RESULT_SUCCESS && ir.resultList.count() == 2) + { + bool ok1 = false; + bool ok2 = false; + + unsigned int t1 = ir.resultList.at(0).toUInt(&ok1); + unsigned int t2 = ir.resultList.at(1).toUInt(&ok2); + + if (ok1 && ok2 && t1 <= time && t2 >= time) + { + return true; + } + } + + return false; +} + + +// Detail Data Filter Text +static bool inArea(DetailData *detailData, const QVariant &value, const QString &interpreterText) +{ + NGL::INGLLogger &logger(getLogger("FilterEquationFunctions")); + (void)detailData; + + QStringList areaValuesList = value.toString().split(QLatin1Char('x')); + + if (areaValuesList.count() != 2) + { + WARNING_LOG(logger) << "inArea: areaValuesList.count() != 2 (" << areaValuesList.count() << ")"; + return false; + } + + QStringList interpreterValuesList = interpreterText.split(QLatin1Char('x')); + + if (interpreterValuesList.count() != 4) + { + WARNING_LOG(logger) << "inArea: interpreterValuesList.count() != 4 (" << interpreterValuesList.count() << ")"; + return false; + } + + bool nb = false; + int n = areaValuesList.at(0).toInt(&nb); + + bool ob = false; + int o = areaValuesList.at(1).toInt(&ob); + + + bool n1b = false; + int n1 = interpreterValuesList.at(0).toInt(&n1b); + + bool n2b = false; + int n2 = interpreterValuesList.at(1).toInt(&n2b); + + bool o1b = false; + int o1 = interpreterValuesList.at(2).toInt(&o1b); + + bool o2b = false; + int o2 = interpreterValuesList.at(3).toInt(&o2b); + + + + /*/ Y + * | N1 + * O1 | + * ----------- X + * | O2 + * N2 | + /*/ + + + + if (!nb || !ob || !n1b || !n2b || !o1b || !o2b) + { + WARNING_LOG(logger) << "inArea: !nb || !ob || !n1b || !n2b || !o1b || !o2b"; + return false; + } + + + QRect range; + range.adjust(o1, n1, o2, n2); + + if (range.contains(o, n)) + { + WARNING_LOG(logger) << "inArea: in area!"; + return true; + } + + WARNING_LOG(logger) << "inArea: not in area"; + return false; +} + + +static bool inRad(DetailData *detailData, const QVariant &value, const QString &interpreterText) +{ + NGL::INGLLogger &logger(getLogger("FilterEquationFunctions")); + (void)detailData; + + QStringList radValuesList = value.toString().split(QLatin1Char('x')); + + if (radValuesList.count() != 2) + { + WARNING_LOG(logger) << "inRad: radValuesList.count() != 2 (" << radValuesList.count() << ")"; + return false; + } + + QStringList interpreterValuesList = interpreterText.split(QLatin1Char('x')); + + if (interpreterValuesList.count() != 3) + { + WARNING_LOG(logger) << "inArea: interpreterValuesList.count() != 3 (" << interpreterValuesList.count() << ")"; + return false; + } + + bool nb = false; + int n = radValuesList.at(0).toInt(&nb); + + bool ob = false; + int o = radValuesList.at(1).toInt(&ob); + + + bool n1b = false; + int n1 = interpreterValuesList.at(0).toInt(&n1b); + + bool o1b = false; + int o1 = interpreterValuesList.at(1).toInt(&o1b); + + bool r1b = false; + int r1 = interpreterValuesList.at(2).toInt(&r1b); + + + + /*/ Y + * | 'C' = center + * = '=' = radius + * ---==C==--- X + * = + * | + /*/ + + + + if (!nb || !ob || !n1b || !o1b || !r1b) + { + WARNING_LOG(logger) << "inRad: !nb || !ob || !n1b || !o1b || !r1b"; + return false; + } + + + QRect range; + range.adjust(o1 - r1, n1 - r1, o1 + r1, n1 + r1); + + if (range.contains(o, n)) + { + WARNING_LOG(logger) << "inRad: in radius!"; + return true; + } + + WARNING_LOG(logger) << "inRad: not in radius"; + return false; +} + + +static bool isIntEqual(DetailData *detailData, const QVariant &value, const QString &interpreterText) // filter for 0 ? +{ + NGL::INGLLogger &logger(getLogger("FilterEquationFunctions")); + (void)detailData; + + bool ok1 = false; + bool ok2 = false; + + //qWarning() << "isIntEqual: val1 =" << value << " val2 =" << interpreterText; + + int i1 = value.toInt(&ok1); + int i2 = interpreterText.toInt(&ok2); + + if (!ok1 || !ok2) + { + WARNING_LOG(logger) << "isIntEqual: STR to INT conversion error! ok1 (" << ok1 << ") ok2 (" << ok2 << ") value (" << value.toString() << ") intTxt (" << interpreterText << ")"; + } + + if (ok1 && ok2 && i1 == i2) + { + return true; + } + + return false; +} + + +bool checkValue(DetailData *detailData, int attributeInterpreterType, const QVariant &value, const QString &interpreterText) +{ + switch(attributeInterpreterType) + { + case DetailData::INTERPRETER_TYPE_TIME: + { + return inTime(detailData, value, interpreterText); // inTime is a range checker + } + + case DetailData::INTERPRETER_TYPE_AREA: + { + return inArea(detailData, value, interpreterText); + } + + case DetailData::INTERPRETER_TYPE_RAD: // TODO: test !! + { + return inRad(detailData, value, interpreterText); + } + + case DetailData::INTERPRETER_TYPE_STR_COMPARE: // TODO: rm - unused + { + //WARNING_LOG(logger) << "INTERPRETER_TYPE_STR_COMPARE value " << value.toString() << " text " << interpreterText; + + if (value.toString() == interpreterText) // ez + return true; + return false; + } + + case DetailData::INTERPRETER_TYPE_ID_COMPARE: + { + bool tryIt = isIntEqual(detailData, value, interpreterText); + + // NOTE: everything typesafe, ids only +// if (!tryIt) // means: cannot convert text OR is not equal; reason: is text OR is not equal; solution: probably value string - getIDKeyFromValue!! +// { +// int newTry = detailData->attributeValueLookup.getValueIDKeyFromValueString(attributeType, interpreterText); + +// if (newTry == -1) // not even a value string (solution does not work) +// { +// DEBUG_LOG(logger) << "checkValue: no key found"; +// tryIt = false; +// } +// else // okay, seems to be a value string +// { +// tryIt = isIntEqual(detailData, value, QString::number(newTry)); +// } +// } + + return tryIt; + } + + default: + { + /* attribute types with ui type for combobox can redirect unproblematically + * => attribute types with special ui type(s) should not be redirected + * so if the attempt to lookup a attribute interpreter type fails, try another lookup with redirection + * side effects can only happen if new attribute types are not completly integrated */ + + // TODO: endless loops possible in some way? + + +// QString newAttributeType = detailData->attributeRedirectionLookup.getRedirection(attributeType); + +// //qWarning() << "checkValue: newAttributeType" << newAttributeType << " attributeType" << attributeType; + +// if (newAttributeType != attributeType) // not equal = redirection +// { +// return checkValue(detailData, newAttributeType, value, interpreterText); // try again with redirected attribute type +// } + + //qWarning() << "checkValue: attribute type"<attributeInterpreterLookup.getInterpreterType(attributeType); // get interpretertype (e.g. for area_pos for pos) + return checkValue(detailData, attributeInterpreterType, value, interpreterText); +} + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.h new file mode 100755 index 000000000..fad73cb64 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.h @@ -0,0 +1,26 @@ +/** + * @RDE_HEADER@ + * equations methods for filter/interpreter + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#pragma once + + +class QVariant; +class QString; + +namespace Timeline +{ +class DetailData; + +namespace FilterEquationFunctions +{ + bool checkValue(DetailData *detailData, const QString &attributeType, const QVariant &value, const QString &interpreterText); +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.cpp new file mode 100755 index 000000000..aacff8a32 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.cpp @@ -0,0 +1,174 @@ +/** + * @RDE_HEADER@ + * interpreter for filter in excon model + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "FilterValueInterpreter.h" +#include "../../detail_data.h" + +#include +#include +#include + + +namespace Timeline +{ + +static InterpreterResult interpretAreaText(const QString &areaText) +{ + QStringList areaList = areaText.split(QLatin1Char('x')); + + if (areaList.count() != 4) // must be 4 values (N1, N2, O1, O2) + { + return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_AREATEXT_COUNT_NOT_FOUR); + } + + bool ok1 = false; + bool ok2 = false; + bool ok3 = false; + bool ok4 = false; + + int n1 = areaList.at(0).toInt(&ok1); + int n2 = areaList.at(1).toInt(&ok2); + int o1 = areaList.at(2).toInt(&ok3); + int o2 = areaList.at(3).toInt(&ok4); + + /*/ Y + * | N1 + * O1 | + * ----------- X + * | O2 + * N2 | + /*/ + + if (!ok1) // do not set coord if some value could nbot be converted + { + return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_AREATEXT_CANNOT_INTERPRET_N1); + } + + if (!ok2) + { + return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_AREATEXT_CANNOT_INTERPRET_N2); + } + + if (!ok3) + { + return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_AREATEXT_CANNOT_INTERPRET_O1); + } + + if (!ok4) + { + return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_AREATEXT_CANNOT_INTERPRET_O2); + } + + InterpreterResult ir(InterpreterResult::InterpreterResultTypes::RESULT_SUCCESS); + ir.resultList.append(QRect(o1, n1, o2, n2)); + return ir; +} + + + +static InterpreterResult interpretToInt(const QString &text) +{ + bool ok = false; + + int result = text.toInt(&ok); // add more informations like: INFO_INT_IS_NEGATIVE [if (result < 0)] if needed + + if (!ok) + { + return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_TOINT_CANNOT_INTERPRET_VALUE); + } + + InterpreterResult ir(InterpreterResult::InterpreterResultTypes::RESULT_SUCCESS); + ir.resultList.append(result); + return ir; +} + +static InterpreterResult interpretRangeText(const QString &rangeText) +{ + QStringList rangeList = rangeText.split(QLatin1Char('-')); // 123456789-123456900 (why does ('-') not work ???) + + if (rangeList.count() != 2) + { + return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_RANGETEXT_COUNT_NOT_TWO); + } + + bool ok1 = false; + bool ok2 = false; + + unsigned int t1 = rangeList.at(0).toUInt(&ok1); + unsigned int t2 = rangeList.at(1).toUInt(&ok2); + + if (!ok1) + { + return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_RANGETEXT_CANNOT_INTERPRET_T1); + } + + if (!ok2) + { + return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_RANGETEXT_CANNOT_INTERPRET_T2); + } + + if (t1 > t2) + { + return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_RANGETEXT_BEGIN_GREATER_THAN_END); + } + + InterpreterResult ir(InterpreterResult::InterpreterResultTypes::RESULT_SUCCESS); + ir.resultList.append(t1); + ir.resultList.append(t2); + + return ir; +} + + +InterpreterResult interpretValue(DetailData *detailData, int attributeInterpreterType, const QString &value) +{ + (void)detailData; + + switch (attributeInterpreterType) + { + case DetailData::INTERPRETER_TYPE_ID_COMPARE: + { + return interpretToInt(value); + } + + case DetailData::INTERPRETER_TYPE_RANGE: + { + return interpretRangeText(value); + } + + case DetailData::INTERPRETER_TYPE_AREA: + { + return interpretAreaText(value); + } + + // TODO: radius + + case DetailData::INTERPRETER_TYPE_STR_COMPARE: // TODO: rm - unused + { + InterpreterResult ir(InterpreterResult::InterpreterResultTypes::RESULT_SUCCESS); + ir.resultList.append(value); + return ir; + } + + default: + { + return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_ATTRIBUTE_HAS_NO_INTERPRETER); + } + } +} + + +InterpreterResult interpretValue(DetailData *detailData, const QString &attributeType, const QString &value) +{ + int interpreterType = detailData->attributeInterpreterLookup.getInterpreterType(attributeType); // -1 = invalid + return interpretValue(detailData, interpreterType, value); +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.h new file mode 100755 index 000000000..4b2bcce52 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.h @@ -0,0 +1,64 @@ +/** + * @RDE_HEADER@ + * interpreter for filter in excon model + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#pragma once + +#include +#include + + +namespace Timeline +{ +class DetailData; + +class InterpreterResult +{ +public: + enum class InterpreterResultTypes + { + RESULT_UNKNOWN, + RESULT_SUCCESS, + //RESULT_UNKNOWN_INTERPRETER_TYPE, + RESULT_ATTRIBUTE_HAS_NO_INTERPRETER, + + RESULT_RANGETEXT_COUNT_NOT_TWO, + RESULT_RANGETEXT_BEGIN_GREATER_THAN_END, + RESULT_RANGETEXT_CANNOT_INTERPRET_T1, + RESULT_RANGETEXT_CANNOT_INTERPRET_T2, + + RESULT_AREATEXT_COUNT_NOT_FOUR, + RESULT_AREATEXT_CANNOT_INTERPRET_N1, + RESULT_AREATEXT_CANNOT_INTERPRET_N2, + RESULT_AREATEXT_CANNOT_INTERPRET_O1, + RESULT_AREATEXT_CANNOT_INTERPRET_O2, + + RESULT_TOINT_CANNOT_INTERPRET_VALUE + }; + + explicit InterpreterResult(const InterpreterResult::InterpreterResultTypes &res) + : resultType(res) + { + } + + InterpreterResult() + : resultType(InterpreterResultTypes::RESULT_UNKNOWN) + { + } + + InterpreterResultTypes resultType; + QList additionalInformation; + + QList resultList; +}; + +InterpreterResult interpretValue(DetailData *detailData, int attributeInterpreterType, const QString &value); +InterpreterResult interpretValue(DetailData *detailData, const QString &attributeType, const QString &value); + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.cpp new file mode 100755 index 000000000..fe78e2727 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.cpp @@ -0,0 +1,319 @@ +/** + * @RDE_HEADER@ + * interpreter to convert text-filter to model filter + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "FilterWorker.h" +#include "InfoWindow.h" +#include "../../detail_data.h" + +#include +#include +#include +#include +#include + +#include + + +namespace Timeline +{ + +FilterWorker* FilterWorker::s_instance = nullptr; +FilterWorker* FilterWorker::getInstance() +{ + if (!s_instance) + { + s_instance = new FilterWorker(); + } + + return s_instance; +} + + +FilterWorker::~FilterWorker() +{ + //qWarning() << "~FilterWorker"; +} + + +void FilterWorker::deleteInstance() +{ + // TODO: rm +// if (s_instance) +// { +// delete s_instance; +// s_instance = 0; +// } +// else +// { +// //qWarning() << "~FilterWorker [no instance to delete!]"; +// } +} + + +FilterWorker::FilterWorker() +{ +#define addErrorHandler(x,y) { FilterWorker::ErrorHandler eh; eh.errorText = y; eh.errorParamCount = eh.errorText.split(QLatin1Char('%'), QString::SkipEmptyParts).count(); m_errorHandlerLookupMap.insert(x, eh); }(void)this + + + // WARNING: addErrorHandler auto discover paramCOunt: .find("%").count ! also, do not use single %'s more than once + addErrorHandler(GetModelFilterListResult::ERR_ATTRIBUTE_BLOCK_NOT_CLOSED, tr("Attribute block not closed: \n\'%1'")); + addErrorHandler(GetModelFilterListResult::ERR_ATTRIBUTE_HAS_NO_VALUES, tr("Attribute '%1' has no values")); + addErrorHandler(GetModelFilterListResult::ERR_COLON_MISUSE, tr("Colon misuse: \n\'%1'")); + addErrorHandler(GetModelFilterListResult::ERR_EVENT_HAS_NOT_ATTRIBUTE, tr("Attribute type '%1' does not belong to event type '%2': \n'%3'")); + addErrorHandler(GetModelFilterListResult::ERR_NO_EVENT_NAME, tr("No event name given for filter '%1'")); + addErrorHandler(GetModelFilterListResult::ERR_UNKNOWN_ATTRIBUTE_TYPE_BY_STRING, tr("Attribute type for '%1' does not exist")); + addErrorHandler(GetModelFilterListResult::ERR_UNKNOWN_EVENT_TYPE, tr("Event type '%1' does not exist")); + //addErrorHandler(GetModelFilterListResult::INFO_EVENT_ONLY_FILTER, tr("%1: Filtering by event type only")); + //addErrorHandler(GetModelFilterListResult::INFO_NO_FILTERS, tr("No filters selected - now resetting Timeline Filters")); + addErrorHandler(GetModelFilterListResult::ERR_VALUE_NOT_FOUND, tr("The attribute value '%1' is not a value of attribute type '%2'")); + addErrorHandler(GetModelFilterListResult::ERR_NO_VALUE_GIVEN, tr("There are no values given inside the brackets: \n'%1'")); + addErrorHandler(GetModelFilterListResult::ERR_TOO_MUCH_BRACKETS, tr("Too much brackets: \n'%1'")); +} + + +/* PRIVATE */ FilterWorker::Result makeResult(const int resultValue, const QString& additionalInformation = QString()) +{ + FilterWorker::Result result; + + result.resultValue = resultValue; + + if (!additionalInformation.isEmpty()) + { + result.additionalInformation.append(additionalInformation); + } + + return result; +} + + +/* PRIVATE */ FilterWorker::Result makeResult(const int resultValue, const QStringList& additionalInformationList) +{ + FilterWorker::Result result; + + result.resultValue = resultValue; + result.additionalInformation.append(additionalInformationList); + + return result; +} + + +FilterWorker::GetModelFilterListResult FilterWorker::getModelFilterList(DetailData *detailData, const QJsonArray &filter, bool fromTypeSafe) // returns a ResultStruct, as the user has to know WHAT failures he did when writing the filter text by himself! +{ + GetModelFilterListResult result; + + if (filter.isEmpty()) // no text, no filters + { + //result.resultValueList.append(makeResult(GetModelFilterListResult::ResultValues::INFO_NO_FILTERS)); + return result; + } + + for (auto i1 = filter.constBegin(); i1 != filter.constEnd(); ++i1) // seperate Event Type from Rest & get attribute list per event type >>> "Shot" "Munition{...},Bla{...},..." <<< + { + const QJsonObject ¤tFilter = (*i1).toObject(); + +//#warning TODO: used? +// if (currentFilter.isEmpty()) +// { +// result.resultValueList.append(makeResult(GetModelFilterListResult::ResultValues::ERR_NO_EVENT_NAME, +// QString::number(i1))); +// continue; +// } + +// if (currentFilter[QStringLiteral("Active")].toBool(false)) +// continue; + + QString eventTypeString = currentFilter[QStringLiteral("EventType")].toString(); // get event type string & look if event type string exists & get attribute keys for event type 0 = Event Type + int eventType = -1; + + if (fromTypeSafe) + { + bool ok = false; + eventType = eventTypeString.toInt(&ok); + if (!ok) + { + eventType = -1; + } + } + else + { + eventType = detailData->eventTypeLookup.getEventType(eventTypeString); // get event type by its string fromt he lookup list + } + + + QString eventTypeName = detailData->eventTypeLookup.getEventText(eventType); + if (!eventTypeName.isEmpty()) + eventTypeString = eventTypeName; + + + if (eventType == -1) + { + result.resultValueList.append(makeResult(GetModelFilterListResult::ResultValues::ERR_UNKNOWN_EVENT_TYPE, + eventTypeString)); + continue; + } + + + bool active = currentFilter[QStringLiteral("Active")].toBool(false); + const QJsonArray &attributes = currentFilter[QStringLiteral("Attributes")].toArray(); + + if (attributes.isEmpty()) // if there are NO attributes, then add this a event-only-filter + { + ModelFilter mf; // already done! + mf.eventType = eventType; + mf.attributeType = QString(); // aka 'ATTRIBUTE_TYPE_EVENT_ONLY' + mf.active = active; + //mf.attributeValue = 0; QString is invalid when created + result.result.append(mf); + + continue; // next! + } + + // otherwise.. is/are attribute(s) then must have one Event Type and the Attributes (as one) + + for (auto i2 = attributes.constBegin(); i2 != attributes.constEnd(); i2++) // process every value for that attribute + { + const QJsonObject &attribute = (*i2).toObject(); + QString attributeType = attribute[QStringLiteral("AttributeType")].toString(); // type => "GearType" + + if (!fromTypeSafe) + { + attributeType = detailData->attributeTypeLookup.getAttributeType(attributeType); // get attribute type by attribute type string + } + + + // NOTE: fix this in ngldao timeline, too + attributeType = detailData->attributeRedirectionLookup.getRedirection(attributeType); + + + if (attributeType.isEmpty()) // no attribute type found from attribute type string? next! + { + result.resultValueList.append(makeResult(GetModelFilterListResult::ResultValues::ERR_UNKNOWN_ATTRIBUTE_TYPE_BY_STRING, + attributeType)); + continue; + } + + // NOTE: fix this in ngldao timeline + + // TODO: FIXME: we must trust that the attribute type is in the event *for now*. Because there is no backwards-lookup from *redirected* attributes back to the original ! + + +// if (!detailData->attributeEventLookup.isAttributeInEvent(eventType, attributeType)) // check if event has that attribute +// { +// QStringList vl; +// vl.append(attributeTypeString); +// vl.append(eventTypeString); +// vl.append(currentFilterString); + +// result.resultValueList.append(makeResult(GetModelFilterListResult::ResultValues::ERR_EVENT_HAS_NOT_ATTRIBUTE, +// vl)); +// continue; +// } + + + // check if this is an pure string + int interpreterType = detailData->attributeInterpreterLookup.getInterpreterType(attributeType); + + if (interpreterType == DetailData::INTERPRETER_TYPE_NONE) + { + continue; // ignore, not filterable + } + + + const QJsonArray &attributeValues = attribute[QStringLiteral("AttributeValues")].toArray(); // values => "M3,M5, ..." + for (auto i3 = attributeValues.constBegin(); i3 != attributeValues.constEnd(); ++i3) + { + QString attributeValueString = (*i3).toString(); // get single value >>> "M3" <<< + + // remember: attribute value id is -2 for attribute types without entries in attribute value lookup <<<< Ist das noch so? + + ModelFilter mf; // create a model filter for every value + mf.eventType = eventType; + mf.attributeType = attributeType; + mf.active = active; + mf.attributeValue = attributeValueString; + result.result.append(mf); + +// qWarning() << "new model filter: event type " << eventType << " attr type " << attributeType << " attr val " << attributeValueString << " active " << mf.active; + } + } + } + + return result; +} + + +bool FilterWorker::handleResultValues(const QVector &resultList, QWidget* parentWidget, bool ignoreInfos) +{ + bool errorOccured = false; + InfoWindowEntryList iwel; + + for (int i = 0; i < resultList.count(); i++) + { + FilterWorker::Result result = resultList.at(i); + int resultValue = result.resultValue; + + if (!errorOccured && (resultValue & GetModelFilterListResult::ERR) == GetModelFilterListResult::ERR) // check if ERROR-bit is set (when there are no errors yet) + { + errorOccured = true; + } + + if (ignoreInfos && (resultValue & GetModelFilterListResult::INFO) == GetModelFilterListResult::INFO) + { + continue; + } + + + // lookup error handler + InfoWindowEntry iwe; + const ErrorHandler& eh = m_errorHandlerLookupMap.value(result.resultValue); + if (!eh.isValid()) + { + iwe.text = tr("Unhandled error (%1)"); + iwe.infoType = InfoWindowEntry::InfoTypes::Error; + iwel.append(iwe); + + continue; // cannot handle, handle next info + } + + + // add info to text + int additionalInformationCount = result.additionalInformation.count(); + QString iweText = eh.errorText; + + if (eh.errorParamCount) // only fill text if there is some text to fill with + { + for (int i2 = 0; i2 < eh.errorParamCount; i2++) // add every REQUESTED parameter by getting the value from the list (check if count is hogh enough, otherwise parameter will be '???') + { + if (additionalInformationCount >= eh.errorParamCount) // only add from addInfo list if the requested error param iterator < add info count ! + { + iweText = iweText.arg(result.additionalInformation.at(i2)); + } + else // add info is missing, fill with '???' + { + iweText = iweText.arg(QStringLiteral("???")); + } + } + } + + iwe.text = iweText; + iwel.append(iwe); + } + + + if (iwel.count()) + { + InfoWindow* iw = new InfoWindow(iwel, parentWidget); + iw->show(); + } + + return !errorOccured; // must return true if NO errors occured +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.h new file mode 100755 index 000000000..8e9075814 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.h @@ -0,0 +1,119 @@ +/** + * @RDE_HEADER@ + * interpreter to convert text-filter to model filter + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + +#pragma once + +#include +#include +#include +#include + + +namespace Timeline +{ +class DetailData; + +class FilterWorker : public QObject +{ + Q_OBJECT +private: + FilterWorker(); + ~FilterWorker(); + static FilterWorker* s_instance; + +public: + static FilterWorker* getInstance(); + static void deleteInstance(); // TODO: to qt instance + +// static Q_CONSTEXPR QLatin1Char filterSeparator() { return QLatin1Char(';'); } +// static Q_CONSTEXPR QLatin1Char filterEventNamespace() { return QLatin1Char(':'); } +// static Q_CONSTEXPR QLatin1Char attributeSeparator() { return QLatin1Char('+'); } +// static Q_CONSTEXPR QLatin1Char attributeValueSeparator() { return QLatin1Char(','); } +// static Q_CONSTEXPR QLatin1Char bracketOpen() { return QLatin1Char('{'); } +// static Q_CONSTEXPR QLatin1Char bracketClose() { return QLatin1Char('}'); } + + struct ModelFilter + { + int eventType = -1; + QString attributeType; + bool active = false; + QString attributeValue; // stores IDs or values (position ("xxxx.xxx;xxxx.xxx"), doubles, etc.) + }; + + struct Result + { + int resultValue = -1; + QStringList additionalInformation; + }; + + struct GetModelFilterListResult + { + // 4 Bit ResultType => [0000] [0000] <= 4 Bit ResultValues + + enum ResultType + { + ERR = 0x80, // bit 8 set - 1000 0000 + WARN = 0x40, // bit 7 set - 0100 0000 + INFO = 0x20, // bit 6 set - 0010 0000 + }; + + enum ResultValues + { + //INFO_NO_FILTERS = INFO | 0, + //INFO_EVENT_ONLY_FILTER = INFO | 1, + + ERR_NO_EVENT_NAME = ERR | 0, + ERR_COLON_MISUSE = ERR | 1, + ERR_UNKNOWN_EVENT_TYPE = ERR | 2, + ERR_ATTRIBUTE_HAS_NO_VALUES = ERR | 3, + ERR_ATTRIBUTE_BLOCK_NOT_CLOSED = ERR | 4, + ERR_UNKNOWN_ATTRIBUTE_TYPE_BY_STRING = ERR | 5, + //ERR_UNKNOWN_ATTRIBUTE_TYPE_BY_TYPE = ERR | 6, + ERR_EVENT_HAS_NOT_ATTRIBUTE = ERR | 7, + ERR_VALUE_NOT_FOUND = ERR | 8, + ERR_NO_VALUE_GIVEN = ERR | 9, + ERR_TOO_MUCH_BRACKETS = ERR | 10, + }; + + QVector resultValueList; + QVector result; + }; + + static GetModelFilterListResult getModelFilterList(DetailData *detailData, const QJsonArray &filter, bool fromTypeSafe = false); // returns a ResultStruct, as the user has to know WHAT failures he did when writing the filter text by himself! + bool handleResultValues(const QVector &resultList, QWidget* parentWidget = nullptr, bool ignoreInfos = false); // returns true if NO error(s) occured (info & warnings are okay) - false = ERRORS !!! + +private: + class ErrorHandler + { + public: + ErrorHandler(const QString& errorText = QString(), const int errorParamCount = 0) + : errorText(errorText) + , errorParamCount(errorParamCount) + { + + } + + bool isValid() const + { + if (errorText.isEmpty() && !errorParamCount) + return false; + return true; + } + + QString errorText; + int errorParamCount; + }; + + using ErrorHandlerLookupMap = QMap; + ErrorHandlerLookupMap m_errorHandlerLookupMap; +}; + +using ModelFilterList = QVector; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.cpp new file mode 100755 index 000000000..42d6fe432 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.cpp @@ -0,0 +1,134 @@ +/** + * @RDE_HEADER@ + * window to provide errors and informations when applying filter to excon model + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "InfoWindow.h" + +#include +#include + + +namespace Timeline +{ + +InfoWindow::InfoWindow(const InfoWindowEntryList &infoWindowEntryList, QWidget* parent) + : QDialog(parent) + , infoWindowEntryList(infoWindowEntryList) + + + // ui + , mainLayout(new QVBoxLayout()) + , pbPrev(new QPushButton(tr("< Previous"))) + , lbIndicator(new QLabel()) + , pbNext(new QPushButton(tr("Next >"))) + , pbOK(new QPushButton(tr("OK"))) + , teText(new QTextEdit(tr("Missing Message"))) + + , listPosition(-1) // invalid / not positioned +{ + if (!infoWindowEntryList.count()) + { + return; + } + + connect(pbPrev, &QPushButton::clicked, this, &InfoWindow::slotPrev); + connect(pbNext, &QPushButton::clicked, this, &InfoWindow::slotNext); + connect(pbOK , &QPushButton::clicked, this, &InfoWindow::deleteLater); + + + // top buttons (< & >) + QHBoxLayout* topButtonsLayout = new QHBoxLayout(); + pbPrev->setEnabled(false); // set prev disabled by default (as there is no prev) + topButtonsLayout->addWidget(pbPrev); + topButtonsLayout->addWidget(lbIndicator); + topButtonsLayout->addWidget(pbNext); + pbNext->setEnabled(false); // set next disabled by default (as there CAN be no next) + QWidget* topButtonsWidget = new QWidget(); + topButtonsWidget->setLayout(topButtonsLayout); + mainLayout->addWidget(topButtonsWidget); + + + // text field for info / error / warning text + mainLayout->addWidget(teText); + + + // bottom buttons (ignore, ignore all, cancel) + QHBoxLayout* bottomButtonsLayout = new QHBoxLayout(); + bottomButtonsLayout->addWidget(pbOK); + QWidget* bottomButtonsWidget = new QWidget(); + bottomButtonsWidget->setLayout(bottomButtonsLayout); + mainLayout->addWidget(bottomButtonsWidget); + + + // fill first thingy.... + slotNext(); + + this->setLayout(mainLayout); +} + +void InfoWindow::checkNavigationButtons(int newPosition) +{ + int listCount = infoWindowEntryList.count(); + + if (newPosition -1 >= 0) // if there is no prev, do not show prev + { + pbPrev->setEnabled(true); + } + else + { + pbPrev->setEnabled(false); + } + + if (newPosition +2 > listCount) // if there is no next, do not show next + { + pbNext->setEnabled(false); + } + else + { + pbNext->setEnabled(true); + } +} + +void InfoWindow::slotPrev() +{ + int listCount = infoWindowEntryList.count(); + int prevListPosition = listPosition - 1 /* 0 -1 = -1 */; + + checkNavigationButtons(prevListPosition); + + if (prevListPosition >= 0 && prevListPosition < listCount) // if there is a prev one + { + teText->setText(infoWindowEntryList.at(prevListPosition).text); // set text + + QString indicatorString = QStringLiteral("%1/%2"); + lbIndicator->setText(indicatorString.arg(prevListPosition + 1 /* so there is no "Info 0" */).arg(listCount)); // set indicator like: "Info 4/8" + + listPosition = prevListPosition; // set new current list position + } +} + +void InfoWindow::slotNext() +{ + int listCount = infoWindowEntryList.count(); + int nextListPosition = listPosition + 1 /* -1 + 1 = 0 */; + + checkNavigationButtons(nextListPosition); + + if (nextListPosition >= 0 && nextListPosition < listCount) // if there is a next one (some safety checks) + { + teText->setText(infoWindowEntryList.at(nextListPosition).text); // set text + + QString indicatorString = QStringLiteral("%1/%2"); + lbIndicator->setText(indicatorString.arg(nextListPosition + 1 /* so there is no "Info 0" */).arg(listCount)); // set indicator like: "Info 4/8" + + listPosition = nextListPosition; // set new current list position + } +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.h new file mode 100755 index 000000000..fe37029d0 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.h @@ -0,0 +1,67 @@ +/** + * @RDE_HEADER@ + * window to provide errors and informations when applying filter to excon model + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#pragma once + +#include +#include +#include +#include +#include +#include + + +namespace Timeline +{ + +struct InfoWindowEntry +{ + enum class InfoTypes + { + Error, + Info, + Warning + }; + + QString title; + QString text; + InfoTypes infoType = InfoTypes::Info; // error, info, warning +}; + +typedef QVector InfoWindowEntryList; + + +class InfoWindow : public QDialog +{ + Q_OBJECT + +public: + InfoWindow(const InfoWindowEntryList &infoWindowEntryList, QWidget* parent = nullptr); + ~InfoWindow() = default; + +private: + InfoWindowEntryList infoWindowEntryList; + QVBoxLayout* mainLayout; + QPushButton* pbPrev; + QLabel* lbIndicator; + QPushButton* pbNext; + QPushButton* pbOK; + QTextEdit* teText; + int listPosition; // current position in list which information is currently shown + + void checkNavigationButtons(int newPosition); + + +public slots: + void slotPrev(); + void slotNext(); +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterEditorUi.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterEditorUi.ui new file mode 100755 index 000000000..7777f134d --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterEditorUi.ui @@ -0,0 +1,1357 @@ + + + FilterEditor + + + + 0 + 0 + 628 + 393 + + + + Filter Table + + + false + + + + 0 + + + + + false + + + QFrame::NoFrame + + + QFrame::Plain + + + true + + + + + 0 + 0 + 610 + 375 + + + + true + + + + + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 192 + 0 + + + + + + + 0 + 160 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 0 + 85 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 192 + 0 + + + + + + + 0 + 160 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 0 + 85 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 64 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 192 + 0 + + + + + + + 0 + 160 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 0 + 85 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 64 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + Add Filter + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 192 + 0 + + + + + + + 0 + 160 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 0 + 85 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 192 + 0 + + + + + + + 0 + 160 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 0 + 85 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 64 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 192 + 0 + + + + + + + 0 + 160 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 0 + 85 + 0 + + + + + + + 0 + 64 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 64 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 128 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + Apply Filters + + + + + + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 213 + 127 + + + + + + + 255 + 191 + 63 + + + + + + + 127 + 85 + 0 + + + + + + + 170 + 113 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 213 + 127 + + + + + + + 255 + 191 + 63 + + + + + + + 127 + 85 + 0 + + + + + + + 170 + 113 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 127 + 85 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 213 + 127 + + + + + + + 255 + 191 + 63 + + + + + + + 127 + 85 + 0 + + + + + + + 170 + 113 + 0 + + + + + + + 127 + 85 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 85 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + Show Events of all Filters + + + + + + + + + + + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterWindowUi.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterWindowUi.ui new file mode 100755 index 000000000..c0f503bde --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterWindowUi.ui @@ -0,0 +1,81 @@ + + + FilterWindow + + + + 0 + 0 + 628 + 393 + + + + Filter Table + + + false + + + + 0 + + + + + Closing this window will reset all filters for the timeline. + + + + + + + false + + + QFrame::NoFrame + + + QFrame::Plain + + + true + + + + + 0 + 0 + 610 + 358 + + + + true + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.cpp new file mode 100755 index 000000000..42148eaf0 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.cpp @@ -0,0 +1,44 @@ +/** + * @RDE_HEADER@ + * abstract widget with basic/easy implementation of new widget types in Filter Table + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "AbstractAttributeWidget.h" + +#include +#include + + +namespace Timeline +{ + +AbstractAttributeWidget::AbstractAttributeWidget(QWidget *parent) + : QWidget(parent) + , m_abstractMainLayout(new QHBoxLayout(this)) +{ + QPushButton *pbDelete(new QPushButton(QStringLiteral("-"))); + pbDelete->setPalette(QPalette(QColor("red"))); + pbDelete->setToolTip(tr("Delete this value")); + + m_abstractMainLayout->addWidget(pbDelete); + connect(pbDelete, &QPushButton::clicked, this, &AbstractAttributeWidget::slotDelete); +} + +void AbstractAttributeWidget::slotDelete() +{ + //delete this; // deletes itself from the parents layout. DONE! <= UGH! Ich als Azubi halt :) + emit deleteClicked(); + deleteLater(); +} + +void AbstractAttributeWidget::addCustomWidget(QWidget* widget) +{ + m_abstractMainLayout->insertWidget(0, widget, 1, Qt::AlignLeft); // add widget to the left +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.h new file mode 100755 index 000000000..957517d43 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.h @@ -0,0 +1,42 @@ +/** + * @RDE_HEADER@ + * abstract widget with basic/easy implementation of new widget types in Filter Table + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#pragma once + +#include + +class QHBoxLayout; + +namespace Timeline +{ +class DetailData; + +class AbstractAttributeWidget : public QWidget +{ + Q_OBJECT +public: + explicit AbstractAttributeWidget(QWidget *parent = nullptr); + virtual QString filterText(bool typeSafe = false) const = 0; // only returns the chosen values for this attribute + virtual void updateData(DetailData *detailData) = 0; + +protected: + void addCustomWidget(QWidget* widget); // use this method to add the abstracted widget to this base classes ready layout +protected: + QHBoxLayout *m_abstractMainLayout; + +private slots: + void slotDelete(); + +signals: + void signalChanges(); + void deleteClicked(); +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.cpp new file mode 100755 index 000000000..d70890146 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.cpp @@ -0,0 +1,77 @@ +/** + * @RDE_HEADER@ + * select area with n1, n2, o1, o2 + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "AreaWidget.h" + +#include +#include +#include + + +namespace Timeline +{ + +AreaWidget::AreaWidget(int n1, int n2, int o1, int o2, QWidget *parent) + : AbstractAttributeWidget(parent) + , sbN1(new QSpinBox()) + , sbN2(new QSpinBox()) + , sbO1(new QSpinBox()) + , sbO2(new QSpinBox()) +{ + connect(sbN1, static_cast(&QSpinBox::valueChanged), this, &AreaWidget::signalChanges); + connect(sbN2, static_cast(&QSpinBox::valueChanged), this, &AreaWidget::signalChanges); + connect(sbO1, static_cast(&QSpinBox::valueChanged), this, &AreaWidget::signalChanges); + connect(sbO2, static_cast(&QSpinBox::valueChanged), this, &AreaWidget::signalChanges); + + QString sbNPrefix = tr("N "); + QString sbOPrefix = tr("O "); + + sbN1->setPrefix(sbNPrefix); + sbN2->setPrefix(sbNPrefix); + sbO1->setPrefix(sbOPrefix); + sbO2->setPrefix(sbOPrefix); + + sbN1->setRange(n1, n2); + sbN2->setRange(n1, n2); + sbO1->setRange(o1, o2); + sbO2->setRange(o1, o2); + + sbN1->setValue(n1); + sbN2->setValue(n2); + sbO1->setValue(o1); + sbO2->setValue(o2); + + + QGridLayout* mainLayout = new QGridLayout(); + + mainLayout->addWidget(sbN1, 0, 1); // top center + mainLayout->addWidget(sbN2, 2, 1); // bottom center + mainLayout->addWidget(sbO1, 1, 0); // left center + mainLayout->addWidget(sbO2, 1, 2); // right center + + QWidget* mainLayoutWidget = new QWidget(); + mainLayoutWidget->setLayout(mainLayout); + + this->addCustomWidget(mainLayoutWidget); +} + +QString AreaWidget::filterText(bool typeSafe) const +{ + Q_UNUSED(typeSafe); + return QStringLiteral("%1x%2x%3x%4").arg(sbN1->cleanText(), sbN2->cleanText(), sbO1->cleanText(), sbO2->cleanText()); +} + +void AreaWidget::updateData(DetailData *detailData) +{ + // data cannot change + Q_UNUSED(detailData); +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.h new file mode 100755 index 000000000..e52beb3d8 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.h @@ -0,0 +1,36 @@ +/** + * @RDE_HEADER@ + * select area with n1, n2, o1, o2 + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + +#pragma once + +#include "AbstractAttributeWidget.h" + + +class QSpinBox; + + +namespace Timeline +{ + +class AreaWidget : public AbstractAttributeWidget//QWidget +{ + Q_OBJECT +public: + explicit AreaWidget(int n1, int n2, int o1, int o2, QWidget *parent = nullptr); + QString filterText(bool typeSafe = false) const override; + void updateData(DetailData *detailData) override; + +private: + QSpinBox* sbN1; + QSpinBox* sbN2; + QSpinBox* sbO1; + QSpinBox* sbO2; +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.cpp new file mode 100755 index 000000000..75d0d2a5f --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.cpp @@ -0,0 +1,73 @@ +/** + * @RDE_HEADER@ + * select true / false + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + +#include "CheckBoxWidget.h" +#include "../../detail_data.h" + +#include + + +namespace Timeline +{ + +CheckBoxWidget::CheckBoxWidget(DetailData *detailData, const QString &attributeType, const QString &initialValue, QWidget* parent) + : AbstractAttributeWidget(parent) + , cbCheck(new QCheckBox(this)) +{ + connect(cbCheck, &QCheckBox::stateChanged, this, &CheckBoxWidget::signalChanges); + + trueValue = detailData->attributeValueLookup.getValueStringFromValueId(attributeType, 1); + falseValue = detailData->attributeValueLookup.getValueStringFromValueId(attributeType, 0); + + cbCheck->setText(trueValue); + + addCustomWidget(cbCheck); + + if (initialValue.isEmpty()) + return; + + cbCheck->setChecked(initialValue != QStringLiteral("0")); +} + + +void CheckBoxWidget::setText(const QString &text) +{ + cbCheck->setText(text); +} + + +QString CheckBoxWidget::filterText(bool typeSafe) const +{ + QString filterText; + + if (cbCheck->isChecked()) + { + if (typeSafe) + filterText += QStringLiteral("1"); + else + filterText += trueValue; + } + else + { + if (typeSafe) + filterText += QStringLiteral("0"); + else + filterText += falseValue; + } + + return filterText; +} + + +void CheckBoxWidget::updateData(DetailData *) +{ + // data cannot change +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.h new file mode 100755 index 000000000..f7ad80421 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.h @@ -0,0 +1,37 @@ +/** + * @RDE_HEADER@ + * select true / false + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + +#pragma once + +#include "AbstractAttributeWidget.h" +#include "../../detail_data.h" + + +class QCheckBox; + + +namespace Timeline +{ + +class CheckBoxWidget : public AbstractAttributeWidget//QWidget +{ + Q_OBJECT +public: + explicit CheckBoxWidget(DetailData *detailData, const QString &attributeType, const QString &initialValue, QWidget *parent = nullptr); + QString filterText(bool typeSafe = false) const override; + void updateData(DetailData *) override; + void setText(const QString &text); + +private: + QCheckBox* cbCheck; + QString trueValue; + QString falseValue; +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.cpp new file mode 100755 index 000000000..2ad280457 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.cpp @@ -0,0 +1,108 @@ +/** + * @RDE_HEADER@ + * select pre-defined value + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "ComboBox.h" +#include "logger.h" + +#include + +namespace Timeline +{ + +// combobox must be aware of getting his own data, as he needs to update himself (performance and coding reasons) +ComboBox::ComboBox(DetailData *detailData, const QString &attributeType, int eventType, const QString &initialValue, QWidget* parent) + : AbstractAttributeWidget(parent) + , m_cbValues(new QComboBox()) + , m_eventType(eventType) + , m_logger(getLogger("EventFilter.ComboBox")) +{ + connect(m_cbValues, static_cast(&QComboBox::currentIndexChanged), this, &ComboBox::signalChanges); + + addCustomWidget(m_cbValues); + + m_concreteAttributeType = detailData->attributeRedirectionLookup.getRedirection(attributeType); // returns 'attributeType' if there is no redirection + + updateData(detailData); + + if (initialValue.isEmpty()) + return; + + bool k = false; + int initialValueKey = initialValue.toInt(&k);// everything is typesafe now, saved as index keys, not values which index have to be looked up anymore + + if (initialValueKey < 0 || !k) // invalid! + { + WARNING_LOG(m_logger) << "ComboBox::c_tor: initialValueKey < 0 (" << initialValueKey << ")" << "initialValue: " << initialValue; + return; + } + + // select initial value + m_cbValues->setCurrentIndex(m_cbValues->findData(initialValueKey, Qt::UserRole)); // set initial value by id WARNING: does not check for invalid index +} + + +void ComboBox::updateData(DetailData *detailData) +{ + int lastSelectedKey = -1; + + if (m_cbValues->currentIndex() > 0) // none selected yet (if m_cbValues has to be built first) + lastSelectedKey = m_cbValues->itemData(m_cbValues->currentIndex()).toInt(); + + // now reset and load new data + QSignalBlocker blocker(m_cbValues); + m_cbValues->clear(); + m_avm = detailData->m_attributeValueLookupDtc.getAttributeValueMap(m_eventType, m_concreteAttributeType); + if (m_avm.isEmpty()) + m_avm = detailData->attributeValueLookup.getAttributeValueMap(m_concreteAttributeType); // get new avm + + for (auto i = m_avm.constBegin(); i != m_avm.constEnd(); ++i) + { + m_cbValues->addItem(i.value() +#ifdef DEBUG + + " (" + QString::number(i.key()) + ")" +#endif + , i.key()); // add value and key (storing key as userdata) + } + + if (lastSelectedKey < 0) // only set new index if there was a last selected index first + { + m_cbValues->setCurrentIndex(0); // set to the first entry + return; // done! + } + + // select old value (if one) + m_cbValues->setCurrentIndex(m_cbValues->findData(lastSelectedKey, Qt::UserRole)); // set initial value by id WARNING: does not check for invalid index + + DEBUG_LOG(m_logger) << "ComboBox: no initial item index found for value id" << lastSelectedKey; +} + + +QString ComboBox::filterText(bool typeSafe) const +{ + QString resultFilterText; + + bool ok = false; + int key = m_cbValues->itemData(m_cbValues->currentIndex()).toInt(&ok); + + if (!ok) + { + return resultFilterText; + } + + if (typeSafe) + resultFilterText = QString::number(key); // returns the selected value's ID + else + resultFilterText = m_avm.value(key); // returns the selected value's STRING + + + return resultFilterText; +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.h new file mode 100755 index 000000000..6d254e880 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.h @@ -0,0 +1,42 @@ +/** + * @RDE_HEADER@ + * select pre-defined value + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#pragma once + +#include "AbstractAttributeWidget.h" +#include "../../detail_data.h" + +#include + +class QComboBox; + + +namespace Timeline +{ + +class ComboBox : public AbstractAttributeWidget +{ + Q_OBJECT +public: + explicit ComboBox(DetailData *detailData, const QString &attributeType, + int eventType, const QString &initialValue, QWidget *parent = nullptr); // combobox fills itself with values, by getting informations from FilterData + QString filterText(bool typeSafe = false) const override; + void updateData(DetailData *detailData) override; + +private: + QComboBox *m_cbValues; + int m_eventType; + QString m_concreteAttributeType; + AttributeValueMap m_avm; + NGL::INGLLogger &m_logger; + +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.cpp new file mode 100755 index 000000000..795fd8a8b --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.cpp @@ -0,0 +1,99 @@ +/** + * @RDE_HEADER@ + * select any range between values + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "DefaultRangeWidget.h" +#include "logger.h" + +#include +#include +#include +#include + +namespace Timeline +{ + +DefaultRangeWidget::DefaultRangeWidget(unsigned int min, unsigned int max, const QString &prefix, const QString &suffix, const QString &initialValue, QWidget *parent) + : AbstractAttributeWidget(parent) + , box1(new QSpinBox()) + , box2(new QSpinBox()) + , m_logger(getLogger("EventFilter.Widgets.DefaultRangeWidget")) +{ + connect(box1, static_cast(&QSpinBox::valueChanged), this, &DefaultRangeWidget::signalChanges); + connect(box2, static_cast(&QSpinBox::valueChanged), this, &DefaultRangeWidget::signalChanges); + + box1->setRange(min, max); + box2->setRange(min, max); + + box1->setPrefix(prefix); + box2->setPrefix(prefix); + + box1->setSuffix(suffix); + box2->setSuffix(suffix); + + box1->setValue(min); + box2->setValue(max); + + + QHBoxLayout* mainLayout = new QHBoxLayout(); + + mainLayout->addWidget(new QLabel(tr("between"))); + mainLayout->addWidget(box1); + mainLayout->addWidget(new QLabel(tr("and"))); + mainLayout->addWidget(box2); + + QWidget* mainLayoutWidget = new QWidget(); + mainLayoutWidget->setLayout(mainLayout); + + this->addCustomWidget(mainLayoutWidget); + + box1->setFocus(); // focus first widget + + + // not necessary, as initialValues are already checked bz checkValue ... + if (initialValue.length()) // is there an initial value ? + { + QStringList valueList = initialValue.split(QLatin1Char('-'), QString::SkipEmptyParts); + + if (valueList.count() != 2) // must be exactly 2 (e.g. "99,999") + { + WARNING_LOG(m_logger) << "DefaultRangeWidget: invalid initial value '" << initialValue << "'"; + return; + } + + bool k1 = false; + bool k2 = false; + + unsigned int val1 = valueList.at(0).toUInt(&k1); + unsigned int val2 = valueList.at(1).toUInt(&k2); + + if (!k1 || !k2) + { + WARNING_LOG(m_logger) << "DefaultRangeWidget: initial value is not numeric '" << initialValue << "'"; + return; + } + + box1->setValue(val1); + box2->setValue(val2); + } +} + +QString DefaultRangeWidget::filterText(bool typeSafe) const +{ + Q_UNUSED(typeSafe); + return QStringLiteral("%1 - %2").arg(box1->value(), box2->value()); +} + +void DefaultRangeWidget::updateData(DetailData *detailData) +{ + // not needed, as min / max is always static (0 - 999 bullets, etc) + Q_UNUSED(detailData); +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.h new file mode 100755 index 000000000..39f8b284b --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.h @@ -0,0 +1,44 @@ +/** + * @RDE_HEADER@ + * select any range between values + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#pragma once + +#include "AbstractAttributeWidget.h" +#include + + +class QHBoxLayout; +class QSpinBox; + + +namespace Timeline +{ + +class DefaultRangeWidget : public AbstractAttributeWidget +{ + Q_OBJECT + +public: + explicit DefaultRangeWidget(unsigned int min, + unsigned int max, + const QString &prefix, + const QString &suffix, + const QString &initialValue = QString(), + QWidget *parent = nullptr); + QString filterText(bool typeSafe = false) const override; + void updateData(DetailData *detailData) override; + +private: + QSpinBox* box1; + QSpinBox* box2; + NGL::INGLLogger &m_logger; +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.cpp new file mode 100755 index 000000000..af0198604 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.cpp @@ -0,0 +1,70 @@ +/** + * @RDE_HEADER@ + * select area with n1, n2, o1, o2 + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "RadiusWidget.h" + +#include +#include +#include + + +namespace Timeline +{ + +RadiusWidget::RadiusWidget(int n1, int n2, int o1, int o2, int radius, QWidget *parent) + : AbstractAttributeWidget(parent) + , sbN(new QSpinBox(this)) + , sbO(new QSpinBox(this)) + , sbR(new QSpinBox(this)) +{ + Q_ASSERT(false); // not ready to use! + + QString sbNPrefix = tr("N "); + QString sbOPrefix = tr("O "); + QString sbRPrefix = tr("radius of "); + + sbN->setPrefix(sbNPrefix); + sbO->setPrefix(sbOPrefix); + sbR->setPrefix(sbRPrefix); + + sbN->setRange(n1, n2); + sbO->setRange(o1, o2); + sbR->setRange(0, 9999); + + sbN->setValue(n1); + sbO->setValue(o1); + sbR->setValue(radius); + + + + QGridLayout* mainLayout = new QGridLayout(); + + mainLayout->addWidget(sbN, 0, 0); // left + mainLayout->addWidget(sbR, 0, 1); // middle + mainLayout->addWidget(sbO, 0, 2); // right + + QWidget* mainLayoutWidget = new QWidget(); + mainLayoutWidget->setLayout(mainLayout); + + addCustomWidget(mainLayoutWidget); +} + +QString RadiusWidget::filterText(bool typeSafe) const +{ + Q_UNUSED(typeSafe); + return QStringLiteral("%1x%2x%3").arg(sbN->cleanText(), sbO->cleanText(), sbR->cleanText()); +} + +void RadiusWidget::updateData(DetailData *) +{ + // TODO: ! +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.h new file mode 100755 index 000000000..2d57bacfb --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.h @@ -0,0 +1,35 @@ +/** + * @RDE_HEADER@ + * select radius with n1, n2, o1, o2 + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#pragma once + +#include "AbstractAttributeWidget.h" + +class QSpinBox; + + +namespace Timeline +{ + +class RadiusWidget : public AbstractAttributeWidget//QWidget +{ + Q_OBJECT +public: + explicit RadiusWidget(int n1, int n2, int o1, int o2, int radius, QWidget *parent = nullptr); + QString filterText(bool typeSafe = false) const override; + void updateData(DetailData *detailData) override; + +private: + QSpinBox* sbN; + QSpinBox* sbO; + QSpinBox* sbR; // radius +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.cpp new file mode 100755 index 000000000..13b9cd49a --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.cpp @@ -0,0 +1,109 @@ +/** + * @RDE_HEADER@ + * select any range between time + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + + +#include "logger.h" +#include "TimeRangeWidget.h" +#include "../../detail_data.h" + +#include + +#include +#include +#include + + +namespace Timeline +{ + +TimeRangeWidget::TimeRangeWidget(DetailData *detailData, const QString &initialValue, QWidget *parent) + : AbstractAttributeWidget(parent) + , m_logger(getLogger("EventFilter.Widgets.TimeRangeWidget")) + , m_edit1(new LtsWidgets::LtsDateTimeEdit(this)) + , m_edit2(new LtsWidgets::LtsDateTimeEdit(this)) +{ + connect(m_edit1, &LtsWidgets::LtsDateTimeEdit::dateTimeChanged, this, &TimeRangeWidget::signalChanges); + connect(m_edit2, &LtsWidgets::LtsDateTimeEdit::dateTimeChanged, this, &TimeRangeWidget::signalChanges); + +// m_edit1->setCalendarPopup(true); +// m_edit2->setCalendarPopup(true); + +// m_edit1->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue); +// m_edit2->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue); + + QHBoxLayout* mainLayout = new QHBoxLayout(); + + mainLayout->addWidget(new QLabel(tr("between"))); + mainLayout->addWidget(m_edit1); + mainLayout->addWidget(new QLabel(tr("and"))); + mainLayout->addWidget(m_edit2); + + QWidget* mainLayoutWidget = new QWidget(); + mainLayoutWidget->setLayout(mainLayout); + + addCustomWidget(mainLayoutWidget); + + m_edit1->setFocus(); // focus first widget + + + updateData(detailData); + + + if (initialValue.isEmpty()) + return; + + const auto initialTimeRange(initialValue.splitRef(QLatin1Char('-'), QString::SkipEmptyParts)); + + if (initialTimeRange.count() != 2) + { + WARNING_LOG(m_logger) << "invalid initial time range value: " << initialValue; + return; + } + + bool k = false; + qint64 time = initialTimeRange.at(0).toInt(&k); + time *= 1000; + + if (!k) + WARNING_LOG(m_logger) << "invalid initial time range start value: " << initialTimeRange.at(0).toString(); + else + m_edit1->setMsecsSinceEpoch(time); + + + time = initialTimeRange.at(1).toInt(&k); + time *= 1000; + + if (!k) + WARNING_LOG(m_logger) << "invalid initial time range start value: " << initialTimeRange.at(1).toString(); + else + m_edit2->setMsecsSinceEpoch(time); +} + + +QString TimeRangeWidget::filterText(bool typeSafe) const +{ + (void)typeSafe; + QString filterText; + + filterText += QString::number(m_edit1->msecsSinceEpoch() / 1000 /* otherwise would not fit into int */); // secs since epoch + filterText += QLatin1Char('-'); // trennzeichen + filterText += QString::number(m_edit2->msecsSinceEpoch() / 1000 /* otherwise would not fit into int */); // s.a.a. + + return filterText; +} + + +void TimeRangeWidget::updateData(DetailData *detailData) +{ + LtsSession::LtsSession *session = detailData->session(); + m_edit1->setMsecsSinceEpoch(session->partitionTime() - 60 * 1000 /* TODO: minus 1 minute offset ? */); + m_edit2->setMsecsSinceEpoch(session->partitionTime()); +} + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.h new file mode 100755 index 000000000..ba205b53e --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.h @@ -0,0 +1,41 @@ +/** + * @RDE_HEADER@ + * select any range between time + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2015-09-23 + */ + +#pragma once + +#include "AbstractAttributeWidget.h" + +#include + + +namespace LtsWidgets +{ +class LtsDateTimeEdit; +} + + +namespace Timeline +{ + +class TimeRangeWidget : public AbstractAttributeWidget +{ + Q_OBJECT +public: + explicit TimeRangeWidget(DetailData *detailData, const QString &initialValue, QWidget *parent = nullptr); + QString filterText(bool typeSafe = false) const override; + void updateData(DetailData *detailData) override; + +private: + NGL::INGLLogger &m_logger; +public: + LtsWidgets::LtsDateTimeEdit *m_edit1; + LtsWidgets::LtsDateTimeEdit *m_edit2; +}; + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.cpp new file mode 100755 index 000000000..2130fc50f --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.cpp @@ -0,0 +1,303 @@ +/** + * @RDE_HEADER@ + * Helper classes to retrieve attribute values + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Christian Ehrlicher, NLE, 2020-02-07 + */ + +#include "attribute_value_lookup.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +namespace Timeline +{ + +// +// AvmChargeType +// +AttributeValueMap AvmChargeType::getAttributeValueMap(int eventType) const +{ + if (!m_dtc) + return {}; + + using namespace ProjectDataManagement; + QVector charges; + switch (eventType) + { + case EventType::Hit: + case EventType::WeaponAssignment: + case EventType::FireEvent: + charges = m_dtc->chargesForGearClass(GearClass::DuelSim); + break; + case EventType::HitBuilding: + charges = m_dtc->chargesForGearClass(GearClass::DuelSim); + Q_FALLTHROUGH(); + case EventType::HitEffectSimulation: + charges += m_dtc->chargesForGearClass(GearClass::Artillery); + charges += m_dtc->chargesForGearClass(GearClass::Mortar); + charges += m_dtc->chargesForGearClass(GearClass::Geopairing); + charges += m_dtc->chargesForGearClass(GearClass::AirSupport); + charges += m_dtc->chargesForGearClass(GearClass::MineArea); + charges += m_dtc->chargesForGearClass(GearClass::Biological); + charges += m_dtc->chargesForGearClass(GearClass::Chemical); + break; + case EventType::HitB: + charges = m_dtc->chargesForGearClass(GearClass::Biological); + break; + case EventType::HitC: + charges = m_dtc->chargesForGearClass(GearClass::Chemical); + break; + case EventType::BCContamination: + charges = m_dtc->chargesForGearClass(GearClass::Biological); + charges += m_dtc->chargesForGearClass(GearClass::Chemical); + break; + case EventType::HitMine: + case EventType::EnterMineArea: + case EventType::LeaveMineArea: + case EventType::MineArea: + charges = m_dtc->chargesForGearClass(GearClass::MineArea); + //charges =+ dtc->chargesForGearClass(GearClass::MineSingle); // same charges + break; + } + Q_ASSERT(!charges.isEmpty()); + + AttributeValueMap ret; + for (const ChargeType &data : qAsConst(charges)) + ret.insert(data.id(), m_dtc->trChargeTypeShortName(data.id())); + return ret; +} + +QString AvmChargeType::getValueStringFromValueId(int attributeValueId) const +{ + if (!m_dtc) + return {}; + return m_dtc->trChargeTypeShortName(attributeValueId); +} + +// +// AvmGearType +// +AttributeValueMap AvmGearType::getAttributeValueMap(int eventType) const +{ + using namespace ProjectDataManagement; + if (eventType != EventType_def::WeaponAssignment && + eventType != EventType_def::FireEvent) + { + Q_ASSERT(false); + return {}; + } + + if (!m_dtc) + return {}; + + const auto gearTypes = m_dtc->gearTypes(); + AttributeValueMap ret; + for (const auto &data : gearTypes) + { + if (data.gearClassId() == GearClass::DuelSim && + data.tasCode() != 0) + ret.insert(data.id(), m_dtc->trGearTypeName(data.id())); + } + return ret; +} + +QString AvmGearType::getValueStringFromValueId(int attributeValueId) const +{ + if (!m_dtc) + return {}; + return m_dtc->trGearTypeName(attributeValueId); +} + +// +// AvmParty +// +AttributeValueMap AvmParty::getAttributeValueMap(int eventType) const +{ + Q_UNUSED(eventType); + + using namespace ParticipantManagement; + + if (!m_dtc) + return {}; + + const auto parties = m_dtc->partys(); + AttributeValueMap ret; + for (const auto &data : parties) + ret.insert(data.id(), trPartyName(data.name())); + return ret; +} + +QString AvmParty::getValueStringFromValueId(int attributeValueId) const +{ + using namespace ParticipantManagement; + if (!m_dtc) + return {}; + return trPartyName(m_dtc->party(attributeValueId).name()); +} + +// +// AvmEquipmentNumber +// +AttributeValueMap AvmEquipmentNumber::getAttributeValueMap(int eventType) const +{ + Q_UNUSED(eventType); + + using namespace ParticipantManagement; + + if (!m_dtc) + return {}; + + AttributeValueMap ret; + auto cb = [&ret](const ParticipantManagement::Participant & p) -> void + { + if (!p.equipmentNumber().is_set()) + return; + const auto equipNo = p.equipmentNumber().get(); + ret.insert(equipNo, QString::number(equipNo)); + }; + m_dtc->participants(cb); + return ret; +} + +QString AvmEquipmentNumber::getValueStringFromValueId(int attributeValueId) const +{ + if (!m_dtc) + return {}; + auto ret = m_dtc->participant(attributeValueId).equipmentNumber(); + return ret.is_set() ? QString::number(ret.get()) : QString(); +} + +// +// AvmOperator +// +AttributeValueMap AvmOperator::getAttributeValueMap(int eventType) const +{ + Q_UNUSED(eventType); + + using namespace OperatorManagement; + + if (!m_dtc) + return {}; + + const auto users = m_dtc->users(); + AttributeValueMap ret; + for (const auto &data : users) + ret.insert(data.id(), QString::fromStdString(data.name())); + ret.insert(0, QObject::tr("EXCON")); + return ret; +} + +QString AvmOperator::getValueStringFromValueId(int attributeValueId) const +{ + if (attributeValueId == 0) + return QObject::tr("EXCON"); + if (!m_dtc) + return {}; + return QString::fromStdString(m_dtc->user(attributeValueId).name()); +} + +// +// AvmBuilding +// +AttributeValueMap AvmBuilding::getAttributeValueMap(int eventType) const +{ + Q_UNUSED(eventType); + + if (!m_dtc) + return {}; + + AttributeValueMap ret; + auto cb = [this, &ret](const InfrastructureManagement::MainStructureElement &mse) -> void + { + if (mse.structureElementTypeId() != InfrastructureManagement::StructureElementType::Building) + return; + ret.insert(mse.id(), m_dtc->getBuildingDisplayName(mse)); + }; + m_dtc->mainStructureElements(cb); + return ret; +} + +QString AvmBuilding::getValueStringFromValueId(int attributeValueId) const +{ + if (!m_dtc) + return {}; + return m_dtc->getBuildingDisplayName(attributeValueId); +} + +// +// AvmStreamName +// +AvmStreamName::AvmStreamName(const std::shared_ptr &dtc) + : m_dtc(dtc) + , m_snm(AudioVideoManagement::StreamNameMapping::create(m_dtc.get())) +{} + +AvmStreamName::~AvmStreamName() = default; + +AttributeValueMap AvmStreamName::getAttributeValueMap(int eventType) const +{ + AttributeValueMap ret; + + if (!m_dtc) + return ret; + + switch (eventType) + { + case ProjectDataManagement::EventType::RadioCnr: + { + auto cb = [&ret](const AudioVideoManagement::CnrConfig &cnrConfig) -> void + { + ret.insert(cnrConfig.id(), QString::fromStdString(cnrConfig.radioCircuit())); + }; + m_dtc->cnrConfigs(cb); + break; + } + case ProjectDataManagement::EventType::RadioTvc: + { + auto cb = [&ret](const AudioVideoManagement::TvcConfig &tvcConfig) -> void + { + ret.insert(tvcConfig.id(), QString::fromStdString(tvcConfig.radioCircuit())); + }; + m_dtc->tvcConfigs(cb); + break; + } + case ProjectDataManagement::EventType::CameraVideo: + { + auto cb = [this, &ret](const AudioVideoManagement::Stream &stream) -> void + { + if (stream.mountingPointId() == 0 || + stream.type() != AudioVideoManagement::StreamType::Video) + return; + ret.insert(stream.id(), m_snm->displayName(stream.mountingPointId())); + }; + m_dtc->streams(cb); + break; + } + default: + break; + } + return ret; +} + +QString AvmStreamName::getValueStringFromValueId(int attributeValueId) const +{ + if (!m_dtc) + return {}; + return QString::fromStdString(m_dtc->stream(attributeValueId).name()); +} + + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.h new file mode 100755 index 000000000..3f7892284 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.h @@ -0,0 +1,138 @@ +/** + * @RDE_HEADER@ + * Helper classes to retrieve attribute values + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Christian Ehrlicher, NLE, 2020-02-07 + */ +#pragma once + +#include +#include +#include + +namespace AudioVideoManagement +{ +class StreamNameMapping; +namespace Interface +{ +class Dtc; +} +} +namespace InfrastructureManagement +{ +namespace Interface +{ +class Dtc; +} +} +namespace OperatorManagement +{ +namespace Interface +{ +class Dtc; +} +} +namespace ParticipantManagement +{ +namespace Interface +{ +class Dtc; +} +} +namespace ProjectDataManagement +{ +namespace Interface +{ +class Dtc; +} +} + +namespace Timeline +{ +using AttributeValueMap = QMap; +using AtributeValueLookupMap = QMap; + +class AttributeValueLookupProvider +{ +public: + virtual ~AttributeValueLookupProvider() = default; + virtual AttributeValueMap getAttributeValueMap(int eventType) const = 0; + virtual QString getValueStringFromValueId(int attributeValueId) const = 0; +}; + +class AvmChargeType final : public AttributeValueLookupProvider +{ +public: + explicit AvmChargeType(const std::shared_ptr &dtc) : m_dtc(dtc) {} + AttributeValueMap getAttributeValueMap(int eventType) const override; + QString getValueStringFromValueId(int attributeValueId) const override; +private: + std::shared_ptr m_dtc; +}; + +class AvmGearType final : public AttributeValueLookupProvider +{ +public: + explicit AvmGearType(const std::shared_ptr &dtc) : m_dtc(dtc) {} + AttributeValueMap getAttributeValueMap(int eventType) const override; + QString getValueStringFromValueId(int attributeValueId) const override; +private: + std::shared_ptr m_dtc; +}; + +class AvmParty final : public AttributeValueLookupProvider +{ +public: + explicit AvmParty(const std::shared_ptr &dtc) : m_dtc(dtc) {} + AttributeValueMap getAttributeValueMap(int eventType) const override; + QString getValueStringFromValueId(int attributeValueId) const override; +private: + std::shared_ptr m_dtc; +}; + +class AvmEquipmentNumber final : public AttributeValueLookupProvider +{ +public: + explicit AvmEquipmentNumber(const std::shared_ptr &dtc) : m_dtc(dtc) {} + AttributeValueMap getAttributeValueMap(int eventType) const override; + QString getValueStringFromValueId(int attributeValueId) const override; +private: + std::shared_ptr m_dtc; +}; + +class AvmOperator final : public AttributeValueLookupProvider +{ +public: + explicit AvmOperator(const std::shared_ptr &dtc) : m_dtc(dtc) {} + AttributeValueMap getAttributeValueMap(int eventType) const override; + QString getValueStringFromValueId(int attributeValueId) const override; +private: + std::shared_ptr m_dtc; +}; + +class AvmBuilding final : public AttributeValueLookupProvider +{ +public: + explicit AvmBuilding(const std::shared_ptr &dtc) : m_dtc(dtc) {} + AttributeValueMap getAttributeValueMap(int eventType) const override; + QString getValueStringFromValueId(int attributeValueId) const override; +private: + std::shared_ptr m_dtc; +}; + +class AvmStreamName final : public AttributeValueLookupProvider +{ +public: + explicit AvmStreamName(const std::shared_ptr &dtc); + ~AvmStreamName(); + AttributeValueMap getAttributeValueMap(int eventType) const override; + QString getValueStringFromValueId(int attributeValueId) const override; +private: + std::shared_ptr m_dtc; + std::shared_ptr m_snm; +}; + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.cpp new file mode 100755 index 000000000..fb014bb9d --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.cpp @@ -0,0 +1,928 @@ +/** + * @RDE_HEADER@ + * Model to handle datail data for the different event types + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-09-04 + */ + +#include "detail_data.h" +#include "logger.h" +#include "tln_legend.h" +#include "attribute_value_lookup.h" + +#include +#include +#include +#include + +// Dtc lookups: (data ifc libs) +#include +#include +#include +#include +#include +#include + + +// Enums only: (svc libs only) +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +namespace Timeline +{ + +static inline QString removeSpaces(const QString &str) +{ + // no QString::erase(it) available... + QString ret; + ret.reserve(str.size()); + for (const QChar c : str) + { + if (!c.isSpace()) + ret += c; + } + return ret; +} + +DetailData::DetailData(LtsSession::LtsSession *session, QObject *parent) + : QObject(parent) + , m_session(session) + , __already_populated__(false) + , m_logger(getLogger("DetailData")) +{ + populate(); +} + +void DetailData::addRedirectedAttributeType(const QString &newAttributeTypeId, const QString &attributeText, const QString &redirectToAttributeTypeId) +{ + attributeTypeLookup.addAttributeText(newAttributeTypeId, attributeText); + attributeRedirectionLookup.addRedirection(newAttributeTypeId, redirectToAttributeTypeId); +} + + +void DetailData::addAttributeType(const QString &attributeTypeId, const QString &attributeText, const int uiTypeId, const int interpreterTypeId) +{ + attributeTypeLookup.addAttributeText(attributeTypeId, attributeText); + attributeUITypeLookup.addUITypeToAttribute(attributeTypeId, uiTypeId); + attributeInterpreterLookup.addInterpreterTypeToAttribute(attributeTypeId, interpreterTypeId); +} + + +void DetailData::addEventType(int eventTypeId, const QString &eventTypeString) // with default attribute types [time, etc.] +{ + eventTypeLookup.addEventType(eventTypeId, eventTypeString); + attributeEventLookup.addAttributesToEvent(eventTypeId, {QStringLiteral("TimeRange")}); +} + + +void DetailData::addEventType(const ProjectDataManagement::EventType &eventType) // with default attribute types [time, etc.] +{ + addEventType(eventType.underlying(), ProjectDataManagement::toString(eventType)); +} + + +void DetailData::populate() // call on any retranslate +{ + if (__already_populated__) // TODO: repopulate!! + return; + __already_populated__ = true; + + + + // TODO: clear all lookups ! + + // populate Event Types - see build/Lts/Services/ExerciseEventManagement/eem_enums.hpp + // * retrieved as of 2017-09-01 + + addEventType(0, tr("General")); // would be type 'unknown' in EventType_def DE: "Allgemein" + + addEventType(markerTypeId, tr("Marker")); + attributeEventLookup.addAttributesToEvent(markerTypeId, {QStringLiteral("MarkerName"), + QStringLiteral("MarkerNote"), + QStringLiteral("Operator"), + QStringLiteral("MarkerOffset"), + QStringLiteral("IsSituationType"), + QStringLiteral("IsVideoType"), + QStringLiteral("IsAudioType")}); + + + using namespace ProjectDataManagement; + const auto possibleEventTypes = TimelineLegendDialog::possibleEvents(); + for (const auto eventType : possibleEventTypes) + { + switch (eventType.underlying()) + { + case EventType::Hit: + attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("VulnerabilityState"), + QStringLiteral("OriginatorChargeTypeId"), + QStringLiteral("FriendlyFire"), + //QStringLiteral("OriginatorId"), // TODO: kann ich nix mit anfangen.. + //QStringLiteral("OriginatorType"), // not really useful - see EEM HandlerDynamicParticipantData::tryCreateHitEvent() + QStringLiteral("OriginatorEquipmentNumber")}); + break; + case EventType::BiteMessage: + break; + case EventType::WeaponAssignment: + case EventType::FireEvent: + attributeEventLookup.addAttributesToEvent(eventType, {//<< QStringLiteral("GearId"), // is a unique serial number not known to excon operator + QStringLiteral("GearTypeId"), + QStringLiteral("ChargeTypeId")}); + break; + case EventType::HitBuilding: + attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesType"), + QStringLiteral("ChargeTypeId"), + QStringLiteral("OriginatorEquipmentNumber"), + QStringLiteral("MainStructureElementId"), + QStringLiteral("VulnerabilityState"), + QStringLiteral("damagePercent"), // range + //QStringLiteral("damagePercentOld"), + }); // range + break; + case EventType::Manipulation: + break; + case EventType::Sanitation: + attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("Vitality"), + QStringLiteral("SanitationProceduresNeeded"), + QStringLiteral("SanitationProceduresTaken")}); + break; + case EventType::CameraVideo: + attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("PartyId"), + QStringLiteral("MainStructureElementId"), + QStringLiteral("duration"), + QStringLiteral("streamName")}); + break; + case EventType::RadioCnr: + attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("PartyId"), + QStringLiteral("duration"), + QStringLiteral("streamName")}); + break; + case EventType::RadioTvc: + attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("duration"), + QStringLiteral("streamName")}); + + break; + case EventType::HitEffectSimulation: + attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesType"), + QStringLiteral("AesName"), + QStringLiteral("OriginatorChargeTypeId")}); + break; + case EventType::HitC: + case EventType::HitB: + case EventType::HitMine: + case EventType::EnterMineArea: + case EventType::LeaveMineArea: + attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesName"), + QStringLiteral("OriginatorChargeTypeId")}); + break; + case EventType::HitN: + case EventType::HitGasPipe: + case EventType::EnterDangerArea: + case EventType::LeaveDangerArea: + case EventType::CrossLocalBorderline: + case EventType::CrossGlobalBorderline: + case EventType::EnterFunctionalArea: + case EventType::LeaveFunctionalArea: + case EventType::EnterNuclear: + case EventType::LeaveNuclear: + attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesName")}); + break; + case EventType::Borderline: + case EventType::NContamination: + case EventType::DangerArea: + case EventType::FunctionalArea: + case EventType::MineCorridor: + case ProjectDataManagement::EventType::GasPipe: + attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesName"), + QStringLiteral("duration")}); + break; + case EventType::MineArea: + case EventType::BCContamination: + attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesName"), + QStringLiteral("duration"), + QStringLiteral("ChargeTypeId")}); + break; + case EventType::Unknown: + case EventType::FriendlyFire: + case EventType::TechnicalArea: + case EventType::EquipmentErrorReport: + case EventType::EmergencyCall: + Q_ASSERT(false); + continue; + } + addEventType(eventType); + } + + // populate Attribute Types - see /home/ref/TDS/src/Lts/Services/ExerciseEventManagement/eem_service.xml:52 + /* + * retrieved as of 2017-09-04 + * + * + * FireEvent: + * GearId + * GearTypeId + * ChargeTypeId + * Remain + * + * WeaponAssignment: + * GearId + * GearTypeId + * DryFire + * + * Manipulation: => show bite window + * DeviceType + * BiteMessage + * BatteryState + * BiteState + * ConfigState + * JsonArray BiteErrors: + * ErrorNo + * CanDeviceNumber + * SubDeviceNumber + * UniqueId + * + * HitBuilding: + * ChargetTypeId + * damagePercent + * damagePercentOld + * AesId + * VunerabilityState + * OriginatorParticipantId + * MainStructureElementId + * + * + * >>> Ab hier bin ich mir nicht mehr Sicher, was genau im Comment gemeint ist... + * HitIndrect: + * HitMine: + * HitN: + * HitC: + * EnterDangerArea: + * LeaveDangerArea: + * CES: + * AesId + * FriendlyFire + */ + + /* Jedes Attribute benoetigt einen Interpreter Typen. Ein Interpreter Typ sagt dem Interpreter, wie er den Wert eines Attributs auf den Filter anwenden kann. Hier als Beispiel: + * "OriginatorChargeTypeId" ist ein Attribut, welches bloß eine Value ID zurueckgibt. D.h. id:9000 (wird dann später einem lesbaren Wert zugeordnet: z.B: "30mm Irgendwas") + * SOll der Wert im Filter also verglichen werden, muessen hier die IDs verglichen werden. Id 9000 => Id 9000. + * Hier ist also folgender Interpreter korrekt: INTERPRETER_TYPE_ID_COMPARE + * + * Anderes Beispiel: + * Zeit. Wird als Filter eine Zeit zwischen X und Y angegeben, muss geschaut werden, ob die Zeit Z sich zwischen X und Y befindet. Mit "INTERPRETER_TYPE_ID_COMPARE" wuerde das + * nicht funktionieren, da sonst nur EINE Zeit (naemlich genau Zeitpunkt Z) beim Interpreter korrekt ist. Fuer diesen Fall gibt es "INTERPRETER_TYPE_RANGE". + * Dieser Interpreter prueft, ob etwas in der Range zwischen X und Y ist. + */ + + // AttributeUiTypeLookup: Wie wird das Attribut angezeigt? Bei einer Liste aus Einträgen: COmboBox, oder wenn z.B. es nur 2 Zustände gib: FriendlyFire => Yes / No => CheckBox + + addAttributeType(QStringLiteral("TimeRange"), tr("Time range:"), ATTRIBUTE_UI_TYPE_TIME_RANGE_WIDGET /* TODO: none! */, INTERPRETER_TYPE_TIME); // is added in getDetailData as dummy so that the filter has a value to filter with TimeRange + + + // Vulnerability State: + addAttributeType(QStringLiteral("VulnerabilityState"), tr("Vulnerability State:")); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::CombatReady); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::LightDamage); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::MediumDamage); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::HeavyDamage); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::MobilityKill); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::VisibleMobilityKill); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::WeaponSystemDamage); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::VisibleWeaponSystemDamage); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::CatastrophicKill); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::TemporarySeverance); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::NearMiss); + addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::HitWithNoEffect); + //addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::NotReady); + + + // Marker Types: + addAttributeTypeWithYesAndNo(QStringLiteral("IsSituationType"), tr("Is situation type:")); + addAttributeTypeWithYesAndNo(QStringLiteral("IsVideoType"), tr("Is video type:")); + addAttributeTypeWithYesAndNo(QStringLiteral("IsAudioType"), tr("Is audio type:")); + + + // AES Types: +// addRedirectedAttributeType(QStringLiteral("AesId"), tr("Aes Type:"), QStringLiteral("AesType")); // because the result type is Aes Type (but has to be resolved by looking at the AES behind the AesId + addAttributeType(QStringLiteral("AesType"), tr("Aes Type:")); + + //addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtUnknown); + addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtNContamination); + addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtBCContamination); + addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtExplosionArea); + addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtExplosionSingle); + addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtMineArea); + addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtDangerArea); + addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtFunctionalArea); + addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtMineCorridor); + addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtBorderline); + //addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtTechnicalArea); + //addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtExplosionAreaSingleExplosions); + addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtMineAreaSingleMines); + + + // Friendly Fire + addAttributeTypeWithYesAndNo(QStringLiteral("FriendlyFire"), tr("Friendly Fire:")); + + // Attribute: Dry Fire + addAttributeTypeWithYesAndNo(QStringLiteral("DryFire"), tr("Dry Fire:")); + + + + + // non-filterables: + addAttributeType(QStringLiteral("MarkerName"), tr("Name:"), ATTRIBUTE_UI_TYPE_CHECKBOX /* TODO: FIXME: none! */, INTERPRETER_TYPE_NONE); + addAttributeType(QStringLiteral("MarkerNote"), tr("Note:"), ATTRIBUTE_UI_TYPE_CHECKBOX /* TODO: FIXME: none! */, INTERPRETER_TYPE_NONE); + + + // TODO: + //(QStringLiteral("Remain"), tr("Remain:")); was ist "remain" ? + + + // Marker offset: + addAttributeType(QStringLiteral("MarkerOffset"), tr("Offset [msecs]:"), ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET /* 0 - x */, INTERPRETER_TYPE_RANGE); + { + DetailData::AttributeParameterLookup::ParameterMap pm; + pm.insert(DetailData::UI_PARAM_TYPE_MIN, QVariant::fromValue(0)); + pm.insert(DetailData::UI_PARAM_TYPE_MAX, QVariant::fromValue(9999999)); + pm.insert(DetailData::UI_PARAM_TYPE_SUFFIX, QVariant::fromValue(QString())); + pm.insert(DetailData::UI_PARAM_TYPE_PREFIX, QVariant::fromValue(QString())); + attributeParameterLookup.addParameter(QStringLiteral("MarkerOffset"), pm); + } + + + // Duration: + addAttributeType(QStringLiteral("duration"), tr("Duration [msecs]:"), ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET /* 0 - x */, INTERPRETER_TYPE_RANGE); + { + DetailData::AttributeParameterLookup::ParameterMap pm; + pm.insert(DetailData::UI_PARAM_TYPE_MIN, QVariant::fromValue(0)); + pm.insert(DetailData::UI_PARAM_TYPE_MAX, QVariant::fromValue(99999999)); + pm.insert(DetailData::UI_PARAM_TYPE_SUFFIX, QVariant::fromValue(QString())); + pm.insert(DetailData::UI_PARAM_TYPE_PREFIX, QVariant::fromValue(QString())); + attributeParameterLookup.addParameter(QStringLiteral("duration"), pm); + } + + + // Damage: + addAttributeType(QStringLiteral("damagePercent"), tr("Damage [%]:"), ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET /* 0 - 100 */, INTERPRETER_TYPE_RANGE); + addRedirectedAttributeType(QStringLiteral("damagePercentOld"), tr("Damage before [%]:"), QStringLiteral("damagePercent")); + + { + DetailData::AttributeParameterLookup::ParameterMap pm; + pm.insert(DetailData::UI_PARAM_TYPE_MIN, QVariant::fromValue(0)); + pm.insert(DetailData::UI_PARAM_TYPE_MAX, QVariant::fromValue(100)); + pm.insert(DetailData::UI_PARAM_TYPE_SUFFIX, QVariant::fromValue(tr(" %"))); + pm.insert(DetailData::UI_PARAM_TYPE_PREFIX, QVariant::fromValue(QString())); + attributeParameterLookup.addParameter(QStringLiteral("damagePercent"), pm); // only for filters (event filter), so only filtereable attributes like MUNITION_LEFT_BETWEEN (not MUNITION_LEFT!) + } + + // Equipment Numbers: (Achtung! Uebersetzt nur direkt eqid zu eqid !) + std::shared_ptr dtcPpm; + m_session->getDtc(dtcPpm); + addAttributeType(QStringLiteral("EquipmentNumber"), tr("Equip. No.:")); + m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("EquipmentNumber"), new AvmEquipmentNumber(dtcPpm)); + addRedirectedAttributeType(QStringLiteral("OriginatorEquipmentNumber"), tr("Equip. No. of Originator:"), QStringLiteral("EquipmentNumber")); + + std::shared_ptr dtcPdm; + m_session->getDtc(dtcPdm); + // Charge Types: + addAttributeType(QStringLiteral("ChargeTypeId"), tr("Charge Type:")); // Achtung: OriginatorChargeTypeId wird auf den Generellen Typ "ChargeTypeId" weitergeleitet, daher muss nur der Interpreter Type des Haupt-Typen gesetzt werden! + addRedirectedAttributeType(QStringLiteral("OriginatorChargeTypeId"), tr("Originator Charge Type:"), QStringLiteral("ChargeTypeId")); + m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("ChargeTypeId"), new AvmChargeType(dtcPdm)); + + // Gear Types: + addAttributeType(QStringLiteral("GearTypeId"), tr("Gear Type:")); + m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("GearTypeId"), new AvmGearType(dtcPdm)); + + // Originator Types: + addAttributeType(QStringLiteral("OriginatorType"), tr("Originator Type:")); + addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::Unknown); + addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::Participant); + addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::AreaEffectSimulation); + addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::ObserverController); + addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::ExerciseControl); + //addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::WoundTreatmentDevice); + //addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::MaintainanceDevice); + addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::FunctionalArea); + addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::Initialization); + addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::ImprovisedExplosiveDevice); + addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::DusMine); + const bool showPvSan = LtsUtils::ProjectSettings::isFunctionEnabled(QStringLiteral("ParticipantInformation"), + QStringLiteral("HasPvSan")); + if (showPvSan) + addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::Sanitation); + + + // (ISM) Structure Elements: + std::shared_ptr dtcIsm; + m_session->getDtc(dtcIsm); + addAttributeType(QStringLiteral("MainStructureElementId"), tr("Building:")); + m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("MainStructureElementId"), new AvmBuilding(dtcIsm)); + + // (PPM) Parties + addAttributeType(QStringLiteral("PartyId"), tr("Party:")); + m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("PartyId"), new AvmParty(dtcPpm)); + + // (OPM) Operator Management: + std::shared_ptr dtcOpm; + m_session->getDtc(dtcOpm); + addAttributeType(QStringLiteral("Operator"), tr("Operator:")); + m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("Operator"), new AvmOperator(dtcOpm)); + + + // (AVM) Streams + std::shared_ptr dtcAvm; + m_session->getDtc(dtcAvm); + addAttributeType(QStringLiteral("streamName"), tr("Stream Name:")); + m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("streamName"), new AvmStreamName(dtcAvm)); +} + +DetailData::GetDetailDataResultList DetailData::getDetailData(const LtsTimelineClassic::Event *event) +{ + GetDetailDataResultList result; + + if (event->detailData().isEmpty()) // no detail data so search in + return result; + + const QJsonObject &root = event->detailData(); + for (auto i = root.constBegin(); i != root.constEnd(); ++i) + { + DEBUG_LOG(m_logger) << "Adding Detail Data for: " << i.key(); + result.append(getDetailDataForAttribute(i.key(), *i)); + } + + return result; +} + + +DetailData::GetDetailDataForAttributeResult DetailData::getDetailDataForAttribute(const LtsTimelineClassic::Event *event, const QString &attributeType) +{ + GetDetailDataForAttributeResult result; + + const QJsonObject &root = event->detailData(); + root[QStringLiteral("TimeRange")] = event->startTime() / 1000 /* as value would be too big for int => see getDetailDataForAttribute(..) */; // event time as temporary detail data + root[QStringLiteral("PartyId")] = event->partyId(); + + const QJsonValue attribute = root[attributeType]; + + if (attribute.isNull() || attribute.isUndefined()) + { + WARNING_LOG(m_logger) << "DetailData::getDetailDataForAttribute: no attribute type " << attributeType + << " in " << QJsonDocument(root).toJson(); + + result.requestResult = DetailData::RequestResult::InvalidAttributeType; + return result; + } + + return getDetailDataForAttribute(attributeType, attribute); +} + + +DetailData::GetDetailDataForAttributeResult DetailData::getDetailDataForAttribute(const QString &attributeType, const QJsonValue &attributeValueJson) +{ + GetDetailDataForAttributeResult result; + result.attributeTypeId = attributeType; + result.attributeValueId = -1; + result.requestResult = DetailData::RequestResult::Error; + QString attributeTypeTranslated = attributeTypeLookup.getAttributeText(attributeType); + + if (attributeTypeTranslated.isEmpty()) + { + result.requestResult = DetailData::RequestResult::InvalidAttributeType; + //ERROR_LOG(m_logger) << "getDetailDataForAttribute: Invalid Attribute Type for " << attributeType; + return result; + } + + result.attributeType = attributeTypeTranslated; + + int attributeValueId = -1; + + /* + enum Type + { + Null = 0x0, + Bool = 0x1, + Double = 0x2, + String = 0x3, + Array = 0x4, + Object = 0x5, + Undefined = 0x80 + }; + */ + + switch (attributeValueJson.type()) + { + // sorted by frequency of occurrence + case QJsonValue::Double: + { + attributeValueId = attributeValueJson.toInt(-1); + break; + } + + case QJsonValue::Null: + case QJsonValue::Undefined: + { + WARNING_LOG(m_logger) << "Timeline: DetailData::getDetailDataForAttribute: attribute value is null or undefined! " << attributeValueJson.toString(); + result.requestResult = DetailData::RequestResult::InvalidAttributeTypeJson; + return result; + } + + case QJsonValue::Bool: + { + attributeValueId = attributeValueJson.toBool() ? 1 : 0; + break; + } + + case QJsonValue::String: + { + bool k = false; + QString attributeValueString = attributeValueJson.toString(); + + if (attributeValueString.isEmpty()) + { + attributeValueId = -1; + break; + } + + attributeValueId = attributeValueString.toInt(&k); + + if (!k) // not a number but treat as text... NOTE: has no id + { + result.attributeValue = attributeValueString; + result.requestResult = DetailData::RequestResult::Okay; + return result; + } + + break; + } + + default: + { + WARNING_LOG(m_logger) << "Timeline: DetailData::getDetailDataForAttribute: attribute value cannot be handled. Type " << attributeValueJson.type() << attributeValueJson.toString(); + result.requestResult = DetailData::RequestResult::InvalidAttributeType; + return result; + } + } + + if (attributeValueId == -1) + { + result.requestResult = DetailData::RequestResult::InvalidAttributeType; + return result; + } + + result.attributeValueId = attributeValueId; + + + // there are values that do not have to be translated: + int attributeUiType = attributeUITypeLookup.getUIType(attributeType); + switch (attributeUiType) + { + // do not translate + case ATTRIBUTE_UI_TYPE_TIME_RANGE_WIDGET: + case ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET: + case ATTRIBUTE_UI_TYPE_RAD_RANGE_WIDGET: + case ATTRIBUTE_UI_TYPE_AREA_RANGE_WIDGET: + { + result.attributeValue = QString::number(attributeValueId); // use "id" as "translated" string + result.requestResult = DetailData::RequestResult::Okay; + + break; + } + + // translate + case ATTRIBUTE_UI_TYPE_COMBO_BOX: + case ATTRIBUTE_UI_TYPE_CHECKBOX: + { + result.attributeValue = attributeValueLookup.getValueStringFromValueId(attributeType, attributeValueId); + if (result.attributeValue.isEmpty()) + result.attributeValue = m_attributeValueLookupDtc.getValueStringFromValueId(attributeType, attributeValueId); + result.requestResult = DetailData::RequestResult::Okay; + break; + } + + + default: // -1 + { + // maybe the type was redirected? + QString concreteAttributeType = attributeRedirectionLookup.getRedirection(attributeType); + + if (concreteAttributeType == attributeType) // it was not redirected - give up! + { + ERROR_LOG(m_logger) << "getDetailDataForAttribute: attribute type " << attributeType << " does not have an UiType !!!"; + result.requestResult = DetailData::RequestResult::NoUiTypeForAttribute; + } + else // there is a redirection, try this method with the redirection + { + //qWarning() << "trying redirection for attribute type" << attributeType; + + // save some results, as getDetailDataForAttribute will set ALL the results for the redirection, instead of ONLY the value.. + QString attributeType = result.attributeType; + QString attributeTypeId = result.attributeTypeId; + + result = getDetailDataForAttribute(concreteAttributeType, attributeValueJson); + + result.attributeType = attributeType; + result.attributeTypeId = attributeTypeId; + } + + break; + } + } + + return result; +} + + +void DetailData::createRetrieveCurrentTimeCallback(LtsWidgets::LtsDateTimeEdit *dateTimeEdit) +{ + dateTimeEdit->setRetrieveCurrentTimeCallback([this]() { return m_session->partitionTime(); }); +} + + +// LOOKUP BASE +DetailData::LookupBase::LookupBase(const QString &lookupClassName) + : m_lookupClassName(lookupClassName) + , m_logger(getLogger(QStringLiteral("DetailData.") + lookupClassName)) +{ + +} + + +// EVENT TYPE LOOKUP +DetailData::EventTypeLookup::EventTypeLookup() + : LookupBase(QStringLiteral("EventTypeLookup")) +{ +} + +void DetailData::EventTypeLookup::addEventType(const int key, const QString &value) +{ + m_eventTypeMap.insert(key, value); +} + +int DetailData::EventTypeLookup::getEventType(const QString &eventText) const +{ + // as eventText is simplified, method 'key' would not work + + const QString paramText = removeSpaces(eventText); + for (auto i = m_eventTypeMap.constBegin(); i != m_eventTypeMap.constEnd(); ++i) + { + const QString mapText = removeSpaces(i.value()); + if (mapText == paramText) + return i.key(); + } + + return -1; // -1 = invalid ! +} + +QString DetailData::EventTypeLookup::getEventText(const int eventType) const +{ + return m_eventTypeMap.value(eventType); +} + +bool DetailData::EventTypeLookup::isEventExists(const int eventType) const +{ + return m_eventTypeMap.contains(eventType); +} + +QStringList DetailData::EventTypeLookup::getEventTexts() const +{ + return m_eventTypeMap.values(); +} + + + +// ATTRIBUTE EVENT LOOKUP +DetailData::AttributeEventLookup::AttributeEventLookup() + : LookupBase(QStringLiteral("AttributeEventLookup")) +{ +} + +void DetailData::AttributeEventLookup::addAttributesToEvent(const int eventType, const AttributeList &attributeTypeList) +{ + AttributeList &al = m_attributeEventLookupMap[eventType]; + al += attributeTypeList; +} + +void DetailData::AttributeEventLookup::addAttributesToEvent(const ProjectDataManagement::EventType &eventType, const AttributeList &attributeTypeList) +{ + addAttributesToEvent(eventType.underlying(), attributeTypeList); +} + +bool DetailData::AttributeEventLookup::isAttributeInEvent(const int eventType, const QString &attributeType) +{ + auto eventTypeIt = m_attributeEventLookupMap.constFind(eventType); + + if (eventTypeIt == m_attributeEventLookupMap.constEnd()) + return false; // event does not even exist + + const AttributeList &attributeList = *eventTypeIt; + + if (attributeList.contains(attributeType)) + return true; + + return false; +} + +DetailData::AttributeEventLookup::AttributeList DetailData::AttributeEventLookup::getEventsAttributeList(const int eventType) const // get all attribute types from the event +{ + return m_attributeEventLookupMap.value(eventType); +} + + + +// ATTRIBUTE TEXT LOOKUP +DetailData::AttributeTypeLookup::AttributeTypeLookup() + : LookupBase(QStringLiteral("AttributeTypeLookup")) +{ +} + +void DetailData::AttributeTypeLookup::addAttributeText(const QString &attributeType, const QString &attributeText) +{ + m_attributeTypeLookupMap.insert(attributeType, attributeText); +} + +QString DetailData::AttributeTypeLookup::getAttributeType(const QString &attributeText) const +{ + const QString paramText = removeSpaces(attributeText); + // as eventText is simplified, method 'key' would not work + for (auto i = m_attributeTypeLookupMap.constBegin(); i != m_attributeTypeLookupMap.constEnd(); ++i) + { + const QString mapText = removeSpaces(i.value()); + if (mapText == paramText) + return i.key(); + } + + WARNING_LOG(m_logger) << "getAttributeType: attribute type not found by text '" << attributeText << "'"; + return QString(); // invalid +} + +DetailData::AttributeTypeLookup::AttributeTypeList DetailData::AttributeTypeLookup::getAttributeTypes() const +{ + return m_attributeTypeLookupMap.keys(); +} + +QString DetailData::AttributeTypeLookup::getAttributeText(const QString &attributeType, const QString &defaultReturnValue) const +{ + return m_attributeTypeLookupMap.value(attributeType, defaultReturnValue); +} + +DetailData::AttributeTypeLookup::AttributeTextList DetailData::AttributeTypeLookup::getAttributeTexts() const +{ + return m_attributeTypeLookupMap.values(); +} + + +// ATTRIBUTE PARAMETER LOOKUP +DetailData::AttributeParameterLookup::AttributeParameterLookup() + : LookupBase(QStringLiteral("AttributeParameterLookup")) +{ +} + +void DetailData::AttributeParameterLookup::addParameter(const QString &attributeType, const ParameterMap ¶meterMap) +{ + if (!parameterMap.count()) + { + WARNING_LOG(m_logger) << "addParameter: parameter map is empty!"; + return; + } + + m_attributeParameterMap.insert(attributeType, parameterMap); +} + +DetailData::AttributeParameterLookup::ParameterMap DetailData::AttributeParameterLookup::getParameterMap(const QString &attributeType) const +{ + return m_attributeParameterMap.value(attributeType); +} + +QVariant DetailData::AttributeParameterLookup::getParameterValue(const QString &attributeType, const int parameterType) const +{ + const ParameterMap &pm = getParameterMap(attributeType); + + auto pmci = pm.constFind(parameterType); + + if (pmci == pm.constEnd()) // exists? FIXME: in NGLDAO Timeline: "!=" !! + return QVariant(); + + return *pmci; +} + + + +// ATTRIBUTE UI TYPE +DetailData::AttributeUITypeLookup::AttributeUITypeLookup() + : LookupBase(QStringLiteral("AttributeUITypeLookup")) +{ +} + +void DetailData::AttributeUITypeLookup::addUITypeToAttribute(const QString &attributeType, const int uiType) +{ + m_attributeUITypeLookupMap.insert(attributeType, uiType); +} + +int DetailData::AttributeUITypeLookup::getUIType(const QString &attributeType) const +{ + return m_attributeUITypeLookupMap.value(attributeType, -1); // -1 = invalid +} + + +// INTERPRETER LOOKUP +DetailData::AttributeInterpreterLookup::AttributeInterpreterLookup() + : LookupBase(QStringLiteral("AttributeInterpreterLookup")) +{ +} + +void DetailData::AttributeInterpreterLookup::addInterpreterTypeToAttribute(const QString &attributeType, const int interpreterType) +{ + m_attributeInterpreterLookupMap.insert(attributeType, interpreterType); +} + +int DetailData::AttributeInterpreterLookup::getInterpreterType(const QString &attributeType) const +{ + return m_attributeInterpreterLookupMap.value(attributeType); +} + + + +// ATTRIBUTE VALUE LOOKUP +DetailData::AttributeValueLookup::AttributeValueLookup() + : LookupBase(QStringLiteral("AttributeValueLookup")) +{ +} + + +void DetailData::AttributeValueLookup::removeValueFromAttributeValueMap(const QString &attributeType, const int valueKey) +{ + auto attributeTypeValueMapIt = m_attributeTypeValueMap.find(attributeType); + + if (attributeTypeValueMapIt == m_attributeTypeValueMap.end()) // there are currently no values for this attribute type, insert all new values + return; // attribute type not even found! + + AttributeValueMap ¤tAttributeValueMap = *attributeTypeValueMapIt; + currentAttributeValueMap.remove(valueKey); +} + + +void DetailData::AttributeValueLookup::addValueToAttributeValueMap(const QString &attributeType, const int valueKey, const QString &valueValue) +{ + AttributeValueMap &avm = m_attributeTypeValueMap[attributeType]; + avm.insert(valueKey, valueValue); +} + + +void DetailData::AttributeValueLookup::addValuesToAttributeValueMap(const QString &attributeType, const AttributeValueMap &avm) // add a VALUE (consisting of id & string) to the map coresponding to the attribute type +{ + AttributeValueMap &thisAvm = m_attributeTypeValueMap[attributeType]; + for (auto i = avm.constBegin(); i != avm.constEnd(); ++i) + { + thisAvm.insert(i.key(), i.value()); + } +} + +AttributeValueMap DetailData::AttributeValueLookup::getAttributeValueMap(const QString &attributeType) const +{ + return m_attributeTypeValueMap.value(attributeType); +} + +QString DetailData::AttributeValueLookup::getValueStringFromValueId(const QString &attributeType, const int attributeValueId, const QString& defaultValue) const +{ + return getAttributeValueMap(attributeType).value(attributeValueId, defaultValue); +} + +void DetailData::AttributeValueLookup::clear() +{ + m_attributeTypeValueMap.clear(); +} + + +// ATTRIBUTE REDIRECTION LOOKUP +DetailData::AttributeRedirectionLookup::AttributeRedirectionLookup() + : LookupBase(QStringLiteral("AttributeRedirectionLookup")) +{ +} + +void DetailData::AttributeRedirectionLookup::addRedirection(const QString &attributeType, const QString &redirectTo) +{ + m_attributeRedirectionMap.insert(attributeType, redirectTo); +} + +QString DetailData::AttributeRedirectionLookup::getRedirection(const QString &attributeType) const +{ + auto it = m_attributeRedirectionMap.find(attributeType); + if (it == m_attributeRedirectionMap.end()) + return attributeType; + return it.value(); +} + + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.h new file mode 100755 index 000000000..eefeca056 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.h @@ -0,0 +1,343 @@ +/** + * @RDE_HEADER@ + * Model to handle datail data for the different event types + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-09-04 + */ +#pragma once + +#include "logger.h" + +#include +#include + +#include // needed for this header + +#include +#include +#include + +#include "attribute_value_lookup.h" + +namespace LtsSession +{ +class LtsSession; +} +namespace LtsTimelineClassic +{ +class Event; +} +namespace LtsWidgets +{ +class LtsDateTimeEdit; +} + + +namespace Timeline +{ +constexpr int markerTypeId = 999999; // HACK: there is no marker type + +class DetailData : public QObject +{ + Q_OBJECT + +public: + enum class RequestResult + { + Error = 0, + Okay = 1, + InvalidAttributeType, + NoValueTranslationForAttribute, + NoUiTypeForAttribute, + InvalidAttributeTypeJson, + JsonCorrupted + }; + + struct GetDetailDataForAttributeResult + { + QString attributeType; // translated! "Friendly Fire" instead of the key "FriendlyFire" + QString attributeValue; // also translated! "No" instead of the key "0" + + QString attributeTypeId; // "FriendlyFire" instead of the translated version "Friendly Fire" + int attributeValueId = 0; + RequestResult requestResult = RequestResult::Error; + }; + + using GetDetailDataResultList = QVector; + + enum AttributeUITypes // attribute ui types + { + ATTRIBUTE_UI_TYPE_TIME_RANGE_WIDGET = 0, + ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET, + ATTRIBUTE_UI_TYPE_AREA_RANGE_WIDGET, + ATTRIBUTE_UI_TYPE_COMBO_BOX, // most attributes use this + ATTRIBUTE_UI_TYPE_CHECKBOX, + ATTRIBUTE_UI_TYPE_RAD_RANGE_WIDGET + }; + + enum UIParameterType + { + UI_PARAM_TYPE_N1, + UI_PARAM_TYPE_N2, + UI_PARAM_TYPE_O1, + UI_PARAM_TYPE_O2, + UI_PARAM_TYPE_RAD, + + UI_PARAM_TYPE_MIN, + UI_PARAM_TYPE_MAX, + UI_PARAM_TYPE_PREFIX, + UI_PARAM_TYPE_SUFFIX + }; + + enum InterpreterTypes + { + INTERPRETER_TYPE_NONE = 0, // ERROR VALUE + //INTERPRETER_TYPE_TOINT, + INTERPRETER_TYPE_RANGE, + INTERPRETER_TYPE_AREA, // for filter interpreter + INTERPRETER_TYPE_ID_COMPARE, // or key compare + INTERPRETER_TYPE_STR_COMPARE, // or value compare [deprecated - do not use] + INTERPRETER_TYPE_POSITION, // for event info windows line edits ! + INTERPRETER_TYPE_TIME, // for event info windows line edits ! + INTERPRETER_TYPE_DURATION, // for event info windows line edits ! + INTERPRETER_TYPE_RAD + }; + + + explicit DetailData(LtsSession::LtsSession *session, QObject *parent = nullptr); + + void populate(); + GetDetailDataResultList getDetailData(const LtsTimelineClassic::Event *event); + GetDetailDataForAttributeResult getDetailDataForAttribute(const LtsTimelineClassic::Event *event, const QString &attributeType); + void createRetrieveCurrentTimeCallback(LtsWidgets::LtsDateTimeEdit *dateTimeEdit); + LtsSession::LtsSession *session() { return m_session; } + + +private: + /** + * @brief addRedirectedAttributeType just like "addAttributeType", but automatically redirects to "redirectionAttributeTypeId" (note that redirected attributes do not need to have ui types or interpreter types) + * @param attributeTypeId + * @param attributeText + * @param redirectionAttributeTypeId + */ + void addRedirectedAttributeType(const QString &newAttributeTypeId, const QString &attributeText, const QString &redirectToAttributeTypeId); + void addAttributeType(const QString &attributeTypeId, const QString &attributeText, const int uiTypeId = ATTRIBUTE_UI_TYPE_COMBO_BOX, const int interpreterTypeId = INTERPRETER_TYPE_ID_COMPARE); + + void addAttributeTypeWithYesAndNo(const QString &attributeTypeId, const QString &attributeText) + { + addAttributeType(attributeTypeId, attributeText, ATTRIBUTE_UI_TYPE_CHECKBOX); + attributeValueLookup.addValueToAttributeValueMap(attributeTypeId, 0, tr("No")); + attributeValueLookup.addValueToAttributeValueMap(attributeTypeId, 1, tr("Yes")); + } + + template + void addAttributeValue(const QString &attributeTypeId, const AttributeEnumType &attributeEnum) + { + //qWarning() << "<<<" << attributeTypeId << ":" << (int)attributeEnum << "=>" << toString(attributeEnum); + attributeValueLookup.addValueToAttributeValueMap(attributeTypeId, (int)attributeEnum, toString(attributeEnum)); + } + + void addEventType(int eventTypeId, const QString &eventTypeString); + void addEventType(const ProjectDataManagement::EventType &eventType); + + GetDetailDataForAttributeResult getDetailDataForAttribute(const QString &attributeType, const QJsonValue &attributeValueJson); + + LtsSession::LtsSession *m_session; + bool __already_populated__; // do not allow secondary population, this would take to much time to develop atm + + NGL::INGLLogger &m_logger; + +public: + + class LookupBase + { + public: + explicit LookupBase(const QString &lookupClassName); + + protected: + QString m_lookupClassName; + NGL::INGLLogger &m_logger; + }; + + + class EventTypeLookup : public LookupBase + { + public: + using EventTypeMap = QMap; // example: 3, 'Hit' + + EventTypeLookup(); + + void addEventType(const int key, const QString &value); + int getEventType(const QString &eventText) const; + QString getEventText(const int eventType) const; + QStringList getEventTexts() const; // all texts + bool isEventExists(const int eventType) const; + + private: + EventTypeMap m_eventTypeMap; + }; + EventTypeLookup eventTypeLookup; + + + class AttributeTypeLookup : public LookupBase + { + public: + using AttributeTypeLookupMap = QMap; + using AttributeTypeList = QList; + using AttributeTextList = QStringList; + + AttributeTypeLookup(); + + void addAttributeText(const QString &attributeType, const QString &attributeText); + QString getAttributeType(const QString &attributeText) const; + AttributeTypeList getAttributeTypes() const; + QString getAttributeText(const QString &attributeType, const QString &defaultReturnValue = QString()) const; + AttributeTextList getAttributeTexts() const; + + private: + AttributeTypeLookupMap m_attributeTypeLookupMap; + }; + AttributeTypeLookup attributeTypeLookup; + + + class AttributeEventLookup : public LookupBase + { + public: + using AttributeEventLookupMap = QMap /* attributeTypeId List */>; + using AttributeList = QList; + + AttributeEventLookup(); + + void addAttributesToEvent(const int eventType, const AttributeList &attributeTypeList); + void addAttributesToEvent(const ProjectDataManagement::EventType &eventType, const AttributeList &attributeTypeList); + bool isAttributeInEvent(const int eventType, const QString &attributeType); + AttributeList getEventsAttributeList(const int eventType) const; // get all attribute types from the event + + private: + AttributeEventLookupMap m_attributeEventLookupMap; + }; + AttributeEventLookup attributeEventLookup; + + + class AttributeParameterLookup : public LookupBase // as ui type is fixed for attribute type, it is perfectly okay to request parameters (min, max, etc.) by attribute type + { + public: + using ParameterMap = QMap; // Parameter Type => Parameter String + using AttributeParameterMap = QHash; + + AttributeParameterLookup(); + + void addParameter(const QString &attributeType, const ParameterMap ¶meterMap); // add a parameter map to the lookup + ParameterMap getParameterMap(const QString &attributeType) const; + QVariant getParameterValue(const QString &attributeType, const int parameterType) const; + + private: + AttributeParameterMap m_attributeParameterMap; + }; + AttributeParameterLookup attributeParameterLookup; + + + class AttributeUITypeLookup : public LookupBase + { + public: + using AttributeUITypeLookupMap = QHash; + + AttributeUITypeLookup(); + + void addUITypeToAttribute(const QString &attributeType, const int uiType); + int getUIType(const QString &attributeType) const; + + private: + AttributeUITypeLookupMap m_attributeUITypeLookupMap; + }; + AttributeUITypeLookup attributeUITypeLookup; + + + class AttributeInterpreterLookup : public LookupBase + { + public: + using AttributeInterpreterLookupMap = QHash; + + AttributeInterpreterLookup(); + + void addInterpreterTypeToAttribute(const QString &attributeType, const int interpreterType); + int getInterpreterType(const QString &attributeType) const; + + private: + AttributeInterpreterLookupMap m_attributeInterpreterLookupMap; + }; + AttributeInterpreterLookup attributeInterpreterLookup; + + + class AttributeValueLookup : public LookupBase + { + public: + AttributeValueLookup(); + + void addValueToAttributeValueMap(const QString &attributeType, const int valueKey, const QString &valueValue /* ^^ */); + void removeValueFromAttributeValueMap(const QString &attributeType, const int valueKey); + void addValuesToAttributeValueMap(const QString &attributeType, const AttributeValueMap &avm); // add a VALUE (consisting of id & string) to the map coresponding to the attribute type + void clear(); // clears map for updating map and sets to uninitialized + + AttributeValueMap getAttributeValueMap(const QString &attributeType) const; + QString getValueStringFromValueId(const QString &attributeType, const int attributeValueId, const QString &defaultValue = QString()) const; + + private: + AtributeValueLookupMap m_attributeTypeValueMap; // contains a map for each attribute type, that contain a map for their keys & values + }; + AttributeValueLookup attributeValueLookup; + + class AttributeValueLookupDtc : public LookupBase + { + public: + AttributeValueLookupDtc() : LookupBase(QStringLiteral("AttributeValueLookupDtc")) {} + ~AttributeValueLookupDtc() { qDeleteAll(m_provider); } + + // takes ownership on provider + void addHandlerForDtc(const QString &attributeType, AttributeValueLookupProvider *provider) + { + auto &p = m_provider[attributeType]; + delete p; + p = provider; + } + AttributeValueMap getAttributeValueMap(int eventType, const QString &attributeType) const + { + const auto provider = m_provider.value(attributeType); + if (!provider) + return {}; + return provider->getAttributeValueMap(eventType); + } + QString getValueStringFromValueId(const QString &attributeType, int attributeValueId) const + { + const auto provider = m_provider.value(attributeType); + if (!provider) + return {}; + return provider->getValueStringFromValueId(attributeValueId); + } + private: + QHash m_provider; + }; + AttributeValueLookupDtc m_attributeValueLookupDtc; + AttributeValueMap operatorsForEventType(int eventType) const; + QString operatorNameFromId(int id) const; + + class AttributeRedirectionLookup : public LookupBase + { + public: + using AttributeRedirectionMap = QHash; + + explicit AttributeRedirectionLookup(); + + void addRedirection(const QString &attributeType, const QString &redirectTo); + QString getRedirection(const QString &attributeType) const; // returns redirection, or if no redirection for attribute type, then returns original attribute type + + private: + AttributeRedirectionMap m_attributeRedirectionMap; + }; + AttributeRedirectionLookup attributeRedirectionLookup; +}; + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.cpp new file mode 100755 index 000000000..e96553c19 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.cpp @@ -0,0 +1,218 @@ +#include "excon_filter.h" +#include "detail_data.h" +#include "EventFilter/interpreter/FilterWorker.h" +#include "EventFilter/interpreter/FilterEquationFunctions.h" + +#include +#include +#include +#include "logger.h" + +#include + + +namespace Timeline +{ + +//m_rootItem->getFullEventList(true, true); +static LtsTimelineClassic::EventList applyFilter(DetailData *detailData, + const LtsTimelineClassic::EventList &eventList, + const ModelFilterList &modelFilterList, + bool simulation) // returns remaining/visible events +{ + NGL::INGLLogger &logger(getLogger("ExconFilter")); + /* + * + * general event can be filtered by event's default base data (time, duration, etc.) + * .. and can be filtered by e.g. position (if the inherit event contains a position - if not, ignore error) + * + */ + + //const QSet eventOnlyEventList = getEventOnlyEventList(modelFilterList); + //EventList eventList = eventListToFilter; //m_rootItem->getFullEventList(true, true); // get all events from model's root item, recursive and all (even hidden, logically) events + LtsTimelineClassic::EventList visibleEvents; + + bool resetFilterOnly = false; + + if (!modelFilterList.count()) // no filters set = no events to filter => show all events + { + DEBUG_LOG(logger) << "applyFilter: Model Filter List is EMPTY"; + + if (simulation) // do not return any visible event if there is NO filter (or every event will be shown which is NOT a nice feature) + return visibleEvents; + + resetFilterOnly = true; + } + + visibleEvents = eventList; // copy list of pointers (!) + + + QSet mentionedEventTypes; + mentionedEventTypes.insert(markerTypeId); // markers are always visible! + + for (const FilterWorker::ModelFilter &mf : modelFilterList) + { + if (mf.active) + mentionedEventTypes.insert(mf.eventType); + } + + /* the filter must consider one of these 2 cases + * + * case 1: filter all events - if there is "General Event" only + * case 2: case 1 + hide all events that are not mentioned - if there are other events than "General Event" AND the "General Event" + */ + + bool showAllEvents = false; + + if (mentionedEventTypes.count() == 1 && mentionedEventTypes.contains(0 /* GENERAL_EVENT */)) + showAllEvents = true; + + + // PER ATTRIBUTE THERE MUST BE AT LEAST ONE FITTING VALUE ! (or) + for (LtsTimelineClassic::Event *event : eventList) // go through all events in model + { + if (!event) + { + WARNING_LOG(logger) << "applyFilter: Erroneous event!"; + continue; // next event, we can't handle this event + } + + int eventType = event->typeId(); + //int eventID = event->getID(); + + if (resetFilterOnly /*|| eventOnlyEventList.contains(eventType)*/) // reset filter or show entire event type when event type is event-type-filter (& search eoe list for current events event type) + { + if (!simulation) + event->show(); + + // no inc / dec needed for vec here ! + + continue; // do not filter further - done! + } + + bool eventVisible = true; + + // check if event must be filtered (mentioned in model filter list) + if (!showAllEvents && !mentionedEventTypes.contains(eventType)) + eventVisible = false; + + if (!eventVisible /*&& m_showOnlyThese*/) // TODO: settings for "SHOW ALL BUT FILTER ONLY THESE" and "SHOW ONLY THESE" + { + if (!simulation) + event->hide(); + + visibleEvents.removeAll(event); + continue; + } + + const auto eventsAttributeList = detailData->attributeEventLookup.getEventsAttributeList(eventType); // get attribute types from event + + // at least one value has to fit per attribute !! (or) + for (const QString &attributeType : eventsAttributeList) // attribute of event [[ATTR]] + { + QString concreteAttributeType = detailData->attributeRedirectionLookup.getRedirection(attributeType); // why did I not "get the concrete type in any case" back then? + bool visibleByAttribute = false; // false from the beginning, because at least one value HAS TO FIT to an attribute + bool attributeTypeMentioned = false; // if not filtered by an attribute, then do not filter by this attribute + + + // no fitting value? then hide event + for (const FilterWorker::ModelFilter &mf : modelFilterList) // values from filter list [[VAL]] + { + if (mf.eventType == eventType || mf.eventType == 0 /* GENERAL_EVENT */) // if true, there are only ModelFilters for General Event (which filters all events) [General Event's attributes get applied on all other Events] + { + if (mf.attributeType == concreteAttributeType && mf.active) // the attribute from the event looking for? + { + attributeTypeMentioned = true; // actually filtering by this attribute ! + + DetailData::GetDetailDataForAttributeResult result = detailData->getDetailDataForAttribute(event, attributeType); // get attribute from event detail data (zwmsdd) + if (result.requestResult != DetailData::RequestResult::Okay) // detail data not found for attr type? must be a redirection + result = detailData->getDetailDataForAttribute(event, concreteAttributeType); // TRY REDIRECTION + + /* filter says: look for detail data with attr type "area_pos" => must be redirected before doing this to "position" + * filter says: look for "attribute verursacher" => do NOT redirect as this is an existing detail data! */ + + /* attribute types with ui type for combobox can redirect unproblematically (same as in filter equation functions) + * => attribute types with special ui type(s) should not be redirected + * so if the attempt to lookup a attribute interpreter type fails, try another lookup with redirection + * side effects: when new attribute types are not completly integrated + * guess: ???? + */ + + if (result.requestResult != DetailData::RequestResult::Okay) // detail data not found for attr type? must be a redirection + { + WARNING_LOG(logger) << "applyFilter: result.requestResult != DetailData::OKAY -" << (int)result.requestResult; + continue; // // TODO: show error and continue + } + + //qWarning() << "checkValue: type" << concreteAttributeType << "value id" << result.attributeValueId << "filter value" << mf.attributeValue << "(value as string:"<setVisible(eventVisible); + + if (!eventVisible) + visibleEvents.removeAll(event); + } + + DEBUG_LOG(logger) << "applyFilter: Visible Events after applying filter:" << visibleEvents.count(); + + return visibleEvents; +} + + +LtsTimelineClassic::EventList setFilter(DetailData *detailData, + const LtsTimelineClassic::EventList &eventListToFilter, + const QJsonArray &filter, + QWidget *parentWidget, + bool simulation, + bool handleResult) +{ + /*/ + * + * Filter Text: + * + * Syntax : [Filter];[Filter]; ... + * Filter : [Event Type]:[Attribute]+[Attribute]+ ... + * Attribute : [Attr Type]{[Attr Value],[Attr Value], ...} + * + /*/ + + LtsTimelineClassic::EventList visibleEvents; + + FilterWorker::GetModelFilterListResult result = FilterWorker::getModelFilterList(detailData, filter, true /* type safe !! */); // get model filter list by the filter text + ModelFilterList modelFilterList = result.result; + if (handleResult) + FilterWorker::getInstance()->handleResultValues(result.resultValueList, parentWidget); + + visibleEvents = applyFilter(detailData, eventListToFilter, modelFilterList, simulation); // apply the model filter list to the timeline + + + return visibleEvents; +} + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.h new file mode 100755 index 000000000..26acdd9a4 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.h @@ -0,0 +1,22 @@ +#pragma once + +#include + +#include + + +class QWidget; + + +namespace Timeline +{ +class DetailData; + +LtsTimelineClassic::EventList setFilter(DetailData *detailData, + const LtsTimelineClassic::EventList &eventListToFilter, + const QJsonArray &filter, + QWidget *parentWidget, + bool simulation = false, + bool handleResult = true); +} + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.cpp new file mode 100755 index 000000000..c0c543dff --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.cpp @@ -0,0 +1,37 @@ +/** + * @RDE_HEADER@ + * Building - logging facility + * $Id$ + * $HeadURL$ + * $Author$ + */ + +#include "logger.h" + +#include + +namespace Timeline +{ + +LOGGER_T getLogger(const char *name) +{ + static const char ns[] = "Plugins.Timeline.Gui."; + std::string loggerName; + const size_t len = strlen(name); + loggerName.reserve(sizeof(ns) + len); + loggerName.append(ns, sizeof(ns) - 1); + loggerName.append(name, len); + + try + { + return NGL::NGLLoggerBootstrap::getNGLRootLogger(). + getNGLLogger(loggerName); + } + catch (const std::exception &ex) + { + fprintf(stderr, "Error retrieving logger: %s", ex.what()); + abort(); + } +} + +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.h new file mode 100755 index 000000000..94743c27c --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.h @@ -0,0 +1,23 @@ +/** + * @RDE_HEADER@ + * Logging for BuildingViewer + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Patric Karwat, SLSE, 2016-08-17 + */ + +#pragma once + +#include + +namespace Timeline +{ +using LOGGER_T = NGL::INGLLogger &; + +LOGGER_T getLogger(const char *name); +inline LOGGER_T getLogger(const QString &loggerName) +{ + return getLogger(loggerName.toUtf8().constData()); +} +} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.cpp new file mode 100755 index 000000000..feeab6182 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.cpp @@ -0,0 +1,111 @@ +/** + * @RDE_HEADER@ + * ExerciseManangement - Exercise Overview Dialog + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-02-10 + */ + +#include "tln_cache_dialog.h" +#include "ui_tln_cache_dialog.h" + +#include + +#include + + +namespace Timeline +{ + +TimelineCacheDialog::TimelineCacheDialog(QWidget *parent) + : QDialog(parent) + , m_ui(new Ui::TimelineCacheDialog) +{ + m_ui->setupUi(this); + + connect(m_ui->pbUncache, &QPushButton::clicked, + this, [this]() + { + bool k = false; + int index = m_ui->twCaches->item(m_ui->twCaches->selectionModel()->currentIndex().row(), 0)->text().toInt(&k); + + if (!k) + return; + + emit signalUncache(index); + close(); + }); + + + connect(m_ui->pbDelete, &QPushButton::clicked, + this, [this]() + { + bool k = false; + int index = m_ui->twCaches->item(m_ui->twCaches->selectionModel()->currentIndex().row(), 0)->text().toInt(&k); + + if (!k) + return; + + emit signalDelete(index); + close(); + }); +} + + +TimelineCacheDialog::~TimelineCacheDialog() +{ + delete m_ui; +} + + +void TimelineCacheDialog::addCache(const CacheRange &cr, const QString &indexString) +{ + int rowCount = m_ui->twCaches->rowCount(); + m_ui->twCaches->insertRow(rowCount); + int row = m_ui->twCaches->rowCount() - 1; + int c = 0; + + m_ui->twCaches->setItem(row, c++ /* pun not intended */, new QTableWidgetItem(indexString)); + + QString hash(QStringLiteral("<%1:%2:%3>").arg(cr.start).arg(cr.end).arg(cr.events.count())); + m_ui->twCaches->setItem(row, c++, new QTableWidgetItem(QString::number(qHash(hash), 16))); + + m_ui->twCaches->setItem(row, c++, new QTableWidgetItem(QStringLiteral("%1 (%2)").arg(QDateTime::fromMSecsSinceEpoch(cr.start).toString()).arg(cr.start))); + m_ui->twCaches->setItem(row, c++, new QTableWidgetItem(QStringLiteral("%1 (%2)").arg(QDateTime::fromMSecsSinceEpoch(cr.end).toString()).arg(cr.end))); + m_ui->twCaches->setItem(row, c++, new QTableWidgetItem(QString::number(cr.events.count()))); +} + + +bool TimelineCacheDialog::init(const QVector> &cachedRanges, const CacheRange &liveCache) +{ + m_ui->twCaches->setRowCount(0); + + int eventCount = 0; + { + int i = 0; + for (auto it = cachedRanges.constBegin(); it != cachedRanges.constEnd(); ++it) + { + const CacheRange &cr = it->second; + + eventCount += cr.events.count(); + addCache(cr, QString::number(i)); + + i++; + } + } + + addCache(liveCache, QStringLiteral("live")); // add live events from its own cache + m_ui->lblEventCount->setText(QString::number(eventCount)); + + + for (int i = 0; i < m_ui->twCaches->columnCount(); i++) + { + m_ui->twCaches->resizeColumnToContents(i); + } + + return true; +} + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.h new file mode 100755 index 000000000..76c6bcfe5 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.h @@ -0,0 +1,48 @@ +/** + * @RDE_HEADER@ + * ExerciseManangement - Exercise Overview Dialog + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-02-10 + */ + +#pragma once + +#include "tln_dialog_model.h" + +#include +#include + + +namespace Ui +{ +class TimelineCacheDialog; +} + + +namespace Timeline +{ + +class TimelineCacheDialog : public QDialog +{ + Q_OBJECT + +public: + explicit TimelineCacheDialog(QWidget *parent = nullptr); + ~TimelineCacheDialog(); + + bool init(const QVector > &cachedRanges, const CacheRange &liveCache); + +private: + void addCache(const CacheRange &cache, const QString &indexString); + + Ui::TimelineCacheDialog *m_ui; + +signals: + void signalUncache(int index); + void signalDelete(int index); +}; + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.ui new file mode 100755 index 000000000..c8759f358 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.ui @@ -0,0 +1,134 @@ + + + TimelineCacheDialog + + + + 0 + 0 + 846 + 500 + + + + Cache View + + + + + + + + Event count: + + + + + + + - + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Never uncache events from a stale cache vector ! + + + + + + + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + true + + + 100 + + + + idx + + + + + hash + + + + + start + + + + + end + + + + + event count + + + + + + + + + + uncache selected + + + + + + + delete selected + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.cpp new file mode 100755 index 000000000..0c0b15d6d --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.cpp @@ -0,0 +1,1085 @@ +/** + * @RDE_HEADER@ + * ExerciseManangement - Exercise Overview Dialog + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-02-10 + */ + +#include "tln_dialog.h" +#include "ui_tln_dialog.h" +#include "tln_dialog_model.h" +#include "tln_cache_dialog.h" +#include "tln_show_details.h" +#include "tln_event_list.h" +#include "tln_legend.h" +#include "detail_data.h" +#include "excon_filter.h" +#include "logger.h" +#include "EventFilter/FilterWindow.h" // TODO: rename to EventFilter and manage the window AND the whole EventFilter there + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace LtsTimelineClassic; + +namespace Timeline +{ + +TimelineViewDialog::TimelineViewDialog(const QString &menuGroup, const LtsWidgets::ButtonCombination &buttonCombo, bool isMain, QWidget *parent) + : LtsWidgets::LtsDialog(parent, buttonCombo, !isMain) + , m_ui(new Ui::TimelineViewDialog) + , m_menuGroup(menuGroup) + , m_model(new DDSTimelineModel(this)) + , m_detailData(nullptr) + , m_filterWindow(nullptr) + , m_eventListDialog(nullptr) + , m_allEventsListDialog(nullptr) + , m_session(nullptr) + , m_requestHelper(new LtsUtils::RequestHelper(this)) + , m_streamNameMapping(nullptr) + , m_rangeChanged(false) + , m_loadingCount(0) + , m_armed(false) + , m_exerciseStart(0) + , m_legendDialog(nullptr) + , m_logger(getLogger("Dialog")) +{ + m_ui->setupUi(this); + +#ifndef LTS_DEBUG + if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("Timeline.DebugWidget")) != QVariant(true)) + { + m_ui->debugWidget->hide(); + m_ui->widget->hideDebugWidget(); + } +#endif + + m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &TimelineViewDialog::slotShowFiltersDialog); + m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &TimelineViewDialog::slotShowLegend); + m_buttonBox->connectButton(LtsWidgets::DialogButton::Import, this, &TimelineViewDialog::slotStartReplaySituation); + + connect(m_ui->pbDebugCreateFakeEvent, &QPushButton::clicked, + this, &TimelineViewDialog::slotDebugCreateFakeEvent); + + LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance(); + const bool enableListEvents = ps->value(QStringLiteral("tln"), + QStringLiteral("enableListEvents")).toBool(); + + if (enableListEvents) + m_buttonBox->connectButton(LtsWidgets::DialogButton::Load, this, &TimelineViewDialog::loadAllEvents); + + connect(m_ui->widget, &TimelineWidget::signalZoomChanged, + this, [this]() + { + m_model->invalidateTimeline(); // rebuild all EventGraphics on zoom as every zoom changes the visibility of events as events may overlap on zooming and "unoverlap" on unzooming + }); + + connect(this, &TimelineViewDialog::signalWaitForReady, + this, &TimelineViewDialog::slotWaitForReady, Qt::QueuedConnection); + + connect(m_ui->widget, &TimelineWidget::signalEventAction, + this, &TimelineViewDialog::showDetailsAction); + + setOnlineHelpFilename(QStringLiteral("Timeline-Application")); +} + + +TimelineViewDialog::~TimelineViewDialog() +{ + if (m_allEventsListDialog) + { + delete m_allEventsListDialog.data(); + m_allEventsListDialog = nullptr; + } + + if (m_eventListDialog) + { + delete m_eventListDialog.data(); + m_eventListDialog = nullptr; + } + + delete m_ui; + delete m_filterWindow; + delete m_legendDialog; + + EventTools::s_inUse = false; +} + + +void TimelineViewDialog::slotDebugCreateFakeEvent() +{ + QFormLayout *fl = new QFormLayout; + + QLineEdit *typeIdWidget = new QLineEdit; + typeIdWidget->setText(QStringLiteral("8")); + fl->addRow(QStringLiteral("typeId"), typeIdWidget); + + QLineEdit *startWidget = new QLineEdit; + startWidget->setText(QStringLiteral("1571141793040")); + fl->addRow(QStringLiteral("start"), startWidget); + + QSpinBox *sb = new QSpinBox; + sb->setMaximum(INT_MAX); + sb->setValue(26); + fl->addRow(QStringLiteral("duration [s]"), sb); + + QTextEdit *te = new QTextEdit; + te->setPlainText(QStringLiteral("{ \"streamName\": \"00003\", \"endTime\": 1571141819620 }")); + fl->addRow(QStringLiteral("detail"), te); + + QPushButton *goBtn = new QPushButton(QStringLiteral("Go")); + connect(goBtn, &QPushButton::clicked, this, [this, typeIdWidget, startWidget, sb, te]() + { + bool k = false; + int typeId = typeIdWidget->text().toInt(&k); + if (!k) + { + new LtsWidgets::LtsMessageDialogNew(this, QStringLiteral("TypeId invalid")); + return; + } + + qint64 start = startWidget->text().toLongLong(&k); + if (!k) + { + new LtsWidgets::LtsMessageDialogNew(this, QStringLiteral("start invalid")); + return; + } + + qint64 end = start + (sb->value() * 1000); + + QJsonParseError error; + const QJsonObject root(QJsonDocument::fromJson(te->toPlainText().toUtf8(), &error).object()); + + if (error.error != QJsonParseError::NoError) + { + new LtsWidgets::LtsMessageDialogNew(this, QStringLiteral("Detail data json invalid: '%1' at offset %2").arg(error.errorString()).arg(error.offset)); + return; + } + + static int uniqueId = 9999999; + Event *e = new Event(uniqueId++, typeId, start, end, -1, -1, 1, { QStringLiteral("none") }, LtsTimelineClassic::Event::drawCustomEventGraphicRect, {}, root, -1); + + showDetails({e}); + }); + + + fl->addRow({}, goBtn); + + QDialog *d = new QDialog(this); + d->setLayout(fl); + d->show(); + d->activateWindow(); +} + + +void TimelineViewDialog::aboutToClose() +{ + if (m_allEventsListDialog) + { + delete m_allEventsListDialog.data(); + m_allEventsListDialog = nullptr; + } + + if (m_eventListDialog) + { + delete m_eventListDialog.data(); + m_eventListDialog = nullptr; + } + + if (m_replayApp != nullptr) + m_replayApp->deleteLater(); +} + + +void TimelineViewDialog::retranslate() +{ + translate(m_ui, tr("Timeline")); + m_detailData->populate(); // TODO: has currently no effect + m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setText(tr("Filters")); + m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setText(tr("Legend", "Deutsch: Legende (erklärende Ergänzung zu einer Grafik)")); + m_buttonBox->getButton(LtsWidgets::DialogButton::Load)->setText(tr("List events")); + + m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setText(tr("Start Situation Replay App")); + m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setToolTip(tr("Replays started from the Show Details dialog will play in the Situation Replay App.")); +} + + +bool TimelineViewDialog::init(const std::shared_ptr &eemForeign, + const std::shared_ptr &mrkDtc, + const std::shared_ptr &exmDtc, + const std::shared_ptr &flmIfc, + const std::shared_ptr &ppmDtc, + const std::shared_ptr &ppmInfoIfc, + const std::shared_ptr &avmIfc, + const std::shared_ptr &mrkIfc, + const std::shared_ptr &srmDataIfc, + const std::shared_ptr &coreDtc, + const std::shared_ptr &pdmDtc, + const std::shared_ptr &ismDtc, + const std::shared_ptr &fltParticipantIfc, + const std::shared_ptr &fltAesIfc, + const std::shared_ptr &fltBuildingComponentIfc, + LtsSession::LtsSession *session, + AudioVideoManagement::StreamNameMapping *streamNameMapping) +{ + if (EventTools::s_inUse) + { + new LtsWidgets::LtsMessageDialogNew(session->baseLayout(), tr("Cannot open timeline as there is already another timeline instance running in the application."), tr("Another timeline instance already in use")); + return false; + } + + EventTools::s_inUse = true; + + m_session = session; + m_exmDtc = exmDtc; + m_flmIfc = flmIfc; + m_ppmDtc = ppmDtc; + m_ppmInfoIfc = ppmInfoIfc; + m_avmIfc = avmIfc; + m_mrkIfc = mrkIfc; + m_srmDataIfc = srmDataIfc; + m_coreDtc = coreDtc; + m_pdmDtc = pdmDtc; + m_ismDtc = ismDtc; + m_mrkDtc = mrkDtc; + m_fltParticipantIfc = fltParticipantIfc; + m_fltAesIfc = fltAesIfc; + m_fltBuildingComponentIfc = fltBuildingComponentIfc; + m_streamNameMapping = streamNameMapping; + + if (m_coreDtc == nullptr || m_srmDataIfc == nullptr) // Situation Replay App's requirements + { + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, false); + m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setToolTip(tr("Required interfaces missing for starting the Situation Replay App.")); + } + + m_detailData = new DetailData(session, this); + + if (!m_model->init(eemForeign, mrkDtc, exmDtc, ppmDtc, pdmDtc, ismDtc, session, m_detailData, m_streamNameMapping)) + { + ERROR_LOG(m_logger) << "model init failed"; + return false; + } + + m_ui->widget->setTimelineModel(m_model); + + + connect(m_model, &DDSTimelineModel::signalRebuildTimelineKnownRanges, + this, [this]() + { + m_ui->widget->knownRangesChanged(m_model->getKnownRanges()); + + emit m_model->dataChanged(QModelIndex(), QModelIndex()); // new events added, time to redraw + }); + + connect(m_model, &DDSTimelineModel::signalLoading, + this, &TimelineViewDialog::slotLoading); + connect(m_model, &DDSTimelineModel::signalLoadingDone, + this, &TimelineViewDialog::slotLoadingDone); + + connect(this, &TimelineViewDialog::signalInitEventList, + this, [this]() + { + if (m_allEventsListDialog) + { + //qCritical() << "signalInitEventList"; + EventList visibleEvents = setFilter(m_detailData, m_model->getRootItem()->getFullEventList(true, true), m_filter, this, true, false); + m_allEventsListDialog->reInitEventList(visibleEvents, m_ui->widget->getRangeMinimum(), m_ui->widget->getRangeMaximum()); + } + }); + + // changes arming + QTimer *armTimer = new QTimer(this); + armTimer->setInterval(750); + connect(armTimer, &QTimer::timeout, + this, [this]() + { + if (!m_rangeChanged) + return; + m_rangeChanged = false; + + qint64 rangeMin = m_ui->widget->getRangeMinimum(); + qint64 rangeMax = m_ui->widget->getRangeMaximum(); + + if (rangeMin > rangeMax) // no events to request + return; + + qint64 now = m_session->partitionTime(); + + if (rangeMin >= now) + return; // don't ask for events from the future + + if (rangeMax >= now) + { + rangeMax = m_session->partitionTime() -1; + //qWarning() << "rangeMax >= now !"; + } + + //slotLoading(); + m_model->getEvents(rangeMin, rangeMax); + }); + +#ifndef LTS_DEBUG // don't automatically arm on debug + m_armed = true; + armTimer->start(); +#endif + + +#ifndef LTS_DEBUG + if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("Timeline.DebugWidget")) == QVariant(true)) +#endif + { + // show current cursor position as event time + QTimer *tCursor = new QTimer(this); + tCursor->setInterval(500); + connect(tCursor, &QTimer::timeout, + this, [this]() + { + qint64 cursorTime = EventTools::getEventTime(m_ui->widget->mapFromGlobal(QCursor::pos()).x()); + m_ui->lblCursorTime->setText(QStringLiteral("%1 (%2)").arg(QDateTime::fromMSecsSinceEpoch(cursorTime).toString()).arg(cursorTime)); + }); + tCursor->start(); + + + // show draws per second + QTimer *tDraws = new QTimer(this); + tDraws->setInterval(1000); + connect(tDraws, &QTimer::timeout, + this, [this]() + { + int paints = EventTools::s_test; + EventTools::s_test = 0; + m_ui->label_8->setText(QStringLiteral("%1 draw(s) per second").arg(paints)); + }); + tDraws->start(); + + + // fake events instead of requesting real events + connect(m_ui->cbFake, &QCheckBox::toggled, + this, [this](bool toggled) + { + qWarning() << "fake toggled? " << toggled; + m_model->setCreateFakeEvents(toggled); + }); + + + // arm manually + connect(m_ui->widget, &TimelineWidget::signalArm, + this, [this, armTimer](bool arm) + { + m_armed = arm; + if (arm) + armTimer->start(); + else + armTimer->stop(); + }); + + + // show cache window + connect(m_ui->pbShowCache, &QPushButton::clicked, + this, [this]() + { + TimelineCacheDialog *cacheDialog = new TimelineCacheDialog(this); + + connect(cacheDialog, &TimelineCacheDialog::signalUncache, + this, [this](int /*idx*/) + { +//#warning reimpl + //m_model->forceUncache(idx); + WARNING_LOG(m_logger) << "reimpl me!!"; + }); + + cacheDialog->setAttribute(Qt::WA_DeleteOnClose, true); + cacheDialog->init(m_model->cachedEvents(), m_model->liveCache()); + cacheDialog->show(); + }); + + + // set live mode manually +// connect(m_ui->cbLive, &QCheckBox::toggled, +// this, [this](bool toggled) +// { +// m_model->setLive(toggled); +// }); + } + + + + // arming timer on changes + connect(m_ui->widget, &TimelineWidget::signalRangeChanged, // if scrollbar was moved, set changed flag (timer requests events if flag active) + this, [this, armTimer]() + { +//#warning do not range change if range did not rly change + + if (!m_model->hasActiveEventTypes()) + { + DEBUG_LOG(m_logger) << "range changed, but no active event types! not arming timer.."; + return; + } + + if (m_armed) + armTimer->start(); // reset timer + + m_rangeChanged = true; + }); + + + + connect(m_session, &LtsSession::LtsSession::partitionTimeChanged, + this, [this](qint64 ) + { +#ifdef LTS_DEBUG + if (m_ui->cbUpdate->isChecked()) +#endif + updateRange(); + }); + + + + updateRange(); + m_ui->widget->setPos(m_session->partitionTime()); + + connect(m_ui->sbSpan, &QScrollBar::valueChanged, + this, &TimelineViewDialog::slotSpanChanged); + + connect(m_ui->pbLive, &QPushButton::clicked, + this, [this]() + { + updateRange(true /* initial */); + }); + + m_exerciseStart = m_exmDtc->exercise(m_session->exerciseId()).beginTime(); + + if (m_exerciseStart < 1) + { + LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("Exercise data not available or exercise not started yet."), tr("Cannot open timeline")); // block .. + ERROR_LOG(m_logger) << "exercise data not available - exercise start: " << m_exerciseStart; + return false; + } + + { + // manually update timeline, then set initial timeline pos + QSignalBlocker block(m_ui->sbSpan); + (void)block; + updateRange(true /* init */); + } + + m_ui->widget->setMaxPos(); // set timeline to live position on initial start + + + // enabled by setting active event types - user has to see that there have to be active event types to have the timeline usable + m_ui->widget->setEnabled(false); + m_ui->sbSpan->setEnabled(false); + m_ui->pbLive->setEnabled(false); + + + LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(); + emit signalWaitForReady(); + + return true; +} + + +void TimelineViewDialog::slotSpanChanged() +{ + qint64 end = currentSpanTime(); + qint64 start = end - (8 * 60 * 60 * 1000); + m_model->setTimeRange(start, end); + + m_ui->lbStartTime->setText(DTG::toStringMSec(start)); + m_ui->lbEndTime->setText(DTG::toStringMSec(end)); + + bool live = (m_ui->sbSpan->value() == m_ui->sbSpan->maximum()); // auto-scroll (aka. live mode) if at end, like any text edit does + + m_model->setLive(live); + m_ui->widget->slotUpdateTimeline(); // only update [emits signalRangeChanged => m_ui->sbSpan] +} + + +void TimelineViewDialog::slotLoading() +{ +#ifdef LTS_DEBUG + m_ui->lblStartTime->setStyleSheet(QLatin1String("background-color: green;")); + m_ui->lblEndTime->setStyleSheet(QLatin1String("background-color: green;")); +#endif + m_loadingCount++; + //qWarning() << "m_loadingCount++ =" << m_loadingCount; +} + + +void TimelineViewDialog::slotLoadingDone() +{ + if (m_loadingCount > 0) + m_loadingCount--; +#ifdef LTS_DEBUG + if (m_loadingCount == 0) // only reset if there are no requests left + { + m_ui->lblStartTime->setStyleSheet(QString()); + m_ui->lblEndTime->setStyleSheet(QString()); + } +#endif + + //qWarning() << "m_loadingCount-- =" << m_loadingCount; + //qCritical() << "slotLoadingDone!"; + emit signalInitEventList(); +} + + +qint64 TimelineViewDialog::currentSpanTime() const +{ + qint64 value = m_ui->sbSpan->value(); + value *= /*60 * 60 **/ 1000; + + return value; +} + + +void TimelineViewDialog::updateRange(bool initial) +{ + qint64 start = m_exerciseStart; + qint64 partitionTime = m_session->partitionTime(); + qint64 now = partitionTime; + + if (now < 1) + now = start; + if (now == 0) + return; + + now = (now / 1000);// + 1; // msecs to hours since epoch (add 1 hour to end so the last event is always visible) + + bool liveSpan = (m_ui->sbSpan->value() == m_ui->sbSpan->maximum()); // auto-scroll (the span scrollbar) if last value was at end, like any text edit does + + m_ui->sbSpan->setMinimum(start / 1000); + m_ui->sbSpan->setMaximum(now); + + if (initial || liveSpan) + { + QSignalBlocker block(m_ui->sbSpan); // don't let the widget tell us that its value changed, we know it here already + (void)block; + m_ui->sbSpan->setValue(now); // live [sbSpan calls slotSpanChanged, which updates the timeline] + } + + m_ui->widget->setLiveTime(partitionTime); + slotSpanChanged(); // span changes when range changes + + //qWarning() << "pos" << m_ui->widget->getPos() << "max" << m_ui->widget->getMaxPos() << "diff" << m_ui->widget->getPos() - m_ui->widget->getMaxPos(); + bool liveRange = (m_ui->widget->getPos() >= m_ui->widget->getMaxPos() - 1); // auto-scroll (the range scrollbar) if last value was at end, like any text edit does [NOTE: slotSpanChanged changes the scrollbar pos] + + //#warning Initiale Timeline Position fehlerhaft - Timeline Position zu gering nach update ! + + if (initial || liveRange) + { + // must be called after slotSpanChanged + m_ui->widget->setPos(EventTools::getTimelineMax());//m_model->highestPositionedItem()); + } +} + + +void TimelineViewDialog::slotStartReplaySituation() +{ + if (m_replayApp != nullptr) + return; + + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, false); + + if (m_requestHelper->startSingleRequest([&]() + { +//#warning !! + return m_srmDataIfc->replayPartitionCreateRequest(m_session->exerciseId(), + LtsSessionData::LtsSessionData::getInstance()->getWorkstationId(), + LtsSessionData::LtsSessionData::getInstance()->getOperatorId(), + Core::ReplayType::SituationData, + this); + })) + { + Core::ReplayPartition rp; + for (int i = 0; i < 50; i++) // FIXME: UGLY HACK + { +//#warning TODO: FIXME: that shouldn't work! replace with QTimer! (steal from other replay starter methods) + // QTimer ... + //QThread::usleep(100 * 1000); + rp = m_coreDtc->replayPartition(m_requestHelper->getRepliedId()); + + if (rp.id() > 0) + break; + } + + if (rp.id() == 0) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session in stage 1.")); + WARNING_LOG(m_logger) << "[timeout] Error while trying to create a replay session: domainId: " << m_session->domainId() << + " - replay partition does not exist - replay id: " << m_requestHelper->getRepliedId() << + " - url " << m_session->tcpConnectionUrl().toString(); + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); + return; + } + else + { + LtsSession::DdsConnectionParams connParams(rp); + m_replayApp = LtsAppManager::LtsAppManager::getInstance()->createApp(LtsAppDescriptor::App::Situation, connParams); + + if (m_replayApp == nullptr) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session in stage 2.")); + WARNING_LOG(m_logger) << "Error while trying to create a replay session: domainId: " << m_session->domainId() << + " - partition create reply (failed) - replay id: " << m_requestHelper->getRepliedId() << + " - url: " << m_session->tcpConnectionUrl().toString(); + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); + return; + } + else + { + connect(m_replayApp->m_sessionManager, &LtsSession::LtsSessionManager::signalInitializationFinished, + this, [this, rp]() + { + LtsSession::LtsSession *replayAppSession = m_replayApp->m_sessionManager->getSession(IDL::PartitionType::Replay, rp.id()); + + if (replayAppSession == nullptr) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session in stage 4.")); + return; + } + + m_replayAppSession = replayAppSession; + + // >> DO THIS IN SHOW DETAiLS DIALOG +// if (!replayAppSession->getForeignGuiInterface(m_srpIfc)) +// { +// LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session in stage 5")); +// return; +// } + +// if (!replayAppSession->getForeignGuiInterface(m_sitMapIfc)) +// { +// LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session in stage 6")); +// return; +// } + + + connect(m_replayApp.data(), &LtsPluginManager::LtsPluginManager::destroyed, + this, [this]() + { +// m_srpIfc = nullptr; +// m_sitMapIfc = nullptr; + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); + }); + }); + + LtsSession::LtsSession *replayAppSession = m_replayApp->m_sessionManager->getSession(IDL::PartitionType::Replay, rp.id()); + + + auto fn = [this, replayAppSession]() + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session in stage 3.")); + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); + return; + }; + + if (replayAppSession->isInitializationDone()) + fn(); + else + connect(replayAppSession, &LtsSession::LtsSession::signalDoneInitializingSession, + this, fn); + } + } + } + else + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session.")); + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); + } +} + + +void TimelineViewDialog::slotEventTypesChanged(QSet activeEventTypeIds) +{ + if (m_filterWindow != nullptr && m_filterWindow->hasUnsavedChanges()) + { + new LtsWidgets::LtsMessageDialogNew(this, tr("You have unsaved filters in Timeline's Filter dialog. Please save or discard them before you add or remove active events in Timeline's Legend dialog."), tr("Unsaved filters")); + return; + } + + if (m_model->activeEventTypeIds().contains(markerTypeId)) + activeEventTypeIds.insert(markerTypeId); + + if (m_legendDialog != nullptr) + m_legendDialog->__unchange__(); // no unsaved filters, filters can be applied + + setTimelineUsable(!activeEventTypeIds.isEmpty()); + + QSet newActiveEventTypesIds(activeEventTypeIds - m_model->activeEventTypeIds()); + //qWarning() << "Event Types Changed: new" << activeEventTypeIds << "old" << m_model->activeEventTypeIds() << "sub" << newActiveEventTypesIds; + + m_model->setActiveEventTypeIds(activeEventTypeIds); + updateFiltersByActiveEventTypes(); + + if (!newActiveEventTypesIds.isEmpty()) // only request events of newly added event type, if there was indeed a newly added event type + m_model->getAllEventsOfType(newActiveEventTypesIds); +} + + +void TimelineViewDialog::slotShowLegend() +{ + QString timelineLegendDialogIdent(QStringLiteral("Timeline.Legend")); + auto layoutArea = LtsWidgets::LayoutArea::eInfoTab; + + if (m_legendDialog != nullptr) + { + focusDialog(m_menuGroup, timelineLegendDialogIdent, layoutArea); + return; + } + + m_legendDialog = new TimelineLegendDialog; + + connect(m_legendDialog, &TimelineLegendDialog::destroyed, + this, [this]() + { + if (static_cast(sender()) == m_legendDialog) + m_legendDialog = nullptr; + }); + + connect(m_legendDialog, &TimelineLegendDialog::signalEventTypesChanged, + this, &TimelineViewDialog::slotEventTypesChanged); + + if (!m_legendDialog->init(m_model, m_model->activeEventTypeIds())) + { + m_legendDialog->deleteLater(); + m_legendDialog = nullptr; + return; + } + + m_session->addWidget(m_legendDialog, m_menuGroup, timelineLegendDialogIdent, layoutArea); +} + + +void TimelineViewDialog::slotShowFiltersDialog() +{ + if (m_detailData == nullptr) + return; + + if (m_filterWindow != nullptr) + { + focusDialog(m_menuGroup, QStringLiteral("timelineFilterDialog"), LtsWidgets::LayoutArea::eDialogTab); + return; + } + + m_filterWindow = new FilterWindow(m_detailData, m_flmIfc, m_session, this); + + connect(m_filterWindow, &FilterWindow::signalShowEvents, + this, &TimelineViewDialog::slotShowEvents); + + connect(m_filterWindow, &FilterWindow::signalApplyFilter, + this, &TimelineViewDialog::slotApplyFilter); + + connect(m_filterWindow, &FilterWindow::destroyed, + this, [this]() + { + if (sender() == static_cast(m_filterWindow)) + m_filterWindow = nullptr; + }); + + m_filterWindow->loadFilters(m_filter); + + addDialog(m_filterWindow, m_menuGroup, QStringLiteral("timelineFilterDialog")); +} + + +void TimelineViewDialog::slotShowEvents(const QJsonArray &filter) +{ + EventList visibleEvents = setFilter(m_detailData, m_model->getRootItem()->getFullEventList(true, true), filter, this, true /* simulation */, false /* handle errors */); + if (visibleEvents.isEmpty()) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("This filter has no results"), tr("No Events found")); + return; + } + + showDetails(visibleEvents); +} + +void TimelineViewDialog::loadAllEvents() +{ + LtsTimelineClassic::EventList visibleEvents = setFilter(m_detailData, m_model->getRootItem()->getFullEventList(true, true), m_filter, this, true /* simulation */, false /* handle errors */); + + qint64 endTime = m_ui->widget->getRangeMaximum(); + qint64 startTime = m_ui->widget->getRangeMinimum(); + LtsTimelineClassic::EventList newEventList; + + for (auto i = visibleEvents.constBegin(); i != visibleEvents.constEnd(); ++i) + { + LtsTimelineClassic::Event *e = (*i); + + if (e->startTime() >= startTime && (e->startTime() + e->duration()) <= endTime) + newEventList += e; + } + + if (newEventList.isEmpty()) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("This filter has no results"), tr("No Events found")); + return; + } + + if (newEventList.isEmpty()) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("No Events to show")); + return; + } + + if (m_allEventsListDialog == nullptr) + { + m_allEventsListDialog = new EventListDialog(m_menuGroup, m_session, m_ppmDtc, m_pdmDtc, m_ismDtc, m_flmIfc, false /* don't show markers */); + connect(m_allEventsListDialog.data(), &EventListDialog::signalShowEventDetails, + this, &TimelineViewDialog::slotShowEventDetails); + + if (!m_allEventsListDialog->init(m_detailData, newEventList, true)) + { + m_allEventsListDialog->deleteLater(); + m_allEventsListDialog = nullptr; + return; + } + addDialog(m_allEventsListDialog, m_menuGroup, QStringLiteral("allEventsListDialog"), LtsWidgets::LayoutArea::eDialogTab); + } + else + { + m_allEventsListDialog->clearModel(); + m_allEventsListDialog->appendEventList(newEventList); + focusDialog(m_menuGroup, QStringLiteral("allEventsListDialog"), LtsWidgets::LayoutArea::eDialogTab); + } + +} + +void TimelineViewDialog::setTimelineUsable(bool usable) +{ + m_ui->widget->setEnabled(usable); + m_ui->sbSpan->setEnabled(usable); + m_ui->pbLive->setEnabled(usable); + + m_ui->lblNoEventsSelected->setVisible(!usable); // tell the user there are no event types selected to get (if none selected though) +} + + +void TimelineViewDialog::updateActiveEventTypesByFilters() +{ + QSet activeEventTypes; + + for (auto i1 = m_filter.constBegin(); i1 != m_filter.constEnd(); ++i1) + { + const QJsonObject &filter = (*i1).toObject(); + + QString eventTypeString = filter[QStringLiteral("EventType")].toString(); + bool k = false; + int eventType = eventTypeString.toInt(&k); // timeline is type safe by default in the meantime + + if (!k || eventType < 0 || !filter[QStringLiteral("Active")].toBool(false)) + continue; + + activeEventTypes.insert(eventType); + } + + m_model->setActiveEventTypeIds(activeEventTypes); + + setTimelineUsable(!activeEventTypes.isEmpty()); + + if (m_legendDialog != nullptr) + m_legendDialog->setActiveEventTypeIds(activeEventTypes); +} + + +void TimelineViewDialog::updateFiltersByActiveEventTypes() // legend changes, de-/activate filters +{ + const QSet &activeEventTypes = m_model->activeEventTypeIds(); + QVector filterEventTypes; + + // de-/activate filters + for (QJsonValueRef filter : m_filter) // clazy:exclude=range-loop + { + QJsonObject filterObj = filter.toObject(); + + QString eventTypeString = filterObj[QStringLiteral("EventType")].toString(); + bool k = false; + int eventType = eventTypeString.toInt(&k); // timeline is type safe by default in the meantime + + if (!k || eventType < 0) + continue; + + if (!filterEventTypes.contains(eventType)) + filterEventTypes.append(eventType); + + bool active = filterObj[QStringLiteral("Active")].toBool(false); + + if (active && !activeEventTypes.contains(eventType)) // filter is active but event type is not active - deactivate filter + active = false; + else if (!active && activeEventTypes.contains(eventType)) // filter is inactive but event type is active - (re)activate filter + active = true; + + filterObj[QStringLiteral("Active")] = active; + filter = filterObj; + } + + + // create bare filters for active events that currently don't have any filters + for (int eventType : activeEventTypes) + { + if (!filterEventTypes.contains(eventType)) + { + QJsonObject filter; + + filter[QStringLiteral("EventType")] = QString::number(eventType); + filter[QStringLiteral("Active")] = true; + + m_filter.append(filter); + } + } + + applyFilter(m_filter, false /* do not update active event types, because that's where we come from */, true); +} + + +void TimelineViewDialog::applyFilter(const QJsonArray &filter, bool doUpdateActiveEventTypes, bool reloadFilterWindow) +{ + m_filter = filter; + setFilter(m_detailData, m_model->getRootItem()->getFullEventList(true, true), filter, this); + m_model->applyFilter(filter); + + if (doUpdateActiveEventTypes) + updateActiveEventTypesByFilters(); + + if (reloadFilterWindow && m_filterWindow != nullptr) + m_filterWindow->loadFilters(filter); +} + + +void TimelineViewDialog::slotApplyFilter(const QJsonArray &filter) +{ + applyFilter(filter, true /* update legend */, false /* don't reload filter window, that's where we come from */); +} + + +void TimelineViewDialog::slotWaitForReady() +{ + // test if exercise is inside partition time + ExerciseManagement::Exercise ex = m_exmDtc->exercise(m_session->partitionId()); + if (ex.id() > 0) + { + qint64 partitionTime = 0; + + partitionTime = m_session->partitionTime(); + + if (partitionTime < 1) + { + emit signalWaitForReady(); + return; + } + + if (partitionTime < ex.beginTime()) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("The current time is outside of the Exercise's period.
Events are only recorded in Exercise period boundaries."), tr("No Events available")); + WARNING_LOG(m_logger) << "Partition time was " << partitionTime << ", exercise begin time: " << ex.beginTime(); + } + } + else + { + WARNING_LOG(m_logger) << "TimelineViewDialog::init: could not check exercise's boundaries!"; + } + + LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); +} + + +void TimelineViewDialog::slotShowEventDetails(const Event *event) +{ + switch (event->typeId()) + { + case ProjectDataManagement::EventType::BiteMessage: + { + m_ppmInfoIfc->showBiteWindow(event->detailData()); + break; + } + + default: + { + addDialog(LtsWidgets::initDialog(new ShowDetailsDialog(), + m_detailData, event, + m_session, + m_replayAppSession, m_avmIfc, m_mrkIfc, m_fltParticipantIfc, m_fltAesIfc, m_fltBuildingComponentIfc, + m_session->app() == LtsAppDescriptor::App::Timeline, + this, m_streamNameMapping), + m_menuGroup, QStringLiteral("ShowEventDetails%1").arg(event->uniqueId()), LtsWidgets::LayoutArea::eInfoTab); + + break; + } + } +} + + +void TimelineViewDialog::showDetails(const EventList &eventList) +{ + if (eventList.isEmpty()) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("No Events to show")); + return; + } + + if (eventList.count() > 1) // multiple events - show list of events (instead of the event detail dialog itself) in detail area + { + if (m_eventListDialog == nullptr) + { + m_eventListDialog = new EventListDialog(m_menuGroup, m_session, m_ppmDtc, m_pdmDtc, m_ismDtc, m_flmIfc, true /* show markers */); + connect(m_eventListDialog.data(), &EventListDialog::signalShowEventDetails, + this, &TimelineViewDialog::slotShowEventDetails); + + if (!m_eventListDialog->init(m_detailData, eventList, false)) + { + m_eventListDialog->deleteLater(); + m_eventListDialog = nullptr; + return; + } + + addDialog(m_eventListDialog, m_menuGroup, QStringLiteral("eventListDialog"), LtsWidgets::LayoutArea::eDialogTab); + } + else + { + m_eventListDialog->appendEventList(eventList); + focusDialog(m_menuGroup, QStringLiteral("eventListDialog"), LtsWidgets::LayoutArea::eDialogTab); + } + + } + else // single event - show single event in info area + { + slotShowEventDetails(eventList.at(0)); + } +} + + +void TimelineViewDialog::showDetailsAction(EventGraphic *eg, int action) +{ + if (action != EventGraphic::ACTION_LEFT_CLICKED) + return; + + showDetails(eg->eventList()); +} + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.h new file mode 100755 index 000000000..be37eeaca --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.h @@ -0,0 +1,174 @@ +/** + * @RDE_HEADER@ + * ExerciseManangement - Exercise Overview Dialog + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-02-10 + */ + +#pragma once + +#include "tln_view_gui_plugin.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Replay +#include + +#include + + +namespace AudioVideoManagement +{ +class StreamNameMapping; +} + +namespace LtsTimelineClassic +{ +class EventGraphic; +class Event; +} + +namespace Ui +{ +class TimelineViewDialog; +} + +namespace LtsSession +{ +class LtsSession; +} + +namespace LtsPluginManager +{ +class LtsPluginManager; +} + + +namespace Timeline +{ + +class FilterWindow; +class DetailData; +class DDSTimelineModel; +class EventListDialog; +class TimelineLegendDialog; + + +class TimelineViewDialog : public LtsWidgets::LtsDialog + , protected SituationReplayManagement::Interface::Ftc::ReplayPartitionCreateReplyHandler +{ + Q_OBJECT + +public: + explicit TimelineViewDialog(const QString &menuGroup, const LtsWidgets::ButtonCombination &buttonCombo, bool isMain, QWidget *parent = nullptr); + ~TimelineViewDialog(); + + bool init(const std::shared_ptr &eemForeign, + const std::shared_ptr &mrkDtc, + const std::shared_ptr &exmDtc, + const std::shared_ptr &flmIfc, + const std::shared_ptr &ppmDtc, + const std::shared_ptr &ppmInfoIfc, + const std::shared_ptr &avmIfc, + const std::shared_ptr &mrkIfc, + const std::shared_ptr &srmDataIfc, + const std::shared_ptr &coreDtc, + const std::shared_ptr &pdmDtc, + const std::shared_ptr &ismDtc, + const std::shared_ptr &fltParticipantIfc, + const std::shared_ptr &fltAesIfc, + const std::shared_ptr &fltBuildingComponentIfc, + LtsSession::LtsSession *session, + AudioVideoManagement::StreamNameMapping *streamNameMapping); + +private slots: + void showDetailsAction(LtsTimelineClassic::EventGraphic *eg, int action); + void showDetails(const LtsTimelineClassic::EventList &eventList); + void slotApplyFilter(const QJsonArray &filter); + void slotShowEventDetails(const LtsTimelineClassic::Event *event); + void slotShowEvents(const QJsonArray &filter); + void slotWaitForReady(); + void slotShowFiltersDialog(); + void slotShowLegend(); + void slotStartReplaySituation(); + void updateRange(bool initial = false); + void slotLoading(); + void slotLoadingDone(); + void slotSpanChanged(); + void slotEventTypesChanged(QSet activeEventTypeIds); // no const ref because markerTypeId might be added + void loadAllEvents(); + void slotDebugCreateFakeEvent(); + +signals: + void signalWaitForReady(); + void signalInitEventList(); + +private: + void retranslate() override; + void onReplayPartitionCreateReply(const Core::FunctionReplyObject &reply) override { m_requestHelper->requestReply(reply); } + qint64 currentSpanTime() const; // in msecs + + // dtc's + std::shared_ptr m_coreDtc; + std::shared_ptr m_exmDtc; + std::shared_ptr m_pdmDtc; + std::shared_ptr m_ismDtc; + std::shared_ptr m_mrkDtc; + std::shared_ptr m_ppmDtc; + + // foreign gui's + std::shared_ptr m_flmIfc; + std::shared_ptr m_ppmInfoIfc; + std::shared_ptr m_avmIfc; + std::shared_ptr m_mrkIfc; + std::shared_ptr m_srmDataIfc; + std::shared_ptr m_fltParticipantIfc; + std::shared_ptr m_fltAesIfc; + std::shared_ptr m_fltBuildingComponentIfc; + + Ui::TimelineViewDialog *m_ui; + QString m_menuGroup; + DDSTimelineModel *m_model; + DetailData *m_detailData; + FilterWindow *m_filterWindow; + QPointer m_eventListDialog; + QPointer m_allEventsListDialog; + LtsSession::LtsSession *m_session; + LtsUtils::RequestHelper *m_requestHelper; + QPointer m_replayApp; + QPointer m_replayAppSession; + AudioVideoManagement::StreamNameMapping *m_streamNameMapping; + bool m_rangeChanged; + QJsonArray m_filter; + int m_loadingCount; + bool m_armed; + qint64 m_exerciseStart; + TimelineLegendDialog *m_legendDialog; + QTimer *m_armTimer; + NGL::INGLLogger &m_logger; + + void setCustomSpan(); + void calculateAndSetRange(); + void setRange(qint64 min, qint64 max); + void updateActiveEventTypesByFilters(); + void updateFiltersByActiveEventTypes(); + void applyFilter(const QJsonArray &filter, bool doUpdateActiveEventTypes = true, bool reloadFilterWindow = false); + void rangeChanged(); + void setTimelineUsable(bool usable = true); + void aboutToClose() override; +}; + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.ui new file mode 100755 index 000000000..1303ae5ff --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.ui @@ -0,0 +1,215 @@ + + + TimelineViewDialog + + + + 0 + 0 + 1401 + 519 + + + + Timeline View + + + + + + + + Time span: + + + + + + + + 0 + 0 + + + + Live + + + + + + + Qt::Vertical + + + + + + + Start: + + + + + + + - + + + + + + + + 0 + 0 + + + + 0 + + + 3600 + + + 3600 + + + true + + + Qt::Horizontal + + + + + + + End: + + + + + + + - + + + + + + + Qt::Vertical + + + + + + + <html><head/><body><p><span style=" color:#ff5656;">Please create at least one filter of any event type to see events.</span></p></body></html> + + + + + + + + + + 0 + 0 + + + + + + + + + + + + + - + + + + + + + + 0 + 0 + + + + Cursor at + + + + + + + - + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + [fake] + + + + + + + [update] + + + + + + + [show cache] + + + + + + + [create fake event] + + + + + + + + + + + + + LtsTimelineClassic::TimelineWidget + QWidget +
LtsTimelineClassic/TimelineWidget.h
+ 1 +
+
+ + +
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.cpp new file mode 100755 index 000000000..62ff29e5d --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.cpp @@ -0,0 +1,1722 @@ +/** + * @RDE_HEADER@ + * Timeline Model for DDS + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2017-03-31 + */ + +#include "excon_filter.h" +#include "tln_dialog_model.h" +#include "detail_data.h" +#include "logger.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include // TODO: rm ws +#include +#include +#include + + +using namespace LtsTimelineClassic; + + +namespace Timeline +{ + +DDSTimelineModel::DDSTimelineModel(QObject *parent) + : LtsTimelineClassic::AbstractTimelineModel(parent) + , m_session(nullptr) + , m_startTime(-1) + , m_endTime(-1) + , m_detailData(nullptr) + , m_streamNameMapping(nullptr) + , m_isLive(false) + , m_cacheSize(15000) // 15.000 - no problemo :) + , m_maxCacheRanges(20) + , m_eventCount(0) + , m_lastCachedEventsId(0) + , m_createFakeEvents(false) + //, m_dtorEmergencyMode(false) + , m_logger(getLogger("DialogModel")) +{ + m_liveCache.visible = false; + m_liveCache.start = 0; + m_liveCache.end = 0; + m_liveCache.incomplete = false; +} + + +DDSTimelineModel::~DDSTimelineModel() +{ + // no need to uncache anything.. AbstractTimelineModel deletes all Events itself +// for (auto i1 = m_cachedEvents.begin(); i1 != m_cachedEvents.end(); ++i1) +// { +// CacheRange &cr = *i1; +// uncache(cr); +// } + + +// // risk dead memory for the safety that the application does not crash.. +// // FIXME: figure out why some events were already deleted but still cached !! +// if (!m_dtorEmergencyMode) +// return; + + +// for (auto i1 = m_cachedEvents.begin(); i1 != m_cachedEvents.end(); ++i1) +// { +// CacheRange &cr = *i1; +// qDeleteAll(cr.events); <= Item deletes all its events from its event list in its dtor +// } +} + + +bool DDSTimelineModel::init(const std::shared_ptr &eemForeign, + const std::shared_ptr &mrkDtc, + const std::shared_ptr &exmDtc, + const std::shared_ptr &ppmDtc, + const std::shared_ptr &pdmDtc, + const std::shared_ptr &ismDtc, + LtsSession::LtsSession *session, + DetailData *detailData, + AudioVideoManagement::StreamNameMapping *streamNameMapping) +{ + //Q_ASSERT(streamNameMapping); + m_eemForeign = eemForeign; + m_dtcExm = exmDtc; + m_ppmDtc = ppmDtc; + m_pdmDtc = pdmDtc; + m_ismDtc = ismDtc; + m_mrkDtc = mrkDtc; + m_session = session; + m_detailData = detailData; + m_streamNameMapping = streamNameMapping; + + connect(m_eemForeign.get(), &TimeLineManagement::ForeignDataInterface::liveEvent, + this, &DDSTimelineModel::slotAddLiveEvent); + +#ifndef LTS_DEBUG + if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("Timeline.DebugWidget")) != QVariant(true)) +#endif + { + // add fake live events every x seconds if fake & live are enabled + QTimer *liveTimer = new QTimer(this); + liveTimer->setInterval(4000); + connect(liveTimer, &QTimer::timeout, + this, [this]() + { + if (m_createFakeEvents && m_isLive) + slotAddLiveEventsFake(); + }); + + liveTimer->start(); + } + + connect(m_mrkDtc.get(), &MarkerManagement::Interface::Dtc::markerChanged, + this, &DDSTimelineModel::slotMarkerChanged); + + // load all markers at once + auto cb = [this](const MarkerManagement::Marker &marker) + { + addMarkerManagementMarker(marker); + }; + m_mrkDtc->markers(cb); + + return true; +} + + +static int testLiveEventId = 0; +void DDSTimelineModel::slotAddLiveEventsFake() +{ + ExerciseEventManagement::Event event; + + event.id(testLiveEventId++); + event.eventTypeId(ProjectDataManagement::EventType::Hit); + event.sampleTime(currentTime()); + event.properties(QStringLiteral("{}").toStdString()); + + slotAddLiveEvent(event); +} + + +void DDSTimelineModel::saveAndClearLiveCache() // if not live anymore or live cache is full +{ + addCacheRange(m_liveCache, m_liveCache.events, false /* never */, false /* already added */); + m_liveCache.events.clear(); + m_liveCache.start = 0; + m_liveCache.end = 0; +} + + +void DDSTimelineModel::setActiveEventTypeIds(const QSet &activeEventTypeIds) +{ + m_activeEventTypeIds = activeEventTypeIds; +} + + +void DDSTimelineModel::slotAddLiveEvent(const ExerciseEventManagement::Event &event) +{ + Event *ev = getEvent(event.id()); + + if (ev != nullptr) + { + QJsonObject root(getDetailData(event)); + ev->setEndT(root[QStringLiteral("endTime")].toDouble()); // might be a audio/video event + ev->setDetailData(root); + DEBUG_LOG(m_logger) << "live event not added - already exists - modified instead - end"; + //invalidateItemForEvent(event.id()); // tell the item that its event list changed (because the end time changed, which triggers the item to re-create the EGLs and therefore EGL length changes visually) - this is needed for events with endTime == -1 ! because th + return; + } + + if (!isLive()) + { + DEBUG_LOG(m_logger) << "not adding live event because we're not live"; + return; + } + + + // don't add if event type not in list of active event types + int eventType = static_cast(event.eventTypeId().underlying()); + if (!m_activeEventTypeIds.contains(eventType)) + { + DEBUG_LOG(m_logger) << "live event not added - event type ("< m_cacheSize) // cache got too big, save it as standard cache, clear the live cache and add the new event in the new cache + { + DEBUG_LOG(m_logger) << "more than " << m_cacheSize << " live events - archiving and clearing"; + saveAndClearLiveCache(); + } + + qint64 start = m_liveCache.start; + qint64 end = m_liveCache.end; + qint64 eventTime = event.sampleTime(); + + if (start > eventTime || start == 0) + m_liveCache.start = eventTime; + + if (end < eventTime) + m_liveCache.end = eventTime; + + LtsTimelineClassic::Event *ltsEvent = createEvent(event); + m_liveCache.events.append(ltsEvent); + + rebuildTimelineKnownRanges(); // schedule rebuild because live cache (start & end) has changed + +#ifdef LTS_DEBUG // expensive + DEBUG_LOG(m_logger) << "added live event at " << eventTime << " - cache: " << start << " " << end << ", " << m_liveCache.events.count() << " events"; +#endif + + addEventAndFilter(ltsEvent); +} + + +void DDSTimelineModel::setTimeRange(qint64 min, qint64 max) +{ + m_lowestPositionedItem = min; + m_highestPositionedItem = max; +} + + +qint64 DDSTimelineModel::currentTime() const +{ + return m_session->partitionTime(); +} + + +void DDSTimelineModel::applyFilter(const QJsonArray &filter) +{ + m_filter = filter; + invalidateTimeline(); // force recreation of all EGLs + beginResetModel(); + endResetModel(); +} + + +void DDSTimelineModel::addCacheRangeToTimeline(const CacheRange &cr) +{ + for (auto i = cr.events.begin(); i != cr.events.end(); ++i) + { + LtsTimelineClassic::Event *event = *i; + addEventAndFilter(event); + } +} + + +void DDSTimelineModel::addCacheRange(const LtsTimelineClassic::Range &range, const QVector &cachedEvents, qint64 incompleteEnd, bool addToTimeline) // NOTE: added as visible cache +{ + CacheRange cr; + + cr.visible = true; + cr.start = range.start; + cr.end = range.end; + cr.events = cachedEvents; + cr.incomplete = (incompleteEnd > 0); + + m_eventCount += cachedEvents.count(); + m_cachedEvents.append(QPair(m_lastCachedEventsId++, cr)); + + std::sort(m_cachedEvents.begin(), m_cachedEvents.end(), [](const QPair &cr1, const QPair &cr2) { return cr1.second.start < cr2.second.start; }); // sort the list, by the lowest start time + + if (addToTimeline) + { + addCacheRangeToTimeline(cr); + rebuildTimelineKnownRanges(); + } + + DEBUG_LOG(m_logger) << "added cache for " << range.start << " to " << range.end << " - event count now: " << m_eventCount; +} + + +bool DDSTimelineModel::isCacheFull() const +{ + return (m_cachedEvents.count() > m_maxCacheRanges) /*|| makes no sense: (m_eventCount > m_cacheSize)*/; +} + + +void DDSTimelineModel::_uncache(const CacheRange &cr) +{ + // remove all events from cr from timeline + for (const LtsTimelineClassic::Event *event : qAsConst(cr.events)) + removeEvent(event->uniqueId()); + + rebuildTimelineKnownRanges(); +} + + +void DDSTimelineModel::uncache(CacheRange &cr) +{ + QString hash(QStringLiteral("<%1:%2:%3>").arg(cr.start).arg(cr.end).arg(cr.events.count())); + DEBUG_LOG(m_logger) << "uncaching " << QString::number(qHash(hash), 16) << " " << cr.start << " "<< cr.end; + + cr.visible = false; + _uncache(cr); +} + + +//void DDSTimelineModel::forceUncache(/*int idx*/) +//{ +//// if (m_cachedEvents.count() > idx) +//// { +//// const CacheRange &cr = m_cachedEvents.firstat(idx); +//// _uncache(cr); +//// m_cachedEvents.remove(idx); +//// } + +// if (m_cachedEvents.begin() == m_cachedEvents.end()) +// { +// WARNING_LOG(m_logger) << "could not force uncache as the cache is empty"; +// return; +// } + +// m_cachedEvents.erase(m_cachedEvents.begin()); +// rebuildTimelineKnownRanges(); +//} + + +void DDSTimelineModel::forceUncache() // also deletes cache +{ + if (m_cachedEvents.isEmpty()) + return; + + // look for invisible & incomplete caches first + for (auto i = m_cachedEvents.begin(); i != m_cachedEvents.end(); ++i) + { + CacheRange &cr = i->second; + if (!cr.visible && cr.incomplete) + { + uncache(cr); + m_eventCount -= cr.events.count(); + m_cachedEvents.erase(i); + DEBUG_LOG(m_logger) << "removed an invisible & incomplete cache - event count now: " << m_eventCount; + return; + } + } + + // nothing found - look for invisible but complete caches + for (auto i = m_cachedEvents.begin(); i != m_cachedEvents.end(); ++i) + { + CacheRange &cr = i->second; + if (!cr.visible) + { + uncache(cr); + m_eventCount -= cr.events.count(); + m_cachedEvents.erase(i); + DEBUG_LOG(m_logger) << "removed an invisible cache - event count now: " << m_eventCount; + return; + } + } + + // nothing found - all caches are visible, force-remove cache that is the farthest away + auto i = m_cachedEvents.begin(); + + auto highestStart = i; + auto lowestEnd = i; + + for (; i != m_cachedEvents.end(); ++i) + { + CacheRange &cr = i->second; + + if (highestStart->second.start < cr.start) + highestStart = i; + if (lowestEnd->second.end > cr.end) + lowestEnd = i; + } + + qint64 sbpos = EventTools::getScrollbarPosition(); + + qint64 highestDiff = highestStart->second.start - sbpos; + qint64 lowestDiff = sbpos - lowestEnd->second.end; + + if (highestDiff > lowestDiff) + { + uncache(highestStart->second); + m_eventCount -= highestStart->second.events.count(); + m_cachedEvents.erase(highestStart); + } + else + { + uncache(lowestEnd->second); + m_eventCount -= lowestEnd->second.events.count(); + m_cachedEvents.erase(lowestEnd); + } + + WARNING_LOG(m_logger) << "force-removing a visible cache ... - event count now: " << m_eventCount; +} + + +QVector DDSTimelineModel::getKnownRanges() const // called by the dialog after rebuildTimelineKnownRanges has emitted the signal.... ugh.. +{ + QVector knownRanges; + knownRanges.reserve(m_cachedEvents.count() + 1); + + for (const auto &i : qAsConst(m_cachedEvents)) + { + const CacheRange &cr = i.second; + + if (!cr.incomplete) // only add as known range if cache is complete (and not missing events) - this tells the user that events are missing / "something is wrong" + knownRanges.append(Range(cr.start, cr.end)); + } + + knownRanges.append(Range(m_liveCache.start, m_liveCache.end)); // add live cache + return knownRanges; +} + + +void DDSTimelineModel::rebuildTimelineKnownRanges() // call when adding or removing caches +{ + QTimer::singleShot(0, this, &DDSTimelineModel::signalRebuildTimelineKnownRanges); // sadly, the model cannot do this itself.. + queue because caches have to be cleaned up first before ranges can be updated with them +} + + +void DDSTimelineModel::processEventList(qint64 &highest, bool &incomplete, QVector &cachedEvents, QVector &eventList, const int initialCount) +{ + int count = initialCount; + + QMutableVectorIterator i(eventList); + while (i.hasNext()) + { + count++; // ++ first, otherwise the following check will not trigger on (limit + 1) + if (count > m_cacheSize) + { + WARNING_LOG(m_logger) << "max cache exceeded - not adding more than " << m_cacheSize << " events"; + incomplete = true; + emit signalTooMuchEvents(); + break; // delete remaining events from receivedEventsList + } + + LtsTimelineClassic::Event *event = i.next(); + i.remove(); // take event! + + cachedEvents.append(event); // add to caches events list + + if (event->startTime() + event->duration(true /* ignore live events */) > highest) + highest = event->startTime() + event->duration(true /* ignore live events */); // the journey to find the lowest low + } + + // delete remaining events from receivedEventsList, as if there are events left in the list, the cache was full, and non-added events have be be removed + qDeleteAll(eventList); +} + + +void DDSTimelineModel::receivedEvents(const LtsTimelineClassic::Range &range, QVector &receivedEventsList /* copy */) // NOTE: does not check if event is already added - must be done while requesting events (performance) +{ + // space for cached ranges available? if not, make space! + if (isCacheFull()) + { + DEBUG_LOG(m_logger) << "receivedEvents: cache full - force uncache"; + forceUncache(); + } + +#ifdef LTS_DEBUG // count is rather expensive + DEBUG_LOG(m_logger) << "received events count: " << receivedEventsList.count(); +#endif + + qint64 highest = 0; + bool incomplete = false; + QVector cachedEvents; + + processEventList(highest, incomplete, cachedEvents, receivedEventsList); + addCacheRange(range, cachedEvents, incomplete ? highest : 0); + + DEBUG_LOG(m_logger) << "receivedEvents: loading done"; + emit signalLoadingDone(); +} + + +void DDSTimelineModel::setLive(bool isLive) +{ + if (m_isLive == isLive) // ignore if already live + return; + + m_isLive = isLive; + m_liveCache.visible = isLive; + + if (isLive) + { + m_liveCache.start = m_session->partitionTime(); // immediately set the start time of the live cache, so that armed getEvents do not get events from inside the live time + m_liveCache.end = m_liveCache.start; + } + else // not live + { + saveAndClearLiveCache(); + } +} + + +// #warning TODO: duplicate! (2) +void DDSTimelineModel::slotRequestMessageReceived(const QString &message) +{ + EventRequest *er = qobject_cast(sender()); + if (er == nullptr) + { + DEBUG_LOG(m_logger) << "not an EventRequest: " << sender(); + return; + } + + //qCritical() << "msg" << message; + + const QJsonDocument msgDoc(QJsonDocument::fromJson(message.toUtf8())); + const QJsonArray eventArray(msgDoc.array()); + + for (auto i = eventArray.constBegin(); i != eventArray.constEnd(); ++i) + { + const QJsonObject &eventObj = (*i).toObject(); + + int id = eventObj[QStringLiteral("id")].toInt(-1); + int eventTypeId = eventObj[QStringLiteral("eventTypeId")].toInt(-1); + qint64 startTime = eventObj[QStringLiteral("sampleTime")].toDouble(-1); + const QString &properties = eventObj[QStringLiteral("properties")].toString(QStringLiteral("{}")); + int partyId = eventObj[QStringLiteral("partyId")].toInt(-1); + int participantId = eventObj[QStringLiteral("participantId")].toInt(-1); + int equipmentNumber = eventObj[QStringLiteral("equipmentNumber")].toInt(-1); + + QJsonObject positionObj(eventObj[QStringLiteral("position")].toObject()); + const LtsUtils::QPoint3D pos(positionObj[QStringLiteral("x")].toDouble(), + positionObj[QStringLiteral("y")].toDouble(), + positionObj[QStringLiteral("z")].toDouble()); + + + QJsonParseError err; + const QJsonDocument doc(QJsonDocument::fromJson(properties.toUtf8(), &err)); + const QJsonObject root(doc.object()); + + if (err.error != QJsonParseError::NoError) + { + ERROR_LOG(m_logger) << "Event #" << id << " with event type id " << eventTypeId << " and start time " << startTime << " json detail data cannot be parsed: " << err.errorString() << " at offset " << err.offset; + continue; + } + + QString partyStr(ParticipantManagement::trPartyName(m_ppmDtc->party(partyId).name())); + + if (partyStr.isEmpty()) + partyStr = tr("Unknown Party"); + + QStringList path; + path.append(partyStr); + + switch (eventTypeId) + { + case ProjectDataManagement::EventType::HitBuilding: // 5 - Hit Building + path = getPathForBuildingEvents(tr("Buildings"), root); + break; + case ProjectDataManagement::EventType::CameraVideo: // 8 - Camera Video + path = getPathForAvsEvents(tr("Camera Video"), root); + break; + case ProjectDataManagement::EventType::RadioCnr: // 9 - CNR Radio + path = getPathForAvsEvents(tr("CNR Radio"), root); + break; + case ProjectDataManagement::EventType::RadioTvc: // 10 - TVC Radio + path = getPathForAvsEvents(tr("TVC Radio"), root); + break; + + case ProjectDataManagement::EventType_def::MineArea: + path = getPathForAesEvents(tr("Mine Area"), root); + break; + + case ProjectDataManagement::EventType_def::Borderline: + path = getPathForAesEvents(tr("Borderline"), root); + break; + + case ProjectDataManagement::EventType_def::BCContamination: + path = getPathForAesEvents(tr("B/C Contamination"), root); + break; + + case ProjectDataManagement::EventType_def::NContamination: + path = getPathForAesEvents(tr("N Contamination"), root); + break; + + case ProjectDataManagement::EventType_def::DangerArea: + path = getPathForAesEvents(tr("Danger Area"), root); + break; + + case ProjectDataManagement::EventType_def::FunctionalArea: + path = getPathForAesEvents(tr("Functional Area"), root); + break; + + case ProjectDataManagement::EventType_def::MineCorridor: + path = getPathForAesEvents(tr("Mine Corridor"), root); + break; + + case ProjectDataManagement::EventType_def::TechnicalArea: + path = getPathForAesEvents(tr("Technical Area"), root); + break; + + case ProjectDataManagement::EventType_def::GasPipe: + path = getPathForAesEvents(tr("Gas Pipe"), root); + break; + + default: + path << m_ppmDtc->hierarchyFromParticipant(participantId, m_ppmDtc->participants()).split(QLatin1Char(',')); + path << QString::number(equipmentNumber); + break; + } + + LtsTimelineClassic::Event::EventPaintFunc paintFunc; // set by setColorPaintFunc + QColor color; // s.a.a. + setColorPaintFun(paintFunc, color, ProjectDataManagement::EventType_def::type(eventTypeId)); + + // add end time to event's detail data json + qint64 endTime = root[QStringLiteral("endTime")].toDouble(); // might be a audio/video event + + LtsTimelineClassic::Event *event = new LtsTimelineClassic::Event(id, eventTypeId, startTime, endTime, participantId, partyId, equipmentNumber, + path, paintFunc, color, root, -1, pos, m_session); + +#ifdef LTS_DEBUG // expensive + DEBUG_LOG(m_logger) << "Event #" << event->uniqueId() << " with event type id " << event->typeId() << " and start time " << event->startTime() << " created"; +#endif + + er->append(event); + } +} + + +void DDSTimelineModel::requestEvents(const LtsTimelineClassic::Range &range) +{ + DEBUG_LOG(m_logger) << "requesting events from " << QDateTime::fromMSecsSinceEpoch(range.start).toString() + << " to " << QDateTime::fromMSecsSinceEpoch(range.end).toString(); + + if (m_createFakeEvents) + DEBUG_LOG(m_logger) << "requesting fake events .."; + else + DEBUG_LOG(m_logger) << "requesting real events .."; + + EventRequest *request = new EventRequest(m_createFakeEvents ? QUrl(QStringLiteral("ws://127.0.0.1:10090")) : m_eemForeign->eemUrl(), + range.start, range.end, m_activeEventTypeIds, m_cacheSize); + + connect(request, &EventRequest::signalDone, + this, [this, range, request]() + { + QVector eventList = request->eventList(); + DEBUG_LOG(m_logger) << ".. received real events! " << range.start << " - " << range.end; + + receivedEvents(range, eventList); + request->deleteLater(); + }); + + connect(request, &EventRequest::signalRequestFailed, // calls deleteLater on itself, don't queue here + this, [this, request](const QString &errorString) + { + ERROR_LOG(m_logger) << ".. event request from " << request->start() << " to " << request->end() << " failed! '" << errorString << "'"; + emit signalLoadingDone(); // calls deleteLater on itself + }); + + connect(request, &EventRequest::signalMessageReceived, + this, &DDSTimelineModel::slotRequestMessageReceived); + + emit signalLoading(); +} + + +bool DDSTimelineModel::isCached(int eventId) const +{ + for (const auto &it : m_cachedEvents) + { + const CacheRange &cr = it.second; + for (const LtsTimelineClassic::Event *ev :cr.events) + { + if (ev->uniqueId() == eventId) + return true; + } + } + + for (const LtsTimelineClassic::Event *ev : m_liveCache.events) + { + if (ev->uniqueId() == eventId) + return true; + } + + return false; +} + + +void DDSTimelineModel::showCached(CacheRange &cacheRange) +{ + cacheRange.visible = true; + addCacheRangeToTimeline(cacheRange); +} + + +bool DDSTimelineModel::splitLowest(qint64 &rangeMin /* out */, qint64 rangeMax /* never changes */, qint64 &requestMin /* out */, qint64 &requestMax /* out */, const CacheRange &lowestCache /* must be the *lowest* cache *inside* the range */) const +{ + qint64 oldRangeMin = rangeMin; + bool spaceBeforeCache = (rangeMin < lowestCache.start); + + if (spaceBeforeCache) // space before the cache? create request! + { + // there is space before the cache, that space must be requested! + // set range to request events from + requestMin = rangeMin; // space before a cache is always at rangeMin because otherwise there would not be space before it :^) + requestMax = lowestCache.start - 1; // end the request right before the cache (because we dont want to get events that are already inside the cache, right) + // NO! skip the cache!! it is already there.. OLD => rangeMin = lowestCache.start; // set range start (the "iterator" - for the next iteration) right on the cache - cache starts AFTER range start + DEBUG_LOG(m_logger) << "splitLowest: there is an uncached range before the lowest cache, adding this uncached range to the request " << requestMin << " - " << requestMax << " and set rangeMin now to " << rangeMin << " while rangeMax keeps being " << rangeMax; + } + else + { + // no space before, nothing to do, do not request, increase rangeMin (itreator, for the next iteration) + DEBUG_LOG(m_logger) << "splitLowest: no uncached range at the start of the requested range, no need to request events here - skipping"; + } + + // increase rangeMin to skip this range as it is now processed, either by skipping it (see code above) or because it is going to be processed by the caller function (requestMin & requestMax were set here) + rangeMin = lowestCache.end + 1; // let the next range check start right after the end of the cache + + if (rangeMin > rangeMax) // is the cache bigger than the range end? + { + DEBUG_LOG(m_logger) << "splitLowest: rangeMin > rangeMax - lowestCache.end " << lowestCache.end; + rangeMin = rangeMax; // then we are at the end, done (leftover will be 0) + } + + DEBUG_LOG(m_logger) << "splitLowest: space? " << spaceBeforeCache << " | requestMin" << requestMin << " - requestMax " << requestMax << " | oldRangeMin " << oldRangeMin << " - rangeMin " << rangeMin; + + return spaceBeforeCache; // true: indicates that a request should be generated by requestMin & requestMax as there was space before the cache; false: skip request and try for next range / indicate that no request should be generated by this range +} + + +bool DDSTimelineModel::isInsideCachedRange(const CacheRange &cr, qint64 start, qint64 end) +{ + // if either one side of the cache is inside the range, then there is something cached + return (cr.end >= start && cr.start <= end); +} + + +void DDSTimelineModel::setCreateFakeEvents(bool createFakeEvents) +{ + m_createFakeEvents = createFakeEvents; +} + + +void DDSTimelineModel::getAllEventsOfType(const QSet &eventTypeIds) +{ + //for (CacheRange &cr : m_cachedEvents) + for (auto i = m_cachedEvents.begin(); i != m_cachedEvents.end(); ++i) + { + CacheRange &cr = i->second; + qint64 crId = i->first; + EventRequest *request = new EventRequest(m_createFakeEvents ? QUrl(QStringLiteral("ws://127.0.0.1:10090")) : m_eemForeign->eemUrl(), cr.start, cr.end, eventTypeIds, m_cacheSize); + + connect(request, &EventRequest::signalDone, + this, [this, crId, request]() + { + auto icr = std::find_if(m_cachedEvents.begin(), m_cachedEvents.end(), [crId](const QPair &pair) + { + return (pair.first == crId); + }); + + if (icr == m_cachedEvents.end()) + { + WARNING_LOG(m_logger) << "cr after request for crId " << crId << " not available anymore"; + return; + } + + CacheRange &cr = icr->second; + + QVector eventList = request->eventList(); // copy + DEBUG_LOG(m_logger) << "getAllEventsOfType: .. received real events! " << cr.start << " - " << cr.end; + + + // space for cached ranges available? if not, make space! + if (isCacheFull()) + { + DEBUG_LOG(m_logger) << "getAllEventsOfType: receivedEvents: cache full - not adding new events"; + cr.incomplete = true; + return; + } + + +#ifdef LTS_DEBUG // count is rather expensive + DEBUG_LOG(m_logger) << "getAllEventsOfType: received events count: " << eventList.count(); +#endif + + qint64 highest = 0; + bool incomplete = false; + QVector cachedEvents; + + processEventList(highest, incomplete, cachedEvents, eventList, cr.events.count()); + + cr.incomplete = incomplete; + + + // delete new events that already exist in CacheRange (if an event type was re-added after it was removed in legend, events will be fetched again and conflict with existing ones) + // TODO: don't even request events that are already in cache - saves bandwidth & cpu (but takes time to dev 'n' test) + QMutableVectorIterator i(cachedEvents); + while (i.hasNext()) + { + LtsTimelineClassic::Event *eNew = i.next(); + + for (LtsTimelineClassic::Event *eOld : qAsConst(cr.events)) + { + if (eNew->uniqueId() == eOld->uniqueId()) + { + delete eNew; + i.remove(); + break; + } + } + } + + + cr.events += cachedEvents; + //std::sort(cr.events.begin(), cr.events.end(), [](const CacheRange &cr1, const CacheRange &cr2) { return cr1.start < cr2.start; }); // sort the list, by the lowest start time + + addEventsAndFilter(cachedEvents); + rebuildTimelineKnownRanges(); +//#warning TODO: tell timeline only when *all* requests are done to save big cpu time + + DEBUG_LOG(m_logger) << "getAllEventsOfType: receivedEvents: loading done"; + request->deleteLater(); + }); + + connect(request, &EventRequest::signalRequestFailed, // calls deleteLater on itself, don't queue here + this, [this, request](const QString &errorString) + { + ERROR_LOG(m_logger) << "getAllEventsOfType: event request from " << request->start() << " to " << request->end() << " failed! '" << errorString << "'"; + emit signalLoadingDone(); + }); + + connect(request, &EventRequest::signalMessageReceived, + this, &DDSTimelineModel::slotRequestMessageReceived); + } +} + + +void DDSTimelineModel::getEvents(qint64 rangeMin, qint64 rangeMax) +{ + DEBUG_LOG(m_logger) << "getEvents: requesting events from " << QDateTime::fromMSecsSinceEpoch(rangeMin).toString() << rangeMin << " to " << QDateTime::fromMSecsSinceEpoch(rangeMax).toString() << rangeMax; + + if (!hasActiveEventTypes()) + { + DEBUG_LOG(m_logger) << "no active event types selected"; + return; + } + + if (m_liveCache.start != 0 && rangeMax > m_liveCache.start) // if there is a live cache, limit request to the start of the live cache + { + DEBUG_LOG(m_logger) << "live cache active & in range - limited range max from " << rangeMax << " to " << m_liveCache.start - 1; + rangeMax = m_liveCache.start - 1; + } + + + QVector requestRanges; + for (auto &it : m_cachedEvents) // starts with the lowest cr + { + CacheRange &cr = it.second; + DEBUG_LOG(m_logger) << "> start " << cr.start << " end " << cr.end; + + bool inside = isInsideCachedRange(cr, rangeMin, rangeMax); + if (!inside) // there are events to reuse because the cache is inside the range + continue; + + DEBUG_LOG(m_logger) << "found range that was cached, using it instead of requesting new events"; + + if (!cr.visible) // if cache is NOT visible but is inside the current range, make cache visible + { + DEBUG_LOG(m_logger) << "found range that was cached AND not visible, showing it again"; + showCached(cr); + } + + qint64 requestMin = 0; + qint64 requestMax = 0; + + if (!splitLowest(rangeMin, rangeMax, requestMin, requestMax, cr)) // NOTE: alters rangeMin + continue; + requestRanges.append(Range(requestMin, requestMax)); + + // No... +// else if (cr.visible && !inside) // is cache is visible but is not outside of the range, uncache / make invisible +// { +// qWarning() << "uncaching that was visible but now out-of-range"; +// uncache(cr); +// } + } + + + // check live cache for events.. + if (rangeMin < rangeMax && m_liveCache.start != 0) // in the end rangeMin must equal rangeMax as we iterated over freee space and over caches and should have come to the end - if not at the end then there is some space left, request that also + { + if (isInsideCachedRange(m_liveCache, rangeMin, rangeMax)) + { + qint64 requestMin = 0; + qint64 requestMax = 0; + + if (splitLowest(rangeMin, rangeMax, requestMin, requestMax, m_liveCache)) + requestRanges.append(Range(requestMin, requestMax)); + } + } + + if (rangeMin < rangeMax) // in the end rangeMin must equal rangeMax as we iterated over freee space and over caches and should have come to the end - if not at the end then there is some space left, request that also + { + DEBUG_LOG(m_logger) << "adding request for leftovers from " << rangeMin << " - " << rangeMax; + requestRanges.append(Range(rangeMin, rangeMax)); + } + + int requestRangesCount = requestRanges.count(); + DEBUG_LOG(m_logger) << "requestRanges: " << requestRangesCount; + + for (const auto &range : qAsConst(requestRanges)) + requestEvents(range); + + if (requestRangesCount < 1) + DEBUG_LOG(m_logger) << "nothing requested (requestRangesCount empty)"; +} + + +void DDSTimelineModel::setColorPaintFun(LtsTimelineClassic::Event::EventPaintFunc &paintFunc, QColor &color, + ProjectDataManagement::EventType eventType) const +{ + paintFunc = nullptr; + color = QColor(); + switch (eventType.underlying()) + { + case ProjectDataManagement::EventType::BiteMessage: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRect; + color = QColor("red"); + return; + case ProjectDataManagement::EventType::CameraVideo: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRect; + color = QColor("yellow"); + return; + case ProjectDataManagement::EventType::CrossGlobalBorderline: + case ProjectDataManagement::EventType::CrossLocalBorderline: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRect; + color = QColor("orange"); + return; + case ProjectDataManagement::EventType::EnterDangerArea: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; + color = QColor("blue"); + return; + case ProjectDataManagement::EventType::LeaveDangerArea: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; + color = QColor("red"); + return; + case ProjectDataManagement::EventType::EnterFunctionalArea: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; + color = QColor("green"); + return; + case ProjectDataManagement::EventType::LeaveFunctionalArea: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; + color = QColor("yellow"); + return; + case ProjectDataManagement::EventType::EnterMineArea: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; + color = QColor("orange"); + return; + case ProjectDataManagement::EventType::LeaveMineArea: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; + color = QColor("brown"); + return; + case ProjectDataManagement::EventType::FireEvent: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicEllipse; + color = QColor("blue"); + return; + case ProjectDataManagement::EventType::Hit: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicEllipse; + color = QColor("green"); + return; + case ProjectDataManagement::EventType::Sanitation: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicEllipse; + color = QColor("magenta"); + return; + case ProjectDataManagement::EventType::HitBuilding: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicEllipse; + color = QColor("cyan"); + return; + case ProjectDataManagement::EventType::HitEffectSimulation: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicEllipse; + color = QColor("orange"); + return; + case ProjectDataManagement::EventType::Manipulation: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicTriangle; + color = QColor("blue"); + return; + case ProjectDataManagement::EventType::RadioCnr: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicTriangle; + color = QColor("red"); + return; + case ProjectDataManagement::EventType::RadioTvc: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicTriangle; + color = QColor("green"); + return; + case ProjectDataManagement::EventType::WeaponAssignment: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicTriangle; + color = QColor("orange"); + return; + case ProjectDataManagement::EventType::MineArea: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; + color = QColor("green"); + return; + case ProjectDataManagement::EventType::NContamination: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; + color = QColor("pink"); + return; + case ProjectDataManagement::EventType::EnterNuclear: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; + color = QColor("pink"); + return; + case ProjectDataManagement::EventType::LeaveNuclear: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; + color = QColor("pink").darker(); + return; + case ProjectDataManagement::EventType::BCContamination: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; + color = QColor("blue"); + return; + case ProjectDataManagement::EventType::DangerArea: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; + color = QColor("yellow"); + return; + case ProjectDataManagement::EventType::FunctionalArea: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; + color = QColor("red"); + return; + case ProjectDataManagement::EventType::MineCorridor: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; + color = QColor("brown"); + return; + case ProjectDataManagement::EventType::Borderline: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; + color = QColor("orange"); + return; + case ProjectDataManagement::EventType::TechnicalArea: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; + color = QColor("black"); + return; + case ProjectDataManagement::EventType::GasPipe: + paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRect; + color = QColor("cyan"); + return; + case ProjectDataManagement::EventType::Unknown: + // don't know why HitFoo is separate - all covered by HitEffectSimulation... + case ProjectDataManagement::EventType::HitN: + case ProjectDataManagement::EventType::HitB: + case ProjectDataManagement::EventType::HitC: + case ProjectDataManagement::EventType::HitGasPipe: + case ProjectDataManagement::EventType::HitMine: + case ProjectDataManagement::EventType::FriendlyFire: + case ProjectDataManagement::EventType::EquipmentErrorReport: + case ProjectDataManagement::EventType::EmergencyCall: + return; + } + Q_ASSERT(false); +} + + +QJsonObject DDSTimelineModel::createMarkerDetailData(const MarkerManagement::Marker &data) const +{ + QJsonObject root; + root[QStringLiteral("MarkerName")] = QString::fromStdString(data.name()); + root[QStringLiteral("MarkerNote")] = QString::fromStdString(data.note()); + root[QStringLiteral("Operator")] = data.operatorId(); + root[QStringLiteral("MarkerOffset")] = data.timeStampOffset(); + root[QStringLiteral("MapSettings")] = QString::fromStdString(data.mapSettings()); + root[QStringLiteral("Filter")] = QString::fromStdString(data.filter()); + + bool isSit = false; + bool isGfx = false; + bool isSfx = false; + + for (const MarkerManagement::MarkerDescription &md : data.descriptions()) + { + switch (md.markerType().underlying()) + { + case MarkerManagement::MarkerType::Situation: + { + isSit = true; + break; + } + case MarkerManagement::MarkerType::Video: + { + isGfx = true; + break; + } + case MarkerManagement::MarkerType::Audio: + { + isSfx = true; + break; + } + default: + { + WARNING_LOG(m_logger) << "Marker " << data.id() << "'s description has an invalid marker type: " << (int)md.markerType().underlying(); + break; + } + } + } + + root[QStringLiteral("IsSituationType")] = isSit; + root[QStringLiteral("IsVideoType")] = isGfx; + root[QStringLiteral("IsAudioType")] = isSfx; + + return root; +} + + +LtsTimelineClassic::Event *DDSTimelineModel::getMarker(int uniqueId) +{ + const LtsTimelineClassic::ItemList il = m_rootItem->getFullItemList(true); + for (auto i = il.constBegin(); i != il.constEnd(); ++i) + { + LtsTimelineClassic::Item *item = *i; + + if (item != nullptr && item->getIdentifier() == QStringLiteral("Markers")) + { + const LtsTimelineClassic::EventList el = item->getFullEventList(true, true); + + for (LtsTimelineClassic::Event *event : el) + { + if (event->uniqueId() == uniqueId) + return event; + } + } + } + + return nullptr; +} + + +void DDSTimelineModel::modifyMarker(const MarkerManagement::Marker &data) +{ + LtsTimelineClassic::Event *event = getMarker(data.id()); + + if (event == nullptr) + return; + + // NOTE: there are things that can't be updated ! + +//#warning TODO: can start, etc. change? + event->setDetailData(createMarkerDetailData(data)); + + // NOTE: marker have + event->setPosition(LtsUtils::QPoint3D(data.position().lon(), + data.position().lat(), + data.position().z())); + +//#warning TODO: needed? event position does not change.. + //emit dataChanged(QModelIndex(), QModelIndex()); +} + + +void DDSTimelineModel::addMarkerManagementMarker(const MarkerManagement::Marker &data) +{ + // as 'init' already adds markers and in some cases dds receives markers later, again, don't let dds add markers that already exist: + if (m_knownMarkerIds.contains(data.id())) + return; // don't add already added marker + m_knownMarkerIds += data.id(); + +//#warning TODO: also check markers, etc., etc. + QStringList path; + path.append(tr("Markers")); // FIXME: tr'd keys are dangerous .. + + LtsTimelineClassic::Event::EventPaintFunc paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicTriangle; + QColor color = QColor(Qt::red); + + const LtsUtils::QPoint3D pos(data.position().lon(), + data.position().lat(), + data.position().z()); + + addEventAndFilter(new LtsTimelineClassic::Event(data.id(), //uniqueId + markerTypeId, // HACK: there is no marker enum type in eem + //data.markerTypeId(), + data.timeStamp(), // start time + 0, // end time. TODO: get duration from properties ? + -1, // player Id + -1, // team Id + -1, // equipment Id + path, // tree path + paintFunc, // paint function + color, // color + createMarkerDetailData(data), // json detail data + -1, // sub event id + pos, + m_session)); + +#ifdef LTS_DEBUG // expensive + DEBUG_LOG(m_logger) << "marker added! uniqueId " << data.id() << ", startTime " << data.timeStamp(); +#endif +} + + +//const QVector DDSTimelineModel::createEvents(const QVector &eventList) const +//{ +// QVector ltsEvents; + +// for (auto i = eventList.constBegin(); i != eventList.constEnd(); ++i) +// { +// const ExerciseEventManagement::Event &eemEvent = *i; +// LtsTimelineClassic::Event *ltsEvent = createEvent(eemEvent); + +// if (ltsEvent != nullptr) +// ltsEvents.append(ltsEvent); +// } + +// return ltsEvents; +//} + + +const QJsonObject DDSTimelineModel::getDetailData(const ExerciseEventManagement::Event &event) const +{ + return getDetailData(QByteArray::fromRawData(event.properties().c_str(), event.properties().size()), event.id(), event.eventTypeId(), event.sampleTime()); +} + + +const QJsonObject DDSTimelineModel::getDetailData(const QByteArray &data, int id, const ProjectDataManagement::EventType& type, qint64 startTime) const +{ + QJsonParseError err; + QJsonDocument doc(QJsonDocument::fromJson(data, &err)); + if (err.error != QJsonParseError::NoError) + { + ERROR_LOG(m_logger) << "getDetailData: Event #" << id << " with event type id " << type << " and start time " << startTime << " json detail data cannot be parsed: " << err.errorString() << " at offset " << err.offset; + return QJsonObject(); + } + + return doc.object(); +} + + +//#warning TODO: duplicate! (1) +LtsTimelineClassic::Event *DDSTimelineModel::createEvent(const ExerciseEventManagement::Event &data) const +{ +// if (data.sampleTime() < m_lowestPositionedItem || data.sampleTime() > m_highestPositionedItem) +// { +// ERROR_LOG(m_logger) << "Event #" << data.id() << " with event type id " << data.eventTypeId() << " and start time " << data.sampleTime() << " is out of range (low: " << m_lowestPositionedItem << ", high: " << m_highestPositionedItem << ")"; +// return nullptr; +// } + + QJsonObject root(getDetailData(data)); + + QString partyStr(ParticipantManagement::trPartyName(m_ppmDtc->party(data.partyId()).name())); + + if (partyStr.isEmpty()) + partyStr = tr("Unknown Party"); + + QStringList path; + path.append(partyStr); + + switch (data.eventTypeId().underlying()) + { + case ProjectDataManagement::EventType::HitBuilding: // 5 - Hit Building + path = getPathForBuildingEvents(tr("Buildings"), root); + break; + case ProjectDataManagement::EventType::CameraVideo: // 8 - Camera Video + path = getPathForAvsEvents(tr("Camera Video"), root); + break; + case ProjectDataManagement::EventType::RadioCnr: // 9 - CNR Radio + path = getPathForAvsEvents(tr("CNR Radio"), root); + break; + case ProjectDataManagement::EventType::RadioTvc: // 10 - TVC Radio + path = getPathForAvsEvents(tr("TVC Radio"), root); + break; + case ProjectDataManagement::EventType_def::MineArea: + path = getPathForAesEvents(tr("Mine Area"), root); + break; + case ProjectDataManagement::EventType_def::Borderline: + path = getPathForAesEvents(tr("Borderline"), root); + break; + case ProjectDataManagement::EventType_def::BCContamination: + path = getPathForAesEvents(tr("B/C Contamination"), root); + break; + case ProjectDataManagement::EventType_def::NContamination: + path = getPathForAesEvents(tr("N Contamination"), root); + break; + case ProjectDataManagement::EventType_def::DangerArea: + path = getPathForAesEvents(tr("Danger Area"), root); + break; + case ProjectDataManagement::EventType_def::FunctionalArea: + path = getPathForAesEvents(tr("Functional Area"), root); + break; + case ProjectDataManagement::EventType_def::MineCorridor: + path = getPathForAesEvents(tr("Mine Corridor"), root); + break; + case ProjectDataManagement::EventType_def::TechnicalArea: + path = getPathForAesEvents(tr("Technical Area"), root); + break; + case ProjectDataManagement::EventType_def::GasPipe: + path = getPathForAesEvents(tr("Gas Pipe"), root); + break; + + default: + path << m_ppmDtc->hierarchyFromParticipant(data.participantId()).split(QLatin1Char(',')); + path << QString::number(data.equipmentNumber()); + break; + } + + LtsTimelineClassic::Event::EventPaintFunc paintFunc; // set by setColorPaintFunc + QColor color; // s.a.a. + setColorPaintFun(paintFunc, color,data.eventTypeId()); + + // add end time to event's detail data json + qint64 endTime = root[QStringLiteral("endTime")].toDouble(); // might be a audio/video event + + const LtsUtils::QPoint3D pos(data.position().lon(), + data.position().lat(), + data.position().z()); + LtsTimelineClassic::Event *event = new LtsTimelineClassic::Event(data.id(), data.eventTypeId().underlying(), data.sampleTime(), endTime, + data.participantId(), data.partyId(), data.equipmentNumber(), path, paintFunc, color, + root, -1, + pos, + m_session); + +// if (!checkDetailData(event)) +// { +// ERROR_LOG(m_logger) << "Event #" << event->uniqueId() << " with event type id " << event->typeId() << " and start time " << event->startTime() << " has invalid detail data and cannot be added!"; +// delete event; +// return nullptr; +// } + +#ifdef LTS_DEBUG // expensive + DEBUG_LOG(m_logger) << "Event #" << event->uniqueId() << " with event type id " << event->typeId() << " and start time " << event->startTime() << " created"; +#endif + + return event; +} + + +//bool DDSTimelineModel::checkDetailData(const LtsTimelineClassic::Event *event) const +//{ +// // after creating the event, check if DetailData can get the detail data of the event, otherwise filtering does not work and the developers will never find out! +// const DetailData::GetDetailDataResultList resultList = m_detailData->getDetailData(event); + +// bool ok = true; +// for (const DetailData::GetDetailDataForAttributeResult &result : resultList) +// { +// if (result.requestResult != DetailData::RequestResult::Okay) +// { +// if (result.requestResult == DetailData::RequestResult::InvalidAttributeType) +// { +// DEBUG_LOG(m_logger) << "new event " +// << event->uniqueId() << " with type id " << event->typeId() << " has unknown attribute type " +// << result.attributeType << " / " << result.attributeTypeId; +// } +// else if (result.requestResult == DetailData::RequestResult::NoValueTranslationForAttribute) +// { +// DEBUG_LOG(m_logger) << "new event " +// << event->uniqueId() << " with type id " << event->typeId() << " has no translation for attribute type " +// << result.attributeType << " / " << result.attributeTypeId; +// } +// else +// { +// ERROR_LOG(m_logger) << "new event " +// << event->uniqueId() << " with type id " << event->typeId() << " has invalid detail data for attribute type " +// << result.attributeType << " / " << result.attributeTypeId << " with result " +// << (int)result.requestResult;// << " - event not added!"; +// ok = false; +// } +// } +// } + +// return ok; +//} + + +/*LtsTimelineClassic::Event *DDSTimelineModel::addExerciseEventManagementEvent(const ExerciseEventManagement::Event &data) +{ + +}*/ + + +QStringList DDSTimelineModel::getPathForAvsEvents(const QString &type, const QJsonObject &obj) const +{ + QStringList result; + + int buildingId = obj[QStringLiteral("MainStructureElementId")].toInt(); + DEBUG_LOG(m_logger) << "Building Id = " << buildingId; + if (buildingId > 0) + { + const QString buildingName = m_ismDtc->getBuildingDisplayName(buildingId); + result << tr("Buildings") << buildingName; + } + + QString streamName = obj[QStringLiteral("streamName")].toString(); + QString displayName = streamName; + + if (m_streamNameMapping != nullptr) + displayName = m_streamNameMapping->displayName(streamName); + + result << type << displayName; + + return result; +} + + +QStringList DDSTimelineModel::getPathForBuildingEvents(const QString &type, const QJsonObject &obj) const +{ + QStringList result; + result << type; + + QString buildingName; + + int buildingId = obj[QStringLiteral("MainStructureElementId")].toInt(); + DEBUG_LOG(m_logger) << "Building Id = " << buildingId; + if (buildingId > 0) + { + buildingName = m_ismDtc->getBuildingDisplayName(buildingId); + result << buildingName; + } + + result << tr("Hits"); + + return result; +} + + +QStringList DDSTimelineModel::getPathForAesEvents(const QString &type, const QJsonObject &obj) const +{ + QStringList result; + result << type; + + QString aesName = obj[QStringLiteral("AesName")].toString(); + DEBUG_LOG(m_logger) << "AesName = " << aesName; + result << aesName; + + return result; +} + + +void DDSTimelineModel::removeEvent(int eventId) +{ + const LtsTimelineClassic::ItemList il = getRootItem()->getFullItemList(true); + + for (LtsTimelineClassic::Item *item : il) + { + if (item->removeEvent(eventId)) + { + //m_alreadyAddedEventIds.removeAll(eventId); + return; + } + } + + WARNING_LOG(m_logger) << "removeEvent: event "<uniqueId() == eventId) + return &it.second; + } + } + + return nullptr; +} + + +void DDSTimelineModel::addEventsAndFilter(const QVector &eventList) +{ + for (LtsTimelineClassic::Event *e : eventList) + addEventAndFilter(e); +} + + +void DDSTimelineModel::addEventAndFilter(LtsTimelineClassic::Event *event) +{ + if (!m_filter.isEmpty()) // don't try to filter if there are when filters + setFilter(m_detailData, LtsTimelineClassic::EventList() << event, m_filter, nullptr, false, false /* do not show error windows here */); + + addEvent(event); // => AbstractTimelineModel + +//#warning TODO: only affected indexes + emit dataChanged(QModelIndex(), QModelIndex()); +} + + +void DDSTimelineModel::deleteMarker(int uniqueId) +{ + m_knownMarkerIds.removeAll(uniqueId); + + LtsTimelineClassic::Event *event = getMarker(uniqueId); + + if (event == nullptr) + return; + + event->setDeleted(); + +//#warning TODO: only affected indexes + emit dataChanged(QModelIndex(), QModelIndex()); // intensive.. +} + + +//void DDSTimelineModel::addExerciseEventManagementEvent(const ExerciseEventManagement::Event &data) +//{ +// if (isCached(data.id())) +// { +// qWarning() << "not adding already cached event" << data.id(); +// return; +// } + +// LtsTimelineClassic::Event *event = createEvent(data); + +// if (event == nullptr) +// { +// ERROR_LOG(m_logger) << "cannot add eem event"; +// return; +// } + +// addEventAndFilter(event); +//} + + +//void DDSTimelineModel::slotEventChanged(const ExerciseEventManagement::Event &data, DataModification modType) +//{ +// TRACE_LOG(m_logger) << "slotEventChanged: " << data; +// switch (modType) +// { +// case DataModification::eModified: +// { +// LtsTimelineClassic::Event *event = getEvent(data.id() /* ABIGIOUS ??! */); + +// if (event == nullptr) +// { +// WARNING_LOG(m_logger) << "event #" << data.id() << " has changed, but could not be found in the timeline to update!"; +// break; +// } + +// // NOTE: there are things that can't be updated ! + +// event->setPlayerId(data.participantId()); +// event->setTeamId(data.partyId()); +// event->setEquipmentId(data.equipmentNumber()); +// const QJsonDocument doc(QJsonDocument::fromJson(QByteArray(data.properties().c_str(), data.properties().size()))); +// event->setDetailData(doc.object()); + +// const Core::GeoPosition &geoPos = data.position(); +// event->setPosition(geoPos.z(), geoPos.lat(), geoPos.lon()); + +// emit dataChanged(QModelIndex(), QModelIndex()); +// break; +// } +// case DataModification::eAdded: +// { +// addExerciseEventManagementEvent(data); +// break; +// } +// case DataModification::eRemoved: // IGNORE ! Just for DDS bus cleanup +// { +// //deleteEvent(data.id()); +// break; +// } +// } +//} + + +void DDSTimelineModel::slotMarkerChanged(const MarkerManagement::Marker &data, DataModification modType) +{ + switch (modType) + { + case DataModification::eAdded: + { + addMarkerManagementMarker(data); + break; + } + case DataModification::eRemoved: + { + deleteMarker(data.id()); + break; + } + case DataModification::eModified: + { + modifyMarker(data); + break; + } + } +} + + +// for testing +static int testId = 0; +QVector DDSTimelineModel::createTestEvents(qint64 time, int count, qint64 distance, qint64 duration) +{ + QVector eventList; + eventList.reserve(count); + LtsTimelineClassic::Event::EventPaintFunc paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRect; + + for (int i = 0; i < count; i++) + { + testId++; + + QJsonObject detail; + detail[QStringLiteral("VulnerabilityState")] = testId; + + qint64 pos = time + (i * (distance / count)); + + LtsTimelineClassic::Event *event = + new LtsTimelineClassic::Event( + testId, + 1, // Hit + pos, + pos + duration, + 0, + 2, // party RED + 0, + QStringList() << QStringLiteral("Test"), + paintFunc, + QColor(Qt::red), + detail, + -1, + LtsUtils::QPoint3D(), + m_session); + + eventList.append(event); + } + + return eventList; +} + + + +// EventRequest + +EventRequest::EventRequest(const QUrl &url, qint64 start, qint64 end, const QSet &eventTypes, int limit) + : m_start(start) + , m_end(end) + , m_timeoutTimer(new QTimer(this)) +{ + QUrl realUrl(url); + realUrl.setPath(QStringLiteral("/request")); + + QUrlQuery query; + query.addQueryItem(QStringLiteral("from"), QString::number(m_start)); + query.addQueryItem(QStringLiteral("to"), QString::number(m_end)); + query.addQueryItem(QStringLiteral("requestId"), QStringLiteral("1")); // unused, but cannot be 0 + query.addQueryItem(QStringLiteral("limit"), QString::number(limit + 1 /* + 1 to trigger the maxCacheSize check */)); // prevent a big mess + + if (!eventTypes.isEmpty()) + { + QStringList sl; + sl.reserve(eventTypes.size()); + for (int id : eventTypes) + sl += QString::number(id); + query.addQueryItem(QStringLiteral("eventTypeId"), sl.join(QLatin1Char(','))); + } + + realUrl.setQuery(query); + + //qWarning() << "requesting data from EEM: " << realUrl.toString(); + + QWebSocket *ws = new QWebSocket(QString(), QWebSocketProtocol::VersionLatest, this); + + connect(ws, QOverload::of(&QWebSocket::error), + this, &EventRequest::slotRequestFailed); + connect(ws, &QWebSocket::textMessageReceived, + this, &EventRequest::slotMessageReceived); + + ws->open(realUrl); + + + m_timeoutTimer->setInterval(5000); + m_timeoutTimer->setSingleShot(true); + + connect(m_timeoutTimer, &QTimer::timeout, + this, [this]() + { + requestFailed(QStringLiteral("timeout")); + }); + + m_timeoutTimer->start(); +} + + +void EventRequest::slotMessageReceived(const QString &message) +{ + if (message.isEmpty() || message == QStringLiteral("{}")) + { + m_timeoutTimer->stop(); + emit signalDone(); + return; + } + + m_timeoutTimer->start(); // restart timer, give the server a chance to send more, restart because the message is not complete at this point + emit signalMessageReceived(message); +} + + +void EventRequest::requestFailed(const QString &errorString) +{ + m_timeoutTimer->stop(); + emit signalRequestFailed(errorString); + deleteLater(); +} + + +void EventRequest::slotRequestFailed() +{ + QWebSocket *ws = qobject_cast(sender()); + + if (ws == nullptr) + { + requestFailed(QStringLiteral("unknown error")); + return; + } + + requestFailed(ws->errorString()); +} + +} // namespace Timeline + + +//#include "tln_dialog_model.moc" diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.h new file mode 100755 index 000000000..c82a24ca8 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.h @@ -0,0 +1,209 @@ +/** + * @RDE_HEADER@ + * Timeline Model for DDS + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Mike Wille, SLSE, 2017-03-31 + */ + +#pragma once + +#include "detail_data.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +namespace LtsUtils +{ +class RequestHelper; +} + +namespace LtsSession +{ +class LtsSession; +} + +namespace AudioVideoManagement +{ +class StreamNameMapping; +} + +namespace Timeline +{ +struct CacheRange : public LtsTimelineClassic::Range +{ + QVector events; + bool incomplete = true; + bool visible = false; // events currently visible/set on timeline? +}; + + +class DDSTimelineModel : public LtsTimelineClassic::AbstractTimelineModel +{ + Q_OBJECT + +public: + explicit DDSTimelineModel(QObject *parent); + ~DDSTimelineModel(); + + bool init(const std::shared_ptr &eemForeign, + const std::shared_ptr &mrkDtc, + const std::shared_ptr &exmDtc, + const std::shared_ptr &ppmDtc, + const std::shared_ptr &pdmDtc, + const std::shared_ptr &ismDtc, + LtsSession::LtsSession *session, + Timeline::DetailData *detailData, + AudioVideoManagement::StreamNameMapping *streamNameMapping); + + void applyFilter(const QJsonArray &filter); + void setDetailData(DetailData *detailData) { m_detailData = detailData; } + void setColorPaintFun(LtsTimelineClassic::Event::EventPaintFunc &paintFunc, QColor &color, ProjectDataManagement::EventType eventType) const; + void setTimeRange(qint64 min, qint64 max); + void getEvents(qint64 rangeMin, qint64 rangeMax); + QVector getKnownRanges() const; + const QVector> &cachedEvents() const { return m_cachedEvents; } // for debug only ! + const CacheRange &liveCache() const { return m_liveCache; } // for debug only ! + void forceUncache(); + void setLive(bool isLive = true); + void setCreateFakeEvents(bool createFakeEvents = true); + void setActiveEventTypeIds(const QSet &activeEventTypeIds); + const QSet &activeEventTypeIds() const { return m_activeEventTypeIds; } + bool hasActiveEventTypes() const { return !m_activeEventTypeIds.isEmpty(); } + void getAllEventsOfType(const QSet &eventTypeIds); + + +private: + qint64 currentTime() const override; + //void addExerciseEventManagementEvent(const ExerciseEventManagement::Event &data); + QStringList getPathForAvsEvents(const QString &type, const QJsonObject &obj) const; + QStringList getPathForBuildingEvents(const QString &type, const QJsonObject &obj) const; + QStringList getPathForAesEvents(const QString &type, const QJsonObject &obj) const; + void addMarkerManagementMarker(const MarkerManagement::Marker &data); + void addEventsAndFilter(const QVector &eventList); + void addEventAndFilter(LtsTimelineClassic::Event *event); // returns false if NOT added (so delete the event if false) + void deleteMarker(int uniqueId); + void modifyMarker(const MarkerManagement::Marker &data); + QJsonObject createMarkerDetailData(const MarkerManagement::Marker &data) const; + LtsTimelineClassic::Event *getMarker(int uniqueId); + void checkCache(); + void removeEvent(int eventId); + void addCacheRange(const LtsTimelineClassic::Range &range, const QVector &cachedEvents, qint64 incompleteEnd, bool addToTimeline = true); + bool isLive() const { return m_isLive; } + LtsTimelineClassic::Event *createEvent(const ExerciseEventManagement::Event &data) const; + //const QVector createEvents(const QVector &eventList) const; + bool checkDetailData(const LtsTimelineClassic::Event *event) const; + void processEventList(qint64 &highest, bool &incomplete, QVector &cachedEvents, QVector &eventList, const int initialCount = 0); + void receivedEvents(const LtsTimelineClassic::Range &range, QVector &receivedEventsList); + void requestEvents(const LtsTimelineClassic::Range &range); + QVector createTestEvents(qint64 time, int count, qint64 distance, qint64 duration = 0); + static bool isInsideCachedRange(const CacheRange &cacheRange, qint64 start, qint64 end); + bool isCached(int eventId) const; + void showCached(CacheRange &cacheRange); + bool isCacheFull() const; + //void forceUncache(); + void uncache(CacheRange &cr); + const CacheRange *getCache(int eventId) const; + void addCacheRangeToTimeline(const CacheRange &cr); + bool splitLowest(qint64 &rangeMin, qint64 rangeMax, qint64 &requestMin, qint64 &requestMax, const CacheRange &lowestCache) const; + void rebuildTimelineKnownRanges(); + void _uncache(const CacheRange &cr); + void saveAndClearLiveCache(); + const QJsonObject getDetailData(const ExerciseEventManagement::Event &event) const; + const QJsonObject getDetailData(const QByteArray &data, int id, const ProjectDataManagement::EventType& type, qint64 startTime) const; + + std::shared_ptr m_eemForeign; + std::shared_ptr m_dtcExm; + std::shared_ptr m_ppmDtc; + std::shared_ptr m_pdmDtc; + std::shared_ptr m_mrkDtc; + std::shared_ptr m_ismDtc; + + QJsonArray m_filter; + LtsSession::LtsSession *m_session; + int64_t m_startTime; + int64_t m_endTime; + DetailData *m_detailData; + AudioVideoManagement::StreamNameMapping *m_streamNameMapping; + bool m_isLive; + int m_cacheSize; // per range in m_cachedEvents + int m_maxCacheRanges; // max entries in m_cachedEvents + int m_eventCount; + + qint64 m_lastCachedEventsId; + QVector> m_cachedEvents; + + CacheRange m_liveCache; + bool m_createFakeEvents; + QSet m_activeEventTypeIds; + //bool m_dtorEmergencyMode; + QVector m_knownMarkerIds; + NGL::INGLLogger &m_logger; + + +public slots: + void slotAddLiveEvent(const ExerciseEventManagement::Event &event); + + +private slots: + //void slotEventChanged(const ExerciseEventManagement::Event &data, DataModification modType); + void slotMarkerChanged(const MarkerManagement::Marker &data, DataModification modType); + void slotAddLiveEventsFake(); + void slotRequestMessageReceived(const QString &message); + + +signals: + void signalTooMuchEvents(); + void signalRebuildTimelineKnownRanges(); // sadly, the model cannot do this.. + void signalLoading(); + void signalLoadingDone(); + +}; + + +class EventRequest : public QObject +{ + Q_OBJECT + +public: + EventRequest(const QUrl &url, qint64 start, qint64 end, const QSet &eventTypes, int limit); + ~EventRequest() = default; + + void append(LtsTimelineClassic::Event *newEvent) { m_eventList.push_back(newEvent); } + const QVector &eventList() const { return m_eventList; } + qint64 start() const { return m_start; } + qint64 end() const { return m_end; } + +private: + void requestFailed(const QString &errorString); + + qint64 m_start; + qint64 m_end; + QVector m_eventList; + QTimer *m_timeoutTimer; + + +private slots: + void slotRequestFailed(); + void slotMessageReceived(const QString &message); + + +signals: + void signalRequestFailed(const QString &errorString); + void signalMessageReceived(const QString &message); + void signalDone(); + void signalTimeout(); + +}; + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.cpp new file mode 100755 index 000000000..7ce73f0f2 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.cpp @@ -0,0 +1,274 @@ +#include "tln_event_list.h" +#include "tln_event_list_columns.h" + +#include "ui_tln_event_list.h" +#include "ui_tln_event_list_columns.h" + +#include "tln_event_list_model.h" +#include "tln_show_details.h" + +#include +#include +#include + +#include +#include + +const int MAX_EVENTS = 30; //TODO: Project Settings ? + +namespace Timeline +{ + +EventListDialog::EventListDialog(const QString &menuGroup, + LtsSession::LtsSession *session, + const std::shared_ptr &ppmDtc, + const std::shared_ptr &pdmDtc, + const std::shared_ptr &ismDtc, + const std::shared_ptr &flmIfc, + bool showMarkers, + QWidget *parent) + : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly) + , m_ui(new Ui::EventListDialog) + , m_columns(nullptr) + , m_model(new EventListDialogModel(ppmDtc, pdmDtc, ismDtc, this)) + , m_detailData(nullptr) + , m_menuGroup(menuGroup) + , m_listEvents(false) + , m_flmIfc(flmIfc) + , m_session(session) + , m_logger(getLogger("EventList")) +{ + m_ui->setupUi(this); + + if (showMarkers) + { + m_ui->ltsDataView->setModel(m_model); + } + else // don't show markers - the proxy model filters all markers out .... and the sort methods don't seem to be different from default + { + m_proxyModel = new EventListDialogProxyModel(this); + m_proxyModel->setSourceModel(m_model); + m_ui->ltsDataView->setModel(m_proxyModel); + } + + connect(m_ui->ltsDataView, &LtsDataView::LtsDataView::signalDoubleClicked, + this, &EventListDialog::slotShowSelected); + + connect(m_ui->ltsDataView, &LtsDataView::LtsDataView::signalSelectionChanged, + this, &EventListDialog::slotEnaDisa); + + connect(this, &EventListDialog::signalAddNewEvents, + m_model, &EventListDialogModel::appendEventList); + + m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &EventListDialog::slotShowSelected); + m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &EventListDialog::onPrint); + m_buttonBox->connectButton(LtsWidgets::DialogButton::Load, this, &EventListDialog::onConfigureColumns); + +#ifndef LTS_DEBUG + addConcealedColumns({ EventListDialogModel::Id, EventListDialogModel::AesId, EventListDialogModel::ParticipantId, + EventListDialogModel::DamagePercentOld }); +#endif + + setUnchangeable(); +} + + +EventListDialog::~EventListDialog() +{ + DEBUG_LOG(m_logger) << "~EventListDialog"; + if (m_proxyModel != nullptr) + m_proxyModel->setInvalid(); // just in case + m_model->setInvalid(); // just in case + delete m_ui; + delete m_columns; +} + + +void EventListDialog::retranslate() +{ + m_buttonBox->getButton(LtsWidgets::DialogButton::Load)->setText(tr("Configuration")); + if (m_listEvents) + translate(m_ui, QString(), false, tr("All Events")); + else + translate(m_ui, QString(), false, tr("%1 Events").arg(m_model->rowCount())); +} + + +bool EventListDialog::init(DetailData *detailData, const LtsTimelineClassic::EventList &eventList, bool listEvents) +{ + m_detailData = detailData; + m_listEvents = listEvents; + + if (m_listEvents) + m_ui->label->setVisible(false); + + if (eventList.isEmpty()) + return false; + + m_model->setData(eventList); + + m_headerState = m_ui->ltsDataView->saveState(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + m_ui->ltsDataView->treeView()->header()->setFirstSectionMovable(true); + m_ui->ltsDataView->searchView()->header()->setFirstSectionMovable(true); +#endif + + initColumns(); + + return true; +} + + +void EventListDialog::addConcealedColumns(const QVector &concealedColumns) +{ + for (const int id : concealedColumns) + { + m_ui->ltsDataView->hideColumn(id); + if (!m_concealedColumns.contains(id)) + m_concealedColumns += id; + } +} + + +void EventListDialog::initColumns() +{ + const int colCount = m_model->columnCount(); + if (colCount > 0) + { + m_headerColumns.clear(); + QVector columnInfos; // must be sorted by visualIndex + columnInfos.reserve(colCount); + const auto header = m_ui->ltsDataView->searchView()->header(); + + DEBUG_LOG(m_logger) << "concealed count: " << m_concealedColumns.length(); + for (int visualIndex = 0; visualIndex < colCount; ++visualIndex) + { + DEBUG_LOG(m_logger) << visualIndex << " concealed? " << m_concealedColumns.contains(visualIndex); + if (m_concealedColumns.contains(visualIndex)) // don't offer concealed columns to be shown + continue; + + ColumnInfo ci; + ci.logicalIndex = header->logicalIndex(visualIndex); + ci.visualIndex = visualIndex; + ci.size = header->sectionSize(ci.logicalIndex); + ci.visible = !header->isSectionHidden(ci.logicalIndex); + ci.name = m_model->headerData(ci.logicalIndex, Qt::Orientation::Horizontal, Qt::DisplayRole).toString(); + + DEBUG_LOG(m_logger) << "InitColumns: Adding column " << ci.name << + " with visual index = " << ci.visualIndex << + ", logical index = " << ci.logicalIndex; + + m_headerColumns.insert(ci.name, ci.logicalIndex); + + columnInfos += ci; + } + + m_columns->deleteLater(); + m_columns = new Timeline::EventListColumns(columnInfos, m_flmIfc, this); + + connect(m_columns, &EventListColumns::accepted, + this, &EventListDialog::showColumns); + + showColumns(); + } +} + + +void EventListDialog::clearModel() +{ + m_model->clear(); +} + + +bool EventListDialog::appendEventList(const LtsTimelineClassic::EventList &eventList) +{ + m_model->appendEventList(eventList); + retranslate(); + return true; +} + + +void EventListDialog::slotEnaDisa() +{ + m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, (m_ui->ltsDataView->selectedRows().size() > 0)); +} + + +void EventListDialog::slotShowSelected() +{ + const QModelIndexList indexList = m_ui->ltsDataView->selectedRows(); + + if (!m_listEvents && indexList.count() > MAX_EVENTS) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("You selected too many events to show (> %1). Please deselect some.").arg(MAX_EVENTS)); + return; + } + + for (const QModelIndex &idx : indexList) + { + const LtsTimelineClassic::Event *event = m_model->eventList().at(idx.row()); + if (event->uniqueId() > 0) + emit signalShowEventDetails(event); + } +} + +void EventListDialog::onPrint() +{ + LtsPrinting::printView(m_session, this, m_ui->ltsDataView->treeView()); +} + +void EventListDialog::onConfigureColumns() +{ + initColumns(); + m_columns->show(); +} + +void EventListDialog::showColumns() +{ + if (!m_columns) + return; + + // sorted by visual index + const auto columnInfo = m_columns->currentColumnsState(); + + m_ui->ltsDataView->restoreState(m_headerState); + + auto header = m_ui->ltsDataView->searchView()->header(); + for (const auto &ci : columnInfo) + { + int oldVisualIndex = header->visualIndex(ci.logicalIndex); + + DEBUG_LOG(m_logger) << "ShowColumns: Column " << ci.name + << ", colVisible: " << ci.visible + << ", logical index: " << ci.logicalIndex + << ", old index: " << oldVisualIndex + << ", new index: " << ci.visualIndex; + + if (oldVisualIndex != ci.visualIndex) + header->moveSection(oldVisualIndex, ci.visualIndex); + + header->setSectionHidden(ci.logicalIndex, !ci.visible); + if (ci.visible && ci.size > 0) + header->resizeSection(ci.logicalIndex, ci.size); + } +} + +void EventListDialog::reInitEventList(const LtsTimelineClassic::EventList &eventList, qint64 startTime, qint64 endTime) +{ + LtsTimelineClassic::EventList newEventList; + + for (auto i = eventList.constBegin(); i != eventList.constEnd(); ++i) + { + LtsTimelineClassic::Event *e = (*i); + + if (e->startTime() >= startTime && (e->startTime() + e->duration()) <= endTime) + newEventList += e; + } + + DEBUG_LOG(m_logger) << "reInitEventList size = " << eventList.size(); + DEBUG_LOG(m_logger) << "reInitEventList new size = " << newEventList.size(); + m_model->clear(); + m_model->setData(newEventList); +} + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.h new file mode 100755 index 000000000..5aa5f08e3 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.h @@ -0,0 +1,83 @@ +#pragma once + +#include "logger.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace Ui +{ +class EventListDialog; +} + +namespace LtsTimelineClassic +{ +class EventGraphic; +class Event; +} + + +namespace Timeline +{ +class EventListDialogProxyModel; +class EventListDialogModel; +class DetailData; +class EventListColumns; + +class EventListDialog : public LtsWidgets::LtsDialog +{ + Q_OBJECT + +public: + EventListDialog(const QString &menuGroup, LtsSession::LtsSession *session, + const std::shared_ptr &ppmDtc, + const std::shared_ptr &pdmDtc, + const std::shared_ptr &ismDtc, + const std::shared_ptr &flmIfc, + bool showMarkers = false, + QWidget *parent = nullptr); + ~EventListDialog(); + + bool init(DetailData *detailData, const LtsTimelineClassic::EventList &eventList, bool listEvents); + bool appendEventList(const LtsTimelineClassic::EventList &eventList); + void clearModel(); + void reInitEventList(const LtsTimelineClassic::EventList &eventList, qint64 startTime, qint64 endTime); + +private: + void retranslate() override; + void initColumns(); + void addConcealedColumns(const QVector &concealedColumns); + + Ui::EventListDialog *m_ui; + EventListColumns *m_columns; + EventListDialogModel *m_model; + DetailData *m_detailData; + QHash m_headerColumns; // original + QByteArray m_headerState; + + QString m_menuGroup; + bool m_listEvents; + std::shared_ptr m_flmIfc; + LtsSession::LtsSession *m_session; + EventListDialogProxyModel *m_proxyModel { nullptr }; + NGL::INGLLogger &m_logger; + QVector m_concealedColumns; + +signals: + void signalShowEventDetails(const LtsTimelineClassic::Event *event); + void signalAddNewEvents(const QVector &eventList); + +private slots: + void showColumns(); + void slotShowSelected(); + void slotEnaDisa(); + void onPrint(); + void onConfigureColumns(); +}; + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.ui new file mode 100755 index 000000000..d4db406d2 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.ui @@ -0,0 +1,46 @@ + + + EventListDialog + + + Qt::ApplicationModal + + + + 0 + 0 + 824 + 445 + + + + Exercise Management + + + + + + Selected event contained more than one event: + + + + + + + QAbstractItemView::ExtendedSelection + + + + + + + + LtsDataView::LtsDataView + QWidget +
LtsDataView/lts_data_view.h
+ 1 +
+
+ + +
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.cpp new file mode 100755 index 000000000..fbcbb99bf --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.cpp @@ -0,0 +1,213 @@ +/** + * @RDE_HEADER@ + * ComboBox's popup, optimized for tablets (bigger dropdown/popup) + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2016-03-09 + */ + +#include "tln_event_list_columns.h" +#include "ui_tln_event_list_columns.h" +#include "tln_event_list_model.h" + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +namespace Timeline +{ +static inline QString colObjectName(int idx) +{ + return QStringLiteral("Column_") + QString::number(idx); +} + +EventListColumns::EventListColumns(const QVector &columns, + const std::shared_ptr &flmIfc, + QWidget *parent) + : LtsFramelessDialog(parent, LtsWidgets::Behaviour::Modal ) + , m_ui(new Ui::EventListColumns) + , m_flmIfc(flmIfc) + , m_columns(columns) + , m_logger(getLogger("EventListColumns")) +{ + m_ui->setupUi(this); + + connect(m_ui->pbOk, &QPushButton::clicked, + this, &EventListColumns::accept); + connect(m_ui->pbClose, &QPushButton::clicked, + this, &EventListColumns::reject); + connect(m_ui->pbLoad, &QPushButton::clicked, + this, &EventListColumns::load); + connect(m_ui->pbSave, &QPushButton::clicked, + this, &EventListColumns::save); + + init(); +} + + +EventListColumns::~EventListColumns() +{ + delete m_ui; +} + +QVector EventListColumns::currentColumnsState() const +{ + const auto children = m_ui->itemLayoutWidget->findChildren(); + QVector result; + result.reserve(children.size()); + for (const EventListColumn *elc : children) + result.push_back(elc->columnInfo()); + std::sort(result.begin(), result.end(), + [](const ColumnInfo &a, const ColumnInfo &b) + { + return a.visualIndex < b.visualIndex; + }); + return result; +} + + +void EventListColumns::init() +{ + qDeleteAll(m_ui->itemLayoutWidget->findChildren()); + + // assumption: m_columns is sorted by visual index + for (const auto &ci : qAsConst(m_columns)) + { + EventListColumn *rtcItem = new EventListColumn(ci); + rtcItem->setObjectName(colObjectName(ci.logicalIndex)); + m_ui->itemLayoutWidget->layout()->addWidget(rtcItem); + } + + m_ui->lblConfiguration->setText(tr("No configuration file loaded")); +} + +bool EventListColumns::load() +{ + bool ret = false; + QByteArray content; + int fileId = m_flmIfc->loadFileContent(this, content, {FileManagement::FileType::Xml}, 0, FileManagement::toString(FileManagement::XmlType::TLNEventListConfiguration)); + if (fileId > 0) + { + if (!m_flmIfc->isXmlType(content, FileManagement::toString(FileManagement::XmlType::TLNEventListConfiguration))) + { + QHash texts({{LtsWidgets::Button::Yes, tr("Ok")}}); + LtsWidgets::LtsMessageDialog::showMessage(this, + tr("Invalid xml file content"), + windowTitle(), + LtsWidgets::Behaviour::Modal, + LtsWidgets::Button::Yes, + texts); + } + else + { + const QJsonDocument doc(QJsonDocument::fromJson(content)); + const QJsonObject obj(doc.object()); + const QJsonArray elcCols(obj.value(QStringLiteral("Columns")).toArray()); + + loadColumns(elcCols); + + ret = true; + } + } + + if (ret) + { + QString fileName = m_flmIfc->getFileName(fileId); + m_ui->lblConfiguration->setText(tr("Configuration file: %1").arg(fileName)); + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Successfully loaded configuration file")); + } + else + { + m_ui->lblConfiguration->setText(tr("No configuration file loaded")); + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Could not load configuration file")); + } + return ret; +} + +void EventListColumns::loadColumns(const QJsonArray &cols) +{ + qDeleteAll(m_ui->itemLayoutWidget->findChildren()); + + Timeline::ColumnInfo ci; + for (const auto &val : cols) + { + const QJsonObject obj = val.toObject(); + ci.logicalIndex = obj.value(QStringLiteral("logicalIndex")).toInt(); + ci.visualIndex = obj.value(QStringLiteral("visualIndex")).toInt(); + ci.name = obj.value(QStringLiteral("name")).toString(); + ci.size = obj.value(QStringLiteral("size")).toInt(); + ci.visible = obj.value(QStringLiteral("visible")).toBool(); + const QString objName = colObjectName(ci.logicalIndex); + + EventListColumn *elc = m_ui->itemLayoutWidget->findChild(objName); + if (elc) + { + // should never happens since we write the json file... + ERROR_LOG(m_logger) << "Modifed Column: " << ci.visualIndex + << ", " << ci.logicalIndex << ", " << ci.name + << ", " << ci.visible << ", " << objName; + elc->setChecked(ci.visible); + } + else + { + ERROR_LOG(m_logger) << "New Column: " << ci.visualIndex + << ", " << ci.logicalIndex << ", " << ci.name + << ", " << ci.visible << ", " << objName; + elc = new EventListColumn(ci); + elc->setObjectName(objName); + m_ui->itemLayoutWidget->layout()->addWidget(elc); + } + } +} + +bool EventListColumns::save() +{ + int fileId = m_flmIfc->saveFileContent(this, FileManagement::FileType::Xml, 0, columnsToDoc(exportColumns())); + if (fileId > 0) + DEBUG_LOG(m_logger) << "Saved file with id = " << fileId; + else + ERROR_LOG(m_logger) << "Could not save file in library "; + return (fileId > 0); +} + +const QByteArray EventListColumns::columnsToDoc(const QJsonArray &cols) +{ + QJsonObject obj; + obj[QStringLiteral("XmlType")] = FileManagement::toString(FileManagement::XmlType::TLNEventListConfiguration); + obj[QStringLiteral("Columns")] = cols; + + QJsonDocument doc(obj); + return doc.toJson(QJsonDocument::Compact); +} + +const QJsonArray EventListColumns::exportColumns() const +{ + QJsonArray result = QJsonArray(); + const auto children = m_ui->itemLayoutWidget->findChildren(); + for (const EventListColumn *elc : children) + { + const auto &ci = elc->columnInfo(); + DEBUG_LOG(m_logger) << "Saving column: " << ci.visualIndex << ", " << elc->text() << ", " << elc->isChecked(); + QJsonObject elcObj; + elcObj[QStringLiteral("visualIndex")] = ci.visualIndex; + elcObj[QStringLiteral("logicalIndex")] = ci.logicalIndex; + elcObj[QStringLiteral("name")] = ci.name; + elcObj[QStringLiteral("size")] = ci.size; + elcObj[QStringLiteral("visible")] = ci.visible; + result.append(elcObj); + } + return result; +} + + +} // namespace diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.h new file mode 100755 index 000000000..be46d78b2 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.h @@ -0,0 +1,96 @@ +/** + * @RDE_HEADER@ + * ComboBox's popup, optimized for tablets (bigger dropdown/popup) + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2016-03-09 + */ + +#pragma once + +#include +#include + +#include "logger.h" + +#include + +namespace Ui +{ +class EventListColumns; +} + +class QAbstractItemModel; + +namespace Timeline +{ + +struct ColumnInfo +{ + QString name; + int logicalIndex = 0; + int visualIndex = 0; + int size = 0; + bool visible = false; +}; + +class EventListColumn : public QCheckBox +{ + Q_OBJECT +public: + explicit EventListColumn(const ColumnInfo &ci) + : QCheckBox(ci.name) + , m_ci(ci) + { + setChecked(ci.visible); + connect(this, &EventListColumn::clicked, + this, [this]() { m_ci.visible = isChecked(); }); + } + const ColumnInfo &columnInfo() const { return m_ci; } + +private: + ColumnInfo m_ci; +}; + +/** + * @brief The EventListColumns is a popup window (LtsFramelessDialog) with a list of QCheckboxes. + * This is a custom Popup which is touch-friendly and screen-centered. + */ +class EventListColumns : public LtsWidgets::LtsFramelessDialog +{ + Q_OBJECT + +public: + /** + * @brief EventListColumns creates a popup with all its items (from model) in it + * @param model the model which contains all items + * @param parent parent of this widget + */ + EventListColumns(const QVector &columns, + const std::shared_ptr &flmIfc, + QWidget *parent = nullptr); + ~EventListColumns(); + + QVector currentColumnsState() const; +public slots: + bool save(); + bool load(); + +private: + const QJsonArray exportColumns() const; + void init(); + + const QByteArray columnsToDoc(const QJsonArray &cols); + void loadColumns(const QJsonArray &cols); + +private: + QString m_fileLoaded; + Ui::EventListColumns *m_ui; + std::shared_ptr m_flmIfc; + QVector m_columns; + NGL::INGLLogger &m_logger; + +}; +} // namespace diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.ui new file mode 100755 index 000000000..7020cda29 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.ui @@ -0,0 +1,217 @@ + + + EventListColumns + + + + 0 + 0 + 368 + 234 + + + + + 0 + 0 + + + + true + + + + + + + 12 + + + + Columns: + + + Qt::AlignCenter + + + + + + + + 75 + true + + + + + + + + + + + + 0 + 1 + + + + + 16777215 + 1 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + 3 + + + + + + + true + + + + 0 + 0 + + + + Qt::NoFocus + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + true + + + Qt::AlignCenter + + + + + 0 + 0 + 356 + 96 + + + + + 0 + 0 + + + + + 800 + 800 + + + + Qt::NoFocus + + + + 0 + + + QLayout::SetMinAndMaxSize + + + 0 + + + 0 + + + 100 + + + 0 + + + + + + + + + + 0 + 1 + + + + + 16777215 + 1 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + 3 + + + + + + + + + Save + + + + + + + Load + + + + + + + Ok + + + + + + + Close + + + + + + + + + pbSave + pbClose + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.cpp new file mode 100755 index 000000000..e92ab7711 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.cpp @@ -0,0 +1,268 @@ +#include "tln_event_list_model.h" +#include "detail_data.h" // marker type + +#include +#include +#include +#include + +#include +#include + + +namespace Timeline +{ + +EventListDialogModel::EventListDialogModel(const std::shared_ptr &ppmDtc, + const std::shared_ptr &pdmDtc, + const std::shared_ptr &ismDtc, + QObject *parent) + : LtsWidgets::LtsAbstractTableModel({tr("Id"), + tr("Type"), + tr("Time"), + tr("Duration [s]", "Dauer in Sekunden"), + tr("Party"), + tr("Equipment Number"), + tr("Hierarchy"), + tr("Participant Id"), + tr("Aes Name"), + tr("Aes Type"), +// tr("Battery State"), +// tr("Bite State"), + tr("Building"), + tr("Charge Type"), + tr("Charge Remain"), +// tr("Config State"), + tr("Damage Percent"), + tr("Damage Percent Old"), +// tr("Device Type"), + tr("Friendly Fire"), + tr("Gear Type"), + tr("Stream Name"), + tr("Vulnerability State")}, + parent) + , m_ppmDtc(ppmDtc) + , m_pdmDtc(pdmDtc) + , m_ismDtc(ismDtc) + , m_logger(getLogger("EventListModel")) +{} + + +QVariant EventListDialogModel::data(const QModelIndex &index, int role) const +{ + if (role != Qt::DisplayRole || !indexIsValid(index) || m_invalid) + return QVariant(); + + LtsTimelineClassic::Event *event = m_vecData.at(index.row()); + + const QJsonObject &obj = event->detailData(); +// ERROR_LOG(m_logger) << "Event details #: " << obj.count(); +// for (auto i = obj.constBegin(); i != obj.constEnd(); ++i) +// ERROR_LOG(m_logger) << "Key = " << i.key() << " Value = " << i.value().toString(); + + switch (index.column()) + { + case EventListDialogModel::Columns::Id: + return event->uniqueId(); + case EventListDialogModel::Columns::Type: + { + if (event->typeId() == markerTypeId /* marker */) + return tr("Marker"); + + return ProjectDataManagement::toString(static_cast/*not the best idea*/(event->typeId())); + } + case EventListDialogModel::Columns::Time: + return QDateTime::fromMSecsSinceEpoch(event->startTime()); //, DTG::Short + case EventListDialogModel::Columns::Duration: + return (event->duration() / 1000); + case EventListDialogModel::Columns::Party: + { + if (event->typeId() == ProjectDataManagement::EventType::HitBuilding) // don't show any text on Hit Building as a building can't have a party + break; + return ParticipantManagement::trPartyName(m_ppmDtc->party(event->partyId()).name()); + } + case EventListDialogModel::Columns::EquipNo: + { + if (event->typeId() == ProjectDataManagement::EventType::HitBuilding) // don't show any text on Hit Building as a building can't have a party + break; + return event->equipmentId(); + } + case EventListDialogModel::Columns::Hierarchy: + return m_ppmDtc->hierarchyFromParticipant(event->playerId()); + case EventListDialogModel::Columns::ParticipantId: + return event->playerId(); + + // TODO: fill data + case EventListDialogModel::AesType: + { + const auto ele = obj.value(QLatin1String("AesType")); + if (!ele.isDouble()) + return QVariant(); + const int aesTypeId = ele.toInt(); + return AreaEffectSimulation::toString(static_cast(aesTypeId)); + } + case EventListDialogModel::AesId: + { + const auto ele = obj.value(QLatin1String("AesName")); + if (ele.isString()) + return ele.toString(); + const auto ele2 = obj.value(QLatin1String("AesId")); + return ele2.isDouble() ? QVariant(ele.toInt()) : QVariant(); + } +/* + case EventListDialogModel::BatteryState: + { + if (!obj.contains(QStringLiteral("BatteryState"))) + return QVariant(); + return obj[QStringLiteral("BatteryState")].toInt(); + } + case EventListDialogModel::BiteState: + { + if (!obj.contains(QStringLiteral("BiteState"))) + return QVariant(); + return obj[QStringLiteral("BiteState")].toInt(); + } + case EventListDialogModel::ConfigState: + { + if (!obj.contains(QStringLiteral("ConfigState"))) + return QVariant(); + return obj[QStringLiteral("ConfigState")].toInt(); + } + case EventListDialogModel::DeviceType: + { + if (!obj.contains(QStringLiteral("DeviceType"))) + return QVariant(); + return obj[QStringLiteral("DeviceType")].toVariant(); + } +*/ + case EventListDialogModel::Building: + { + const auto ele = obj.value(QLatin1String("MainStructureElementId")); + if (!ele.isDouble()) + return QVariant(); + int buildingId = ele.toInt(); + if (buildingId > 0) + return m_ismDtc->getBuildingDisplayName(buildingId); + return QVariant(); + } + + case EventListDialogModel::ChargeType: + { + int chargeTypeId = obj.value(QLatin1String("OriginatorChargeTypeId")).toInt(); + if (chargeTypeId <= 0) + chargeTypeId = obj.value(QLatin1String("ChargeTypeId")).toInt(); + if (chargeTypeId <= 0) + return QVariant(); + return m_pdmDtc->trChargeTypeShortName(chargeTypeId); + } + case EventListDialogModel::ChargeRemain: + { + const auto ele = obj.value(QLatin1String("Remain")); + if (!ele.isDouble()) + return QVariant(); + return ele.toInt(); + } + case EventListDialogModel::DamagePercent: + { + const auto ele = obj.value(QLatin1String("damagePercent")); + if (!ele.isDouble()) + return QVariant(); + return ele.toInt(); + } + case EventListDialogModel::DamagePercentOld: + { + const auto ele = obj.value(QLatin1String("damagePercentOld")); + if (!ele.isDouble()) + return QVariant(); + return ele.toInt(); + } + case EventListDialogModel::FriendlyFire: + { + const auto ele = obj.value(QLatin1String("FriendlyFire")); + if (!ele.isBool()) + return QVariant(); + return ele.toBool(); + } + case EventListDialogModel::GearType: + { + int gearTypeId = obj.value(QLatin1String("GearTypeId")).toInt(); + if (gearTypeId <= 0) + return QVariant(); + return m_pdmDtc->trGearTypeName(gearTypeId); + } + case EventListDialogModel::StreamName: + { + const auto ele = obj.value(QLatin1String("streamName")); + if (!ele.isString()) + return QVariant(); + return ele.toString(); + } + case EventListDialogModel::VulnerabilityState: + { + const auto ele = obj.value(QLatin1String("VulnerabilityState")); + if (!ele.isDouble()) + return QVariant(); + const int vId = ele.toInt(); + return ProjectDataManagement::toString(static_cast(vId)); + } + default: + break; + } + + return QVariant(); +} + +void EventListDialogModel::appendEventList(const QVector &eventList) +{ + for (const auto &event : eventList) + { + if (!m_vecData.contains(event)) + insertRow(event); + } +} + +// +// EventListProxyModel +// +void EventListDialogProxyModel::setSourceModel(QAbstractItemModel *sourceModel) +{ + m_sourceModel = qobject_cast(sourceModel); + LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel); +} + +bool EventListDialogProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const +{ + if (!m_sourceModel || + source_left.column() != source_right.column() || + !source_left.isValid() || + !source_right.isValid() || + m_invalid) + return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right); + const auto &dataLeft = m_sourceModel->m_vecData.at(source_left.row()); + const auto dataRight = m_sourceModel->m_vecData.at(source_right.row()); + switch (source_left.column()) + { + case EventListDialogModel::Time: + return dataLeft->startTime() < dataRight->startTime(); + case EventListDialogModel::EquipNo: + return dataLeft->equipmentId() < dataRight->equipmentId(); + default: + break; + } + return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right); +} + + +bool EventListDialogProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const +{ + if (!m_sourceModel || source_parent.isValid() || source_row < 0 || source_row >= m_sourceModel->rowCount() || m_invalid) + return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent); + + LtsTimelineClassic::Event *event = m_sourceModel->m_vecData.at(source_row); + if (event->typeId() == markerTypeId) // not showing Markers in list model + return false; + return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent); +} + + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.h new file mode 100755 index 000000000..2c2712029 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.h @@ -0,0 +1,86 @@ +#pragma once + + +#include +#include +#include +#include +#include +#include + +namespace Timeline +{ + +class EventListDialogModel final : public LtsWidgets::LtsAbstractTableModel +{ + Q_OBJECT + +public: + enum Columns + { + Id, + Type, + Time, + Duration, + Party, + EquipNo, + Hierarchy, + ParticipantId, + AesId, + AesType, +// BatteryState, //opt +// BiteState, //opt + Building, + ChargeType, + ChargeRemain, +// ConfigState, //opt + DamagePercent, + DamagePercentOld, +// DeviceType, //opt + FriendlyFire, + GearType, +// OriginatorType, //opt + StreamName, + VulnerabilityState, + Count + }; + + explicit EventListDialogModel(const std::shared_ptr &ppmDtc, + const std::shared_ptr &pdmDtc, + const std::shared_ptr &ismDtc, + QObject *parent = nullptr); + + const QVector &eventList() const { return m_vecData; } + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + void setInvalid() { m_invalid = true; } + +public slots: + void appendEventList(const QVector &eventList); + +private: + std::shared_ptr m_ppmDtc; + std::shared_ptr m_pdmDtc; + std::shared_ptr m_ismDtc; + bool m_invalid = false; + NGL::INGLLogger &m_logger; + + friend class EventListDialogProxyModel; +}; + +class EventListDialogProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel +{ + Q_OBJECT +public: + using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel; + void setSourceModel(QAbstractItemModel *sourceModel) override; + void setInvalid() { m_invalid = true; } +protected: + bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; + bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; +private: + EventListDialogModel *m_sourceModel = nullptr; + bool m_invalid = false; +}; + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.cpp new file mode 100755 index 000000000..165f6e8fc --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.cpp @@ -0,0 +1,327 @@ +/** + * @RDE_HEADER@ + * ExerciseManangement - Exercise Overview Dialog + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-02-10 + */ + +#include "tln_legend.h" +#include "ui_tln_legend.h" +#include "detail_data.h" +#include "tln_dialog_model.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace Timeline +{ + +TimelineLegendDialog::TimelineLegendDialog(QWidget *parent) + : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel) + , m_ui(new Ui::TimelineLegendDialog) + , m_logger(getLogger("TimelineLegendDialog")) +{ + m_ui->setupUi(this); + + m_buttonBox->getButton(LtsWidgets::DialogButton::Ok)->hide(); // apply() always returns false (because it can't be executed with async ops), resulting in the window not closing on OK - only use apply button until apply() can have async ops + + connect(m_ui->cbCheckAll, &QCheckBox::toggled, + this, [this](bool toggled) + { + const auto cbList = findChildren(); + for (QCheckBox *cb : cbList) + { + if (cb == m_ui->cbCheckAll) // needed? maybe recursion? + continue; + + cb->setChecked(toggled); + } + }); +} + + +TimelineLegendDialog::~TimelineLegendDialog() +{ + delete m_ui; +} + + +void TimelineLegendDialog::retranslate() +{ + translate(m_ui, tr("Timeline Legend")); +} + + +void TimelineLegendDialog::setActiveEventTypeIds(const QSet &activeEventTypeIds) +{ + setUnchangeable(); + // first, deactivate all checkboxes, as we can't keep track on WHICH event types are now inactive + + const QList cbs(findChildren()); // yes, even the "check all" cb + + for (QCheckBox *cb : cbs) + cb->setChecked(false); + + for (int activeEventType : activeEventTypeIds) + { + QCheckBox *cb = checkBox(activeEventType); + + if (cb != nullptr) + cb->setChecked(true); + else + WARNING_LOG(m_logger) << "cb for event type " << activeEventType << " not found!"; + } + + setUnchangeable(false); +} + +QVector TimelineLegendDialog::possibleEvents() +{ + QVector ret + ({ +// ProjectDataManagement::EventType::Unknown, + ProjectDataManagement::EventType::Hit, + ProjectDataManagement::EventType::WeaponAssignment, + ProjectDataManagement::EventType::BiteMessage, + ProjectDataManagement::EventType::FireEvent, + ProjectDataManagement::EventType::HitBuilding, + ProjectDataManagement::EventType::Manipulation, + ProjectDataManagement::EventType::CameraVideo, + ProjectDataManagement::EventType::RadioCnr, + ProjectDataManagement::EventType::RadioTvc, + ProjectDataManagement::EventType::HitEffectSimulation, +// ProjectDataManagement::EventType::HitMine, // HitEffectSimulation +// ProjectDataManagement::EventType::HitN, // HitEffectSimulation +// ProjectDataManagement::EventType::HitC, // HitEffectSimulation +// ProjectDataManagement::EventType::EnterDangerArea, // showEnterLeaveEvents +// ProjectDataManagement::EventType::LeaveDangerArea, // showEnterLeaveEvents +// ProjectDataManagement::EventType::EnterMineArea, // showEnterLeaveEvents +// ProjectDataManagement::EventType::LeaveMineArea, // showEnterLeaveEvents + ProjectDataManagement::EventType::CrossLocalBorderline, +// ProjectDataManagement::EventType::EnterFunctionalArea, // showEnterLeaveEvents +// ProjectDataManagement::EventType::LeaveFunctionalArea, // showEnterLeaveEvents +// ProjectDataManagement::EventType::EnterNuclear, // showEnterLeaveEvents +// ProjectDataManagement::EventType::LeaveNuclear, // showEnterLeaveEvents + ProjectDataManagement::EventType::CrossGlobalBorderline, +// ProjectDataManagement::EventType::HitB, // HitEffectSimulation +// ProjectDataManagement::EventType::FriendlyFire, // currently not displayed +// ProjectDataManagement::EventType::HitGasPipe, // HitEffectSimulation +// ProjectDataManagement::EventType::MineArea, // showEffectSimulationEvents +// ProjectDataManagement::EventType::NContamination, // showEffectSimulationEvents +// ProjectDataManagement::EventType::BCContamination, // showEffectSimulationEvents +// ProjectDataManagement::EventType::DangerArea, // showEffectSimulationEvents +// ProjectDataManagement::EventType::FunctionalArea, // showEffectSimulationEvents +// ProjectDataManagement::EventType::MineCorridor, // showEffectSimulationEvents +// ProjectDataManagement::EventType::Borderline, // showEffectSimulationEvents +// ProjectDataManagement::EventType::TechnicalArea, +// ProjectDataManagement::EventType::GasPipe, // separate +// ProjectDataManagement::EventType::EquipmentErrorReport, +// ProjectDataManagement::EventType::EmergencyCall, + }); + + LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance(); + + if (ps->value(QStringLiteral("tln"), + QStringLiteral("showEffectSimulationEvents")).toBool()) + { + ret += ProjectDataManagement::EventType::MineArea; + ret += ProjectDataManagement::EventType::DangerArea; + ret += ProjectDataManagement::EventType::FunctionalArea; + ret += ProjectDataManagement::EventType::MineCorridor; + ret += ProjectDataManagement::EventType::Borderline; + if (ps->value(QStringLiteral("aes"), + QStringLiteral("enableNuclearContaminations")).toBool()) + ret += ProjectDataManagement::EventType::NContamination; + if (ps->value(QStringLiteral("aes"), + QStringLiteral("enableNuclearContaminations")).toBool() || + ps->value(QStringLiteral("aes"), + QStringLiteral("enableNuclearContaminations")).toBool()) + ret += ProjectDataManagement::EventType::BCContamination; + } + + + if (ps->value(QStringLiteral("tln"), + QStringLiteral("showEnterLeaveEvents")).toBool()) + { + ret += ProjectDataManagement::EventType::EnterDangerArea; + ret += ProjectDataManagement::EventType::LeaveDangerArea; + ret += ProjectDataManagement::EventType::EnterMineArea; + ret += ProjectDataManagement::EventType::LeaveMineArea; + ret += ProjectDataManagement::EventType::EnterFunctionalArea; + ret += ProjectDataManagement::EventType::LeaveFunctionalArea; + + if (ps->value(QStringLiteral("aes"), + QStringLiteral("enableNuclearContaminations")).toBool()) + { + ret += ProjectDataManagement::EventType::EnterNuclear; + ret += ProjectDataManagement::EventType::LeaveNuclear; + } + } + + + if (ps->value(QStringLiteral("aes"), + QStringLiteral("enableGasPipes")).toBool()) + { + ret += ProjectDataManagement::EventType::GasPipe; + //ret += ProjectDataManagement::EventType::HitGasPipe; covered by HitEffectSimulation yes or no ?? + } + + const bool showPvSan = LtsUtils::ProjectSettings::isFunctionEnabled(QStringLiteral("ParticipantInformation"), + QStringLiteral("HasPvSan")); + if (showPvSan) + ret += ProjectDataManagement::EventType::Sanitation; + + return ret; +} + +// helper for grouped sorting +static int categoryFromEventType(ProjectDataManagement::EventType et) +{ + switch (et.underlying()) + { + case ProjectDataManagement::EventType::Unknown: + return 0; + case ProjectDataManagement::EventType::Hit: + case ProjectDataManagement::EventType::WeaponAssignment: + case ProjectDataManagement::EventType::BiteMessage: + case ProjectDataManagement::EventType::FireEvent: + case ProjectDataManagement::EventType::FriendlyFire: + case ProjectDataManagement::EventType::Manipulation: + return 1; + case ProjectDataManagement::EventType::CameraVideo: + case ProjectDataManagement::EventType::RadioCnr: + case ProjectDataManagement::EventType::RadioTvc: + return 5; + case ProjectDataManagement::EventType::HitBuilding: + case ProjectDataManagement::EventType::HitEffectSimulation: + case ProjectDataManagement::EventType::HitMine: + case ProjectDataManagement::EventType::HitN: + case ProjectDataManagement::EventType::HitB: + case ProjectDataManagement::EventType::HitC: + case ProjectDataManagement::EventType::HitGasPipe: + return 2; + case ProjectDataManagement::EventType::EnterDangerArea: + case ProjectDataManagement::EventType::LeaveDangerArea: + case ProjectDataManagement::EventType::EnterMineArea: + case ProjectDataManagement::EventType::LeaveMineArea: + case ProjectDataManagement::EventType::CrossLocalBorderline: + case ProjectDataManagement::EventType::EnterFunctionalArea: + case ProjectDataManagement::EventType::LeaveFunctionalArea: + case ProjectDataManagement::EventType::EnterNuclear: + case ProjectDataManagement::EventType::LeaveNuclear: + case ProjectDataManagement::EventType::CrossGlobalBorderline: + case ProjectDataManagement::EventType::Sanitation: + return 3; + case ProjectDataManagement::EventType::MineArea: + case ProjectDataManagement::EventType::NContamination: + case ProjectDataManagement::EventType::BCContamination: + case ProjectDataManagement::EventType::DangerArea: + case ProjectDataManagement::EventType::FunctionalArea: + case ProjectDataManagement::EventType::MineCorridor: + case ProjectDataManagement::EventType::Borderline: + case ProjectDataManagement::EventType::GasPipe: + return 6; + case ProjectDataManagement::EventType::TechnicalArea: + case ProjectDataManagement::EventType::EquipmentErrorReport: + case ProjectDataManagement::EventType::EmergencyCall: + return 0; + } + Q_ASSERT(false); + return 0; +} + +bool TimelineLegendDialog::init(DDSTimelineModel *model, const QSet &activeEventTypeIds) +{ + struct WidgetSortHelper + { + QLabel *lbl = nullptr; + QCheckBox *cbx = nullptr; + ProjectDataManagement::EventType et = ProjectDataManagement::EventType::Unknown; + }; + QImage p(16, 24, QImage::Format_ARGB32); + QColor c; // dummy + LtsTimelineClassic::Event::EventPaintFunc paintFunc; + WidgetSortHelper wsh; + + const auto events = possibleEvents(); + std::vector helperCont; + helperCont.reserve(events.size()); + for (const ProjectDataManagement::EventType eventType : events) + { + model->setColorPaintFun(paintFunc, c, eventType.underlying()); + + if (paintFunc == nullptr) + { + WARNING_LOG(m_logger) << "No draw function for event " << eventType; + Q_ASSERT(false); + continue; + } + + p.fill(Qt::transparent); + QPainter pp(&p); + pp.setRenderHint(QPainter::Antialiasing); + pp.setBrush(QBrush(c)); + paintFunc(&pp, p.rect().adjusted(0, 0, -1, -1)); + + wsh.lbl = new QLabel(this); + wsh.lbl->setPixmap(QPixmap::fromImage(p)); + + wsh.et = eventType; + wsh.cbx = new QCheckBox(ProjectDataManagement::toString(eventType), this); + wsh.cbx->setObjectName(checkBoxName(eventType)); + wsh.cbx->setChecked(activeEventTypeIds.contains(eventType.underlying())); + wsh.cbx->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + + helperCont.push_back(wsh); + } + + std::sort(helperCont.begin(), helperCont.end(), [](const WidgetSortHelper &a, const WidgetSortHelper &b) + { + const auto et1 = categoryFromEventType(a.et); + const auto et2 = categoryFromEventType(b.et); + if (et1 != et2) + return et1 < et2; + return a.cbx->text() < b.cbx->text(); + }); + + int curGridRow = 1; // 0 is 'Check all' + for (const auto &ele : helperCont) + { + m_ui->gridLayout->addWidget(ele.lbl, curGridRow, 0); + m_ui->gridLayout->addWidget(ele.cbx, curGridRow, 1); + m_ui->gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), curGridRow, 2); + ++curGridRow; + } + m_ui->gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), curGridRow, 0); + + return true; +} + + +bool TimelineLegendDialog::apply() +{ + QSet activeEventTypeIds; + const auto events = possibleEvents(); + for (const ProjectDataManagement::EventType eventType : events) + { + if (checkBox(eventType)->isChecked()) + activeEventTypeIds.insert(eventType.underlying()); + } + emit signalEventTypesChanged(activeEventTypeIds); + return false; // because this has to happen async.. (reset changes after async ops are (successfully) done) +} + +} // namespace Timeline + +// diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.h new file mode 100755 index 000000000..419fa7674 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.h @@ -0,0 +1,58 @@ +/** + * @RDE_HEADER@ + * ExerciseManangement - Exercise Overview Dialog + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-02-10 + */ + +#pragma once + +#include +#include +#include "logger.h" + +namespace Ui +{ +class TimelineLegendDialog; +} + + +namespace Timeline +{ +class DDSTimelineModel; + + +class TimelineLegendDialog : public LtsWidgets::LtsDialog +{ + Q_OBJECT + +public: + explicit TimelineLegendDialog(QWidget *parent = nullptr); + ~TimelineLegendDialog(); + + bool apply() override; + bool init(DDSTimelineModel *model, const QSet &activeEventTypeIds); + void setActiveEventTypeIds(const QSet &activeEventTypeIds); + + static QVector possibleEvents(); +signals: + void signalEventTypesChanged(const QSet &activeEventTypeIds); + +private: + void retranslate() override; + + static QString checkBoxName(int eventTypeId) { return QStringLiteral("CheckBoxEvent%1").arg(eventTypeId); } + static QString checkBoxName(ProjectDataManagement::EventType eventType) { return checkBoxName(eventType.underlying()); } + QCheckBox *checkBox(int eventTypeId) { return findChild(checkBoxName(eventTypeId)); } + QCheckBox *checkBox(ProjectDataManagement::EventType eventType) { return checkBox(eventType.underlying()); } + +private: + Ui::TimelineLegendDialog *m_ui; + NGL::INGLLogger &m_logger; + +}; + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.ui new file mode 100755 index 000000000..973686935 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.ui @@ -0,0 +1,53 @@ + + + TimelineLegendDialog + + + Timeline View + + + + + + + + Check all + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 0 + 20 + + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + + + + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.cpp new file mode 100755 index 000000000..64ce48cd7 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.cpp @@ -0,0 +1,521 @@ +/** + * @RDE_HEADER@ + * Show Details Dialog + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Iuliana Ojog, SLSE, 2017-05-22 + */ + +#include "tln_show_details.h" +#include "ui_tln_show_details.h" +#include "tln_view_gui_plugin.h" +#include "detail_data.h" +#include "logger.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* + * NOTE: + * + * This Dialog uses foreign gui ifcs from a Session that is not ours! + * If we have the last shared_ptr to a foreign Session's foreign Ifc, + * and our Dialog gets deleted AFTER the foreign Session was killed, + * then we trigger the deletion of the dead foreign Ifc of a DEAD SESSION. + * So ifc shared_ptrs are fetched when needed and removed directly after use. + * + * Shared Pointers. + * + */ + + +namespace Timeline +{ + +ShowDetailsDialog::ShowDetailsDialog(QWidget *parent) + : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly) + , m_ui(new Ui::ShowDetailsDialog) + , m_logger(getLogger("ShowDetailsDialog")) +{ + m_ui->setupUi(this); + setUnchangeable(); + + m_ui->debugWidget->hide(); + + connect(m_ui->pbStartReplay, &QPushButton::clicked, + this, &ShowDetailsDialog::slotStartReplay); + + connect(m_ui->pbShowMarker, &QPushButton::clicked, + this, &ShowDetailsDialog::slotShowMarker); + + connect(m_ui->pbPlayback, &QPushButton::clicked, + this, &ShowDetailsDialog::slotStartPlayback); + + connect(m_ui->pbFocus, &QPushButton::clicked, + this, &ShowDetailsDialog::slotFocusOnMap); + + m_ui->tbFocus->hide(); + m_ui->tbMarker->hide(); + m_ui->tbPlayback->hide(); + m_ui->tbReplay->hide(); + +#ifndef LTS_DEBUG + if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("Timeline.Debug")) == QVariant(true)) +#endif + { + m_ui->debugWidget->show(); + } +} + +//------------------------------------------------------------------------------------------------------------------------ +ShowDetailsDialog::~ShowDetailsDialog() +{ + m_session = nullptr; + m_mrkDtc = nullptr; + delete m_ui; +} + +//------------------------------------------------------------------------------------------------------------------------ +void ShowDetailsDialog::retranslate() +{ + translate(m_ui, m_eventType, false, tr("Event")); +} + +//------------------------------------------------------------------------------------------------------------------------ +void ShowDetailsDialog::slotFocusOnMap() +{ + if (m_replayAppSession == nullptr) + { + WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no replay app, no focus"; + return; + } + + std::shared_ptr sitMapIfc; + + if (!m_replayAppSession->getForeignGuiInterface(sitMapIfc)) + { + WARNING_LOG(m_logger) << "no sitMapIfc, no focusing on replay in Show Details Dialog 1"; + return; + } + + if (!sitMapIfc) + { + WARNING_LOG(m_logger) << "no sitMapIfc, no focusing on replay in Show Details Dialog 2"; + return; + } + + if (m_event->typeId() != markerTypeId) // NOTE: marker events have their position stored in the map settings + { + if (!m_event->positionValid()) + { + WARNING_LOG(m_logger) << "event has no valid position, skip focusOnMap"; + return; + } + + // x == lon ; y == lat + sitMapIfc->setCenterPoint(m_event->pos2d()); + } + + const QJsonObject root(m_event->detailData()); + const QJsonValue mapSettings(root[QStringLiteral("MapSettings")]); + + if (!mapSettings.isUndefined()) + sitMapIfc->setOperatorMapSettings(mapSettings); + + const QJsonValue filterSettings(root[QStringLiteral("Filter")]); + if (!filterSettings.isUndefined()) + { + MarkerManagement::MarkerManagementApplyFilter applyFilter(m_replayAppSession, m_fltParticipantIfc, m_fltAesIfc, m_fltBuildingComponentIfc); + if (!applyFilter.applyFilter(filterSettings.toObject())) + { + WARNING_LOG(m_logger) << "filters from event #"<uniqueId()<<" could not be applied"; + return; + } + } +} + +//------------------------------------------------------------------------------------------------------------------------ +void ShowDetailsDialog::slotShowMarker() +{ + m_mrkIfc->showMarker(m_event->uniqueId()); +} + +//------------------------------------------------------------------------------------------------------------------------ +bool ShowDetailsDialog::hasNameAndEndTime() const +{ + QString dummy1; + qint64 dummy2; + return getStreamNameAndEndTime(dummy1, dummy2, true); +} + +//------------------------------------------------------------------------------------------------------------------------ +bool ShowDetailsDialog::getStreamNameAndEndTime(QString &streamName, qint64 &endTime, bool silent) const +{ + const QJsonObject root(m_event->detailData()); + const QString _streamName = root[QStringLiteral("streamName")].toString(); // Lts/Services/ExerciseEventManagement/web_socket_avs.cpp:160 + + if (_streamName.isEmpty()) + { + if (!silent) + ERROR_LOG(m_logger) << "ShowDetailsDialog::slotStartVideo(): stream name is empty " << QJsonDocument(m_event->detailData()).toJson(); + return false; + } + + qint64 _endTime = root[QStringLiteral("endTime")].toDouble(0); + + if (_endTime == 0 && !silent) + WARNING_LOG(m_logger) << "ShowDetailsDialog::slotStartPlayback: event " << m_event->uniqueId() << " has no end time!"; + + streamName = _streamName; + endTime = _endTime; + return true; +} + +//------------------------------------------------------------------------------------------------------------------------ +void ShowDetailsDialog::slotStartPlayback() +{ + QString streamName; + qint64 endTime; + + if (!getStreamNameAndEndTime(streamName, endTime)) + { + LtsWidgets::LtsMessageDialog::showMessage(this, tr("Cannot start playback as this event's informations are missing.")); + return; + } + + const bool isAudio = isAudioEventType(m_event->typeId()); + if (!m_avmIfc->startAudioVideoPlayback(streamName, m_event->startTime(), isAudio)) + new LtsWidgets::LtsMessageDialogNew(this, tr("Playback cannot be started because of an error. Please try again later.")); +} + +//------------------------------------------------------------------------------------------------------------------------ +void ShowDetailsDialog::slotStartReplay() +{ + if (m_replayAppSession == nullptr) + { + ERROR_LOG(m_logger) << "ShowDetailsDialog::slotStartReplay: no replay app, no replay"; + return; + } + + std::shared_ptr srpIfc; + + if (!m_replayAppSession->getForeignGuiInterface(srpIfc)) + { + ERROR_LOG(m_logger) << "ShowDetailsDialog::slotStartReplay: no srp, no replay in Show Details Dialog"; + return; + } + + srpIfc->startReplay(m_event->startTime() - (10 * 1000) /* TODO: offset? */); // TODO: endTime.. + slotFocusOnMap(); +} + +//------------------------------------------------------------------------------------------------------------------------ +void ShowDetailsDialog::setButtonDisabled(QPushButton *button, QToolButton *warningButton, const QString &reasonMessage, bool hide) +{ + if (hide) + button->setVisible(false); + button->setEnabled(false); + button->setToolTip(reasonMessage); + warningButton->setToolTip(reasonMessage); + warningButton->show(); + + connect(warningButton, &QToolButton::clicked, + warningButton, [this, warningButton]() + { + LtsWidgets::LtsMessageDialog::showMessage(this, warningButton->toolTip()); + }); +} + + +//------------------------------------------------------------------------------------------------------------------------ +bool ShowDetailsDialog::isMarkerAudioVideo() const +{ + const QJsonObject root(m_event->detailData()); + + return (root[QStringLiteral("IsAudioType")].toBool(false) || root[QStringLiteral("IsVideoType")].toBool(false)); +} + + +//------------------------------------------------------------------------------------------------------------------------ +bool ShowDetailsDialog::isAvsCapable(const LtsTimelineClassic::Event *event) +{ + const int eventType = event->typeId(); + return isAvEventType(eventType) || eventType == Timeline::markerTypeId; +} + +//------------------------------------------------------------------------------------------------------------------------ +bool ShowDetailsDialog::isHitEventType(int eventTypeId) +{ + return (eventTypeId == ProjectDataManagement::EventType_def::Hit || + eventTypeId == ProjectDataManagement::EventType_def::HitB || + eventTypeId == ProjectDataManagement::EventType_def::HitBuilding || + eventTypeId == ProjectDataManagement::EventType_def::HitC || + eventTypeId == ProjectDataManagement::EventType_def::HitGasPipe || + eventTypeId == ProjectDataManagement::EventType_def::HitEffectSimulation || + eventTypeId == ProjectDataManagement::EventType_def::HitMine || + eventTypeId == ProjectDataManagement::EventType_def::HitN); +} + +//------------------------------------------------------------------------------------------------------------------------ +bool ShowDetailsDialog::isAvEventType(int eventTypeId) +{ + return (isAudioEventType(eventTypeId) || + eventTypeId == ProjectDataManagement::EventType_def::CameraVideo); +} + +//------------------------------------------------------------------------------------------------------------------------ +bool ShowDetailsDialog::isAudioEventType(int eventTypeId) +{ + return (eventTypeId == ProjectDataManagement::EventType_def::RadioCnr || + eventTypeId == ProjectDataManagement::EventType_def::RadioTvc); +} + +//------------------------------------------------------------------------------------------------------------------------ +bool ShowDetailsDialog::init(DetailData *detailData, const LtsTimelineClassic::Event *event, + const QPointer &session, + const QPointer &replayAppSession, + const std::shared_ptr &avmIfc, + const std::shared_ptr &mrkIfc, + const std::shared_ptr &fltParticipantIfc, + const std::shared_ptr &fltAesIfc, + const std::shared_ptr &fltBuildingComponentIfc, + bool isTimelineApp, + QWidget *pseudoParent, + AudioVideoManagement::StreamNameMapping *streamNameMapping) +{ + m_session = session; + //Q_ASSERT(streamNameMapping); +// m_srpIfc = srpIfc; << from replay app +// m_sitMapIfc = sitMapIfc; << from replay app + + std::shared_ptr srpIfc; + std::shared_ptr sitMapIfc; + if (!m_session->getDtc(m_mrkDtc)) + WARNING_LOG(m_logger) << "!m_session->getDtc(m_mrkDtc)"; + + m_mrkDtc->enableMarker(); + + connect(m_mrkDtc.get(), &MarkerManagement::Interface::Dtc::markerChanged, + this, &ShowDetailsDialog::updateMarker); + + + if (replayAppSession != nullptr) + { + m_replayAppSession = replayAppSession; + + connect(replayAppSession.data(), &LtsSession::LtsSession::destroyed, + this, [this]() + { + setButtonDisabled(m_ui->pbFocus, m_ui->tbFocus, tr("No map available.")); + setButtonDisabled(m_ui->pbStartReplay, m_ui->tbReplay, tr("Situation Replay App not started.")); + }); + + if (!replayAppSession->getForeignGuiInterface(srpIfc)) + WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no srp, no replay in Show Details Dialog"; + + if (!replayAppSession->getForeignGuiInterface(sitMapIfc)) + WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no sitMapIfc, no focusing on replay in Show Details Dialog"; + } + + m_avmIfc = avmIfc; + m_mrkIfc = mrkIfc; + m_fltParticipantIfc = fltParticipantIfc; + m_fltAesIfc = fltAesIfc; + m_fltBuildingComponentIfc = fltBuildingComponentIfc; + m_streamNameMapping = streamNameMapping; + + if (m_avmIfc == nullptr) + WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no avm ifc given"; + + if (m_mrkIfc == nullptr) + WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no mrk ifc given"; + + if (m_fltParticipantIfc == nullptr) + WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no flt Part ifc given"; + + if (m_fltAesIfc == nullptr) + WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no flt Aes ifc given"; + + if (m_fltBuildingComponentIfc == nullptr) + WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no flt buildingComponent ifc given"; + + if (m_streamNameMapping == nullptr) + WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no stream name mapping given"; + + m_event = event; + int eventTypeId = event->typeId(); + + // hide equipment id labels if event has no eq id + if (event->equipmentId() <= 0) + { + m_ui->lblEquipNo->hide(); + m_ui->lblValueEquipNo->hide(); + } + else + m_ui->lblValueEquipNo->setText(QString::number(event->equipmentId())); + + connect(pseudoParent, &QWidget::destroyed, this, &ShowDetailsDialog::deleteLater); + + QString eventTime; + + if (m_logger.isDebugEnabled()) + eventTime = QStringLiteral("%1 (%2)").arg(DTG::toStringMSec(event->startTime())).arg(event->startTime()); + else + eventTime = DTG::toStringMSec(event->startTime()); + + m_ui->lblValueEventTime->setText(eventTime); + m_eventType = detailData->eventTypeLookup.getEventText(eventTypeId); + + if (m_eventType.isEmpty()) + m_eventType = tr(" (%1)").arg(eventTypeId); + + if (sitMapIfc == nullptr || isTimelineApp) + setButtonDisabled(m_ui->pbFocus, m_ui->tbFocus, tr("No map available"), true); + else if (eventTypeId != markerTypeId && !m_event->positionValid()) // NOTE: markers get their position from the map settings ! + setButtonDisabled(m_ui->pbFocus, m_ui->tbFocus, tr("Event has an invalid position and cannot be focused")); + + if (srpIfc == nullptr) + setButtonDisabled(m_ui->pbStartReplay, m_ui->tbReplay, tr("Situation Replay App not started.")); + else if (sitMapIfc == nullptr) + setButtonDisabled(m_ui->pbStartReplay, m_ui->tbReplay, tr("This app has no map to focus this event on.")); + else if (eventTypeId != markerTypeId && !m_event->positionValid()) // NOTE: markers get their position from the map settings ! + setButtonDisabled(m_ui->pbStartReplay, m_ui->tbReplay, tr("Event has an invalid position, cannot be focused and therefore has no replay capability.")); + + if (eventTypeId != markerTypeId) + setButtonDisabled(m_ui->pbShowMarker, m_ui->tbMarker, tr("This event is not a marker."), true); + else if (m_mrkIfc == nullptr) + setButtonDisabled(m_ui->pbShowMarker, m_ui->tbMarker, tr("This app has no marker interface available."), true); + + if (!isAvsCapable(event)) + setButtonDisabled(m_ui->pbPlayback, m_ui->tbPlayback, tr("This event is not an audio/video type."), true); + else if (m_avmIfc == nullptr) + setButtonDisabled(m_ui->pbPlayback, m_ui->tbPlayback, tr("This app has no audio/video interface available."), true); + else if (eventTypeId == Timeline::markerTypeId && !isMarkerAudioVideo()) + setButtonDisabled(m_ui->pbPlayback, m_ui->tbPlayback, tr("This marker event is not an audio / video type."), true); + else if (!hasNameAndEndTime()) + setButtonDisabled(m_ui->pbPlayback, m_ui->tbPlayback, tr("This event has missing informations about the playback.")); + + + // Button im Ereignisfenster abhaengig vom Eventtyp ausblenden + if (isAvsCapable(event)) + { + m_ui->pbFocus->hide(); + m_ui->tbFocus->hide(); + m_ui->pbStartReplay->hide(); + m_ui->tbReplay->hide(); + } + + const DetailData::GetDetailDataResultList result = detailData->getDetailData(event); + QLocale locale; // uses system locale + + for (const DetailData::GetDetailDataForAttributeResult &attributeDetail : result) + { + // do not add time again + if (detailData->attributeInterpreterLookup.getInterpreterType(attributeDetail.attributeTypeId) == DetailData::INTERPRETER_TYPE_TIME) + continue; + + QString attributeTypeText; + QString attributeValueText; + + if (attributeDetail.requestResult != DetailData::RequestResult::Okay) + { + if (attributeDetail.requestResult == DetailData::RequestResult::NoValueTranslationForAttribute) // attribute type valid, but no attribute value, but a attribute value id is given - show the id! + { + attributeTypeText = attributeDetail.attributeType; + attributeValueText = QStringLiteral("%1 (%2)").arg(tr("")).arg(attributeDetail.attributeValueId); + } + else if (attributeDetail.requestResult == DetailData::RequestResult::InvalidAttributeType) + { + // an attribute which we don't handle, it's fine + DEBUG_LOG(m_logger) << "Unhandled attribute " << attributeDetail.attributeTypeId << " - skipping"; + continue; + } + else // everything went wrong, only show unknown ids for both key and value + { + attributeTypeText = QStringLiteral("%1 (%2)").arg(tr(""), attributeDetail.attributeTypeId); + attributeValueText = tr(""); + + WARNING_LOG(m_logger) << "getDetailData failed with message id " << (int)attributeDetail.requestResult << " for attribute " << attributeDetail.attributeTypeId; + continue; // do not add unknown types + } + } + else // everything worked fine: + { + attributeTypeText = attributeDetail.attributeType; + + // user readability + bool isNumber = false; + qint64 attributeValueAsNumber = attributeValueText.toLongLong(&isNumber); + if (isNumber) + attributeValueText = locale.toString(attributeValueAsNumber); + + if (m_logger.isDebugEnabled()) + attributeValueText = QStringLiteral("%1 (%2)").arg(attributeDetail.attributeValue).arg(attributeDetail.attributeValueId); + else + attributeValueText = attributeDetail.attributeValue; + } + + + + QString attributeType(attributeDetail.attributeTypeId); + + // leave some attributes out ... + int eventType = event->typeId(); + if (isAudioEventType(eventType)) + { + if (attributeType == QStringLiteral("MainStructureElementId")) + continue; + } + else if (isHitEventType(eventType)) + { + if (attributeType == QStringLiteral("OriginatorType")) + continue; + } + + if (attributeType == QStringLiteral("GearId")) // never show gear id + continue; + + + + + QLabel *attributeValueTextLabel = new QLabel(attributeValueText); + DEBUG_LOG(m_logger) << "attributeValueText=" << attributeValueText; + attributeValueTextLabel->setTextInteractionFlags(attributeValueTextLabel->textInteractionFlags() | Qt::TextInteractionFlag::TextSelectableByMouse); + DEBUG_LOG(m_logger) << "attributeTypeText=" << attributeTypeText + << " attributeValueTextLabel=" << attributeValueTextLabel; + m_ui->formLayout->addRow(new QLabel(attributeTypeText), attributeValueTextLabel); + } + + if (m_eventType.isEmpty()) + m_eventType = QStringLiteral("%1 (%2)").arg(tr(""), ProjectDataManagement::toString(static_cast(event->typeId()))); + m_ui->lblEventType->setText(QStringLiteral("%1").arg(m_eventType)); + + m_ui->pteDetailDataTest->setPlainText(QString::fromUtf8(QJsonDocument(event->detailData()).toJson())); + + QString pos(QStringLiteral("x: %1 - y: %2 - z: %3").arg(m_event->position().x()).arg(m_event->position().y()).arg(m_event->position().z())); + m_ui->lblPos->setText(pos); + + return true; +} + +void ShowDetailsDialog::updateMarker() +{ + DEBUG_LOG(m_logger) << "ShowDetailsDialog::updateMarker"; +} + + +//------------------------------------------------------------------------------------------------------------------------ +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.h new file mode 100755 index 000000000..0a4ec5e59 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.h @@ -0,0 +1,96 @@ +/** + * @RDE_HEADER@ + * FileManagement - Rename Folder Dialog + * $Id$ + * $HeadURL$ + * $Author$ + * Created by Iuliana Ojog, SLSE, 2017-05-22 + */ + +#pragma once + +#include "tln_view_gui_plugin.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace Ui +{ +class ShowDetailsDialog; +} + +namespace AudioVideoManagement +{ +class StreamNameMapping; +} + +namespace Timeline +{ +class DetailData; + +class ShowDetailsDialog : public LtsWidgets::LtsDialog +{ + Q_OBJECT + +public: + explicit ShowDetailsDialog(QWidget *parent = nullptr); + ~ShowDetailsDialog(); + + bool init(DetailData *detailData, const LtsTimelineClassic::Event *event, + const QPointer &session, + const QPointer &replayAppSession, + const std::shared_ptr &avmIfc, + const std::shared_ptr &mrkIfc, + const std::shared_ptr &fltParticipantIfc, + const std::shared_ptr &fltAesIfc, + const std::shared_ptr &fltBuildingComponentIfc, + bool isTimelineApp, + QWidget *pseudoParent, + AudioVideoManagement::StreamNameMapping *streamNameMapping); + + void retranslate() override; + +private slots: + void slotStartReplay(); + void slotStartPlayback(); + void slotShowMarker(); + void slotFocusOnMap(); + void updateMarker(); + +private: + bool hasNameAndEndTime() const; + bool getStreamNameAndEndTime(QString &streamName, qint64 &endTime, bool silent = false) const; + void setButtonDisabled(QPushButton *button, QToolButton *warningButton, const QString &reasonMessage, bool hide = false); + bool isMarkerAudioVideo() const; + static bool isAvsCapable(const LtsTimelineClassic::Event *event); + static bool isHitEventType(int eventTypeId); + static bool isAvEventType(int eventTypeId); + static bool isAudioEventType(int eventTypeId); + + QString m_eventType; + Ui::ShowDetailsDialog *m_ui{nullptr}; + const LtsTimelineClassic::Event *m_event{nullptr}; + + // everything from replay app: + QPointer m_replayAppSession; + // end + + std::shared_ptr m_avmIfc; + std::shared_ptr m_mrkIfc; + std::shared_ptr m_fltParticipantIfc; + std::shared_ptr m_fltAesIfc; + std::shared_ptr m_fltBuildingComponentIfc; + AudioVideoManagement::StreamNameMapping *m_streamNameMapping{nullptr}; + std::shared_ptr m_mrkDtc; + LtsSession::LtsSessionDataDds *m_session{nullptr}; + NGL::INGLLogger &m_logger; +}; +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.ui new file mode 100755 index 000000000..352e78270 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.ui @@ -0,0 +1,304 @@ + + + ShowDetailsDialog + + + Qt::ApplicationModal + + + + 0 + 0 + 366 + 451 + + + + Exercise Management + + + + + + <Event Type> + + + + + + + Qt::Horizontal + + + + + + + + + Folder Name + + + Equip. No.: + + + + + + + Event Time: + + + + + + + ... + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + ... + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + + + + :/style/warning.svg:/style/warning.svg + + + + 24 + 24 + + + + + + + + <html><head/><body><p>Plays the audio and/or video clip assoociated to the event in the replay application, in a audio/video dialog.</p></body></html> + + + Start Playback + + + + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + + + + :/style/warning.svg:/style/warning.svg + + + + 24 + 24 + + + + + + + + Focus on map + + + + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + + + + :/style/warning.svg:/style/warning.svg + + + + 24 + 24 + + + + + + + + <html><head/><body><p>Sets the replay application back to the time the event occured and focuses the event on the map. </p></body></html> + + + Start Replay + + + + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + + + + :/style/warning.svg:/style/warning.svg + + + + 24 + 24 + + + + + + + + Show Marker + + + + + + + + + + + + + + <font color='#aebac6'>Debug:</font> + + + + + + + + + Position: + + + + + + + - + + + + + + + + + + 0 + 0 + + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.cpp new file mode 100755 index 000000000..d193907c9 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.cpp @@ -0,0 +1,167 @@ +/** + * @RDE_HEADER@ + * GUI Plugin for ExerciseManangement + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-02-10 + */ + +#include "EventFilter/FilterWindow.h" +#include "tln_view_gui_plugin.h" +#include "tln_dialog.h" +#include "logger.h" + +#include // for abort + +#include +#include +#include + +#include + +namespace Timeline +{ + +std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) +{ + return std::make_shared(session); +} + +InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) + : GuiPluginBase::Interface(session, getLogger("View")) +{} + + +bool InterfaceImpl::fetchInterfaces() +{ + if (!m_session->getForeignDataInterface(m_eemForeign)) + return false; + if (!m_session->getDtc(m_mrkDtc)) + return false; + if (!m_session->getDtc(m_exmDtc)) + return false; + if (!m_session->getDtc(m_ppmDtc)) + return false; + if (!m_session->getForeignGuiInterface(m_flmIfc)) + return false; + if (!m_session->getForeignGuiInterface(m_ppmInfoIfc)) + return false; + if (!m_session->getDtc(m_pdmDtc)) + return false; +// if (!m_session->getDtc(m_ismDtc)) +// return false; + + if (!m_session->getForeignDataInterface_NEW(m_avmDataIfc)) + WARNING_LOG(m_logger) << "no avm data ifc, no stream name mapping"; + if (!m_session->getForeignDataInterface(m_srmDataIfc)) // to start the replay situation app + WARNING_LOG(m_logger) << "no srm data ifc, no situation replay app"; + if (!m_session->getDtc(m_coreDtc)) + WARNING_LOG(m_logger) << "no core dtc, no situation replay app"; + if (!m_session->getForeignGuiInterface(m_avmIfc)) + WARNING_LOG(m_logger) << "Timeline Gui Plugin: no avm ifc"; + if (!m_session->getForeignGuiInterface(m_mrkIfc)) + WARNING_LOG(m_logger) << "Timeline Gui Plugin: no mrk ifc"; + if (!m_session->getForeignGuiInterface(m_fltParticipantIfc)) + WARNING_LOG(m_logger) << "Timeline Gui Plugin: no flt Part ifc"; + if (!m_session->getForeignGuiInterface(m_fltAesIfc)) + WARNING_LOG(m_logger) << "Timeline Gui Plugin: no flt Aes ifc"; + if (!m_session->getForeignGuiInterface(m_fltBuildingComponentIfc)) + WARNING_LOG(m_logger) << "Timeline Gui Plugin: no flt BuildingComponent ifc"; + + return true; +} + + +void InterfaceImpl::clearInterfaces() +{ + m_eemForeign = nullptr; + m_mrkDtc = nullptr; + m_exmDtc = nullptr; + m_ppmDtc = nullptr; + m_flmIfc = nullptr; + m_ppmInfoIfc = nullptr; + m_srmDataIfc = nullptr; + m_coreDtc = nullptr; + m_avmIfc = nullptr; + m_mrkIfc = nullptr; + m_avmDataIfc = nullptr; + m_pdmDtc = nullptr; + //m_ismDtc = nullptr; + m_fltParticipantIfc = nullptr; + m_fltAesIfc = nullptr; + m_fltBuildingComponentIfc = nullptr; +} + + +QVector InterfaceImpl::getActions() +{ + QVector ret; + + { + LtsWidgets::PluginData plData; + plData.menuGroup = menuGroup(); + plData.menuText = tr("Timeline"); + plData.identifier = QLatin1String("tlnView"); + plData.exercisePart = LtsWidgets::ExercisePart::eExecution; + plData.menuIcon = QIcon(QLatin1String("icon:timeline.svg")); + + if (getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::MAIN)) + { + plData.layoutArea = LtsWidgets::LayoutArea::eMainTab; + plData.createInstant = LtsWidgets::CreateInstantType::CreateInstantAndDiscardAction; + + plData.createWidgetFunc = [this](QWidget *) + { + return onShowTimelineViewDialog(true); + }; + } + else + { + plData.layoutArea = LtsWidgets::LayoutArea::eDialogTab; + + plData.createWidgetFunc = [this](QWidget *) + { + return onShowTimelineViewDialog(false); + }; + } + + ret.append(plData); + } + + return ret; +} + + +QString InterfaceImpl::menuGroup() const +{ + return tr("Timeline"); // TODO: oder Events? +} + + +LtsWidgets::LtsDialog *InterfaceImpl::onShowTimelineViewDialog(bool isMain) +{ + std::shared_ptr ismDtc; + if (!m_session->getDtc(ismDtc)) + { + new LtsWidgets::LtsMessageDialogNew(m_session->baseLayoutWidget(), tr("The Infrastructure Management is not available!"), tr("Cannot open Timeline")); + return nullptr; + } + + + LtsWidgets::ButtonCombination buttonCombo = /*isMain ? LtsWidgets::ButtonCombination::SeamlessDialog : */LtsWidgets::ButtonCombination::CloseOnly; + + AudioVideoManagement::StreamNameMapping *streamNameMapping = nullptr; + + if (m_avmDataIfc) + streamNameMapping = m_avmDataIfc->streamNameMapping(); + + return LtsWidgets::initDialog(new TimelineViewDialog(menuGroup(), buttonCombo, isMain, nullptr), + m_eemForeign, m_mrkDtc, m_exmDtc, m_flmIfc, m_ppmDtc, + m_ppmInfoIfc, m_avmIfc, m_mrkIfc,m_srmDataIfc, m_coreDtc, + m_pdmDtc, ismDtc, m_fltParticipantIfc, m_fltAesIfc, m_fltBuildingComponentIfc, m_session, + streamNameMapping); +} + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.h new file mode 100755 index 000000000..79321c2c2 --- /dev/null +++ b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.h @@ -0,0 +1,94 @@ +/** + * @RDE_HEADER@ + * Gui Plugin for ExerciseManangement + * $Id$ + * $HeadURL$ + * $Author$ + * + * Created by Mike Wille, SLSE, 2017-02-10 + */ + +#pragma once + +#include +#include // forward decls for dtc/ftc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace Timeline +{ + +class GuiPlugin final : public QObject, public GuiPluginBase::Plugin +{ + Q_PLUGIN_METADATA(IID "gui:3:tln.view") + Q_INTERFACES(GuiPluginBase::Plugin) + + Q_OBJECT + +public: + explicit GuiPlugin() = default; + ~GuiPlugin() = default; + + QString pluginName() override { return QLatin1String("TimelineGuiPlugin"); } + std::shared_ptr createGuiInterface(LtsSession::LtsSession *session) override; + bool availableInPartition(IDL::PartitionType partition) const override + { + return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Replay; + } +}; + +class InterfaceImpl final : public QObject, public GuiPluginBase::Interface +{ + Q_OBJECT + +public: + explicit InterfaceImpl(LtsSession::LtsSession *session); + + QVector getActions() override; + QString menuGroup() const override; + bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Replay; } + bool fetchInterfaces() override; + void clearInterfaces() override; + +private: + LtsWidgets::LtsDialog *onShowTimelineViewDialog(bool isMain); + + // dtc's + std::shared_ptr m_coreDtc; + std::shared_ptr m_exmDtc; + std::shared_ptr m_mrkDtc; + std::shared_ptr m_ppmDtc; + std::shared_ptr m_pdmDtc; + //std::shared_ptr m_ismDtc; + std::shared_ptr m_avmDataIfc; + + // foreign gui's + std::shared_ptr m_eemForeign; + std::shared_ptr m_flmIfc; + std::shared_ptr m_ppmInfoIfc; + std::shared_ptr m_avmIfc; + std::shared_ptr m_mrkIfc; + std::shared_ptr m_srmDataIfc; + std::shared_ptr m_fltParticipantIfc; + std::shared_ptr m_fltAesIfc; + std::shared_ptr m_fltBuildingComponentIfc; +}; + +} // namespace Timeline diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/Adler/WebSocketSimulator/awss_base_layout.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/Adler/WebSocketSimulator/awss_base_layout.cpp index a567919cf..9ae054763 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/Adler/WebSocketSimulator/awss_base_layout.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/Adler/WebSocketSimulator/awss_base_layout.cpp @@ -17,7 +17,7 @@ //other #include "awss_websocket_interface.h" -#include +#include // Qt6: QAction moved from QtWidgets to QtGui #include namespace AdlerWebSocketSimulator { diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/CnrProxyTester/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Tools/CnrProxyTester/CMakeLists.txt index 71b090517..eae3d69f6 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/CnrProxyTester/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/CnrProxyTester/CMakeLists.txt @@ -5,6 +5,9 @@ # Created by Hannes Fritsche, SLSE, 2017-09-05 # +# .ui files live in the ui/ subdirectory; tell AUTOUIC where to find them +set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/ui) + SET(SRCS mainwindow.cpp mainwindow.h diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleGenerator/initialisation.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleGenerator/initialisation.cpp index 5cb07057f..de61025c3 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleGenerator/initialisation.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleGenerator/initialisation.cpp @@ -48,12 +48,12 @@ void Initialisation::generateTestData(const QString &type) { ExerciseManagement::Exercise data; - data.id(999); - data.name("TestExe"); - data.isUsed(m_isUsed); - data.partitionName("Exe999"); - data.state(ExerciseManagement::ExerciseState::Started); - data.isDeleted(false); + data.id = 999; + data.name = "TestExe"; + data.isUsed = m_isUsed; + data.partitionName = "Exe999"; + data.state = ExerciseManagement::ExerciseState::Started; + data.isDeleted = false; getPublisher()->write(data); @@ -62,19 +62,19 @@ void Initialisation::generateTestData(const QString &type) { ParticipantManagement::Participant data; - data.id(m_participantId); - data.symbol(std::string("231")); + data.id = m_participantId; + data.symbol = std::string("231"); //data.relatedUnit(1); - data.equipmentNumber (1111); + data.equipmentNumber = 1111; - data.isSimulated(true); - data.sampleTime(QDateTime::currentMSecsSinceEpoch()); + data.isSimulated = true; + data.sampleTime = static_cast(QDateTime::currentMSecsSinceEpoch()); //data.isNBCProtectionActivated(false); getPublisher()->write(data); - data.id(m_participantId+10); + data.id = m_participantId+10; getPublisher()->write(data); } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleReceiver/main.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleReceiver/main.cpp index e839e74bf..78dd92fd3 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleReceiver/main.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleReceiver/main.cpp @@ -30,7 +30,8 @@ static QVector getAvailableTopicTypes() // get top return false; QMap topics = typePlugin->getDataTopics(); - topics.unite(typePlugin->getFunctionTopics()); + // Qt6: QMap::unite removed; insert() keeps the same "existing keys win" semantics + topics.insert(typePlugin->getFunctionTopics()); QMap::iterator it = topics.begin(); for( ; it != topics.end(); ++it) @@ -71,23 +72,24 @@ public: return availDataTopics; // Convert list of DoTypes, separated by comma (given by user) + // Qt6: QStringRef/QString::splitRef removed; QStringView::split provides the same tokenization const QString doTypeStr = value(QLatin1String("t")); - const QVector strList = doTypeStr.splitRef(QLatin1Char(','), QString::SkipEmptyParts); + const QList strList = QStringView{doTypeStr}.split(QLatin1Char(','), Qt::SkipEmptyParts); if (strList.isEmpty()) return availDataTopics; QVector vDt; vDt.reserve(strList.size()); - for (const QStringRef &doTypeStr : strList) + for (const QStringView doTypeView : strList) { bool ok = false; - int doTypeInt = doTypeStr.toInt(&ok); + const int doTypeInt = doTypeView.toInt(&ok); INFO_LOG(logger) << "doType: " << doTypeInt; if (ok && doTypeInt >= 0 && doTypeInt < availDataTopics.size()) vDt.append(availDataTopics.at(doTypeInt)); else - WARNING_LOG(logger) << doTypeStr.toString() << " is not a valid DoType, skipping.. "; + WARNING_LOG(logger) << doTypeView.toString() << " is not a valid DoType, skipping.. "; } return vDt; } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleReceiver/topic_data.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleReceiver/topic_data.cpp index fdc741627..8e616872a 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleReceiver/topic_data.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/DataSampleReceiver/topic_data.cpp @@ -76,12 +76,12 @@ void TopicData::processData(const ExerciseManagement::Exercise &data) DEBUG_LOG(m_logger) << "=> IN processData Exercise"; - INFO_LOG(m_logger) << "|#| id: # " << data.id(); - INFO_LOG(m_logger) << "|#| name: # " << data.name(); - INFO_LOG(m_logger) << "|#| state: # " << data.state(); - INFO_LOG(m_logger) << "|#| partition: # " << data.partitionName(); - INFO_LOG(m_logger) << "|#| isUsed: # " << data.isUsed(); - INFO_LOG(m_logger) << "|#| markedAsDeleted: # " << data.isDeleted(); + INFO_LOG(m_logger) << "|#| id: # " << data.id; + INFO_LOG(m_logger) << "|#| name: # " << data.name; + INFO_LOG(m_logger) << "|#| state: # " << data.state; + INFO_LOG(m_logger) << "|#| partition: # " << data.partitionName; + INFO_LOG(m_logger) << "|#| isUsed: # " << data.isUsed; + INFO_LOG(m_logger) << "|#| markedAsDeleted: # " << data.isDeleted; } @@ -90,10 +90,10 @@ void TopicData::processData(const ParticipantManagement::Participant &data) { DEBUG_LOG(m_logger) << "-> IN processData Participant"; - INFO_LOG(m_logger) << "|#| participantId: #" << data.id(); - INFO_LOG(m_logger) << "|#| name: #" << data.name(); - INFO_LOG(m_logger) << "|#| hierarchyNo: #" << data.hierarchyNumber(); - INFO_LOG(m_logger) << "|#| equipNo: #" << data.equipmentNumber(); + INFO_LOG(m_logger) << "|#| participantId: #" << data.id; + INFO_LOG(m_logger) << "|#| name: #" << data.name; + INFO_LOG(m_logger) << "|#| hierarchyNo: #" << data.hierarchyNumber; + INFO_LOG(m_logger) << "|#| equipNo: #" << data.equipmentNumber; //processData(data.location()); } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/rw/rwwidgets.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/rw/rwwidgets.cpp index 524a5149c..47fe52c74 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/rw/rwwidgets.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/rw/rwwidgets.cpp @@ -330,7 +330,7 @@ RWBitfieldWidget::RWBitfieldWidget(RwMode readOnly, QWidget *parent) void RWBitfieldWidget::setValue(quint8 val) { - m_label->setText(QLatin1Literal("0b") + QString::number(val,2)); + m_label->setText(QStringLiteral("0b") + QString::number(val,2)); if (m_bitfield) m_bitfield->setValue(val); } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/samplemodel.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/samplemodel.cpp index 50677e21b..d62762f9f 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/samplemodel.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/samplemodel.cpp @@ -40,7 +40,7 @@ SampleModel::SampleData SampleModel::SampleData::decodeFromMime(const QByteArray QString tn; quint64 ptr; dds::core::xtypes::DynamicData *dynDataPtr; - stream >> tn >> ptr >> ret.topicName >> ret.m_description >> ret.pause; + stream >> tn >> ptr >> ret.topicName >> ret.description >> ret.pause; ret.typeName = tn.toStdString(); dynDataPtr = reinterpret_cast(ptr); ret.legatusData = QSharedPointer(new dds::core::xtypes::DynamicData(*dynDataPtr)); @@ -103,7 +103,7 @@ QVariant SampleModel::data(const QModelIndex &index, int role) const case Column::TopicName: return data.topicName; case Column::Description: - return data.m_description; + return data.description; case Column::TypeName: return QString::fromStdString(data.typeName); case Column::Pause: @@ -133,10 +133,10 @@ bool SampleModel::setData(const QModelIndex &index, const QVariant &value, int r case Column::TypeName: break; case Column::Description: - data.m_description = value.toString(); + data.description = value.toString(); retVal = true; if (data.dialog) - data.dialog->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(data.m_description, data.topicName)); + data.dialog->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(data.description, data.topicName)); break; case Column::Pause: { @@ -313,7 +313,7 @@ bool SampleModel::dropMimeData(const QMimeData *data, Qt::DropAction action, sample.legatusData = QSharedPointer(new dds::core::xtypes::DynamicData(*ptr)); sample.typeName = ptr->type().name(); - sample.m_description = sample.topicName; + sample.description = sample.topicName; int beginRow; if (row != -1) @@ -339,7 +339,7 @@ bool SampleModel::dropMimeData(const QMimeData *data, Qt::DropAction action, // TODO: set topicName sample.typeName = typeName.toStdString(); sample.topicName = QString::fromLatin1(topicName.data()); - sample.m_description = sample.topicName; + sample.description = sample.topicName; sample.legatusData = QSharedPointer(new dds::core::xtypes::DynamicData(NGLSettings::instance()->dataTopic(sample.topicName).type)); int beginRow; @@ -370,7 +370,7 @@ bool SampleModel::addRow(const dds::core::xtypes::DynamicData &data, const QStri id.typeName = data.type().name(); id.topicName = topicName; - id.m_description = description.isEmpty() ? topicName : description; + id.description = description.isEmpty() ? topicName : description; id.legatusData = QSharedPointer(new dds::core::xtypes::DynamicData(data.type())); return addRow(id); @@ -423,7 +423,7 @@ bool SampleSortModel::lessThan(const QModelIndex &left, case SampleModel::Column::TopicName: return dataLeft.topicName < dataRight.topicName; case SampleModel::Column::Description: - return dataLeft.m_description < dataRight.m_description; + return dataLeft.description < dataRight.description; case SampleModel::Column::TypeName: return dataLeft.typeName < dataRight.typeName; case SampleModel::Column::Pause: diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/sampleview.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/sampleview.cpp index 0f4c86dfb..27bfed526 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/sampleview.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/sampleview.cpp @@ -172,7 +172,7 @@ void SampleView::onTableDoubleClicked(const QModelIndex &mi) if (dvd) { dvd->fill(*data.data()); - dvd->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(m_model->sampleData(sourceMi).m_description, + dvd->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(m_model->sampleData(sourceMi).description, m_model->sampleData(sourceMi).topicName)); } @@ -183,7 +183,7 @@ void SampleView::onTableDoubleClicked(const QModelIndex &mi) connect(dvd, &DetailViewDlg::send, this, &SampleView::send); dvd->init(*data.data(), m_model->sampleData(sourceMi).topicName, RwMode::WriteOnly); dvd->setBtnsSendOkCancel(); - dvd->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(m_model->sampleData(sourceMi).m_description, + dvd->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(m_model->sampleData(sourceMi).description, m_model->sampleData(sourceMi).topicName)); m_model->setDialog(sourceMi, dvd); } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/sequences/abstractsequencewidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/sequences/abstractsequencewidget.cpp index ff72bfe9c..0091eb86e 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/sequences/abstractsequencewidget.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/sequences/abstractsequencewidget.cpp @@ -165,7 +165,7 @@ void AbstractSequenceWidget::deleteMemberWidget(QObject *member) QString childName = child->objectName(); QString newId = m_name + QLatin1Char('.') + QString::number(i + 1); - child->setObjectName(childName.replace(QRegularExpression(QRegularExpression::escape(m_name + QLatin1String(".") + "([0-9]*)")), newId)); + child->setObjectName(childName.replace(QRegularExpression(QRegularExpression::escape(m_name + QString::fromLatin1(".([0-9]*)" ))), newId)); DEBUG_LOG(m_logger) << "new child name: " << child->objectName(); } } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/DotMatrixDisplay/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Tools/DotMatrixDisplay/CMakeLists.txt index d2155b5d7..c04033c0b 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/DotMatrixDisplay/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/DotMatrixDisplay/CMakeLists.txt @@ -31,6 +31,10 @@ NGL_ADD_EXECUTABLE(WS NO_TRANSLATION displayPanelSimulator ${displayPanelSimulator_HDRS} ) +# .ui files live in the ui/ subdirectory; AUTOUIC only searches the source +# dir by default, so tell it where to find them +set_target_properties(displayPanelSimulator PROPERTIES AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/ui") + NGL_TARGET_INCLUDE_DIRECTORIES(displayPanelSimulator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/logviewtablemodel.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/logviewtablemodel.cpp index eee2fed13..ad2ddddd7 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/logviewtablemodel.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/logviewtablemodel.cpp @@ -96,7 +96,7 @@ QVariant LogViewTableModel::data(const QModelIndex &index, int role) const return QVariant(); } - case Qt::TextColorRole: // TEXT COLOR + case Qt::ForegroundRole: // TEXT COLOR { const QString logLevel = m_logfile.at(index.row()).level; QColor col = m_fontColors.level.value(logLevel); diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/logviewtableview.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/logviewtableview.cpp index e5f846396..c3f5e8700 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/logviewtableview.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/logviewtableview.cpp @@ -10,7 +10,7 @@ #include "logviewtableview.h" #include "logviewtablemodel.h" -#include +#include // Qt6: QAction moved from QtWidgets to QtGui #include #include #include diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/mainwindow.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/mainwindow.cpp index 4a8f07c61..b9bb167bf 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/mainwindow.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/LogViewer/mainwindow.cpp @@ -126,10 +126,10 @@ void MainWindow::onActionOpen() QString str(QString::fromUtf8(ba)); - const QStringList strLines = str.split(QLatin1Char('\n'), QString::SkipEmptyParts); + const QStringList strLines = str.split(QLatin1Char('\n'), Qt::SkipEmptyParts); for (const QString &tempLines : strLines) { - const QStringList strWords = tempLines.split(QLatin1Char(' '), QString::SkipEmptyParts); + const QStringList strWords = tempLines.split(QLatin1Char(' '), Qt::SkipEmptyParts); LogViewTableModel::logInformation li; QDateTime firstDate; diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ParticipantDataGenerator/main_handler.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/ParticipantDataGenerator/main_handler.cpp index d8c162294..4a0efda72 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ParticipantDataGenerator/main_handler.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/ParticipantDataGenerator/main_handler.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "proxy_emulator.h" @@ -29,7 +30,7 @@ ParticipantDataGenerator::MainHandler::MainHandler(QObject *parent) , m_participantCreationTimer(new QElapsedTimer()) , m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("PDG.MainHandler")) { - qsrand(QDateTime::currentMSecsSinceEpoch()); + QRandomGenerator::global()->seed(QDateTime::currentMSecsSinceEpoch()); } ParticipantDataGenerator::MainHandler::~MainHandler() @@ -161,9 +162,9 @@ void ParticipantDataGenerator::MainHandler::createParticipants() for (auto it = participantMap.begin(); it != participantMap.end(); ++it) { - if (it.value().equipmentNumber().is_set()) + if (it.value().equipmentNumber.has_value()) { - allocatedEquipmentNumbers.append(it.value().equipmentNumber().get()); + allocatedEquipmentNumbers.append(it.value().equipmentNumber.value()); ++equipmentNumberCount; } } @@ -178,13 +179,13 @@ void ParticipantDataGenerator::MainHandler::createParticipants() DEBUG_LOG(m_logger) << "Creating " << participantCount << " new participants."; - request.data().reserve(participantCount); + request.data.reserve(participantCount); for (int32_t counter = 1; counter <= participantCount; ++counter) { ParticipantManagement::ParticipantData newData; ParticipantManagement::Type type = randomType(); - newData.modId(counter); + newData.modId = counter; inferiorCount.insert(counter, 0); int32_t partyId = 2; int32_t superiorModId = 0; @@ -193,27 +194,27 @@ void ParticipantDataGenerator::MainHandler::createParticipants() superiorModId = randomSuperiorModId(counter - 1); int32_t hierarchyNumber = inferiorCount.value(superiorModId) + 1; - newData.superiorModId(superiorModId); - newData.hierarchyNumber(counter == 1 ? 1 : hierarchyNumber); + newData.superiorModId = superiorModId; + newData.hierarchyNumber = (counter == 1 ? 1 : hierarchyNumber); inferiorCount.insert(superiorModId, hierarchyNumber); // increment equipmentNumber until it is not already allocated while (allocatedEquipmentNumbers.contains(++equipmentNumber)); allocatedEquipmentNumbers.append(equipmentNumber); - newData.equipmentNumber().set(equipmentNumber); - newData.isSimulated(true); - newData.isDeleted(false); - newData.typeId(type.id()); - newData.symbol(type.symbol()); - newData.name(QStringLiteral("name_%1").arg(counter).toStdString()); - newData.designator(QStringLiteral("designator_%1").arg(counter).toStdString()); - newData.tacticalIdentifier(QStringLiteral("tacticalIdentifier_%1").arg(counter).toStdString()); - newData.info(QStringLiteral("info_%1").arg(counter).toStdString()); - newData.assignState(ParticipantManagement::ParticipantAssignState::HandoutExcon); - newData.partyId(partyId); + newData.equipmentNumber = equipmentNumber; + newData.isSimulated = true; + newData.isDeleted = false; + newData.typeId = type.id; + newData.symbol = type.symbol; + newData.name = QStringLiteral("name_%1").arg(counter).toStdString(); + newData.designator = QStringLiteral("designator_%1").arg(counter).toStdString(); + newData.tacticalIdentifier = QStringLiteral("tacticalIdentifier_%1").arg(counter).toStdString(); + newData.info = QStringLiteral("info_%1").arg(counter).toStdString(); + newData.assignState = ParticipantManagement::ParticipantAssignState::HandoutExcon; + newData.partyId = partyId; - request.data().push_back(std::move(newData)); + request.data.push_back(std::move(newData)); } m_participantCreationTimer->start(); @@ -236,8 +237,8 @@ void ParticipantDataGenerator::MainHandler::onNewPositions() for (auto it = participants.begin(); it != participants.end(); ++it) { - if (it.value().equipmentNumber().is_set()) - participantIdToEquipmentnumber.insert(it.value().id(), it.value().equipmentNumber().get()); + if (it.value().equipmentNumber.has_value()) + participantIdToEquipmentnumber.insert(it.value().id, it.value().equipmentNumber.value()); } m_proxyEmulator->moveParticipants(participantIdToEquipmentnumber, m_ppmDtc->participantPositions()); @@ -252,14 +253,14 @@ ParticipantManagement::Type ParticipantDataGenerator::MainHandler::randomType() { do { - unsigned int index = qrand() % m_types.size(); + unsigned int index = QRandomGenerator::global()->bounded(m_types.size()); result = m_types.at(index); } - while (result.typeClass() != ParticipantManagement::TypeClass::Human && - result.typeClass() != ParticipantManagement::TypeClass::GroundVehicle && - result.typeClass() != ParticipantManagement::TypeClass::Aircraft && - result.typeClass() != ParticipantManagement::TypeClass::Vessel && - result.typeClass() != ParticipantManagement::TypeClass::VehicleWithGear + while (result.typeClass != ParticipantManagement::TypeClass::Human && + result.typeClass != ParticipantManagement::TypeClass::GroundVehicle && + result.typeClass != ParticipantManagement::TypeClass::Aircraft && + result.typeClass != ParticipantManagement::TypeClass::Vessel && + result.typeClass != ParticipantManagement::TypeClass::VehicleWithGear ); } @@ -268,8 +269,8 @@ ParticipantManagement::Type ParticipantDataGenerator::MainHandler::randomType() int32_t ParticipantDataGenerator::MainHandler::randomSuperiorModId(int32_t upperBound) { - qsrand(QDateTime::currentMSecsSinceEpoch()); - auto ret = qrand() % (upperBound + 1); + QRandomGenerator::global()->seed(QDateTime::currentMSecsSinceEpoch()); + auto ret = QRandomGenerator::global()->bounded(upperBound + 1); return ret == 0 ? ret + 1 : ret; } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ParticipantDataGenerator/proxy_emulator.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/ParticipantDataGenerator/proxy_emulator.cpp index 98c41fa88..409b65e9a 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ParticipantDataGenerator/proxy_emulator.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/ParticipantDataGenerator/proxy_emulator.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -47,14 +48,14 @@ void ParticipantDataGenerator::ProxyEmulator::giveInitPositions(const QMap(QDateTime::currentMSecsSinceEpoch()); + pos.position.position = randomPosition(); m_tabDts->publish(pos); } @@ -79,10 +80,10 @@ static constexpr double minY = 5870000; Core::GeoPosition ParticipantDataGenerator::ProxyEmulator::movePosition(const Core::GeoPosition &oldPosition) { - LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(oldPosition.lon(), oldPosition.lat())); + LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(oldPosition.lon, oldPosition.lat)); - int ofsX = (qrand() % 200) - 100; - int ofsY = (qrand() % 200) - 100; + int ofsX = (QRandomGenerator::global()->bounded(200)) - 100; + int ofsY = (QRandomGenerator::global()->bounded(200)) - 100; coord.x += ofsX; coord.y += ofsY; @@ -91,26 +92,27 @@ Core::GeoPosition ParticipantDataGenerator::ProxyEmulator::movePosition(const Co coord.y = qBound(minY, coord.y, maxY); const QPointF ret(coord.geographic()); - return Core::GeoPosition(ret.x(), ret.y(), oldPosition.z()); + return Core::GeoPosition(ret.x(), ret.y(), oldPosition.z); } void ParticipantDataGenerator::ProxyEmulator::moveParticipants(const QHash &participantIdToEquimentNumber, const QMap &positions) { - const int posSelector = (qrand() % 10) + 1; - const int biteSelector = (qrand() % 100) + 1; - const int equipGearAssignSelector = (qrand() % 200) + 1; - const int ctaDataErrorSelector = (qrand() % 100) + 1; + const int posSelector = (QRandomGenerator::global()->bounded(10)) + 1; + const int biteSelector = (QRandomGenerator::global()->bounded(100)) + 1; + const int equipGearAssignSelector = (QRandomGenerator::global()->bounded(200)) + 1; + const int ctaDataErrorSelector = (QRandomGenerator::global()->bounded(100)) + 1; int counter = 0; TrainingAreaBase::EquipmentPosition newPosition; - newPosition.sampleTime(QDateTime::currentMSecsSinceEpoch()); + newPosition.sampleTime = static_cast(QDateTime::currentMSecsSinceEpoch()); TrainingAreaBase::EquipmentBite newBite; - newBite.sampleTime(QDateTime::currentMSecsSinceEpoch()); + newBite.sampleTime = static_cast(QDateTime::currentMSecsSinceEpoch()); TrainingAreaBase::EquipmentGearAssignment newGearAssignment; - newGearAssignment.sampleTime(QDateTime::currentMSecsSinceEpoch()); + newGearAssignment.sampleTime = static_cast(QDateTime::currentMSecsSinceEpoch()); TrainingAreaBase::CtaDataError newCtaDataError; - newCtaDataError.sampleTime(QDateTime::currentMSecsSinceEpoch()); - newCtaDataError.reason(ProjectDataManagement::DataErrorReason::ErrorConfigSelfTest); - newCtaDataError.originTelegramId(203); + newCtaDataError.sampleTime = static_cast(QDateTime::currentMSecsSinceEpoch()); + // Regenerated DDS enum uses prefixed enumerators (pdm_enums.hpp) + newCtaDataError.reason = ProjectDataManagement::DataErrorReason::DataErrorReason_ErrorConfigSelfTest; + newCtaDataError.originTelegramId = 203; int pC = 0; int bC = 0; int gC = 0; @@ -118,24 +120,24 @@ void ParticipantDataGenerator::ProxyEmulator::moveParticipants(const QHashpublish(newBite); ++bC; } if ((counter % equipGearAssignSelector) == 0) { - newGearAssignment.equipmentNumber(equipNo); + newGearAssignment.equipmentNumber = equipNo; m_tabDts->publish(newGearAssignment); ++gC; } if ((counter % ctaDataErrorSelector) == 0) { - newCtaDataError.equipmentNumber(equipNo); + newCtaDataError.equipmentNumber = equipNo; m_tabDts->publish(newCtaDataError); ++cC; } @@ -144,11 +146,11 @@ void ParticipantDataGenerator::ProxyEmulator::moveParticipants(const QHashpublish(newPosition); @@ -171,11 +173,11 @@ Core::GeoPosition ParticipantDataGenerator::ProxyEmulator::randomPosition() constexpr int rangeX = qAbs(minX - maxX); constexpr int rangeY = qAbs(minY - maxY); - const QPointF p(coord.geographic(qrand() % rangeX, - qrand() % rangeY)); - result.z(0); - result.lon(p.x()); - result.lat(p.y()); + const QPointF p(coord.geographic(QRandomGenerator::global()->bounded(rangeX), + QRandomGenerator::global()->bounded(rangeY))); + result.z = 0; + result.lon = p.x(); + result.lat = p.y(); return result; } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ProjectSettingsEditor/main_window.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/ProjectSettingsEditor/main_window.cpp index ec2a35fa5..a263ecea5 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ProjectSettingsEditor/main_window.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/ProjectSettingsEditor/main_window.cpp @@ -13,7 +13,7 @@ #include -#include +#include // Qt6: QAction moved from QtWidgets to QtGui #include #include #include diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/QLedLine/qledline.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/QLedLine/qledline.cpp index fbda42341..9e0d5ad5a 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/QLedLine/qledline.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/QLedLine/qledline.cpp @@ -29,7 +29,6 @@ QLedLine::QLedLine(QWidget *parent) { m_layout->setSpacing(0); m_layout->setContentsMargins(0,0,0,0); - m_layout->setMargin(0); QSpacerItem *sp1 = new QSpacerItem(0,0, QSizePolicy::Expanding, QSizePolicy::Expanding); QSpacerItem *sp2 = new QSpacerItem(0,0, QSizePolicy::Expanding, QSizePolicy::Expanding); diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/TextEditorTest/textedit.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/TextEditorTest/textedit.cpp index ab0d12512..7c0dc3200 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/TextEditorTest/textedit.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/TextEditorTest/textedit.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -10,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -367,8 +367,8 @@ bool TextEdit::load(const QString &f) return false; QByteArray data = file.readAll(); - QTextCodec *codec = Qt::codecForHtml(data); - QString str = codec->toUnicode(data); + // Qt6: QTextCodec/Qt::codecForHtml removed; decode as UTF-8 + QString str = QString::fromUtf8(data); if (Qt::mightBeRichText(str)) { QUrl baseUrl = (f.front() == QLatin1Char(':') ? QUrl(f) : QUrl::fromLocalFile(f)).adjusted(QUrl::RemoveFilename); textEdit->document()->setBaseUrl(baseUrl); @@ -505,7 +505,7 @@ void TextEdit::filePrint() QPrinter printer(QPrinter::HighResolution); QPrintDialog *dlg = new QPrintDialog(&printer, this); if (textEdit->textCursor().hasSelection()) - dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection); + dlg->setOption(QAbstractPrintDialog::PrintSelection, true); dlg->setWindowTitle(tr("Print Document")); if (dlg->exec() == QDialog::Accepted) textEdit->print(&printer); diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/TopicDiscover/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Tools/TopicDiscover/CMakeLists.txt index b813fbdec..1b27e1d44 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/TopicDiscover/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/TopicDiscover/CMakeLists.txt @@ -38,4 +38,5 @@ NGL_TARGET_LINK_LIBRARIES(topicdiscoverexe LtsCommandLineParser nglcoreapplication topicdiscover + NGLLogger ) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/mainwindow.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/mainwindow.cpp index 17fba8197..bd183e7aa 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/mainwindow.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/mainwindow.cpp @@ -34,7 +34,7 @@ MainWindow::MainWindow(QWidget *parent) ERROR_LOG(m_logger) << "trainingArea size: " << trainingAreas.size(); for (const auto &item : trainingAreas) { - DEBUG_LOG(m_logger) << "ta name: " << item.name << ", id: " << item.m_id; + DEBUG_LOG(m_logger) << "ta name: " << item.name << ", id: " << item.id; m_ui->cbTrainingArea->addItem(item.name, QVariant::fromValue(item)); } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/settings.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/settings.cpp index 390aaf820..5320152ea 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/settings.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/settings.cpp @@ -53,12 +53,12 @@ QMap Settings::trainingAreas() { settings->setArrayIndex(i); TrainingArea ta; - ta.m_id = settings->value(QStringLiteral("id")).toInt(); + ta.id = settings->value(QStringLiteral("id")).toInt(); ta.name = settings->value(QStringLiteral("name")).toString(); ta.bottomLeft = settings->value(QStringLiteral("bottomLeftMgrs")).toString(); ta.width = settings->value(QStringLiteral("width"), 1000).toInt(); ta.height = settings->value(QStringLiteral("height"), 1000).toInt(); - map.insert(ta.m_id, ta); + map.insert(ta.id, ta); } settings->endArray(); } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/worker.cpp b/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/worker.cpp index 1948d647d..29526a11b 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/worker.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Tools/WlsRandomPositions/worker.cpp @@ -40,7 +40,7 @@ Worker::Worker(QObject *parent) m_tcpClient = new QTcpSocket(this); connect(m_tcpClient, &QTcpSocket::connected, this, &Worker::onTcpConnected); - connect(m_tcpClient, QOverload::of(&QTcpSocket::error), this, &Worker::error); + connect(m_tcpClient, &QAbstractSocket::errorOccurred, this, &Worker::error); connect(m_tcpClient, &QTcpSocket::disconnected, this, &Worker::onTcpDisconnected); } diff --git a/qt6-after/qt6-migrated-legatus/cmake/NGLMacros.cmake b/qt6-after/qt6-migrated-legatus/cmake/NGLMacros.cmake index acf650d5f..c987b8143 100755 --- a/qt6-after/qt6-migrated-legatus/cmake/NGLMacros.cmake +++ b/qt6-after/qt6-migrated-legatus/cmake/NGLMacros.cmake @@ -550,14 +550,14 @@ MACRO(ADD_INTERFACE_LIBRARY name_ header_ inc_path_) ENDMACRO() -macro(NGL_COMPILE_RESOURCES output_qrc_objects) - +macro(NGL_COMPILE_RESOURCES output_qrc_objects) + # Qt6 path: use qt6_add_resources if(TARGET Qt6::Core) qt6_add_resources(${output_qrc_objects} ${ARGN}) - return() - endif() - + # Note: Removed return() as it exits the calling CMakeLists.txt file + else() + get_property(ipo_active VARIABLE PROPERTY CMAKE_INTERPROCEDURAL_OPTIMIZATION) if(CMAKE_VERSION VERSION_GREATER 3.8.99 AND Qt6Core_VERSION VERSION_GREATER 5.12.99 AND NOT WIN32 AND NOT ipo_active) set(_QT5_INTERNAL_SCOPE ON) @@ -604,6 +604,7 @@ macro(NGL_COMPILE_RESOURCES output_qrc_objects) QT5_ADD_RESOURCES(${output_qrc_objects} ${ARGN}) endif() + endif() endmacro() diff --git a/qt6-after/qt6-migrated-legatus/include/LtsProjectionWorkstation/ltsprojectionworkstation_export.h b/qt6-after/qt6-migrated-legatus/include/LtsProjectionWorkstation/ltsprojectionworkstation_export.h index fec64b2b0..38d1a7e9b 100644 --- a/qt6-after/qt6-migrated-legatus/include/LtsProjectionWorkstation/ltsprojectionworkstation_export.h +++ b/qt6-after/qt6-migrated-legatus/include/LtsProjectionWorkstation/ltsprojectionworkstation_export.h @@ -1,12 +1,26 @@ #pragma once // Stub export header for LtsProjectionWorkstation -// Created for Qt6 migration with BUILD_RTI=OFF +// (the real header is generated by CMake via GENERATE_EXPORT_HEADER when the +// library is built; this stub covers non-RTI builds and is found first on the +// -I line because the source include/ dir precedes the build tree) #ifndef LTSPROJECTIONWORKSTATION_EXPORT_H #define LTSPROJECTIONWORKSTATION_EXPORT_H -#define LTSPROJECTIONWORKSTATION_EXPORT +// Must expand to a default-visibility attribute, NOT to empty: the build sets +// CMAKE_CXX_VISIBILITY_PRESET=hidden, and this stub is found before the +// CMake-generated header (the source include/ dir precedes the build tree on +// the -I line). With an empty macro the LtsProjectionWorkstation class symbols +// would be hidden and consumers (e.g. OperatorApplication) fail to link +// libLtsProjectionWorkstation.so. +// If the library is not built, the attribute is harmless: it only changes +// visibility, not symbol resolution. +#if defined(_MSC_VER) +# define LTSPROJECTIONWORKSTATION_EXPORT __declspec(dllexport) +#else +# define LTSPROJECTIONWORKSTATION_EXPORT __attribute__((visibility("default"))) +#endif #define LTSPROJECTIONWORKSTATION_NO_EXPORT #endif // LTSPROJECTIONWORKSTATION_EXPORT_H \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/include/LtsSession/ltssession_export.h b/qt6-after/qt6-migrated-legatus/include/LtsSession/ltssession_export.h index 848ec8d51..46e11c1dd 100644 --- a/qt6-after/qt6-migrated-legatus/include/LtsSession/ltssession_export.h +++ b/qt6-after/qt6-migrated-legatus/include/LtsSession/ltssession_export.h @@ -5,7 +5,18 @@ // This file is generated by CMake when building with RTI // For non-RTI builds, we provide this stub -#define LTSSESSION_EXPORT +// Must expand to a default-visibility attribute, NOT to empty: the build sets +// CMAKE_CXX_VISIBILITY_PRESET=hidden, and this stub is found before the +// CMake-generated header (the source include/ dir precedes the build tree on +// the -I line). With an empty macro the LtsSession class symbols would be +// hidden and consumers (e.g. LtsFileDialog) fail to link libLtsSession.so. +// If the library is not built, the attribute is harmless: it only changes +// visibility, not symbol resolution. +#if defined(_MSC_VER) +# define LTSSESSION_EXPORT __declspec(dllexport) +#else +# define LTSSESSION_EXPORT __attribute__((visibility("default"))) +#endif #define LTSSESSION_NO_EXPORT #endif // LTSSESSION_EXPORT_H \ No newline at end of file diff --git a/qt6-after/qt6-migrated-legatus/include/LtsUtilsGuiDds/ltsutilsguidds_export.h b/qt6-after/qt6-migrated-legatus/include/LtsUtilsGuiDds/ltsutilsguidds_export.h index 0e90bd5b4..33d85606c 100644 --- a/qt6-after/qt6-migrated-legatus/include/LtsUtilsGuiDds/ltsutilsguidds_export.h +++ b/qt6-after/qt6-migrated-legatus/include/LtsUtilsGuiDds/ltsutilsguidds_export.h @@ -7,7 +7,18 @@ // When BUILD_RTI is OFF, this library is not built // Stub header allows compilation of dependent code -#define LTSUTILSGUIDDS_EXPORT +// Must expand to a default-visibility attribute, NOT to empty: the build sets +// CMAKE_CXX_VISIBILITY_PRESET=hidden, and this stub is found before the +// CMake-generated header (the source include/ dir precedes the build tree on +// the -I line). With an empty macro every RequestHelper/pixmap symbol would be +// hidden and consumers (e.g. LtsSession) fail to link libLtsUtilsGuiDds.so. +// If the library is not built, the attribute is harmless: it only changes +// visibility, not symbol resolution. +#if defined(_MSC_VER) +# define LTSUTILSGUIDDS_EXPORT __declspec(dllexport) +#else +# define LTSUTILSGUIDDS_EXPORT __attribute__((visibility("default"))) +#endif #define LTSUTILSGUIDDS_NO_EXPORT // dds_vector_to_pixmap.h uses LTSUTILSCORE_EXPORT (from LtsUtilsCore) diff --git a/qt6-after/qt6-migrated-legatus/new_docker_build.sh b/qt6-after/qt6-migrated-legatus/new_docker_build.sh index a4a12eefc..7fd50af5d 100755 --- a/qt6-after/qt6-migrated-legatus/new_docker_build.sh +++ b/qt6-after/qt6-migrated-legatus/new_docker_build.sh @@ -905,7 +905,6 @@ if [[ "${BUILD_ARCGIS}" == "ON" ]]; then advancedSymbologyXML LtsDataView LtsDataViewTest - LtsReportDisplay ) else GROUP5_TARGETS=( @@ -917,7 +916,6 @@ if [[ "${BUILD_ARCGIS}" == "ON" ]]; then LtsDataViewTest LtsFileDialog LtsFileDialogTest - LtsReportDisplay ) fi else @@ -929,7 +927,6 @@ else advancedSymbologyXML LtsDataView LtsDataViewTest - LtsReportDisplay ) else GROUP5_TARGETS=( @@ -940,11 +937,17 @@ else LtsDataViewTest LtsFileDialog LtsFileDialogTest - LtsReportDisplay ) fi fi +# LtsReportDisplay only exists when BUILD_CODIFICATION=ON (the module +# RETURN()s otherwise); requesting the target unconditionally aborts make +# with "No rule to make target" +if [[ "${BUILD_CODIFICATION}" == "ON" ]]; then + GROUP5_TARGETS+=("LtsReportDisplay") +fi + # Group 6: LTS Tools (Qt6 migration targets) # These tools require RTI DDS for DataSampleGenerator, DataSampleReceiver, and DdsView GROUP6_TARGETS=( @@ -964,7 +967,7 @@ GROUP6_TARGETS=( # Group 7: LTS Tools A,B,C,E,I directories (Qt6 migration targets) GROUP7_TARGETS=( AdlerWebSocketSimulator - AsmWorkstationCertifier + # AsmWorkstationCertifier - requires botan2 (not available in prebuilt image); target not generated CnrProxyTester ConfigX EEMFakeServer @@ -975,8 +978,8 @@ GROUP7_TARGETS=( GROUP8_TARGETS=( ParticipantDataGenerator ProjectSettingsEditor - QLedLine - QLedMatrix + qledline + qledmatrix ) # Group 9: LTS Tools R,S,T,V,W directories (Qt6 migration targets) @@ -985,14 +988,16 @@ GROUP9_TARGETS=( ScreenIdShow SerialToTcpConverter Splash - SqlBrowser - TextEditorTest - Times - TopicDiscover - TrajectoryWidget - VapixConfig - VideoImport - WlsRandomPositions + sqlbrowser + textEditorTest + ctime + stime + topicdiscover + topicdiscoverexe + # TrajectoryWidget - standalone sub-project (own project()/find_package), not part of the main build + vapixconfig + # VideoImport - subdir commented out in Lts/Tools/CMakeLists.txt + wlsRandomPositions ) # Group 10: LTS Projects (Qt6 migration targets) @@ -1011,7 +1016,7 @@ GROUP10_TARGETS=( # Group 11: LTS Application (Qt6 migration targets) GROUP11_TARGETS=( OperatorApplication - thp_viewer + # thp_viewer - Lts/Application/THP subdir commented out (VLC dependency unavailable) aarApp )