Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Malte Diers, SLSE, 2017-04-06
|
||||
#
|
||||
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
AesChargeEffectGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aes_charge_effect_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
)
|
||||
|
||||
SET(aes_charge_effect_gui_SRCS
|
||||
aes_charge_effect_gui_plugin.cpp
|
||||
aes_charge_effect_gui_plugin.h
|
||||
aes_charge_effect_edit.cpp
|
||||
aes_charge_effect_edit.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(aes_charge_effect_gui_SRCS
|
||||
aes_charge_effect_edit.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS AesChargeEffectGuiPlugin MODULE ${aes_charge_effect_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(AesChargeEffectGuiPlugin
|
||||
AesBaseGui
|
||||
AesChargeEffectGuiPluginInterface
|
||||
ngltools
|
||||
NGLLogger
|
||||
LtsSessionData
|
||||
AesDataPluginInterface
|
||||
PpmGuiComboboxPluginInterface
|
||||
PpmDataPluginInterface
|
||||
PpmParticipantSelectionGui
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
AsbDataPluginInterface
|
||||
advancedSymbologyGui
|
||||
LtsUtilsSettings
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(AesChargeEffectGuiPlugin)
|
||||
|
||||
|
||||
+312
@@ -0,0 +1,312 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Charge Effect Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Müller, ESZE, 2025-08-19
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
#include <Plugins/AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/Gui/ParticipantSelection/participant_selection.h>
|
||||
#include <Plugins/ParticipantManagement/Gui/Common/participant_edit_model.h>
|
||||
#include <AreaEffectSimulation/Utils/polygons.h>
|
||||
#include <AreaEffectSimulation/aes_translation.h>
|
||||
#include <SituationMap/Map/map.h>
|
||||
|
||||
|
||||
#include "aes_charge_effect_edit.h"
|
||||
#include "ui_aes_charge_effect_edit.h"
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
ChargeEffectEdit::ChargeEffectEdit(const QString &menuGroup, QWidget *parent)
|
||||
: BaseEdit(menuGroup, QLatin1String("ChargeEffectEdit"), parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_ui(new Ui::ChargeEffectEdit)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->pbPosition->setEnabled(false);
|
||||
m_ui->lblFuze->setVisible(false);
|
||||
m_ui->cbFuze->setVisible(false);
|
||||
m_ui->lblWeapon->setVisible(false);
|
||||
m_ui->cbWeapon->setVisible(false);
|
||||
enaDisa();
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Add_Charge_Effect"));
|
||||
}
|
||||
|
||||
ChargeEffectEdit::~ChargeEffectEdit()
|
||||
{
|
||||
m_sitMapGuiIfc = nullptr;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool ChargeEffectEdit::apply()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Apply";
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChargeEffectEdit::showPreviewObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool ChargeEffectEdit::init(int areaId, bool copy,
|
||||
LtsSession::LtsSession *session)
|
||||
{
|
||||
Q_UNUSED(copy)
|
||||
|
||||
if (!BaseEdit::init(areaId, session)) //areaId is aesItemId
|
||||
return false;
|
||||
|
||||
if (!session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc))
|
||||
return false;
|
||||
|
||||
if (!session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
||||
return false;
|
||||
|
||||
// PDM
|
||||
if (!session->getDtc<ProjectDataManagement::DataInterface>(m_pdmDtc))
|
||||
{
|
||||
ERROR_LOG(m_logger) << " failed to get pdmDtc";
|
||||
return false;
|
||||
}
|
||||
m_pdmDtc->waitForHistoricalDataChargeType(1000);
|
||||
m_pdmDtc->waitForHistoricalDataGearType(1000);
|
||||
m_pdmDtc->waitForHistoricalDataGearTypeChargeType(1000);
|
||||
|
||||
connect(m_ui->cbPlayer, &QCheckBox::toggled, this, &ChargeEffectEdit::onChangeParty);
|
||||
|
||||
bool editable = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::ChargeEffectEdit) &&
|
||||
m_session->app() != LtsAppDescriptor::App::OC;
|
||||
|
||||
if (!editable)
|
||||
return false;
|
||||
|
||||
session->getForeignDataInterface<AdvancedSymbology::DataInterface>(m_asb);
|
||||
m_participantModel = new ParticipantManagement::ParticipantEditModel(this, m_ppmDtc, m_asb);
|
||||
m_participantModel->setUnitsSelectable(false);
|
||||
// only needed to set recursiveFilteringEnabled
|
||||
auto proxyModel = new ParticipantManagement::ParticipantTreeFilterProxyModel(this);
|
||||
proxyModel->setSourceModel(m_participantModel);
|
||||
proxyModel->setRecursiveFilteringEnabled(true);
|
||||
m_ui->dvParticipants->setModel(proxyModel);
|
||||
m_ui->dvParticipants->setToolButtonsVisible(false);
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->dvParticipants->hideColumn(ParticipantManagement::ParticipantEditModel::ColParticipantId);
|
||||
#endif
|
||||
m_ui->dvParticipants->setSortIndicator(0, Qt::AscendingOrder);
|
||||
|
||||
connect(m_ui->dvParticipants, &LtsDataView::LtsDataView::selectionChanged,
|
||||
this, &ChargeEffectEdit::onSelectionChanged);
|
||||
|
||||
connect(m_ui->cbParty,
|
||||
static_cast<void (LtsWidgets::LtsComboBox::*)(int)>(&LtsWidgets::LtsComboBox::currentIndexChanged),
|
||||
this, &ChargeEffectEdit::onChangeParty);
|
||||
|
||||
m_ppmGuiCbxIfc->fillPartyComboBox(m_ui->cbParty);
|
||||
onChangeParty();
|
||||
|
||||
fillCharges();
|
||||
if (m_ui->cbChargeType->count())
|
||||
m_ui->pbPosition->setEnabled(true);
|
||||
|
||||
// enableUiElements(editable && isModifiable() && !isOnlyNameModifiable());
|
||||
|
||||
m_ui->pbPosition->setIcon(QIcon(QStringLiteral("icon:position.svg")));
|
||||
|
||||
connect(m_ui->pbPosition, &QPushButton::toggled, this, &ChargeEffectEdit::onPositionButtonToggled);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChargeEffectEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, m_aesItem, tr("Charge Effect"));
|
||||
}
|
||||
|
||||
void ChargeEffectEdit::enableUiElements(bool enable)
|
||||
{
|
||||
Q_UNUSED(enable);
|
||||
}
|
||||
|
||||
void ChargeEffectEdit::onChangeParty()
|
||||
{
|
||||
if (m_ui->cbPlayer->isChecked())
|
||||
{
|
||||
m_ui->dvParticipants->setEnabled(true);
|
||||
m_participantModel->onReinitModel(m_ui->cbParty->currentData().toInt());
|
||||
m_ui->dvParticipants->expandAll();
|
||||
m_ui->pbPosition->setEnabled(false);
|
||||
cancelPositionTrigger();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->dvParticipants->setEnabled(false);
|
||||
m_participantModel->resetModel();
|
||||
if (m_ui->cbChargeType->count())
|
||||
m_ui->pbPosition->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ChargeEffectEdit::onSelectionChanged()
|
||||
{
|
||||
m_ui->pbPosition->setEnabled(false);
|
||||
|
||||
if (m_ui->dvParticipants->selectedRows().isEmpty())
|
||||
return;
|
||||
|
||||
const ParticipantManagement::ParticipantData data(m_participantModel->getParticipantData(m_ui->dvParticipants->selectedRows().first()));
|
||||
DEBUG_LOG(m_logger) << "ParticipantId: " << data.id();
|
||||
|
||||
if (m_ppmDtc->type(data.typeId()).typeClass() == ParticipantManagement::TypeClass_def::Unit)
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "typeClass: " << m_ppmDtc->type(data.typeId()).typeClass()
|
||||
<< " eqNr.isSet(): " << data.equipmentNumber().is_set();
|
||||
|
||||
if (data.equipmentNumber().is_set())
|
||||
{
|
||||
if (m_ui->cbChargeType->count())
|
||||
m_ui->pbPosition->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ChargeEffectEdit::onPositionButtonToggled(bool isChecked)
|
||||
{
|
||||
if (isChecked)
|
||||
{
|
||||
m_ui->pbPosition->setStyleSheet(QStringLiteral("background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop: 0 rgb(254, 45, 102), stop: 1 rgb(255, 92, 61));"));
|
||||
getPosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->pbPosition->setStyleSheet(QStringLiteral(""));
|
||||
m_sitMapGuiIfc->cancelActiveRubberbands();
|
||||
}
|
||||
}
|
||||
|
||||
void ChargeEffectEdit::getPosition()
|
||||
{
|
||||
|
||||
if (!m_sitMapGuiIfc) //sanity
|
||||
return;
|
||||
|
||||
if (m_sitMapGuiIfc->mapMode() != SituationMap::MapMode::MapMode_2D)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this, tr("Only available in 2D mode"));
|
||||
return;
|
||||
}
|
||||
m_sitMapGuiIfc->getCoordinate(this, SLOT(onGetCoordinate(QPointF)), SLOT(onEscapePressed(QString)));
|
||||
}
|
||||
|
||||
void ChargeEffectEdit::onGetCoordinate(const QPointF &coordinate)
|
||||
{
|
||||
ParticipantManagement::ParticipantData participantData;
|
||||
const QModelIndexList indexList = m_ui->dvParticipants->selectedRows();
|
||||
int checked = m_ui->cbPlayer->isChecked();
|
||||
if (checked && indexList.size())
|
||||
participantData = m_participantModel->getParticipantData(indexList.first());
|
||||
|
||||
const int chargeTypeId = m_ui->cbChargeType->currentData().toInt();
|
||||
const int partyId = m_ui->cbParty->currentData().toInt();
|
||||
DEBUG_LOG(m_logger) << "ParticipantId=" << participantData.id()
|
||||
<< " EquipmentNr=" << participantData.equipmentNumber()
|
||||
<< " partyId=" << partyId
|
||||
<< " chargeType=" << chargeTypeId
|
||||
<< " onGetCoordinate x=" << coordinate.x() << " y=" << coordinate.y();
|
||||
|
||||
// Button zurücksetzen
|
||||
cancelPositionTrigger();
|
||||
int gearType = 0;
|
||||
for (const auto >c : m_pdmDtc->gearTypeChargeTypes())
|
||||
{
|
||||
if (gtc.chargeTypeId() == chargeTypeId)
|
||||
gearType = gtc.gearTypeId();
|
||||
}
|
||||
|
||||
const auto chargeType = m_pdmDtc->chargeType(chargeTypeId);
|
||||
|
||||
|
||||
|
||||
ChargeEffectModifyRequest request;
|
||||
int id;
|
||||
ProjectDataManagement::StateChangeOriginator originatorTypeId;
|
||||
if (m_ui->cbPlayer->isChecked())
|
||||
{
|
||||
id = participantData.id();
|
||||
originatorTypeId = ProjectDataManagement::StateChangeOriginator::Participant;
|
||||
}
|
||||
else
|
||||
{
|
||||
id = partyId;
|
||||
originatorTypeId = ProjectDataManagement::StateChangeOriginator::Party;
|
||||
}
|
||||
|
||||
|
||||
request.name(chargeType.shortName());
|
||||
request.chargeTypeId(chargeTypeId);
|
||||
request.igniterTypeId(0);//(m_pdmDtc->fuseTypes(chargeTypeId).first()); <-- check by inserting error
|
||||
request.gearTypeId(gearType);
|
||||
request.originatorId(id);
|
||||
request.originatorTypeId(originatorTypeId);
|
||||
request.effectDuration(1000);
|
||||
request.effectStart(m_session->partitionTime() + 6000);
|
||||
request.position(Core::GeoPosition(coordinate.x(), coordinate.y(), 0.0));
|
||||
|
||||
m_requestHelper->addRequest([this,request]()
|
||||
{
|
||||
return m_ftc->chargeEffectModifyRequest(request, this);
|
||||
});
|
||||
m_requestHelper->startRequests();
|
||||
}
|
||||
|
||||
void ChargeEffectEdit::onEscapePressed(const QString &value)
|
||||
{
|
||||
Q_UNUSED(value)
|
||||
DEBUG_LOG(m_logger) << "################## onEscapePressed";
|
||||
cancelPositionTrigger();
|
||||
}
|
||||
|
||||
void ChargeEffectEdit::fillCharges()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " fillCharges";
|
||||
|
||||
m_ui->cbChargeType->clear();
|
||||
|
||||
if (!m_pdmDtc)
|
||||
{
|
||||
ERROR_LOG(m_logger) << " no m_pdmDtc";
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto &charge : m_pdmDtc->chargeTypes())
|
||||
{
|
||||
if(!m_pdmDtc->isVirtuallyFireable(charge.id()))
|
||||
continue;
|
||||
|
||||
m_ui->cbChargeType->addItem(QString::fromStdString(charge.name()), charge.id());
|
||||
}
|
||||
m_ui->cbChargeType->setEnabled(m_ui->cbChargeType->count() > 1);
|
||||
}
|
||||
|
||||
void ChargeEffectEdit::cancelPositionTrigger()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " cancelPositionTrigger";
|
||||
m_ui->pbPosition->setChecked(false);
|
||||
onPositionButtonToggled(m_ui->pbPosition->isChecked());
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Charge Effect Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Müller, ESZE, 2025-08-19
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_edit.h>
|
||||
#include <AreaEffectSimulation/aes_ftc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <Plugins/AdvancedSymbology/asb_data_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <QPolygonF>
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class ParticipantEditModel;
|
||||
}
|
||||
|
||||
namespace Ui {
|
||||
class ChargeEffectEdit;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class ChargeEffectEdit final
|
||||
: public BaseEdit
|
||||
, protected AreaEffectSimulation::Interface::Ftc::ChargeEffectModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ChargeEffectEdit(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~ChargeEffectEdit();
|
||||
|
||||
QString dialogIdentifier() const override
|
||||
{
|
||||
return m_aesItem.id() <= 0 ? QStringLiteral("AddChargeEffect") : QStringLiteral("EditChargeEffect%1").arg(m_aesItem.id());
|
||||
}
|
||||
bool init(int areaId, bool copy, LtsSession::LtsSession *session);
|
||||
void onChargeEffectModifyReply(const Core::FunctionReplyObject &replyObject) override final { onAesItemModifyReply(replyObject); }
|
||||
|
||||
public slots:
|
||||
void onGetCoordinate(const QPointF &coordinate);
|
||||
void onEscapePressed(const QString &value);
|
||||
|
||||
private slots:
|
||||
bool apply() override;
|
||||
void showPreviewObject() override;
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void enableUiElements(bool enable) override;
|
||||
void fillCharges();
|
||||
void cancelPositionTrigger();
|
||||
|
||||
void onChangeParty();
|
||||
void onSelectionChanged();
|
||||
void onPositionButtonToggled(bool isChecked);
|
||||
void getPosition();
|
||||
|
||||
|
||||
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asb;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
|
||||
ParticipantManagement::ParticipantEditModel *m_participantModel;
|
||||
|
||||
Ui::ChargeEffectEdit *m_ui;
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
||||
|
||||
};
|
||||
|
||||
} //namespace AreaEffectSimulation
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ChargeEffectEdit</class>
|
||||
<widget class="QWidget" name="ChargeEffectEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>686</width>
|
||||
<height>481</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,0">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="LtsDataView::LtsDataView" name="dvParticipants" native="true">
|
||||
<property name="rootIsDecorated" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblParty">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>2</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Party:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbParty"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbPlayer">
|
||||
<property name="text">
|
||||
<string>select Player</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblType">
|
||||
<property name="text">
|
||||
<string>Munition</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbChargeType"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblWeapon">
|
||||
<property name="text">
|
||||
<string>Weapon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbWeapon"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblFuze">
|
||||
<property name="text">
|
||||
<string>Fuze:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbFuze"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="pbPosition">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fire</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for AreaEffectSimulation - Charge Effect
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Malte Diers, SLSE, 2017-04-06
|
||||
*/
|
||||
|
||||
#include "aes_charge_effect_gui_plugin.h"
|
||||
#include "aes_charge_effect_edit.h"
|
||||
|
||||
#include <AreaEffectSimulation/aes_operator_rights.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: AesBaseInterface(session, getLogger("Plugins.Gui.ChargeEffect"))
|
||||
, ForeignGuiInterface()
|
||||
{}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
bool enableChargeEffect = ps->value(QStringLiteral("aes"),
|
||||
QStringLiteral("enableChargeEffect")).toBool();
|
||||
|
||||
if (enableChargeEffect)
|
||||
{
|
||||
// Charge Effect
|
||||
if (m_session->isExercisePartition() && appId() != LtsAppDescriptor::App::OC)
|
||||
ret.append(LtsWidgets::PluginData(menuGroup(),
|
||||
tr("Add Charge Effect"),
|
||||
QLatin1String("AddChargeEffect"),
|
||||
QIcon(QLatin1String("icon:functional_area_add.svg")),
|
||||
[this](QWidget *parent) { return onShowAddChargeEffectDialog(parent);},
|
||||
OperatorRights::ChargeEffectEdit,
|
||||
LtsWidgets::ExercisePart::eExecution,
|
||||
LtsWidgets::ExerciseState::eCreated | LtsWidgets::ExerciseState::eStarted | LtsWidgets::ExerciseState::ePaused));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
AreaEffectSimulation::BaseEdit *InterfaceImpl::showEditWindow(int aesEntityId, QWidget *parent)
|
||||
{
|
||||
ChargeEffectEdit *editWidget = new ChargeEffectEdit(menuGroup(), parent);
|
||||
if (editWidget->init(aesEntityId, false, m_session))
|
||||
return editWidget;
|
||||
|
||||
delete editWidget;
|
||||
return nullptr;
|
||||
}
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowAddChargeEffectDialog(QWidget *parent)
|
||||
{
|
||||
ChargeEffectEdit *editWidget = new ChargeEffectEdit(menuGroup(), parent);
|
||||
if (editWidget->init(0, false, m_session))
|
||||
return editWidget;
|
||||
|
||||
delete editWidget;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for AreaEffectSimulation - Charge Effect
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Malte Diers, SLSE, 2017-04-06
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_gui_plugin.h>
|
||||
#include "aes_charge_effect_gui_plugin_interface.h"
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class GuiPlugin final : public AesBaseGuiPlugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:aes.chargeeffects")
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("AreaEffectSimuationChargeEffectGui"); }
|
||||
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 AesBaseInterface, public AesChargeEffect::ForeignGuiInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
|
||||
AreaEffectSimulation::BaseEdit *showEditWindow(int aesEntityId, QWidget *parent) override;
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowAddChargeEffectDialog(QWidget *parent);
|
||||
};
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation / Charge Effect (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Malte Diers, SLSE, 2017-04-06
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
class QWidget;
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class BaseEdit;
|
||||
}
|
||||
|
||||
namespace AesChargeEffect
|
||||
{
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
|
||||
virtual AreaEffectSimulation::BaseEdit *showEditWindow(int aesEntityId, QWidget *parent) = 0;
|
||||
};
|
||||
} // namespace AesChargeEffect
|
||||
|
||||
Reference in new issue
Block a user