Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+105
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for ParticipantManagement - Template Edit Model
|
||||
* $Id: participant_template_edit_model.h 49756 2020-02-04 08:46:35Z ehrlicher $
|
||||
* $HeadURL: svn://192.168.133.21/TDS/branches/product/features/3dws_devel/Lts/Plugins/ParticipantManagement/Gui/ParticipantTemplates/participant_template_edit_model.h $
|
||||
* $Author: ehrlicher $
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
#include <Common/participant_icon_model_base.h>
|
||||
|
||||
namespace AdvancedSymbology
|
||||
{
|
||||
class ForeignDataInterface;
|
||||
class SymbolResult;
|
||||
}
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSessionDataDds;
|
||||
}
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class FiringUnitValidator;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class PPMCOMMON_EXPORT ParticipantTemplateEditModel final : public ParticipantIconModelBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
ColDesignator,
|
||||
ColIdentifier,
|
||||
ColTypeClass,
|
||||
ColType,
|
||||
ColEquipmentNumber,
|
||||
ColTemplateId
|
||||
};
|
||||
|
||||
ParticipantTemplateEditModel(QObject *parent,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc,
|
||||
int rootId);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
int columnCount(const QModelIndex &parent) const override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
bool canDropMimeData(const QMimeData *data,
|
||||
Qt::DropAction action,
|
||||
int row,
|
||||
int column,
|
||||
const QModelIndex &parent) const override;
|
||||
Qt::DropActions supportedDropActions() const override { return Qt::MoveAction; }
|
||||
Qt::DropActions supportedDragActions() const override { return Qt::MoveAction; }
|
||||
|
||||
std::vector<TemplateData> templateData(bool bOnlyModified = true) const;
|
||||
std::vector<TemplateData> templateDataAsCopy(const QModelIndex &idx = QModelIndex()) const;
|
||||
void dataCommitted(); // the modified data returned by getTemplateData() was successfully commited into db
|
||||
|
||||
QSet<int> usedEquipmentNumbers() const;
|
||||
|
||||
TemplateData getTemplateData(const QModelIndex &index) const;
|
||||
|
||||
public slots:
|
||||
bool onInsertRow(const QModelIndex &parent, TemplateData templateData);
|
||||
bool onUpdateRow(const QModelIndex &index, const TemplateData &templateData);
|
||||
bool onDeleteRow(const QModelIndex &idx, bool isFirstItem = true);
|
||||
bool onInsertTemplate(int rootId, const QModelIndex &parentIndex,
|
||||
bool asCopy);
|
||||
|
||||
signals:
|
||||
void internalDataChanged();
|
||||
|
||||
private:
|
||||
std::vector<TemplateData> templateData(const QModelIndex &idx, bool bAsNewTemplate, bool bOnlyModified) const;
|
||||
|
||||
void init();
|
||||
std::vector<TemplateData> getChildrenOf(NGLTreeItem *item,
|
||||
int parentId,
|
||||
int hierarchyNumber,
|
||||
bool bOnlyModified,
|
||||
int &highestModId) const;
|
||||
void insertChildrenOf(int parentId,
|
||||
NGLTreeItem *parent,
|
||||
const QModelIndex &parentIdx,
|
||||
const QHash<int, QSet<int>> &parentId2id,
|
||||
const QHash<int, TemplateData> &tmap);
|
||||
|
||||
NGLTreeItem *createItem(const QVariant &data, const QIcon &icon) const override;
|
||||
QSet<int> usedEquipmentNumbers(NGLTreeItem *item) const;
|
||||
|
||||
private:
|
||||
int m_rootTemplateId;
|
||||
QVector<ParticipantManagement::TemplateData> m_dataToDelete;
|
||||
FiringUnitValidator *m_firingUnitValidator;
|
||||
};
|
||||
|
||||
} //namespace ParticipantManagement
|
||||
Q_DECLARE_METATYPE(ParticipantManagement::TemplateData)
|
||||
|
||||
Reference in new issue
Block a user