Files
qt5-legatus-legacy/Lts/Plugins/ParticipantManagement/Gui/ParticipantTemplates/participant_template_edit.h
T
2026-08-13 18:33:10 +02:00

117 lines
3.4 KiB
C++
Executable File

/**
* @RDE_HEADER@
* HMI Plugin for ParticipantManagement - Template Edit Dialog
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-10-05
*/
#pragma once
#include <ParticipantManagement/Gui/Common/participant_template_edit_model.h>
#include <ParticipantManagement/logger.h>
#include <Services/ParticipantManagement/ppm_dtc.h>
#include <Services/ParticipantManagement/ppm_ftc.h>
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <LtsWidgets/lts_dialog.h>
#include <LtsSession/lts_session.h>
class NGLTreeItem;
class QItemSelection;
namespace Ui
{
class ParticipantTemplateEdit;
}
namespace ParticipantManagement
{
class FiringUnitValidator;
//----------------------------------------------------------------------------
class ParticipantTemplateEdit : public LtsWidgets::LtsDialog
, protected ParticipantManagement::Interface::Ftc::ModifyTemplateDataReplyHandler
{
Q_OBJECT
public:
ParticipantTemplateEdit(LtsSession::LtsSession *session,
int rootId,
bool asSupportService,
QWidget *parent = nullptr);
virtual ~ParticipantTemplateEdit();
bool init(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc,
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ftc,
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc,
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc);
void onModifyTemplateDataReply(const Core::FunctionReplyObject &replyObject) override final;
public Q_SLOTS:
bool apply() override final;
private:
void retranslate() override;
QModelIndex selectedIndexView() const;
bool isContainer(const QModelIndex &index);
void enaDisa(); // enable/disable the widgets
void removeCurrentRow();
signals:
void signalTeTemplateInserted();
void signalAccept();
void usedEquipmentNumbersChanged(const QSet<int> &usedEquipmentNumbers);
protected slots:
void onAddItem();
void onEditItem();
void onRemoveItem();
void onPrint();
void onInsertTemplate();
void onAddTemplateToModel(int templateId);
void onSaveAsNewTemplate();
void onAddItemToModel(const QModelIndex &parent, const TemplateData &templateData);
void onModifyItemInModel(const QModelIndex &index, const TemplateData &editData);
void onDoubleClicked(const QModelIndex &selIndex);
void onSelectionChanged(const QItemSelection & /*selected*/,
const QItemSelection & /*deselected*/);
void slotCustomContextMenuRequested(const QPoint &position);
private:
int m_rootId;
bool m_asSupportService;
bool m_bNeedCommitModifedData;
ParticipantTemplateEditModel *m_model;
QAction *m_actionInsertTemplate;
QAction *m_actionSaveAsNewTemplate;
QAction *m_actionRemove;
QAction *m_actionEdit;
LtsUtils::RequestHelper *m_requestHelper;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ftc;
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asbIfc;
LtsSession::LtsSession *m_session;
FiringUnitValidator *m_firingUnitValidator { nullptr };
Ui::ParticipantTemplateEdit *m_ui;
NGL::INGLLogger &m_logger;
};
} //ParticipantManagement