Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
+124
@@ -0,0 +1,124 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "topic_editor_utils.h"
|
||||
|
||||
#include <TopicEditorBase/topiceditorbase_export.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtilsCore/promise.h>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
namespace LtsUtils { class Promise; }
|
||||
|
||||
|
||||
namespace TopicEditorBase
|
||||
{
|
||||
|
||||
class TopicPreviewWidget;
|
||||
|
||||
|
||||
class TOPICEDITORBASE_EXPORT ExportNotifier : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExportNotifier(QObject *parent)
|
||||
: QObject(parent)
|
||||
{}
|
||||
|
||||
bool isSuccessful = false;
|
||||
QString successMessage;
|
||||
|
||||
void setExportSuccessful(const QString &message)
|
||||
{
|
||||
isSuccessful = true;
|
||||
successMessage = message;
|
||||
emit exportSuccessful(message);
|
||||
emit exportFinished();
|
||||
}
|
||||
|
||||
void setExportFailed()
|
||||
{
|
||||
isSuccessful = false;
|
||||
successMessage = QString();
|
||||
emit exportFailed();
|
||||
emit exportFinished();
|
||||
}
|
||||
|
||||
signals:
|
||||
void stillAlive();
|
||||
void exportSuccessful(const QString &);
|
||||
void exportFailed();
|
||||
void exportFinished();
|
||||
};
|
||||
|
||||
|
||||
class TOPICEDITORBASE_EXPORT TopicEditor: public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TopicEditor(QWidget *parent = nullptr);
|
||||
virtual ~TopicEditor() = default;
|
||||
|
||||
TopicData &topicData() { return m_topicData; }
|
||||
void setTopicData(const TopicData &data);
|
||||
|
||||
int topicId() const { return m_topicData.id; }
|
||||
|
||||
int startTime() const { return m_topicData.startTime; }
|
||||
void setStartTime(int start) { m_topicData.startTime = start; }
|
||||
|
||||
int duration() const { return m_topicData.duration; }
|
||||
void setDuration(int duration);
|
||||
|
||||
QString description() const { return m_topicData.description; }
|
||||
void setDescription(const QString &description) { m_topicData.description = description; }
|
||||
|
||||
TopicPreviewWidget *topicPreviewWidget() { return m_previewWidget; }
|
||||
|
||||
protected:
|
||||
void init(TopicPreviewWidget *widget);
|
||||
|
||||
|
||||
|
||||
virtual void updateInternalData() = 0;
|
||||
virtual void updateInternalLength() {}
|
||||
|
||||
TopicType topicType() const { return m_topicData.topicType; }
|
||||
QJsonValue getTopicDataValue(const QString &key) const { return m_topicData.properties.value(key); }
|
||||
QJsonArray getTopicVDataAsArray(const QString &key) const { return m_topicData.properties.value(key).toArray(); }
|
||||
|
||||
bool hasTopicDataProperties() const { return !m_topicData.properties.isEmpty(); }
|
||||
void setTopicDataProperty(const QString &key, const QJsonValue &value);
|
||||
|
||||
void applied();
|
||||
|
||||
public slots:
|
||||
virtual bool apply2() = 0;
|
||||
void setIsPlaying(bool isPlaying);
|
||||
|
||||
private slots:
|
||||
bool apply() override final;
|
||||
|
||||
signals:
|
||||
void topicDataChanged();
|
||||
void topicEditorRequested(const TopicData &);
|
||||
void durationCheckRequested(int duration, LtsUtils::Promise *promise);
|
||||
void signalSetTopicPosition(QWidget *widget, int ignoreTopicForReplay);
|
||||
void changesSaved(const TopicData &data);
|
||||
|
||||
protected:
|
||||
TopicData m_topicData;
|
||||
int m_topicDuration{-1};
|
||||
bool m_isPlaying {false};
|
||||
|
||||
TopicPreviewWidget *m_previewWidget{nullptr};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user