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

121 lines
4.4 KiB
C++
Executable File

/**
* @RDE_HEADER@
* GUI Plugin for ParticipantManagement - Participant Combat Power Dialog
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2017-04-07
*/
#pragma once
#include "participant_org_chart.h"
#include "org_chart_main_helper.h"
#include <ParticipantManagement/logger.h>
#include <Services/ParticipantManagement/ppm_dtc.h>
#include <Services/ParticipantManagement/ppm_ftc.h>
#include <Plugins/AdvancedSymbology/asb_data_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_participant_info_gui_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_participants_gui_plugin_interface.h>
#include <LtsWidgets/lts_dialog.h>
#include <LtsSession/lts_session.h>
#include <LtsSession/lts_session_lock_handler.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <QPointer>
namespace Ui
{
class OrgChartMain;
}
namespace ParticipantManagement
{
//----------------------------------------------------------------------------
class OrgChartMain : public LtsWidgets::LtsDialog
, protected ParticipantManagement::Interface::Ftc::ModifyParticipantDataReplyHandler
, protected ParticipantManagement::Interface::Ftc::ModifyTemplateDataReplyHandler
{
Q_OBJECT
public:
explicit OrgChartMain(LtsSession::LtsSession *session
, QWidget *parent = nullptr);
~OrgChartMain();
bool init(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc
, const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ftc
, const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc
, const std::shared_ptr<ForeignGuiComboboxInterface> &ppmGuiCbxIfc
, const std::shared_ptr<ForeignParticipantInfoGuiInterface> &ppmGuiInfoIfc
, bool useSymData = true
, bool asSupportService = false
, int templateId = -1);
void initTopicLockHandler();
void onModifyParticipantDataReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
void onModifyTemplateDataReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
bool loadTemplate(int templateRootId, bool isSupport = false);
private:
void retranslate() override;
bool initButtons();
QByteArray getMimeData(const Type &type, const QImage &image);
QVector<ParticipantData> getDataOf(const QJsonObject &obj, int superiorModId, int hierarchyNr);
QVector<TemplateData> getTemplateDataOf(const QJsonObject &obj, int superiorModId, int hierarchyNr);
bool apply() override;
ParticipantData convertFromJson(const QJsonObject &obj);
TemplateData fromParticipantData(const ParticipantData &data);
void fillComboBoxes();
void updateButtonMimeData();
QColor currentPartyColor();
AdvancedSymbology::Role currentPartyRole();
private slots:
void onPartyChanged();
void onOpenInfo(int id);
void onEdit(const QString &data);
void onDelete(const QString &data);
void onUpdateItem(const QModelIndex &parent, const ParticipantData &editData);
void onNewHierarchy(const QString &data);
void onReload();
void onUpdateParticipant(const Participant &data, DataModification modType);
void onLockDataChanged();
private:
ParticipantManagement::LtsParticipantsOrgChart *m_orgChart;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ftc;
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asbIfc;
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
std::shared_ptr<ParticipantManagement::ForeignParticipantInfoGuiInterface> m_ppmGuiInfoIfc;
LtsUtils::RequestHelper *m_requestHelper;
LtsSession::LtsSession *m_session;
QVector<ParticipantData> m_participantsToDelete;
QVector<TemplateData> m_templateParticipantsToDelete;
QMap<LtsWidgets::LtsDragIcon *, std::tuple<QString, AdvancedSymbology::SymbolResultWatcher *>> m_buttonMap;
QMap<QPointer<LtsWidgets::LtsDragIcon>, QPointer<OrgChartMain_MimeDataHelper>> m_templateMimeDataHelpers;
// global TopicLockHandler does not exists, create our own:
LtsSession::TopicLockHanderData m_topicLockHanderData;
bool m_useSymData;
bool m_asSupportService;
bool m_isTemplate;
int m_rootTemplateId;
int m_party;
Ui::OrgChartMain *m_ui;
NGL::INGLLogger &m_logger;
};
} //ParticipantManagement