Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

@@ -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)
@@ -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
@@ -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
@@ -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>
@@ -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
@@ -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
@@ -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>
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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>