189 lines
5.3 KiB
C++
Executable File
189 lines
5.3 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Gui Plugin for TargetManagement
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Norbert Thoden, NLE, 2020-05-29
|
|
*/
|
|
|
|
#include "tgt_target_gui_plugin.h"
|
|
#include "tgt_target_part_dialog.h"
|
|
#include "tgt_target_area_assignment_dialog.h"
|
|
#include "tgt_area_dialog.h"
|
|
|
|
#include <LtsSession/lts_session.h>
|
|
#include <LtsWidgets/lts_base_layout_widget.h>
|
|
|
|
//#include <Services/ParticipantManagement/ppm_operator_rights.h>
|
|
|
|
|
|
namespace TargetManagement
|
|
{
|
|
|
|
const char s_targetAreaAssignmentIdentifier[] = "tgtAssignments";
|
|
|
|
|
|
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.Tgt.Target"))
|
|
{}
|
|
|
|
|
|
bool InterfaceImpl::fetchInterfaces()
|
|
{
|
|
if (!m_session->getDtc<TargetManagement::DataInterface>(m_dtc))
|
|
return false;
|
|
if (!m_session->getFtc<TargetManagement::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;
|
|
|
|
if (!m_session->getForeignGuiInterface<FileManagement::ForeignGuiInterface>(m_flmGui))
|
|
return false;
|
|
|
|
if (!m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc))
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
void InterfaceImpl::clearInterfaces()
|
|
{
|
|
m_dtc = nullptr;
|
|
m_ftc = nullptr;
|
|
}
|
|
|
|
QString InterfaceImpl::menuGroup() const
|
|
{
|
|
return tr("Participants / Targets");
|
|
}
|
|
|
|
|
|
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
|
{
|
|
QVector<LtsWidgets::PluginData> ret;
|
|
|
|
LtsWidgets::PluginData plData;
|
|
plData.menuGroup = menuGroup();
|
|
|
|
//
|
|
// "TargetBaseConfiguration"
|
|
//
|
|
plData.menuText = tr("Assign/Configure Targets"); // BaseConfiguration like ActivateLaserDesignation...
|
|
plData.identifier = QLatin1String("tgtTargetBaseConfiguration");
|
|
plData.menuIcon = QIcon(QLatin1String("icon:target.svg"));
|
|
// plData.operatorRight = OperatorRights::PartyEdit::PartiesShow;
|
|
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
|
plData.createWidgetFunc = [this](QWidget * parent)
|
|
{
|
|
return onShowTargetBaseConfiguration(parent);
|
|
};
|
|
ret.append(plData);
|
|
|
|
|
|
if (m_session->app() == LtsAppDescriptor::App::Shootback)
|
|
{
|
|
|
|
//
|
|
// "ShootbackApp"
|
|
//
|
|
plData.menuText = tr("Configure Shootback");
|
|
plData.identifier = QLatin1String("tgtAssignConfigureTarget");
|
|
plData.menuIcon = QIcon(QLatin1String("icon:party_edit.svg"));
|
|
// plData.operatorRight = OperatorRights::PartyEdit::PartiesShow;
|
|
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
|
plData.createWidgetFunc = [this](QWidget * parent)
|
|
{
|
|
return onShowTargets(parent);
|
|
};
|
|
ret.append(plData);
|
|
|
|
plData.menuText = tr("Shootback Overview"); //areaId
|
|
plData.identifier = QLatin1String(s_targetAreaAssignmentIdentifier);
|
|
plData.menuIcon = QIcon(QLatin1String("icon:party_edit.svg"));
|
|
// plData.operatorRight = OperatorRights::PartyEdit::PartiesShow;
|
|
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
|
plData.createWidgetFunc = [this](QWidget * parent)
|
|
{
|
|
return onShowTargetAreaAssignment(parent);
|
|
};
|
|
|
|
ret.append(plData);
|
|
|
|
plData.menuText = tr("Configure Areas");
|
|
plData.identifier = QLatin1String("tgtAreas");
|
|
plData.menuIcon = QIcon(QLatin1String("icon:party_edit.svg"));
|
|
// plData.operatorRight = OperatorRights::PartyEdit::PartiesShow;
|
|
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
|
plData.createWidgetFunc = [this](QWidget * parent)
|
|
{
|
|
return onShowAreas(parent);
|
|
};
|
|
ret.append(plData);
|
|
|
|
} // if (m_session->app() == LtsAppDescriptor::App::Shootback)
|
|
|
|
return ret;
|
|
}
|
|
|
|
|
|
LtsWidgets::LtsDialog *InterfaceImpl::onShowTargetBaseConfiguration(QWidget *parent)
|
|
{
|
|
TargetPartDialog *dlg = new TargetPartDialog(menuGroup(), m_session, parent);
|
|
if (!dlg->init(TargetPartDialog::MODE::TARGET_BASE_CONFIGURATION))
|
|
{
|
|
dlg->deleteLater();
|
|
return nullptr;
|
|
}
|
|
|
|
const QString identifier(QStringLiteral("tgtTargetBaseConfigurationXX"));
|
|
if (!m_session->addWidget(dlg, menuGroup(), identifier, LtsWidgets::LayoutArea::eDialogTab))
|
|
dlg->deleteLater();
|
|
|
|
return dlg;
|
|
}
|
|
|
|
LtsWidgets::LtsDialog *InterfaceImpl::onShowTargets(QWidget *parent)
|
|
{
|
|
TargetPartDialog *dlg = new TargetPartDialog(menuGroup(), m_session, parent);
|
|
if (!dlg->init(TargetPartDialog::MODE::TARGET_OVERVIEW))
|
|
{
|
|
dlg->deleteLater();
|
|
return nullptr;
|
|
}
|
|
|
|
const QString identifier(QStringLiteral("tgtAssignConfigureTargetXX"));
|
|
if (!m_session->addWidget(dlg, menuGroup(), identifier, LtsWidgets::LayoutArea::eDialogTab))
|
|
dlg->deleteLater();
|
|
|
|
return dlg;
|
|
}
|
|
|
|
LtsWidgets::LtsDialog *InterfaceImpl::onShowTargetAreaAssignment(QWidget *parent)
|
|
{
|
|
// init with parameter
|
|
m_targetAreaAssignmentDialog = LtsWidgets::initDialog(new AssignmentDialog(menuGroup(), m_session, parent));
|
|
return m_targetAreaAssignmentDialog;
|
|
}
|
|
|
|
LtsWidgets::LtsDialog *InterfaceImpl::onShowAreas(QWidget *parent)
|
|
{
|
|
// init without parameter
|
|
return LtsWidgets::initDialog(new AreaDialog(menuGroup(), m_session, parent));
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace TargetManagement
|