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
+122
@@ -0,0 +1,122 @@
|
||||
|
||||
|
||||
|
||||
#include "topic_editor_base.h"
|
||||
#include "topic_preview_widget.h"
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace TopicEditorBase
|
||||
{
|
||||
|
||||
TopicEditor::TopicEditor(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_previewWidget(nullptr)
|
||||
{
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Ok)->hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TopicEditor::setTopicData(const TopicEditorBase::TopicData &data)
|
||||
{
|
||||
m_topicData = data;
|
||||
m_topicDuration = data.duration;
|
||||
|
||||
if (m_previewWidget == nullptr)
|
||||
{
|
||||
QMessageBox::critical(
|
||||
nullptr, QStringLiteral("An den Entwickler!"),
|
||||
QStringLiteral("!! STOP !! - Dieser Topic Editor hatte 'init()' vorher nicht aufgerufen!")
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_previewWidget->setTopicData(m_topicData);
|
||||
|
||||
bool isAlreadyUnchangeable = unchangeable();
|
||||
if (!isAlreadyUnchangeable)
|
||||
setUnchangeable(true);
|
||||
|
||||
updateInternalData();
|
||||
|
||||
if (!isAlreadyUnchangeable)
|
||||
setUnchangeable(false);
|
||||
}
|
||||
|
||||
|
||||
void TopicEditor::setDuration(int duration)
|
||||
{
|
||||
m_topicData.duration = duration;
|
||||
updateInternalLength();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TopicEditor::init(TopicPreviewWidget *widget)
|
||||
{
|
||||
m_previewWidget = widget;
|
||||
connect(m_previewWidget, &TopicPreviewWidget::deleteMe,
|
||||
this, &TopicEditor::deleteLater);
|
||||
|
||||
|
||||
m_previewWidget->setTopicEnabled(false);
|
||||
connect(this, &TopicEditor::signalChangesMade, this, [this]()
|
||||
{
|
||||
m_previewWidget->setTopicEnabled(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void TopicEditor::setTopicDataProperty(const QString &key, const QJsonValue &value)
|
||||
{
|
||||
m_topicData.properties[key] = value;
|
||||
emit signalChangesMade();
|
||||
}
|
||||
|
||||
|
||||
void TopicEditor::applied()
|
||||
{
|
||||
m_previewWidget->setTopicEnabled(true);
|
||||
emit topicDataChanged();
|
||||
}
|
||||
|
||||
void TopicEditor::setIsPlaying(bool isPlaying)
|
||||
{
|
||||
m_isPlaying = isPlaying;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool TopicEditor::apply()
|
||||
{
|
||||
if (m_previewWidget == nullptr)
|
||||
{
|
||||
QMessageBox::critical(
|
||||
nullptr, QStringLiteral("An den Entwickler!"),
|
||||
QStringLiteral("!! STOP !! - Dieser Topic Editor hatte 'init()' vorher nicht aufgerufen!")
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
if (m_isPlaying)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this, tr("Please Stop Playback first"));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool result = apply2();
|
||||
if (result)
|
||||
applied();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user