90 lines
2.6 KiB
C++
Executable File
90 lines
2.6 KiB
C++
Executable File
/**
|
|
* @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
|