/** * @RDE_HEADER@ * HMI Plugin for Messaging - Messaging Model * $Id$ * $HeadURL$ * $Author$ * Created by Chrsitian Roeskens, NLSE, 2018-05-03 */ #pragma once #include #include #include #include namespace LtsSession { class LtsSession; } namespace TrainingAreaBaseOC { struct Entry { Entry() = default; Entry(const QDateTime &date, const QString &msg) : m_date(date), m_msg(msg) {} QDateTime m_date; QString m_msg; }; enum class TextType { test = 0, UnderFire = 1, Injury = 2, Manipulation = 3, Kill = 4, State = 5, Error = 6, Activation = 7, Messages = 8, AcousticOutputOnly = 9, ClearDisplay = 255, }; // -------------------------------------------------------- // MessagingModel // -------------------------------------------------------- class MessagingModel final : public LtsWidgets::LtsAbstractTableModel { Q_OBJECT public: explicit MessagingModel(QObject *parent = nullptr); bool initModel(const std::shared_ptr &dtc, qint64 lastClearTime); QVariant data(const QModelIndex &, int) const override; public slots: void clearModel(); private: void insertData(const TrainingAreaBaseOC::FreeText &data, DataModification modType = DataModification::eAdded); void insertData(const TrainingAreaBaseOC::ShortMessage &data, DataModification modType = DataModification::eAdded); bool dontAdd(qint64 timeToCheck); static QString textTypeToString(TrainingAreaBaseOC::TextType type); static QString vbgVbaIndexToText(int type, int vbg); std::shared_ptr m_dtc; int m_operatorId; qint64 m_lastClearTime; LOGGER_T m_logger; }; } //namespace TrainingAreaBaseOC