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