Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+106
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
*
|
||||
* TableModel for dynamic topics
|
||||
*
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QVector>
|
||||
#include <QDateTime>
|
||||
#include <QSharedPointer>
|
||||
#include <QStringList>
|
||||
|
||||
#include <dds/core/xtypes/DynamicData.hpp>
|
||||
|
||||
#include <LtsUtilsCore/data_modification_enum.h>
|
||||
#include "logger.h"
|
||||
|
||||
class QDomDocument;
|
||||
class QDomElement;
|
||||
class TelegramSortModel;
|
||||
|
||||
class TelegramModel final : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TelegramModel(QObject *parent = nullptr);
|
||||
|
||||
enum Column
|
||||
{
|
||||
DateTime = 0,
|
||||
TopicName = 1,
|
||||
TypeName = 2,
|
||||
Info = 3,
|
||||
Maximum = Info
|
||||
};
|
||||
|
||||
struct TelegramData
|
||||
{
|
||||
QDateTime dateTime;
|
||||
std::string typeName;
|
||||
QString topicName;
|
||||
QString info;
|
||||
DataModification modType;
|
||||
QSharedPointer<dds::core::xtypes::DynamicData> legatusData;
|
||||
|
||||
void toXml(QDomDocument &doc, QDomElement &de) const;
|
||||
bool fromXml(QDomElement &de);
|
||||
};
|
||||
|
||||
int rowCount(const QModelIndex &parent) const override;
|
||||
int columnCount(const QModelIndex &parent) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
TelegramData telegramData(const QModelIndex &index) const;
|
||||
|
||||
void processData(const dds::core::xtypes::DynamicData &data, const QString &topicName, DataModification modType);
|
||||
|
||||
const QString topicName(const QModelIndex &index) const;
|
||||
const std::string typeName(const QModelIndex &index) const;
|
||||
const QSharedPointer<dds::core::xtypes::DynamicData> dynamicData(const QModelIndex &index) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
Qt::DropActions supportedDropActions() const override;
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
|
||||
QMimeData *mimeData(const QModelIndexList &indexes) const override;
|
||||
QStringList mimeTypes() const override;
|
||||
|
||||
void onTypeCodeInfosChanged();
|
||||
|
||||
bool deleteRow(const QModelIndex &index);
|
||||
|
||||
public slots:
|
||||
void onClear();
|
||||
|
||||
signals:
|
||||
void send(const QSharedPointer<dds::core::xtypes::DynamicData> &data, const QString &topicName);
|
||||
|
||||
private:
|
||||
QString getString(const dds::core::xtypes::DynamicData &data, uint32_t member_index) const;
|
||||
QString getInfo(const dds::core::xtypes::DynamicData &data, const QString &topicName) const;
|
||||
QMap<QString, QString> getInfoInternal(const dds::core::xtypes::DynamicData &data, const QStringList &fields) const;
|
||||
|
||||
|
||||
QVector<TelegramData> m_data;
|
||||
QMap<QString, QStringList> m_infoList;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
friend class TelegramSortModel;
|
||||
};
|
||||
|
||||
class TelegramSortModel final : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QSortFilterProxyModel::QSortFilterProxyModel;
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &left,
|
||||
const QModelIndex &right) const override;
|
||||
};
|
||||
Reference in new issue
Block a user