73 lines
2.1 KiB
C++
Executable File
73 lines
2.1 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* HMI Plugin for ParticipantManagement - Template Model
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Patric Karwat, SLSE, 2016-10.05
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <ParticipantManagement/ppm_dtc.h>
|
|
#include <ParticipantManagement/logger.h>
|
|
|
|
#include <LtsWidgets/lts_abstract_table_model.h>
|
|
#include <Plugins/AdvancedSymbology/Helper/table_model_symbol_renderer.h>
|
|
|
|
namespace LtsSession
|
|
{
|
|
class LtsSessionDataDds;
|
|
}
|
|
|
|
namespace ParticipantManagement
|
|
{
|
|
// --------------------------------------------------------
|
|
// ParticipantTemplateChooserModel
|
|
// --------------------------------------------------------
|
|
class ParticipantTemplateChooserModel final : public LtsWidgets::LtsAbstractTableModel<ParticipantManagement::TemplateParticipant>
|
|
, public AdvancedSymbology::TableModelSymbolRenderer<ParticipantTemplateChooserModel>
|
|
{
|
|
Q_OBJECT
|
|
friend class AdvancedSymbology::TableModelSymbolRenderer<ParticipantTemplateChooserModel>;
|
|
public:
|
|
enum Columns
|
|
{
|
|
ColDesignatorIdentifier,
|
|
ColTypeClass,
|
|
ColType
|
|
};
|
|
|
|
explicit ParticipantTemplateChooserModel(bool asSupportService, QObject *parent = nullptr);
|
|
~ParticipantTemplateChooserModel();
|
|
|
|
bool initModel(LtsSession::LtsSessionDataDds *session,
|
|
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc);
|
|
|
|
QVariant data(const QModelIndex &, int) const override final;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
QMimeData *mimeData(const QModelIndexList &indexes) const override;
|
|
QStringList mimeTypes() const override;
|
|
Qt::DropActions supportedDragActions() const override { return Qt::CopyAction; }
|
|
|
|
protected:
|
|
int getId(const TemplateParticipant &data) const override
|
|
{
|
|
return data.templateId();
|
|
}
|
|
|
|
private slots:
|
|
void onTemplateChanged(const ParticipantManagement::TemplateParticipant &data,
|
|
DataModification modType);
|
|
|
|
private:
|
|
bool isFiltered(const TemplateParticipant &data, DataModification modType) const override;
|
|
|
|
bool m_asSupportService;
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
|
|
|
|
LOGGER_T m_logger;
|
|
};
|
|
} //namespace ParticipantManagement
|