Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user