Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Christian Ehrlicher, SLSE, 2016-03-01
#
ADD_SUBDIRECTORY(Data)
ADD_SUBDIRECTORY(Gui)
#
# Gui Plugin Interface
#
ADD_INTERFACE_LIBRARY(PdmGuiPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/pdm_gui_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
GuiPluginInterface
svcPdmCommon
)
#
# Charge Table Gui Plugin Interface
#
ADD_INTERFACE_LIBRARY(PdmChargeTableGuiPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/pdm_charge_table_gui_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
GuiPluginInterface
svcPdmCommon
)
#
# Data Plugin Interface
#
ADD_INTERFACE_LIBRARY(PdmDataPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/pdm_data_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
DataPluginInterface
svcPdmCommon
)
+21
View File
@@ -0,0 +1,21 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Mike Wille, SLSE, 2016-09-06
#
#
# Data Plugin
#
NGL_ADD_LIBRARY(WS PdmDataPlugin MODULE pdm_data_plugin.cpp pdm_data_plugin.h)
NGL_TARGET_LINK_LIBRARIES(PdmDataPlugin
Qt5::Core
PdmDataPluginInterface
svcPdmClient
NGLLogger
LtsSessionDataDds
ngltranslator
LtsUtilsGuiDds # dds-vec => QByteArray
)
NGL_INSTALL_TARGET(PdmDataPlugin)
+55
View File
@@ -0,0 +1,55 @@
/**
* @RDE_HEADER@
* Data Plugin for ExerciseManangement
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-29
*/
#include "pdm_data_plugin.h"
#include <Plugins/OperatorManagement/opm_gui_plugin_interface.h>
#include <DDS/DDSConnector/dds_connector.h>
#include <ProjectDataManagement/logger.h>
#include <LtsSession/lts_session_data_dds.h>
#include <LtsUtilsCore/dds_vector.h>
#include <ngltranslator/ngltranslator.h>
namespace ProjectDataManagement
{
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
{
std::shared_ptr<ProjectDataManagement::Interface::Dtc> dtc;
std::shared_ptr<ProjectDataManagement::Interface::Ftc> ftc;
if (!session->createTopicClient(dtc, ftc, false, true))
return std::shared_ptr<DataPluginBase::Interface>();
connect(dtc.get(), &ProjectDataManagement::Interface::Dtc::translationBlobChanged,
this, &DataPlugin::onTranslationBlobChanged);
dtc.get()->enableTranslationBlob();
return std::make_shared<DataInterfaceImpl>(dtc, ftc);
}
void DataPlugin::onTranslationBlobChanged(const ProjectDataManagement::TranslationBlob &data, DataModification modType)
{
if (modType == DataModification::eRemoved)
return;
// always compressed by definition
NGL::setTranslationDataJson(LtsUtils::toQByteArray(data.payload()), data.md5sum().c_str(), true);
}
DataInterfaceImpl::DataInterfaceImpl(const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &dtc,
const std::shared_ptr<ProjectDataManagement::Interface::Ftc> &ftc)
: DataInterface()
, m_dtc(dtc)
, m_ftc(ftc)
{}
} // namespace ProjectDataManagement
+54
View File
@@ -0,0 +1,54 @@
/**
* @RDE_HEADER@
* Data Plugin for ProjectDataManagement
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-29
*/
#pragma once
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
namespace ProjectDataManagement
{
class DataPlugin final : public QObject, public DataPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "data:3:pdm")
Q_INTERFACES(DataPluginBase::Plugin)
Q_OBJECT
public:
DataPlugin() = default;
~DataPlugin() = default;
QString pluginName() const override { return QStringLiteral("ProjectDataManagement"); }
std::shared_ptr<DataPluginBase::Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) override;
bool availableInPartition(IDL::PartitionType partition) const override
{
return partition == IDL::PartitionType::Exercise ||
partition == IDL::PartitionType::Replay ||
partition == IDL::PartitionType::Global;
}
private Q_SLOTS:
void onTranslationBlobChanged(const ProjectDataManagement::TranslationBlob &data, DataModification modType);
};
class DataInterfaceImpl final : public DataInterface
{
public:
explicit DataInterfaceImpl(const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &dtc,
const std::shared_ptr<ProjectDataManagement::Interface::Ftc> &ftc);
std::shared_ptr<ProjectDataManagement::Interface::Dtc> getDtc() override { return m_dtc; }
std::shared_ptr<ProjectDataManagement::Interface::Ftc> getFtc() override { return m_ftc; }
private:
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtc;
std::shared_ptr<ProjectDataManagement::Interface::Ftc> m_ftc;
};
} // namespace ProjectDataManagement
+9
View File
@@ -0,0 +1,9 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Christian Ehrlicher, SLSE, 2016-03-01
#
ADD_SUBDIRECTORY(PdmComboBox)
ADD_SUBDIRECTORY(PdmChargeTable)
@@ -0,0 +1,63 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Mike Wille, SLSE, 2016-05-05
#
SET(charge_table_gui_SRCS
pdm_charge_table_foreign_gui_interface_impl.cpp
pdm_charge_table_foreign_gui_interface_impl.h
charge_table.cpp
charge_table.h
charge_table.ui
charge_table_model.cpp
charge_table_model.h
charge_edit_dialog.cpp
charge_edit_dialog.h
)
NGL_WRAP_UI(charge_table_gui_SRCS
charge_table.ui
charge_edit_dialog.ui
)
NGL_ADD_LIBRARY(WS PdmChargeTableGui STATIC ${charge_table_gui_SRCS})
NGL_TARGET_INCLUDE_DIRECTORIES(PdmChargeTableGui
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../..
)
NGL_TARGET_LINK_LIBRARIES(PdmChargeTableGui
PRIVATE
Qt5::Widgets
nglwidgets
PdmDataPluginInterface
FlmDataPluginInterface
LtsUtilsSettings
LtsUtilsGuiDds
LtsPrinting
LtsDataView
LtsSession
LtsSessionData
LtsWidgets
NGLLogger
PUBLIC
PdmGuiPluginInterface
Qt5::Core
svcPdmClient
)
SET(pdm_charge_table_gui_plugin_SRCS
pdm_charge_table_gui_plugin.cpp
pdm_charge_table_gui_plugin.h
)
NGL_ADD_LIBRARY(WS PdmChargeTableGuiPlugin MODULE ${pdm_charge_table_gui_plugin_SRCS})
NGL_TARGET_LINK_LIBRARIES(PdmChargeTableGuiPlugin
LtsSession
NGLLogger
PdmChargeTableGui
PdmDataPluginInterface
)
NGL_INSTALL_TARGET(PdmChargeTableGuiPlugin)
@@ -0,0 +1,104 @@
/**
* @RDE_HEADER@
* WarehouseManagement - Operator Edit Dialog
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-29
*/
#include "charge_edit_dialog.h"
#include "ui_charge_edit_dialog.h"
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
#include <ProjectDataManagement/pdm_dtc.h>
#include <LtsSession/lts_session.h>
#include <LtsUtilsGuiDds/request_helper.h>
namespace ProjectDataManagement
{
ChargeEditDialog::ChargeEditDialog(const int chargeId,
LtsSession::LtsSession *session,
QWidget *parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
, m_ui(new Ui::ChargeEditDialog)
, m_session(session)
, m_ftc(nullptr)
, m_requestHelper(new LtsUtils::RequestHelper(this))
, m_logger(ProjectDataManagement::getLogger("InjuryModelEditDialog"))
{
m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
m_uiRequirements->addRequirement({m_ui->lbxLongName, [this]()
{
m_ui->leLongName->setText(m_ui->leLongName->text().simplified());
return (m_ui->leLongName->text().size() > 0);
}});
m_uiRequirements->addRequirement({m_ui->lbxShortName, [this]()
{
m_ui->leShortName->setText(m_ui->leShortName->text().simplified());
return (m_ui->leShortName->text().size() > 0);
}});
setOnlineHelpFilename(QStringLiteral("Administrator-ChargeEdit"));
m_chargeType.id(chargeId);
}
ChargeEditDialog::~ChargeEditDialog()
{
delete m_requestHelper;
delete m_ui;
}
bool ChargeEditDialog::init()
{
std::shared_ptr<ProjectDataManagement::Interface::Dtc> dtc;
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(dtc) ||
!dtc->enableChargeType() ||
!m_session->getFtc<ProjectDataManagement::DataInterface>(m_ftc) ||
!m_ftc->enableUpdateChargeNames())
return false;
m_chargeType = dtc->chargeType(m_chargeType.id());
loadUiValues();
return true;
}
void ChargeEditDialog::loadUiValues()
{
// Todo: Why is it always hasChanges()?
m_ui->leLongName->setText(QString::fromStdString(m_chargeType.name()));
m_ui->leShortName->setText(QString::fromStdString(m_chargeType.shortName()));
m_ui->lbPredefinedName->setText(QString::fromStdString(m_chargeType.predefinedName()));
retranslate();
}
void ChargeEditDialog::onUpdateChargeNamesReply(const Core::FunctionReplyObject &reply)
{
m_requestHelper->requestReply(reply);
}
void ChargeEditDialog::retranslate()
{
// Todo: Either no Charge Type specified or Predefined name falls back to default text
// translate(m_ui, m_chargeType, tr("Charge Type"));
if (m_ui->lbPredefinedName->text().contains(QLatin1Char('\n')))
translate(m_ui, tr("Edit Charge Type '%1[...]'").arg(m_ui->lbPredefinedName->text().split(QLatin1Char('\n')).first()));
else
translate(m_ui, tr("Edit Charge Type '%1'").arg(m_ui->lbPredefinedName->text()));
}
bool ChargeEditDialog::apply()
{
ProjectDataManagement::UpdateChargeNamesRequest req(m_chargeType.id(),m_ui->leLongName->text().toStdString(),m_ui->leShortName->text().toStdString());
return m_requestHelper->startSingleRequest([req, this]()
{
return m_ftc->updateChargeNamesRequest(req, this);
});
}
} // namespace ProjectDataManagement
@@ -0,0 +1,59 @@
/**
* @RDE_HEADER@
* OperatorManangement - Operator Edit Dialog
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-29
*/
#pragma once
#include <LtsWidgets/lts_dialog.h>
#include <ProjectDataManagement/pdm_ftc.h>
#include <ProjectDataManagement/logger.h>
namespace Ui {
class ChargeEditDialog;
}
namespace LtsSession {
class LtsSession;
}
namespace LtsUtils {
class RequestHelper;
}
namespace ProjectDataManagement
{
class ChargeEditDialog : public LtsWidgets::LtsDialog
, protected ProjectDataManagement::Interface::Ftc::UpdateChargeNamesReplyHandler
{
Q_OBJECT
public:
explicit ChargeEditDialog(const int chargeId,
LtsSession::LtsSession *session,
QWidget *parent = nullptr);
~ChargeEditDialog();
bool init();
void loadUiValues();
protected:
void onUpdateChargeNamesReply(const Core::FunctionReplyObject &reply) override;
private:
void retranslate() override;
bool apply() override final;
Ui::ChargeEditDialog *m_ui;
LtsSession::LtsSession *m_session;
std::shared_ptr<ProjectDataManagement::Interface::Ftc> m_ftc;
LtsUtils::RequestHelper *m_requestHelper;
ChargeType m_chargeType;
LOGGER_T m_logger;
};
} //namespace ProjectDataManagement
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChargeEditDialog</class>
<widget class="QWidget" name="ChargeEditDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>787</width>
<height>314</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">Operator Edit</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="3">
<widget class="QLineEdit" name="leShortName">
<property name="statusTip">
<string>Max. 16 Characters</string>
</property>
<property name="maxLength">
<number>16</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbxPredefinedName">
<property name="text">
<string>Predefined Name:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>101</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" rowspan="3">
<widget class="QFrame" name="frame">
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="lbPredefinedName">
<property name="text">
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Hier stehen&lt;/p&gt;&lt;p&gt;mehrzeilig&lt;/p&gt;&lt;p&gt;Munitionsarten&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>137</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lbxShortName">
<property name="text">
<string>Short Name:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QLabel" name="lbxLongName">
<property name="text">
<string>Long Name:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="leLongName">
<property name="statusTip">
<string>Max. 64 Characters</string>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,299 @@
/**
* @RDE_HEADER@
* HMI Plugin for OperatorManagement - Operator/User Overview Dialog
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-29
*/
#include "charge_table.h"
#include "ui_charge_table.h"
#include "charge_table_model.h"
#include "charge_edit_dialog.h"
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
#include <LtsPrinting/printing.h>
#include <QTreeView>
#include <LtsSession/lts_session.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <FileManagement/flm_translation.h>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonDocument>
/* This class serves two purposes:
*
* In Organiser Mode, you can Check/Uncheck the selectable charges throughout the system:
* i.e. in filtering, reports etc. Charge display is not affected! This reduces the load in comboboxes etc.
* Charges NOT to be shown are marked such - they are added a "{"suppressVisibility": true}" in the pdm_charge_type DB
*
* In normal (selection) mode, the dialog is for checking those Charges that are taken into account e.g. for
* filtering or crafting reports. In a detailed view, a charge variation such as top attack or burst of fire can be
* selected per charge. The dialog then does not return the chargeIds but the ULEIS codes.
*
*/
namespace ProjectDataManagement
{
ChargeTableDialog::ChargeTableDialog(QWidget *parent, bool organiser)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkCancel)
, m_ui(new Ui::ChargeTableDialog)
, m_ftc(nullptr)
, m_requestHelper(new LtsUtils::RequestHelper(this))
, m_model(nullptr)
, m_isOrganiser(organiser)
, m_logger(getLogger("ChargeTableDialog"))
{
m_ui->setupUi(this);
m_buttonBox->setButtonVisible(LtsWidgets::DialogButton::Edit, m_isOrganiser);
if (m_isOrganiser)
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &ChargeTableDialog::onEditCharge);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &ChargeTableDialog::onPrint);
setOnlineHelpFilename(QStringLiteral("Administrator-ChargeTypes"));
}
ChargeTableDialog::~ChargeTableDialog()
{
delete m_ui;
}
void ChargeTableDialog::retranslate()
{
translate(m_ui, tr("Charge Types"));
}
void ChargeTableDialog::onUpdateChargeTypeReply(const Core::FunctionReplyObject &replyObject)
{
m_requestHelper->requestReply(replyObject);
}
void ChargeTableDialog::tableColumnOrganiserSetting()
{
//LtsColumnOrganiser
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
}
bool ChargeTableDialog::init(LtsSession::LtsSession *session, bool details, const QSet<GearClass> &gearClasses)
{
m_session = session;
std::shared_ptr<ProjectDataManagement::Interface::Dtc> dtc;
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(dtc))
return false;
m_model = new ChargeTableDialogModel(m_isOrganiser, this);
m_model->initModel(dtc, gearClasses);
m_ui->widget->setModel(m_model);
if (m_isOrganiser)
{
if (!m_session->getFtc<ProjectDataManagement::DataInterface>(m_ftc) ||
!m_ftc->enableUpdateChargeType())
return false;
m_ui->cbDetails->hide();
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked, this, &ChargeTableDialog::onEditCharge);
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged, this, &ChargeTableDialog::enaDisa);
connect(m_model, &ChargeTableDialogModel::chargeVisibilityChanged, this, &ChargeTableDialog::enaDisaOk);
m_ui->rbBoth->hide();
m_ui->rbDirect->hide();
m_ui->rbIndirect->hide();
enaDisa();
}
else
{
m_ui->widget->hideColumn(ChargeTableDialogModel::Columns::PredefinedName);
//m_ui->widget->hideColumn(ChargeTableDialogModel::Columns::ShortName);
m_ui->widget->hideColumn(ChargeTableDialogModel::Columns::DisEntity);
m_ui->cbDetails->setChecked(details);
connect(m_ui->cbDetails, &QCheckBox::toggled, this, &ChargeTableDialog::showDetails);
// Enable "Ok":
slotChangesMade();
}
#ifndef LTS_DEBUG
m_ui->widget->hideColumn(ChargeTableDialogModel::Columns::Id);
#endif
showDetails(details);
m_ui->widget->setSortIndicator(ChargeTableDialogModel::Columns::LongName, Qt::AscendingOrder);
if (!m_session->getForeignGuiInterface<FileManagement::ForeignGuiInterface>(m_flmGui))
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Library, false);
// Save/Load from Library Button
m_buttonBox->connectLibraryButton(this,
&ChargeTableDialog::onImportButtonClicked,
&ChargeTableDialog::onExportButtonClicked);
return true;
}
bool ChargeTableDialog::apply()
{
if (!m_isOrganiser)
{
if (m_ui->rbDirect->isChecked())
{
emit selectedUleisCodes(m_model->selectedCharges());
return true;
}
QSet<int> additionalChargeIds;
QSet<int> selectedChargeIds = m_model->selectedCharges();
for(const auto &chargeId : qAsConst(selectedChargeIds))
{
if (chargeId >= 1000 && chargeId < 2000)
additionalChargeIds << chargeId - 500;
else
additionalChargeIds << chargeId + 500;
}
if (m_ui->rbBoth->isChecked())
additionalChargeIds += selectedChargeIds;
emit selectedUleisCodes(additionalChargeIds);
return true;
}
QVector<ChargeType> cts = m_model->getChargeTypesWithChangedVisibility();
for (const ChargeType& req : qAsConst(cts))
{
m_requestHelper->addRequest([this,req]()
{
return m_ftc->updateChargeTypeRequest(req, this);
});
}
return m_requestHelper->startRequests();
}
void ChargeTableDialog::setValues(const std::vector<int> &values, bool includeChildren)
{
if (m_model)
m_model->setValues(values, includeChildren);
}
void ChargeTableDialog::setValues(const QSet<int> &values, bool includeChildren)
{
if (m_model)
m_model->setValues(values, includeChildren);
}
void ChargeTableDialog::enaDisa()
{
if (!m_isOrganiser)
return;
const int cntSelectedRows = m_ui->widget->selectedRows().size();
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, cntSelectedRows == 1);
}
void ChargeTableDialog::showDetails(bool showThem)
{
m_ui->widget->setColumnHidden(ChargeTableDialogModel::Columns::AirBurst, !showThem);
m_ui->widget->setColumnHidden(ChargeTableDialogModel::Columns::TopAttack, !showThem);
m_ui->widget->setColumnHidden(ChargeTableDialogModel::Columns::ShortTime, !showThem);
m_ui->widget->setColumnHidden(ChargeTableDialogModel::Columns::ShortTimeScanning, !showThem);
m_ui->widget->setColumnHidden(ChargeTableDialogModel::Columns::FireAndForget, !showThem);
m_ui->widget->setColumnHidden(ChargeTableDialogModel::Columns::BurstOfFire, !showThem);
m_ui->widget->setColumnHidden(ChargeTableDialogModel::Columns::DirectImpact, !showThem);
m_ui->widget->setColumnHidden(ChargeTableDialogModel::Columns::Unarmed, !showThem);
}
void ChargeTableDialog::enaDisaOk(bool hasChanges)
{
if (!m_isOrganiser)
return;
if (hasChanges)
slotChangesMade();
else
__unchange__();
}
void ChargeTableDialog::onPrint()
{
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
}
void ChargeTableDialog::onEditCharge()
{
const QModelIndex idx = m_ui->widget->currentIndex();
const ProjectDataManagement::ChargeType ct = m_model->getRowData(idx.row());
if (ct.id() <= 0)
return;
ChargeEditDialog *dialog = new ChargeEditDialog(ct.id(), m_session, this);
const QString identifier = QLatin1String("EditCharge") + QString::number(ct.id());
addDialog(dialog, menuGroup(), identifier, LtsWidgets::LayoutArea::eDialogTab);
dialog->init();
}
void ChargeTableDialog::onImportButtonClicked()
{
QByteArray content;
int fileId = m_flmGui->loadFileContent(this,
content,
{FileManagement::FileType::Xml},
m_session->exerciseId(),
FileManagement::toString(m_isOrganiser ? FileManagement::XmlType::PDMChargeFilter : FileManagement::XmlType::PDMUleisCodeFilter));
if (fileId <= 0)
return;
if (!m_flmGui->isXmlType(content, FileManagement::toString(m_isOrganiser ? FileManagement::XmlType::PDMChargeFilter : FileManagement::XmlType::PDMUleisCodeFilter)))
{
QHash<LtsWidgets::Button, QString> texts({{LtsWidgets::Button::Yes, tr("Ok")}});
LtsWidgets::LtsMessageDialog::showMessage(this,
tr("Invalid xml file content"),
windowTitle(),
LtsWidgets::Behaviour::Modal,
LtsWidgets::Button::Yes,
texts);
return;
}
const QJsonDocument doc(QJsonDocument::fromJson(content));
const QJsonObject obj(doc.object());
const QJsonArray arr(obj.value(QLatin1String("selectedCharges")).toArray());
QSet<int> result;
result.reserve(arr.size());
for (const auto &elem : arr)
result << elem.toObject()[m_isOrganiser ? QLatin1String("chargeTypeId") : QLatin1String("uleisCode")].toInt();
m_model->setValues(result);
}
void ChargeTableDialog::onExportButtonClicked()
{
QJsonObject obj;
QJsonArray arr;
const auto charges = m_model->selectedCharges();
for (int charge : charges)
{
QJsonObject inner;
inner[m_isOrganiser ? QLatin1String("chargeTypeId") : QLatin1String("uleisCode")] = charge;
arr += inner;
}
obj[QLatin1String("XmlType")] = FileManagement::toString(m_isOrganiser ? FileManagement::XmlType::PDMChargeFilter : FileManagement::XmlType::PDMUleisCodeFilter);
obj[QLatin1String("selectedCharges")] = arr;
QJsonDocument doc(obj);
QByteArray byteArray = doc.toJson(QJsonDocument::Compact);
m_flmGui->saveFileContent(this, FileManagement::FileType::Xml, m_session->exerciseId(), byteArray);
}
} // namespace ProjectDataManagement
@@ -0,0 +1,84 @@
/**
* @RDE_HEADER@
* HMI Plugin for OpeartorManagement - Operator/User Overview Dialog
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-29
*/
#pragma once
#include "charge_table_model.h"
#include <ProjectDataManagement/pdm_ftc.h>
#include <LtsWidgets/lts_dialog.h>
#include <ProjectDataManagement/logger.h>
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
#include <QWidget>
namespace Ui
{
class ChargeTableDialog;
}
namespace LtsSession
{
class LtsSession;
}
namespace LtsUtils {
class RequestHelper;
}
namespace FileManagement {
class ForeignGuiInterface;
}
namespace ProjectDataManagement
{
class ChargeTableDialog : public LtsWidgets::LtsDialog
, protected ProjectDataManagement::Interface::Ftc::UpdateChargeTypeReplyHandler
{
Q_OBJECT
public:
explicit ChargeTableDialog(QWidget *parent = nullptr, bool organiser = false);
~ChargeTableDialog();
bool init(LtsSession::LtsSession *session, bool showDetails = false, const QSet<GearClass> &gearClasses = {GearClass::DuelSim});
bool apply() override;
public slots:
void setValues(const std::vector<int> &values, bool includeChildren = false);
void setValues(const QSet<int> &values, bool includeChildren = false);
private:
void retranslate() override;
void onUpdateChargeTypeReply(const Core::FunctionReplyObject &replyObject) override final;
void tableColumnOrganiserSetting() override;
Ui::ChargeTableDialog *m_ui;
LtsSession::LtsSession *m_session;
std::shared_ptr<ProjectDataManagement::Interface::Ftc> m_ftc;
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
LtsUtils::RequestHelper *m_requestHelper;
ChargeTableDialogModel *m_model;
bool m_isOrganiser;
LOGGER_T m_logger;
signals:
void selectedUleisCodes(const QSet<int> &codes);
private slots:
void enaDisa();
void showDetails(bool showThem);
void onEditCharge();
void onPrint();
void enaDisaOk(bool hasChanges);
void onImportButtonClicked();
void onExportButtonClicked();
};
} // namespace ProjectDataManagement
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChargeTableDialog</class>
<widget class="QWidget" name="ChargeTableDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>674</width>
<height>328</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">Charge Edit</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="cbDetails">
<property name="text">
<string>Detailed View</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QRadioButton" name="rbBoth">
<property name="text">
<string>Direct and Indirect</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="5">
<widget class="LtsDataView::LtsDataView" name="widget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QRadioButton" name="rbDirect">
<property name="text">
<string>Only Direct</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QRadioButton" name="rbIndirect">
<property name="text">
<string>Only Indirect</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsDataView::LtsDataView</class>
<extends>QWidget</extends>
<header>LtsDataView/lts_data_view.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,439 @@
/**
* @RDE_HEADER@
* HMI Plugin for OperatorManangement - Operator Overview Dialog Model
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-29
*/
#include "charge_table_model.h"
#include <QIcon>
#include <QJsonObject>
#include <QJsonDocument>
namespace ProjectDataManagement
{
const QVector<int> ChargeTableDialogModel::ALL_ULEIS = {ChargeTableDialogModel::DirectImpactGrandparent,
ChargeTableDialogModel::DirectImpactChild,
ChargeTableDialogModel::BurstOfFireParent,
ChargeTableDialogModel::BurstOfFireChild,
ChargeTableDialogModel::AirBurstParent,
ChargeTableDialogModel::AirBurstChild,
ChargeTableDialogModel::UnarmedParent,
ChargeTableDialogModel::UnarmedChild,
ChargeTableDialogModel::FireAndForgetParent,
ChargeTableDialogModel::FireAndForgetChild,
ChargeTableDialogModel::ShortTimeScanningParent,
ChargeTableDialogModel::ShortTimeScanningChild };
const QVector<int> ChargeTableDialogModel::ALL_TAS = {ChargeTableDialogModel::ShortTimeChild1,
ChargeTableDialogModel::ShortTimeChild2,
ChargeTableDialogModel::ShortTimeChild3,
ChargeTableDialogModel::ShortTimeChild4,
ChargeTableDialogModel::ShortTimeChild5 };
//---------------------------------
// ChargeTableDialogModel
//---------------------------------
ChargeTableDialogModel::ChargeTableDialogModel(bool isOrganiser, QObject *parent )
: LtsWidgets::LtsAbstractTableModel<ProjectDataManagement::ChargeType>({tr("Id"),
tr("Is Visible"),
tr("Predefined Name"),
tr("Short Name"),
tr("Long Name"),
tr("Direct Impact"),
tr("Top Attack"),
tr("Burst of Fire"),
tr("Air Burst"),
tr("Unarmed"),
tr("Short Time"),
tr("Fire-and-Forget"),
tr("Short-Time Scanning"),
tr("DIS Entity")},
parent)
, m_dtc(nullptr)
, m_isOrganiser(isOrganiser)
, m_logger(getLogger("ChargeTableDialogModel"))
{}
ChargeTableDialogModel::~ChargeTableDialogModel()
{}
bool ChargeTableDialogModel::initModel(const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &dtc, const QSet<GearClass> &gearClasses)
{
m_dtc = dtc;
m_gearClasses = gearClasses;
connect(m_dtc.get(), &ProjectDataManagement::Interface::Dtc::chargeTypeChanged,
this, &ChargeTableDialogModel::onDataChanged);
m_dtc->chargeTypes([this](const ProjectDataManagement::ChargeType &ct)
{
if (!m_isOrganiser && !m_dtc->isVisible(ct.id()))
return;
insertRow(ct);
if (m_isOrganiser && m_dtc->isVisible(ct.id()))
m_visibleCharges.insert(ct.id());
});
return true;
}
QVariant ChargeTableDialogModel::data(const QModelIndex &index, int role) const
{
if (!indexIsValid(index))
return QVariant();
const ProjectDataManagement::ChargeType &ct = m_vecData.at(index.row());
// if (role == Qt::DecorationRole && index.column() == PredefinedName)
// return QIcon(QLatin1String(":/style/mortar_ammunition_administration.svg"));
if (role == Qt::CheckStateRole)
{
// CheckBoxes only for columns that are actually checkable
if (!flags(index).testFlag(Qt::ItemIsUserCheckable))
return QVariant();
// Organiser:
if (m_isOrganiser)
{
if (index.column() == IsVisible)
return (m_visibleCharges.contains(ct.id()) ? Qt::Checked : Qt::Unchecked);
return QVariant();
}
// Non Organiser:
qint32 tasCode = ct.id();
// TAS Codes < 2000 -> One Column fits all
if (tasCode < 2000)
{
if (index.column() == IsVisible)
return m_visibleCharges.contains(ct.id()) ? Qt::Checked : Qt::Unchecked;
// TAS Codes 1-46 exept 25 and 30 use cols DI, TA, BF, AB:
if (tasCode >= 1 && tasCode <= 46 && tasCode != 25 && tasCode != 30)
if (index.column() != DirectImpact &&
index.column() != TopAttack &&
index.column() != BurstOfFire &&
index.column() != AirBurst)
return QVariant();
// TAS Codes 25 and 30 are for FF charges:
if (tasCode == 25 || tasCode == 30)
if (index.column() != FireAndForget)
return QVariant();
// TAS Codes 77-79 are for SS charges
if (tasCode >= 77 && tasCode <=79)
if (index.column() != ShortTimeScanning)
return QVariant();
// TAS Codes 47-74 and 15xx, 16xx, 17xx, 18xx and 19xx (xx = 47-74) are ST charges
// Note: Not ommitting e.g. 13xx!
if (tasCode % 100 >= 47 && tasCode % 100 <= 76)
if (index.column() != ShortTime)
return QVariant();
// Now that all columns not relevant for charge do NOT show any CheckBoxes,
// we fill the remaining columns with synchronized checked CheckBoxes.
return m_visibleCharges.contains(ct.id()) ? Qt::Checked : Qt::Unchecked;
}
// TAS Codes > 2000
if (index.column() == IsVisible)
{
// Parent / Child are treated identically
// Direct Hit / Top Attack is the same kind
int sum = 0;
if (m_visibleCharges.contains(tasCode + DirectImpactGrandparent) || m_visibleCharges.contains(tasCode + DirectImpactChild))
++sum;
if (m_visibleCharges.contains(tasCode + BurstOfFireParent) || m_visibleCharges.contains(tasCode + BurstOfFireChild))
++sum;
if (m_visibleCharges.contains(tasCode + AirBurstParent) || m_visibleCharges.contains(tasCode + AirBurstChild))
++sum;
if (m_visibleCharges.contains(tasCode + UnarmedParent) || m_visibleCharges.contains(tasCode + UnarmedChild))
++sum;
if (m_visibleCharges.contains(tasCode + FireAndForgetParent) || m_visibleCharges.contains(tasCode + FireAndForgetChild))
++sum;
if (m_visibleCharges.contains(tasCode + ShortTimeScanningParent) || m_visibleCharges.contains(tasCode + ShortTimeScanningChild))
++sum;
// Check if all / nothing / intermediate is checked and set CheckBox accordingly:
if (sum == 0)
return Qt::Unchecked;
if (sum == 6)
return Qt::Checked;
return Qt::PartiallyChecked;
}
// Now to the single CheckBoxes:
// Direct Impact and Top Attack are treated identically:
// Do not distinguish unless Offset differs.
if (index.column() == DirectImpact || index.column() == TopAttack)
return (m_visibleCharges.contains(tasCode + DirectImpactGrandparent) || m_visibleCharges.contains(tasCode + DirectImpactChild) ? Qt::Checked : Qt::Unchecked);
if (index.column() == BurstOfFire)
return (m_visibleCharges.contains(tasCode + BurstOfFireParent) || m_visibleCharges.contains(tasCode + BurstOfFireChild) ? Qt::Checked : Qt::Unchecked);
if (index.column() == AirBurst)
return (m_visibleCharges.contains(tasCode + AirBurstParent) || m_visibleCharges.contains(tasCode + AirBurstChild) ? Qt::Checked : Qt::Unchecked);
if (index.column() == Unarmed)
return (m_visibleCharges.contains(tasCode + UnarmedParent) || m_visibleCharges.contains(tasCode + UnarmedChild) ? Qt::Checked : Qt::Unchecked);
if (index.column() == FireAndForget)
return (m_visibleCharges.contains(tasCode + FireAndForgetParent) || m_visibleCharges.contains(tasCode + FireAndForgetChild) ? Qt::Checked : Qt::Unchecked);
if (index.column() == ShortTimeScanning)
return (m_visibleCharges.contains(tasCode + ShortTimeScanningParent) || m_visibleCharges.contains(tasCode + ShortTimeScanning) ? Qt::Checked : Qt::Unchecked);
}
if (role == Qt::DisplayRole)
{
switch (index.column())
{
case IsVisible:
if (m_isOrganiser)
return m_dtc->isVisible(ct.id()) ? tr("Yes") : tr("No");
else
return ct.id();
case Id:
return QString::number(ct.id());
case PredefinedName:
return QString::fromStdString(ct.predefinedName());
case ShortName:
return QString::fromStdString(ct.shortName());
case LongName:
return QString::fromStdString(ct.name());
case DisEntity:
return QString::fromStdString(ct.disEntity());
}
}
return QVariant();
}
bool ChargeTableDialogModel::setData(const QModelIndex &idx, const QVariant &value, int role)
{
if (!indexIsValid(idx))
return false;
if (role != Qt::CheckStateRole)
return false;
bool bVal = value.toBool();
if (m_isOrganiser)
{
if (idx.column() != IsVisible)
return false;
// Get JSON Properties
ChargeType ct = getRowData(idx.row());
QJsonDocument propsDoc = QJsonDocument::fromJson(QByteArray::fromStdString(ct.properties()));
QJsonObject propsObj;
if (propsDoc.isObject()) // if the given properties are no valid JSON object, the properties will be made from scratch
propsObj = propsDoc.object();
// Update JSON Properties
if (bVal)
{
propsObj.remove(QLatin1String("suppressVisibility"));
m_visibleCharges.insert(m_vecData.at(idx.row()).id());
}
else
{
propsObj.insert(QLatin1String("suppressVisibility"), true);
m_visibleCharges.remove(m_vecData.at(idx.row()).id());
}
// Put back JSON Properties
ct.properties(QJsonDocument(propsObj).toJson(QJsonDocument::Compact).toStdString());
setRowData(idx.row(), ct);
if (m_dtc->isVisible(ct.id()) != bVal)
m_differences.insert(ct.id());
else
m_differences.remove(ct.id());
emit chargeVisibilityChanged(!m_differences.isEmpty());
return true;
}
else
{
const int tasCode = m_vecData.at(idx.row()).id();
if (tasCode < 1000)
{
if (bVal)
m_visibleCharges.insert(tasCode);
else
m_visibleCharges.remove(tasCode);
// Grandparents 47 - 76 have Children that are implicitly checked:
if (tasCode >= 47 && tasCode <= 76)
{
if (bVal)
{
for (const auto &type : ALL_TAS)
m_visibleCharges.insert(type + tasCode);
}
else
{
for (const auto &type : ALL_TAS)
m_visibleCharges.remove(type + tasCode);
}
}
}
else if (tasCode > 2000)
{
if (bVal)
{
// Check all Types
if (idx.column() == IsVisible)
{
for (const auto &type : ALL_ULEIS)
m_visibleCharges.insert(tasCode + type);
}
// For each type check both uleis codes:
if (idx.column() == DirectImpact)
{
m_visibleCharges.insert(tasCode + DirectImpactGrandparent);
m_visibleCharges.insert(tasCode + DirectImpactChild);
}
if (idx.column() == TopAttack)
{
m_visibleCharges.insert(tasCode + TopAttackGrandparent);
m_visibleCharges.insert(tasCode + TopAttackChild);
}
if (idx.column() == BurstOfFire)
{
m_visibleCharges.insert(tasCode + BurstOfFireParent);
m_visibleCharges.insert(tasCode + BurstOfFireChild);
}
if (idx.column() == AirBurst)
{
m_visibleCharges.insert(tasCode + AirBurstParent);
m_visibleCharges.insert(tasCode + AirBurstChild);
}
if (idx.column() == Unarmed)
{
m_visibleCharges.insert(tasCode + UnarmedParent);
m_visibleCharges.insert(tasCode + UnarmedChild);
}
if (idx.column() == FireAndForget)
{
m_visibleCharges.insert(tasCode + FireAndForgetParent);
m_visibleCharges.insert(tasCode + FireAndForgetChild);
}
if (idx.column() == ShortTimeScanning)
{
m_visibleCharges.insert(tasCode + ShortTimeScanningParent);
m_visibleCharges.insert(tasCode + ShortTimeScanningChild);
}
}
else
{
// Uncheck all types
if (idx.column() == IsVisible)
{
for (const auto &type : ALL_ULEIS)
m_visibleCharges.remove(tasCode + type);
}
// For each type uncheck both uleis codes:
if (idx.column() == DirectImpact)
{
m_visibleCharges.remove(tasCode + DirectImpactGrandparent);
m_visibleCharges.remove(tasCode + DirectImpactChild);
}
if (idx.column() == TopAttack)
{
m_visibleCharges.remove(tasCode + TopAttackGrandparent);
m_visibleCharges.remove(tasCode + TopAttackChild);
}
if (idx.column() == BurstOfFire)
{
m_visibleCharges.remove(tasCode + BurstOfFireParent);
m_visibleCharges.remove(tasCode + BurstOfFireChild);
}
if (idx.column() == AirBurst)
{
m_visibleCharges.remove(tasCode + AirBurstParent);
m_visibleCharges.remove(tasCode + AirBurstChild);
}
if (idx.column() == Unarmed)
{
m_visibleCharges.remove(tasCode + UnarmedParent);
m_visibleCharges.remove(tasCode + UnarmedChild);
}
if (idx.column() == FireAndForget)
{
m_visibleCharges.remove(tasCode + FireAndForgetParent);
m_visibleCharges.remove(tasCode + FireAndForgetChild);
}
if (idx.column() == ShortTimeScanning)
{
m_visibleCharges.remove(tasCode + ShortTimeScanningParent);
m_visibleCharges.remove(tasCode + ShortTimeScanningChild);
}
}
}
else
{
// Tas Code == 1000 - 2000: Do nothing, they are invalid...
}
emit dataChanged(index(idx.row(), 0), index(idx.row(), columnCount() - 1));
return true;
}
return false;
}
QVector<ChargeType> ChargeTableDialogModel::getChargeTypesWithChangedVisibility() const
{
QVector<ChargeType> cts;
for (const auto &ct : m_vecData)
if (m_differences.contains(ct.id()))
cts << ct;
return cts;
}
bool ChargeTableDialogModel::isFiltered(int chargeTypeId) const
{
// Filter anything?
if (m_isOrganiser)
return false;
if (!m_gearClasses.contains(m_dtc->gearClassFromChargeTypeId(baseCharge(chargeTypeId))))
return true;
return !isBaseCharge(chargeTypeId);
}
bool ChargeTableDialogModel::isFiltered(const ProjectDataManagement::ChargeType &data, DataModification modType) const
{
Q_UNUSED(modType);
return isFiltered(data.id());
}
QSet<int> ChargeTableDialogModel::selectedCharges() const
{
return m_visibleCharges;
}
int ChargeTableDialogModel::baseCharge(int chargeTypeId)
{
if (isBaseCharge(chargeTypeId))
return chargeTypeId;
if (chargeTypeId < 2000)
return (chargeTypeId % 100);
return ((chargeTypeId % 1000) + 2000);
}
} // namespace ProjectDataManagement
@@ -0,0 +1,198 @@
/**
* @RDE_HEADER@
* HMI Plugin for OperatorManagement - Operator Overview Dialog Model
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-29
*/
#pragma once
#include <ProjectDataManagement/pdm_dtc.h>
#include <ProjectDataManagement/logger.h>
#include <LtsWidgets/lts_abstract_table_model.h>
#include <QSet>
namespace ProjectDataManagement
{
inline uint qHash(GearClass gc)
{
return ::qHash(gc.underlying());
}
// --------------------------------------------------------
// OperatorManagementModel
// --------------------------------------------------------
class /* OPMCHANGEPASSWORDGUI_EXPORT*/ ChargeTableDialogModel final : public LtsWidgets::LtsAbstractTableModel<ProjectDataManagement::ChargeType>
{
Q_OBJECT
public:
enum Columns
{
Id,
IsVisible,
PredefinedName,
ShortName,
LongName,
DirectImpact,
TopAttack,
BurstOfFire,
AirBurst,
Unarmed,
ShortTime,
FireAndForget,
ShortTimeScanning,
DisEntity
};
enum Offsets
{
None = 0,
Grandparent = 0,
ShortTimeChild1 = 1500,
ShortTimeChild2 = 1600,
ShortTimeChild3 = 1700,
ShortTimeChild4 = 1800,
ShortTimeChild5 = 1900,
DirectImpactGrandparent = 0,
TopAttackGrandparent = 0,
DirectImpactChild = 1000,
TopAttackChild = 1000,
BurstOfFireParent = 2000,
BurstOfFireChild = 3000,
AirBurstParent = 4000,
AirBurstChild = 5000,
UnarmedParent = 6000,
UnarmedChild = 7000,
FireAndForgetParent = 10000,
FireAndForgetChild = 11000,
ShortTimeScanningParent = 20000,
ShortTimeScanningChild = 21000
};
explicit ChargeTableDialogModel(bool isOrganiser, QObject *parent = nullptr);
~ChargeTableDialogModel();
bool initModel(const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &dtc, const QSet<GearClass> &gearClasses = {GearClass::DuelSim});
QVariant data(const QModelIndex &, int) const override final;
bool setData(const QModelIndex &idx, const QVariant &value, int role = Qt::EditRole) override final;
Qt::ItemFlags flags(const QModelIndex &index) const override final
{
Qt::ItemFlags flags(LtsWidgets::LtsAbstractTableModel<ProjectDataManagement::ChargeType>::flags(index));
switch (index.column())
{
case IsVisible:
case DirectImpact:
case TopAttack:
case AirBurst:
case BurstOfFire:
case Unarmed:
case ShortTime:
case ShortTimeScanning:
case FireAndForget:
flags.setFlag(Qt::ItemIsUserCheckable);
break;
default:
break;
}
return flags;
}
QVector<ChargeType> getChargeTypesWithChangedVisibility() const;
bool isFiltered( const ProjectDataManagement::ChargeType &data, DataModification modType ) const override;
QSet<int> selectedCharges() const;
template<typename T>
bool setValues(const T &uleisCodes, bool includeChildren = false)
{
m_visibleCharges.clear();
if (includeChildren && !m_isOrganiser)
{
std::vector<int> inclusive = chargesIncludingChildren(uleisCodes);
for (auto val : inclusive)
m_visibleCharges.insert(val);
}
else
{
for (auto val : uleisCodes)
{
m_visibleCharges.insert(val);
}
}
emit dataChanged(index(0, 0), index(m_vecData.size()-1, columnCount()-1));
return true;
}
template<typename T>
static std::vector<int> chargesIncludingChildren(const T &parentalCharges)
{
std::vector<int> retVal;
for (auto val : parentalCharges)
{
if (val < 1000)
retVal.push_back(val);
else if (val > 3000)
continue;
if (val >= 47 && val <= 76)
{
for (const auto &type : ALL_TAS)
retVal.push_back(type + val);
}
else if (val > 2000 && val < 3000)
{
for (const auto &type : ALL_ULEIS)
retVal.push_back(type + val);
}
}
return retVal;
}
static bool isBaseCharge(int type) { return (type < 1000 || (type > 2000 && type < 3000));}
static int baseCharge(int chargeTypeId);
template<typename T>
static int chargeCountBaseCharges(const T &chargeTypes)
{
QSet<int> tmp;
for (int type : chargeTypes)
tmp.insert(baseCharge(type));
return tmp.size();
}
signals:
void chargeVisibilityChanged(bool hasChanges);
private:
bool isFiltered(int chargeTypeId) const;
private:
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtc;
// For not always decoding JSON Properties, store temp visibility seperately:
QSet<int> m_visibleCharges;
// Charge type ids, whose Visibility changed:
QSet<int> m_differences;
QSet<GearClass> m_gearClasses;
bool m_isOrganiser;
LOGGER_T m_logger;
static const QVector<int> ALL_ULEIS;
static const QVector<int> ALL_TAS;
// We could store all ChargeTypes by ULEIS Code in a seperate map.
// Then, we could put names/DIS/data to the respective column if a Code >3000 is defined.
// Nevertheless, the row data copy is the master. But that's only altered in organiser mode.
};
} // namespace ProjectDataManagement
@@ -0,0 +1,32 @@
/**
* @RDE_HEADER@
* GUI Plugin for ProjectDataManagement - PdmComboBox
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#include "pdm_charge_table_foreign_gui_interface_impl.h"
//#include "pdm_charge_selector.h"
//#include "pdm_combobox.h"
namespace ProjectDataManagement
{
ForeignGuiInterfaceImpl::ForeignGuiInterfaceImpl()
: m_dtc(nullptr)
{}
bool ForeignGuiInterfaceImpl::init(const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &dtc)
{
m_dtc = dtc;
return m_dtc != nullptr;
}
void ForeignGuiInterfaceImpl::uninit()
{
m_dtc = nullptr;
}
} // namespace ProjectDataManagement
@@ -0,0 +1,30 @@
/**
*@RDE_HEADER@
* Gui Plugin for ProjectDataManagement - PdmComboBox
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#pragma once
#include <ProjectDataManagement/pdm_charge_table_gui_plugin_interface.h>
#include <ProjectDataManagement/pdm_dtc.h>
namespace ProjectDataManagement
{
class ForeignGuiInterfaceImpl : public ForeignChargeTableGuiInterface
{
public:
ForeignGuiInterfaceImpl();
bool init(const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &dtc);
void uninit();
private:
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtc;
};
} // namespace ProjectDataManagement
@@ -0,0 +1,67 @@
/**
* @RDE_HEADER@
* GUI Plugin for ProjectDataManagement - PdmComboBox
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#include "pdm_charge_table_gui_plugin.h"
#include "charge_table.h"
#include <ProjectDataManagement/pdm_operator_rights.h>
namespace ProjectDataManagement
{
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.Pdm.PdmChargeTable"))
{}
bool InterfaceImpl::fetchInterfaces()
{
std::shared_ptr<ProjectDataManagement::Interface::Dtc> dtc;
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(dtc))
return false;
return ForeignGuiInterfaceImpl::init(dtc);
}
void InterfaceImpl::clearInterfaces()
{
ForeignGuiInterfaceImpl::uninit();
}
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
QVector<LtsWidgets::PluginData> ret;
LtsWidgets::PluginData plData;
plData.menuGroup = tr("Charges");
plData.menuText = tr("Charge Type Visibility");
plData.identifier = QLatin1String("pdmChargeTypes");
plData.menuIcon = QIcon(QLatin1String("icon:list-add-user.svg"));
plData.operatorRight = OperatorRights::ChargeVisibilityEdit;
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
plData.createWidgetFunc = [this](QWidget *parent)
{
return onShowChargeTableDialog(parent, true);
};
ret.append(plData);
return ret;
}
LtsWidgets::LtsDialog *InterfaceImpl::onShowChargeTableDialog(QWidget *parent, bool isOrganiser)
{
ChargeTableDialog *dialog = new ChargeTableDialog(parent, isOrganiser);
dialog->init(m_session);
return dialog;
}
} // namespace ProjectDataManagement
@@ -0,0 +1,60 @@
/**
*@RDE_HEADER@
* Gui Plugin for ProjectDataManagement - PdmComboBox
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#pragma once
#include <LtsSession/lts_session.h>
#include <ProjectDataManagement/logger.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
#include "pdm_charge_table_foreign_gui_interface_impl.h"
namespace ProjectDataManagement
{
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:pdm.chargetable")
Q_INTERFACES(GuiPluginBase::Plugin)
Q_OBJECT
public:
GuiPlugin() = default;
~GuiPlugin() = default;
QString pluginName() override { return QLatin1String("ProjectDataManagementChargeTableGuiPlugin"); }
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
bool availableInPartition(IDL::PartitionType partition) const override
{
return (partition == IDL::PartitionType::Global);
}
};
class InterfaceImpl final : public QObject, public ForeignGuiInterfaceImpl, public GuiPluginBase::Interface
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
bool fetchInterfaces() override;
void clearInterfaces() override;
QVector<LtsWidgets::PluginData> getActions() override;
QString menuGroup() const override { return tr("Charges"); }
bool availableInPartition(IDL::PartitionType partition) const override {
return (partition == IDL::PartitionType::Global);
}
private:
LtsWidgets::LtsDialog *onShowChargeTableDialog(QWidget *parent, bool isOrganiser);
};
} // namespace ProjectDataManagement
@@ -0,0 +1,46 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Mike Wille, SLSE, 2016-05-05
#
SET(pdm_combobox_gui_SRCS
pdm_combobox_foreign_gui_interface_impl.cpp
pdm_combobox_foreign_gui_interface_impl.h
pdm_combobox.cpp
pdm_combobox.h
pdm_charge_selector.cpp
pdm_charge_selector.h
)
NGL_WRAP_UI(pdm_combobox_gui_SRCS pdm_charge_selector.ui)
NGL_ADD_LIBRARY(WS PdmComboBoxGui STATIC ${pdm_combobox_gui_SRCS})
NGL_TARGET_INCLUDE_DIRECTORIES(PdmComboBoxGui
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../..
)
NGL_TARGET_LINK_LIBRARIES(PdmComboBoxGui
PRIVATE
Qt5::Widgets
LtsUtilsSettings
PUBLIC
PdmGuiPluginInterface
Qt5::Core
svcPdmClient
)
SET(pdm_combobox_gui_plugin_SRCS
pdm_combobox_gui_plugin.cpp
pdm_combobox_gui_plugin.h
)
NGL_ADD_LIBRARY(WS PdmComboBoxGuiPlugin MODULE ${pdm_combobox_gui_plugin_SRCS})
NGL_TARGET_LINK_LIBRARIES(PdmComboBoxGuiPlugin
LtsSession
NGLLogger
PdmComboBoxGui
PdmDataPluginInterface
)
NGL_INSTALL_TARGET(PdmComboBoxGuiPlugin)
@@ -0,0 +1,79 @@
/**
* @RDE_HEADER@
* A Frameless dialog to select parties
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-06-22
*/
#include "pdm_charge_selector.h"
#include <QCheckBox>
#include <QHBoxLayout>
#include <QPushButton>
#include <ProjectDataManagement/pdm_translation.h>
#include <LtsUtils/LtsUtilsCore/json_object.h>
namespace ProjectDataManagement
{
ChargeSelector::ChargeSelector(QWidget *parent)
: LtsWidgets::LtsFramelessDialog(parent, LtsWidgets::Behaviour::Modal)
{
m_ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
}
ChargeSelector::~ChargeSelector()
{}
bool ChargeSelector::init(const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &dtc,
GearClass gearClass,
const QSet<int> &preselectedCharges)
{
QString title = tr("Select %1 Charges").arg(toString(gearClass));
m_ui.lblCharges->setText(title);
setWindowTitle(title);
qDeleteAll(findChildren<QCheckBox *>());
m_selectedCharges = preselectedCharges;
m_selectedChargesOriginal = preselectedCharges;
const auto cfgc = dtc->chargesForGearClass(gearClass);
for (const ChargeType &charge : cfgc)
{
if (LtsUtils::JsonObject::fromJson(charge.properties()).valueOr<bool>("suppressVisibility", false))
continue;
const int chargeId = charge.id();
QCheckBox *cb = new QCheckBox;
cb->setText(dtc->trChargeTypeShortName(chargeId, true));
cb->setChecked(preselectedCharges.contains(chargeId));
connect(cb, &QCheckBox::clicked, cb, [this, chargeId](bool checked) { chargeCheckBoxChanged(chargeId, checked); });
m_ui.layParties->addWidget(cb);
}
connect(m_ui.pbOk, &QPushButton::clicked,
this, &ChargeSelector::accept);
connect(m_ui.pbCancel, &QPushButton::clicked,
this, &ChargeSelector::reject);
return true;
}
void ChargeSelector::chargeCheckBoxChanged(int chargeId, bool bChecked)
{
if (bChecked)
m_selectedCharges += chargeId;
else
m_selectedCharges -= chargeId;
emit chargesSelected(m_selectedCharges);
}
void ChargeSelector::reject()
{
emit chargesSelected(m_selectedChargesOriginal);
LtsWidgets::LtsFramelessDialog::reject();
}
} // namespace ProjectDataManagement
@@ -0,0 +1,40 @@
/**
* @RDE_HEADER@
* A Frameless dialog to select parties
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-06-22
*/
#pragma once
#include <LtsWidgets/lts_frameless_dialog.h>
#include <ProjectDataManagement/logger.h>
#include <ProjectDataManagement/pdm_dtc.h>
#include <QSet>
#include "ui_pdm_charge_selector.h"
namespace ProjectDataManagement
{
class ChargeSelector final : public LtsWidgets::LtsFramelessDialog
{
Q_OBJECT
public:
explicit ChargeSelector(QWidget *parent = nullptr);
~ChargeSelector();
bool init(const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &dtc,
GearClass gearClass,
const QSet<int> &preselectedCharges);
Q_SIGNALS:
void chargesSelected(const QSet<int> &selectedCharges);
private:
void chargeCheckBoxChanged(int chargeId, bool bChecked);
void reject() override;
private:
QSet<int> m_selectedCharges;
QSet<int> m_selectedChargesOriginal;
Ui::ChargeSelector m_ui;
};
} // namespace ProjectDataManagement
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChargeSelector</class>
<widget class="QWidget" name="ChargeSelector">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>194</width>
<height>127</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="lblCharges">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Select Charges</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="layParties"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pbOk">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbCancel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,343 @@
/**
* @RDE_HEADER@
* ProjectDataManagement - PdmComboBox
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#include "pdm_combobox.h"
#include <QJsonDocument>
#include <QJsonObject>
#include <QSet>
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <LtsUtilsSettings/settings.h>
#include <LtsWidgets/lts_combo_box.h>
#include <ProjectDataManagement/pdm_translation.h>
namespace ProjectDataManagement
{
namespace PdmComboBox
{
static QLatin1String emptyEntryComboBox = QLatin1String("--");
void ChargeTypeFilterProxyModel::setPropertyFilter(const QString &property, const QVariant &value)
{
if (m_property == property && m_value == value)
return;
m_property = property;
m_value = value;
invalidate();
}
void ChargeTypeFilterProxyModel::setSourceModel(QAbstractItemModel *model)
{
m_model = qobject_cast<QStandardItemModel *>(model);
QSortFilterProxyModel::setSourceModel(model);
}
bool ChargeTypeFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
if (!m_model || source_parent != QModelIndex())
return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
if (m_property.isEmpty() || m_value.isNull())
return true;
QStandardItem *item = m_model->item(source_row);
QJsonObject obj = item->data(Qt::UserRole + 2).toJsonObject();
if (obj.isEmpty())
{
QJsonDocument doc(QJsonDocument::fromJson(item->data(Qt::UserRole + 1).toByteArray()));
if (doc.isObject())
obj = doc.object();
else
obj = QJsonObject();
if (obj.isEmpty())
obj[QStringLiteral("empty")] = 1;
item->setData(obj, Qt::UserRole + 2);
}
return obj.value(m_property) == m_value;
}
void fillGearClass(QComboBox *cbx, GearClass gearClass, const std::shared_ptr<Interface::Dtc> &dtc)
{
QStandardItemModel *itemModel = new QStandardItemModel(cbx);
ChargeTypeFilterProxyModel *fpm = new ChargeTypeFilterProxyModel(cbx);
fpm->setSourceModel(itemModel);
cbx->setModel(fpm);
// ULEIS codes 3000+ not actually omitted, but there are no (yet) defined.
const auto charges = dtc->chargesForGearClass(gearClass);
for (const ChargeType &charge : charges)
{
QStandardItem *item = new QStandardItem(dtc->trChargeTypeShortName(charge.id(), true));
item->setToolTip(dtc->trChargeTypeName(charge.id(), true));
item->setData(charge.id(), CBUserRoles::Id);
item->setData(QByteArray::fromStdString(charge.properties()), CBUserRoles::Properties);
itemModel->appendRow(item);
}
}
void fillIgniterType(QComboBox *cbx, int chargeTypeId, const std::shared_ptr<Interface::Dtc> &dtc)
{
QStandardItemModel *itemModel = new QStandardItemModel(cbx);
cbx->setModel(itemModel);
QStandardItem *itemEmpty = new QStandardItem(emptyEntryComboBox);
itemEmpty->setData(-1, CBUserRoles::Id);
itemModel->appendRow(itemEmpty);
const auto igniters = dtc->ignitersForChargeType(chargeTypeId);
for (const IgniterType &igniter : igniters)
{
QStandardItem *item = new QStandardItem(dtc->trIgniterTypeShortName(igniter.id()));
item->setToolTip(dtc->trIgniterTypeName(igniter.id()));
item->setData(igniter.id(), CBUserRoles::Id);
item->setData(QByteArray::fromStdString(igniter.properties()), CBUserRoles::Properties);
itemModel->appendRow(item);
}
itemModel->sort(0, Qt::AscendingOrder);
// Choose Option if only one option beside the empty entry exists
if (cbx->count() == 2)
cbx->setCurrentIndex(1);
}
void fillIgniterFunction(QComboBox *cbx, int chargeTypeId, int igniterTypeId, const std::shared_ptr<Interface::Dtc> &dtc)
{
QStandardItemModel *itemModel = new QStandardItemModel(cbx);
cbx->setModel(itemModel);
QStandardItem *itemEmpty = new QStandardItem(emptyEntryComboBox);
itemEmpty->setData(-1, CBUserRoles::Id);
itemModel->appendRow(itemEmpty);
const auto chargeTypeIgTypeIgFunMap = dtc->igniterFunctionsForChargeTypeIgniterType(chargeTypeId, igniterTypeId);
for (const ChargeTypeIgniterTypeIgniterFunction &chargeTypeIgTypeIgFun : chargeTypeIgTypeIgFunMap)
{
QStandardItem *item = new QStandardItem(dtc->trIgniterFunctionShortName(chargeTypeIgTypeIgFun.igniterFunctionId()));
item->setToolTip(dtc->trIgniterFunctionName(chargeTypeIgTypeIgFun.igniterFunctionId()));
item->setData(chargeTypeIgTypeIgFun.igniterFunctionId(), CBUserRoles::Id);
item->setData(QByteArray::fromStdString(chargeTypeIgTypeIgFun.properties()), CBUserRoles::Properties);
itemModel->appendRow(item);
}
itemModel->sort(0, Qt::AscendingOrder);
// Choose Option if only one option beside the empty entry exists
if (cbx->count() == 2)
cbx->setCurrentIndex(1);
}
void fillLoadType(QComboBox *cbx, int chargeTypeId, const std::shared_ptr<Interface::Dtc> &dtc)
{
QStandardItemModel *itemModel = new QStandardItemModel(cbx);
cbx->setModel(itemModel);
QStandardItem *itemEmpty = new QStandardItem(emptyEntryComboBox);
itemEmpty->setData(-1, CBUserRoles::Id);
itemModel->appendRow(itemEmpty);
const auto loads = dtc->loadsForChargeType(chargeTypeId);
for (const LoadType &load : loads)
{
QStandardItem *item = new QStandardItem(dtc->trLoadTypeShortName(load.id()));
item->setToolTip(dtc->trLoadTypeName(load.id()));
item->setData(load.id(), CBUserRoles::Id);
itemModel->appendRow(item);
}
itemModel->sort(0, Qt::AscendingOrder);
// Choose Option if only one option beside the empty entry exists
if (cbx->count() == 2)
cbx->setCurrentIndex(1);
}
void fillTargetType(QComboBox *cbx, const std::shared_ptr<Interface::Dtc> &dtc)
{
QStandardItemModel *itemModel = new QStandardItemModel(cbx);
cbx->setModel(itemModel);
QStandardItem *itemEmpty = new QStandardItem(emptyEntryComboBox);
itemEmpty->setData(-1, CBUserRoles::Id);
itemModel->appendRow(itemEmpty);
const auto targeTypes = dtc->targetTypes();
for (const TargetType &targetType : targeTypes)
{
QStandardItem *item = new QStandardItem(dtc->trTargetTypeName(targetType.id()));
item->setToolTip(dtc->trTargetTypeName(targetType.id()));
item->setData(targetType.id(), CBUserRoles::Id);
itemModel->appendRow(item);
}
itemModel->sort(0, Qt::AscendingOrder);
}
void fillTargetSubType(QComboBox *cbx, int targetTypeId, const std::shared_ptr<Interface::Dtc> &dtc)
{
QStandardItemModel *itemModel = new QStandardItemModel(cbx);
cbx->setModel(itemModel);
const auto targetSubTypeVec = dtc->targetSubTypesForTargetType(targetTypeId);
QStandardItem *itemEmpty = new QStandardItem(emptyEntryComboBox);
itemEmpty->setData(-1, TargetSubTypeRole::Id);
itemModel->appendRow(itemEmpty);
for (const TargetSubType &targetSubType : targetSubTypeVec)
{
QStandardItem *item = new QStandardItem(dtc->trTargetSubTypeName(targetSubType.id()));
item->setToolTip(dtc->trTargetSubTypeName(targetSubType.id()));
item->setData(targetSubType.id(), TargetSubTypeRole::Id);
item->setData(QString::fromStdString(targetSubType.abbreviation()), TargetSubTypeRole::Abbreviation);
itemModel->appendRow(item);
}
itemModel->sort(0, Qt::AscendingOrder);
}
void fillFirePurpose(QComboBox *cbx, const std::shared_ptr<Interface::Dtc> &dtc)
{
QStandardItemModel *itemModel = new QStandardItemModel(cbx);
cbx->setModel(itemModel);
QStandardItem *itemEmpty = new QStandardItem(emptyEntryComboBox);
itemEmpty->setData(-1, CBUserRoles::Id);
itemModel->appendRow(itemEmpty);
const auto &firePurposes = dtc->firePurposes();
for (const FirePurpose &firePurpose : firePurposes)
{
QStandardItem *item = new QStandardItem(dtc->trFirePurposeName(firePurpose.id()));
item->setToolTip(dtc->trFirePurposeName(firePurpose.id()));
item->setData(firePurpose.id(), CBUserRoles::Id);
item->setData(QByteArray::fromStdString(firePurpose.properties()), CBUserRoles::Properties);
itemModel->appendRow(item);
}
itemModel->sort(0, Qt::AscendingOrder);
}
bool fill(QComboBox *cbx, PdmComboBoxType type)
{
if (!cbx)
return false;
const QVariant curData = cbx->currentData();
QSignalBlocker block(cbx);
cbx->clear();
switch (type)
{
case PdmComboBoxType::CbLanguage:
{
const QString languages = LtsUtils::ProjectSettings::getInstance()->value(QStringLiteral("pdm"), QStringLiteral("EquipmentLanguages")).toString();
const QVector<QStringRef> slLang = languages.splitRef(QLatin1Char(','));
QSet<int> alreadySeen;
alreadySeen += LanguageConfiguration::NoChange;
cbx->addItem(toString(LanguageConfiguration::NoChange), LanguageConfiguration::NoChange);
for (const QStringRef &r : slLang)
{
const int langId = r.toInt();
if (alreadySeen.contains(langId))
continue;
alreadySeen += langId;
cbx->addItem(toString(static_cast<LanguageConfiguration_def::type>(langId)), static_cast<LanguageConfiguration_def::type>(langId));
}
break;
}
case PdmComboBoxType::CbOperationMode:
{
cbx->addItem(toString(OperationMode::NoChange), OperationMode::NoChange);
cbx->addItem(toString(OperationMode::Normal), OperationMode::Normal);
cbx->addItem(toString(OperationMode::BeStill), OperationMode::BeStill);
break;
}
case PdmComboBoxType::CbModeHelmet:
case PdmComboBoxType::CbModeVest:
{
cbx->addItem(toString(WphMode::NoChange), WphMode::NoChange);
cbx->addItem(toString(WphMode::Without), WphMode::Without);
cbx->addItem(toString(WphMode::With), WphMode::With);
break;
}
case PdmComboBoxType::CbPersonalProtection:
{
cbx->addItem(toString(PersonalProtection::NoChange), PersonalProtection::NoChange);
cbx->addItem(toString(PersonalProtection::Without), PersonalProtection::Without);
cbx->addItem(toString(PersonalProtection::Suit), PersonalProtection::Suit);
cbx->addItem(toString(PersonalProtection::SuitAndGloves), PersonalProtection::SuitAndGloves);
break;
}
case PdmComboBoxType::CbProtectionLevel:
{
cbx->addItem(toString(ProtectionLevel::NoChange), ProtectionLevel::NoChange);
cbx->addItem(toString(ProtectionLevel::IdzBs), ProtectionLevel::IdzBs);
cbx->addItem(toString(ProtectionLevel::IdzEs), ProtectionLevel::IdzEs);
cbx->addItem(toString(ProtectionLevel::Ksk), ProtectionLevel::Ksk);
cbx->addItem(toString(ProtectionLevel::SoldierWithBodyArmor), ProtectionLevel::SoldierWithBodyArmor);
cbx->addItem(toString(ProtectionLevel::SoldierActor), ProtectionLevel::SoldierActor);
break;
}
case PdmComboBoxType::CbHandgrenadeSearchMode:
{
cbx->addItem(toString(HandgrenadeSearchMode::NoChange), HandgrenadeSearchMode::NoChange);
cbx->addItem(toString(HandgrenadeSearchMode::On), HandgrenadeSearchMode::On);
cbx->addItem(toString(HandgrenadeSearchMode::Off), HandgrenadeSearchMode::Off);
break;
}
case PdmComboBoxType::CbInternationalMode:
{
cbx->addItem(toString(InternationalMode::NoChange), InternationalMode::NoChange);
cbx->addItem(toString(InternationalMode::On), InternationalMode::On);
cbx->addItem(toString(InternationalMode::Off), InternationalMode::Off);
break;
}
case PdmComboBoxType::CbABCProtectionMode:
{
cbx->addItem(toString(ABCProtectionMode::NoChange), ABCProtectionMode::NoChange);
cbx->addItem(toString(ABCProtectionMode::On), ABCProtectionMode::On);
cbx->addItem(toString(ABCProtectionMode::Off), ABCProtectionMode::Off);
break;
}
case PdmComboBoxType::CbUnkown:
break;
} // end switch
if (curData.isValid() && (cbx->findData(curData) != -1))
cbx->setCurrentIndex(cbx->findData(curData));
else if (cbx->count())
cbx->setCurrentIndex(0);
cbx->model()->sort(0, Qt::AscendingOrder);
return true;
}
bool fill(QComboBox *cbx, GearClass gearClass, const std::shared_ptr<Interface::Dtc> &dtc)
{
if (!cbx)
return false;
const QVariant curData = cbx->currentData();
QSignalBlocker block(cbx);
cbx->clear();
fillGearClass(cbx, gearClass, dtc);
if (curData.isValid() && (cbx->findData(curData) != -1))
cbx->setCurrentIndex(cbx->findData(curData));
else if (cbx->count())
cbx->setCurrentIndex(0);
return true;
}
bool setChargeTypePropertyFilter(QComboBox *cbx, const QString &property, const QVariant &value)
{
if (!cbx)
return false;
ChargeTypeFilterProxyModel *fpm = qobject_cast<ChargeTypeFilterProxyModel *>(cbx->model());
if (!fpm)
return false;
fpm->setPropertyFilter(property, value);
return true;
}
} // namespace PdmComboBox
} // namespace ProjectDataManagement
@@ -0,0 +1,86 @@
/**
* @RDE_HEADER@
* HMI Plugin for ProjectDataManagement - PDM ComboBox
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#pragma once
// DDS
#include <QSortFilterProxyModel>
#include <ProjectDataManagement/pdm_dtc.h>
class QComboBox;
class QStandardItemModel;
namespace ProjectDataManagement
{
enum class PdmComboBoxType
{
CbUnkown = 0,
CbLanguage,
CbOperationMode,
CbModeHelmet,
CbModeVest,
CbPersonalProtection,
CbProtectionLevel,
CbHandgrenadeSearchMode,
CbInternationalMode,
CbABCProtectionMode,
};
// --------------------------------------------------------
// ComboBox
// --------------------------------------------------------
namespace PdmComboBox
{
class ChargeTypeFilterProxyModel final : public QSortFilterProxyModel
{
Q_OBJECT
public:
using QSortFilterProxyModel::QSortFilterProxyModel;
void setPropertyFilter(const QString &property, const QVariant &value);
void setSourceModel(QAbstractItemModel *model) override;
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
private:
QStandardItemModel *m_model = nullptr;
QString m_property;
QVariant m_value;
};
namespace CBUserRoles
{
enum Role
{
Id = Qt::UserRole,
Properties
};
}
namespace TargetSubTypeRole
{
enum Role
{
Id = Qt::UserRole,
Abbreviation
};
}
bool fill(QComboBox *cbx, PdmComboBoxType type);
bool fill(QComboBox *cbx, GearClass gearClass, const std::shared_ptr<Interface::Dtc> &dtc);
void fillIgniterType(QComboBox *cbx, int chargeTypeId, const std::shared_ptr<Interface::Dtc> &dtc);
void fillIgniterFunction(QComboBox *cbx, int chargeTypeId, int igniterTypeId, const std::shared_ptr<Interface::Dtc> &dtc);
void fillLoadType(QComboBox *cbx, int chargeTypeId, const std::shared_ptr<Interface::Dtc> &dtc);
void fillTargetType(QComboBox *cbx, const std::shared_ptr<Interface::Dtc> &dtc);
void fillTargetSubType(QComboBox *cbx, int targetTypeId, const std::shared_ptr<Interface::Dtc> &dtc);
void fillFirePurpose(QComboBox *cbx, const std::shared_ptr<Interface::Dtc> &dtc);
bool setChargeTypePropertyFilter(QComboBox *cbx, const QString &property, const QVariant &value);
} // namespace PdmComboBox
} // namespace ProjectDataManagement
@@ -0,0 +1,181 @@
/**
* @RDE_HEADER@
* GUI Plugin for ProjectDataManagement - PdmComboBox
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#include "pdm_combobox_foreign_gui_interface_impl.h"
#include "pdm_charge_selector.h"
#include "pdm_combobox.h"
namespace ProjectDataManagement
{
ForeignGuiInterfaceImpl::ForeignGuiInterfaceImpl()
: m_dtc(nullptr)
{}
bool ForeignGuiInterfaceImpl::init(const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &dtc)
{
m_dtc = dtc;
return m_dtc != nullptr;
}
void ForeignGuiInterfaceImpl::uninit()
{
m_dtc = nullptr;
}
bool ForeignGuiInterfaceImpl::fillBComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, ProjectDataManagement::GearClass::Biological, m_dtc);
}
bool ForeignGuiInterfaceImpl::fillCComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, ProjectDataManagement::GearClass::Chemical, m_dtc);
}
bool ForeignGuiInterfaceImpl::fillNComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, ProjectDataManagement::GearClass::Nuclear, m_dtc);
}
bool ForeignGuiInterfaceImpl::fillArtilleryComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, ProjectDataManagement::GearClass::Artillery, m_dtc);
}
bool ForeignGuiInterfaceImpl::fillMortarComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, ProjectDataManagement::GearClass::Mortar, m_dtc);
}
bool ForeignGuiInterfaceImpl::fillSingleMineComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, ProjectDataManagement::GearClass::MineSingle, m_dtc);
}
bool ForeignGuiInterfaceImpl::fillMineFieldComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, ProjectDataManagement::GearClass::MineArea, m_dtc);
}
bool ForeignGuiInterfaceImpl::fillBoobyTrapComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, ProjectDataManagement::GearClass::BoobyTrap, m_dtc);
}
bool ForeignGuiInterfaceImpl::fillOffRouteMineComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, ProjectDataManagement::GearClass_def::OffRouteMine, m_dtc);
}
bool ForeignGuiInterfaceImpl::fillFunctionalAreaComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, ProjectDataManagement::GearClass::FunctionalArea, m_dtc);
}
bool ForeignGuiInterfaceImpl::fillAirSupportComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, ProjectDataManagement::GearClass::AirSupport, m_dtc);
}
void ForeignGuiInterfaceImpl::fillIgniterComboBox(QComboBox *cbx, int chargeTypeId)
{
return PdmComboBox::fillIgniterType(cbx, chargeTypeId, m_dtc);
}
void ForeignGuiInterfaceImpl::fillIgniterFunctionComboBox(QComboBox *cbx, int chargeTypeId, int igniterTypeId)
{
return PdmComboBox::fillIgniterFunction(cbx, chargeTypeId, igniterTypeId, m_dtc);
}
void ForeignGuiInterfaceImpl::fillLoadComboBox(QComboBox *cbx, int chargeTypeId)
{
return PdmComboBox::fillLoadType(cbx, chargeTypeId, m_dtc);
}
void ForeignGuiInterfaceImpl::fillTargetTypeComboBox(QComboBox *cbx)
{
return PdmComboBox::fillTargetType(cbx, m_dtc);
}
void ForeignGuiInterfaceImpl::fillTargetSubTypeComboBox(QComboBox *cbx, int targetTypeId)
{
return PdmComboBox::fillTargetSubType(cbx, targetTypeId, m_dtc);
}
void ForeignGuiInterfaceImpl::fillFirePurposeComboBox(QComboBox *cbx)
{
return PdmComboBox::fillFirePurpose(cbx, m_dtc);
}
bool ForeignGuiInterfaceImpl::setChargeTypePropertyFilter(QComboBox *cbx, const QString &property, const QVariant &value)
{
return PdmComboBox::setChargeTypePropertyFilter(cbx, property, value);
}
void ForeignGuiInterfaceImpl::chargeSelector(const QSet<int> &preselectedCharges,
GearClass gearClass,
const std::function<void(const QSet<int>&)> &cb,
QWidget *parent)
{
ChargeSelector *ps(new ChargeSelector(parent));
ps->init(m_dtc, gearClass, preselectedCharges);
if (parent)
QObject::connect(ps, &ChargeSelector::chargesSelected, parent, cb);
ps->show();
}
bool ForeignGuiInterfaceImpl::fillPlayerLanguageComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, PdmComboBoxType::CbLanguage);
}
bool ForeignGuiInterfaceImpl::fillPlayerOperationModeComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, PdmComboBoxType::CbOperationMode);
}
bool ForeignGuiInterfaceImpl::fillPlayerModeHelmetComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, PdmComboBoxType::CbModeHelmet);
}
bool ForeignGuiInterfaceImpl::fillPlayerModeVestComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, PdmComboBoxType::CbModeVest);
}
bool ForeignGuiInterfaceImpl::fillPlayerPersonalProtectionComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, PdmComboBoxType::CbPersonalProtection);
}
bool ForeignGuiInterfaceImpl::fillPlayerProtectionLevelComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, PdmComboBoxType::CbProtectionLevel);
}
bool ForeignGuiInterfaceImpl::fillPlayerHandgrenadeSearchModeComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, PdmComboBoxType::CbHandgrenadeSearchMode);
}
bool ForeignGuiInterfaceImpl::fillPlayerInternationalModeComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, PdmComboBoxType::CbInternationalMode);
}
bool ForeignGuiInterfaceImpl::fillABCProtectionComboBox(QComboBox *cbx)
{
return PdmComboBox::fill(cbx, PdmComboBoxType::CbABCProtectionMode);
}
} // namespace ProjectDataManagement
@@ -0,0 +1,65 @@
/**
*@RDE_HEADER@
* Gui Plugin for ProjectDataManagement - PdmComboBox
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#pragma once
#include <ProjectDataManagement/pdm_gui_plugin_interface.h>
#include <ProjectDataManagement/pdm_dtc.h>
namespace ProjectDataManagement
{
class ForeignGuiInterfaceImpl : public ForeignGuiInterface
{
public:
ForeignGuiInterfaceImpl();
bool init(const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &dtc);
void uninit();
bool fillBComboBox(QComboBox *cbx) override;
bool fillCComboBox(QComboBox *cbx) override;
bool fillNComboBox(QComboBox *cbx) override;
bool fillArtilleryComboBox(QComboBox *cbx) override;
bool fillMortarComboBox(QComboBox *cbx) override;
bool fillSingleMineComboBox(QComboBox *cbx) override;
bool fillMineFieldComboBox(QComboBox *cbx) override;
bool fillBoobyTrapComboBox(QComboBox *cbx) override;
bool fillOffRouteMineComboBox(QComboBox *cbx) override;
bool fillFunctionalAreaComboBox(QComboBox *cbx) override;
bool fillAirSupportComboBox(QComboBox *cbx) override;
bool setChargeTypePropertyFilter(QComboBox *cbx, const QString &property, const QVariant &value) override;
bool fillPlayerLanguageComboBox(QComboBox *cbx) override;
bool fillPlayerOperationModeComboBox(QComboBox *cbx) override;
bool fillPlayerModeHelmetComboBox(QComboBox *cbx) override;
bool fillPlayerModeVestComboBox(QComboBox *cbx) override;
bool fillPlayerPersonalProtectionComboBox(QComboBox *cbx) override;
bool fillPlayerProtectionLevelComboBox(QComboBox *cbx) override;
bool fillPlayerHandgrenadeSearchModeComboBox(QComboBox *cbx) override;
bool fillPlayerInternationalModeComboBox(QComboBox *cbx) override;
bool fillABCProtectionComboBox(QComboBox *cbx) override;
void fillIgniterComboBox(QComboBox *cbx, int chargeTypeId) override;
void fillIgniterFunctionComboBox(QComboBox *cbx, int chargeTypeId, int igniterTypeId) override;
void fillLoadComboBox(QComboBox *cbx, int chargeTypeId) override;
void fillTargetTypeComboBox(QComboBox *cbx) override;
void fillTargetSubTypeComboBox(QComboBox *cbx, int targetTypeId) override;
void fillFirePurposeComboBox(QComboBox *cbx) override;
void chargeSelector(const QSet<int> &preselectedCharges,
GearClass gearClass,
const std::function<void(const QSet<int>&)> &cb,
QWidget *parent) override;
private:
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtc;
};
} // namespace ProjectDataManagement
@@ -0,0 +1,37 @@
/**
* @RDE_HEADER@
* GUI Plugin for ProjectDataManagement - PdmComboBox
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#include "pdm_combobox_gui_plugin.h"
namespace ProjectDataManagement
{
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.Pdm.PdmCombobox"))
{}
bool InterfaceImpl::fetchInterfaces()
{
std::shared_ptr<ProjectDataManagement::Interface::Dtc> dtc;
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(dtc))
return false;
return ForeignGuiInterfaceImpl::init(dtc);
}
void InterfaceImpl::clearInterfaces()
{
ForeignGuiInterfaceImpl::uninit();
}
} // namespace ProjectDataManagement
@@ -0,0 +1,54 @@
/**
*@RDE_HEADER@
* Gui Plugin for ProjectDataManagement - PdmComboBox
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#pragma once
#include <LtsSession/lts_session.h>
#include <ProjectDataManagement/logger.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
#include "pdm_combobox_foreign_gui_interface_impl.h"
namespace ProjectDataManagement
{
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:pdm")
Q_INTERFACES(GuiPluginBase::Plugin)
Q_OBJECT
public:
GuiPlugin() = default;
~GuiPlugin() = default;
QString pluginName() override { return QLatin1String("ProjectDataManagementGuiPlugin"); }
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
bool availableInPartition(IDL::PartitionType partition) const override
{
return (partition == IDL::PartitionType::Global ||
partition == IDL::PartitionType::Exercise ||
partition == IDL::PartitionType::Replay);
}
};
class InterfaceImpl final : public QObject, public ForeignGuiInterfaceImpl, public GuiPluginBase::Interface
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
bool fetchInterfaces() override;
void clearInterfaces() override;
QString menuGroup() const override { return QString(); }
bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise; }
};
} // namespace ProjectDataManagement
@@ -0,0 +1,28 @@
/**
* @RDE_HEADER@
* HMI Plugin for ProjectDataManagement (Interface for access from other Plugins)
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#pragma once
#include <QSet>
#include <functional>
class QComboBox;
class QWidget;
class QVariant;
namespace ProjectDataManagement
{
class ForeignChargeTableGuiInterface
{
public:
ForeignChargeTableGuiInterface() = default;
virtual ~ForeignChargeTableGuiInterface() = default;
};
} // namespace ProjectDataManagement
@@ -0,0 +1,32 @@
/**
* @RDE_HEADER@
* Data Plugin Interface for ProjectDataManagement (Interface for access from other Plugins)
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-29
*/
#pragma once
#include <ProjectDataManagement/pdm_dtc.h>
#include <ProjectDataManagement/pdm_ftc.h>
#include <PluginInterfaces/data_plugin_interface.h>
namespace ProjectDataManagement
{
class ForeignDataInterface;
/**
* @brief The DataInterface class provides the Topics Clients only for the GUI Plugins
*/
class DataInterface : public DataPluginBase::Interface
{
public:
using DataPluginBase::Interface::Interface;
virtual std::shared_ptr<ProjectDataManagement::Interface::Dtc> getDtc() = 0;
virtual std::shared_ptr<ProjectDataManagement::Interface::Ftc> getFtc() = 0;
};
} // namespace ProjectDataManagement
@@ -0,0 +1,66 @@
/**
* @RDE_HEADER@
* HMI Plugin for ProjectDataManagement (Interface for access from other Plugins)
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-09-12
*/
#pragma once
#include <QSet>
#include <functional>
#include <ProjectDataManagement/pdm_enums.hpp>
class QComboBox;
class QWidget;
class QVariant;
namespace ProjectDataManagement
{
class ForeignGuiInterface
{
public:
ForeignGuiInterface() = default;
virtual ~ForeignGuiInterface() = default;
virtual bool fillBComboBox(QComboBox *cbx) = 0;
virtual bool fillCComboBox(QComboBox *cbx) = 0;
virtual bool fillNComboBox(QComboBox *cbx) = 0;
virtual bool fillArtilleryComboBox(QComboBox *cbx) = 0;
virtual bool fillMortarComboBox(QComboBox *cbx) = 0;
virtual bool fillSingleMineComboBox(QComboBox *cbx) = 0;
virtual bool fillMineFieldComboBox(QComboBox *cbx) = 0;
virtual bool fillBoobyTrapComboBox(QComboBox *cbx) = 0;
virtual bool fillOffRouteMineComboBox(QComboBox *cbx) = 0;
virtual bool fillFunctionalAreaComboBox(QComboBox *cbx) = 0;
virtual bool fillAirSupportComboBox(QComboBox *cbx) = 0;
virtual bool setChargeTypePropertyFilter(QComboBox *cbx, const QString &property, const QVariant &value) = 0;
virtual bool fillPlayerLanguageComboBox(QComboBox *cbx) = 0;
virtual bool fillPlayerOperationModeComboBox(QComboBox *cbx) = 0;
virtual bool fillPlayerModeHelmetComboBox(QComboBox *cbx) = 0;
virtual bool fillPlayerModeVestComboBox(QComboBox *cbx) = 0;
virtual bool fillPlayerPersonalProtectionComboBox(QComboBox *cbx) = 0;
virtual bool fillPlayerProtectionLevelComboBox(QComboBox *cbx) = 0;
virtual bool fillPlayerHandgrenadeSearchModeComboBox(QComboBox *cbx) = 0;
virtual bool fillPlayerInternationalModeComboBox(QComboBox *cbx) = 0;
virtual bool fillABCProtectionComboBox(QComboBox *cbx) = 0;
virtual void fillIgniterComboBox(QComboBox *cbx, int chargeTypeId) = 0;
virtual void fillIgniterFunctionComboBox(QComboBox *cbx, int chargeTypeId, int igniterTypeId) = 0;
virtual void fillLoadComboBox(QComboBox *cbx, int chargeTypeId) = 0;
virtual void fillTargetTypeComboBox(QComboBox *cbx) = 0;
virtual void fillTargetSubTypeComboBox(QComboBox *cbx, int targetTypeId) = 0;
virtual void fillFirePurposeComboBox(QComboBox *cbx) = 0;
// virtual bool fillMobileVideoSystemComboBox(QComboBox *cbx) = 0;
virtual void chargeSelector(const QSet<int> &preselectedCharges,
GearClass gearClass,
const std::function<void(const QSet<int>&)> &cb,
QWidget *parent) = 0;
};
} // namespace ProjectDataManagement