Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
#ADD_SUBDIRECTORY(Data)
|
||||
#ADD_SUBDIRECTORY(Gui)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(AlmGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/alm_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
GuiPluginInterface
|
||||
)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(AlmInfoGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/alm_info_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
GuiPluginInterface
|
||||
)
|
||||
|
||||
#
|
||||
# Data Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(AlmDataPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/alm_data_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
DataPluginInterface
|
||||
svcAlmCommon
|
||||
)
|
||||
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Mike Wille, SLSE, 2017-01-11
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Data)
|
||||
ADD_SUBDIRECTORY(Gui)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
#NGL_ADD_LIBRARY(WS AlmGuiPluginInterface SHARED alm_gui_plugin_interface.h)
|
||||
#NGL_TARGET_LINK_LIBRARIES(AlmGuiPluginInterface
|
||||
# Qt5::Core
|
||||
# GuiPluginInterface
|
||||
#)
|
||||
#NGL_INSTALL_TARGET(AlarmGuiPluginInterface)
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Mike Wille, SLSE; 2016-09-06
|
||||
#
|
||||
|
||||
#
|
||||
# Data Plugin
|
||||
#
|
||||
NGL_ADD_LIBRARY2(WS AlmDataPlugin MODULE alm_data_plugin.cpp alm_data_plugin.h)
|
||||
NGL_TARGET_LINK_LIBRARIES(AlmDataPlugin
|
||||
Qt5::Core
|
||||
AlmDataPluginInterface
|
||||
svcAlmClient
|
||||
NGLLogger
|
||||
LtsSessionDataDds
|
||||
)
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for AlarmManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "alm_data_plugin.h"
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
|
||||
{
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> dtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> ftc;
|
||||
if (!session->createTopicClient(dtc, ftc))
|
||||
return std::shared_ptr<DataPluginBase::Interface>();
|
||||
|
||||
return std::make_shared<DataInterfaceImpl>(dtc,ftc);
|
||||
}
|
||||
|
||||
DataInterfaceImpl::DataInterfaceImpl(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Ftc> &ftc)
|
||||
: DataInterface()
|
||||
, m_dtc(dtc)
|
||||
, m_ftc(ftc)
|
||||
{}
|
||||
|
||||
} // namespace AlarmManagement
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for AlarmManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <Plugins/AlarmManagement/alm_data_plugin_interface.h>
|
||||
|
||||
#include <AlarmManagement/alm_dtc.h>
|
||||
#include <AlarmManagement/alm_ftc.h>
|
||||
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
|
||||
class DataPlugin final : public QObject, public DataPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "data:3:alm")
|
||||
Q_INTERFACES(DataPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataPlugin() = default;
|
||||
~DataPlugin() = default;
|
||||
|
||||
QString pluginName() const override { return QStringLiteral("AlarmManagement"); }
|
||||
std::shared_ptr<DataPluginBase::Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise
|
||||
|| partition == IDL::PartitionType::Replay;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class DataInterfaceImpl final : public DataInterface
|
||||
{
|
||||
public:
|
||||
explicit DataInterfaceImpl(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Ftc> &ftc);
|
||||
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> getDtc() override { return m_dtc; }
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> getFtc() override { return m_ftc; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> m_ftc;
|
||||
};
|
||||
|
||||
} // namespace AlarmManagement
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Common)
|
||||
ADD_SUBDIRECTORY(ConfigAlarm)
|
||||
ADD_SUBDIRECTORY(ConfigParticipantAlarm)
|
||||
ADD_SUBDIRECTORY(EmergencyCalls)
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Mike Wille, SLSE, 2016-09-06
|
||||
#
|
||||
|
||||
#
|
||||
# Data Plugin
|
||||
#
|
||||
SET(alarm_common_gui_SRCS
|
||||
alm_history_alarm_model.cpp
|
||||
alm_history_alarm_model.h
|
||||
alm_config_alarm_model.cpp
|
||||
alm_config_alarm_model.h
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY2(WS AlmCommon SHARED ${alarm_common_gui_SRCS} )
|
||||
NGL_TARGET_LINK_LIBRARIES(AlmCommon
|
||||
PRIVATE
|
||||
Qt5::Widgets
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
LtsCoordTrans
|
||||
NGLLogger
|
||||
PUBLIC
|
||||
Qt5::Core
|
||||
nglwidgets
|
||||
svcPpmCommon
|
||||
svcAlmCommon
|
||||
svcAesCommon
|
||||
advancedSymbology
|
||||
advancedSymbologyGui
|
||||
ngltools
|
||||
)
|
||||
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AlarmManagement - AlarmManagement Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#include "alm_config_alarm_model.h"
|
||||
#include <AlarmManagement/alm_translation.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <ProjectDataManagement/pdm_to_string.h>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
//---------------------------------
|
||||
// AlarmManagementModel
|
||||
//---------------------------------
|
||||
ConfigAlarmModel::ConfigAlarmModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<AlarmManagement::AlarmConfig>(
|
||||
{
|
||||
tr("Id"),
|
||||
tr("Equip. No."),
|
||||
tr("Designator"),
|
||||
tr("Tact. Identifier"),
|
||||
tr("Vulnerability State"),
|
||||
tr("Event Type"),
|
||||
tr("Message Window"),
|
||||
tr("Set Marker")
|
||||
},
|
||||
parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_alarmHistoryModel(nullptr)
|
||||
, m_global(false)
|
||||
, m_logger(getLogger("ConfigAlarmModel"))
|
||||
{}
|
||||
|
||||
|
||||
bool ConfigAlarmModel::initModel(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
AlarmHistoryModel *alarmHistoryModel,
|
||||
bool global)
|
||||
{
|
||||
m_dtc = dtc;
|
||||
m_ppmDtc = ppmDtc;
|
||||
m_alarmHistoryModel = alarmHistoryModel;
|
||||
m_global = global;
|
||||
|
||||
// insert Model
|
||||
const QMap<qint32, AlarmManagement::AlarmConfig> alarmConfigs = m_dtc->alarmConfigs();
|
||||
INFO_LOG(m_logger) << "initModel - #AlarmConfig: " << alarmConfigs.size();
|
||||
|
||||
connect(m_dtc.get(), &Interface::Dtc::alarmConfigChanged,
|
||||
this, &ConfigAlarmModel::onAlarmConfigChanged);
|
||||
|
||||
m_dtc->enableAlarmConfig();
|
||||
auto cb = [this] (const AlarmManagement::AlarmConfig &d)
|
||||
{
|
||||
onAlarmConfigChanged(d, DataModification::eAdded);
|
||||
};
|
||||
m_dtc->alarmConfigs(cb);
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant ConfigAlarmModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "AlarmManagementModel::data";
|
||||
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const AlarmManagement::AlarmConfig &alarmConfig = m_vecData.at(index.row());
|
||||
if (alarmConfig.global() != m_global)
|
||||
return QVariant();
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return alarmConfig.id();
|
||||
case EquipmentNumber:
|
||||
{
|
||||
const int equipmentNumber = m_alarmHistoryModel->participantId2EquipNo(alarmConfig.participantId());
|
||||
if (equipmentNumber == 0)
|
||||
return tr("All");
|
||||
return equipmentNumber;
|
||||
}
|
||||
case Designator:
|
||||
return m_alarmHistoryModel->getDesignator(alarmConfig.participantId());
|
||||
case TactIdentifier:
|
||||
return m_alarmHistoryModel->getTactIdentifier(alarmConfig.participantId());
|
||||
case VulnerabilityState:
|
||||
{
|
||||
QString vulnerabilityState = tr("All Types");
|
||||
if (alarmConfig.vulnerabilityState()>=0){
|
||||
ParticipantManagement::TypeClass typeClass =
|
||||
m_ppmDtc->type(m_ppmDtc->participant(alarmConfig.participantId()).typeId()).typeClass();
|
||||
|
||||
const ProjectDataManagement::VulnerabilityClass vc = typeClass == ParticipantManagement::TypeClass::Human ?
|
||||
ProjectDataManagement::VulnerabilityClass_def::SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass_def::VehicleDamages;
|
||||
ProjectDataManagement::VulnerabilityState vs = static_cast<ProjectDataManagement::VulnerabilityState_def::type>(alarmConfig.vulnerabilityState());
|
||||
vulnerabilityState = ProjectDataManagement::toString(vs, vc);
|
||||
}
|
||||
return vulnerabilityState;
|
||||
}
|
||||
|
||||
case EventType:
|
||||
return ProjectDataManagement::toString(alarmConfig.eventTypeId());
|
||||
case MessageWindow:
|
||||
return alarmConfig.messageWindow() ? tr("Yes") : tr("No");
|
||||
case SetMarker:
|
||||
return alarmConfig.setMarker() ? tr("Yes") : tr("No");
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
void ConfigAlarmModel::onAlarmConfigChanged(const AlarmManagement::AlarmConfig &data,
|
||||
const DataModification modType)
|
||||
{
|
||||
const int id = data.id();
|
||||
if (data.global() != m_global)
|
||||
return;
|
||||
|
||||
int row = findRowForId(id);
|
||||
|
||||
const int eventTypeId = data.eventTypeId().underlying();
|
||||
const bool messageWindow = data.messageWindow();
|
||||
const bool setMarker = data.setMarker();
|
||||
DEBUG_LOG(m_logger) << "onAlarmConfigChanged: " << eventTypeId << " messageWindow=" << messageWindow
|
||||
<< "setMarker"<<setMarker;
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eRemoved:
|
||||
{
|
||||
// removed
|
||||
DEBUG_LOG(m_logger) << "AlarmConfig was removed: " << id;
|
||||
AlarmManagement::AlarmConfig data1 = data;
|
||||
data1.messageWindow(false);
|
||||
data1.setMarker(false);
|
||||
setRowData(row, data1);
|
||||
removeRow(row);
|
||||
return;
|
||||
}
|
||||
case DataModification::eModified:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DataModification::eModified: ";
|
||||
if (row < 0)
|
||||
{
|
||||
// created
|
||||
return;
|
||||
}
|
||||
if (m_alarmHistoryModel->participantId2EquipNo(data.participantId()) > 0)
|
||||
setRowData(row, data);
|
||||
break;
|
||||
}
|
||||
case DataModification::eAdded:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DataModification::eAdded";
|
||||
insertRow(data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace AlarmManagement
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Messaging - Messaging Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Common/almcommon_export.h>
|
||||
#include <AlarmManagement/alm_dtc.h>
|
||||
#include <AlarmManagement/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include "alm_history_alarm_model.h"
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
// --------------------------------------------------------
|
||||
// AlarmManagementModel
|
||||
// --------------------------------------------------------
|
||||
class ALMCOMMON_EXPORT ConfigAlarmModel final : public LtsWidgets::LtsAbstractTableModel<AlarmManagement::AlarmConfig>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id,
|
||||
EquipmentNumber,
|
||||
Designator,
|
||||
TactIdentifier,
|
||||
VulnerabilityState,
|
||||
EventType,
|
||||
MessageWindow,
|
||||
SetMarker
|
||||
};
|
||||
|
||||
explicit ConfigAlarmModel(QObject *parent = nullptr);
|
||||
|
||||
bool initModel(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
AlarmHistoryModel *alarmHistoryModel,
|
||||
bool global);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
private slots:
|
||||
void onAlarmConfigChanged(const AlarmManagement::AlarmConfig &data,
|
||||
const DataModification modType);
|
||||
private:
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
AlarmHistoryModel *m_alarmHistoryModel;
|
||||
bool m_global;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
} //namespace AlarmManagement
|
||||
@@ -0,0 +1,325 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AlarmManagement - AlarmManagement Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#include "alm_history_alarm_model.h"
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <AlarmManagement/alm_translation.h>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
#include <ProjectDataManagement/pdm_translation.h>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonParseError>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
//---------------------------------
|
||||
// AlarmHistoryModel
|
||||
//---------------------------------
|
||||
AlarmHistoryModel::AlarmHistoryModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<NotificationEx>(
|
||||
{
|
||||
tr("Id"),
|
||||
tr("Date"),
|
||||
tr("Incident"),
|
||||
tr("Equip. No."),
|
||||
tr("Hierarchie"),
|
||||
tr("Participant Id"),
|
||||
tr("Position"),
|
||||
tr("Aes Id"),
|
||||
tr("Aes Name"),
|
||||
},
|
||||
parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_logger(getLogger("AlarmHistoryModel"))
|
||||
{}
|
||||
|
||||
|
||||
bool AlarmHistoryModel::initModel(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc)
|
||||
{
|
||||
m_dtc = dtc;
|
||||
m_ppmDtc = ppmDtc;
|
||||
m_aesDtc = aesDtc;
|
||||
|
||||
// insert Model
|
||||
|
||||
connect(m_dtc.get(), &Interface::Dtc::notificationChanged,
|
||||
this, &AlarmHistoryModel::onNotificationChanged);
|
||||
|
||||
connect(m_ppmDtc.get(), &ParticipantManagement::Interface::Dtc::participantChanged,
|
||||
this, &AlarmHistoryModel::onParticipantChanged);
|
||||
|
||||
m_ppmDtc->enableParticipant();
|
||||
m_dtc->enableNotification();
|
||||
|
||||
// Player in Referenzmap eintragen
|
||||
const auto cbParticipants = [this](const ParticipantManagement::Participant & participant)
|
||||
{
|
||||
onParticipantChanged(participant, DataModification::eAdded);
|
||||
};
|
||||
m_ppmDtc->participants(cbParticipants);
|
||||
//***************************************************************
|
||||
//** Get AES-Names
|
||||
//***************************************************************
|
||||
|
||||
// Get AesNames for all AesItems
|
||||
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::borderlineChanged,
|
||||
this, &AlarmHistoryModel::onAesItemChanged);
|
||||
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::dangerAreaChanged,
|
||||
this, &AlarmHistoryModel::onAesItemChanged);
|
||||
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::nContaminationChanged,
|
||||
this, &AlarmHistoryModel::onAesItemChanged);
|
||||
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::bCContaminationChanged,
|
||||
this, &AlarmHistoryModel::onBCContaminationChanged);
|
||||
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::mineAreaChanged,
|
||||
this, &AlarmHistoryModel::onAesItemChanged);
|
||||
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::functionalAreaChanged,
|
||||
this, &AlarmHistoryModel::onAesItemChanged);
|
||||
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::boobyTrapChanged,
|
||||
this, &AlarmHistoryModel::onBoobyTrapChanged);
|
||||
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::offRouteMineChanged,
|
||||
this, &AlarmHistoryModel::onOffRouteMineChanged);
|
||||
|
||||
|
||||
auto cbAesItem = [this](const AreaEffectSimulation::AesItem & item)
|
||||
{
|
||||
onAesItemChanged(item, DataModification::eAdded);
|
||||
};
|
||||
m_aesDtc->borderlines(cbAesItem);
|
||||
m_aesDtc->dangerAreas(cbAesItem);
|
||||
m_aesDtc->nContaminations(cbAesItem);
|
||||
m_aesDtc->mineAreas(cbAesItem);
|
||||
m_aesDtc->functionalAreas(cbAesItem);
|
||||
m_aesDtc->boobyTraps(cbAesItem);
|
||||
m_aesDtc->offRouteMines(cbAesItem);
|
||||
|
||||
return true;
|
||||
} // end of initModel
|
||||
|
||||
|
||||
QVariant AlarmHistoryModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!indexIsValid(index))
|
||||
return QVariant();
|
||||
if ((role != Qt::DisplayRole) && (role != Qt::UserRole) && (role != Qt::BackgroundRole))
|
||||
return QVariant();
|
||||
|
||||
const NotificationEx ¬ificationEx = m_vecData.at(index.row());
|
||||
|
||||
if (role == Qt::BackgroundRole)
|
||||
{
|
||||
if (notificationEx.eventType() == ProjectDataManagement::EventType_def::EmergencyCall)
|
||||
return QColor(Qt::red);
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return notificationEx.id();
|
||||
case Date:
|
||||
return QDateTime::fromMSecsSinceEpoch(notificationEx.time());
|
||||
case EquipmentNumber:
|
||||
if (notificationEx.equipmentNumber)
|
||||
return notificationEx.equipmentNumber;
|
||||
break;
|
||||
case Incident:
|
||||
return ProjectDataManagement::toString(notificationEx.eventTypeId);
|
||||
case Hierarchie:
|
||||
return m_ppmDtc->hierarchyFromParticipant(notificationEx.participantId);
|
||||
case ParticipantId:
|
||||
return notificationEx.participantId;
|
||||
case Position:
|
||||
if (role == Qt::DisplayRole)
|
||||
return LtsCoordTrans::mgrsFromGeographic(notificationEx.position().lon(), notificationEx.position().lat());
|
||||
else if (role == Qt::UserRole)
|
||||
return QPointF(notificationEx.position().lon(), notificationEx.position().lat());
|
||||
break;
|
||||
case AesId:
|
||||
return notificationEx.aesId;
|
||||
case AesName:
|
||||
// Direct Hits do not contain aesId
|
||||
return m_aesNameMap.value(notificationEx.aesId, tr("-"));
|
||||
}
|
||||
return QVariant();
|
||||
} // end of data
|
||||
|
||||
|
||||
bool AlarmHistoryModel::isFiltered(const NotificationEx &data, DataModification modType) const
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
if (data.operatorId() == 0)
|
||||
return false;
|
||||
return data.operatorId() != LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
|
||||
}
|
||||
|
||||
void AlarmHistoryModel::onNotificationChanged(const AlarmManagement::Notification &data,
|
||||
const DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
NotificationEx notification(data);
|
||||
const QByteArray properties = QByteArray::fromRawData(data.properties().c_str(), data.properties().size());
|
||||
const QJsonDocument propertieJsonDoc = QJsonDocument::fromJson(properties);
|
||||
const QJsonObject propertieJsonObj = propertieJsonDoc.object();
|
||||
|
||||
notification.equipmentNumber = data.equipmentNumber();
|
||||
if (data.participantId().is_set())
|
||||
notification.participantId = data.participantId().get();
|
||||
notification.eventTypeId = data.eventType();
|
||||
if (data.aesId().is_set())
|
||||
notification.aesId = data.aesId().get();
|
||||
const int global = propertieJsonObj[QStringLiteral("Global")].toInt();
|
||||
const int friendlyFire = propertieJsonObj[QStringLiteral("FriendlyFire")].toInt();
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION
|
||||
<< " notification:" << data
|
||||
<< ", Global: " << global
|
||||
<< ", FriendlyFire: " << friendlyFire;
|
||||
|
||||
onDataChanged(notification, modType);
|
||||
} // end of onWindowChanged
|
||||
|
||||
void AlarmHistoryModel::onParticipantChanged(const ParticipantManagement::Participant &participant,
|
||||
const DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
QString designator = QString::fromStdString(participant.designator());
|
||||
m_idDesignatorMap.insert(participant.id(), designator);
|
||||
|
||||
const int equipNo = participant.equipmentNumber().is_set() ? participant.equipmentNumber().get() : 0;
|
||||
m_partId2EquipNoMap.insert(participant.id(), equipNo);
|
||||
|
||||
QString tacticalIdentifier = QString::fromStdString(participant.tacticalIdentifier());
|
||||
m_idTactIdentifierMap.insert(participant.id(), tacticalIdentifier);
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " id=" << participant.id()
|
||||
<< " designator=" << designator
|
||||
<< " tacticalIdentifier=" << tacticalIdentifier;
|
||||
} // end of onParticipantChanged
|
||||
|
||||
int AlarmHistoryModel::participantId2EquipNo(const int participantId) const
|
||||
{
|
||||
int ret = m_partId2EquipNoMap.value(participantId, 0);
|
||||
INFO_LOG(m_logger) << "participantId2EquipNo participantId=" << participantId
|
||||
<< " EquipmentNumber=" << ret;
|
||||
return ret;
|
||||
} // end of participantId2EquipNo()
|
||||
|
||||
QString AlarmHistoryModel::getDesignator(const int participantId) const
|
||||
{
|
||||
QString designator = m_idDesignatorMap.value(participantId);
|
||||
DEBUG_LOG(m_logger) << "m_idDesignatorMap.value(participantId)=" << designator;
|
||||
|
||||
return designator;
|
||||
}
|
||||
|
||||
QString AlarmHistoryModel::getTactIdentifier(const int participantId) const
|
||||
{
|
||||
QString tactIdentifier = m_idTactIdentifierMap.value(participantId);
|
||||
DEBUG_LOG(m_logger) << "m_idTactIdentifierMap.value(participantId)=" << tactIdentifier;
|
||||
|
||||
return tactIdentifier;
|
||||
}
|
||||
|
||||
void AlarmHistoryModel::onBCContaminationChanged(const AreaEffectSimulation::BCContamination &data,
|
||||
const DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
int id = data.id();
|
||||
QString name = QString::fromStdString(data.name());
|
||||
m_aesNameMap[id] = name;
|
||||
DEBUG_LOG(m_logger) << "onBCContaminationChanged: " << data
|
||||
<< " Name=" << name
|
||||
<< " id=" << id;
|
||||
}
|
||||
|
||||
void AlarmHistoryModel::onBoobyTrapChanged(const AreaEffectSimulation::BoobyTrap &data,
|
||||
const DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
int id = data.id();
|
||||
QString name = QString::fromStdString(data.name());
|
||||
m_aesNameMap[id] = name;
|
||||
DEBUG_LOG(m_logger) << "BoobyTrap: " << data
|
||||
<< " Name=" << name
|
||||
<< " id=" << id;
|
||||
}
|
||||
|
||||
void AlarmHistoryModel::onOffRouteMineChanged(const AreaEffectSimulation::OffRouteMine &data,
|
||||
const DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
int id = data.id();
|
||||
QString name = QString::fromStdString(data.name());
|
||||
m_aesNameMap[id] = name;
|
||||
DEBUG_LOG(m_logger) << "OffRouteMine: " << data
|
||||
<< " Name=" << name
|
||||
<< " id=" << id;
|
||||
}
|
||||
|
||||
void AlarmHistoryModel::onAesItemChanged(const AreaEffectSimulation::AesItem &item,
|
||||
const DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
QString name = QString::fromStdString(item.name());
|
||||
int id = item.id();
|
||||
m_aesNameMap[id] = name;
|
||||
DEBUG_LOG(m_logger) << "AreaEffectSimulation::AesItem onAesItemChanged: " << item
|
||||
<< " Name=" << name
|
||||
<< " id=" << item.id();
|
||||
} // end of onAesItemChanged
|
||||
|
||||
//
|
||||
// AlarmHistoryProxyModel
|
||||
//
|
||||
void AlarmHistoryProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<AlarmHistoryModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
bool AlarmHistoryProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
|
||||
{
|
||||
if (!m_sourceModel ||
|
||||
source_left.column() != source_right.column() ||
|
||||
!source_left.isValid() ||
|
||||
!source_right.isValid())
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
const auto &dataLeft = m_sourceModel->m_vecData.at(source_left.row());
|
||||
const auto dataRight = m_sourceModel->m_vecData.at(source_right.row());
|
||||
switch (source_left.column())
|
||||
{
|
||||
case AlarmHistoryModel::Date:
|
||||
return dataLeft.time() < dataRight.time();
|
||||
|
||||
case AlarmHistoryModel::Id:
|
||||
case AlarmHistoryModel::Incident:
|
||||
case AlarmHistoryModel::EquipmentNumber:
|
||||
case AlarmHistoryModel::Hierarchie:
|
||||
case AlarmHistoryModel::ParticipantId:
|
||||
case AlarmHistoryModel::Position:
|
||||
case AlarmHistoryModel::AesId:
|
||||
case AlarmHistoryModel::AesName:
|
||||
break;
|
||||
}
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
}
|
||||
} // namespace AlarmManagement
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Messaging - Messaging Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Common/almcommon_export.h>
|
||||
#include <AlarmManagement/alm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <AlarmManagement/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
// --------------------------------------------------------
|
||||
// AlarmHistoryModel
|
||||
// --------------------------------------------------------
|
||||
struct NotificationEx : public AlarmManagement::Notification
|
||||
{
|
||||
int equipmentNumber = 0;
|
||||
int participantId = 0;
|
||||
int aesId = 0;
|
||||
ProjectDataManagement::EventType eventTypeId = ProjectDataManagement::EventType::Unknown;
|
||||
|
||||
NotificationEx() = default;
|
||||
explicit NotificationEx(const AlarmManagement::Notification &n)
|
||||
: AlarmManagement::Notification(n)
|
||||
{}
|
||||
};
|
||||
|
||||
class ALMCOMMON_EXPORT AlarmHistoryModel final : public LtsWidgets::LtsAbstractTableModel<NotificationEx>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
enum Columns
|
||||
{
|
||||
Id,
|
||||
Date,
|
||||
Incident,
|
||||
EquipmentNumber,
|
||||
Hierarchie,
|
||||
ParticipantId,
|
||||
Position,
|
||||
AesId,
|
||||
AesName
|
||||
};
|
||||
|
||||
explicit AlarmHistoryModel(QObject *parent = nullptr);
|
||||
|
||||
bool initModel(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
/**
|
||||
* Get equipment number for the given participant
|
||||
* @param participantId participant id to get the equipment number for
|
||||
* @return equipment number or 0 in case of failure
|
||||
*/
|
||||
int participantId2EquipNo(const int participantId) const;
|
||||
QString getDesignator(const int participantId) const;
|
||||
QString getTactIdentifier(const int participantId) const;
|
||||
|
||||
protected:
|
||||
bool isFiltered(const NotificationEx &data, DataModification modType) const override;
|
||||
private slots:
|
||||
void onNotificationChanged(const AlarmManagement::Notification &data,
|
||||
const DataModification modType);
|
||||
void onParticipantChanged(const ParticipantManagement::Participant &participant,
|
||||
const DataModification modType);
|
||||
void onAesItemChanged(const AreaEffectSimulation::AesItem &item,
|
||||
const DataModification modType);
|
||||
void onBCContaminationChanged(const AreaEffectSimulation::BCContamination &data,
|
||||
const DataModification modType);
|
||||
void onBoobyTrapChanged(const AreaEffectSimulation::BoobyTrap &data,
|
||||
const DataModification modType);
|
||||
void onOffRouteMineChanged(const AreaEffectSimulation::OffRouteMine &data,
|
||||
const DataModification modType);
|
||||
|
||||
private:
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
|
||||
QMap<int, int> m_partId2EquipNoMap; ///< Reference map participant (player) to equipment number (participantId, equipmentNo)
|
||||
QHash<int, QString> m_idDesignatorMap;
|
||||
QHash<int, QString> m_idTactIdentifierMap;
|
||||
QHash<int, QString> m_aesNameMap; // key = aesId, name = aesName
|
||||
|
||||
friend class AlarmHistoryProxyModel;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
class ALMCOMMON_EXPORT AlarmHistoryProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
|
||||
private:
|
||||
AlarmHistoryModel *m_sourceModel = nullptr;
|
||||
};
|
||||
} //namespace AlarmManagement
|
||||
@@ -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>
|
||||
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Hannes Baeuerle, SLSE, 2017-02-24
|
||||
#
|
||||
|
||||
|
||||
SET(alm_online_reports_gui_SRCS
|
||||
alm_participant_model.h
|
||||
alm_participant_model.cpp
|
||||
alm_participant_gui_plugin.h
|
||||
alm_participant_gui_plugin.cpp
|
||||
alm_config_participant_dialog.h
|
||||
alm_config_participant_dialog.cpp
|
||||
alm_participant_dialog.h
|
||||
alm_participant_dialog.cpp
|
||||
alm_participant_show_config.cpp
|
||||
alm_participant_show_config.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI (alm_online_reports_gui_SRCS
|
||||
alm_config_participant_dialog.ui
|
||||
alm_participant_dialog.ui
|
||||
alm_participant_show_config.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS AlmOnlineReportsGuiPlugin MODULE ${alm_online_reports_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(AlmOnlineReportsGuiPlugin
|
||||
LtsPrinting
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
AlmGuiPluginInterface
|
||||
AlmDataPluginInterface
|
||||
svcPdmCommon # pdm_translation.h in alm_dialog.cpp
|
||||
svcAesCommon
|
||||
GuiPluginInterface
|
||||
Qt5::Widgets
|
||||
PpmCommon
|
||||
AlmCommon
|
||||
LtsUtilsGuiDds
|
||||
LtsUtilsSettings
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(AlmOnlineReportsGuiPlugin)
|
||||
+326
@@ -0,0 +1,326 @@
|
||||
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Dialog to create a new online report
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-27
|
||||
*/
|
||||
|
||||
#include "alm_config_participant_dialog.h"
|
||||
#include "ui_alm_config_participant_dialog.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
#include <Plugins/ParticipantManagement/Gui/Common/participant_vulnerability_types.h>
|
||||
|
||||
namespace ParticipantAlarms
|
||||
{
|
||||
ConfigParticipantsDialog::ConfigParticipantsDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_ui(new Ui::ConfigParticipantsDialog)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_typeClass(ParticipantManagement::TypeClass::Human)
|
||||
, m_logger(AlarmManagement::getLogger("ConfigParticipantsDialog"))
|
||||
{
|
||||
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
|
||||
const bool enableNuclearContaminations = ps->value(QStringLiteral("aes"),
|
||||
QStringLiteral("enableNuclearContaminations")).toBool();
|
||||
const bool enableMineAreas = ps->value(QStringLiteral("aes"),
|
||||
QStringLiteral("enableMineAreas")).toBool();
|
||||
m_ui->setupUi(this);
|
||||
|
||||
if (!enableNuclearContaminations)
|
||||
{
|
||||
m_ui->cbxNbcAgent->hide();
|
||||
}
|
||||
if (!enableMineAreas)
|
||||
{
|
||||
m_ui->cbxMines->hide();
|
||||
m_ui->cbxIndirectFire->hide();
|
||||
}
|
||||
|
||||
#ifdef ETS_MODE
|
||||
//hide Mil Things
|
||||
m_ui->cbxFriendlyFire->hide();
|
||||
m_ui->cbStatusFriendly->hide();
|
||||
#endif
|
||||
|
||||
setNoTopicLock(); // as this topic is only related to an operator
|
||||
}
|
||||
|
||||
ConfigParticipantsDialog::~ConfigParticipantsDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void ConfigParticipantsDialog::retranslate()
|
||||
{
|
||||
if (!m_participantData.equipmentNumber().is_set())
|
||||
{
|
||||
QString hierarchy = m_ppmDtc->hierarchyFromParticipant(m_participantData.id());
|
||||
translate(m_ui, m_participantData, hierarchy, tr("Participant Alarm"));
|
||||
}
|
||||
else
|
||||
translate(m_ui, m_participantData, QString::number(m_participantData.equipmentNumber().get()), tr("Participant Alarm"));
|
||||
|
||||
m_uiRequirements->clear();
|
||||
m_uiRequirements->addRequirement( { m_ui->lbReaction, [this]() { return m_ui->cbxSetMarker->isChecked() || m_ui->cbxMessageWindow->isChecked(); }, tr("Select at least one reaction") });
|
||||
}
|
||||
|
||||
bool ConfigParticipantsDialog::init(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Dtc> &almDtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Ftc> &almFtc,
|
||||
const ParticipantManagement::ParticipantData &participantData,
|
||||
const std::vector<int> &participantVector,
|
||||
const std::vector<int> &equipmentVector)
|
||||
{
|
||||
if (!ppmDtc || !almDtc || !almFtc)
|
||||
return false;
|
||||
|
||||
m_ppmDtc = ppmDtc;
|
||||
m_almFtc = almFtc;
|
||||
m_almDtc = almDtc;
|
||||
m_participantVector = participantVector;
|
||||
m_participantData = participantData;
|
||||
|
||||
m_operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
|
||||
|
||||
m_ui->lbHierarchy->setText(m_ppmDtc->hierarchyFromParticipant(m_participantData.id()));
|
||||
|
||||
QString equipmentNumbersStr;
|
||||
if (participantData.equipmentNumber().is_set())
|
||||
{
|
||||
equipmentNumbersStr.append(QString::number(participantData.equipmentNumber().get()));
|
||||
equipmentNumbersStr.append(QStringLiteral(": "));
|
||||
}
|
||||
|
||||
for (const int equipNo : equipmentVector)
|
||||
equipmentNumbersStr += QString::number(equipNo) + QStringLiteral(", ");
|
||||
equipmentNumbersStr.chop(2);
|
||||
|
||||
m_ui->equipmentNoContent->setText(equipmentNumbersStr);
|
||||
|
||||
DEBUG_LOG(m_logger) << "current participantId = " << participantData.id();
|
||||
|
||||
m_typeClass = ppmDtc->type(participantData.typeId()).typeClass();
|
||||
DEBUG_LOG(m_logger) << "m_typeClass=" << m_typeClass << " TypeId=" << participantData.typeId();
|
||||
fillCbx();
|
||||
|
||||
m_almDtc->alarmConfigs([this](const AlarmManagement::AlarmConfig &alarm) { setAlaramData(alarm); });
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig &alarm)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "setAlaramData:" << alarm;
|
||||
if (alarm.operatorId() != m_operatorId ||
|
||||
alarm.participantId() != m_participantData.id() ||
|
||||
alarm.global())
|
||||
return;
|
||||
|
||||
switch (alarm.eventTypeId().underlying())
|
||||
{
|
||||
case ProjectDataManagement::EventType_def::Hit:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Hit zuweisen ";
|
||||
m_ui->cbxDirectFire->setChecked(true);
|
||||
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
|
||||
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
|
||||
if (alarm.vulnerabilityState() >= 0)
|
||||
{
|
||||
ProjectDataManagement::VulnerabilityState vulState = static_cast<ProjectDataManagement::VulnerabilityState_def::type>(alarm.vulnerabilityState());
|
||||
int index = m_ui->cbStatusDirect->findData(QVariant(vulState.underlying()));
|
||||
m_ui->cbStatusDirect->setCurrentIndex(index);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::HitEffectSimulation:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "HitIndirect zuweisen ";
|
||||
m_ui->cbxIndirectFire->setChecked(true);
|
||||
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
|
||||
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::AirSupport:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "AirSupport zuweisen ";
|
||||
m_ui->cbxAirSupport->setChecked(true);
|
||||
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
|
||||
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::HitMine:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "HitMine zuweisen ";
|
||||
m_ui->cbxMines->setChecked(true);
|
||||
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
|
||||
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::HitB:
|
||||
case ProjectDataManagement::EventType_def::HitN:
|
||||
case ProjectDataManagement::EventType_def::HitC:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Hit N/B/C zuweisen ";
|
||||
m_ui->cbxNbcAgent->setChecked(true);
|
||||
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
|
||||
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::FriendlyFire:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "FriendlyFire zuweisen ";
|
||||
m_ui->cbxFriendlyFire->setChecked(true);
|
||||
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
|
||||
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
|
||||
if (alarm.vulnerabilityState() >= 0)
|
||||
{
|
||||
ProjectDataManagement::VulnerabilityState vulState = static_cast<ProjectDataManagement::VulnerabilityState_def::type>(alarm.vulnerabilityState());
|
||||
int index = m_ui->cbStatusDirect->findData(QVariant(vulState.underlying()));
|
||||
m_ui->cbStatusFriendly->setCurrentIndex(index);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::Manipulation:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Manipulation zuweisen ";
|
||||
m_ui->cbxManipulation->setChecked(true);
|
||||
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
|
||||
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::CrossGlobalBorderline:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CrossGlobalBorderline zuweisen ";
|
||||
m_ui->cbxGlobalBorderLine->setChecked(true);
|
||||
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
|
||||
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::EventType_def::CrossLocalBorderline:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CrossLocalBorderline zuweisen ";
|
||||
m_ui->cbxLocalBorderLine->setChecked(true);
|
||||
m_ui->cbxSetMarker->setChecked(alarm.setMarker());
|
||||
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Not possible to set with Operator App!!!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<AlarmManagement::AlarmAction> ConfigParticipantsDialog::getCheckedValues() const
|
||||
{
|
||||
AlarmManagement::AlarmAction alarmActionDds;
|
||||
DEBUG_LOG(m_logger) << "getCheckedValues";
|
||||
|
||||
std::vector<AlarmManagement::AlarmAction> alarmsDds;
|
||||
|
||||
alarmActionDds.setMarker(m_ui->cbxSetMarker->isChecked());
|
||||
alarmActionDds.messageWindow(m_ui->cbxMessageWindow->isChecked());
|
||||
alarmActionDds.vulnerabilityState(-1); // Default All Types
|
||||
|
||||
if (alarmActionDds.setMarker() || alarmActionDds.messageWindow())
|
||||
{
|
||||
if (m_ui->cbxDirectFire->isChecked())
|
||||
{
|
||||
alarmActionDds.eventTypeId(ProjectDataManagement::EventType_def::Hit);
|
||||
int statusDirect = -1;
|
||||
if (m_ui->cbStatusDirect->currentIndex() > 0)
|
||||
statusDirect = m_ui->cbStatusDirect->currentData().toInt();
|
||||
alarmActionDds.vulnerabilityState(statusDirect);
|
||||
alarmsDds.push_back(alarmActionDds);
|
||||
}
|
||||
if (m_ui->cbxFriendlyFire->isChecked())
|
||||
{
|
||||
alarmActionDds.eventTypeId(ProjectDataManagement::EventType_def::FriendlyFire);
|
||||
int statusFriendly = -1;
|
||||
if (m_ui->cbStatusFriendly->currentIndex() > 0)
|
||||
statusFriendly = m_ui->cbStatusFriendly->currentData().toInt();
|
||||
alarmActionDds.vulnerabilityState(statusFriendly);
|
||||
alarmsDds.push_back(alarmActionDds);
|
||||
}
|
||||
alarmActionDds.vulnerabilityState(-1); // Default All Types
|
||||
if (m_ui->cbxIndirectFire->isChecked())
|
||||
{
|
||||
alarmActionDds.eventTypeId(ProjectDataManagement::EventType_def::HitEffectSimulation);
|
||||
alarmsDds.push_back(alarmActionDds);
|
||||
}
|
||||
if (m_ui->cbxAirSupport->isChecked())
|
||||
{
|
||||
alarmActionDds.eventTypeId(ProjectDataManagement::EventType_def::AirSupport);
|
||||
alarmsDds.push_back(alarmActionDds);
|
||||
}
|
||||
if (m_ui->cbxMines->isChecked())
|
||||
{
|
||||
alarmActionDds.eventTypeId(ProjectDataManagement::EventType_def::HitMine);
|
||||
alarmsDds.push_back(alarmActionDds);
|
||||
}
|
||||
if (m_ui->cbxNbcAgent->isChecked())
|
||||
{
|
||||
alarmActionDds.eventTypeId(ProjectDataManagement::EventType_def::HitN);
|
||||
alarmsDds.push_back(alarmActionDds);
|
||||
alarmActionDds.eventTypeId(ProjectDataManagement::EventType_def::HitB);
|
||||
alarmsDds.push_back(alarmActionDds);
|
||||
alarmActionDds.eventTypeId(ProjectDataManagement::EventType_def::HitC);
|
||||
alarmsDds.push_back(alarmActionDds);
|
||||
}
|
||||
if (m_ui->cbxManipulation->isChecked())
|
||||
{
|
||||
alarmActionDds.eventTypeId(ProjectDataManagement::EventType_def::Manipulation);
|
||||
alarmsDds.push_back(alarmActionDds);
|
||||
}
|
||||
if (m_ui->cbxGlobalBorderLine->isChecked())
|
||||
{
|
||||
alarmActionDds.eventTypeId(ProjectDataManagement::EventType_def::CrossGlobalBorderline);
|
||||
alarmsDds.push_back(alarmActionDds);
|
||||
}
|
||||
if (m_ui->cbxLocalBorderLine->isChecked())
|
||||
{
|
||||
alarmActionDds.eventTypeId(ProjectDataManagement::EventType_def::CrossLocalBorderline);
|
||||
alarmsDds.push_back(alarmActionDds);
|
||||
}
|
||||
}
|
||||
return alarmsDds;
|
||||
}
|
||||
|
||||
bool ConfigParticipantsDialog::apply()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "apply";
|
||||
AlarmManagement::ConfigureAlarmsRequest req;
|
||||
req.participantIds(m_participantVector);
|
||||
req.alarms(getCheckedValues());
|
||||
req.operatorId(m_operatorId);
|
||||
req.global(false);
|
||||
req.remove(false);
|
||||
|
||||
return m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_almFtc->configureAlarmsRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigParticipantsDialog::fillCbx()
|
||||
{
|
||||
m_ui->cbStatusDirect->clear();
|
||||
m_ui->cbStatusFriendly->clear();
|
||||
//Vulnerability
|
||||
m_ui->cbStatusDirect->addItem(tr("All Types"), -1);
|
||||
m_ui->cbStatusFriendly->addItem(tr("All Types"), -1);
|
||||
ParticipantManagement::insertVulnerabilityStates(m_ui->cbStatusDirect, m_typeClass);
|
||||
ParticipantManagement::insertVulnerabilityStates(m_ui->cbStatusFriendly, m_typeClass);
|
||||
m_ui->cbStatusDirect->removeItem(m_ui->cbStatusDirect->findData(ProjectDataManagement::VulnerabilityState::TemporarySeverance));
|
||||
m_ui->cbStatusFriendly->removeItem(m_ui->cbStatusDirect->findData(ProjectDataManagement::VulnerabilityState::TemporarySeverance));
|
||||
}
|
||||
|
||||
} // namespace ParticipantAlarms
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Dialog to create a new online report
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-27
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <memory>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
#include <Services/AlarmManagement/alm_dtc.h>
|
||||
#include <Services/AlarmManagement/alm_ftc.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <AlarmManagement/logger.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ConfigParticipantsDialog;
|
||||
}
|
||||
|
||||
namespace ParticipantAlarms
|
||||
{
|
||||
class ConfigParticipantsDialog : public LtsWidgets::LtsDialog
|
||||
, protected AlarmManagement::Interface::Ftc::ConfigureAlarmsReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConfigParticipantsDialog(QWidget *parent = nullptr);
|
||||
~ConfigParticipantsDialog();
|
||||
|
||||
bool init(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Dtc> &almDtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Ftc> &almFtc,
|
||||
const ParticipantManagement::ParticipantData &participantData,
|
||||
const std::vector<int> &participantVector,
|
||||
const std::vector<int> &equipmentVector);
|
||||
|
||||
protected:
|
||||
void onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
private: // methods
|
||||
void retranslate() override;
|
||||
bool apply() override;
|
||||
std::vector<AlarmManagement::AlarmAction> getCheckedValues() const;
|
||||
void fillCbx();
|
||||
void setAlaramData(const AlarmManagement::AlarmConfig &alarm);
|
||||
|
||||
private: // attributes
|
||||
Ui::ConfigParticipantsDialog *m_ui;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_almDtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> m_almFtc;
|
||||
int m_operatorId;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
std::vector<int> m_participantVector;
|
||||
ParticipantManagement::TypeClass m_typeClass;
|
||||
ParticipantManagement::ParticipantData m_participantData;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace ParticipantAlarms
|
||||
+267
@@ -0,0 +1,267 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ConfigParticipantsDialog</class>
|
||||
<widget class="QWidget" name="ConfigParticipantsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>323</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Messaging View</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="designatorName">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hierarchy:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lbHierarchy">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="equipmentNoName">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Equip. No.:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="equipmentNoContent">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Hit</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cbxIndirectFire">
|
||||
<property name="text">
|
||||
<string>Indirect Fire</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="cbxNbcAgent">
|
||||
<property name="text">
|
||||
<string>N/B/C Agents</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="cbxDirectFire">
|
||||
<property name="text">
|
||||
<string>Direct Fire</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbStatusDirect">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="cbxMines">
|
||||
<property name="text">
|
||||
<string>Mines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="cbxFriendlyFire">
|
||||
<property name="text">
|
||||
<string>Friendly Fire</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<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="5" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbStatusFriendly">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="cbxManipulation">
|
||||
<property name="text">
|
||||
<string>Manipulation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="cbxAirSupport">
|
||||
<property name="text">
|
||||
<string>Air Support</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_11">
|
||||
<property name="title">
|
||||
<string>Cross</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="cbxGlobalBorderLine">
|
||||
<property name="text">
|
||||
<string>Global Borderline</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cbxLocalBorderLine">
|
||||
<property name="text">
|
||||
<string>Local Borderline</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_13">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cbxSetMarker">
|
||||
<property name="text">
|
||||
<string>Set Marker</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="cbxMessageWindow">
|
||||
<property name="text">
|
||||
<string>Message Window</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="lbReaction">
|
||||
<property name="text">
|
||||
<string>Reaction</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="4">
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>cbxDirectFire</tabstop>
|
||||
<tabstop>cbStatusDirect</tabstop>
|
||||
<tabstop>cbxIndirectFire</tabstop>
|
||||
<tabstop>cbxNbcAgent</tabstop>
|
||||
<tabstop>cbxMines</tabstop>
|
||||
<tabstop>cbxFriendlyFire</tabstop>
|
||||
<tabstop>cbStatusFriendly</tabstop>
|
||||
<tabstop>cbxManipulation</tabstop>
|
||||
<tabstop>cbxGlobalBorderLine</tabstop>
|
||||
<tabstop>cbxLocalBorderLine</tabstop>
|
||||
<tabstop>cbxSetMarker</tabstop>
|
||||
<tabstop>cbxMessageWindow</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Dialog to create a new online report
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-27
|
||||
*/
|
||||
|
||||
#include "alm_participant_dialog.h"
|
||||
#include "ui_alm_participant_dialog.h"
|
||||
#include "alm_config_participant_dialog.h"
|
||||
#include "alm_participant_model.h"
|
||||
|
||||
#include <AdvancedSymbology/asb_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/Gui/Common/participant_edit_model.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
|
||||
#include <QTreeView>
|
||||
#include <LtsPrinting/printing.h>
|
||||
|
||||
namespace ParticipantAlarms
|
||||
{
|
||||
int ParticipantsDialog::s_preselectedParty = -1;
|
||||
|
||||
ParticipantsDialog::ParticipantsDialog(const QString &menuGroup, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent)
|
||||
, m_session(nullptr)
|
||||
, m_almDtc(nullptr)
|
||||
, m_almFtc(nullptr)
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_participantModel(nullptr)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_ui(new Ui::ParticipantsDialog)
|
||||
, m_logger(AlarmManagement::getLogger("ParticipantsDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &ParticipantsDialog::onAddButtonClicked);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &ParticipantsDialog::onPrint);
|
||||
//m_buttonBox->getButton(LtsWidgets::DialogButton::_change_)->hide();
|
||||
|
||||
m_ui->cbAllParticipants->setVisible(false);
|
||||
// m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Add, false);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Assign_Participant_Alarms"));
|
||||
}
|
||||
|
||||
ParticipantsDialog::~ParticipantsDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void ParticipantsDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Assign Participant Alarms"));
|
||||
}
|
||||
|
||||
bool ParticipantsDialog::init(LtsSession::LtsSession *session,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Dtc> &almDtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Ftc> &almFtc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc)
|
||||
{
|
||||
m_ppmDtc = ppmDtc;
|
||||
m_almDtc = almDtc;
|
||||
m_almFtc = almFtc;
|
||||
m_session = session;
|
||||
|
||||
if (m_ppmDtc == nullptr ||
|
||||
!ppmDtc->enableDynamicParticipantData() ||
|
||||
!ppmDtc->enableParticipant())
|
||||
return false;
|
||||
|
||||
if (m_almFtc == nullptr ||
|
||||
!almFtc->enableConfigureAlarms())
|
||||
return false;
|
||||
|
||||
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> asbIfc;
|
||||
m_session->getForeignDataInterface<AdvancedSymbology::DataInterface>(asbIfc);
|
||||
m_participantModel = new ParticipantAlarms::ParticipantAlarmModel(this,
|
||||
m_ppmDtc,
|
||||
asbIfc);
|
||||
m_participantProxyModel = new ParticipantManagement::ParticipantTreeFilterProxyModel(this);
|
||||
m_participantProxyModel->setSourceModel(m_participantModel);
|
||||
m_participantProxyModel->setRecursiveFilteringEnabled(true);
|
||||
|
||||
m_ui->dvParticipants->setModel(m_participantProxyModel);
|
||||
connect(m_ui->cbParty,
|
||||
static_cast<void (LtsWidgets::LtsComboBox::*)(int)>(&LtsWidgets::LtsComboBox::currentIndexChanged),
|
||||
this, &ParticipantsDialog::onCbPartyChanged);
|
||||
connect(m_ui->cbAllParticipants, &QCheckBox::clicked,
|
||||
m_ui->dvParticipants, &LtsDataView::LtsDataView::setDisabled);
|
||||
connect(m_ui->dvParticipants, &LtsDataView::LtsDataView::selectionChanged,
|
||||
this, &ParticipantsDialog::onSelectionChanged);
|
||||
connect(m_ui->dvParticipants, &LtsDataView::LtsDataView::signalDoubleClicked,
|
||||
this, &ParticipantsDialog::onDoubleClicked);
|
||||
connect(m_ui->cbAllParticipants, &QCheckBox::clicked,
|
||||
this, [this](bool checked)
|
||||
{
|
||||
if (checked)
|
||||
m_ui->dvParticipants->treeView()->selectAll();
|
||||
else
|
||||
m_ui->dvParticipants->treeView()->clearSelection();
|
||||
});
|
||||
|
||||
ppmGuiCbxIfc->fillPartyComboBox(m_ui->cbParty);
|
||||
const int idx = m_ui->cbParty->findData(s_preselectedParty);
|
||||
if (idx >= 0)
|
||||
m_ui->cbParty->setCurrentIndex(idx);
|
||||
onCbPartyChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ParticipantsDialog::onSelectionChanged()
|
||||
{
|
||||
bool configureAlarms = false;
|
||||
DEBUG_LOG(m_logger) << "onSelectionChanged";
|
||||
const QModelIndexList currentlySelectedParticipants = m_ui->dvParticipants->selectedRows();
|
||||
|
||||
for (const QModelIndex &index : currentlySelectedParticipants)
|
||||
{
|
||||
const ParticipantManagement::ParticipantData data(m_participantModel->getParticipantData(index));
|
||||
if ((data.equipmentNumber().is_set() && data.equipmentNumber().get() > 0) ||
|
||||
m_ppmDtc->type(data.typeId()).typeClass() == ParticipantManagement::TypeClass_def::Unit)
|
||||
configureAlarms = true;
|
||||
DEBUG_LOG(m_logger) << "setChildrenSelected row =" << index.row() << " column=" << index.column();
|
||||
|
||||
}
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, configureAlarms);
|
||||
}
|
||||
|
||||
void ParticipantsDialog::onCbPartyChanged()
|
||||
{
|
||||
const int curPartyId = m_ui->cbParty->currentData().toInt();
|
||||
s_preselectedParty = curPartyId;
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
|
||||
m_participantModel->onReinitModel(curPartyId);
|
||||
m_ui->dvParticipants->expandAll();
|
||||
if (m_ui->cbAllParticipants->isChecked())
|
||||
m_ui->dvParticipants->treeView()->selectAll();
|
||||
m_ui->dvParticipants->resizeHeadersByContent();
|
||||
}
|
||||
|
||||
void ParticipantsDialog::onAddButtonClicked()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onAddButtonClicked";
|
||||
// get participant IDs ---
|
||||
m_participantVector.clear();
|
||||
m_equipmentVector.clear();
|
||||
if (!m_ui->cbAllParticipants->isChecked())
|
||||
{
|
||||
const QModelIndexList currentlySelectedParticipants = m_ui->dvParticipants->selectedRows();
|
||||
|
||||
for (const QModelIndex &index : currentlySelectedParticipants)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "setChildrenSelected: " << index.row() << " column=" << index.column();
|
||||
setChildrenSelected(index);
|
||||
}
|
||||
}
|
||||
|
||||
QModelIndex participantIndex = m_ui->dvParticipants->currentIndex();
|
||||
ParticipantManagement::ParticipantData data = m_participantModel->getParticipantData(participantIndex);
|
||||
DEBUG_LOG(m_logger) << "current participantId = " << data.id();
|
||||
m_participantVector.push_back(data.id());
|
||||
|
||||
const auto partData = m_participantModel->getParticipantData(participantIndex);
|
||||
addDialog(LtsWidgets::initDialog(new ConfigParticipantsDialog(this),
|
||||
m_ppmDtc, m_almDtc, m_almFtc, partData, m_participantVector, m_equipmentVector),
|
||||
m_menuGroup, QStringLiteral("ConfigAlarms%1").arg(partData.id()));
|
||||
}
|
||||
|
||||
void ParticipantsDialog::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->dvParticipants->treeView());
|
||||
}
|
||||
|
||||
void ParticipantsDialog::setChildrenSelected(const QModelIndex &parent)
|
||||
{
|
||||
if (!(parent.isValid() &&
|
||||
m_participantModel->hasChildren(parent)))
|
||||
return;
|
||||
|
||||
const int rc = m_participantModel->rowCount(parent);
|
||||
for (int currentRow = 0; currentRow < rc; ++currentRow)
|
||||
{
|
||||
QModelIndex childIndex = m_participantModel->index(currentRow, 0, parent);
|
||||
|
||||
if (m_participantModel->hasChildren(childIndex))
|
||||
setChildrenSelected(childIndex);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Setting row "
|
||||
<< childIndex.row()
|
||||
<< " selected";
|
||||
|
||||
ParticipantManagement::ParticipantData data = m_participantModel->getParticipantData(childIndex);
|
||||
DEBUG_LOG(m_logger) << "append participantId = " << data.id();
|
||||
m_participantVector.push_back(data.id());
|
||||
if (data.equipmentNumber().is_set())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "append equipmentNumber = " << data.equipmentNumber().get();
|
||||
m_equipmentVector.push_back(data.equipmentNumber().get());
|
||||
}
|
||||
|
||||
m_ui->dvParticipants->selectionModel()->select(m_participantProxyModel->mapFromSource(childIndex), QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
}
|
||||
}
|
||||
|
||||
void ParticipantsDialog::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->dvParticipants->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
void ParticipantsDialog::onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onConfigureAlarmsReply" << replyObject.str();
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
void ParticipantsDialog::onDoubleClicked()
|
||||
{
|
||||
if (!m_buttonBox->isButtonEnabled(LtsWidgets::DialogButton::Edit))
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "onDoubleClicked";
|
||||
onAddButtonClicked();
|
||||
}
|
||||
|
||||
} // namespace Messaging
|
||||
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Dialog to create a new online report
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-27
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "alm_participant_model.h"
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <memory>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
#include <Services/AlarmManagement/alm_dtc.h>
|
||||
#include <Services/AlarmManagement/alm_ftc.h>
|
||||
#include <Services/AlarmManagement/alm.hpp>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ParticipantsDialog;
|
||||
}
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class ParticipantTreeFilterProxyModel;
|
||||
class ForeignGuiComboboxInterface;
|
||||
}
|
||||
|
||||
namespace ParticipantAlarms
|
||||
{
|
||||
class TypeModel;
|
||||
|
||||
class ParticipantsDialog : public LtsWidgets::LtsDialog
|
||||
, protected AlarmManagement::Interface::Ftc::ConfigureAlarmsReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ParticipantsDialog(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~ParticipantsDialog();
|
||||
|
||||
bool init(LtsSession::LtsSession *session,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Dtc> &almDtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Ftc> &almFtc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc);
|
||||
|
||||
protected:
|
||||
void onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
|
||||
private slots:
|
||||
void onAddButtonClicked();
|
||||
void onPrint();
|
||||
void onCbPartyChanged();
|
||||
void onDoubleClicked();
|
||||
void onSelectionChanged();
|
||||
|
||||
private: // methods
|
||||
void retranslate() override;
|
||||
void setChildrenSelected(const QModelIndex &parent);
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
private: // attributes
|
||||
LtsSession::LtsSession *m_session;
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_almDtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> m_almFtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
ParticipantAlarmModel *m_participantModel;
|
||||
ParticipantManagement::ParticipantTreeFilterProxyModel *m_participantProxyModel;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
std::vector<int> m_participantVector;
|
||||
std::vector<int> m_equipmentVector;
|
||||
QString m_menuGroup;
|
||||
static int s_preselectedParty;
|
||||
Ui::ParticipantsDialog *m_ui;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace OnlineReports
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ParticipantsDialog</class>
|
||||
<widget class="QWidget" name="ParticipantsDialog">
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Messaging View</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbParty">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="cbAllParticipants">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblParty">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Party:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4">
|
||||
<widget class="LtsDataView::LtsDataView" name="dvParticipants">
|
||||
<property name="showColumnCount" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolButtonsVisible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>cbParty</tabstop>
|
||||
<tabstop>cbAllParticipants</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for OnlineReports
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-27
|
||||
*/
|
||||
|
||||
#include "alm_participant_gui_plugin.h"
|
||||
#include "alm_participant_dialog.h"
|
||||
#include "alm_participant_show_config.h"
|
||||
|
||||
#include <AlarmManagement/alm_data_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <AlarmManagement/alm_operator_rights.h>
|
||||
#include <AlarmManagement/logger.h>
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
namespace ParticipantAlarms
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, AlarmManagement::getLogger("OnlineReports"))
|
||||
{
|
||||
}
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
return m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc) &&
|
||||
m_session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc) &&
|
||||
m_session->getDtc<AlarmManagement::DataInterface>(m_almDtc) &&
|
||||
m_session->getFtc<AlarmManagement::DataInterface>(m_almFtc) &&
|
||||
m_session->getForeignGuiInterface<ParticipantManagement::ForeignGuiComboboxInterface>(m_ppmGuiCbxIfc);
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_ppmDtc = nullptr;
|
||||
m_aesDtc = nullptr;
|
||||
m_almDtc = nullptr;
|
||||
m_almFtc = nullptr;
|
||||
m_ppmGuiCbxIfc = nullptr;
|
||||
}
|
||||
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
return tr("Alarm Management");
|
||||
}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
|
||||
plData.menuText = tr("Assign Participant Alarms");
|
||||
plData.identifier = QLatin1String("almDialog");
|
||||
plData.operatorRight = OperatorRights::ConfigParticipantDialog;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.layoutArea = LtsWidgets::LayoutArea::eDialogTab;
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:config_player_alarms.svg"));
|
||||
plData.createWidgetFunc = [this](QWidget *)
|
||||
{
|
||||
return LtsWidgets::initDialog(new ParticipantsDialog(menuGroup()),
|
||||
m_session, m_ppmDtc, m_almDtc, m_almFtc, m_ppmGuiCbxIfc);
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
plData.menuText = tr("Show Config Participant Alarms");
|
||||
plData.identifier = QLatin1String("almShowConfigAlarm");
|
||||
plData.operatorRight = OperatorRights::ConfigParticipantDialog;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.layoutArea = LtsWidgets::LayoutArea::eDialogTab;
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:show_player_alarms.svg"));
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new ParticipantShowConfigView(m_session, parent),
|
||||
m_almDtc, m_almFtc, m_ppmDtc, m_aesDtc);
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace OnlineReports
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for OnlineReports
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-27
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/AlarmManagement/alm_gui_plugin_interface.h>
|
||||
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <AlarmManagement/alm_ftc.h>
|
||||
#include <AlarmManagement/alm_dtc.h>
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class ForeignGuiComboboxInterface;
|
||||
}
|
||||
|
||||
namespace ParticipantAlarms
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:alm.configparticipantalarm")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QLatin1String("AlarmManagement.GuiPlugin.ConfigParticipantAlarm"); }
|
||||
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
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
QString menuGroup() const override;
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
|
||||
private: // attributes
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> m_almFtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_almDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
|
||||
};
|
||||
|
||||
} // namespace OnlineReports
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Model for ParticipantsMoveDialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Gerlinde Rudolphus, SLSE, 2018-01-02
|
||||
*/
|
||||
|
||||
#include "alm_participant_model.h"
|
||||
|
||||
#include <AlarmManagement/logger.h>
|
||||
|
||||
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
|
||||
|
||||
namespace ParticipantAlarms
|
||||
{
|
||||
//----------------------------------------------------------------------------
|
||||
ParticipantAlarmModel::ParticipantAlarmModel(QObject *parent,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc)
|
||||
: ParticipantManagement::ParticipantEditModel(parent, ppmDtc, asbIfc)
|
||||
, m_logger(AlarmManagement::getLogger("ParticipantAlarmModel"))
|
||||
{
|
||||
m_titles += tr("Alarm Assignable");
|
||||
|
||||
DEBUG_LOG(m_logger) << "ParticipantAlarmModel::ParticipantAlarmModel";
|
||||
}
|
||||
|
||||
QVariant ParticipantAlarmModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
// ColSimulated is the last column
|
||||
if (role == Qt::DisplayRole && index.column() == columnCount() - 1)
|
||||
{
|
||||
bool bIsSimulated = false;
|
||||
if (!isSelectableByAlarm(index, &bIsSimulated))
|
||||
return QVariant();
|
||||
return !bIsSimulated ? tr("Yes") : tr("No");
|
||||
}
|
||||
|
||||
return ParticipantManagement::ParticipantEditModel::data(index, role);
|
||||
}
|
||||
|
||||
void ParticipantAlarmModel::onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
if (data.partyId() != partyId())
|
||||
return;
|
||||
|
||||
INFO_LOG(m_logger) << "onParticipantChanged isSimulated=" << data.isSimulated();
|
||||
onReinitModel(partyId());
|
||||
emit newData();
|
||||
}
|
||||
|
||||
bool ParticipantAlarmModel::isSelectableByAlarm(const QModelIndex &index, bool *bIsSimulated) const
|
||||
{
|
||||
bool isSimulatable = false;
|
||||
const ParticipantManagement::ParticipantData data(getParticipantData(index));
|
||||
|
||||
if ((data.equipmentNumber().is_set() && data.equipmentNumber().get() > 0) ||
|
||||
m_dtc->type(data.typeId()).typeClass() == ParticipantManagement::TypeClass_def::Unit)
|
||||
isSimulatable = true;
|
||||
|
||||
DEBUG_LOG(m_logger) << "ParticipantId: " << data.id()
|
||||
<< " isSimulated:" << data.isSimulated()
|
||||
<< " equipmentNo:" << data.equipmentNumber()
|
||||
<< " typeId=" << data.typeId()
|
||||
<< " modId=" << data.modId()
|
||||
<< " typeClass=" << m_dtc->type(data.typeId()).typeClass()
|
||||
<< " isSimulatable=" << isSimulatable;
|
||||
|
||||
if (bIsSimulated)
|
||||
*bIsSimulated = data.isSimulated();
|
||||
|
||||
return isSimulatable;
|
||||
}
|
||||
|
||||
} // namespace ParticipantAlarms
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Model for ParticipantsMoveDialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Gerlinde Rudolphus, SLSE, 2018-01-02
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/ParticipantManagement/Gui/Common/participant_edit_model.h>
|
||||
|
||||
namespace ParticipantAlarms
|
||||
{
|
||||
class ParticipantAlarmModel final : public ParticipantManagement::ParticipantEditModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ParticipantAlarmModel(QObject *parent,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
signals:
|
||||
void newData();
|
||||
|
||||
private:
|
||||
void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType);
|
||||
bool isSelectableByAlarm(const QModelIndex &index, bool *bIsSimulated = nullptr) const;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace ParticipantAlarms
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Messaging - Messaging Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "alm_participant_show_config.h"
|
||||
#include "ui_alm_participant_show_config.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace ParticipantAlarms
|
||||
{
|
||||
|
||||
ParticipantShowConfigView::ParticipantShowConfigView(LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_configAlarmModel(nullptr)
|
||||
, m_alarmHistoryModel(nullptr)
|
||||
, m_dtc(nullptr)
|
||||
, m_almFtc(nullptr)
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::ParticipantShowConfigView)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(AlarmManagement::getLogger("ParticipantShowConfigView"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "--- ParticipantShowConfigView Konstruktor() ";
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
// connects fuer Widgetaenderungen
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &ParticipantShowConfigView::onSelectionChanged);
|
||||
|
||||
// Double Clicked
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked,
|
||||
this, &ParticipantShowConfigView::onShowAlarm);
|
||||
|
||||
// Create Remove-Button
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &ParticipantShowConfigView::onRemoveAlarm);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &ParticipantShowConfigView::onPrint);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Show_Config_Participant_Alarms"));
|
||||
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ParticipantShowConfigView::~ParticipantShowConfigView()
|
||||
{
|
||||
INFO_LOG(m_logger) << "--- ParticipantShowConfigView Destruktor() ";
|
||||
delete m_ui;
|
||||
} // end of dtor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ParticipantShowConfigView::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Show Config Participant Alarms"));
|
||||
}
|
||||
|
||||
bool ParticipantShowConfigView::init(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc)
|
||||
{
|
||||
INFO_LOG(m_logger) << "--- init() ";
|
||||
if (!dtc || !ftc)
|
||||
return false;
|
||||
|
||||
m_dtc = dtc;
|
||||
m_almFtc = ftc;
|
||||
m_alarmHistoryModel = new AlarmManagement::AlarmHistoryModel(this);
|
||||
m_alarmHistoryModel->initModel(dtc, ppmDtc, aesDtc);
|
||||
|
||||
DEBUG_LOG(m_logger) << "--- ParticipantShowConfigView::init ";
|
||||
m_configAlarmModel = new AlarmManagement::ConfigAlarmModel(this);
|
||||
m_configAlarmModel->initModel(m_dtc, ppmDtc, m_alarmHistoryModel, false);
|
||||
m_ui->widget->setModel(m_configAlarmModel);
|
||||
return true;
|
||||
} // end of init()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ParticipantShowConfigView::onSelectionChanged()
|
||||
{
|
||||
QModelIndexList selectedRows = m_ui->widget->selectedRows();
|
||||
const int cntSelectedRows = selectedRows.size();
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, cntSelectedRows == 1);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, cntSelectedRows == 1);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, cntSelectedRows == 1);
|
||||
} // end of onSelectionChanged()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ParticipantShowConfigView::onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
DEBUG_LOG(m_logger)<<"onConfigureAlarmsReply"<<replyObject.str();
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
} // end of onConfigureAlarmsReply
|
||||
|
||||
void ParticipantShowConfigView::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
void ParticipantShowConfigView::onShowAlarm()
|
||||
{
|
||||
INFO_LOG(m_logger) << "--- onShowAlarm() ";
|
||||
} // end of onShowAlarm()
|
||||
|
||||
|
||||
// Window to remove an Alarm
|
||||
void ParticipantShowConfigView::onRemoveAlarm()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onRemoveAlarm"
|
||||
<< " id = "<< m_configAlarmModel->getRowData(m_ui->widget->currentIndex().row()).id()
|
||||
<< " eventTypeId = "<< m_configAlarmModel->getRowData(m_ui->widget->currentIndex().row()).eventTypeId()
|
||||
<< " operatorId = "<< m_configAlarmModel->getRowData(m_ui->widget->currentIndex().row()).operatorId()
|
||||
<< " participantId = "<< m_configAlarmModel->getRowData(m_ui->widget->currentIndex().row()).participantId();
|
||||
|
||||
const QModelIndex curIdx = m_ui->widget->currentIndex();
|
||||
if (!curIdx.isValid())
|
||||
return;
|
||||
const AlarmManagement::AlarmConfig &rowdata = m_configAlarmModel->getRowData(curIdx.row());
|
||||
int operatorId = rowdata.operatorId();
|
||||
std::vector<int32_t> ddsParticipantIds;
|
||||
ddsParticipantIds.push_back(rowdata.participantId());
|
||||
bool globalEvent = true;
|
||||
bool remove = true;
|
||||
std::vector<AlarmManagement::AlarmAction> alarmsDds;
|
||||
alarmsDds.resize(1);
|
||||
alarmsDds[0].setMarker(false);
|
||||
alarmsDds[0].messageWindow(false);
|
||||
alarmsDds[0].eventTypeId(rowdata.eventTypeId());
|
||||
AlarmManagement::ConfigureAlarmsRequest request(alarmsDds, operatorId, ddsParticipantIds, globalEvent, remove);
|
||||
|
||||
m_requestHelper->startSingleRequest([request, this]()
|
||||
{
|
||||
return m_almFtc->configureAlarmsRequest(request, this);
|
||||
|
||||
});
|
||||
|
||||
} // end of onRemoveAlarm()
|
||||
|
||||
// print window items
|
||||
void ParticipantShowConfigView::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView() );
|
||||
}
|
||||
|
||||
} // namespace ParticipantAlarms
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Messaging - Messaging Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Services/AlarmManagement/alm_dtc.h>
|
||||
#include <Services/AlarmManagement/alm_ftc.h>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <Plugins/AlarmManagement/Gui/Common/alm_config_alarm_model.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ParticipantShowConfigView;
|
||||
}
|
||||
namespace ParticipantAlarms
|
||||
{
|
||||
|
||||
class ParticipantShowConfigView : public LtsWidgets::LtsDialog
|
||||
, protected AlarmManagement::Interface::Ftc::ConfigureAlarmsReplyHandler
|
||||
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ParticipantShowConfigView(LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~ParticipantShowConfigView();
|
||||
|
||||
bool init(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<AlarmManagement::Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc);
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void retranslate() override;
|
||||
void onSelectionChanged();
|
||||
void onShowAlarm();
|
||||
void onRemoveAlarm();
|
||||
void onPrint();
|
||||
|
||||
protected:
|
||||
void onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
|
||||
private:
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
private:
|
||||
AlarmManagement::ConfigAlarmModel *m_configAlarmModel;
|
||||
AlarmManagement::AlarmHistoryModel *m_alarmHistoryModel;
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> m_almFtc;
|
||||
|
||||
LtsSession::LtsSession *m_session;
|
||||
Ui::ParticipantShowConfigView *m_ui;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
|
||||
AlarmManagement::LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace ParticipantAlarms
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ParticipantShowConfigView</class>
|
||||
<widget class="QWidget" name="ParticipantShowConfigView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>455</width>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">ShowConfigView</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>
|
||||
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Patric Karwat, SLSE, 2016-10-05
|
||||
#
|
||||
|
||||
SET(alm_emergency_call_gui_SRCS
|
||||
|
||||
alm_emergency_call_gui_plugin.cpp
|
||||
alm_emergency_call_gui_plugin.h
|
||||
alm_emergency_call_dialog.cpp
|
||||
alm_emergency_call_dialog.h
|
||||
alm_emergency_call_model.cpp
|
||||
alm_emergency_call_model.h
|
||||
alm_emergency_call_info_dialog.cpp
|
||||
alm_emergency_call_info_dialog.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(alm_emergency_call_gui_SRCS
|
||||
alm_emergency_call_dialog.ui
|
||||
alm_emergency_call_info_dialog.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS AlmEmergencyCallGuiPlugin MODULE ${alm_emergency_call_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(AlmEmergencyCallGuiPlugin
|
||||
LtsPrinting
|
||||
AlmCommon
|
||||
svcTabCommon
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
LtsUtilsSettings
|
||||
#AlmGuiPluginInterface
|
||||
AlmInfoGuiPluginInterface
|
||||
AlmDataPluginInterface
|
||||
OpmDataPluginInterface
|
||||
ExmDataPluginInterface
|
||||
#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(AlmEmergencyCallGuiPlugin)
|
||||
+284
@@ -0,0 +1,284 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AlarmManagement (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Steve Kemayou, SLSE, 2023-05-26
|
||||
*/
|
||||
|
||||
#include "alm_emergency_call_dialog.h"
|
||||
#include "ui_alm_emergency_call_dialog.h"
|
||||
#include "AlarmManagement/Gui/EmergencyCalls/alm_emergency_call_model.h"
|
||||
#include <Services/AlarmManagement/alm_operator_rights.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <ExerciseManagement/exm_data_plugin_interface.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
|
||||
|
||||
EmergencyCallDialog::EmergencyCallDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_session(nullptr)
|
||||
, m_ui(new Ui::EmergencyCallDialog)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("EmergencyCallDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
void EmergencyCallDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Emergency Call "));
|
||||
}
|
||||
|
||||
bool EmergencyCallDialog::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)
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START ";
|
||||
if (!ftc || !dtc || !session){
|
||||
ERROR_LOG(m_logger)<<" init Emergency call dialog failed !!";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_ftc = ftc;
|
||||
m_dtc = dtc;
|
||||
m_opmDtc = opmDtc;
|
||||
m_session = session;
|
||||
m_dtc->enableAlmEmergencyCall();
|
||||
m_ftc->enableEmergencyCallAcknowledge();
|
||||
m_sitMapGuiIfc = sitMapGuiIfc;
|
||||
|
||||
|
||||
delete m_model;
|
||||
m_model = new AlarmManagement::EmergencyCallModel(this);
|
||||
m_model->initModel(m_dtc, opmDtc);
|
||||
|
||||
m_proxyModel = new EmergencyCallProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
m_ui->emergencyCallView->setModel(m_proxyModel);
|
||||
m_proxyModel->hideByExerciseStopped(m_session->exerciseState()!=LtsWidgets::ExcState::eStarted &&
|
||||
m_session->exerciseState() != LtsWidgets::ExcState::ePaused);
|
||||
m_ui->emergencyCallView->setSortingEnabled(true);
|
||||
m_ui->emergencyCallView->resizeSection(EmergencyCallModel::Columns::SAMPLE_TIME, 300);
|
||||
m_ui->emergencyCallView->resizeSection(EmergencyCallModel::Columns::POSITION, 300);
|
||||
m_ui->emergencyCallView->resizeSection(EmergencyCallModel::Columns::DELETED_TIMESTAMP, 300);
|
||||
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setText(tr("Acknowledge"));
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setText(tr("Center"));
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setIcon(QIcon(QStringLiteral("icon:center_to_object.svg")));
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &EmergencyCallDialog::onEditBtCliked);
|
||||
|
||||
const bool &hasOperatorRightEmergencyCall = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::EmergencyCall);
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setVisible(hasOperatorRightEmergencyCall);
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &EmergencyCallDialog::onFindEmergencyOnMap);
|
||||
|
||||
|
||||
//cbx show expired
|
||||
QCheckBox *cbExpired = new QCheckBox(tr("Show expired"), m_ui->emergencyCallView);
|
||||
cbExpired->setProperty("const", true);
|
||||
m_ui->emergencyCallView->setCustomWidget(cbExpired);
|
||||
connect(cbExpired, &QCheckBox::toggled, this, &EmergencyCallDialog::onSetShowExpired);
|
||||
|
||||
connect(m_ui->emergencyCallView, &LtsDataView::LtsDataView::signalSelectionChanged, this, &EmergencyCallDialog::enaDisa);
|
||||
connect(m_ui->emergencyCallView, &LtsDataView::LtsDataView::doubleClicked, this, &EmergencyCallDialog::onEmergencyIndexDoubleClicked);
|
||||
enaDisa();
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->emergencyCallView->hideColumn(EmergencyCallModel::ID);
|
||||
m_ui->emergencyCallView->hideColumn(EmergencyCallModel::SAMPLE_TIME);
|
||||
m_ui->emergencyCallView->hideColumn(EmergencyCallModel::NAME);
|
||||
m_ui->emergencyCallView->hideColumn(EmergencyCallModel::EXPIRED);
|
||||
#endif
|
||||
|
||||
INFO_LOG(m_logger) << "EmergencyCallDialog::init done";
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallDialog::enaDisa
|
||||
* enable 'acknowledge' button when selected has expired= false
|
||||
*/
|
||||
void EmergencyCallDialog::enaDisa()
|
||||
{
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, false);
|
||||
|
||||
const AlmEmergencyCall &sos = getSelectedSOS();
|
||||
if (sos.id() <= 0)
|
||||
return;
|
||||
|
||||
if (!sos.expired())
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, true);
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, true);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallDialog::getSelectedSOS
|
||||
* \return
|
||||
*/
|
||||
AlmEmergencyCall EmergencyCallDialog::getSelectedSOS()
|
||||
{
|
||||
QModelIndexList indexList = m_ui->emergencyCallView->selectedRows();
|
||||
if (indexList.isEmpty())
|
||||
return {};
|
||||
|
||||
return m_model->getRowData(indexList.front().row());
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallDialog::setAcknowledgeUi
|
||||
*/
|
||||
void EmergencyCallDialog::setAcknowledgeUi()
|
||||
{
|
||||
LtsWidgets::LtsFramelessDialog *popup = new LtsWidgets::LtsFramelessDialog(this, LtsWidgets::Behaviour::Popup);
|
||||
LtsWidgets::LtsDialogButtonBox *btnBox = new LtsWidgets::LtsDialogButtonBox(popup);
|
||||
btnBox->getButton(LtsWidgets::DialogButton::Ok)->setEnabled(false);
|
||||
QVBoxLayout *lay = new QVBoxLayout(popup);
|
||||
QLineEdit *le = new QLineEdit(popup);
|
||||
QLabel *lblTxt = new QLabel(tr("Acknowledged by:"), popup);
|
||||
|
||||
connect(btnBox->getButton(LtsWidgets::DialogButton::Close), &QPushButton::clicked, popup, &LtsWidgets::LtsFramelessDialog::accept);
|
||||
|
||||
//check if total text count > than textMinSize
|
||||
connect(le, &QLineEdit::textChanged, this, [btnBox](const QString &text)
|
||||
{
|
||||
const int textMinSize = 5;
|
||||
btnBox->getButton(LtsWidgets::DialogButton::Ok)->setEnabled(text.trimmed().size() >= textMinSize);
|
||||
});
|
||||
// on ok clicked acknowledge emergency
|
||||
connect(btnBox->getButton(LtsWidgets::DialogButton::Ok), &QPushButton::clicked, this, [this, le, popup]()
|
||||
{
|
||||
sendAcknowledgeEmergency(le->text());
|
||||
popup->accept();
|
||||
});
|
||||
|
||||
lay->addWidget(lblTxt);
|
||||
lay->addWidget(le);
|
||||
lay->addWidget(btnBox);
|
||||
popup->setLayout(lay);
|
||||
popup->setMinimumWidth(350);
|
||||
popup->show();
|
||||
le->setFocus();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallDialog::onEditBtCliked
|
||||
*/
|
||||
void EmergencyCallDialog::onEditBtCliked()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
|
||||
const AlmEmergencyCall &sos = getSelectedSOS();
|
||||
if (sos.id() <= 0)
|
||||
return;
|
||||
setAcknowledgeUi();
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallDialog::setShowExpire
|
||||
*/
|
||||
void EmergencyCallDialog::onSetShowExpired(bool show)
|
||||
{
|
||||
if (m_proxyModel)
|
||||
m_proxyModel->setShowExpired(show);
|
||||
|
||||
// initialisation of class to display expired sos calls only if needed:
|
||||
if (!m_updateSOSGuard)
|
||||
m_updateSOSGuard = QSharedPointer<UpdateSOSGuard>(new UpdateSOSGuard(m_sitMapGuiIfc));
|
||||
m_updateSOSGuard->showExpiredSOS(show);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallDialog::onFindEmergencyOnMap
|
||||
* \param position
|
||||
*/
|
||||
void EmergencyCallDialog::onFindEmergencyOnMap()
|
||||
{
|
||||
if (!m_sitMapGuiIfc)
|
||||
return;
|
||||
|
||||
const AlmEmergencyCall &sos = getSelectedSOS();
|
||||
if (sos.id() <= 0)
|
||||
return;
|
||||
|
||||
m_sitMapGuiIfc->setCenterPoint(QPointF(sos.position().lon(), sos.position().lat()));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallDialog::onEmergencyIndexDoubleClicked
|
||||
* \param index
|
||||
*/
|
||||
void EmergencyCallDialog::onEmergencyIndexDoubleClicked(const QModelIndex &index)
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
emit openInfoDlg(getSelectedSOS().id());
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallDialog::onRemove
|
||||
* this method is use to acknowledge/quit the emergency call request
|
||||
*/
|
||||
void EmergencyCallDialog::sendAcknowledgeEmergency(const QString &comment)
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
|
||||
const AlmEmergencyCall &sos = getSelectedSOS();
|
||||
if (sos.id() <= 0 || sos.expired())
|
||||
return;
|
||||
|
||||
EmergencyCallAcknowledgeRequest request;
|
||||
request.id(sos.id());
|
||||
request.issi(sos.issi());
|
||||
request.name(sos.name());
|
||||
request.timestamp(QDateTime::currentMSecsSinceEpoch());
|
||||
request.incomingTime(sos.incomingTime());
|
||||
request.expired(true);
|
||||
request.operatorId(LtsSessionData::LtsSessionData::getInstance()->getOperatorId());
|
||||
request.comment(comment.toStdString());
|
||||
m_requestHelper->startSingleRequest([this, request]()
|
||||
{
|
||||
return m_ftc->emergencyCallAcknowledgeRequest(request, this);
|
||||
});
|
||||
|
||||
enaDisa();
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
}
|
||||
|
||||
void EmergencyCallDialog::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->emergencyCallView->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
EmergencyCallDialog::~EmergencyCallDialog()
|
||||
{
|
||||
// m_updateSOSGuard will be destroyed via QSharedPointer,
|
||||
// which hold it´s own shared_ptr/sitMapGuiIfc;
|
||||
// Therefore showExpiredEmergencyCalls(false) will be called
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
}// namespace AlarmManagement
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
/**
|
||||
* @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
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EmergencyCallDialog</class>
|
||||
<widget class="QWidget" name="EmergencyCallDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>406</width>
|
||||
<height>266</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="LtsDataView::LtsDataView" name="emergencyCallView" native="true">
|
||||
<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>
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AlarmManagement (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Steve Kemayou, SLSE, 2023-05-26
|
||||
*/
|
||||
|
||||
|
||||
#include "alm_emergency_call_gui_plugin.h"
|
||||
#include <Services/AlarmManagement/alm_operator_rights.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>
|
||||
#include "alm_emergency_call_info_dialog.h"
|
||||
|
||||
#include <QDebug>
|
||||
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("Plugins.Gui.Interface"))
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_exmDtc(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
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<OperatorManagement::DataInterface>(m_opmDtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getDtc for OperatorManagement::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_session->getDtc<ExerciseManagement::DataInterface>(m_exmDtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getDtc for ExerciseManagement::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
m_exmDtc->waitForHistoricalDataExercise();
|
||||
m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitmapGuIfc);
|
||||
|
||||
connect(m_dtc.get(), &AlarmManagement::Interface::Dtc::almEmergencyCallChanged,
|
||||
this, &InterfaceImpl::onEmergencyCallChanged, Qt::UniqueConnection);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_ftc = nullptr;
|
||||
m_dtc = nullptr;
|
||||
m_sitmapGuIfc = nullptr;
|
||||
}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
|
||||
// Action 'EmergencyCall' anlegen
|
||||
plData.menuText = tr("Emergency Calls");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:emergency_call_enabled.svg"));
|
||||
plData.identifier = QLatin1String("almEmergencyCall");
|
||||
plData.layoutArea = LtsWidgets::LayoutArea::eDialogTab;
|
||||
plData.operatorRight = OperatorRights::ConfigGlobalDialog;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return slotShowEmergencyCallDialog(parent);;
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
auto cb = [this](const AlmEmergencyCall &data)
|
||||
{
|
||||
if (data.id() <= 0 || data.expired())
|
||||
return;
|
||||
this->showEmergencyCallInfoWindow(data.id());
|
||||
};
|
||||
m_dtc->almEmergencyCalls(cb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::slotShowEmergencyCallDialog(QWidget *parent)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "slotShowEmergencyCallDialog";
|
||||
|
||||
AlarmManagement::EmergencyCallDialog *emergencyDialog = new EmergencyCallDialog(parent);
|
||||
emergencyDialog->setOnlineHelpFilename(QStringLiteral("SOS_02"));
|
||||
connect(emergencyDialog, &AlarmManagement::EmergencyCallDialog::openInfoDlg, this, &InterfaceImpl::onOpenInfoDlg);
|
||||
return LtsWidgets::initDialog(emergencyDialog, m_ftc, m_dtc, m_sitmapGuIfc, m_opmDtc, m_session);
|
||||
}
|
||||
|
||||
void InterfaceImpl::showEmergencyCallInfoWindows(const QVector<int32_t> &entityIds)
|
||||
{
|
||||
for (auto id : entityIds)
|
||||
this->showEmergencyCallInfoWindow(id);
|
||||
}
|
||||
|
||||
void InterfaceImpl::onEmergencyCallChanged(const AlmEmergencyCall &data, DataModification modType)
|
||||
{
|
||||
if (modType != DataModification::eAdded)
|
||||
return;
|
||||
if (data.id() <= 0 || data.expired())
|
||||
return;
|
||||
|
||||
this->showEmergencyCallInfoWindow(data.id());
|
||||
}
|
||||
|
||||
void InterfaceImpl::onOpenInfoDlg(const int &id)
|
||||
{
|
||||
this->showEmergencyCallInfoWindow(id);
|
||||
}
|
||||
|
||||
void InterfaceImpl::showEmergencyCallInfoWindow(const int id)
|
||||
{
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> dtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> ftc;
|
||||
if (!m_session->getDtc<AlarmManagement::DataInterface>(dtc)
|
||||
|| !m_session->getFtc<AlarmManagement::DataInterface>(ftc))
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(m_session->baseLayout(), tr("The Alarm Management is not available!"), tr("Cannot open Emergency Call Info Dialog"));
|
||||
return;
|
||||
}
|
||||
const QVector<LtsAppDescriptor::App> notValidApps {LtsAppDescriptor::App::PlanEditor,
|
||||
LtsAppDescriptor::App::Scripts,
|
||||
LtsAppDescriptor::App::Timeline,
|
||||
LtsAppDescriptor::App::BuildingViewer};
|
||||
|
||||
if (m_session->partitionType() == IDL::PartitionType::Replay
|
||||
|| m_session->exerciseState() == LtsWidgets::ExcState::eStopped
|
||||
|| notValidApps.contains(m_session->app()))
|
||||
return;
|
||||
|
||||
AlarmManagement::EmergencyCallInfoDialog *infoDialog = new EmergencyCallInfoDialog(id);
|
||||
infoDialog->setOnlineHelpFilename(QStringLiteral("SOS_01"));
|
||||
if (!infoDialog->init(ftc, dtc, m_sitmapGuIfc, m_opmDtc))
|
||||
{
|
||||
delete infoDialog;
|
||||
return;
|
||||
}
|
||||
m_session->addWidget(infoDialog, menuGroup(), infoDialog->emergencyIdentifier(), LtsWidgets::LayoutArea::eInfoTab);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace AlarmManagement
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* @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 "alm_emergency_call_dialog.h"
|
||||
#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/alm_info_gui_plugin_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
//#include <Services/OperatorManagement/opm_dtc.h>
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
|
||||
#include <ExerciseManagement/exm_data_plugin_interface.h>
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:alm.emergencycall")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("AlmEmergencyCall"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise
|
||||
|| partition == IDL::PartitionType::Replay;
|
||||
}
|
||||
};
|
||||
|
||||
class InterfaceImpl final
|
||||
: public QObject
|
||||
, public GuiPluginBase::Interface
|
||||
, public ForeignInfoGuiInterface
|
||||
{
|
||||
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"); }
|
||||
|
||||
void showEmergencyCallInfoWindow(const int id) override;
|
||||
public slots:
|
||||
void showEmergencyCallInfoWindows(const QVector<int32_t> &entityIds) override final;
|
||||
void onEmergencyCallChanged(const AlarmManagement::AlmEmergencyCall &data, DataModification modType);
|
||||
void onOpenInfoDlg(const int &id);
|
||||
|
||||
private: // methods
|
||||
LtsWidgets::LtsDialog *slotShowEmergencyCallDialog(QWidget *parent);
|
||||
|
||||
private:
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitmapGuIfc;
|
||||
|
||||
};
|
||||
|
||||
} // namespace AlarmManagement
|
||||
+268
@@ -0,0 +1,268 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AlarmManagement (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Steve Kemayou, SLSE, 2023-05-26
|
||||
*/
|
||||
|
||||
#include "alm_emergency_call_info_dialog.h"
|
||||
#include "ui_alm_emergency_call_info_dialog.h"
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <AlarmManagement/alm_operator_rights.h>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
|
||||
QImage renderEmergencySymbol(bool expired = false)
|
||||
{
|
||||
int size = 64;
|
||||
QImage image(size, size, QImage::Format_ARGB32);
|
||||
image.fill(Qt::transparent);
|
||||
|
||||
QPainter painter(&image);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
QPen pen(Qt::white);
|
||||
pen.setWidth(3);
|
||||
painter.setPen(pen);
|
||||
|
||||
painter.setBrush( expired ? QBrush(Qt::gray) : QBrush(Qt::red));
|
||||
painter.drawEllipse(QPointF(image.rect().center()),
|
||||
image.rect().width() * 0.45,
|
||||
image.rect().height() * 0.45);
|
||||
|
||||
painter.setPen(QPen(Qt::white));
|
||||
|
||||
QFont font = painter.font();
|
||||
font.setBold(true);
|
||||
font.setPixelSize(26);
|
||||
painter.setFont(font);
|
||||
|
||||
QPointF pos(image.width() * 0.125,
|
||||
image.height() * 0.625);
|
||||
|
||||
painter.drawText(pos, QLatin1String("SOS"));
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallInfoDialog::EmergencyCallInfoDialog
|
||||
* \param entryId
|
||||
* \param parent
|
||||
*/
|
||||
EmergencyCallInfoDialog::EmergencyCallInfoDialog(int entryId, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_logger(getLogger("EmergencyCallInfoDialog"))
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_ui(new Ui::EmergencyCallInfoDialog)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_emergency.id(entryId);
|
||||
}
|
||||
|
||||
EmergencyCallInfoDialog::~EmergencyCallInfoDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallInfoDialog::init
|
||||
* \param ftc
|
||||
* \param dtc
|
||||
* \param sitMapGuiIfc
|
||||
* \return
|
||||
*/
|
||||
bool EmergencyCallInfoDialog::init(const std::shared_ptr<Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<SituationMap::ForeignGuiInterface> &sitMapGuiIfc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc>&opmDtc)
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
if (!ftc || !dtc)
|
||||
{
|
||||
ERROR_LOG(m_logger)<<" init Emergency call Info dialog failed !!";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
m_opmDtc = opmDtc;
|
||||
m_sitMapGuiIfc = sitMapGuiIfc;
|
||||
|
||||
m_dtc->enableAlmEmergencyCall();
|
||||
m_ftc->enableEmergencyCallAcknowledge();
|
||||
|
||||
//center tp sos
|
||||
m_emergency = m_dtc->almEmergencyCall(m_emergency.id());
|
||||
setUiValues();
|
||||
|
||||
connect(m_dtc.get(), &AlarmManagement::Interface::Dtc::almEmergencyCallChanged, this, &EmergencyCallInfoDialog::onEmergencyCallChanged );
|
||||
connect(m_ui->pbAckEmergency, &QPushButton::clicked, this, &EmergencyCallInfoDialog::onPbAckEmergencyClicked );
|
||||
connect(m_ui->pbEmergencyCallFindOnMap, &QPushButton::clicked, this, &EmergencyCallInfoDialog::onFindEmergencyOnMap);
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallInfoDialog::emergencyIdentifier
|
||||
* \return
|
||||
*/
|
||||
QString EmergencyCallInfoDialog::emergencyIdentifier() const
|
||||
{
|
||||
return QStringLiteral("emergency_") + QString::number(m_emergency.id());
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallInfoDialog::setUiValues
|
||||
* \return
|
||||
*/
|
||||
bool EmergencyCallInfoDialog::setUiValues()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
if (!m_dtc || !m_ftc || m_emergency.id() < 0)
|
||||
{
|
||||
ERROR_LOG(m_logger)<<" >> unabled to init EmergencyCallInfoDialog";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_ui->lblEquipNr->setText(QString::number(m_emergency.issi()));
|
||||
m_ui->lblIncomingTime->setText(DTG::toString(QDateTime::fromMSecsSinceEpoch(m_emergency.incomingTime())));//.toString(QStringLiteral("dd hhmmss Z MMMM yy")));
|
||||
m_ui->lblStatus->setText(m_emergency.expired() ? DTG::toString(QDateTime::fromMSecsSinceEpoch(m_emergency.deleted())) : QStringLiteral("--"));
|
||||
m_ui->lblComment->setText(QString::fromStdString(m_emergency.comment()));
|
||||
QString mgrs = LtsCoordTrans::mgrsFromGeographic(m_emergency.position().lon(), m_emergency.position().lat());
|
||||
m_ui->lblPosition->setText(mgrs);
|
||||
|
||||
// ack button
|
||||
const bool &hasOperatorRightEmergencyCall = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::EmergencyCall);
|
||||
m_ui->pbAckEmergency->setIcon(QIcon(QStringLiteral("icon:edit.svg")));
|
||||
m_ui->pbAckEmergency->setEnabled(m_emergency.expired() ? false : true);
|
||||
m_ui->pbAckEmergency->setVisible(hasOperatorRightEmergencyCall);
|
||||
|
||||
// render icon
|
||||
QPixmap iconPixmap = QPixmap::fromImage(renderEmergencySymbol(m_emergency.expired()));
|
||||
m_ui->lblIcon->setPixmap(iconPixmap);
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallInfoDialog::onEmergencyCallChanged
|
||||
* \param data
|
||||
* \param modType
|
||||
*/
|
||||
void EmergencyCallInfoDialog::onEmergencyCallChanged(AlarmManagement::AlmEmergencyCall data, DataModification modType)
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
if (data.id() != m_emergency.id() || data.id() == 0)
|
||||
return;
|
||||
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
m_ui->pbAckEmergency->setEnabled(false);
|
||||
m_ui->pbEmergencyCallFindOnMap->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if (modType == DataModification::eModified)
|
||||
{
|
||||
m_emergency = data;
|
||||
setUiValues();
|
||||
}
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallInfoDialog::onFindEmergencyOnMap
|
||||
* slot function to center map on specific object by it position
|
||||
*/
|
||||
void EmergencyCallInfoDialog::onFindEmergencyOnMap()
|
||||
{
|
||||
if (!m_sitMapGuiIfc || m_emergency.id() <= 0)
|
||||
return;
|
||||
m_sitMapGuiIfc->setCenterPoint(QPointF(m_emergency.position().lon(), m_emergency.position().lat()));
|
||||
}
|
||||
|
||||
void EmergencyCallInfoDialog::onPbAckEmergencyClicked()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
|
||||
LtsWidgets::LtsFramelessDialog *popup = new LtsWidgets::LtsFramelessDialog(this, LtsWidgets::Behaviour::Popup);
|
||||
LtsWidgets::LtsDialogButtonBox *btnBox = new LtsWidgets::LtsDialogButtonBox(popup);
|
||||
btnBox->getButton(LtsWidgets::DialogButton::Ok)->setEnabled(false);
|
||||
QVBoxLayout *lay = new QVBoxLayout(popup);
|
||||
QLineEdit *le = new QLineEdit(popup);
|
||||
QLabel *lblTxt = new QLabel(tr("Acknowledged by:"), popup);
|
||||
|
||||
connect(btnBox->getButton(LtsWidgets::DialogButton::Close), &QPushButton::clicked, popup, &LtsWidgets::LtsFramelessDialog::accept);
|
||||
|
||||
//check if total text count > than textMinSize
|
||||
connect(le, &QLineEdit::textChanged, this, [btnBox](const QString &text)
|
||||
{
|
||||
const int textMinSize = 5;
|
||||
btnBox->getButton(LtsWidgets::DialogButton::Ok)->setEnabled(text.trimmed().size() >= textMinSize);
|
||||
});
|
||||
|
||||
connect(btnBox->getButton(LtsWidgets::DialogButton::Ok), &QPushButton::clicked, this, [this, le, popup]()
|
||||
{
|
||||
const QString c = le->text().trimmed();
|
||||
sendAcknowledgeEmergencyCallRequest(c);
|
||||
popup->accept();
|
||||
});
|
||||
|
||||
lay->addWidget(lblTxt);
|
||||
lay->addWidget(le);
|
||||
lay->addWidget(btnBox);
|
||||
popup->setLayout(lay);
|
||||
popup->setMinimumWidth(350);
|
||||
popup->show();
|
||||
le->setFocus();
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallInfoDialog::sendAcknowledgeEmergencyCallRequest
|
||||
* \param comment
|
||||
*/
|
||||
void EmergencyCallInfoDialog::sendAcknowledgeEmergencyCallRequest(const QString &comment)
|
||||
{
|
||||
if (m_emergency.id() <= 0)
|
||||
return ;
|
||||
|
||||
EmergencyCallAcknowledgeRequest request;
|
||||
request.id(m_emergency.id());
|
||||
request.name(m_emergency.name());
|
||||
request.issi(m_emergency.issi());
|
||||
request.timestamp(QDateTime::currentMSecsSinceEpoch());
|
||||
request.incomingTime(m_emergency.incomingTime());
|
||||
request.expired(true);
|
||||
request.operatorId(LtsSessionData::LtsSessionData::getInstance()->getOperatorId());
|
||||
request.comment(comment.toStdString());
|
||||
bool ret = m_requestHelper->startSingleRequest([this, request]()
|
||||
{
|
||||
return m_ftc->emergencyCallAcknowledgeRequest(request, this);
|
||||
});
|
||||
|
||||
if (ret)
|
||||
setUiValues();
|
||||
}
|
||||
|
||||
void EmergencyCallInfoDialog::retranslate()
|
||||
{
|
||||
m_emergency = m_dtc->almEmergencyCall(m_emergency.id());
|
||||
const QString lbName = tr("SOS_%1").arg(m_emergency.issi());
|
||||
translate(m_ui, lbName);
|
||||
}
|
||||
|
||||
|
||||
} // namespace AlarmManagement
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @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 <LtsSession/lts_session.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 <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class EmergencyCallInfoDialog;
|
||||
}
|
||||
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
class EmergencyCallInfoDialog : public LtsWidgets::LtsDialog
|
||||
, protected AlarmManagement::Interface::Ftc::EmergencyCallAcknowledgeReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EmergencyCallInfoDialog(int entryId, QWidget *parent = nullptr);
|
||||
~EmergencyCallInfoDialog();
|
||||
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);
|
||||
QString emergencyIdentifier() const;
|
||||
|
||||
bool setUiValues();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onEmergencyCallChanged(AlmEmergencyCall data, DataModification modType);
|
||||
void onFindEmergencyOnMap();
|
||||
void onPbAckEmergencyClicked();
|
||||
|
||||
|
||||
protected:
|
||||
void onEmergencyCallAcknowledgeReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void sendAcknowledgeEmergencyCallRequest(const QString &comment);
|
||||
private:
|
||||
void retranslate() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<AlarmManagement::Interface::Ftc> m_ftc;
|
||||
AlarmManagement::AlmEmergencyCall m_emergency;
|
||||
LOGGER_T m_logger;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
|
||||
|
||||
Ui::EmergencyCallInfoDialog *m_ui;
|
||||
};
|
||||
|
||||
} // namespace AlarmManagement
|
||||
+252
@@ -0,0 +1,252 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EmergencyCallInfoDialog</class>
|
||||
<widget class="QWidget" name="EmergencyCallInfoDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>420</width>
|
||||
<height>556</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="LtsWidgets::LtsElidedLabel" name="lbEquipNr">
|
||||
<property name="text">
|
||||
<string>Equip. No.:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>138</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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>
|
||||
<widget class="QLabel" name="lblIcon">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="LtsWidgets::LtsElidedLabel" name="lbIncomingTime">
|
||||
<property name="text">
|
||||
<string>Incoming Time:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QLabel" name="lblIncomingTime">
|
||||
<property name="text">
|
||||
<string notr="true"><TIMESTAMP></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="QLabel" name="lblEquipNr">
|
||||
<property name="text">
|
||||
<string notr="true"><EUIPNR></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="lblStatus">
|
||||
<property name="text">
|
||||
<string notr="true"><STATUS></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QToolButton" name="pbAckEmergency">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Acknowledge SOS</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="lblPosition">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"><POSITION></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QToolButton" name="pbEmergencyCallFindOnMap">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Find on Map</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/style/center_to_object.svg</normaloff>:/style/center_to_object.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>138</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="LtsWidgets::LtsElidedLabel" name="lbComment">
|
||||
<property name="text">
|
||||
<string>Acknowledged by:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="LtsWidgets::LtsElidedLabel" name="lbStatus">
|
||||
<property name="text">
|
||||
<string>Acknowledged:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="LtsWidgets::LtsElidedLabel" name="lbPosition">
|
||||
<property name="text">
|
||||
<string>Position:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="3">
|
||||
<widget class="QLabel" name="lblComment">
|
||||
<property name="text">
|
||||
<string notr="true"><COMMENT></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="4">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>358</width>
|
||||
<height>288</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsElidedLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>LtsWidgets/lts_elided_label.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AlarmManagement (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Steve Kemayou, SLSE, 2023-05-26
|
||||
*/
|
||||
|
||||
#include "alm_emergency_call_model.h"
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
EmergencyCallModel::EmergencyCallModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<AlarmManagement::AlmEmergencyCall>(
|
||||
{
|
||||
tr("Id"),
|
||||
tr("Sample Time"),
|
||||
tr("Incoming Time"),
|
||||
tr("Name"),
|
||||
tr("Issi"),
|
||||
tr("Position"),
|
||||
tr("Expired"),
|
||||
tr("Operator"),
|
||||
tr("Deleted Timestamp"),
|
||||
tr("Comment"),
|
||||
}, parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_logger(getLogger("EmergencyCallModel"))
|
||||
{}
|
||||
|
||||
QVariant EmergencyCallModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const AlarmManagement::AlmEmergencyCall &almEmergency = m_vecData.at(index.row());
|
||||
switch (index.column())
|
||||
{
|
||||
case Columns::ID:
|
||||
return almEmergency.id();
|
||||
case SAMPLE_TIME:
|
||||
return QDateTime::fromMSecsSinceEpoch(almEmergency.sampleTime());
|
||||
case INCOMING_TIME:
|
||||
return QDateTime::fromMSecsSinceEpoch(almEmergency.incomingTime());
|
||||
case NAME:
|
||||
return QString::fromStdString(almEmergency.name());
|
||||
case ISSI:
|
||||
return almEmergency.issi();
|
||||
case POSITION:
|
||||
{
|
||||
if (std::isnan(almEmergency.position().lat()))
|
||||
return tr("---");
|
||||
const QString mgrs = LtsCoordTrans::mgrsFromGeographic(almEmergency.position().lon(), almEmergency.position().lat());
|
||||
return mgrs;
|
||||
}
|
||||
case EXPIRED:
|
||||
return almEmergency.expired();
|
||||
case OPERATION_ID:
|
||||
{
|
||||
if (almEmergency.operatorId() == 0)
|
||||
return QStringLiteral("-");
|
||||
|
||||
return QString::fromStdString(m_opmDtc.get()->user(almEmergency.operatorId()).name());
|
||||
}
|
||||
case DELETED_TIMESTAMP:
|
||||
return QDateTime::fromMSecsSinceEpoch(almEmergency.deleted());
|
||||
case COMMENT:
|
||||
return QString::fromStdString(almEmergency.comment());
|
||||
default:
|
||||
break;
|
||||
} // switch
|
||||
return {};
|
||||
}
|
||||
|
||||
bool EmergencyCallModel::initModel(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc)
|
||||
{
|
||||
m_dtc = dtc;
|
||||
m_opmDtc = opmDtc;
|
||||
|
||||
auto cb = [this](const AlarmManagement::AlmEmergencyCall & d)
|
||||
{
|
||||
onAlarmEmergencyCallChanged(d, DataModification::eAdded);
|
||||
};
|
||||
m_dtc->almEmergencyCalls(cb);
|
||||
connect(m_dtc.get(), &Interface::Dtc::almEmergencyCallChanged,
|
||||
this, &EmergencyCallModel::onAlarmEmergencyCallChanged);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EmergencyCallModel::onAlarmEmergencyCallChanged(const AlarmManagement::AlmEmergencyCall &data, const DataModification modType)
|
||||
{
|
||||
const int id = data.id();
|
||||
int row = findRowForId(id);
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eModified:
|
||||
{
|
||||
if (row < 0)
|
||||
return;
|
||||
setRowData(row, data);
|
||||
break;
|
||||
}
|
||||
case DataModification::eAdded:
|
||||
insertRow(data);
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
removeRow(row);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
///**************************
|
||||
/// EmergencyCallProxyModel
|
||||
///**************************
|
||||
|
||||
/*!
|
||||
* \brief EmergencyCallProxyModel::setSourceModel
|
||||
* \param sourceModel
|
||||
*/
|
||||
void EmergencyCallProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<EmergencyCallModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
void EmergencyCallProxyModel::hideByExerciseStopped(bool show)
|
||||
{
|
||||
if (m_hideByExerciseStopped == show)
|
||||
return;
|
||||
m_hideByExerciseStopped = show;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void EmergencyCallProxyModel::setShowExpired(bool show)
|
||||
{
|
||||
if (m_showExpired == show)
|
||||
return;
|
||||
m_showExpired = show;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
bool EmergencyCallProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
{
|
||||
Q_UNUSED(source_parent)
|
||||
return checkFilter(source_row);
|
||||
}
|
||||
|
||||
bool EmergencyCallProxyModel::checkFilter(int source_row) const
|
||||
{
|
||||
const auto sos = m_sourceModel->getRowData(source_row);
|
||||
if ((sos.expired() && !showExpired()) || (exerciseStopped() && !sos.expired()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace AlarmManagement
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* @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 <AlarmManagement/alm_dtc.h>
|
||||
#include <AlarmManagement/logger.h>
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
|
||||
class EmergencyCallModel : public LtsWidgets::LtsAbstractTableModel<AlarmManagement::AlmEmergencyCall>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
ID,
|
||||
SAMPLE_TIME,
|
||||
INCOMING_TIME,
|
||||
NAME,
|
||||
ISSI,
|
||||
POSITION,
|
||||
EXPIRED,
|
||||
OPERATION_ID,
|
||||
DELETED_TIMESTAMP,
|
||||
COMMENT
|
||||
};
|
||||
explicit EmergencyCallModel(QObject *parent = nullptr);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override final;
|
||||
bool initModel(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc);
|
||||
|
||||
private slots:
|
||||
void onAlarmEmergencyCallChanged(const AlarmManagement::AlmEmergencyCall &data, const DataModification modType);
|
||||
private:
|
||||
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
friend class EmergencyCallProxyModel;
|
||||
|
||||
};
|
||||
|
||||
|
||||
///**************************
|
||||
/// EmergencyCallProxyModel
|
||||
///**************************
|
||||
/*!
|
||||
* \brief The EmergencyCallProxyModel class
|
||||
*/
|
||||
class EmergencyCallProxyModel : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
bool showExpired() const { return m_showExpired; }
|
||||
bool exerciseStopped()const {return m_hideByExerciseStopped;}
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
void hideByExerciseStopped(bool show);
|
||||
|
||||
public slots:
|
||||
void setShowExpired(bool show);
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override final;
|
||||
|
||||
private:
|
||||
bool checkFilter(int source_row) const;
|
||||
|
||||
private:
|
||||
bool m_showExpired{false};
|
||||
bool m_hideByExerciseStopped{false};
|
||||
EmergencyCallModel *m_sourceModel{nullptr};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <AlarmManagement/alm_dtc.h>
|
||||
#include <AlarmManagement/alm_ftc.h>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
/**
|
||||
* @brief The DataInterface class provides the Topics Clients only for the GUI Plugins
|
||||
*/
|
||||
class DataInterface : public DataPluginBase::Interface
|
||||
{
|
||||
public:
|
||||
using DataPluginBase::Interface::Interface;
|
||||
|
||||
virtual std::shared_ptr<AlarmManagement::Interface::Dtc> getDtc() = 0;
|
||||
virtual std::shared_ptr<AlarmManagement::Interface::Ftc> getFtc() = 0;
|
||||
};
|
||||
|
||||
} // namespace AlarmManagement
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AlarmManagement (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
static QString pluginName() { return QStringLiteral("AlarmManagement.GuiPlugin.ConfigAlarm"); }
|
||||
};
|
||||
|
||||
} //namespace AlarmManagement
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for building (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2017-04-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QVector>
|
||||
|
||||
namespace AlarmManagement
|
||||
{
|
||||
|
||||
class ForeignInfoGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignInfoGuiInterface() = default;
|
||||
virtual ~ForeignInfoGuiInterface() = default;
|
||||
|
||||
virtual void showEmergencyCallInfoWindows(const QVector<int32_t> &entityIds) = 0;
|
||||
virtual void showEmergencyCallInfoWindow(const int id) = 0;
|
||||
};
|
||||
|
||||
} // namespace Buildings
|
||||
Reference in new issue
Block a user