Files
qt5-legatus-legacy/Lts/Plugins/EffectShowClient/Gui/esc_order_model.h
T
2026-08-13 18:33:10 +02:00

85 lines
2.2 KiB
C++
Executable File

/**
* @RDE_HEADER@
* HMI Plugin for MeteoDataManagement - Weather Station Overview Dialog Model
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-10.05
*/
#pragma once
#include <EffectShowClient/esc_dtc.h>
#include <EffectShowClient/logger.h>
#include <TrainingAreaBaseOC/taboc_dtc.h>
#include <LtsWidgets/lts_abstract_table_model.h>
#include <LtsWidgets/lts_column_filter_proxy_model.h>
namespace EffectShowClient
{
/**
* @brief The OrderModel provides all effect show orders related to the vehicle.
*/
class OrderModel final : public LtsWidgets::LtsAbstractTableModel<EffectShowClient::Order>
{
Q_OBJECT
public:
enum Columns
{
Id,
Type,
Info,
Status,
StartTime,
Duration,
Distance,
Position,
Area,
Rotation,
Volley,
ShotsInTotal
};
explicit OrderModel(QObject *parent = nullptr);
bool initModel(const std::shared_ptr<EffectShowClient::Interface::Dtc> &dtc,
const std::shared_ptr<TrainingAreaBaseOC::Interface::Dtc> &dtcTabOC,
bool isEffectShow);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
/**
* @brief Converts seconds of the day into a string like: hh::mm:ss.
* @param seconds Seconds of the day
* @return A string like: hh::mm:ss
*/
static QString timeOfDayString(int seconds);
private slots:
bool onDataChanged(const EffectShowClient::Order &data, DataModification modType) override;
void onOwnPositionChanged(const TrainingAreaBaseOC::OwnPosition &data);
private:
std::shared_ptr<EffectShowClient::Interface::Dtc> m_dtc;
std::shared_ptr<TrainingAreaBaseOC::Interface::Dtc> m_dtcTabOC;
TrainingAreaBaseOC::OwnPosition m_ownPosition;
friend class OrderProxyModel;
bool m_isEffectShow = true;
LOGGER_T m_logger;
};
class OrderProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
{
Q_OBJECT
public:
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
void setSourceModel(QAbstractItemModel *sourceModel) override;
protected:
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
private:
OrderModel *m_sourceModel = nullptr;
};
} //namespace EffectShowClient