/** * @RDE_HEADER@ * Handler for ParticipantData * $Id$ * $HeadURL$ * $Author$ * Created by Norbert Thoden, NLE, 2020-06-29 */ #pragma once #include // Get targets #include // Get Participants #include #include #include #include #include namespace TargetManagement { // -------------------------------------------------------- // ParticipantHandler // -------------------------------------------------------- class ParticipantHandler final : public QObject // public LtsWidgets::LtsAbstractTableModel { Q_OBJECT // using BaseClass = LtsWidgets::LtsAbstractTableModel; using BaseClass = QObject; public: explicit ParticipantHandler(QObject *parent = nullptr); bool init(const std::shared_ptr &tgt_dtc, const std::shared_ptr &ppmDtc, const std::shared_ptr &ppmGuiCbxIfc); int getParticipantIdToTargetId(int participantId) const; const QHash &getParticipantHierarchies() const { return m_participantHierarchies; } QString getParticipantHierarchie(int participantId) const; const QHash &getParticipantDecorations() const { return m_participantDecorations; } QPixmap getParticipantDecoration(int participantId) const { return m_participantDecorations.value(participantId); } QHash getParticipantIdToEquipmentNumber() const { return m_participantIdToEq; } int getParticipantIdToEquipmentNumber(int participantId) const { return m_participantIdToEq.value(participantId, -1); } ParticipantManagement::WmsTypeClass getParticipantIdToWmsTypeClass(int participantId) const { return m_participantIdToWmsTypeClass.value(participantId, ParticipantManagement::WmsTypeClass_def::None); } static QString target_wmsTypeClassToString(const ParticipantManagement::WmsTypeClass &wmsTypeClass); Q_SIGNALS: void signalParticipantNamesChanged(); void signalParticipantChanged(int participantId); private Q_SLOTS: void onShootbackTargetChanged(const TargetManagement::ShootbackTarget &data, const DataModification modType); void onTypeChanged(const ParticipantManagement::Type &data, const DataModification modType); void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType); private: std::shared_ptr m_tgt_dtc; std::shared_ptr m_ppm_dtc; std::shared_ptr m_ppmGuiCbxIfc; QHash m_participantIdToTargetId; // key = (target)participantId, value = id of target QHash m_participantHierarchies; // key = participantId, value = HierarchyString QHash m_participantDecorations; QHash m_participantIdToEq; // key = participantId, value = EquipmentNumber QHash m_typeToTypeClass; // key = ParticipantType, value = TypeClass QHash m_participantIdToWmsTypeClass; // key = participantId, value = WmsTypeClass QIcon m_yes{QLatin1String("icon:yes.svg")}; QIcon m_no{QLatin1String("icon:no.svg")}; LOGGER_T m_logger; }; } //namespace TargetManagement