Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files) - Formatted LtsAppDescriptor module files - Formatted LtsAppManager/AppChooser files - Applied clang-format to all DTC and enum headers across modules - Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/) Cosmetic changes only, no functional modifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
848 files changed
+89305
-100020
No files matched your search
Executable → Regular
+21
-25
@@ -1,47 +1,43 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esm_effect_show_model.h"
|
||||
|
||||
#include <Services/EffectShowManagement/esm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <Services/EffectShowManagement/esm_dtc.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EffectShowActorList;
|
||||
}
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
|
||||
|
||||
class EffectShowActorList : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectShowActorList(QWidget *parent = nullptr);
|
||||
~EffectShowActorList();
|
||||
bool init(LtsSession::LtsSession *session);
|
||||
public:
|
||||
explicit EffectShowActorList(QWidget* parent = nullptr);
|
||||
~EffectShowActorList();
|
||||
bool init(LtsSession::LtsSession* session);
|
||||
|
||||
private:
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void retranslate() override;
|
||||
void onSelectionChanged();
|
||||
void onShowEffectShowActor();
|
||||
void onPrint();
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
void onSelectionChanged();
|
||||
void onShowEffectShowActor();
|
||||
void onPrint();
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
private:
|
||||
EffectShowModel *m_effectShowModel;
|
||||
LtsSession::LtsSession *m_session;
|
||||
Ui::EffectShowActorList *m_ui;
|
||||
private:
|
||||
EffectShowModel* m_effectShowModel;
|
||||
LtsSession::LtsSession* m_session;
|
||||
Ui::EffectShowActorList* m_ui;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+52
-67
@@ -1,106 +1,91 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
#include "esm_effect_show_model.h"
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <EffectShowManagement/esm_dtc.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
|
||||
class EffectShowActorProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EffectShowActorProxyModel(EffectShowActorModel *sourceModel, EffectShowModel *effectShowModel, QObject *parent);
|
||||
public:
|
||||
EffectShowActorProxyModel(EffectShowActorModel* sourceModel, EffectShowModel* effectShowModel, QObject* parent);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
NGL::INGLLogger& m_logger;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
|
||||
|
||||
EffectShowModel *m_effectShowModel;
|
||||
EffectShowActorModel *m_sourceModel;
|
||||
EffectShowModel* m_effectShowModel;
|
||||
EffectShowActorModel* m_sourceModel;
|
||||
};
|
||||
|
||||
|
||||
class EffectShowModel;
|
||||
|
||||
|
||||
class EffectShowActorModel final : public LtsWidgets::LtsAbstractTableModel<ParticipantManagement::Participant>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Name,
|
||||
Status,
|
||||
BITE,
|
||||
Feature,
|
||||
Position,
|
||||
EffectShow,
|
||||
Relocation,
|
||||
RestMagazine,
|
||||
RestAmmunition
|
||||
};
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns { Name, Status, BITE, Feature, Position, EffectShow, Relocation, RestMagazine, RestAmmunition };
|
||||
|
||||
enum eFeature
|
||||
{
|
||||
NotSpecified = Feature_e_def::NotSpecified,
|
||||
Smoke = Feature_e_def::Smoke,
|
||||
Explosion24 = Feature_e_def::Explosion24,
|
||||
Explosion48 = Feature_e_def::Explosion48,
|
||||
SmokeAndExplosion48 = Explosion48 + 1
|
||||
};
|
||||
static QVector<eFeature> s_features;
|
||||
enum eFeature {
|
||||
NotSpecified = Feature_e_def::NotSpecified,
|
||||
Smoke = Feature_e_def::Smoke,
|
||||
Explosion24 = Feature_e_def::Explosion24,
|
||||
Explosion48 = Feature_e_def::Explosion48,
|
||||
SmokeAndExplosion48 = Explosion48 + 1
|
||||
};
|
||||
|
||||
enum eStatus
|
||||
{
|
||||
NotOperational = 0,
|
||||
Operational = 1
|
||||
};
|
||||
static QVector<eStatus> s_status;
|
||||
static QVector<eFeature> s_features;
|
||||
|
||||
explicit EffectShowActorModel(EffectShowModel *effectShowModel, QObject *parent);
|
||||
enum eStatus { NotOperational = 0, Operational = 1 };
|
||||
|
||||
bool initModel(LtsSession::LtsSession *session);
|
||||
static QVector<eStatus> s_status;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
explicit EffectShowActorModel(EffectShowModel* effectShowModel, QObject* parent);
|
||||
|
||||
|
||||
bool initModel(LtsSession::LtsSession* session);
|
||||
|
||||
bool isFiltered(const ParticipantManagement::Participant &data, DataModification modType) const override final;
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
QVector<ParticipantManagement::Participant>::const_iterator getIt(int id) const;
|
||||
QVector<ParticipantManagement::Participant>::const_iterator getItBegin() const { return m_vecData.begin(); }
|
||||
QVector<ParticipantManagement::Participant>::const_iterator getItEnd() const { return m_vecData.end(); }
|
||||
Feature_e getFeature(int rowId) const;
|
||||
static QString getFeatureName(const eFeature &feature);
|
||||
bool isOperational(int rowId) const;
|
||||
bool isMatchedByFilter(const int &equipmentNumber, const int &featureFilter) const;
|
||||
bool isFiltered(const ParticipantManagement::Participant& data, DataModification modType) const override final;
|
||||
|
||||
private:
|
||||
void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType);
|
||||
QVector<ParticipantManagement::Participant>::const_iterator getIt(int id) const;
|
||||
|
||||
QString faultStatus(bool fault) const;
|
||||
QVector<ParticipantManagement::Participant>::const_iterator getItBegin() const
|
||||
{
|
||||
return m_vecData.begin();
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
|
||||
QVector<ParticipantManagement::Participant>::const_iterator getItEnd() const
|
||||
{
|
||||
return m_vecData.end();
|
||||
}
|
||||
|
||||
QHash<int, Core::GeoPosition2D> m_ppmPositions;
|
||||
Feature_e getFeature(int rowId) const;
|
||||
static QString getFeatureName(const eFeature& feature);
|
||||
bool isOperational(int rowId) const;
|
||||
bool isMatchedByFilter(const int& equipmentNumber, const int& featureFilter) const;
|
||||
|
||||
EffectShowModel *m_effectShowModel;
|
||||
friend class EffectShowActorProxyModel;
|
||||
private:
|
||||
void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition& data, DataModification modType);
|
||||
|
||||
QString faultStatus(bool fault) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
|
||||
|
||||
QHash<int, Core::GeoPosition2D> m_ppmPositions;
|
||||
|
||||
EffectShowModel* m_effectShowModel;
|
||||
friend class EffectShowActorProxyModel;
|
||||
};
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+121
-135
@@ -1,189 +1,175 @@
|
||||
|
||||
|
||||
|
||||
#include "esm_effect_show_actor_relocation_edit.h"
|
||||
#include <utility>
|
||||
|
||||
#include "ParticipantManagement/ppm_data_plugin_interface.h"
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include "esm_effect_show_actor_relocation_model.h"
|
||||
#include "ui_esm_effect_show_actor_relocation_list.h"
|
||||
#include "ui_esm_effect_show_actor_relocation_edit.h"
|
||||
#include "ui_esm_effect_show_actor_relocation_list.h"
|
||||
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
#include <LtsDataView/tree_view_delegate.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <LtsDataView/tree_view_delegate.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
EffectShowActorRelocationEdit::EffectShowActorRelocationEdit(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_sitMapGuiIfc(nullptr)
|
||||
, m_model(nullptr)
|
||||
, m_session(nullptr)
|
||||
, m_ui(new Ui::EffectShowActorRelocationEdit)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
EffectShowActorRelocationEdit::EffectShowActorRelocationEdit(QWidget* parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel), m_dtc(nullptr), m_ftc(nullptr),
|
||||
m_ppmDtc(nullptr), m_sitMapGuiIfc(nullptr), m_model(nullptr), m_session(nullptr),
|
||||
m_ui(new Ui::EffectShowActorRelocationEdit), m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
EffectShowActorRelocationEdit::~EffectShowActorRelocationEdit()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationEdit::getPosition()
|
||||
{
|
||||
if (!m_sitMapGuiIfc)
|
||||
return;
|
||||
if (!m_sitMapGuiIfc)
|
||||
return;
|
||||
|
||||
m_sitMapGuiIfc->getCoordinate(m_ui->cwCoordinate, SLOT(setCoordinate(QPointF)), nullptr);
|
||||
m_sitMapGuiIfc->getCoordinate(m_ui->cwCoordinate, SLOT(setCoordinate(QPointF)), nullptr);
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationEdit::onEffectShowActorFilterChanged(const int &idx)
|
||||
void EffectShowActorRelocationEdit::onEffectShowActorFilterChanged(const int& idx)
|
||||
{
|
||||
Q_UNUSED(idx);
|
||||
Q_UNUSED(idx);
|
||||
|
||||
int selectedParticipantId = -1;
|
||||
if (m_ui->cbEffectShowActor->count() > 0 && m_ui->cbEffectShowActor->currentIndex() >= 0)
|
||||
selectedParticipantId = m_ui->cbEffectShowActor->currentData().toInt();
|
||||
int selectedParticipantId = -1;
|
||||
if (m_ui->cbEffectShowActor->count() > 0 && m_ui->cbEffectShowActor->currentIndex() >= 0)
|
||||
selectedParticipantId = m_ui->cbEffectShowActor->currentData().toInt();
|
||||
|
||||
m_ui->cbEffectShowActor->clear();
|
||||
m_ui->cbEffectShowActor->clear();
|
||||
|
||||
const int filter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
int i = 0;
|
||||
for (auto it = m_effectShowActors.begin(); it != m_effectShowActors.end(); ++it)
|
||||
{
|
||||
auto iParticipant = m_model->getEffectShowActorModel()->getIt(it.key());
|
||||
if (iParticipant == m_model->getEffectShowActorModel()->getItEnd())
|
||||
continue;
|
||||
if (!iParticipant->equipmentNumber().is_set())
|
||||
continue;
|
||||
if (!m_model->getEffectShowActorModel()->isMatchedByFilter(iParticipant->equipmentNumber().get(), filter))
|
||||
continue;
|
||||
const int filter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
int i = 0;
|
||||
for (auto it = m_effectShowActors.begin(); it != m_effectShowActors.end(); ++it)
|
||||
{
|
||||
auto iParticipant = m_model->getEffectShowActorModel()->getIt(it.key());
|
||||
if (iParticipant == m_model->getEffectShowActorModel()->getItEnd())
|
||||
continue;
|
||||
if (!iParticipant->equipmentNumber().is_set())
|
||||
continue;
|
||||
if (!m_model->getEffectShowActorModel()->isMatchedByFilter(iParticipant->equipmentNumber().get(), filter))
|
||||
continue;
|
||||
|
||||
m_ui->cbEffectShowActor->addItem(it.value(), it.key());
|
||||
if (selectedParticipantId == it.key())
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(i++);
|
||||
}
|
||||
m_ui->cbEffectShowActor->addItem(it.value(), it.key());
|
||||
if (selectedParticipantId == it.key())
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(i++);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationEdit::onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus &data,
|
||||
const DataModification &modType)
|
||||
void EffectShowActorRelocationEdit::onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus& data,
|
||||
const DataModification& modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
int equipmentNumber = m_ppmDtc->equipmentNumberByParticipantId(data.esmParticipantId());
|
||||
m_effectShowActors = m_model->getParticipantList();
|
||||
const int filter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
if (m_model->getEffectShowActorModel()->isMatchedByFilter(equipmentNumber, filter))
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
Q_UNUSED(modType);
|
||||
int equipmentNumber = m_ppmDtc->equipmentNumberByParticipantId(data.esmParticipantId());
|
||||
m_effectShowActors = m_model->getParticipantList();
|
||||
const int filter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
if (m_model->getEffectShowActorModel()->isMatchedByFilter(equipmentNumber, filter))
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, QString(), true, tr("Actor Relocation"));
|
||||
translate(m_ui, QString(), true, tr("Actor Relocation"));
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowActorRelocationEdit::init(LtsSession::LtsSession *session,
|
||||
EffectShowModel *model,
|
||||
int rowToCopy)
|
||||
bool EffectShowActorRelocationEdit::init(LtsSession::LtsSession* session, EffectShowModel* model, int rowToCopy)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "EffectShowActorRelocationEdit::init()";
|
||||
DEBUG_LOG(m_logger) << "EffectShowActorRelocationEdit::init()";
|
||||
|
||||
if (!session)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "EffectShowActorRelocationEdit::init() Invalid shared_ptr!";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!session->getDtc<EffectShowManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
if (!session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
||||
return false;
|
||||
|
||||
m_model = model;
|
||||
m_session = session;
|
||||
|
||||
m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc);
|
||||
if (m_sitMapGuiIfc)
|
||||
connect(m_ui->pbPosition, &QPushButton::clicked, this, &EffectShowActorRelocationEdit::getPosition);
|
||||
|
||||
connect(m_ui->pbClear, &QPushButton::clicked,
|
||||
m_ui->cwCoordinate, &LtsCoordWidget::LtsCoordWidget::clear);
|
||||
|
||||
m_effectShowActors = m_model->getParticipantList();
|
||||
|
||||
|
||||
int idx = 1;
|
||||
m_ui->cbEffectShowActorFilter->addItem(tr("<No filter>"), EffectShowActorModel::eFeature::NotSpecified);
|
||||
for (const EffectShowActorModel::eFeature &feature : std::as_const(EffectShowActorModel::s_features))
|
||||
{
|
||||
m_ui->cbEffectShowActorFilter->addItem(EffectShowActorModel::getFeatureName(feature), static_cast<int>(feature));
|
||||
if (feature == EffectShowActorModel::eFeature::SmokeAndExplosion48)
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(idx);
|
||||
++idx;
|
||||
}
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
|
||||
connect(m_ui->cbEffectShowActorFilter, QOverload<int>::of(&LtsWidgets::LtsComboBox::currentIndexChanged),
|
||||
this, &EffectShowActorRelocationEdit::onEffectShowActorFilterChanged);
|
||||
|
||||
|
||||
connect(m_model, &EffectShowModel::effectShowVehicleStatusChanged,
|
||||
this, &EffectShowActorRelocationEdit::onEffectShowVehicleStatusChanged);
|
||||
|
||||
|
||||
m_ui->dteTime->setMinimumTimeMSec(m_session->partitionTime());
|
||||
m_ui->dteTime->setRetrieveCurrentTimeCallback([this]() { return m_session->partitionTime(); });
|
||||
|
||||
|
||||
m_uiRequirements->addRequirement({m_ui->lblCoordinate, [this]() { return (!m_ui->cwCoordinate->coordinate().isNull()); }});
|
||||
m_uiRequirements->addRequirement({m_ui->lblTime, [this]() { return (m_ui->dteTime->msecsSinceEpoch() > m_session->partitionTime()); }});
|
||||
m_uiRequirements->addRequirement({m_ui->lblEffectShowActor, [this]() { return (m_ui->cbEffectShowActor->currentIndex() != -1); }});
|
||||
|
||||
if (rowToCopy >= 0)
|
||||
{
|
||||
const EffectShowActorRelocation © = m_model->getEffetShowActorRelocationModel()->getRowData(rowToCopy);
|
||||
if (copy.id() > 0)
|
||||
if (!session)
|
||||
{
|
||||
m_ui->cwCoordinate->setCoordinate(copy.position().lon(), copy.position().lat());
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(m_ui->cbEffectShowActor->findData(copy.esmParticipantId()));
|
||||
m_ui->leInfo->setText(QString::fromStdString(copy.info()));
|
||||
if (copy.arrival_time().is_set())
|
||||
m_ui->dteTime->setMsecsSinceEpoch(copy.arrival_time().get());
|
||||
slotChangesMade();
|
||||
ERROR_LOG(m_logger) << "EffectShowActorRelocationEdit::init() Invalid shared_ptr!";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
if (!session->getDtc<EffectShowManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
if (!session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
||||
return false;
|
||||
|
||||
m_model = model;
|
||||
m_session = session;
|
||||
|
||||
m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc);
|
||||
if (m_sitMapGuiIfc)
|
||||
connect(m_ui->pbPosition, &QPushButton::clicked, this, &EffectShowActorRelocationEdit::getPosition);
|
||||
|
||||
connect(m_ui->pbClear, &QPushButton::clicked, m_ui->cwCoordinate, &LtsCoordWidget::LtsCoordWidget::clear);
|
||||
|
||||
m_effectShowActors = m_model->getParticipantList();
|
||||
|
||||
int idx = 1;
|
||||
m_ui->cbEffectShowActorFilter->addItem(tr("<No filter>"), EffectShowActorModel::eFeature::NotSpecified);
|
||||
for (const EffectShowActorModel::eFeature& feature : std::as_const(EffectShowActorModel::s_features))
|
||||
{
|
||||
m_ui->cbEffectShowActorFilter->addItem(EffectShowActorModel::getFeatureName(feature),
|
||||
static_cast<int>(feature));
|
||||
if (feature == EffectShowActorModel::eFeature::SmokeAndExplosion48)
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(idx);
|
||||
++idx;
|
||||
}
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
|
||||
connect(m_ui->cbEffectShowActorFilter, QOverload<int>::of(&LtsWidgets::LtsComboBox::currentIndexChanged), this,
|
||||
&EffectShowActorRelocationEdit::onEffectShowActorFilterChanged);
|
||||
|
||||
connect(m_model, &EffectShowModel::effectShowVehicleStatusChanged, this,
|
||||
&EffectShowActorRelocationEdit::onEffectShowVehicleStatusChanged);
|
||||
|
||||
m_ui->dteTime->setMinimumTimeMSec(m_session->partitionTime());
|
||||
m_ui->dteTime->setRetrieveCurrentTimeCallback([this]() { return m_session->partitionTime(); });
|
||||
|
||||
m_uiRequirements->addRequirement(
|
||||
{m_ui->lblCoordinate, [this]() { return (!m_ui->cwCoordinate->coordinate().isNull()); }});
|
||||
m_uiRequirements->addRequirement(
|
||||
{m_ui->lblTime, [this]() { return (m_ui->dteTime->msecsSinceEpoch() > m_session->partitionTime()); }});
|
||||
m_uiRequirements->addRequirement(
|
||||
{m_ui->lblEffectShowActor, [this]() { return (m_ui->cbEffectShowActor->currentIndex() != -1); }});
|
||||
|
||||
if (rowToCopy >= 0)
|
||||
{
|
||||
const EffectShowActorRelocation& copy = m_model->getEffetShowActorRelocationModel()->getRowData(rowToCopy);
|
||||
if (copy.id() > 0)
|
||||
{
|
||||
m_ui->cwCoordinate->setCoordinate(copy.position().lon(), copy.position().lat());
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(m_ui->cbEffectShowActor->findData(copy.esmParticipantId()));
|
||||
m_ui->leInfo->setText(QString::fromStdString(copy.info()));
|
||||
if (copy.arrival_time().is_set())
|
||||
m_ui->dteTime->setMsecsSinceEpoch(copy.arrival_time().get());
|
||||
slotChangesMade();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowActorRelocationEdit::apply()
|
||||
{
|
||||
|
||||
|
||||
return m_requestHelper->startSingleRequest([this]()
|
||||
{
|
||||
EffectShowActorRelocation data;
|
||||
data.id(0);
|
||||
return m_requestHelper->startSingleRequest([this]() {
|
||||
EffectShowActorRelocation data;
|
||||
data.id(0);
|
||||
|
||||
data.esmParticipantId(m_ui->cbEffectShowActor->currentData().toInt());
|
||||
data.position(Core::GeoPosition2D(m_ui->cwCoordinate->coordinate().x(), m_ui->cwCoordinate->coordinate().y()));
|
||||
data.arrival_time().set(m_ui->dteTime->msecsSinceEpoch());
|
||||
data.info(m_ui->leInfo->text().toStdString());
|
||||
data.esmParticipantId(m_ui->cbEffectShowActor->currentData().toInt());
|
||||
data.position(Core::GeoPosition2D(m_ui->cwCoordinate->coordinate().x(), m_ui->cwCoordinate->coordinate().y()));
|
||||
data.arrival_time().set(m_ui->dteTime->msecsSinceEpoch());
|
||||
data.info(m_ui->leInfo->text().toStdString());
|
||||
|
||||
return m_ftc->effectShowActorRelocationModifyRequest(data, this);
|
||||
});
|
||||
return m_ftc->effectShowActorRelocationModifyRequest(data, this);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+35
-36
@@ -1,17 +1,15 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
#include "esm_effect_show_model.h"
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <Services/EffectShowManagement/esm_dtc.h>
|
||||
#include <Services/EffectShowManagement/esm_ftc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -26,45 +24,46 @@ class ForeignGuiInterface;
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
|
||||
class EffectShowActorRelocationEdit : public LtsWidgets::LtsDialog,
|
||||
protected EffectShowManagement::Interface::Ftc::EffectShowActorRelocationModifyReplyHandler
|
||||
class EffectShowActorRelocationEdit
|
||||
: public LtsWidgets::LtsDialog,
|
||||
protected EffectShowManagement::Interface::Ftc::EffectShowActorRelocationModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectShowActorRelocationEdit(QWidget *parent = nullptr);
|
||||
~EffectShowActorRelocationEdit();
|
||||
public:
|
||||
explicit EffectShowActorRelocationEdit(QWidget* parent = nullptr);
|
||||
~EffectShowActorRelocationEdit();
|
||||
|
||||
bool init(LtsSession::LtsSession *session,
|
||||
EffectShowModel *model,
|
||||
int rowToCopy = -1);
|
||||
bool apply() override;
|
||||
bool init(LtsSession::LtsSession* session, EffectShowModel* model, int rowToCopy = -1);
|
||||
bool apply() override;
|
||||
|
||||
private slots:
|
||||
void getPosition();
|
||||
void onEffectShowActorFilterChanged(const int &idx);
|
||||
void onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus &data, const DataModification &modType);
|
||||
private slots:
|
||||
void getPosition();
|
||||
void onEffectShowActorFilterChanged(const int& idx);
|
||||
void onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus& data, const DataModification& modType);
|
||||
|
||||
private:
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void retranslate() override;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
void onEffectShowActorRelocationModifyReply(const Core::FunctionReplyObject &replyObject) override { m_requestHelper->requestReply(replyObject); }
|
||||
void onEffectShowActorRelocationModifyReply(const Core::FunctionReplyObject& replyObject) override
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
private:
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
||||
|
||||
QMap<int, QString> m_effectShowActors;
|
||||
QMap<int, QString> m_effectShowActors;
|
||||
|
||||
EffectShowModel *m_model;
|
||||
LtsSession::LtsSession *m_session;
|
||||
Ui::EffectShowActorRelocationEdit *m_ui;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
EffectShowModel* m_model;
|
||||
LtsSession::LtsSession* m_session;
|
||||
Ui::EffectShowActorRelocationEdit* m_ui;
|
||||
LtsUtils::RequestHelper* m_requestHelper;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+68
-89
@@ -1,146 +1,125 @@
|
||||
|
||||
|
||||
|
||||
#include "esm_effect_show_actor_relocation_list.h"
|
||||
#include "ui_esm_effect_show_actor_relocation_list.h"
|
||||
#include "esm_effect_show_actor_relocation_edit.h"
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
|
||||
#include "esm_effect_show_actor_relocation_edit.h"
|
||||
#include "ui_esm_effect_show_actor_relocation_list.h"
|
||||
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
EffectShowActorRelocationList::EffectShowActorRelocationList(const QString &menuGroup, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_effectShowModel(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_session(nullptr)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_ui(new Ui::EffectShowActorRelocationList)
|
||||
EffectShowActorRelocationList::EffectShowActorRelocationList(const QString& menuGroup, QWidget* parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly), m_menuGroup(menuGroup),
|
||||
m_effectShowModel(nullptr), m_ftc(nullptr), m_session(nullptr),
|
||||
m_requestHelper(new LtsUtils::RequestHelper(this)), m_ui(new Ui::EffectShowActorRelocationList)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &EffectShowActorRelocationList::onSelectionChanged);
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged, this,
|
||||
&EffectShowActorRelocationList::onSelectionChanged);
|
||||
|
||||
|
||||
QCheckBox *cbExpired = new QCheckBox(tr("Show expired"), m_ui->widget);
|
||||
cbExpired->setProperty("const", true);
|
||||
m_ui->widget->setCustomWidget(cbExpired);
|
||||
connect(cbExpired, &QCheckBox::toggled, this, &EffectShowActorRelocationList::setShowExpired);
|
||||
QCheckBox* cbExpired = new QCheckBox(tr("Show expired"), m_ui->widget);
|
||||
cbExpired->setProperty("const", true);
|
||||
m_ui->widget->setCustomWidget(cbExpired);
|
||||
connect(cbExpired, &QCheckBox::toggled, this, &EffectShowActorRelocationList::setShowExpired);
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, this,
|
||||
&EffectShowActorRelocationList::onAddEffectShowActorRelocation);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this,
|
||||
&EffectShowActorRelocationList::onRemoveEffectShowActorRelocation);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &EffectShowActorRelocationList::onPrint);
|
||||
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, this, &EffectShowActorRelocationList::onAddEffectShowActorRelocation);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &EffectShowActorRelocationList::onRemoveEffectShowActorRelocation);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &EffectShowActorRelocationList::onPrint);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Effect_Show_Actor_Relocations"));
|
||||
|
||||
}
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Effect_Show_Actor_Relocations"));
|
||||
}
|
||||
|
||||
EffectShowActorRelocationList::~EffectShowActorRelocationList()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationList::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Actor Position Relocations"));
|
||||
translate(m_ui, tr("Actor Position Relocations"));
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowActorRelocationList::init(LtsSession::LtsSession *session)
|
||||
bool EffectShowActorRelocationList::init(LtsSession::LtsSession* session)
|
||||
{
|
||||
if (!session)
|
||||
return false;
|
||||
if (!session)
|
||||
return false;
|
||||
|
||||
if (!session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
if (!session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
|
||||
m_session = session;
|
||||
m_effectShowModel = new EffectShowModel(this);
|
||||
m_effectShowModel->initModel(session);
|
||||
|
||||
m_proxyModel = new EffectShowActorRelocationProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_effectShowModel->getEffetShowActorRelocationModel());
|
||||
m_ui->widget->setModel(m_proxyModel);
|
||||
m_session = session;
|
||||
m_effectShowModel = new EffectShowModel(this);
|
||||
m_effectShowModel->initModel(session);
|
||||
|
||||
m_proxyModel = new EffectShowActorRelocationProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_effectShowModel->getEffetShowActorRelocationModel());
|
||||
m_ui->widget->setModel(m_proxyModel);
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->widget->hideColumn(EffectShowModel::Columns::Id);
|
||||
m_ui->widget->hideColumn(EffectShowModel::Columns::Id);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationList::onSelectionChanged()
|
||||
{
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, m_ui->widget->selectionModel()->selectedRows().size());
|
||||
|
||||
}
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove,
|
||||
m_ui->widget->selectionModel()->selectedRows().size());
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationList::onAddEffectShowActorRelocation()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "--- onAddEffectShowActorRelocation() ";
|
||||
EffectShowActorRelocationEdit *dialog = new EffectShowActorRelocationEdit(this);
|
||||
if (m_ui->widget->currentIndex().row() >= 0)
|
||||
dialog->init(m_session, m_effectShowModel, m_ui->widget->currentIndex().row());
|
||||
else
|
||||
dialog->init(m_session, m_effectShowModel, -1);
|
||||
|
||||
addDialog(dialog, m_menuGroup, QLatin1String("esmEffectShowActorRelocation"), LtsWidgets::LayoutArea::eDialogTab);
|
||||
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "--- onAddEffectShowActorRelocation() ";
|
||||
EffectShowActorRelocationEdit* dialog = new EffectShowActorRelocationEdit(this);
|
||||
if (m_ui->widget->currentIndex().row() >= 0)
|
||||
dialog->init(m_session, m_effectShowModel, m_ui->widget->currentIndex().row());
|
||||
else
|
||||
dialog->init(m_session, m_effectShowModel, -1);
|
||||
|
||||
addDialog(dialog, m_menuGroup, QLatin1String("esmEffectShowActorRelocation"), LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationList::onRemoveEffectShowActorRelocation()
|
||||
{
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
|
||||
int row = idx.row();
|
||||
if (row < 0)
|
||||
return;
|
||||
int row = idx.row();
|
||||
if (row < 0)
|
||||
return;
|
||||
|
||||
EffectShowManagement::EffectShowActorRelocation esar = m_effectShowModel->getEffetShowActorRelocationModel()->getRowData(row);
|
||||
|
||||
|
||||
|
||||
m_requestHelper->startSingleRequest([esar, this]()
|
||||
{
|
||||
const Core::RemoveElementRequest req(esar.id());
|
||||
return m_ftc->effectShowActorRelocationRemoveRequest(req, this);
|
||||
});
|
||||
|
||||
}
|
||||
EffectShowManagement::EffectShowActorRelocation esar =
|
||||
m_effectShowModel->getEffetShowActorRelocationModel()->getRowData(row);
|
||||
|
||||
m_requestHelper->startSingleRequest([esar, this]() {
|
||||
const Core::RemoveElementRequest req(esar.id());
|
||||
return m_ftc->effectShowActorRelocationRemoveRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationList::setShowExpired(bool show)
|
||||
{
|
||||
m_proxyModel->setShowExpired(show);
|
||||
m_proxyModel->setShowExpired(show);
|
||||
}
|
||||
|
||||
|
||||
void EffectShowActorRelocationList::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationList::tableColumnOrganiserSetting()
|
||||
{
|
||||
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+35
-37
@@ -1,65 +1,63 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esm_effect_show_model.h"
|
||||
#include "esm_effect_show_actor_relocation_model.h"
|
||||
#include "esm_effect_show_model.h"
|
||||
|
||||
#include <EffectShowManagement/esm_dtc.h>
|
||||
#include <EffectShowManagement/esm_ftc.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EffectShowActorRelocationList;
|
||||
}
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
|
||||
class EffectShowActorRelocationList : public LtsWidgets::LtsDialog
|
||||
, protected EffectShowManagement::Interface::Ftc::EffectShowActorRelocationRemoveReplyHandler
|
||||
class EffectShowActorRelocationList
|
||||
: public LtsWidgets::LtsDialog,
|
||||
protected EffectShowManagement::Interface::Ftc::EffectShowActorRelocationRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectShowActorRelocationList(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~EffectShowActorRelocationList();
|
||||
bool init(LtsSession::LtsSession *session);
|
||||
public:
|
||||
explicit EffectShowActorRelocationList(const QString& menuGroup, QWidget* parent = nullptr);
|
||||
~EffectShowActorRelocationList();
|
||||
bool init(LtsSession::LtsSession* session);
|
||||
|
||||
private:
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void retranslate() override;
|
||||
void onSelectionChanged();
|
||||
void onAddEffectShowActorRelocation();
|
||||
void onRemoveEffectShowActorRelocation();
|
||||
void onPrint();
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
void onSelectionChanged();
|
||||
void onAddEffectShowActorRelocation();
|
||||
void onRemoveEffectShowActorRelocation();
|
||||
void onPrint();
|
||||
void tableColumnOrganiserSetting() override;
|
||||
void onEffectShowActorRelocationRemoveReply(const Core::FunctionReplyObject& reply) override
|
||||
{
|
||||
m_requestHelper->requestReply(reply);
|
||||
}
|
||||
|
||||
void onEffectShowActorRelocationRemoveReply(const Core::FunctionReplyObject &reply) override
|
||||
{
|
||||
m_requestHelper->requestReply(reply);
|
||||
}
|
||||
private slots:
|
||||
void setShowExpired(bool show);
|
||||
|
||||
private slots:
|
||||
void setShowExpired(bool show);
|
||||
private:
|
||||
QString m_menuGroup;
|
||||
EffectShowModel* m_effectShowModel{nullptr};
|
||||
EffectShowActorRelocationProxyModel* m_proxyModel{nullptr};
|
||||
|
||||
private:
|
||||
QString m_menuGroup;
|
||||
EffectShowModel *m_effectShowModel{nullptr};
|
||||
EffectShowActorRelocationProxyModel *m_proxyModel{nullptr};
|
||||
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
LtsSession::LtsSession *m_session{nullptr};
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
LtsSession::LtsSession* m_session{nullptr};
|
||||
LtsUtils::RequestHelper* m_requestHelper{nullptr};
|
||||
|
||||
Ui::EffectShowActorRelocationList *m_ui{nullptr};
|
||||
Ui::EffectShowActorRelocationList* m_ui{nullptr};
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+44
-44
@@ -1,11 +1,9 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <EffectShowManagement/esm_dtc.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
|
||||
@@ -13,60 +11,62 @@ namespace EffectShowManagement
|
||||
{
|
||||
class EffectShowModel;
|
||||
|
||||
|
||||
|
||||
class EffectShowActorRelocationModel final : public LtsWidgets::LtsAbstractTableModel<EffectShowManagement::EffectShowActorRelocation>
|
||||
class EffectShowActorRelocationModel final
|
||||
: public LtsWidgets::LtsAbstractTableModel<EffectShowManagement::EffectShowActorRelocation>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Name,
|
||||
Id,
|
||||
ArrivalTime,
|
||||
Position,
|
||||
Info,
|
||||
Status,
|
||||
Answer
|
||||
};
|
||||
explicit EffectShowActorRelocationModel(EffectShowModel *effectShowModel, QObject *parent);
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns { Name, Id, ArrivalTime, Position, Info, Status, Answer };
|
||||
|
||||
bool initModel(const std::shared_ptr<EffectShowManagement::Interface::Dtc> &dtc);
|
||||
explicit EffectShowActorRelocationModel(EffectShowModel* effectShowModel, QObject* parent);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool initModel(const std::shared_ptr<EffectShowManagement::Interface::Dtc>& dtc);
|
||||
|
||||
QVector<EffectShowManagement::EffectShowActorRelocation>::const_iterator getItBegin() const { return m_vecData.begin(); }
|
||||
QVector<EffectShowManagement::EffectShowActorRelocation>::const_iterator getItEnd() const { return m_vecData.end(); }
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
private:
|
||||
QVector<EffectShowManagement::EffectShowActorRelocation>::const_iterator getItBegin() const
|
||||
{
|
||||
return m_vecData.begin();
|
||||
}
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
QVector<EffectShowManagement::EffectShowActorRelocation>::const_iterator getItEnd() const
|
||||
{
|
||||
return m_vecData.end();
|
||||
}
|
||||
|
||||
EffectShowModel *m_effectShowModel;
|
||||
friend class EffectShowActorRelocationProxyModel;
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
|
||||
EffectShowModel* m_effectShowModel;
|
||||
friend class EffectShowActorRelocationProxyModel;
|
||||
};
|
||||
|
||||
|
||||
class EffectShowActorRelocationProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
bool showExpired() const { return m_showExpired; }
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
void setSourceModel(QAbstractItemModel* sourceModel) override;
|
||||
|
||||
public slots:
|
||||
void setShowExpired(bool show);
|
||||
bool showExpired() const
|
||||
{
|
||||
return m_showExpired;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override final;
|
||||
private:
|
||||
bool checkFilter(int source_row) const;
|
||||
private:
|
||||
bool m_showExpired{false};
|
||||
public slots:
|
||||
void setShowExpired(bool show);
|
||||
|
||||
EffectShowActorRelocationModel *m_sourceModel{nullptr};
|
||||
protected:
|
||||
bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const override;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override final;
|
||||
|
||||
private:
|
||||
bool checkFilter(int source_row) const;
|
||||
|
||||
private:
|
||||
bool m_showExpired{false};
|
||||
|
||||
EffectShowActorRelocationModel* m_sourceModel{nullptr};
|
||||
};
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+136
-178
@@ -1,234 +1,192 @@
|
||||
|
||||
|
||||
|
||||
#include "esm_effect_show_edit.h"
|
||||
#include "ui_esm_effect_show_list.h"
|
||||
#include "ui_esm_effect_show_edit.h"
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include "ui_esm_effect_show_edit.h"
|
||||
#include "ui_esm_effect_show_list.h"
|
||||
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
EffectShowEdit::EffectShowEdit(const EffectShow &effectShow, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_ftc(nullptr)
|
||||
, m_model(nullptr)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_effectShow(effectShow)
|
||||
, m_ui(new Ui::EffectShowEdit)
|
||||
EffectShowEdit::EffectShowEdit(const EffectShow& effectShow, QWidget* parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel), m_ftc(nullptr), m_model(nullptr),
|
||||
m_requestHelper(new LtsUtils::RequestHelper(this)), m_effectShow(effectShow), m_ui(new Ui::EffectShowEdit)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
EffectShowEdit::~EffectShowEdit()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void EffectShowEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Edit Effect Show"));
|
||||
translate(m_ui, tr("Edit Effect Show"));
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowEdit::init(LtsSession::LtsSession *session,
|
||||
EffectShowModel *model)
|
||||
bool EffectShowEdit::init(LtsSession::LtsSession* session, EffectShowModel* model)
|
||||
{
|
||||
m_session = session;
|
||||
if (!session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
if (!session->getDtc<ProjectDataManagement::DataInterface>(m_pdmDtc))
|
||||
return false;
|
||||
if (!session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
||||
return false;
|
||||
if (!session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc))
|
||||
return false;
|
||||
if (!session->getForeignGuiInterface(m_esmActorCbx))
|
||||
return false;
|
||||
m_session = session;
|
||||
if (!session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
if (!session->getDtc<ProjectDataManagement::DataInterface>(m_pdmDtc))
|
||||
return false;
|
||||
if (!session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
||||
return false;
|
||||
if (!session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc))
|
||||
return false;
|
||||
if (!session->getForeignGuiInterface(m_esmActorCbx))
|
||||
return false;
|
||||
|
||||
DEBUG_LOG(m_logger) << "EffectShowEdit::init()";
|
||||
m_model = model;
|
||||
DEBUG_LOG(m_logger) << "EffectShowEdit::init()";
|
||||
m_model = model;
|
||||
|
||||
AreaEffectSimulation::AesItem aesItem;
|
||||
bool foundItem = m_aesDtc->aesItemFromId(m_effectShow.idAreaEffectSimulation(), aesItem);
|
||||
DEBUG_LOG(m_logger) << ", found :" << foundItem
|
||||
<< ", idAreaEffectSimulation :" << m_effectShow.idAreaEffectSimulation()
|
||||
<< ", aesItem.id() :" << aesItem.id()
|
||||
<< ", esmParticipantId: " << m_effectShow.esmParticipantId();
|
||||
AreaEffectSimulation::AesItem aesItem;
|
||||
bool foundItem = m_aesDtc->aesItemFromId(m_effectShow.idAreaEffectSimulation(), aesItem);
|
||||
DEBUG_LOG(m_logger) << ", found :" << foundItem
|
||||
<< ", idAreaEffectSimulation :" << m_effectShow.idAreaEffectSimulation()
|
||||
<< ", aesItem.id() :" << aesItem.id()
|
||||
<< ", esmParticipantId: " << m_effectShow.esmParticipantId();
|
||||
|
||||
if (!foundItem)
|
||||
return false;
|
||||
if (!foundItem)
|
||||
return false;
|
||||
|
||||
m_isSmoke = m_pdmDtc->isSmoke(aesItem.chargeStruct().chargeTypeId(),
|
||||
aesItem.chargeStruct().igniterTypeId(),
|
||||
aesItem.chargeStruct().igniterFunctionId());
|
||||
m_isSmoke = m_pdmDtc->isSmoke(aesItem.chargeStruct().chargeTypeId(), aesItem.chargeStruct().igniterTypeId(),
|
||||
aesItem.chargeStruct().igniterFunctionId());
|
||||
|
||||
if (!m_isSmoke)
|
||||
{
|
||||
connect(m_ui->sbVolley, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [this](int val)
|
||||
if (!m_isSmoke)
|
||||
{
|
||||
m_ui->sbShotsInTotal->setMinimum(val);
|
||||
if (m_ui->sbShotsInTotal->value() < val)
|
||||
m_ui->sbShotsInTotal->setValue(val);
|
||||
});
|
||||
connect(m_ui->sbVolley, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [this](int val) {
|
||||
m_ui->sbShotsInTotal->setMinimum(val);
|
||||
if (m_ui->sbShotsInTotal->value() < val)
|
||||
m_ui->sbShotsInTotal->setValue(val);
|
||||
});
|
||||
|
||||
|
||||
m_ui->cbEffectShowActorFilter->addItem(tr("<No filter>"), EffectShowActorModel::eFeature::NotSpecified);
|
||||
m_ui->cbEffectShowActorFilter->addItem(EffectShowActorModel::getFeatureName(EffectShowActorModel::eFeature::SmokeAndExplosion48),
|
||||
EffectShowActorModel::eFeature::SmokeAndExplosion48);
|
||||
m_ui->cbEffectShowActorFilter->addItem(EffectShowActorModel::getFeatureName(EffectShowActorModel::eFeature::Explosion24),
|
||||
EffectShowActorModel::eFeature::Explosion24);
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(1);
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
connect(m_ui->cbEffectShowActorFilter, QOverload<int>::of(&LtsWidgets::LtsComboBox::currentIndexChanged),
|
||||
this, &EffectShowEdit::onEffectShowActorFilterChanged);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->lblEffectShowActorFilter->hide();
|
||||
m_ui->cbEffectShowActorFilter->hide();
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
}
|
||||
m_ui->cbEffectShowActorFilter->addItem(tr("<No filter>"), EffectShowActorModel::eFeature::NotSpecified);
|
||||
m_ui->cbEffectShowActorFilter->addItem(
|
||||
EffectShowActorModel::getFeatureName(EffectShowActorModel::eFeature::SmokeAndExplosion48),
|
||||
EffectShowActorModel::eFeature::SmokeAndExplosion48);
|
||||
m_ui->cbEffectShowActorFilter->addItem(
|
||||
EffectShowActorModel::getFeatureName(EffectShowActorModel::eFeature::Explosion24),
|
||||
EffectShowActorModel::eFeature::Explosion24);
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(1);
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
connect(m_ui->cbEffectShowActorFilter, QOverload<int>::of(&LtsWidgets::LtsComboBox::currentIndexChanged), this,
|
||||
&EffectShowEdit::onEffectShowActorFilterChanged);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->lblEffectShowActorFilter->hide();
|
||||
m_ui->cbEffectShowActorFilter->hide();
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
}
|
||||
|
||||
connect(m_model, &EffectShowModel::effectShowVehicleStatusChanged,
|
||||
this, &EffectShowEdit::onEffectShowVehicleStatusChanged);
|
||||
connect(m_model, &EffectShowModel::effectShowVehicleStatusChanged, this,
|
||||
&EffectShowEdit::onEffectShowVehicleStatusChanged);
|
||||
|
||||
showEffectShow();
|
||||
m_ui->dteFire->setWithNowButton(false);
|
||||
return true;
|
||||
showEffectShow();
|
||||
m_ui->dteFire->setWithNowButton(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowEdit::apply()
|
||||
{
|
||||
|
||||
return m_requestHelper->startSingleRequest([this]()
|
||||
{
|
||||
m_effectShow.esmParticipantId(m_ui->cbEffectShowActor->currentData().toInt());
|
||||
if (!m_isSmoke)
|
||||
{
|
||||
m_effectShow.numOfVolley(m_ui->sbVolley->value());
|
||||
m_effectShow.shotsPerVolley(m_ui->sbShotsInTotal->value());
|
||||
}
|
||||
return m_ftc->effectShowModifyRequest(m_effectShow, this);
|
||||
});
|
||||
}
|
||||
|
||||
return m_requestHelper->startSingleRequest([this]() {
|
||||
m_effectShow.esmParticipantId(m_ui->cbEffectShowActor->currentData().toInt());
|
||||
if (!m_isSmoke)
|
||||
{
|
||||
m_effectShow.numOfVolley(m_ui->sbVolley->value());
|
||||
m_effectShow.shotsPerVolley(m_ui->sbShotsInTotal->value());
|
||||
}
|
||||
return m_ftc->effectShowModifyRequest(m_effectShow, this);
|
||||
});
|
||||
}
|
||||
|
||||
void EffectShowEdit::showEffectShow()
|
||||
{
|
||||
m_ui->leName->setText(QString::fromStdString(m_effectShow.nameAreaEffectSimulation()));
|
||||
|
||||
EffectShowVehicleStatus vehicleStatus;
|
||||
const int equipmentNumber = m_ppmDtc->equipmentNumberByParticipantId(m_effectShow.esmParticipantId());
|
||||
m_model->getVehicleStatus(equipmentNumber, vehicleStatus);
|
||||
const int feature = m_ui->cbEffectShowActorFilter->findData(vehicleStatus.feature().underlying());
|
||||
switch (feature)
|
||||
{
|
||||
case EffectShowManagement::Feature_e::Explosion24:
|
||||
case EffectShowManagement::Feature_e::NotSpecified:
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(feature);
|
||||
break;
|
||||
default:
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(1);
|
||||
break;
|
||||
}
|
||||
m_ui->leName->setText(QString::fromStdString(m_effectShow.nameAreaEffectSimulation()));
|
||||
|
||||
if (m_effectShow.esmParticipantId() > 0)
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(m_ui->cbEffectShowActor->findData(m_effectShow.esmParticipantId()));
|
||||
EffectShowVehicleStatus vehicleStatus;
|
||||
const int equipmentNumber = m_ppmDtc->equipmentNumberByParticipantId(m_effectShow.esmParticipantId());
|
||||
m_model->getVehicleStatus(equipmentNumber, vehicleStatus);
|
||||
const int feature = m_ui->cbEffectShowActorFilter->findData(vehicleStatus.feature().underlying());
|
||||
switch (feature)
|
||||
{
|
||||
case EffectShowManagement::Feature_e::Explosion24:
|
||||
case EffectShowManagement::Feature_e::NotSpecified:
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(feature);
|
||||
break;
|
||||
default:
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_isSmoke)
|
||||
{
|
||||
m_ui->sbVolley->hide();
|
||||
m_ui->lblVolley->hide();
|
||||
m_ui->sbShotsInTotal->hide();
|
||||
m_ui->lblShots->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->lblVolley->setText(tr("Volley:"));
|
||||
m_ui->lblShots->setText(tr("Shots in Total:"));
|
||||
m_ui->sbVolley->setValue(m_effectShow.numOfVolley());
|
||||
m_ui->sbShotsInTotal->setValue(m_effectShow.shotsPerVolley());
|
||||
}
|
||||
m_ui->dteFire->setMsecsSinceEpoch(m_effectShow.startTime().is_set() ? m_effectShow.startTime().get() : 0);
|
||||
m_ui->leRemainingAmmunition->setText(m_model->getParticipantAmmunition(m_effectShow.esmParticipantId()));
|
||||
if (m_effectShow.esmParticipantId() > 0)
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(m_ui->cbEffectShowActor->findData(m_effectShow.esmParticipantId()));
|
||||
|
||||
connect(m_ui->cbEffectShowActor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this]()
|
||||
{
|
||||
m_ui->leRemainingAmmunition->setText(m_model->getParticipantAmmunition(m_ui->cbEffectShowActor->currentData().toInt()));
|
||||
});
|
||||
if (m_isSmoke)
|
||||
{
|
||||
m_ui->sbVolley->hide();
|
||||
m_ui->lblVolley->hide();
|
||||
m_ui->sbShotsInTotal->hide();
|
||||
m_ui->lblShots->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->lblVolley->setText(tr("Volley:"));
|
||||
m_ui->lblShots->setText(tr("Shots in Total:"));
|
||||
m_ui->sbVolley->setValue(m_effectShow.numOfVolley());
|
||||
m_ui->sbShotsInTotal->setValue(m_effectShow.shotsPerVolley());
|
||||
}
|
||||
m_ui->dteFire->setMsecsSinceEpoch(m_effectShow.startTime().is_set() ? m_effectShow.startTime().get() : 0);
|
||||
m_ui->leRemainingAmmunition->setText(m_model->getParticipantAmmunition(m_effectShow.esmParticipantId()));
|
||||
|
||||
connect(m_ui->cbEffectShowActor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
[this]() {
|
||||
m_ui->leRemainingAmmunition->setText(
|
||||
m_model->getParticipantAmmunition(m_ui->cbEffectShowActor->currentData().toInt()));
|
||||
});
|
||||
}
|
||||
|
||||
void EffectShowEdit::updateActorComboBox(const Core::GeoPosition &coordGeo)
|
||||
void EffectShowEdit::updateActorComboBox(const Core::GeoPosition& coordGeo)
|
||||
{
|
||||
|
||||
bool ok;
|
||||
bool ok;
|
||||
|
||||
int esmParticipantId = m_ui->cbEffectShowActor->currentData().toInt(&ok);
|
||||
DEBUG_LOG(m_logger) << "currentIndex: " << m_ui->cbEffectShowActor->currentIndex()
|
||||
<< ", currentText: " << m_ui->cbEffectShowActor->currentText()
|
||||
<< ", esmParticipantId: " << esmParticipantId
|
||||
<< ", ok: " << ok;
|
||||
int featureFilter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
m_esmActorCbx->fillActorComboBox(m_ui->cbEffectShowActor, coordGeo, m_isSmoke, featureFilter);
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(m_ui->cbEffectShowActor->findData(esmParticipantId));
|
||||
int esmParticipantId = m_ui->cbEffectShowActor->currentData().toInt(&ok);
|
||||
DEBUG_LOG(m_logger) << "currentIndex: " << m_ui->cbEffectShowActor->currentIndex()
|
||||
<< ", currentText: " << m_ui->cbEffectShowActor->currentText()
|
||||
<< ", esmParticipantId: " << esmParticipantId << ", ok: " << ok;
|
||||
int featureFilter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
m_esmActorCbx->fillActorComboBox(m_ui->cbEffectShowActor, coordGeo, m_isSmoke, featureFilter);
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(m_ui->cbEffectShowActor->findData(esmParticipantId));
|
||||
}
|
||||
|
||||
void EffectShowEdit::onEffectShowActorFilterChanged(const int &idx)
|
||||
void EffectShowEdit::onEffectShowActorFilterChanged(const int& idx)
|
||||
{
|
||||
Q_UNUSED(idx);
|
||||
Q_UNUSED(idx);
|
||||
|
||||
const Core::GeoPosition coordGeo(m_effectShow.position().lon(), m_effectShow.position().lat(), 0);
|
||||
updateActorComboBox(coordGeo);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const Core::GeoPosition coordGeo(m_effectShow.position().lon(), m_effectShow.position().lat(), 0);
|
||||
updateActorComboBox(coordGeo);
|
||||
}
|
||||
|
||||
void EffectShowEdit::onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus &data, const DataModification &modType)
|
||||
void EffectShowEdit::onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus& data,
|
||||
const DataModification& modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
int equipmentNumber = m_ppmDtc->equipmentNumberByParticipantId(data.esmParticipantId());
|
||||
const int filter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
if (m_model->getEffectShowActorModel()->isMatchedByFilter(equipmentNumber, filter))
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
Q_UNUSED(modType);
|
||||
int equipmentNumber = m_ppmDtc->equipmentNumberByParticipantId(data.esmParticipantId());
|
||||
const int filter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
if (m_model->getEffectShowActorModel()->isMatchedByFilter(equipmentNumber, filter))
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+41
-42
@@ -1,24 +1,21 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
#include "esm_effect_show_model.h"
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/EffectShowManagement/esm_gui_combobox_plugin_interface.h>
|
||||
|
||||
#include <Services/EffectShowManagement/esm_dtc.h>
|
||||
#include <Services/EffectShowManagement/esm_ftc.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/EffectShowManagement/esm_gui_combobox_plugin_interface.h>
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
#include <QPair>
|
||||
#include <QVector>
|
||||
#include <Services/EffectShowManagement/esm_dtc.h>
|
||||
#include <Services/EffectShowManagement/esm_ftc.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -28,46 +25,48 @@ class EffectShowEdit;
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
|
||||
class EffectShowEdit : public LtsWidgets::LtsDialog,
|
||||
protected EffectShowManagement::Interface::Ftc::EffectShowModifyReplyHandler
|
||||
protected EffectShowManagement::Interface::Ftc::EffectShowModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectShowEdit(const EffectShow &effectShow, QWidget *parent = nullptr);
|
||||
~EffectShowEdit();
|
||||
public:
|
||||
explicit EffectShowEdit(const EffectShow& effectShow, QWidget* parent = nullptr);
|
||||
~EffectShowEdit();
|
||||
|
||||
bool init(LtsSession::LtsSession *session,
|
||||
EffectShowModel *model);
|
||||
bool apply() override;
|
||||
bool init(LtsSession::LtsSession* session, EffectShowModel* model);
|
||||
bool apply() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void retranslate() override;
|
||||
void showEffectShow();
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
void showEffectShow();
|
||||
void onEffectShowModifyReply(const Core::FunctionReplyObject &replyObject) override { m_requestHelper->requestReply(replyObject); }
|
||||
void updateActorComboBox(const Core::GeoPosition &coordGeo);
|
||||
void onEffectShowModifyReply(const Core::FunctionReplyObject& replyObject) override
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
private slots:
|
||||
void onEffectShowActorFilterChanged(const int &idx);
|
||||
void onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus &data, const DataModification &modType);
|
||||
void updateActorComboBox(const Core::GeoPosition& coordGeo);
|
||||
|
||||
private:
|
||||
LtsSession::LtsSession *m_session;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<EffectShowManagement::ForeignGuiComboboxInterface> m_esmActorCbx;
|
||||
private slots:
|
||||
void onEffectShowActorFilterChanged(const int& idx);
|
||||
void onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus& data, const DataModification& modType);
|
||||
|
||||
EffectShowModel *m_model;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
EffectShow m_effectShow;
|
||||
bool m_isSmoke{false};
|
||||
private:
|
||||
LtsSession::LtsSession* m_session;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<EffectShowManagement::ForeignGuiComboboxInterface> m_esmActorCbx;
|
||||
|
||||
Ui::EffectShowEdit *m_ui;
|
||||
EffectShowModel* m_model;
|
||||
LtsUtils::RequestHelper* m_requestHelper;
|
||||
EffectShow m_effectShow;
|
||||
bool m_isSmoke{false};
|
||||
|
||||
Ui::EffectShowEdit* m_ui;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+80
-106
@@ -1,169 +1,143 @@
|
||||
|
||||
|
||||
|
||||
#include "esm_effect_show_list.h"
|
||||
#include "ui_esm_effect_show_list.h"
|
||||
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include "esm_effect_show_edit.h"
|
||||
#include "esm_effect_show_model.h"
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
#include "ui_esm_effect_show_list.h"
|
||||
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
EffectShowList::EffectShowList(const QString &menuGroup, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_model(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_session(nullptr)
|
||||
, m_ui(new Ui::EffectShowList)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
EffectShowList::EffectShowList(const QString& menuGroup, QWidget* parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly), m_menuGroup(menuGroup), m_model(nullptr),
|
||||
m_ftc(nullptr), m_session(nullptr), m_ui(new Ui::EffectShowList),
|
||||
m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
QCheckBox* cbExpired = new QCheckBox(tr("Show expired"), m_ui->widget);
|
||||
cbExpired->setProperty("const", true);
|
||||
m_ui->widget->setCustomWidget(cbExpired);
|
||||
connect(cbExpired, &QCheckBox::toggled, this, &EffectShowList::setShowExpired);
|
||||
|
||||
|
||||
QCheckBox *cbExpired = new QCheckBox(tr("Show expired"), m_ui->widget);
|
||||
cbExpired->setProperty("const", true);
|
||||
m_ui->widget->setCustomWidget(cbExpired);
|
||||
connect(cbExpired, &QCheckBox::toggled, this, &EffectShowList::setShowExpired);
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged, this, &EffectShowList::onSelectionChanged);
|
||||
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &EffectShowList::onSelectionChanged);
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked, this, &EffectShowList::onEditEffectShow);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked,
|
||||
this, &EffectShowList::onEditEffectShow);
|
||||
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &EffectShowList::onEditEffectShow);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &EffectShowList::onRemoveEffectShow);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &EffectShowList::onPrint);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Effect_Shows"));
|
||||
|
||||
}
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &EffectShowList::onEditEffectShow);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &EffectShowList::onRemoveEffectShow);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &EffectShowList::onPrint);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Effect_Shows"));
|
||||
}
|
||||
|
||||
EffectShowList::~EffectShowList()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void EffectShowList::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Effect Representations"));
|
||||
translate(m_ui, tr("Effect Representations"));
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowList::init(LtsSession::LtsSession *session)
|
||||
bool EffectShowList::init(LtsSession::LtsSession* session)
|
||||
{
|
||||
if (!session)
|
||||
return false;
|
||||
if (!session)
|
||||
return false;
|
||||
|
||||
m_session = session;
|
||||
if (!m_session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
m_session = session;
|
||||
if (!m_session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
|
||||
m_model = new EffectShowModel(this);
|
||||
m_model->initModel(session);
|
||||
m_model = new EffectShowModel(this);
|
||||
m_model->initModel(session);
|
||||
|
||||
m_proxyModel = new EffectShowProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
m_ui->widget->setModel(m_proxyModel);
|
||||
m_proxyModel = new EffectShowProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
m_ui->widget->setModel(m_proxyModel);
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->widget->hideColumn(EffectShowModel::Columns::Id);
|
||||
m_ui->widget->hideColumn(EffectShowModel::Columns::Id);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EffectShowList::onSelectionChanged()
|
||||
{
|
||||
int rowCount = m_ui->widget->selectedRows().size();
|
||||
|
||||
bool enaEdit = false;
|
||||
if (rowCount > 0)
|
||||
{
|
||||
int row = m_ui->widget->currentIndex().row();
|
||||
EffectShowManagement::EffectShow effectShow = m_model->getRowData(row);
|
||||
enaEdit = effectShow.orderConfirmation() != OrderConfirmation_e::OrderCarriedOut &&
|
||||
effectShow.orderConfirmation() != OrderConfirmation_e::Execution;
|
||||
}
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, enaEdit);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, rowCount);
|
||||
|
||||
|
||||
}
|
||||
int rowCount = m_ui->widget->selectedRows().size();
|
||||
|
||||
bool enaEdit = false;
|
||||
if (rowCount > 0)
|
||||
{
|
||||
int row = m_ui->widget->currentIndex().row();
|
||||
EffectShowManagement::EffectShow effectShow = m_model->getRowData(row);
|
||||
enaEdit = effectShow.orderConfirmation() != OrderConfirmation_e::OrderCarriedOut &&
|
||||
effectShow.orderConfirmation() != OrderConfirmation_e::Execution;
|
||||
}
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, enaEdit);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, rowCount);
|
||||
}
|
||||
|
||||
void EffectShowList::onEditEffectShow()
|
||||
{
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
|
||||
int row = idx.row();
|
||||
if (row < 0)
|
||||
return;
|
||||
int row = idx.row();
|
||||
if (row < 0)
|
||||
return;
|
||||
|
||||
EffectShowManagement::EffectShow effectShow = m_model->getRowData(row);
|
||||
EffectShowManagement::EffectShow effectShow = m_model->getRowData(row);
|
||||
|
||||
DEBUG_LOG(m_logger) << "--- onEffectShow() "
|
||||
<< " id: " << effectShow.id()
|
||||
<< " position: " << effectShow.position();
|
||||
|
||||
|
||||
EffectShowEdit *dialog = new EffectShowEdit(effectShow, this);
|
||||
dialog->init(m_session, m_model);
|
||||
addDialog(dialog, m_menuGroup, QLatin1String("esmEffectShow") + QString::number(effectShow.id()), LtsWidgets::LayoutArea::eDialogTab);
|
||||
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "--- onEffectShow() "
|
||||
<< " id: " << effectShow.id() << " position: " << effectShow.position();
|
||||
|
||||
EffectShowEdit* dialog = new EffectShowEdit(effectShow, this);
|
||||
dialog->init(m_session, m_model);
|
||||
addDialog(dialog, m_menuGroup, QLatin1String("esmEffectShow") + QString::number(effectShow.id()),
|
||||
LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
|
||||
void EffectShowList::onRemoveEffectShow()
|
||||
{
|
||||
const QModelIndexList idxList = m_ui->widget->selectedRows();
|
||||
const QModelIndexList idxList = m_ui->widget->selectedRows();
|
||||
|
||||
if (idxList.isEmpty())
|
||||
return;
|
||||
int row = idxList.first().row();
|
||||
if (idxList.isEmpty())
|
||||
return;
|
||||
int row = idxList.first().row();
|
||||
|
||||
EffectShowManagement::EffectShow es = m_model->getRowData(row);
|
||||
|
||||
|
||||
|
||||
m_requestHelper->startSingleRequest([es, this]()
|
||||
{
|
||||
const Core::RemoveElementRequest req(es.id());
|
||||
return m_ftc->effectShowRemoveRequest(req, this);
|
||||
});
|
||||
}
|
||||
EffectShowManagement::EffectShow es = m_model->getRowData(row);
|
||||
|
||||
m_requestHelper->startSingleRequest([es, this]() {
|
||||
const Core::RemoveElementRequest req(es.id());
|
||||
return m_ftc->effectShowRemoveRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
void EffectShowList::setShowExpired(bool show)
|
||||
{
|
||||
m_proxyModel->setShowExpired(show);
|
||||
m_proxyModel->setShowExpired(show);
|
||||
}
|
||||
|
||||
void EffectShowList::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
|
||||
}
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
|
||||
}
|
||||
|
||||
void EffectShowList::tableColumnOrganiserSetting()
|
||||
{
|
||||
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+38
-41
@@ -1,24 +1,22 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
#include <Services/EffectShowManagement/esm_dtc.h>
|
||||
#include <Services/EffectShowManagement/esm_ftc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EffectShowList;
|
||||
}
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
class EffectShowModel;
|
||||
@@ -26,43 +24,42 @@ class EffectShowProxyModel;
|
||||
class EffectShowActorModel;
|
||||
class EffectShowActorRelocationModel;
|
||||
|
||||
|
||||
class EffectShowList : public LtsWidgets::LtsDialog
|
||||
, protected EffectShowManagement::Interface::Ftc::EffectShowRemoveReplyHandler
|
||||
class EffectShowList : public LtsWidgets::LtsDialog,
|
||||
protected EffectShowManagement::Interface::Ftc::EffectShowRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectShowList(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~EffectShowList();
|
||||
bool init(LtsSession::LtsSession *session);
|
||||
public:
|
||||
explicit EffectShowList(const QString& menuGroup, QWidget* parent = nullptr);
|
||||
~EffectShowList();
|
||||
bool init(LtsSession::LtsSession* session);
|
||||
|
||||
private slots:
|
||||
void setShowExpired(bool show);
|
||||
private slots:
|
||||
void setShowExpired(bool show);
|
||||
|
||||
private:
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void retranslate() override;
|
||||
void onSelectionChanged();
|
||||
void onEditEffectShow();
|
||||
void onRemoveEffectShow();
|
||||
void onPrint();
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
void onSelectionChanged();
|
||||
void onEditEffectShow();
|
||||
void onRemoveEffectShow();
|
||||
void onPrint();
|
||||
void tableColumnOrganiserSetting() override;
|
||||
void onEffectShowRemoveReply(const Core::FunctionReplyObject& reply) override
|
||||
{
|
||||
m_requestHelper->requestReply(reply);
|
||||
}
|
||||
|
||||
void onEffectShowRemoveReply(const Core::FunctionReplyObject &reply) override
|
||||
{
|
||||
m_requestHelper->requestReply(reply);
|
||||
}
|
||||
private:
|
||||
QString m_menuGroup;
|
||||
EffectShowModel *m_model;
|
||||
EffectShowProxyModel *m_proxyModel;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
LtsSession::LtsSession *m_session;
|
||||
Ui::EffectShowList *m_ui;
|
||||
private:
|
||||
QString m_menuGroup;
|
||||
EffectShowModel* m_model;
|
||||
EffectShowProxyModel* m_proxyModel;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
LtsSession::LtsSession* m_session;
|
||||
Ui::EffectShowList* m_ui;
|
||||
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
LtsUtils::RequestHelper* m_requestHelper;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+350
-378
@@ -1,515 +1,487 @@
|
||||
|
||||
|
||||
|
||||
#include "esm_effect_show_model.h"
|
||||
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include "esm_effect_show_actor_relocation_model.h"
|
||||
#include <EffectShowManagement/esm_translation.h>
|
||||
#include <AreaEffectSimulation/aes_translation.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_translation.h>
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
#include <EffectShowManagement/esm_translation.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
|
||||
|
||||
EffectShowModel::EffectShowModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<EffectShowManagement::EffectShow>(
|
||||
EffectShowModel::EffectShowModel(QObject* parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<EffectShowManagement::EffectShow>(
|
||||
{tr("Name AES"), tr("Id"), tr("Fire"), tr("Duration"), tr("Position"), tr("AesStatus"), tr("Actor"),
|
||||
tr("Volley"), tr("Shots in total"), tr("Dimension [m]"), tr("Rotation"), tr("Status"), tr("Answer")},
|
||||
parent),
|
||||
m_dtc(nullptr), m_effectShowActorProxyModel(nullptr), m_effectShowActorModel(nullptr),
|
||||
m_effectShowActorRelocationModel(nullptr)
|
||||
{
|
||||
tr("Name AES"),
|
||||
tr("Id"),
|
||||
tr("Fire"),
|
||||
tr("Duration"),
|
||||
tr("Position"),
|
||||
tr("AesStatus"),
|
||||
tr("Actor"),
|
||||
tr("Volley"),
|
||||
tr("Shots in total"),
|
||||
tr("Dimension [m]"),
|
||||
tr("Rotation"),
|
||||
tr("Status"),
|
||||
tr("Answer")
|
||||
},
|
||||
parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_effectShowActorProxyModel(nullptr)
|
||||
, m_effectShowActorModel(nullptr)
|
||||
, m_effectShowActorRelocationModel(nullptr)
|
||||
{}
|
||||
}
|
||||
|
||||
EffectShowModel::~EffectShowModel()
|
||||
{
|
||||
delete m_effectShowActorProxyModel;
|
||||
delete m_effectShowActorModel;
|
||||
delete m_effectShowActorRelocationModel;
|
||||
delete m_effectShowActorProxyModel;
|
||||
delete m_effectShowActorModel;
|
||||
delete m_effectShowActorRelocationModel;
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowModel::initModel(LtsSession::LtsSession *session)
|
||||
bool EffectShowModel::initModel(LtsSession::LtsSession* session)
|
||||
{
|
||||
if (!session->getDtc<EffectShowManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!session->getDtc<ParticipantManagement::DataInterface>(m_dtcPpm))
|
||||
return false;
|
||||
if (!session->getDtc<AreaEffectSimulation::DataInterface>(m_dtcAes))
|
||||
return false;
|
||||
if (!session->getDtc<EffectShowManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!session->getDtc<ParticipantManagement::DataInterface>(m_dtcPpm))
|
||||
return false;
|
||||
if (!session->getDtc<AreaEffectSimulation::DataInterface>(m_dtcAes))
|
||||
return false;
|
||||
|
||||
connect(m_dtc.get(), &EffectShowManagement::Interface::Dtc::effectShowChanged,
|
||||
this, &EffectShowModel::onDataChanged);
|
||||
connect(m_dtc.get(), &EffectShowManagement::Interface::Dtc::effectShowVehicleStatusChanged,
|
||||
this, &EffectShowModel::onEffectShowVehicleStatusChanged);
|
||||
connect(m_dtc.get(), &EffectShowManagement::Interface::Dtc::effectShowChanged, this,
|
||||
&EffectShowModel::onDataChanged);
|
||||
connect(m_dtc.get(), &EffectShowManagement::Interface::Dtc::effectShowVehicleStatusChanged, this,
|
||||
&EffectShowModel::onEffectShowVehicleStatusChanged);
|
||||
|
||||
m_dtc->effectShows([this](const EffectShowManagement::EffectShow& effectShow) { insertRow(effectShow); });
|
||||
m_effectShowVehicleStatus = m_dtc->effectShowVehicleStatuss();
|
||||
|
||||
|
||||
m_dtc->effectShows([this](const EffectShowManagement::EffectShow & effectShow) { insertRow(effectShow); });
|
||||
m_effectShowVehicleStatus = m_dtc->effectShowVehicleStatuss();
|
||||
m_effectShowActorModel = new EffectShowActorModel(this, this);
|
||||
m_effectShowActorProxyModel = new EffectShowActorProxyModel(m_effectShowActorModel, this, this);
|
||||
m_effectShowActorModel->initModel(session);
|
||||
|
||||
m_effectShowActorModel = new EffectShowActorModel(this, this);
|
||||
m_effectShowActorProxyModel = new EffectShowActorProxyModel(m_effectShowActorModel, this, this);
|
||||
m_effectShowActorModel->initModel(session);
|
||||
m_effectShowActorRelocationModel = new EffectShowActorRelocationModel(this, this);
|
||||
m_effectShowActorRelocationModel->initModel(m_dtc);
|
||||
|
||||
m_effectShowActorRelocationModel = new EffectShowActorRelocationModel(this, this);
|
||||
m_effectShowActorRelocationModel->initModel(m_dtc);
|
||||
m_dtc->effectShowVehicleStatuss([this](const EffectShowManagement::EffectShowVehicleStatus& item) {
|
||||
onEffectShowVehicleStatusChanged(item, DataModification::eAdded);
|
||||
});
|
||||
|
||||
m_dtc->effectShowVehicleStatuss([this](const EffectShowManagement::EffectShowVehicleStatus &item) { onEffectShowVehicleStatusChanged(item, DataModification::eAdded);});
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant EffectShowModel::data(const QModelIndex &index, int role) const
|
||||
QVariant EffectShowModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const EffectShowManagement::EffectShow& effectShow = m_vecData.at(index.row());
|
||||
AreaEffectSimulation::AesItem aesItem;
|
||||
m_dtcAes->aesItemFromId(effectShow.idAreaEffectSimulation(), aesItem);
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return effectShow.id();
|
||||
case Name_AES:
|
||||
return QString::fromStdString(effectShow.nameAreaEffectSimulation());
|
||||
case Duration:
|
||||
return LtsWidgets::readableDuration(effectShow.duration());
|
||||
;
|
||||
case StartTime:
|
||||
return effectShow.startTime().is_set() ? DTG::toStringMSec(effectShow.startTime().get())
|
||||
: QStringLiteral("---");
|
||||
case Position: {
|
||||
const Core::GeoPosition2D& pos = effectShow.position();
|
||||
return LtsCoordTrans::mgrsFromGeographic(pos.lon(), pos.lat());
|
||||
}
|
||||
case EffectShowActor: {
|
||||
int id = effectShow.esmParticipantId();
|
||||
return (id > 0) ? getParticipantName(id) : QStringLiteral("---");
|
||||
}
|
||||
case Volley: {
|
||||
if (effectShow.typeOfAmmunition() == 5)
|
||||
return QStringLiteral("--");
|
||||
else
|
||||
return effectShow.numOfVolley();
|
||||
}
|
||||
case ShotsInTotal: {
|
||||
if (effectShow.typeOfAmmunition() == 5)
|
||||
return QStringLiteral("--");
|
||||
else
|
||||
return effectShow.shotsPerVolley();
|
||||
}
|
||||
case Size:
|
||||
return tr("%1 x %2").arg(QString::number(effectShow.areaWidth()), QString::number(effectShow.areaDepth()));
|
||||
case Rotation:
|
||||
return effectShow.areaRotation();
|
||||
case Status:
|
||||
return EffectShowManagement::toString(effectShow.orderConfirmation());
|
||||
case Answer:
|
||||
return QString::fromStdString(effectShow.answerText());
|
||||
case AesStatus:
|
||||
return AreaEffectSimulation::toString(aesItem.effectStateId());
|
||||
}
|
||||
return QVariant();
|
||||
|
||||
const EffectShowManagement::EffectShow &effectShow = m_vecData.at(index.row());
|
||||
AreaEffectSimulation::AesItem aesItem;
|
||||
m_dtcAes->aesItemFromId(effectShow.idAreaEffectSimulation(), aesItem);
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return effectShow.id();
|
||||
case Name_AES:
|
||||
return QString::fromStdString(effectShow.nameAreaEffectSimulation());
|
||||
case Duration:
|
||||
return LtsWidgets::readableDuration(effectShow.duration());;
|
||||
case StartTime:
|
||||
return effectShow.startTime().is_set() ? DTG::toStringMSec(effectShow.startTime().get()) : QStringLiteral("---");
|
||||
case Position:
|
||||
{
|
||||
const Core::GeoPosition2D &pos = effectShow.position();
|
||||
return LtsCoordTrans::mgrsFromGeographic(pos.lon(), pos.lat());
|
||||
}
|
||||
case EffectShowActor:
|
||||
{
|
||||
int id = effectShow.esmParticipantId();
|
||||
return (id > 0) ? getParticipantName(id) : QStringLiteral("---");
|
||||
}
|
||||
case Volley:
|
||||
{
|
||||
if (effectShow.typeOfAmmunition() == 5)
|
||||
return QStringLiteral("--");
|
||||
else
|
||||
return effectShow.numOfVolley();
|
||||
}
|
||||
case ShotsInTotal:
|
||||
{
|
||||
if (effectShow.typeOfAmmunition() == 5)
|
||||
return QStringLiteral("--");
|
||||
else
|
||||
return effectShow.shotsPerVolley();
|
||||
}
|
||||
case Size:
|
||||
return tr("%1 x %2").arg(QString::number(effectShow.areaWidth()), QString::number(effectShow.areaDepth()));
|
||||
case Rotation:
|
||||
return effectShow.areaRotation();
|
||||
case Status:
|
||||
return EffectShowManagement::toString(effectShow.orderConfirmation());
|
||||
case Answer:
|
||||
return QString::fromStdString(effectShow.answerText());
|
||||
case AesStatus:
|
||||
return AreaEffectSimulation::toString(aesItem.effectStateId());
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QMap<int, QString> EffectShowModel::getParticipantList() const
|
||||
{
|
||||
QMap<int, QString> ret;
|
||||
int numRow = m_effectShowActorProxyModel->rowCount(QModelIndex());
|
||||
QMap<int, QString> ret;
|
||||
int numRow = m_effectShowActorProxyModel->rowCount(QModelIndex());
|
||||
|
||||
for (int i = 0; i < numRow; ++i)
|
||||
{
|
||||
const ParticipantManagement::Participant part = m_effectShowActorModel->getRowData(m_effectShowActorProxyModel->mapToSource(m_effectShowActorProxyModel->index(i, 0)).row());
|
||||
if (hasVehicleReportedOperationalToday(part.equipmentNumber().get()))
|
||||
ret.insert(part.id(), getParticipantName(part.id()));
|
||||
}
|
||||
return ret;
|
||||
for (int i = 0; i < numRow; ++i)
|
||||
{
|
||||
const ParticipantManagement::Participant part = m_effectShowActorModel->getRowData(
|
||||
m_effectShowActorProxyModel->mapToSource(m_effectShowActorProxyModel->index(i, 0)).row());
|
||||
if (hasVehicleReportedOperationalToday(part.equipmentNumber().get()))
|
||||
ret.insert(part.id(), getParticipantName(part.id()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QMap<int, QString> EffectShowModel::getParticipantList(bool is_smoke) const
|
||||
{
|
||||
QMap<int, QString> ret;
|
||||
int numRow = m_effectShowActorProxyModel->rowCount(QModelIndex());
|
||||
QMap<int, QString> ret;
|
||||
int numRow = m_effectShowActorProxyModel->rowCount(QModelIndex());
|
||||
|
||||
for (int i = 0; i < numRow; ++i)
|
||||
{
|
||||
int realRow = m_effectShowActorProxyModel->mapToSource(m_effectShowActorProxyModel->index(i, 0)).row();
|
||||
const ParticipantManagement::Participant part = m_effectShowActorModel->getRowData(realRow);
|
||||
for (int i = 0; i < numRow; ++i)
|
||||
{
|
||||
int realRow = m_effectShowActorProxyModel->mapToSource(m_effectShowActorProxyModel->index(i, 0)).row();
|
||||
const ParticipantManagement::Participant part = m_effectShowActorModel->getRowData(realRow);
|
||||
|
||||
if (!hasVehicleReportedOperationalToday(part.equipmentNumber().get()))
|
||||
continue;
|
||||
if (!hasVehicleReportedOperationalToday(part.equipmentNumber().get()))
|
||||
continue;
|
||||
|
||||
EffectShowManagement::Feature_e feature = m_effectShowActorModel->getFeature(realRow);
|
||||
if (feature != EffectShowManagement::Feature_e_def::NotSpecified &&
|
||||
(
|
||||
(feature == EffectShowManagement::Feature_e_def::Smoke && is_smoke) ||
|
||||
(feature != EffectShowManagement::Feature_e_def::Smoke && !is_smoke)
|
||||
)
|
||||
)
|
||||
ret.insert(part.id(), getParticipantName(part.id()));
|
||||
}
|
||||
return ret;
|
||||
EffectShowManagement::Feature_e feature = m_effectShowActorModel->getFeature(realRow);
|
||||
if (feature != EffectShowManagement::Feature_e_def::NotSpecified &&
|
||||
((feature == EffectShowManagement::Feature_e_def::Smoke && is_smoke) ||
|
||||
(feature != EffectShowManagement::Feature_e_def::Smoke && !is_smoke)))
|
||||
ret.insert(part.id(), getParticipantName(part.id()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QVector<QPair<int, QString>> EffectShowModel::getParticipantListByDistance(bool is_smoke, const Core::GeoPosition2D &origin)
|
||||
QVector<QPair<int, QString>> EffectShowModel::getParticipantListByDistance(bool is_smoke,
|
||||
const Core::GeoPosition2D& origin)
|
||||
{
|
||||
QVector<QPair<int, QString>> ret;
|
||||
QVector<QPair<int, QString>> ret;
|
||||
|
||||
|
||||
QMap<int, QString> participantList = getParticipantList(is_smoke);
|
||||
|
||||
ret.reserve(participantList.size());
|
||||
QMap<int, QString> participantList = getParticipantList(is_smoke);
|
||||
|
||||
QMap<double, int> distanceMapSorted;
|
||||
for (const auto partId : participantList.keys())
|
||||
{
|
||||
ret.reserve(participantList.size());
|
||||
|
||||
int eqNr = m_dtcPpm->equipmentNumberByParticipantId(partId);
|
||||
if (eqNr <= 0)
|
||||
continue;
|
||||
EffectShowManagement::EffectShowVehicleStatus vehicleStatus;
|
||||
bool isVehicleStatus = getVehicleStatus(eqNr, vehicleStatus);
|
||||
if (!isVehicleStatus)
|
||||
continue;
|
||||
const ParticipantManagement::ParticipantPosition &pos = m_dtcPpm->participantPosition(partId);
|
||||
|
||||
|
||||
LtsCoordTrans::UtmCoordinate pPos = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.pos().lon(), pos.pos().lat());
|
||||
LtsCoordTrans::UtmCoordinate pOrigin = LtsCoordTrans::UtmCoordinate::fromGeographic(origin.lon(), origin.lat());
|
||||
|
||||
double distance = LtsCoordTrans::distance(pPos, pOrigin);
|
||||
|
||||
|
||||
|
||||
distanceMapSorted.insert(distance, partId);
|
||||
|
||||
|
||||
QString currentAssigendEffectShows;
|
||||
for (const auto &dat : m_vecData)
|
||||
QMap<double, int> distanceMapSorted;
|
||||
for (const auto partId : participantList.keys())
|
||||
{
|
||||
if (dat.esmParticipantId() == partId)
|
||||
{
|
||||
|
||||
int eqNr = m_dtcPpm->equipmentNumberByParticipantId(partId);
|
||||
if (eqNr <= 0)
|
||||
continue;
|
||||
EffectShowManagement::EffectShowVehicleStatus vehicleStatus;
|
||||
bool isVehicleStatus = getVehicleStatus(eqNr, vehicleStatus);
|
||||
if (!isVehicleStatus)
|
||||
continue;
|
||||
const ParticipantManagement::ParticipantPosition& pos = m_dtcPpm->participantPosition(partId);
|
||||
|
||||
LtsCoordTrans::UtmCoordinate pPos =
|
||||
LtsCoordTrans::UtmCoordinate::fromGeographic(pos.pos().lon(), pos.pos().lat());
|
||||
LtsCoordTrans::UtmCoordinate pOrigin = LtsCoordTrans::UtmCoordinate::fromGeographic(origin.lon(), origin.lat());
|
||||
|
||||
double distance = LtsCoordTrans::distance(pPos, pOrigin);
|
||||
|
||||
distanceMapSorted.insert(distance, partId);
|
||||
|
||||
QString currentAssigendEffectShows;
|
||||
for (const auto& dat : m_vecData)
|
||||
{
|
||||
if (dat.esmParticipantId() == partId)
|
||||
{
|
||||
if (!currentAssigendEffectShows.isEmpty())
|
||||
currentAssigendEffectShows.append(QStringLiteral(", "));
|
||||
currentAssigendEffectShows.append(QString::fromStdString(dat.nameAreaEffectSimulation()));
|
||||
}
|
||||
}
|
||||
|
||||
QString newString = participantList.value(partId);
|
||||
newString.append(QStringLiteral(" "));
|
||||
newString.append(
|
||||
tr("Mag: %1 | Avail: %2").arg(vehicleStatus.ammunitionMagazine()).arg(vehicleStatus.ammunitionAvailable()));
|
||||
newString.append(tr(" | Dist: %1[m]").arg(QString::number(int(distance))));
|
||||
if (!currentAssigendEffectShows.isEmpty())
|
||||
currentAssigendEffectShows.append(QStringLiteral(", "));
|
||||
currentAssigendEffectShows.append(QString::fromStdString(dat.nameAreaEffectSimulation()));
|
||||
}
|
||||
newString.append(tr(" | Assigned: %1").arg(currentAssigendEffectShows));
|
||||
|
||||
participantList.insert(partId, newString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString newString = participantList.value(partId);
|
||||
newString.append(QStringLiteral(" "));
|
||||
newString.append(tr("Mag: %1 | Avail: %2").arg(vehicleStatus.ammunitionMagazine()).arg(vehicleStatus.ammunitionAvailable()));
|
||||
newString.append(tr(" | Dist: %1[m]").arg(QString::number(int(distance))));
|
||||
if (!currentAssigendEffectShows.isEmpty())
|
||||
newString.append(tr(" | Assigned: %1").arg(currentAssigendEffectShows));
|
||||
|
||||
participantList.insert(partId, newString);
|
||||
}
|
||||
QMapIterator<double, int> it(distanceMapSorted);
|
||||
while (it.hasNext())
|
||||
{
|
||||
it.next();
|
||||
ret.append(QPair<int, QString>(it.value(), participantList.value(it.value())));
|
||||
}
|
||||
|
||||
QMapIterator<double, int> it(distanceMapSorted);
|
||||
while(it.hasNext())
|
||||
{
|
||||
it.next();
|
||||
ret.append(QPair<int, QString>(it.value(), participantList.value(it.value())));
|
||||
}
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString EffectShowModel::getParticipantName(int id) const
|
||||
{
|
||||
auto it = m_effectShowActorModel->getIt(id);
|
||||
if (it == m_effectShowActorModel->getItEnd()) return QString();
|
||||
QString eqNumber = QStringLiteral("-");
|
||||
if (it->equipmentNumber().is_set())
|
||||
eqNumber = QString::number(it->equipmentNumber().get());
|
||||
return QStringLiteral("%1 - %2 (%3)").arg(QString::fromStdString(it->designator())).arg(QString::fromStdString(it->tacticalIdentifier())).arg(eqNumber);
|
||||
auto it = m_effectShowActorModel->getIt(id);
|
||||
if (it == m_effectShowActorModel->getItEnd())
|
||||
return QString();
|
||||
QString eqNumber = QStringLiteral("-");
|
||||
if (it->equipmentNumber().is_set())
|
||||
eqNumber = QString::number(it->equipmentNumber().get());
|
||||
return QStringLiteral("%1 - %2 (%3)")
|
||||
.arg(QString::fromStdString(it->designator()))
|
||||
.arg(QString::fromStdString(it->tacticalIdentifier()))
|
||||
.arg(eqNumber);
|
||||
}
|
||||
|
||||
QString EffectShowModel::getParticipantAmmunition(int id) const
|
||||
{
|
||||
auto it = m_effectShowActorModel->getIt(id);
|
||||
if (it == m_effectShowActorModel->getItEnd()) return QString();
|
||||
auto it = m_effectShowActorModel->getIt(id);
|
||||
if (it == m_effectShowActorModel->getItEnd())
|
||||
return QString();
|
||||
|
||||
EffectShowManagement::EffectShowVehicleStatus vehicleStatus;
|
||||
if (!getVehicleStatus(it->equipmentNumber().get(), vehicleStatus)) return QString();
|
||||
EffectShowManagement::EffectShowVehicleStatus vehicleStatus;
|
||||
if (!getVehicleStatus(it->equipmentNumber().get(), vehicleStatus))
|
||||
return QString();
|
||||
|
||||
QString res = QString::number(vehicleStatus.ammunitionMagazine());
|
||||
res.append(QLatin1String(" / "));
|
||||
res.append(QString::number(vehicleStatus.ammunitionAvailable()));
|
||||
return res;
|
||||
QString res = QString::number(vehicleStatus.ammunitionMagazine());
|
||||
res.append(QLatin1String(" / "));
|
||||
res.append(QString::number(vehicleStatus.ammunitionAvailable()));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowModel::isVehicleStatus(int equipmentNum) const
|
||||
{
|
||||
auto it = m_effectShowVehicleStatus.find(equipmentNum);
|
||||
return (it != m_effectShowVehicleStatus.end());
|
||||
auto it = m_effectShowVehicleStatus.find(equipmentNum);
|
||||
return (it != m_effectShowVehicleStatus.end());
|
||||
}
|
||||
|
||||
bool EffectShowModel::getVehicleStatus(int equipmentNum, EffectShowManagement::EffectShowVehicleStatus &vehicleStatus) const
|
||||
bool EffectShowModel::getVehicleStatus(int equipmentNum,
|
||||
EffectShowManagement::EffectShowVehicleStatus& vehicleStatus) const
|
||||
{
|
||||
auto it = m_effectShowVehicleStatus.find(equipmentNum);
|
||||
if (it == m_effectShowVehicleStatus.end())
|
||||
return false;
|
||||
auto it = m_effectShowVehicleStatus.find(equipmentNum);
|
||||
if (it == m_effectShowVehicleStatus.end())
|
||||
return false;
|
||||
|
||||
vehicleStatus = it.value();
|
||||
return true;
|
||||
vehicleStatus = it.value();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EffectShowModel::hasVehicleReportedOperationalToday(int equipmentNum) const
|
||||
{
|
||||
EffectShowVehicleStatus vehicleStatus;
|
||||
getVehicleStatus(equipmentNum, vehicleStatus);
|
||||
EffectShowVehicleStatus vehicleStatus;
|
||||
getVehicleStatus(equipmentNum, vehicleStatus);
|
||||
|
||||
|
||||
if (vehicleStatus.operational())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId() << " is operational.";
|
||||
return true;
|
||||
}
|
||||
if (vehicleStatus.operational())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId() << " is operational.";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!m_effectShowVehicleLastTimeOperational.contains(equipmentNum))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId() << " has not reported operational at any time.";
|
||||
return false;
|
||||
}
|
||||
if (!m_effectShowVehicleLastTimeOperational.contains(equipmentNum))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId() << " has not reported operational at any time.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool bRet = QDateTime().addMSecs(m_effectShowVehicleLastTimeOperational[equipmentNum]).date() == QDate::currentDate();
|
||||
if (bRet)
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId() << " is not operational, but has reported operational today.";
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId() << " is not operational and has not reported operational today.";
|
||||
return bRet;
|
||||
bool bRet =
|
||||
QDateTime().addMSecs(m_effectShowVehicleLastTimeOperational[equipmentNum]).date() == QDate::currentDate();
|
||||
if (bRet)
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId()
|
||||
<< " is not operational, but has reported operational today.";
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId()
|
||||
<< " is not operational and has not reported operational today.";
|
||||
return bRet;
|
||||
}
|
||||
|
||||
QString EffectShowModel::getTimeAndPositionOfNextEffectShow(int idParticipant) const
|
||||
{
|
||||
auto it = m_vecData.begin();
|
||||
if (it == m_vecData.end())
|
||||
return QString();
|
||||
auto it = m_vecData.begin();
|
||||
if (it == m_vecData.end())
|
||||
return QString();
|
||||
|
||||
qint64 effectStart = 0;
|
||||
int numOrder = 0;
|
||||
Core::GeoPosition2D position;
|
||||
while (it != m_vecData.end())
|
||||
{
|
||||
if (it->orderConfirmation() != OrderConfirmation_e::OrderCarriedOut &&
|
||||
it->esmParticipantId() == idParticipant)
|
||||
qint64 effectStart = 0;
|
||||
int numOrder = 0;
|
||||
Core::GeoPosition2D position;
|
||||
while (it != m_vecData.end())
|
||||
{
|
||||
++numOrder;
|
||||
qint64 start = it->startTime().is_set() ? it->startTime().get() : 0;
|
||||
if (it->orderConfirmation() != OrderConfirmation_e::OrderCarriedOut && it->esmParticipantId() == idParticipant)
|
||||
{
|
||||
++numOrder;
|
||||
qint64 start = it->startTime().is_set() ? it->startTime().get() : 0;
|
||||
|
||||
if (effectStart == 0)
|
||||
{
|
||||
effectStart = start;
|
||||
position = it->position();
|
||||
}
|
||||
else if (start < effectStart)
|
||||
{
|
||||
effectStart = start;
|
||||
position = it->position();
|
||||
}
|
||||
if (effectStart == 0)
|
||||
{
|
||||
effectStart = start;
|
||||
position = it->position();
|
||||
}
|
||||
else if (start < effectStart)
|
||||
{
|
||||
effectStart = start;
|
||||
position = it->position();
|
||||
}
|
||||
}
|
||||
++it;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
if ((numOrder == 0) || ((numOrder > 1) && (effectStart == 0)))
|
||||
return QString();
|
||||
if ((numOrder == 0) || ((numOrder > 1) && (effectStart == 0)))
|
||||
return QString();
|
||||
|
||||
QString res;
|
||||
res = (effectStart != 0) ? DTG::toStringMSec(effectStart) : tr("---");
|
||||
QString res;
|
||||
res = (effectStart != 0) ? DTG::toStringMSec(effectStart) : tr("---");
|
||||
|
||||
res += QLatin1String(", ");
|
||||
res += LtsCoordTrans::mgrsFromGeographic(position.lon(), position.lat());
|
||||
res += QLatin1String(", ");
|
||||
res += LtsCoordTrans::mgrsFromGeographic(position.lon(), position.lat());
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
QString EffectShowModel::getTimeAndPositionOfNextActorRelocation(int idParticipant) const
|
||||
{
|
||||
auto it = m_effectShowActorRelocationModel->getItBegin();
|
||||
if (it == m_effectShowActorRelocationModel->getItEnd())
|
||||
return QString();
|
||||
auto it = m_effectShowActorRelocationModel->getItBegin();
|
||||
if (it == m_effectShowActorRelocationModel->getItEnd())
|
||||
return QString();
|
||||
|
||||
qint64 arrivalTime = std::numeric_limits<qint64>::max();
|
||||
Core::GeoPosition2D position;
|
||||
bool found = false;
|
||||
qint64 arrivalTime = std::numeric_limits<qint64>::max();
|
||||
Core::GeoPosition2D position;
|
||||
bool found = false;
|
||||
|
||||
while (it != m_effectShowActorRelocationModel->getItEnd())
|
||||
{
|
||||
if (it->orderConfirmation() != OrderConfirmation_e::OrderCarriedOut &&
|
||||
it->orderConfirmation() != OrderConfirmation_e::PositionReached &&
|
||||
it->orderConfirmation() != OrderConfirmation_e::Abort &&
|
||||
it->orderConfirmation() != OrderConfirmation_e::Nonacceptance &&
|
||||
it->esmParticipantId() == idParticipant)
|
||||
while (it != m_effectShowActorRelocationModel->getItEnd())
|
||||
{
|
||||
if (it->arrival_time().get() < arrivalTime)
|
||||
{
|
||||
arrivalTime = it->arrival_time().get();
|
||||
position = it->position();
|
||||
found = true;
|
||||
}
|
||||
if (it->orderConfirmation() != OrderConfirmation_e::OrderCarriedOut &&
|
||||
it->orderConfirmation() != OrderConfirmation_e::PositionReached &&
|
||||
it->orderConfirmation() != OrderConfirmation_e::Abort &&
|
||||
it->orderConfirmation() != OrderConfirmation_e::Nonacceptance && it->esmParticipantId() == idParticipant)
|
||||
{
|
||||
if (it->arrival_time().get() < arrivalTime)
|
||||
{
|
||||
arrivalTime = it->arrival_time().get();
|
||||
position = it->position();
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
++it;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
return QString();
|
||||
if (!found)
|
||||
return QString();
|
||||
|
||||
QString res;
|
||||
res = (arrivalTime != 0) ? DTG::toStringMSec(arrivalTime) : tr("---");
|
||||
QString res;
|
||||
res = (arrivalTime != 0) ? DTG::toStringMSec(arrivalTime) : tr("---");
|
||||
|
||||
res += QLatin1String(", ");
|
||||
res += LtsCoordTrans::mgrsFromGeographic(position.lon(), position.lat());
|
||||
res += QLatin1String(", ");
|
||||
res += LtsCoordTrans::mgrsFromGeographic(position.lon(), position.lat());
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
void EffectShowModel::updateAll()
|
||||
{
|
||||
this->update();
|
||||
m_effectShowActorModel->update();
|
||||
m_effectShowActorRelocationModel->update();
|
||||
this->update();
|
||||
m_effectShowActorModel->update();
|
||||
m_effectShowActorRelocationModel->update();
|
||||
}
|
||||
|
||||
bool EffectShowModel::onEffectShowVehicleStatusChanged(const EffectShowManagement::EffectShowVehicleStatus &data, DataModification modType)
|
||||
bool EffectShowModel::onEffectShowVehicleStatusChanged(const EffectShowManagement::EffectShowVehicleStatus& data,
|
||||
DataModification modType)
|
||||
{
|
||||
int equipmentNumber = m_dtcPpm->equipmentNumberByParticipantId(data.esmParticipantId());
|
||||
int equipmentNumber = m_dtcPpm->equipmentNumberByParticipantId(data.esmParticipantId());
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
if (m_effectShowVehicleStatus.contains(equipmentNumber))
|
||||
switch (modType)
|
||||
{
|
||||
if (m_effectShowVehicleStatus[equipmentNumber].operational() && !data.operational())
|
||||
m_effectShowVehicleLastTimeOperational[equipmentNumber] = data.sampleTime();
|
||||
}
|
||||
else
|
||||
m_effectShowVehicleLastTimeOperational[equipmentNumber] = 0;
|
||||
m_effectShowVehicleStatus[equipmentNumber] = data;
|
||||
break;
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
if (m_effectShowVehicleStatus.contains(equipmentNumber))
|
||||
{
|
||||
if (m_effectShowVehicleStatus[equipmentNumber].operational() && !data.operational())
|
||||
m_effectShowVehicleLastTimeOperational[equipmentNumber] = data.sampleTime();
|
||||
}
|
||||
else
|
||||
m_effectShowVehicleLastTimeOperational[equipmentNumber] = 0;
|
||||
m_effectShowVehicleStatus[equipmentNumber] = data;
|
||||
break;
|
||||
|
||||
case DataModification::eRemoved:
|
||||
m_effectShowVehicleStatus.remove(equipmentNumber);
|
||||
m_effectShowVehicleLastTimeOperational.remove(equipmentNumber);
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved:
|
||||
m_effectShowVehicleStatus.remove(equipmentNumber);
|
||||
m_effectShowVehicleLastTimeOperational.remove(equipmentNumber);
|
||||
break;
|
||||
}
|
||||
|
||||
updateAll();
|
||||
emit effectShowVehicleStatusChanged(data, modType);
|
||||
return true;
|
||||
updateAll();
|
||||
emit effectShowVehicleStatusChanged(data, modType);
|
||||
return true;
|
||||
}
|
||||
|
||||
void EffectShowProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
void EffectShowProxyModel::setSourceModel(QAbstractItemModel* sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<EffectShowModel *>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
m_sourceModel = qobject_cast<EffectShowModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
void EffectShowProxyModel::setShowExpired(bool show)
|
||||
{
|
||||
if (m_showExpired == show)
|
||||
return;
|
||||
if (m_showExpired == show)
|
||||
return;
|
||||
|
||||
m_showExpired = show;
|
||||
invalidateFilter();
|
||||
m_showExpired = show;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
bool EffectShowProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
|
||||
bool EffectShowProxyModel::lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const
|
||||
{
|
||||
if (!m_sourceModel ||
|
||||
source_left.column() != source_right.column() ||
|
||||
!source_left.isValid() ||
|
||||
!source_right.isValid())
|
||||
if (!m_sourceModel || source_left.column() != source_right.column() || !source_left.isValid() ||
|
||||
!source_right.isValid())
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
const auto& dataLeft = m_sourceModel->m_vecData.at(source_left.row());
|
||||
const auto dataRight = m_sourceModel->m_vecData.at(source_right.row());
|
||||
switch (source_left.column())
|
||||
{
|
||||
case EffectShowModel::StartTime:
|
||||
if (dataLeft.startTime().is_set() && dataRight.startTime().is_set())
|
||||
return dataLeft.startTime().get() < dataRight.startTime().get();
|
||||
if (dataRight.startTime().is_set())
|
||||
return true;
|
||||
if (dataLeft.startTime().is_set())
|
||||
return false;
|
||||
return dataLeft.id() < dataRight.id();
|
||||
|
||||
case EffectShowModel::Name_AES:
|
||||
case EffectShowModel::Id:
|
||||
case EffectShowModel::Duration:
|
||||
case EffectShowModel::Position:
|
||||
case EffectShowModel::EffectShowActor:
|
||||
case EffectShowModel::Volley:
|
||||
case EffectShowModel::ShotsInTotal:
|
||||
case EffectShowModel::Status:
|
||||
case EffectShowModel::Answer:
|
||||
break;
|
||||
}
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
const auto &dataLeft = m_sourceModel->m_vecData.at(source_left.row());
|
||||
const auto dataRight = m_sourceModel->m_vecData.at(source_right.row());
|
||||
switch (source_left.column())
|
||||
{
|
||||
case EffectShowModel::StartTime:
|
||||
if (dataLeft.startTime().is_set() && dataRight.startTime().is_set())
|
||||
return dataLeft.startTime().get() < dataRight.startTime().get();
|
||||
if (dataRight.startTime().is_set())
|
||||
return true;
|
||||
if (dataLeft.startTime().is_set())
|
||||
return false;
|
||||
return dataLeft.id() < dataRight.id();
|
||||
|
||||
case EffectShowModel::Name_AES:
|
||||
case EffectShowModel::Id:
|
||||
case EffectShowModel::Duration:
|
||||
case EffectShowModel::Position:
|
||||
case EffectShowModel::EffectShowActor:
|
||||
case EffectShowModel::Volley:
|
||||
case EffectShowModel::ShotsInTotal:
|
||||
case EffectShowModel::Status:
|
||||
case EffectShowModel::Answer:
|
||||
break;
|
||||
}
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
}
|
||||
|
||||
bool EffectShowProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
bool EffectShowProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
|
||||
{
|
||||
bool bRet = checkFilter(source_row);
|
||||
if (!bRet)
|
||||
return false;
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
bool bRet = checkFilter(source_row);
|
||||
if (!bRet)
|
||||
return false;
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
}
|
||||
|
||||
bool EffectShowProxyModel::checkFilter(int source_row) const
|
||||
{
|
||||
|
||||
|
||||
if (showExpired())
|
||||
return true;
|
||||
if (showExpired())
|
||||
return true;
|
||||
|
||||
const auto effectShowSource = m_sourceModel->getRowData(source_row);
|
||||
const auto effectShowSource = m_sourceModel->getRowData(source_row);
|
||||
|
||||
|
||||
if (effectShowSource.orderConfirmation() != EffectShowManagement::OrderConfirmation_e_def::OrderCarriedOut)
|
||||
return true;
|
||||
if (effectShowSource.orderConfirmation() != EffectShowManagement::OrderConfirmation_e_def::OrderCarriedOut)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Executable → Regular
+84
-91
@@ -1,19 +1,17 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <EffectShowManagement/esm_dtc.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace EffectShowManagement
|
||||
@@ -22,123 +20,118 @@ class EffectShowActorProxyModel;
|
||||
class EffectShowActorModel;
|
||||
class EffectShowActorRelocationModel;
|
||||
|
||||
|
||||
|
||||
class EffectShowModel final : public LtsWidgets::LtsAbstractTableModel<EffectShowManagement::EffectShow>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Name_AES,
|
||||
Id,
|
||||
StartTime,
|
||||
Duration,
|
||||
Position,
|
||||
AesStatus,
|
||||
EffectShowActor,
|
||||
Volley,
|
||||
ShotsInTotal,
|
||||
Size,
|
||||
Rotation,
|
||||
Status,
|
||||
Answer
|
||||
};
|
||||
explicit EffectShowModel(QObject *parent);
|
||||
~EffectShowModel();
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns {
|
||||
Name_AES,
|
||||
Id,
|
||||
StartTime,
|
||||
Duration,
|
||||
Position,
|
||||
AesStatus,
|
||||
EffectShowActor,
|
||||
Volley,
|
||||
ShotsInTotal,
|
||||
Size,
|
||||
Rotation,
|
||||
Status,
|
||||
Answer
|
||||
};
|
||||
|
||||
bool initModel(LtsSession::LtsSession *session);
|
||||
explicit EffectShowModel(QObject* parent);
|
||||
~EffectShowModel();
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool initModel(LtsSession::LtsSession* session);
|
||||
|
||||
EffectShowActorModel *getEffectShowActorModel() { return m_effectShowActorModel; }
|
||||
EffectShowActorProxyModel *getEffectShowActorProxyModel() { return m_effectShowActorProxyModel; }
|
||||
EffectShowActorRelocationModel *getEffetShowActorRelocationModel() { return m_effectShowActorRelocationModel; }
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
|
||||
EffectShowActorModel* getEffectShowActorModel()
|
||||
{
|
||||
return m_effectShowActorModel;
|
||||
}
|
||||
|
||||
QMap<int, QString> getParticipantList() const;
|
||||
EffectShowActorProxyModel* getEffectShowActorProxyModel()
|
||||
{
|
||||
return m_effectShowActorProxyModel;
|
||||
}
|
||||
|
||||
EffectShowActorRelocationModel* getEffetShowActorRelocationModel()
|
||||
{
|
||||
return m_effectShowActorRelocationModel;
|
||||
}
|
||||
|
||||
|
||||
QMap<int, QString> getParticipantList() const;
|
||||
|
||||
QMap<int, QString> getParticipantList(bool is_smoke) const;
|
||||
QMap<int, QString> getParticipantList(bool is_smoke) const;
|
||||
|
||||
|
||||
QVector<QPair<int, QString>> getParticipantListByDistance(bool is_smoke, const Core::GeoPosition2D& origin);
|
||||
|
||||
QVector<QPair<int, QString>> getParticipantListByDistance(bool is_smoke, const Core::GeoPosition2D &origin);
|
||||
QString getParticipantName(int id) const;
|
||||
|
||||
|
||||
QString getParticipantAmmunition(int id) const;
|
||||
|
||||
QString getParticipantName(int id) const;
|
||||
bool isVehicleStatus(int equipmentNum) const;
|
||||
|
||||
|
||||
bool getVehicleStatus(int equipmentNum, EffectShowManagement::EffectShowVehicleStatus& vehicleStatus) const;
|
||||
|
||||
QString getParticipantAmmunition(int id) const;
|
||||
bool hasVehicleReportedOperationalToday(int equipmentNum) const;
|
||||
|
||||
|
||||
QString getTimeAndPositionOfNextEffectShow(int idParticipant) const;
|
||||
|
||||
bool isVehicleStatus(int equipmentNum) const;
|
||||
|
||||
QString getTimeAndPositionOfNextActorRelocation(int idParticipant) const;
|
||||
|
||||
bool getVehicleStatus(int equipmentNum, EffectShowManagement::EffectShowVehicleStatus &vehicleStatus) const;
|
||||
|
||||
void updateAll();
|
||||
|
||||
bool hasVehicleReportedOperationalToday(int equipmentNum) const;
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
bool onEffectShowVehicleStatusChanged(const EffectShowManagement::EffectShowVehicleStatus& data,
|
||||
DataModification modType);
|
||||
|
||||
|
||||
signals:
|
||||
void effectShowVehicleStatusChanged(const EffectShowManagement::EffectShowVehicleStatus&, const DataModification&);
|
||||
|
||||
QString getTimeAndPositionOfNextEffectShow(int idParticipant) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes;
|
||||
|
||||
QString getTimeAndPositionOfNextActorRelocation(int idParticipant) const;
|
||||
QMap<int, EffectShowManagement::EffectShowVehicleStatus> m_effectShowVehicleStatus;
|
||||
QMap<int, qint64> m_effectShowVehicleLastTimeOperational;
|
||||
|
||||
|
||||
EffectShowActorProxyModel* m_effectShowActorProxyModel;
|
||||
EffectShowActorModel* m_effectShowActorModel;
|
||||
EffectShowActorRelocationModel* m_effectShowActorRelocationModel;
|
||||
|
||||
void updateAll();
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool onEffectShowVehicleStatusChanged(const EffectShowManagement::EffectShowVehicleStatus &data, DataModification modType);
|
||||
|
||||
signals:
|
||||
void effectShowVehicleStatusChanged(const EffectShowManagement::EffectShowVehicleStatus &, const DataModification &);
|
||||
|
||||
private:
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes;
|
||||
|
||||
QMap<int, EffectShowManagement::EffectShowVehicleStatus> m_effectShowVehicleStatus;
|
||||
QMap<int, qint64> m_effectShowVehicleLastTimeOperational;
|
||||
|
||||
EffectShowActorProxyModel *m_effectShowActorProxyModel;
|
||||
EffectShowActorModel *m_effectShowActorModel;
|
||||
EffectShowActorRelocationModel *m_effectShowActorRelocationModel;
|
||||
|
||||
friend class EffectShowProxyModel;
|
||||
friend class EffectShowProxyModel;
|
||||
};
|
||||
|
||||
class EffectShowProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
bool showExpired() const { return m_showExpired; }
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
void setSourceModel(QAbstractItemModel* sourceModel) override;
|
||||
|
||||
public slots:
|
||||
void setShowExpired(bool show);
|
||||
bool showExpired() const
|
||||
{
|
||||
return m_showExpired;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override final;
|
||||
private:
|
||||
bool checkFilter(int source_row) const;
|
||||
private:
|
||||
bool m_showExpired = false;
|
||||
public slots:
|
||||
void setShowExpired(bool show);
|
||||
|
||||
EffectShowModel *m_sourceModel = nullptr;
|
||||
protected:
|
||||
bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const override;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override final;
|
||||
|
||||
private:
|
||||
bool checkFilter(int source_row) const;
|
||||
|
||||
private:
|
||||
bool m_showExpired = false;
|
||||
|
||||
EffectShowModel* m_sourceModel = nullptr;
|
||||
};
|
||||
}
|
||||
} // namespace EffectShowManagement
|
||||
Reference in new issue
Block a user