Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Patric Karwat, SLSE, 2016-10-05
|
||||
#
|
||||
|
||||
SET(alm_config_alarm_gui_SRCS
|
||||
|
||||
alm_config_alarm_gui_plugin.cpp
|
||||
alm_config_alarm_gui_plugin.h
|
||||
alm_dialog.cpp
|
||||
alm_dialog.h
|
||||
alm_history.cpp
|
||||
alm_history.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(alm_config_alarm_gui_SRCS
|
||||
alm_dialog.ui
|
||||
alm_history.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS AlmConfigAlarmGuiPlugin MODULE ${alm_config_alarm_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(AlmConfigAlarmGuiPlugin
|
||||
LtsPrinting
|
||||
AlmCommon
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
LtsUtilsSettings
|
||||
AlmGuiPluginInterface
|
||||
AlmDataPluginInterface
|
||||
svcPdmCommon # pdm_enums.h in alm_dialog.cpp
|
||||
svcPpmCommon
|
||||
GuiPluginInterface
|
||||
Qt5::Widgets
|
||||
LtsCoordTrans
|
||||
LtsWidgets
|
||||
LtsDataView
|
||||
SituationMapGuiPluginInterface
|
||||
NGLLogger
|
||||
LtsUtilsGuiDds
|
||||
LtsAppManager # get sessions to look on which one to open alarm history
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(AlmConfigAlarmGuiPlugin)
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for AlarmManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "alm_config_alarm_gui_plugin.h"
|
||||
#include "alm_dialog.h"
|
||||
#include "alm_history.h"
|
||||
#include <Services/AlarmManagement/alm_operator_rights.h>
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <LtsAppManager/lts_app_manager.h>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, getLogger("InterfaceImpl"))
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_aesDtc(nullptr)
|
||||
, m_alarmHistoryModel(nullptr)
|
||||
, m_alarmHistoryDialogIdentifier(QStringLiteral("almAlarmHistory"))
|
||||
, m_alarmHistoryDialogLayoutArea(LtsWidgets::LayoutArea::eInfoTab)
|
||||
{
|
||||
}
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
if (!m_session->getDtc<AlarmManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!m_session->getFtc<AlarmManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
||||
return false;
|
||||
if (!m_session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_ppmDtc = nullptr;
|
||||
m_aesDtc = nullptr;
|
||||
m_ftc = nullptr;
|
||||
m_dtc = nullptr;
|
||||
}
|
||||
|
||||
void InterfaceImpl::showEmergencyMessage(const AlarmManagement::Notification &data)
|
||||
{
|
||||
if (data.eventType() != ProjectDataManagement::EventType_def::EmergencyCall)
|
||||
return;
|
||||
|
||||
const int issi = data.equipmentNumber();
|
||||
const QString &positionStr = LtsCoordTrans::mgrsFromGeographic(data.position().lon(), data.position().lat());
|
||||
|
||||
// text html formatieren und zur Anzeige bringen
|
||||
/* non-blocking! */ new LtsWidgets::LtsMessageDialogNew(m_session->baseLayout(),
|
||||
tr("ISSI: %1 --- Position: %2\n").arg(issi).arg(positionStr),
|
||||
tr("!!!!!! Emergency Call --- %1 !!!!!").arg(DTG::toStringMSec(data.time())));
|
||||
}
|
||||
|
||||
void InterfaceImpl::showAlarm(const AlarmManagement::Notification &data)
|
||||
{
|
||||
showEmergencyMessage(data);
|
||||
|
||||
if (data.operatorId() == LtsSessionData::LtsSessionData::getInstance()->getOperatorId() ||
|
||||
data.operatorId() == 0) // All Operators
|
||||
{
|
||||
bool bWidgetExists = m_session->widgetExists(menuGroup(), m_alarmHistoryDialogIdentifier, m_alarmHistoryDialogLayoutArea);
|
||||
if (!bWidgetExists)
|
||||
m_session->addWidget(onShowHistoryAlarmDialog(), menuGroup(), m_alarmHistoryDialogIdentifier, m_alarmHistoryDialogLayoutArea);
|
||||
}
|
||||
}
|
||||
|
||||
void InterfaceImpl::onNotificationChanged(const AlarmManagement::Notification &data, const DataModification &mod)
|
||||
{
|
||||
if (mod != DataModification::eAdded)
|
||||
return;
|
||||
|
||||
INFO_LOG(m_logger) << "ALARM! data.operatorId(): " << data.operatorId()
|
||||
<< "currentOperatorId: " << LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
|
||||
|
||||
// do I have the dialog already open? Show Message and return:
|
||||
if (m_session->widgetExists(menuGroup(), m_alarmHistoryDialogIdentifier, m_alarmHistoryDialogLayoutArea))
|
||||
{
|
||||
showEmergencyMessage(data);
|
||||
return;
|
||||
}
|
||||
|
||||
// does someone else have the dialog open? or is there a main screen session (not me) that could show the message & dialog? return
|
||||
if (LtsAppManager::LtsAppManager::getInstance()->otherSessionsResponsibility(
|
||||
m_session, {LtsAppDescriptor::App::Situation}, {IDL::PartitionType::Exercise},
|
||||
menuGroup(), m_alarmHistoryDialogIdentifier, m_alarmHistoryDialogLayoutArea))
|
||||
return;
|
||||
|
||||
// so nobody else has the dialog open - so I must be on the main screen OR nobody else already have the dialog open - Show Message & Dialog and return
|
||||
showAlarm(data);
|
||||
}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
|
||||
if (!m_alarmHistoryModel)
|
||||
{
|
||||
m_alarmHistoryModel = new AlarmManagement::AlarmHistoryModel(this);
|
||||
m_alarmHistoryModel->initModel(m_dtc, m_ppmDtc, m_aesDtc);
|
||||
}
|
||||
|
||||
// Action 'ConfigAlarm' anlegen
|
||||
plData.menuText = tr("Configure Global Alarms");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:config_global_alarms.svg"));
|
||||
plData.identifier = QLatin1String("almAlarmConfig");
|
||||
plData.operatorRight = OperatorRights::ConfigGlobalDialog;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new AlarmDialog(parent),
|
||||
m_ftc, m_dtc, m_ppmDtc, m_alarmHistoryModel);
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
// Action 'AlarmHistory' anlegen
|
||||
plData.menuText = tr("Alarm History");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:global_alarms_history.svg"));
|
||||
plData.identifier = QLatin1String("almAlarmHistory");
|
||||
plData.operatorRight = OperatorRights::ConfigGlobalDialog;
|
||||
plData.layoutArea = m_alarmHistoryDialogLayoutArea;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget *)
|
||||
{
|
||||
return onShowHistoryAlarmDialog();
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
connect(m_dtc.get(), &AlarmManagement::Interface::Dtc::notificationChanged,
|
||||
this, &InterfaceImpl::onNotificationChanged);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowHistoryAlarmDialog()
|
||||
{
|
||||
return LtsWidgets::initDialog(new AlarmView(m_session),
|
||||
m_dtc, m_alarmHistoryModel);
|
||||
}
|
||||
|
||||
|
||||
} // namespace AlarmManagement
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for AlarmManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AlarmManagement/logger.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/AlarmManagement/alm_gui_plugin_interface.h>
|
||||
#include <Plugins/AlarmManagement/alm_data_plugin_interface.h>
|
||||
#include <Plugins/AlarmManagement/Gui/Common/alm_config_alarm_model.h>
|
||||
#include <Plugins/AlarmManagement/Gui/Common/alm_history_alarm_model.h>
|
||||
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:alm.configalarm")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
//QString pluginName() override { return ForeignGuiInterface::pluginName(); }
|
||||
QString pluginName() override { return QLatin1String("AlarmManagement.GuiPlugin.ConfigAlarm"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise;
|
||||
}
|
||||
};
|
||||
|
||||
class InterfaceImpl final
|
||||
: public QObject
|
||||
, public GuiPluginBase::Interface
|
||||
, public ForeignGuiInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
QString menuGroup() const override { return tr("Alarm Management"); }
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowHistoryAlarmDialog();
|
||||
void showEmergencyMessage(const AlarmManagement::Notification &data);
|
||||
void showAlarm(const AlarmManagement::Notification &data);
|
||||
|
||||
private:
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
AlarmHistoryModel *m_alarmHistoryModel;
|
||||
QString m_alarmHistoryDialogIdentifier;
|
||||
LtsWidgets::LayoutArea m_alarmHistoryDialogLayoutArea;
|
||||
|
||||
private slots:
|
||||
void onNotificationChanged(const AlarmManagement::Notification &data, const DataModification &mod);
|
||||
};
|
||||
|
||||
} // namespace AlarmManagement
|
||||
+317
@@ -0,0 +1,317 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Beschreibung des Dialogs
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, SLSE, 2017-11-01
|
||||
*/
|
||||
|
||||
#include "alm_dialog.h"
|
||||
#include "ui_alm_dialog.h"
|
||||
#include "alm_history.h"
|
||||
#include <Plugins/AlarmManagement/Gui/Common/alm_config_alarm_model.h>
|
||||
#include <Plugins/AlarmManagement/Gui/Common/alm_history_alarm_model.h>
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <ProjectDataManagement/pdm_enums.hpp>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
|
||||
AlarmDialog::AlarmDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_configAlarmModel(nullptr)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_ui(new Ui::AlarmDialog)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_operatorId(-1)
|
||||
, m_logger(getLogger("AlarmDialog"))
|
||||
{
|
||||
AlarmCheckBox alarmCheckBox;
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
|
||||
const bool enableNuclearContaminations = ps->value(QLatin1String("aes"),
|
||||
QLatin1String("enableNuclearContaminations")).toBool();
|
||||
const bool enableDangerAreas = ps->value(QLatin1String("aes"),
|
||||
QLatin1String("enableDangerAreas")).toBool();
|
||||
const bool enableMineAreas = ps->value(QLatin1String("aes"),
|
||||
QLatin1String("enableMineAreas")).toBool();
|
||||
|
||||
m_ui->setupUi(this);
|
||||
|
||||
if (!enableNuclearContaminations)
|
||||
{
|
||||
m_ui->lblNAgentEntry->hide();
|
||||
m_ui->cbxNMarker->hide();
|
||||
m_ui->cbxNMessage->hide();
|
||||
}
|
||||
|
||||
if (!enableDangerAreas)
|
||||
{
|
||||
m_ui->lblDangerAreaEntry->hide();
|
||||
m_ui->cbxDanerAreaMarker->hide();
|
||||
m_ui->cbxDangerAreaMessage->hide();
|
||||
}
|
||||
if (!enableMineAreas)
|
||||
{
|
||||
m_ui->lblMineAreaEntry->hide();
|
||||
m_ui->cbxMineAreaEntryMarker->hide();
|
||||
m_ui->cbxMineAreaEntryMessage->hide();
|
||||
m_ui->lblMineAreaHit->hide();
|
||||
m_ui->cbxMineAreaHitMarker->hide();
|
||||
m_ui->cbxMineAreaHitMessage->hide();
|
||||
}
|
||||
|
||||
alarmCheckBox.name = QLatin1String("NuclearAgentEntry");
|
||||
alarmCheckBox.checkboxMarker = m_ui->cbxNMarker;
|
||||
alarmCheckBox.checkboxWindow = m_ui->cbxNMessage;
|
||||
alarmCheckBox.eventTypeId = ProjectDataManagement::EventType::EnterNuclear;
|
||||
m_checkBoxes.append(alarmCheckBox);
|
||||
|
||||
alarmCheckBox.name = QLatin1String("DangerAreasEntry");
|
||||
alarmCheckBox.checkboxMarker = m_ui->cbxDanerAreaMarker;
|
||||
alarmCheckBox.checkboxWindow = m_ui->cbxDangerAreaMessage;
|
||||
alarmCheckBox.eventTypeId = ProjectDataManagement::EventType::EnterDangerArea;
|
||||
m_checkBoxes.append(alarmCheckBox);
|
||||
|
||||
alarmCheckBox.name = QLatin1String("MineAreaEntry");
|
||||
alarmCheckBox.checkboxMarker = m_ui->cbxMineAreaEntryMarker;
|
||||
alarmCheckBox.checkboxWindow = m_ui->cbxMineAreaEntryMessage;
|
||||
alarmCheckBox.eventTypeId = ProjectDataManagement::EventType::EnterMineArea;
|
||||
m_checkBoxes.append(alarmCheckBox);
|
||||
|
||||
alarmCheckBox.name = QLatin1String("MineAreaHit");
|
||||
alarmCheckBox.checkboxMarker = m_ui->cbxMineAreaHitMarker;
|
||||
alarmCheckBox.checkboxWindow = m_ui->cbxMineAreaHitMessage;
|
||||
alarmCheckBox.eventTypeId = ProjectDataManagement::EventType::HitMine;
|
||||
m_checkBoxes.append(alarmCheckBox);
|
||||
|
||||
alarmCheckBox.name = QLatin1String("DirectFire");
|
||||
alarmCheckBox.checkboxMarker = m_ui->cbxDirectFireMarker;
|
||||
alarmCheckBox.checkboxWindow = m_ui->cbxDirectFireMessage;
|
||||
alarmCheckBox.eventTypeId = ProjectDataManagement::EventType::Hit;
|
||||
m_checkBoxes.append(alarmCheckBox);
|
||||
|
||||
alarmCheckBox.name = QLatin1String("IndirectFire");
|
||||
alarmCheckBox.checkboxMarker = m_ui->cbxIndirectFireMarker;
|
||||
alarmCheckBox.checkboxWindow = m_ui->cbxIndirectFireMessage;
|
||||
alarmCheckBox.eventTypeId = ProjectDataManagement::EventType::HitEffectSimulation;
|
||||
m_checkBoxes.append(alarmCheckBox);
|
||||
|
||||
alarmCheckBox.name = QLatin1String("CrossLocalBorderlines");
|
||||
alarmCheckBox.checkboxMarker = m_ui->cbxLocalBorderMarker;
|
||||
alarmCheckBox.checkboxWindow = m_ui->cbxLocalBorderMessage;
|
||||
alarmCheckBox.eventTypeId = ProjectDataManagement::EventType::CrossLocalBorderline;
|
||||
m_checkBoxes.append(alarmCheckBox);
|
||||
|
||||
alarmCheckBox.name = QLatin1String("CrossGlobalBorderlines");
|
||||
alarmCheckBox.checkboxMarker = m_ui->cbxGlobalBorderMarker;
|
||||
alarmCheckBox.checkboxWindow = m_ui->cbxGlobalBorderMessage;
|
||||
alarmCheckBox.eventTypeId = ProjectDataManagement::EventType::CrossGlobalBorderline;
|
||||
m_checkBoxes.append(alarmCheckBox);
|
||||
|
||||
alarmCheckBox.name = QLatin1String("AirSupport");
|
||||
alarmCheckBox.checkboxMarker = m_ui->cbxAirSupportMarker;
|
||||
alarmCheckBox.checkboxWindow = m_ui->cbxAirSupportMessage;
|
||||
alarmCheckBox.eventTypeId = ProjectDataManagement::EventType::AirSupport;
|
||||
m_checkBoxes.append(alarmCheckBox);
|
||||
|
||||
setOnlineHelpFilename(QLatin1String("Situation-Configure_Global_Alarms"));
|
||||
}
|
||||
|
||||
AlarmDialog::~AlarmDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool AlarmDialog::init(const std::shared_ptr<AlarmManagement::Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
AlarmHistoryModel *alarmHistoryModel)
|
||||
{
|
||||
if (!ftc)
|
||||
return false;
|
||||
if (!dtc)
|
||||
return false;
|
||||
if (!ppmDtc)
|
||||
return false;
|
||||
|
||||
m_operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
|
||||
|
||||
m_ftc = ftc;
|
||||
m_dtc = dtc;
|
||||
|
||||
connect(m_dtc.get(), &AlarmManagement::Interface::Dtc::alarmConfigChanged,
|
||||
this, &AlarmDialog::onAlarmConfigChanged);
|
||||
m_dtc->enableAlarmConfig();
|
||||
|
||||
auto cbConfig = [this](const AlarmManagement::AlarmConfig & c)
|
||||
{
|
||||
onAlarmConfigChanged(c, DataModification::eAdded);
|
||||
};
|
||||
m_dtc->alarmConfigs(cbConfig);
|
||||
|
||||
delete m_configAlarmModel;
|
||||
m_configAlarmModel = new AlarmManagement::ConfigAlarmModel(this);
|
||||
bool global = true;
|
||||
m_configAlarmModel->initModel(m_dtc, ppmDtc, alarmHistoryModel, global);
|
||||
|
||||
INFO_LOG(m_logger) << "AlarmDialog::init";
|
||||
return true;
|
||||
}
|
||||
|
||||
void AlarmDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Configure Global Alarms"));
|
||||
}
|
||||
|
||||
void AlarmDialog::onAlarmConfigChanged(const AlarmManagement::AlarmConfig &data, DataModification modType)
|
||||
{
|
||||
bool setMarker = data.setMarker();
|
||||
bool messageWindow = data.messageWindow();
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "************** onAlarmConfigChanged "
|
||||
<< " id=" << data.id()
|
||||
<< " operatorId=" << data.operatorId()
|
||||
<< " m_operatorId=" << m_operatorId
|
||||
<< " participantId=" << data.participantId()
|
||||
<< " eventTypeId=" << data.eventTypeId()
|
||||
<< " messageWindow=" << messageWindow
|
||||
<< " setMarker=" << setMarker;
|
||||
if (data.global() == false)
|
||||
return;
|
||||
|
||||
if (data.operatorId() == m_operatorId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "************** onAlarmConfig zuweisen ";
|
||||
switch (data.eventTypeId().underlying())
|
||||
{
|
||||
case ProjectDataManagement::EventType_def::EnterNuclear:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "EnterNuclear zuweisen ";
|
||||
m_ui->cbxNMarker->setChecked(setMarker);
|
||||
m_ui->cbxNMessage->setChecked(messageWindow);
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::EnterDangerArea:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "EnterDangerArea zuweisen ";
|
||||
m_ui->cbxDanerAreaMarker->setChecked(setMarker);
|
||||
m_ui->cbxDangerAreaMessage->setChecked(messageWindow);
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::EnterMineArea:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "EnterMineArea zuweisen ";
|
||||
m_ui->cbxMineAreaEntryMarker->setChecked(setMarker);
|
||||
m_ui->cbxMineAreaEntryMessage->setChecked(messageWindow);
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::HitMine:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "HitMine zuweisen ";
|
||||
m_ui->cbxMineAreaHitMarker->setChecked(setMarker);
|
||||
m_ui->cbxMineAreaHitMessage->setChecked(messageWindow);
|
||||
break;
|
||||
}
|
||||
|
||||
case ProjectDataManagement::EventType_def::Hit:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Hit zuweisen ";
|
||||
m_ui->cbxDirectFireMarker->setChecked(setMarker);
|
||||
m_ui->cbxDirectFireMessage->setChecked(messageWindow);
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::HitEffectSimulation:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "HitEffectSimulation zuweisen ";
|
||||
m_ui->cbxIndirectFireMarker->setChecked(setMarker);
|
||||
m_ui->cbxIndirectFireMessage->setChecked(messageWindow);
|
||||
break;
|
||||
}
|
||||
|
||||
case ProjectDataManagement::EventType_def::CrossLocalBorderline:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CrossLocalBorderline zuweisen ";
|
||||
m_ui->cbxLocalBorderMarker->setChecked(setMarker);
|
||||
m_ui->cbxLocalBorderMessage->setChecked(messageWindow);
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::CrossGlobalBorderline:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CrossGlobalBorderline zuweisen ";
|
||||
m_ui->cbxGlobalBorderMarker->setChecked(setMarker);
|
||||
m_ui->cbxGlobalBorderMessage->setChecked(messageWindow);
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::AirSupport:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "AirSupport zuweisen ";
|
||||
m_ui->cbxAirSupportMarker->setChecked(setMarker);
|
||||
m_ui->cbxAirSupportMessage->setChecked(messageWindow);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ERROR_LOG(m_logger) << "Not possible to set with Operator App!!!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // end of onOperatorChanged
|
||||
|
||||
|
||||
std::vector<AlarmManagement::AlarmAction> AlarmDialog::getCheckedValues() const
|
||||
{
|
||||
AlarmManagement::AlarmAction alarmActionDds;
|
||||
std::vector<AlarmManagement::AlarmAction> ret;
|
||||
ret.clear();
|
||||
ret.reserve(m_checkBoxes.size());
|
||||
for (const AlarmCheckBox &item : qAsConst(m_checkBoxes))
|
||||
{
|
||||
alarmActionDds.eventTypeId(item.eventTypeId);
|
||||
if (item.checkboxMarker->isChecked())
|
||||
{
|
||||
alarmActionDds.setMarker(true);
|
||||
DEBUG_LOG(m_logger) << item.name << " setMarker = true";
|
||||
}
|
||||
else
|
||||
{
|
||||
alarmActionDds.setMarker(false);
|
||||
DEBUG_LOG(m_logger) << item.name << " setMarker = false";
|
||||
}
|
||||
if (item.checkboxWindow->isChecked())
|
||||
{
|
||||
alarmActionDds.messageWindow(true);
|
||||
DEBUG_LOG(m_logger) << item.name << " messageWindow = true";
|
||||
}
|
||||
else
|
||||
{
|
||||
alarmActionDds.messageWindow(false);
|
||||
DEBUG_LOG(m_logger) << item.name << " messageWindow = false";
|
||||
}
|
||||
if (alarmActionDds.setMarker() || alarmActionDds.messageWindow())
|
||||
ret.push_back(alarmActionDds);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool AlarmDialog::apply()
|
||||
{
|
||||
std::vector<int32_t> participantIds;
|
||||
participantIds.push_back(0); // Global Event
|
||||
bool globalEvent = true;
|
||||
bool remove = false;
|
||||
const ConfigureAlarmsRequest req(getCheckedValues(), m_operatorId, participantIds, globalEvent, remove);
|
||||
|
||||
return m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ftc->configureAlarmsRequest(req, this);
|
||||
});
|
||||
} // end of apply
|
||||
} // namespace AlarmManagement
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Alarm Configuration
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, SLSE, 2017-01-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Services/AlarmManagement/alm_ftc.h>
|
||||
#include <Services/AlarmManagement/alm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <AlarmManagement/logger.h>
|
||||
|
||||
class QCheckBox;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class AlarmDialog;
|
||||
}
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
class ConfigAlarmModel;
|
||||
class AlarmHistoryModel;
|
||||
|
||||
class AlarmDialog final : public LtsWidgets::LtsDialog
|
||||
, protected AlarmManagement::Interface::Ftc::ConfigureAlarmsReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
struct AlarmAction
|
||||
{
|
||||
int eventTypeId = 0;
|
||||
bool setMarker = false;
|
||||
bool messageWindow = false;
|
||||
};
|
||||
|
||||
struct AlarmCheckBox
|
||||
{
|
||||
QCheckBox *checkboxMarker = nullptr;
|
||||
QCheckBox *checkboxWindow = nullptr;
|
||||
QString name;
|
||||
ProjectDataManagement::EventType eventTypeId = ProjectDataManagement::EventType::Unknown;
|
||||
};
|
||||
|
||||
explicit AlarmDialog(QWidget *parent = nullptr);
|
||||
~AlarmDialog();
|
||||
|
||||
bool init(const std::shared_ptr<AlarmManagement::Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
AlarmHistoryModel *alarmHistoryModel);
|
||||
|
||||
void retranslate() override;
|
||||
bool apply() override;
|
||||
|
||||
protected:
|
||||
void onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
private slots:
|
||||
void onAlarmConfigChanged(const AlarmManagement::AlarmConfig &data, DataModification modType);
|
||||
|
||||
private:
|
||||
std::vector<AlarmManagement::AlarmAction> getCheckedValues() const;
|
||||
|
||||
ConfigAlarmModel *m_configAlarmModel;
|
||||
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> m_ftc;
|
||||
|
||||
Ui::AlarmDialog *m_ui;
|
||||
QVector<AlarmCheckBox> m_checkBoxes;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
int m_operatorId;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
} // namespace AlarmManagement
|
||||
+335
@@ -0,0 +1,335 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AlarmDialog</class>
|
||||
<widget class="QWidget" name="AlarmDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>413</width>
|
||||
<height>285</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">MainWindow</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="cbxDanerAreaMarker">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="5">
|
||||
<widget class="QCheckBox" name="cbxGlobalBorderMessage">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QCheckBox" name="cbxDirectFireMarker">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QCheckBox" name="cbxNMessage">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Indirect Fire</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="4" colspan="3">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Message Window</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>19</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set Marker</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QCheckBox" name="cbxLocalBorderMarker">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Direct Fire</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<widget class="QCheckBox" name="cbxDangerAreaMessage">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QCheckBox" name="cbxMineAreaEntryMarker">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblDangerAreaEntry">
|
||||
<property name="text">
|
||||
<string>Danger Areas Entry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<widget class="QCheckBox" name="cbxMineAreaEntryMessage">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="5">
|
||||
<widget class="QCheckBox" name="cbxLocalBorderMessage">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="5">
|
||||
<widget class="QCheckBox" name="cbxMineAreaHitMessage">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblMineAreaEntry">
|
||||
<property name="text">
|
||||
<string>Mine Area Entry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="lblCrossLocalBorderline">
|
||||
<property name="text">
|
||||
<string>Cross Local Borderlines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QCheckBox" name="cbxIndirectFireMarker">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<spacer name="horizontalSpacer_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>39</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="5">
|
||||
<widget class="QCheckBox" name="cbxIndirectFireMessage">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="cbxNMarker">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="5">
|
||||
<widget class="QCheckBox" name="cbxDirectFireMessage">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QCheckBox" name="cbxMineAreaHitMarker">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QCheckBox" name="cbxGlobalBorderMarker">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblNAgentEntry">
|
||||
<property name="text">
|
||||
<string>Nuclear Agent Entry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<spacer name="horizontalSpacer_20">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>38</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="lblCrossGlobalBorderline">
|
||||
<property name="text">
|
||||
<string>Cross Global Borderlines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblMineAreaHit">
|
||||
<property name="text">
|
||||
<string>Mine Area Hit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="lblAirSupport">
|
||||
<property name="text">
|
||||
<string>Air Support</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QCheckBox" name="cbxAirSupportMarker">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="5">
|
||||
<widget class="QCheckBox" name="cbxAirSupportMessage">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<tabstops>
|
||||
<tabstop>cbxNMarker</tabstop>
|
||||
<tabstop>cbxNMessage</tabstop>
|
||||
<tabstop>cbxDanerAreaMarker</tabstop>
|
||||
<tabstop>cbxDangerAreaMessage</tabstop>
|
||||
<tabstop>cbxMineAreaEntryMarker</tabstop>
|
||||
<tabstop>cbxMineAreaEntryMessage</tabstop>
|
||||
<tabstop>cbxMineAreaHitMarker</tabstop>
|
||||
<tabstop>cbxMineAreaHitMessage</tabstop>
|
||||
<tabstop>cbxLocalBorderMarker</tabstop>
|
||||
<tabstop>cbxLocalBorderMessage</tabstop>
|
||||
<tabstop>cbxGlobalBorderMarker</tabstop>
|
||||
<tabstop>cbxGlobalBorderMessage</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Messaging - Messaging Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "alm_history.h"
|
||||
#include "ui_alm_history.h"
|
||||
|
||||
#include <Plugins/AlarmManagement/Gui/Common/alm_history_alarm_model.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
|
||||
AlarmView::AlarmView(LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_alarmHistoryModel(nullptr)
|
||||
, m_dtc(nullptr)
|
||||
, m_sitMapGuiIfc(nullptr)
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::AlarmView)
|
||||
, m_logger(getLogger("AlarmView"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " --- AlarmView Konstruktor() ";
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
|
||||
// connects fuer Widgetaenderungen
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &AlarmView::onSelectionChanged);
|
||||
|
||||
// Double Clicked
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked,
|
||||
this, &AlarmView::onShowAlarm);
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print,
|
||||
this, &AlarmView::onPrint);
|
||||
// Create Remove-Button
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &AlarmView::onRemoveAlarm);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
|
||||
|
||||
// Center Map Button
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &AlarmView::onCenterAlarm);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Alarm_History"));
|
||||
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
AlarmView::~AlarmView()
|
||||
{
|
||||
INFO_LOG(m_logger) << "--- AlarmView Destruktor() ";
|
||||
m_sitMapGuiIfc = nullptr;
|
||||
delete m_ui;
|
||||
} // end of dtor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void AlarmView::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Alarm History"));
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setText(tr("Center Map"));
|
||||
}
|
||||
|
||||
bool AlarmView::init(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
AlarmHistoryModel *alarmHistoryModel)
|
||||
{
|
||||
INFO_LOG(m_logger) << "--- init() ";
|
||||
if (!dtc)
|
||||
return false;
|
||||
|
||||
m_dtc = dtc;
|
||||
m_alarmHistoryModel = alarmHistoryModel;
|
||||
|
||||
DEBUG_LOG(m_logger) << "--- AlarmView::init ";
|
||||
m_proxyModel = new AlarmHistoryProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_alarmHistoryModel);
|
||||
m_ui->widget->setModel(m_proxyModel);
|
||||
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->widget->hideColumn(AlarmHistoryModel::Id);
|
||||
m_ui->widget->hideColumn(AlarmHistoryModel::ParticipantId);
|
||||
m_ui->widget->hideColumn(AlarmHistoryModel::AesId);
|
||||
#endif
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setIcon(QIcon(QStringLiteral("icon:center_to_object.svg")));
|
||||
m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc);
|
||||
return true;
|
||||
} // end of init()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void AlarmView::onSelectionChanged()
|
||||
{
|
||||
QModelIndexList selectedRows = m_ui->widget->selectedRows();
|
||||
const int cntSelectedRows = selectedRows.size();
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, cntSelectedRows == 1); // onCenterAlarm
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, cntSelectedRows > 0);
|
||||
} // end of onSelectionChanged()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void AlarmView::onShowAlarm()
|
||||
{
|
||||
INFO_LOG(m_logger) << "--- onShowMAlarm() ";
|
||||
} // end of onShowAlarm()
|
||||
|
||||
|
||||
// Window to remove an Alarm
|
||||
void AlarmView::onRemoveAlarm()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onRemoveAlarm selectedRows.size"
|
||||
<< m_ui->widget->selectedRows().size();
|
||||
|
||||
const QModelIndexList idxList = m_ui->widget->selectedRows();
|
||||
QVector<int> rowsToRemove;
|
||||
rowsToRemove.reserve(idxList.size());
|
||||
for (const auto &idx : idxList)
|
||||
rowsToRemove.push_back(idx.row());
|
||||
std::sort(rowsToRemove.begin(), rowsToRemove.end(), std::greater<int>());
|
||||
for (int i = 0; i < rowsToRemove.length(); i++)
|
||||
m_alarmHistoryModel->removeRow(rowsToRemove.at(i));
|
||||
} // end of onRemoveAlarm()
|
||||
|
||||
// Window to center an Alarm to participant
|
||||
void AlarmView::onCenterAlarm()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onCenterAlarm";
|
||||
if (!m_sitMapGuiIfc)
|
||||
return;
|
||||
const QModelIndexList indexList = m_ui->widget->selectedRows();
|
||||
if (indexList.isEmpty())
|
||||
return;
|
||||
const QModelIndex &index = indexList.first();
|
||||
|
||||
const QModelIndex indexPosi = m_alarmHistoryModel->index(index.row(), AlarmHistoryModel::Position, index.parent());
|
||||
const QPointF &position = indexPosi.data(Qt::UserRole).toPointF(); // Qt::UserRole to get Position as value, not as string
|
||||
|
||||
if (!position.isNull())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " position=" << position.x() << " - " << position.y();
|
||||
m_sitMapGuiIfc->setCenterPoint(position);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QModelIndex &indexParticipantId = m_alarmHistoryModel->index(index.row(), AlarmHistoryModel::ParticipantId, index.parent());
|
||||
const int participantId = indexParticipantId.data().toInt();
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " participantId=" << participantId;
|
||||
m_sitMapGuiIfc->centerMapToParticipant(participantId);
|
||||
}
|
||||
} // end of onCenterAlarm()
|
||||
|
||||
void AlarmView::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
|
||||
}
|
||||
|
||||
void AlarmView::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
} // namespace AlarmManagement
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Messaging - Messaging Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AlarmManagement/alm_dtc.h>
|
||||
#include <AlarmManagement/logger.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class AlarmView;
|
||||
}
|
||||
namespace AlarmManagement
|
||||
{
|
||||
class AlarmHistoryModel;
|
||||
class AlarmHistoryProxyModel;
|
||||
|
||||
class AlarmView final : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlarmView(LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~AlarmView();
|
||||
bool init(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
AlarmHistoryModel *alarmHistoryModel);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void onSelectionChanged();
|
||||
void onShowAlarm();
|
||||
void onRemoveAlarm();
|
||||
void onCenterAlarm();
|
||||
void onPrint();
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
private:
|
||||
AlarmHistoryModel *m_alarmHistoryModel;
|
||||
AlarmHistoryProxyModel *m_proxyModel;
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
||||
|
||||
LtsSession::LtsSession *m_session;
|
||||
Ui::AlarmView *m_ui;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
} // namespace AlarmManagement
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AlarmView</class>
|
||||
<widget class="QWidget" name="AlarmView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>455</width>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">AlarmView</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="LtsDataView::LtsDataView" name="widget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in new issue
Block a user