92 lines
3.9 KiB
C++
Executable File
92 lines
3.9 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Handler for ParticipantData
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Norbert Thoden, NLE, 2020-06-29
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <TargetManagement/logger.h>
|
|
|
|
// Get targets
|
|
#include <TargetManagement/tgt_dtc.h>
|
|
|
|
// Get Participants
|
|
#include <ParticipantManagement/ppm_dtc.h>
|
|
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
|
|
|
#include <LtsWidgets/lts_abstract_table_model.h>
|
|
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
|
#include <LtsSession/lts_session.h>
|
|
|
|
namespace TargetManagement
|
|
{
|
|
|
|
// --------------------------------------------------------
|
|
// ParticipantHandler
|
|
// --------------------------------------------------------
|
|
class ParticipantHandler final : public QObject // public LtsWidgets::LtsAbstractTableModel<class T>
|
|
{
|
|
Q_OBJECT
|
|
// using BaseClass = LtsWidgets::LtsAbstractTableModel<T>;
|
|
using BaseClass = QObject;
|
|
|
|
public:
|
|
explicit ParticipantHandler(QObject *parent = nullptr);
|
|
|
|
bool init(const std::shared_ptr<TargetManagement::Interface::Dtc> &tgt_dtc,
|
|
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
|
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc);
|
|
|
|
int getParticipantIdToTargetId(int participantId) const;
|
|
|
|
const QHash <int, QString> &getParticipantHierarchies() const { return m_participantHierarchies; }
|
|
QString getParticipantHierarchie(int participantId) const;
|
|
|
|
const QHash <int, QPixmap> &getParticipantDecorations() const { return m_participantDecorations; }
|
|
QPixmap getParticipantDecoration(int participantId) const { return m_participantDecorations.value(participantId); }
|
|
|
|
QHash <int, int> 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<TargetManagement::Interface::Dtc> m_tgt_dtc;
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppm_dtc;
|
|
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
|
|
|
|
QHash <int, int > m_participantIdToTargetId; // key = (target)participantId, value = id of target
|
|
QHash <int, QString> m_participantHierarchies; // key = participantId, value = HierarchyString
|
|
QHash <int, QPixmap> m_participantDecorations;
|
|
QHash <int, int > m_participantIdToEq; // key = participantId, value = EquipmentNumber
|
|
QHash <int, ParticipantManagement::TypeClass> m_typeToTypeClass; // key = ParticipantType, value = TypeClass
|
|
QHash <int, ParticipantManagement::WmsTypeClass> 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
|