Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsScriptTimeline/track_entry.h
T
torstenandCopilot d6b6ffce7c 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>
2026-08-19 14:46:29 +02:00

132 lines
4.8 KiB
C++

#pragma once
#include "ltsscripttimeline_export.h"
#include "track_entry_painters.h"
#include <QJsonObject>
#include <QObject>
namespace LtsScriptTimeline
{
class LTSSCRIPTTIMELINE_EXPORT TrackEntry : public QObject
{
Q_OBJECT
public:
explicit TrackEntry(const TrackEntryType& tet = TrackEntryType::INVALID)
: QObject(), m_topicId(-1), m_startTime(-1), m_length(-1), m_type(tet), isSet(false), index(-1), x(-1), y(-1),
h(-1), w(-1)
{
}
explicit TrackEntry(int topicId, int startTime, int length, LtsScriptTimeline::TrackEntryType type,
const QJsonObject& detailData, const QString& channelName, const QString& description)
: QObject(), m_topicId(topicId), m_startTime(startTime), m_length(length), m_type(type), isSet(false),
index(-1), x(-1), y(-1), h(-1), w(-1), m_detailData(detailData), m_channelName(channelName)
,
m_description(description)
{
}
explicit TrackEntry(const TrackEntry& te)
: QObject(), m_topicId(te.m_topicId), m_startTime(te.m_startTime), m_length(te.m_length), m_type(te.m_type),
isSet(te.isSet), index(te.index), x(te.x), y(te.y), h(te.h), w(te.w), m_detailData(te.m_detailData),
m_channelName(te.m_channelName), m_description(te.m_description),
m_filterParentChannel(te.m_filterParentChannel)
{
}
explicit TrackEntry(TrackEntry* te)
: QObject(), m_topicId(te->m_topicId), m_startTime(te->m_startTime), m_length(te->m_length), m_type(te->m_type),
isSet(te->isSet), index(te->index), x(te->x), y(te->y), h(te->h), w(te->w), m_detailData(te->m_detailData),
m_channelName(te->m_channelName), m_description(te->m_description),
m_filterParentChannel(te->m_filterParentChannel)
{
}
TrackEntry(const TrackEntryType& tet, int length)
: QObject(), m_topicId(-1), m_startTime(-1), m_length(length), m_type(tet), isSet(false), index(-1), x(-1),
y(-1), h(-1), w(-1)
{
}
~TrackEntry() {}
TrackEntry& operator=(const TrackEntry& other)
{
this->m_topicId = other.m_topicId;
this->m_startTime = other.m_startTime;
this->m_length = other.m_length;
this->m_type = other.m_type;
this->isSet = other.isSet;
this->index = other.index;
this->x = other.x;
this->y = other.y;
this->h = other.h;
this->w = other.w;
this->m_detailData = other.m_detailData;
this->m_channelName = other.m_channelName;
this->m_filterParentChannel = other.m_filterParentChannel;
this->m_description = other.m_description;
return *this;
}
int m_topicId;
int m_startTime;
int m_length;
TrackEntryType m_type;
bool isSet;
int index;
double x;
double y;
double h;
double w;
QJsonObject m_detailData;
QString m_channelName;
QString m_description;
QString m_filterParentChannel;
QJsonObject toJson() const
{
return QJsonObject({{QStringLiteral("topicId"), m_topicId},
{QStringLiteral("startTime"), m_startTime},
{QStringLiteral("length"), m_length},
{QStringLiteral("type"), static_cast<int>(m_type)},
{QStringLiteral("isSet"), isSet},
{QStringLiteral("index"), index},
{QStringLiteral("x"), x},
{QStringLiteral("y"), y},
{QStringLiteral("w"), w},
{QStringLiteral("h"), h},
{QStringLiteral("detailData"), m_detailData},
{QStringLiteral("channelName"), m_channelName},
{QStringLiteral("description"), m_description},
{QStringLiteral("filterParentChannel"), m_filterParentChannel}});
}
void fromJson(const QJsonObject& obj)
{
m_topicId = obj[QStringLiteral("topicId")].toInt();
m_startTime = obj[QStringLiteral("startTime")].toInt(-1);
m_length = obj[QStringLiteral("length")].toInt(-1);
m_type = static_cast<TrackEntryType>(obj[QStringLiteral("type")].toInt());
isSet = obj[QStringLiteral("isSet")].toBool();
index = obj[QStringLiteral("index")].toInt();
x = obj[QStringLiteral("x")].toDouble();
y = obj[QStringLiteral("y")].toDouble();
w = obj[QStringLiteral("w")].toDouble();
h = obj[QStringLiteral("h")].toDouble();
m_detailData = obj[QStringLiteral("detailData")].toObject();
m_channelName = obj[QStringLiteral("channelName")].toString();
m_description = obj[QStringLiteral("description")].toString();
m_filterParentChannel = obj[QStringLiteral("filterParentChannel")].toString();
}
};
} // namespace LtsScriptTimeline