Files
qt5-legatus-legacy/Lts/Plugins/AlarmManagement/Gui/EmergencyCalls/alm_emergency_call_dialog.h
T
2026-08-13 18:33:10 +02:00

117 lines
3.1 KiB
C++
Executable File

/**
* @RDE_HEADER@
* HMI Plugin for AlarmManagement (Interface for access from other Plugins)
* $Id$
* $HeadURL$
* $Author$
* Created by Steve Kemayou, SLSE, 2023-05-26
*/
#pragma once
#include <LtsWidgets/lts_dialog.h>
#include <Services/AlarmManagement/alm_ftc.h>
#include <Services/AlarmManagement/alm_dtc.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <AlarmManagement/logger.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
#include <LtsSession/lts_session_data.h>
#include <LtsSession/lts_session.h>
#include <QWidget>
#include <QDebug>
namespace Ui
{
class EmergencyCallDialog;
}
namespace AlarmManagement
{
/*!
* \brief The UpdateSOSGuard class
*/
class UpdateSOSGuard
{
public:
explicit UpdateSOSGuard(const std::shared_ptr<SituationMap::ForeignGuiInterface> &sitMapGuiIfc)
: m_sitMapGuiIfc(sitMapGuiIfc)
{}
~UpdateSOSGuard()
{
if (m_sitMapGuiIfc)
m_sitMapGuiIfc->showExpiredEmergencyCalls(false);
}
void showExpiredSOS(bool visible)
{
if (m_sitMapGuiIfc)
m_sitMapGuiIfc->showExpiredEmergencyCalls(visible);
}
private:
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
};
class EmergencyCallModel;
class EmergencyCallProxyModel;
class EmergencyCallDialog final : public LtsWidgets::LtsDialog
, AlarmManagement::Interface::Ftc::EmergencyCallAcknowledgeReplyHandler
{
Q_OBJECT
public:
explicit EmergencyCallDialog(QWidget *parent = nullptr);
~EmergencyCallDialog();
bool init(const std::shared_ptr<AlarmManagement::Interface::Ftc> &ftc,
const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
const std::shared_ptr<SituationMap::ForeignGuiInterface> &sitMapGuiIfc,
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
LtsSession::LtsSession *session);
void retranslate() override;
void enaDisa();
AlmEmergencyCall getSelectedSOS();
protected:
void onEmergencyCallAcknowledgeReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
void setAcknowledgeUi();
private slots:
void onEditBtCliked();
void onSetShowExpired(bool show);
void onFindEmergencyOnMap();
void onEmergencyIndexDoubleClicked(const QModelIndex &index);
signals:
void openInfoDlg(int id);
private:
void sendAcknowledgeEmergency(const QString &comment);
void tableColumnOrganiserSetting() override;
private:
EmergencyCallModel *m_model{nullptr};
EmergencyCallProxyModel *m_proxyModel{nullptr};
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
std::shared_ptr<AlarmManagement::Interface::Ftc> m_ftc;
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
LtsSession::LtsSession *m_session;
Ui::EmergencyCallDialog *m_ui;
LtsUtils::RequestHelper *m_requestHelper;
LOGGER_T m_logger;
friend class UpdateSOSGuard;
QSharedPointer<UpdateSOSGuard> m_updateSOSGuard;
};
}// namespace EmergencyCallDialog