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

+38
View File
@@ -0,0 +1,38 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# Created by Dassow Philipp, SLEA, 2017-07-28
#
ADD_SUBDIRECTORY(Gui)
ADD_SUBDIRECTORY(Data)
#
# Gui Pairing Plugin Interface
#
ADD_INTERFACE_LIBRARY(GimGuiPairingPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/gim_pairing_gui_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/../../
GuiPluginInterface
)
#
# Gui Info Plugin Interface
#
ADD_INTERFACE_LIBRARY(GimGuiInfoPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/gim_info_gui_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/../../
GuiPluginInterface
)
#
# Data Plugin Interface
#
ADD_INTERFACE_LIBRARY(GimDataPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/gim_data_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/../
DataPluginInterface
svcGimCommon
)
+20
View File
@@ -0,0 +1,20 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# Created by Dassow Philipp, SLEA, 2017-08-15
#
#
# Data Plugin
#
NGL_ADD_LIBRARY(WS GimDataPlugin MODULE gim_data_plugin.cpp gim_data_plugin.h)
NGL_TARGET_LINK_LIBRARIES(GimDataPlugin
Qt5::Core
GimDataPluginInterface
svcGimClient
NGLLogger
LtsSessionDataDds
)
NGL_INSTALL_TARGET(GimDataPlugin)
+36
View File
@@ -0,0 +1,36 @@
/**
* @RDE_HEADER@
* Data Plugin for GuezIedManangement
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-08-15
*/
#include "gim_data_plugin.h"
#include <DDS/DDSConnector/dds_connector.h>
#include <LtsSession/lts_session_data_dds.h>
namespace GuezIedManagement
{
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
{
std::shared_ptr<Interface::Dtc> dtc;
std::shared_ptr<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<GuezIedManagement::Interface::Dtc> &dtc,
const std::shared_ptr<GuezIedManagement::Interface::Ftc> &ftc)
: DataInterface()
, m_dtc(dtc)
, m_ftc(ftc)
{}
} // namespace GuezIedManagement
+53
View File
@@ -0,0 +1,53 @@
/**
* @RDE_HEADER@
* Data Plugin for GuezIedManangement
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-08-15
*/
#pragma once
#include <PluginInterfaces/data_plugin_interface.h>
#include <Plugins/GuezIedManagement/gim_data_plugin_interface.h>
namespace GuezIedManagement
{
class DataPlugin final : public QObject, public DataPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "data:3:gim")
Q_INTERFACES(DataPluginBase::Plugin)
Q_OBJECT
public:
DataPlugin() = default;
~DataPlugin() = default;
QString pluginName() const override { return QStringLiteral("GuezIedManagement"); }
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:
DataInterfaceImpl(const std::shared_ptr<GuezIedManagement::Interface::Dtc> &dtc,
const std::shared_ptr<GuezIedManagement::Interface::Ftc> &ftc);
std::shared_ptr<GuezIedManagement::Interface::Dtc> getDtc() override { return m_dtc; }
std::shared_ptr<GuezIedManagement::Interface::Ftc> getFtc() override { return m_ftc; }
private:
std::shared_ptr<GuezIedManagement::Interface::Dtc> m_dtc;
std::shared_ptr<GuezIedManagement::Interface::Ftc> m_ftc;
};
} // namespace GuezIedManagement
+10
View File
@@ -0,0 +1,10 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# Created by Dassow Philipp, SLEA, 2017-07-28
#
ADD_SUBDIRECTORY(PairingEdit)
ADD_SUBDIRECTORY(InfoDialog)
@@ -0,0 +1,36 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# Created by Dassow Philipp, SLEA, 2017-08-22
#
SET (gim_info_gui_SRCS
gim_info_gui_plugin.h
gim_info_gui_plugin.cpp
gim_info_dialog.h
gim_info_dialog.cpp
)
QT5_WRAP_UI(gim_info_gui_SRCS
gim_info_dialog.ui
)
NGL_ADD_LIBRARY(WS GimInfoGuiPlugin MODULE ${gim_info_gui_SRCS})
NGL_TARGET_LINK_LIBRARIES(GimInfoGuiPlugin
PRIVATE
svcGimCommon
PUBLIC
LtsSession
LtsCoordTrans
LtsUtilsGuiDds
GimGuiInfoPluginInterface
GimDataPluginInterface
AsbDataPluginInterface
PpmDataPluginInterface
SituationMapGuiPluginInterface
Qt5::Widgets
)
NGL_INSTALL_TARGET(GimInfoGuiPlugin)
@@ -0,0 +1,271 @@
/**
* @RDE_HEADER@
* GUI Plugin for IED- Info
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-08-23
*/
#include "gim_info_dialog.h"
#include "ui_gim_info_dialog.h"
#include <QTableWidgetItem>
#include <LtsCoordTrans/lts_coord_trans.h>
#include <GuezIedManagement/gim_translation.h>
#include <ParticipantManagement/ppm_translation.h>
#include <Symbology/symbol_data_to_render_role.h>
#include <Symbology/sidc_builder_base.h>
namespace GuezIedManagement {
InfoDialog::InfoDialog(int iedEntityId, QWidget *parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
, m_iedEntityId(iedEntityId)
, m_session(nullptr)
, m_dtc(nullptr)
, m_ppmDtc(nullptr)
, m_asbIfc(nullptr)
, m_symbolWatcher(nullptr)
, m_ui(new Ui::InfoDialog)
, m_logger(getLogger("IedInfoDialog"))
{
m_ui->setupUi(this);
setUnchangeable();
m_symbolWatcher = new AdvancedSymbology::SymbolResultWatcherLabel(m_ui->lblIcon);
connect(m_ui->pbFindOnMap, &QToolButton::clicked, this, &InfoDialog::onFindOnMap);
}
InfoDialog::~InfoDialog()
{
delete m_symbolWatcher;
delete m_ui;
}
bool InfoDialog::init(LtsSession::LtsSession *session,
const std::shared_ptr<Interface::Dtc> &dtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
const std::shared_ptr<SituationMap::ForeignGuiInterface> &situationIfc,
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc)
{
m_session = session;
m_dtc = dtc;
m_ppmDtc = ppmDtc;
m_situationIfc = situationIfc;
m_asbIfc = asbIfc;
if (!m_dtc->enableIed())
return false;
if (!m_ppmDtc->enableParty())
return false;
connect(m_dtc.get(), &Interface::Dtc::iedChanged, this, &InfoDialog::onIedChanged);
connect(m_dtc.get(), &Interface::Dtc::iedPositionChanged, this, &InfoDialog::onIedPositionChanged);
showIedInfos();
return true;
}
void InfoDialog::retranslate()
{
translate(m_ui, QString::number(m_dtc->ied(m_iedEntityId).equipmentNumber()), false, tr("IED"));
}
void InfoDialog::showIedInfos()
{
Ied ied = m_dtc->ied(m_iedEntityId);
m_ui->lblEquipmentNumber->setText(QString::number(ied.equipmentNumber()));
m_ui->lblParty->setText(ParticipantManagement::trPartyName(m_ppmDtc->party(ied.partyId()).name()));
m_ui->lblDesignator->setText(QString::fromStdString(ied.name()));
setPosition(m_dtc->iedPosition(m_iedEntityId));
m_ui->lblExplosiveForce->setText(QString::number(ied.explosiveForce()));
m_ui->lblTriggerRemote->setEnabled(ied.remoteTrigger());
m_ui->lblTriggerButton->setEnabled(ied.switchTrigger());
m_ui->lblTriggerLightbarrier->setEnabled(ied.lightBarrierTrigger());
m_ui->lblTriggerWire->setEnabled(ied.tautWireTrigger());
if (ied.pyrotechnics())
m_ui->lblPyrotechnics->setText(tr("Active"));
else
m_ui->lblPyrotechnics->setText(tr("Inactive"));
m_ui->lblState->setText(GuezIedManagement::toString(ied.tacticalState()));
m_ui->tbwBit->setRowCount(0);
if (ied.electronicsError().underlying() != IedError_def::NoError)
{
QTableWidgetItem *device = new QTableWidgetItem(tr("Electronics"));
QTableWidgetItem *error = new QTableWidgetItem(GuezIedManagement::toString(ied.electronicsError()));
addTbwBitEntry(device, error);
}
if (ied.pyrotechnics1Error().underlying() != IedError_def::NoError)
{
QTableWidgetItem *device = new QTableWidgetItem(tr("Pyrotechnics 1"));
QTableWidgetItem *error = new QTableWidgetItem(GuezIedManagement::toString(ied.pyrotechnics1Error()));
addTbwBitEntry(device, error);
}
if (ied.pyrotechnics2Error().underlying() != IedError_def::NoError)
{
QTableWidgetItem *device = new QTableWidgetItem(tr("Pyrotechnics 2"));
QTableWidgetItem *error = new QTableWidgetItem(GuezIedManagement::toString(ied.pyrotechnics2Error()));
addTbwBitEntry(device, error);
}
if (ied.pyrotechnics3Error().underlying() != IedError_def::NoError)
{
QTableWidgetItem *device = new QTableWidgetItem(tr("Pyrotechnics 3"));
QTableWidgetItem *error = new QTableWidgetItem(GuezIedManagement::toString(ied.pyrotechnics3Error()));
addTbwBitEntry(device, error);
}
if ((ied.electronicsError().underlying() == IedError_def::NoError) &&
(ied.pyrotechnics1Error().underlying() == IedError_def::NoError) &&
(ied.pyrotechnics2Error().underlying() == IedError_def::NoError) &&
(ied.pyrotechnics3Error().underlying() == IedError_def::NoError))
{
QTableWidgetItem *device = new QTableWidgetItem(tr("no Errors"));
addTbwBitEntry(device, nullptr);
}
const QColor &color = QColor::fromRgb(QRgb(m_ppmDtc->party(ied.partyId()).color()));
const AdvancedSymbology::Role &role = AdvancedSymbology::roleToRole<>(m_ppmDtc->party(ied.partyId()).role());
updateIcon(color, role, ied.tacticalState(), QString::fromStdString(ied.symbol()));
}
void InfoDialog::setPosition(const IedPosition &pos)
{
if (std::isnan(pos.position().lon()) || std::isnan(pos.position().lat()))
m_ui->lblPosition->setText(tr("Invalid Position"));
else
m_ui->lblPosition->setText(LtsCoordTrans::mgrsFromGeographic(pos.position().lon(), pos.position().lat()));
}
AdvancedSymbology::Injury guezIedStateToInjury(const GuezIedManagement::IedTacticalState &iedState)
{
switch (iedState.underlying())
{
case GuezIedManagement::IedTacticalState::Active:
return AdvancedSymbology::Injury::NoInjury; // ""
break;
default:
return AdvancedSymbology::Injury::TotalKill; // "/\"
}
}
void updateIedPyro(const GuezIedManagement::IedTacticalState &iedStateIn,
AdvancedSymbology::Injury &injuryInOut,
QString &symbolInOut)
{
// Note:
// Special: triggered Ied<Small|Big> has seperate SIDC:
// "M25D|CMPL|10014000001103000000"); // SIDC for IED (OHNE ZickZack)
// "M25D|CMPL|10014000001103010000"); // SIDC for IED (MIT ZickZack)
// ^
// | -> Therefore suppress Injury
// handled at guez_ied_to_map.cpp and gim_info_dialog.cpp
if (injuryInOut != AdvancedSymbology::Injury::TotalKill)
return;
switch (iedStateIn.underlying())
{
case GuezIedManagement::IedTacticalState::Unknown:
case GuezIedManagement::IedTacticalState::NotActive:
case GuezIedManagement::IedTacticalState::Active:
// empty
break;
case GuezIedManagement::IedTacticalState::TriggeredBySwitch:
case GuezIedManagement::IedTacticalState::TriggeredByRemote:
case GuezIedManagement::IedTacticalState::TriggeredByLightBarrier:
case GuezIedManagement::IedTacticalState::TriggeredByTautWire:
case GuezIedManagement::IedTacticalState::TriggeredByControlDevice:
{
// Sonderfall: type == Ied:
// sidc MIT ZickZack ersetzt 'sidc OHNE ZickZack && TotalKill'
const QString &bsc = AdvancedSymbology::SidcBuilderBase::concreteSidcToBaseSymbolCode(symbolInOut);
// QStringLiteral("AP6D|CMPL|10014000001103000000"); // SIDC for IED (OHNE ZickZack)
if ((bsc.compare(QStringLiteral("AP6D|BASE|40110300")) == 0 ||
bsc.compare(QStringLiteral("M25D|BASE|40110300")) == 0)
)
{
symbolInOut = QStringLiteral("AP6D|CMPL|10014000001103010000"); // SIDC for IED (MIT ZickZack)
injuryInOut = AdvancedSymbology::Injury::NoInjury;
}
}
break;
case GuezIedManagement::IedTacticalState::Defused:
// empty
return;
} //switch
}
void InfoDialog::updateIcon(const QColor &color, AdvancedSymbology::Role role,
const IedTacticalState &state, const QString &sidc)
{
AdvancedSymbology::SymbolDataToRender symDataToRender(sidc);
//symDataToRender.injury = stateToInjury(state);
symDataToRender.role = role;
symDataToRender.injuryColor = Qt::black;
symDataToRender.fillColor = color;
symDataToRender.fillColorReplace = true;
symDataToRender.injury = guezIedStateToInjury(state);
// copy of Lts/Plugins/SituationMapPlugin/Gui/SituationMap/AdapterDds/guez_ied_to_map.cpp :
updateIedPyro(state, symDataToRender.injury, symDataToRender.sidc);
// : copy of Lts/Plugins/SituationMapPlugin/Gui/SituationMap/AdapterDds/guez_ied_to_map.cpp
m_symbolWatcher->setSymbolResult(m_asbIfc->findImage(symDataToRender));
}
void InfoDialog::onFindOnMap()
{
m_situationIfc->centerMapToGuezIedObject(m_iedEntityId);
}
void InfoDialog::onIedChanged(const Ied &data, DataModification modType)
{
Q_UNUSED(modType);
if (data.id() != m_iedEntityId)
return;
showIedInfos();
}
void InfoDialog::onIedPositionChanged(const IedPosition &data, DataModification modType)
{
if (data.id() != m_iedEntityId || modType == DataModification::eRemoved)
return;
setPosition(data);
}
void InfoDialog::addTbwBitEntry(QTableWidgetItem *device, QTableWidgetItem *error)
{
m_ui->tbwBit->setSortingEnabled(false);
int newRow = m_ui->tbwBit->rowCount();
if (device || error)
m_ui->tbwBit->insertRow(newRow);
if (device)
m_ui->tbwBit->setItem(newRow, 0, device);
if (error)
m_ui->tbwBit->setItem(newRow, 1, error);
m_ui->tbwBit->setSortingEnabled(true);
}
}
@@ -0,0 +1,79 @@
/**
* @RDE_HEADER@
* GUI Plugin for IED- Info
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-08-23
*/
#pragma once
// Lts
#include <LtsWidgets/lts_dialog.h>
#include <LtsSession/lts_session.h>
// Logger
#include <GuezIedManagement/logger.h>
// Plugins
#include <Plugins/AdvancedSymbology/asb_data_plugin_interface.h>
#include <Plugins/GuezIedManagement/gim_data_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
namespace Ui {
class InfoDialog;
}
class QTableWidgetItem;
namespace GuezIedManagement
{
// --------------------------------------------------------
// BuildingInfoDialog
// --------------------------------------------------------
class InfoDialog : public LtsWidgets::LtsDialog
{
Q_OBJECT
public:
explicit InfoDialog(int iedEntityId, QWidget *parent = nullptr);
~InfoDialog();
bool init(LtsSession::LtsSession *session,
const std::shared_ptr<GuezIedManagement::Interface::Dtc> &dtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
const std::shared_ptr<SituationMap::ForeignGuiInterface> &situationIfc,
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc);
private:
void retranslate() override;
void showIedInfos();
void setPosition(const IedPosition &pos);
void updateIcon(const QColor &color, AdvancedSymbology::Role role,
const IedTacticalState &state, const QString &sidc);
private Q_SLOTS:
void onFindOnMap();
void onIedChanged(const Ied &data, DataModification modType);
void onIedPositionChanged(const IedPosition &data, DataModification modType);
private:
void addTbwBitEntry(QTableWidgetItem* device, QTableWidgetItem* error);
int m_iedEntityId;
LtsSession::LtsSession *m_session;
std::shared_ptr<GuezIedManagement::Interface::Dtc> m_dtc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<SituationMap::ForeignGuiInterface> m_situationIfc;
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asbIfc;
AdvancedSymbology::SymbolResultWatcherLabel *m_symbolWatcher;
Ui::InfoDialog* m_ui;
LOGGER_T m_logger;
};
} // namespace Buildings
@@ -0,0 +1,526 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InfoDialog</class>
<widget class="QWidget" name="InfoDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>363</width>
<height>510</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<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>
<widget class="QLabel" name="lblIcon">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbEquimentNumber">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Equipment Number:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lblEquipmentNumber">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Equipment Number&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="lbParty">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Party:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="lblParty">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Party&gt;</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="lbDesignator">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Designator:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="lblDesignator">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Designator&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="lbPosition">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Position:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lblPosition">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Position&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="pbFindOnMap">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../../../Styles/Light/resources/rme_light_style.qrc">
<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>
<spacer name="horizontalSpacer_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="lbExplosiveForce">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Explosive Force:</string>
</property>
</widget>
</item>
<item row="4" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblExplosiveForce">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Explosive Force&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbExplosiveForceUnit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>kg TNT</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="lbTrigger">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Trigger:</string>
</property>
</widget>
</item>
<item row="5" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="lblTriggerRemote">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>R</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblTriggerButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>B</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblTriggerLightbarrier">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>L</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblTriggerWire">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>W</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="lbPyrotechnics">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Pyrotechnics:</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="lblPyrotechnics">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Pyrotechnics&gt;</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="lbState">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>State:</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="lblState">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;State&gt;</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="lbBit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>BIT:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="8" column="1" colspan="2">
<widget class="QTableWidget" name="tbwBit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>120</number>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>31</number>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Device</string>
</property>
</column>
<column>
<property name="text">
<string>State</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>75</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="../../../Styles/Light/resources/rme_light_style.qrc"/>
</resources>
<connections/>
</ui>
@@ -0,0 +1,109 @@
/**
* @RDE_HEADER@
* Pairing of IED-objects
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-07-28
*/
#include "gim_info_gui_plugin.h"
#include "gim_info_dialog.h"
#include <LtsSession/lts_session.h>
#include <GuezIedManagement/gim_operator_rights.h>
#include <GuezIedManagement/logger.h>
#include <Plugins/AdvancedSymbology/asb_data_plugin_interface.h>
#include <Plugins/GuezIedManagement/gim_data_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
namespace GuezIedManagement
{
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("GuiInterface"))
, m_dtc(nullptr)
, m_ppmDtc(nullptr)
, m_situationIfc(nullptr)
, m_asbIfc(nullptr)
{}
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
QVector<LtsWidgets::PluginData> ret;
/*LtsWidgets::PluginData plData;
plData.menuGroup = menuGroup();
plData.menuText = tr("Info");
plData.identifier = QLatin1String("gimInfo");
plData.menuIcon = QIcon(QLatin1String("icon:set_marker_situation.svg"));
plData.layoutArea = LtsWidgets::LayoutArea::eInfoTab;
plData.createWidgetFunc = [this](QWidget *parent)
{
return onShowInfoWindow(parent, 1);
};
plData.operatorRight = OperatorRights::PairingEdit;
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
ret.append(plData);*/
return ret;
}
bool InterfaceImpl::fetchInterfaces()
{
if (!m_session->getDtc<GuezIedManagement::DataInterface>(m_dtc))
return false;
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
return false;
if (!m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_situationIfc))
return false;
if (!m_session->getForeignDataInterface<AdvancedSymbology::DataInterface>(m_asbIfc))
return false;
return true;
}
void InterfaceImpl::clearInterfaces()
{
m_asbIfc = nullptr;
m_situationIfc = nullptr;
m_ppmDtc = nullptr;
m_dtc = nullptr;
}
void InterfaceImpl::showInfoWindow(const QVector<int> &iedEntityIds)
{
for (auto id : iedEntityIds)
this->showInfoWindow(id);
}
void InterfaceImpl::showInfoWindow(int iedEntityId)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " iedEntityId: " << iedEntityId;
InfoDialog *dialog = new InfoDialog(iedEntityId);
if (!dialog->init(m_session, m_dtc, m_ppmDtc, m_situationIfc, m_asbIfc))
{
delete dialog;
return;
}
m_session->addWidget(dialog, menuGroup(), QString::number(iedEntityId), LtsWidgets::LayoutArea::eInfoTab);
}
LtsWidgets::LtsDialog *InterfaceImpl::onShowInfoWindow(QWidget *parent, int iedEntityId)
{
DEBUG_LOG(m_logger) << "onShowInfoWindow() "
<< " iedEntityId: " << iedEntityId;
InfoDialog *dialog = new InfoDialog(iedEntityId, parent);
dialog->init(m_session, m_dtc, m_ppmDtc, m_situationIfc, m_asbIfc);
return dialog;
}
} // namespace GuezIedManagement
@@ -0,0 +1,85 @@
/**
* @RDE_HEADER@
* Pairing of IED-objects
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-07-28
*/
#pragma once
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Common/ProjectConfig/project_defines.h>
#include <Plugins/GuezIedManagement/gim_info_gui_plugin_interface.h>
namespace ParticipantManagement
{
namespace Interface {
class Dtc;
}
}
namespace SituationMap{
class ForeignGuiInterface;
}
namespace AdvancedSymbology {
class ForeignDataInterface;
}
namespace GuezIedManagement
{
namespace Interface {
class Dtc;
}
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:gim.info")
Q_INTERFACES(GuiPluginBase::Plugin)
Q_OBJECT
public:
explicit GuiPlugin() = default;
~GuiPlugin() = default;
QString pluginName() override { return ForeignGuiInterface::pluginName(); }
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 GuezIedManagement::ForeignGuiInterface, public GuiPluginBase::Interface
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
QString pluginName() { return ForeignGuiInterface::pluginName(); }
QVector<LtsWidgets::PluginData> getActions() override;
QString menuGroup() const override { return tr("IED Management"); }
bool fetchInterfaces() override;
void clearInterfaces() override;
// ForeignDataInterface
void showInfoWindow(const QVector<int> &iedEntityIds) override;
void showInfoWindow(int iedEntityId) override;
private:
LtsWidgets::LtsDialog *onShowInfoWindow(QWidget *parent, int iedEntityId);
std::shared_ptr<GuezIedManagement::Interface::Dtc> m_dtc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<SituationMap::ForeignGuiInterface> m_situationIfc;
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asbIfc;
};
} // namespace GuezIedManagement
@@ -0,0 +1,38 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# Created by Dassow Philipp, SLEA, 2017-07-28
#
SET (gim_pairing_gui_SRCS
gim_pairing_gui_plugin.h
gim_pairing_gui_plugin.cpp
gim_pairing_edit_dialog.h
gim_pairing_edit_dialog.cpp
)
QT5_WRAP_UI(gim_pairing_gui_SRCS
gim_pairing_edit_dialog.ui
)
NGL_ADD_LIBRARY(WS GimPairingGuiPlugin MODULE ${gim_pairing_gui_SRCS})
NGL_TARGET_LINK_LIBRARIES(GimPairingGuiPlugin
PRIVATE
LtsPrinting
svcGimCommon
AsbDataPluginInterface
PUBLIC
LtsSession
LtsUtilsGuiDds
LtsUtilsSettings
GimGuiPairingPluginInterface
GimDataPluginInterface
PpmDataPluginInterface
PpmGuiComboboxPluginInterface
PpmCommon
Qt5::Widgets
)
NGL_INSTALL_TARGET(GimPairingGuiPlugin)
@@ -0,0 +1,287 @@
/**
* @RDE_HEADER@
* Pairing of IED-objects
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-07-28
*/
#include "gim_pairing_edit_dialog.h"
#include "ui_gim_pairing_edit_dialog.h"
#include <AdvancedSymbology/asb_data_plugin_interface.h>
#include <GuezIedManagement/gim_data_plugin_interface.h>
#include <ParticipantManagement/ppm_data_plugin_interface.h>
#include <ParticipantManagement/Gui/Common/participant_edit_model.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <GuezIedManagement/gim_translation.h>
#include <LtsSession/lts_session.h>
#include <LtsPrinting/printing.h>
#include <QTreeView>
namespace GuezIedManagement
{
PairingEditDialog::PairingEditDialog(LtsSession::LtsSession *session, QWidget *parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
, m_session(session)
, m_ui(new Ui::IedPairingEditDialog)
, m_sessionData(nullptr)
, m_dtc(nullptr)
, m_ftc(nullptr)
, m_ppmDtc(nullptr)
, m_ppmGuiCbxIfc(nullptr)
, m_participantModel(nullptr)
, m_requestHelper(new LtsUtils::RequestHelper(this))
, m_logger(getLogger("GuezIedManangementPairingEditDialog"))
{
m_ui->setupUi(this);
m_uiRequirements->addRequirement({m_ui->lblPairingState, [this]() { return applyPairingStateCheck(); }});
m_uiRequirements->addRequirement({m_ui->lblParticipantsTree, [this]() { return applyParticipantSelectionCheck(); }});
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &PairingEditDialog::onPrint);
setOnlineHelpFilename(QStringLiteral("Situation-IED"));
}
bool PairingEditDialog::init(LtsSession::LtsSessionDataDds *session)
{
m_sessionData = session;
m_sessionData->getDtc<GuezIedManagement::DataInterface>(m_dtc);
if (!m_dtc || !m_dtc->enableIed())
{
ERROR_LOG(m_logger) << "could not enable Ied DDS-objects in GuezIedManagement DTC ";
return false;
}
m_sessionData->getFtc<GuezIedManagement::DataInterface>(m_ftc);
if (!m_ftc || !m_ftc->enablePairIed())
{
ERROR_LOG(m_logger) << "could not enable pair Ied DDS-Function in GuezIedManagement FTC ";
return false;
}
m_sessionData->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc);
if (!m_ppmDtc || !m_ppmDtc->enableParticipant())
{
ERROR_LOG(m_logger) << "could not enable Participant DDS-objects in ParticipantManagement DTC ";
return false;
}
m_sessionData->getForeignGuiInterface<ParticipantManagement::ForeignGuiComboboxInterface>(m_ppmGuiCbxIfc);
if (!m_ppmGuiCbxIfc)
return false;
connect(m_dtc.get(), &Interface::Dtc::iedChanged, this, &PairingEditDialog::onIedChanged);
connect(m_ui->cbxIed, static_cast<void (LtsWidgets::LtsComboBox::*)(int)>(&LtsWidgets::LtsComboBox::currentIndexChanged), this, &PairingEditDialog::onIedSelected);
connect(m_ui->cbxPairingState, static_cast<void (LtsWidgets::LtsComboBox::*)(int)>(&LtsWidgets::LtsComboBox::currentIndexChanged), this, &PairingEditDialog::onPairingStateSelected);
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> asb;
session->getForeignDataInterface<AdvancedSymbology::DataInterface>(asb);
m_participantModel = new ParticipantManagement::ParticipantEditModel(this, m_ppmDtc, asb);
m_participantModel->setUnitsSelectable(false);
m_ui->treeViewParticipants->setModel(m_participantModel);
connect(m_ui->cbxParty,
static_cast<void (LtsWidgets::LtsComboBox::*)(int)>(&LtsWidgets::LtsComboBox::currentIndexChanged),
this, &PairingEditDialog::onReInitModel);
connect(m_ui->treeViewParticipants, &QTreeView::clicked, this, &PairingEditDialog::onParticipantSelected);
fillAllCbx();
enDisableUiElements();
return true;
}
PairingEditDialog::~PairingEditDialog()
{
delete m_ui;
}
void PairingEditDialog::onIedSelected(int idx)
{
Q_UNUSED(idx);
Ied ied = m_dtc->ied(m_ui->cbxIed->currentData().toInt());
setUnchangeable(true);
m_ui->cbxPairingState->setCurrentIndex(m_ui->cbxPairingState->findData(QVariant(ied.pairingState().underlying())));
m_ui->treeViewParticipants->clearSelection();
if (ied.pairingState().underlying() == IedPairingState_def::PairedToParticipant)
{
m_ui->cbxParty->setCurrentIndex(m_ui->cbxParty->findData(m_ppmDtc->participant(ied.pairedParticipantId().get()).partyId()));
m_participantModel->selectItemByParticipantId(ied.pairedParticipantId().get(), [this](const QModelIndex &idx){m_ui->treeViewParticipants->setCurrentIndex(idx);});
}
setUnchangeable(false);
enDisableUiElements();
}
void PairingEditDialog::onPairingStateSelected(int idx)
{
Q_UNUSED(idx);
enDisableUiElements();
}
void PairingEditDialog::onIedChanged(const Ied &data, DataModification modType)
{
Q_UNUSED(data);
Q_UNUSED(modType);
fillIedCbx();
enDisableUiElements();
}
void PairingEditDialog::onParticipantSelected(const QModelIndex &idx)
{
DEBUG_LOG(m_logger) << "Index of Item: " << idx.row() << " " << idx.column();
if (checkSelectedParticipantType())
{
Ied ied = m_dtc->ied(m_ui->cbxIed->currentData().toInt());
if (ied.pairingState() == IedPairingState_def::PairedToParticipant)
{
// was paired, check if new participant selected
if (m_participantModel->getParticipantData(idx).id() != ied.pairedParticipantId().get())
slotChangesMade();
}
else
slotChangesMade();
}
}
void PairingEditDialog::retranslate()
{
translate(m_ui, tr("IED Pairing"));
fillAllCbx();
enDisableUiElements();
}
bool PairingEditDialog::apply()
{
if (m_ui->cbxIed->count() > 0)
{
PairIedRequest request;
request.id(m_ui->cbxIed->currentData().toInt());
request.pairingState(static_cast<IedPairingState::inner_enum>(m_ui->cbxPairingState->currentData().toInt()));
if (request.pairingState().underlying() == IedPairingState_def::PairedToParticipant)
request.pairedParticipantId(dds::core::optional<int32_t>(m_participantModel->getParticipantData(m_ui->treeViewParticipants->currentIndex()).id()));
return m_requestHelper->startSingleRequest([=]()
{
return m_ftc->pairIedRequest(request, this);
});
}
return false;
}
bool PairingEditDialog::applyPairingStateCheck()
{
Ied ied = m_dtc->ied(m_ui->cbxIed->currentData().toInt());
// was notPairedand and still notPaired selected?
if (ied.pairingState() == IedPairingState_def::NotPaired && m_ui->cbxPairingState->currentData().toInt() == ied.pairingState().underlying())
return false;
return true;
}
bool PairingEditDialog::applyParticipantSelectionCheck()
{
// is pairedToParticipant selected ?
if (m_ui->cbxPairingState->currentData().toInt() == IedPairingState_def::PairedToParticipant)
{
Ied ied = m_dtc->ied(m_ui->cbxIed->currentData().toInt());
if (ied.pairingState().underlying() == IedPairingState_def::PairedToParticipant)
{
if (checkSelectedParticipantType())
{
// ied was already paired, did the paired participant changend?
if (ied.pairedParticipantId() == m_participantModel->getParticipantData(m_ui->treeViewParticipants->currentIndex()).id())
return false;
// check if selected item is a player not a unit
return true;
}
}
else // ied was not paired before, just check if is a player not a unit
return checkSelectedParticipantType();
}
return true; // is not paired
}
bool PairingEditDialog::checkSelectedParticipantType()
{
ParticipantManagement::Type type = m_ppmDtc->type(m_participantModel->getParticipantData(m_ui->treeViewParticipants->currentIndex()).typeId());
return ((type.typeClass().underlying() != ParticipantManagement::TypeClass_def::SupportUnit) &&
(type.typeClass().underlying() != ParticipantManagement::TypeClass_def::Unit));
}
void PairingEditDialog::fillIedCbx()
{
// current Ied
int curIdxIed = m_ui->cbxIed->currentIndex();
m_ui->cbxIed->clear();
const QMap <qint32, GuezIedManagement::Ied> mapIed = m_dtc->ieds();
for (auto it = mapIed.begin(); it != mapIed.end(); ++it)
m_ui->cbxIed->addItem(QString::number(it.value().equipmentNumber()), QVariant(it.value().id()));
if (curIdxIed >= 0)
m_ui->cbxIed->setCurrentIndex(curIdxIed);
else
m_ui->cbxIed->setCurrentIndex(0);
}
void PairingEditDialog::fillPairingState()
{
m_ui->cbxPairingState->clear();
m_ui->cbxPairingState->addItem(GuezIedManagement::toString(IedPairingState(IedPairingState_def::NotPaired).underlying()), IedPairingState_def::NotPaired);
m_ui->cbxPairingState->addItem(GuezIedManagement::toString(IedPairingState(IedPairingState_def::PairedToParticipant).underlying()), IedPairingState_def::PairedToParticipant);
}
void PairingEditDialog::fillPartyCbx()
{
m_ppmGuiCbxIfc->fillPartyComboBox(m_ui->cbxParty);
}
void PairingEditDialog::fillAllCbx()
{
fillPairingState();
fillPartyCbx();
// initial init, as fillIedCbx() needs a filled model and onReInitModel needs fillPartyCbx()
onReInitModel();
fillIedCbx(); // has to be filled last (sets other ui-elements corresponding to IED-Object data)
}
void PairingEditDialog::enDisableUiElements()
{
m_ui->cbxIed->setEnabled(m_ui->cbxIed->count() > 1);
m_ui->cbxPairingState->setEnabled(m_ui->cbxIed->count() > 0 && m_participantModel->rowCount() > 0);
if (m_ui->cbxPairingState->currentData().toInt() == IedPairingState_def::NotPaired)
{
m_ui->cbxParty->setEnabled(false);
m_ui->treeViewParticipants->setEnabled(false);
}
else
{
m_ui->cbxParty->setEnabled((m_ui->cbxIed->count() > 0) && (m_ui->cbxParty->count() > 1));
m_ui->treeViewParticipants->setEnabled(m_participantModel->rowCount());
}
}
void PairingEditDialog::onReInitModel()
{
m_participantModel->onReinitModel(m_ui->cbxParty->currentData().toInt());
m_ui->treeViewParticipants->expandAll();
}
void PairingEditDialog::onPrint()
{
LtsPrinting::printView(m_session, this, m_ui->treeViewParticipants );
}
} // namespace Test
@@ -0,0 +1,89 @@
/**
* @RDE_HEADER@
* Pairing of IED-objects
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-07-28
*/
#pragma once
#include <GuezIedManagement/gim_dtc.h>
#include <GuezIedManagement/gim_ftc.h>
#include <GuezIedManagement/logger.h>
#include <ParticipantManagement/ppm_dtc.h>
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
#include <LtsSession/lts_session.h>
#include <LtsWidgets/lts_dialog.h>
#include <LtsUtilsGuiDds/request_helper.h>
namespace ParticipantManagement
{
class ParticipantEditModel;
}
namespace Ui
{
class IedPairingEditDialog;
}
namespace LtsSession
{
class LtsSession;
}
namespace GuezIedManagement
{
class PairingEditDialog : public LtsWidgets::LtsDialog
, protected GuezIedManagement::Interface::Ftc::PairIedReplyHandler
{
Q_OBJECT
public:
explicit PairingEditDialog(LtsSession::LtsSession * session, QWidget *parent = nullptr);
bool init (LtsSession::LtsSessionDataDds *session);
~PairingEditDialog();
void onPairIedReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
private slots:
void onIedSelected(int idx);
void onPairingStateSelected(int idx);
void onIedChanged(const Ied &data, DataModification modType);
void onParticipantSelected(const QModelIndex &idx);
void onReInitModel();
void onPrint();
private:
void retranslate() override;
bool apply() override final;
bool applyPairingStateCheck();
bool applyParticipantSelectionCheck();
bool checkSelectedParticipantType();
void fillIedCbx();
void fillPairingState();
void fillPartyCbx();
void fillAllCbx();
void enDisableUiElements();
LtsSession::LtsSession *m_session;
Ui::IedPairingEditDialog *m_ui;
LtsSession::LtsSessionDataDds *m_sessionData;
std::shared_ptr<Interface::Dtc> m_dtc;
std::shared_ptr<Interface::Ftc> m_ftc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
ParticipantManagement::ParticipantEditModel *m_participantModel;
LtsUtils::RequestHelper *m_requestHelper;
LOGGER_T m_logger;
};
} // namespace GuezIedManagement
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>IedPairingEditDialog</class>
<widget class="QWidget" name="IedPairingEditDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>577</width>
<height>266</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblIed">
<property name="text">
<string>IED:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="LtsWidgets::LtsComboBox" name="cbxIed">
<property name="currentText">
<string notr="true"/>
</property>
<property name="const" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lblPairingState">
<property name="text">
<string>Pairing State:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="LtsWidgets::LtsComboBox" name="cbxPairingState">
<property name="currentText">
<string notr="true"/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblParty">
<property name="text">
<string>Party:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="LtsWidgets::LtsComboBox" name="cbxParty">
<property name="currentText">
<string notr="true"/>
</property>
<property name="const" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>158</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>94</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblParticipantsTree">
<property name="text">
<string>Participants:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QTreeView" name="treeViewParticipants"/>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</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>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,89 @@
/**
* @RDE_HEADER@
* Pairing of IED-objects
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-07-28
*/
#include "gim_pairing_gui_plugin.h"
#include "gim_pairing_edit_dialog.h"
#include <LtsSession/lts_session.h>
#include <LtsUtilsSettings/settings.h>
#include <GuezIedManagement/gim_operator_rights.h>
#include <GuezIedManagement/logger.h>
#include <Plugins/GuezIedManagement/gim_data_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
namespace GuezIedManagement
{
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("PairingGuiPlugin"))
, m_dtc(nullptr)
, m_ftc(nullptr)
, m_ppmDtc(nullptr)
, m_ppmGuiCbxIfc(nullptr)
{}
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
QVector<LtsWidgets::PluginData> ret;
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
const bool enableIED_Pairing = ps->value(QStringLiteral("gim"),
QStringLiteral("enableIED_Pairing")).toBool();
if (!m_session->isReplayPartition() && enableIED_Pairing)
{
LtsWidgets::PluginData plData;
plData.menuGroup = menuGroup();
plData.menuText = tr("IED Pairing");
plData.identifier = QLatin1String("gimPairingEdit");
plData.menuIcon = QIcon(QLatin1String("icon:ied_pairing.svg")),
plData.createWidgetFunc = [this](QWidget *parent)
{
return LtsWidgets::initDialog(new PairingEditDialog(m_session, parent),
m_session);
};
plData.operatorRight = OperatorRights::PairingEdit;
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
ret.append(plData);
}
return ret;
}
bool InterfaceImpl::fetchInterfaces()
{
if (!m_session->getDtc<GuezIedManagement::DataInterface>(m_dtc))
return false;
if (!m_session->getFtc<GuezIedManagement::DataInterface>(m_ftc))
return false;
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
return false;
if(!m_session->getForeignGuiInterface<ParticipantManagement::ForeignGuiComboboxInterface>(m_ppmGuiCbxIfc))
return false;
return true;
}
void InterfaceImpl::clearInterfaces()
{
m_ppmGuiCbxIfc = nullptr;
m_ppmDtc = nullptr;
m_ftc = nullptr;
m_dtc = nullptr;
}
} // namespace GuezIedManagement
@@ -0,0 +1,72 @@
/**
* @RDE_HEADER@
* Pairing of IED-objects
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-07-28
*/
#pragma once
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Common/ProjectConfig/project_defines.h>
#include <Plugins/GuezIedManagement/gim_pairing_gui_plugin_interface.h>
namespace ParticipantManagement
{
namespace Interface {
class Dtc;
}
class ForeignGuiComboboxInterface;
}
namespace GuezIedManagement
{
namespace Interface {
class Dtc;
class Ftc;
}
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:gim.pairingedit")
Q_INTERFACES(GuiPluginBase::Plugin)
Q_OBJECT
public:
explicit GuiPlugin() = default;
~GuiPlugin() = default;
QString pluginName() override { return ForeignGuiInterface::pluginName(); }
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);
QString pluginName() { return ForeignGuiInterface::pluginName(); }
QVector<LtsWidgets::PluginData> getActions() override;
QString menuGroup() const override { return tr("Participants");}
bool fetchInterfaces() override;
void clearInterfaces() override;
private:
std::shared_ptr<GuezIedManagement::Interface::Dtc> m_dtc;
std::shared_ptr<GuezIedManagement::Interface::Ftc> m_ftc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
};
} // namespace GuezIedManagement
+30
View File
@@ -0,0 +1,30 @@
/**
* @RDE_HEADER@
* HMI Plugin for GuezIedManagement (Interface for access from other Plugins)
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-08-15
*/
#pragma once
#include <PluginInterfaces/data_plugin_interface.h>
#include <GuezIedManagement/gim_dtc.h>
#include <GuezIedManagement/gim_ftc.h>
namespace GuezIedManagement
{
/**
* @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<GuezIedManagement::Interface::Dtc> getDtc() = 0;
virtual std::shared_ptr<GuezIedManagement::Interface::Ftc> getFtc() = 0;
};
} // namespace GuezIedManagement
@@ -0,0 +1,32 @@
/*
* @RDE_HEADER@
*
* Pairing of IEDs
*
* $Id$
* $HeadURL$
* $Author$
*
* Created by Dassow Philipp, SLEA, 2017-07-28
*/
#pragma once
#include <QString>
#include <QVector>
namespace GuezIedManagement
{
class ForeignGuiInterface
{
public:
ForeignGuiInterface() = default;
virtual ~ForeignGuiInterface() = default;
virtual void showInfoWindow(const QVector<int> &aesEntityId) = 0;
virtual void showInfoWindow(int bldEntityId) = 0;
static QString pluginName() { return QStringLiteral("GuezIedManagementInfoGuiPlugin"); }
};
}
@@ -0,0 +1,27 @@
/*
* @RDE_HEADER@
*
* Pairing of IEDs
*
* $Id$
* $HeadURL$
* $Author$
*
* Created by Dassow Philipp, SLEA, 2017-07-28
*/
#pragma once
class QObject;
namespace GuezIedManagement
{
class ForeignGuiInterface
{
public:
ForeignGuiInterface() = default;
virtual ~ForeignGuiInterface() = default;
static QString pluginName() { return QStringLiteral("GuezIedManagementPairingGuiPlugin"); }
};
}