- 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>
132 lines
3.1 KiB
C++
132 lines
3.1 KiB
C++
|
|
|
|
#pragma once
|
|
|
|
#include <QJsonObject>
|
|
#include <QVector>
|
|
#include <TopicEditorBase/topic_editor_utils.h>
|
|
|
|
class QWidget;
|
|
|
|
namespace TopicEditorBase
|
|
{
|
|
class ExportNotifier;
|
|
}
|
|
|
|
namespace TopicReplay
|
|
{
|
|
|
|
class Interface
|
|
{
|
|
|
|
public:
|
|
static QJsonObject timeRange(qint64 start, qint64 end)
|
|
{
|
|
return {{QStringLiteral("start"), start}, {QStringLiteral("end"), end}};
|
|
}
|
|
|
|
struct SituationReplayTime
|
|
{
|
|
int id = 0;
|
|
|
|
qint64 topicStart_s = -1;
|
|
qint64 topicEnd_s = -1;
|
|
|
|
qint64 replayStart_ms = -1;
|
|
qint64 replayEnd_ms = -1;
|
|
double replaySpeedFactor = 1;
|
|
|
|
QJsonObject toReplayInformation() const
|
|
{
|
|
return {
|
|
{QStringLiteral("id"), id},
|
|
{QStringLiteral("timeInPresentation"), timeRange(topicStart_s * 1000, topicEnd_s * 1000)},
|
|
};
|
|
}
|
|
|
|
QJsonObject toPlaybackTime(double max) const
|
|
{
|
|
QJsonObject ret = timeRange(replayStart_ms, std::min(replayEnd_ms * replaySpeedFactor, max));
|
|
ret[QStringLiteral("replaySpeedFactor")] = replaySpeedFactor;
|
|
return ret;
|
|
}
|
|
|
|
QJsonObject toJson(double maxReplayEndMs) const
|
|
{
|
|
return {
|
|
{QStringLiteral("playbackTime"), toPlaybackTime(maxReplayEndMs)},
|
|
{QStringLiteral("replayInformation"), toReplayInformation()},
|
|
};
|
|
}
|
|
};
|
|
|
|
Interface() = default;
|
|
virtual ~Interface() = default;
|
|
|
|
virtual QWidget* createWidget()
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
virtual bool playbackInit(const QJsonObject& attributes)
|
|
{
|
|
Q_UNUSED(attributes);
|
|
return true;
|
|
}
|
|
|
|
virtual bool playbackStart(int secondsOffset)
|
|
{
|
|
Q_UNUSED(secondsOffset);
|
|
return true;
|
|
}
|
|
|
|
virtual bool playbackPause()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
virtual bool playbackStop()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
virtual void setExportPlaybackTimes(qint64 startTimeSec, qint64 durationSec,
|
|
const QVector<SituationReplayTime>& sitReplayTimes)
|
|
{
|
|
Q_UNUSED(startTimeSec);
|
|
Q_UNUSED(durationSec);
|
|
Q_UNUSED(sitReplayTimes);
|
|
}
|
|
|
|
virtual bool exportTopic(const QJsonObject& attributes, const QString& strFolderPath,
|
|
TopicEditorBase::ExportNotifier* pExportNotifier) = 0;
|
|
|
|
virtual QVector<TopicEditorBase::TopicData> additionalTrackEntries(const QJsonObject& attributes) const
|
|
{
|
|
Q_UNUSED(attributes);
|
|
return {};
|
|
}
|
|
|
|
virtual QVector<TopicEditorBase::TopicData> additionalTrackEntries(const QJsonObject& attributes,
|
|
bool& keepOriginalTopic) const
|
|
{
|
|
keepOriginalTopic = true;
|
|
return additionalTrackEntries(attributes);
|
|
}
|
|
|
|
virtual void setBasePath(const QString& basePath)
|
|
{
|
|
Q_UNUSED(basePath);
|
|
}
|
|
};
|
|
|
|
class Factory
|
|
{
|
|
|
|
public:
|
|
virtual ~Factory() = default;
|
|
virtual Interface* createInterface(TopicEditorBase::TopicType topicType) = 0;
|
|
};
|
|
|
|
} // namespace TopicReplay
|