120 lines
3.8 KiB
C++
Executable File
120 lines
3.8 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* GUI Plugin for ParticipantManagement - Participant Organisaton
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Patric Karwat, SLSE, 2016-10-17
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <Plugins/ParticipantManagement/Gui/Common/participant_edit_model.h>
|
|
|
|
#include "participant_pool_model.h"
|
|
#include "participant_orga_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 <Plugins/ParticipantManagement/ppm_templates_gui_plugin_interface.h>
|
|
|
|
#include <LtsWidgets/lts_dialog.h>
|
|
#include <LtsSession/lts_session.h>
|
|
#include <LtsUtilsGuiDds/request_helper.h>
|
|
|
|
#include <QItemDelegate>
|
|
|
|
class QSortFilterProxyModel;
|
|
|
|
namespace Ui
|
|
{
|
|
class ParticipantOrganisation;
|
|
}
|
|
|
|
namespace ParticipantManagement
|
|
{
|
|
|
|
|
|
class DeleteDelegate : public QItemDelegate
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DeleteDelegate(QObject *parent = nullptr);
|
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
|
|
|
|
Q_SIGNALS:
|
|
void removePoolParty();
|
|
|
|
};
|
|
|
|
//----------------------------------------------------------------------------
|
|
class ParticipantOrganisationDialog : public LtsWidgets::LtsDialog,
|
|
protected ParticipantManagement::Interface::Ftc::ModifyParticipantDataReplyHandler
|
|
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
ParticipantOrganisationDialog(LtsSession::LtsSession *session,
|
|
bool asSupportService,
|
|
QWidget *parent = nullptr);
|
|
~ParticipantOrganisationDialog();
|
|
bool init(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc,
|
|
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ftc,
|
|
const std::shared_ptr<ParticipantManagement::ForeignGuiTemplatesInterface> &ppmGuiTemplateIfc,
|
|
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc,
|
|
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc);
|
|
|
|
void onModifyParticipantDataReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
|
|
|
|
void retranslate() override;
|
|
void lock() override;
|
|
void unlock() override;
|
|
|
|
private:
|
|
QModelIndex selectedIndexView() const;
|
|
bool saveParticipantData(const ModifyParticipantDataRequest &request);
|
|
|
|
protected Q_SLOTS:
|
|
void onPoolParticipantsChanged(const QVector<ParticipantData> &participants, const QString &originatorMimeType);
|
|
void onPartyParticipantsChanged(int addedParticipantId);
|
|
void onAttachedParticipantsChanged(int addedParticipantId);
|
|
void onDetachedParticipantsChanged(int addedParticipantId);
|
|
void onCooperateParticipantsChanged(int addedParticipantId);
|
|
void onStartTemplateUnitNamer(int templateId);
|
|
void onPartyChanged();
|
|
void onRemovePoolParty();
|
|
void showContextMenu(const QPoint &position);
|
|
|
|
private:
|
|
bool m_asSupportService;
|
|
ParticipantPoolModel *m_poolModel;
|
|
QSortFilterProxyModel *m_proxyModel;
|
|
ParticipantOrgaModel *m_partyModel;
|
|
ParticipantOrgaModel *m_attachedModel;
|
|
ParticipantOrgaModel *m_detachedModel;
|
|
ParticipantOrgaModel *m_cooperateModel;
|
|
DeleteDelegate *m_delegate;
|
|
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
|
|
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ftc;
|
|
std::shared_ptr<ParticipantManagement::ForeignGuiTemplatesInterface> m_ppmGuiTemplateIfc;
|
|
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
|
|
LtsSession::LtsSession *m_session;
|
|
LtsUtils::RequestHelper *m_requestHelper;
|
|
static int s_preselectedParty;
|
|
|
|
Ui::ParticipantOrganisation *m_ui;
|
|
NGL::INGLLogger &m_logger;
|
|
};
|
|
|
|
|
|
|
|
} //ParticipantManagement
|