Files
qt5-legatus-legacy/Lts/Plugins/EffectShowManagement/Gui/esm_effect_show_gui_plugin.cpp
T
2026-08-13 18:33:10 +02:00

138 lines
4.1 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Gui Plugin for MeteoDataManagement
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-10-05
*/
#include "esm_effect_show_list.h"
#include "esm_effect_show_actor_relocation_list.h"
#include "esm_effect_show_actor_list.h"
#include "esm_effect_show_gui_plugin.h"
#include <LtsSession/lts_session.h>
#include <Services/EffectShowManagement/esm_operator_rights.h>
#include <ParticipantManagement/ppm_data_plugin_interface.h>
#include <LtsUtilsSettings/settings.h>
namespace EffectShowManagement
{
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("Plugins.Gui.Esm.EffectShow"))
, m_dtc(nullptr)
, m_ftc(nullptr)
, m_dtcPpm(nullptr)
, m_dtcPdm(nullptr)
{}
bool InterfaceImpl::fetchInterfaces()
{
if (!m_session->getDtc<EffectShowManagement::DataInterface>(m_dtc))
return false;
if (!m_session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
return false;
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_dtcPpm))
return false;
if (!m_session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc))
return false;
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(m_dtcPdm))
return false;
return true;
}
void InterfaceImpl::clearInterfaces()
{
m_dtc = nullptr;
m_ftc = nullptr;
m_dtcPpm = nullptr;
m_dtcPdm = nullptr;
}
QString InterfaceImpl::menuGroup() const
{
return tr("Effect Representation");
}
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
QVector<LtsWidgets::PluginData> ret;
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
const bool enableEffectShowManagement = ps->value(QStringLiteral("esm"),
QStringLiteral("enableEffectShowManagement")).toBool();
if (enableEffectShowManagement)
{
LtsWidgets::PluginData plData;
plData.menuGroup = menuGroup();
plData.menuText = tr("Effect Representations");
plData.identifier = QLatin1String("esmEffectShowList");
plData.menuIcon = QIcon(QLatin1String("icon:create_evaluation_topic.svg"));
plData.operatorRight = OperatorRights::EffectShowEdit;
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
plData.createWidgetFunc = [this](QWidget * parent)
{
return onShowEffectShows(parent);
};
ret.append(plData);
plData.menuGroup = menuGroup();
plData.menuText = tr("Actor Position Relocations");
plData.identifier = QLatin1String("esmEffectShowActorRelocationList");
plData.menuIcon = QIcon(QLatin1String("icon:reloc_vehicle.svg"));
plData.operatorRight = OperatorRights::RelocationsEdit;
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
plData.createWidgetFunc = [this](QWidget * parent)
{
return onShowEffectShowActorRelocations(parent);
};
ret.append(plData);
plData.menuGroup = menuGroup();
plData.menuText = tr("Effect Actors");
plData.identifier = QLatin1String("esmEffectShowActorList");
plData.menuIcon = QIcon(QLatin1String("icon:visible_teams.svg"));
plData.operatorRight = OperatorRights::ActorEdit;
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
plData.createWidgetFunc = [this](QWidget * parent)
{
return onShowEffectShowActors(parent);
};
ret.append(plData);
}
return ret;
}
LtsWidgets::LtsDialog *InterfaceImpl::onShowEffectShows(QWidget *parent)
{
return LtsWidgets::initDialog(new EffectShowList(menuGroup(), parent),
m_session);
}
LtsWidgets::LtsDialog *InterfaceImpl::onShowEffectShowActorRelocations(QWidget *parent)
{
return LtsWidgets::initDialog(new EffectShowActorRelocationList(menuGroup(), parent),
m_session);
}
LtsWidgets::LtsDialog *InterfaceImpl::onShowEffectShowActors(QWidget *parent)
{
return LtsWidgets::initDialog(new EffectShowActorList(parent),
m_session);
}
} // namespace EffectShowManagement