Files
qt5-legatus-legacy/Lts/Plugins/AreaEffectSimulation/Gui/Base/aes_itemlist.h
T
2026-08-13 18:33:10 +02:00

112 lines
3.7 KiB
C++
Executable File

/**
* @RDE_HEADER@
* AreaEffectSimulation - Contamination Overview Dialog
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-07-07
*/
#pragma once
#include "aes_base_exports.h"
#include <LtsWidgets/lts_dialog.h>
#include <AreaEffectSimulation/aes_ftc.h>
#include <AreaEffectSimulation/aes_dtc.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <AreaEffectSimulation/logger.h>
namespace Ui
{
class AesItemList;
}
namespace LtsSession
{
class LtsSession;
}
class QAbstractItemModel;
namespace LtsDataView
{
class AbstractDisplayWidget;
}
namespace AreaEffectSimulation
{
class AesItemSortFilterProxyModel;
template<typename T>
class AesItemSortFilterProxyModelTmpl;
class AESBASEGUI_EXPORT AesItemList : public LtsWidgets::LtsDialog
, protected AreaEffectSimulation::Interface::Ftc::MineResetReplyHandler
, protected AreaEffectSimulation::Interface::Ftc::ExplosionClusterReleaseReceivedReplyHandler
, protected AreaEffectSimulation::Interface::Ftc::AcknowledgeExternalAesItemReplyHandler
, protected AreaEffectSimulation::Interface::Ftc::SetAesItemEffectorStateReplyHandler
{
Q_OBJECT
public:
explicit AesItemList(const QString &menuGroup, QWidget *parent = nullptr);
~AesItemList();
virtual bool init(LtsSession::LtsSession *session);
bool isShowExpired() const { return m_showExpired; }
void onMineResetReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
void onExplosionClusterReleaseReceivedReply (const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
void onSetAesItemEffectorStateReply (const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
void onAcknowledgeExternalAesItemReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
public slots:
void setShowExpired(bool show);
protected slots:
void enaDisa();
virtual void onPrint();
virtual void onAddAesItem() = 0;
virtual void onEditAesItem() = 0;
virtual void onRemoveAesItem() = 0;
virtual void onHandleAdler();
void onAdlerBtn();
void onCenterAesItem();
void hideColumn(int col);
void showColumn(int col);
protected:
virtual void createModel() = 0;
virtual AesItemSortFilterProxyModel *model() = 0;
virtual const AesItemSortFilterProxyModel *model() const = 0;
int currentRow() const; // the currently selected row (not current index!)
void setDataViewModel(QAbstractItemModel *model, const std::function<LtsDataView::AbstractDisplayWidget*()> &customDisplayWidgetCreator);
void setDataViewModel(QAbstractItemModel *model);
void setSortIndicator(int col);
void translateBase(const QString &windowTitle);
void tableColumnOrganiserSetting() override;
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_ftc;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtc;
QString m_menuGroup;
LtsUtils::RequestHelper *m_requestHelper;
bool m_showExpired;
bool m_bHasAddEditOperatorRights;
bool m_bHasAddAdlerOperatorRights;
LtsSession::LtsSession *m_session;
Ui::AesItemList *m_ui;
QMetaObject::Connection m_doubleClickConnection;
LOGGER_T m_logger;
};
template <typename T>
class AesItemListTmpl : public AesItemList
{
public:
using AesItemList::AesItemList;
protected:
AesItemSortFilterProxyModel *model() override { return m_model; }
const AesItemSortFilterProxyModel *model() const override { return m_model; }
AesItemSortFilterProxyModelTmpl<T> *m_model = nullptr;
};
}