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

76 lines
2.3 KiB
C++
Executable File

/**
* @RDE_HEADER@
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Last, SLSE, 2017-11-10
*/
#pragma once
#include <memory>
#include <LtsDataView/lts_data_view.h>
#include <Plugins/ParticipantManagement/Gui/Common/ppmcommon_export.h>
#include <ParticipantManagement/ppm_dtc.h>
#include <ParticipantManagement/ppm_ftc.h>
#include <LtsUtilsGuiDds/request_helper.h>
namespace ParticipantManagement
{
class ParticipantEditModel;
class ParticipantTreeFilterProxyModel;
class PPMCOMMON_EXPORT ParticipantTreeEditHandler : public QObject, protected ParticipantManagement::Interface::Ftc::ModifyParticipantDataReplyHandler
{
Q_OBJECT
public:
ParticipantTreeEditHandler(LtsDataView::LtsDataView *dataView,
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc,
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ftc,
bool asSupportService,
QObject *parent = nullptr);
void setEditParticipantsAllowed(bool bAllow) { m_editParticipantsAllowed = bAllow; }
QModelIndex selectedIndexView() const;
bool isSelectedIndexValid() const;
bool isSelectedIndexRemovable() const;
bool isContainer() const;
QVector<int> usedEquipmentNumbers() const;
ParticipantManagement::ParticipantData getSelectedData() const;
void beautifyTreeView(bool keepExpanded);
void partyHasChanged(int newPartyId, bool keepExpanded = true);
signals:
void signalChangesMade();
void signalDoubleClicked();
void signalSelectionChanged();
void signalEditParticipant(); // use getSelectedData() to retrieve the current participant data
public slots:
bool onApplyChanges();
void onRemoveItem();
void showContextMenu(const QPoint &position);
private:
void expandNodeChildren(QTreeView *pTreeView, const QModelIndex &index, bool expand);
void removeCurrentRow();
void onModifyParticipantDataReply(const Core::FunctionReplyObject &replyObject) override final;
LtsDataView::LtsDataView *m_dataView;
ParticipantEditModel *m_model;
bool m_asSupportService;
bool m_editParticipantsAllowed;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ftc;
LtsUtils::RequestHelper *m_requestHelper;
};
}