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
+105
@@ -0,0 +1,105 @@
|
||||
#include "track_entry_preview_widget.h"
|
||||
#include "ui_track_entry_preview_widget.h"
|
||||
#include "track_entry.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsWidgets/lts_message_dialog.h>
|
||||
|
||||
#include <QMenu>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QJsonDocument>
|
||||
#include <QTextEdit>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
TrackEntryPreviewWidget::TrackEntryPreviewWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_ui(new Ui::TrackEntryPreviewWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->lbTopicId->hide();
|
||||
m_ui->lblTopicId->hide();
|
||||
|
||||
m_ui->lbLen->hide();
|
||||
m_ui->lblLen->hide();
|
||||
#endif
|
||||
connect(m_ui->widget, &TrackEntryPreviewer::signalDelete,
|
||||
this, &TrackEntryPreviewWidget::signalDelete);
|
||||
|
||||
|
||||
connect(m_ui->widget, &TrackEntryPreviewer::signalStartDrag,
|
||||
this, &TrackEntryPreviewWidget::signalStartDrag);
|
||||
connect(m_ui->widget, &TrackEntryPreviewer::signalStopDrag,
|
||||
this, &TrackEntryPreviewWidget::signalStopDrag);
|
||||
}
|
||||
|
||||
|
||||
TrackEntryPreviewWidget::~TrackEntryPreviewWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void TrackEntryPreviewWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
#ifndef LTS_DEBUG
|
||||
if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TrackEntryPreviewWidget.DebugMenu")) == QVariant(true))
|
||||
#endif
|
||||
{
|
||||
QMenu *m = new QMenu(this);
|
||||
m->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
QPoint p = mapToGlobal(m->pos());
|
||||
m->setGeometry(QRect(p, QPoint(event->x(), event->y())));
|
||||
|
||||
m->addAction(QStringLiteral("enable"), this, [this]()
|
||||
{
|
||||
setTopicEnabled(true);
|
||||
});
|
||||
|
||||
m->addAction(QStringLiteral("disable"), this, [this]()
|
||||
{
|
||||
setTopicEnabled(false);
|
||||
});
|
||||
|
||||
m->addAction(QStringLiteral("show detail data"), this, [this]()
|
||||
{
|
||||
TrackEntry *te = m_ui->widget->trackEntry();
|
||||
|
||||
if (te == nullptr)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this, QStringLiteral("no te was set"));
|
||||
return;
|
||||
}
|
||||
|
||||
QTextEdit *ted = new QTextEdit(nullptr);
|
||||
ted->setAttribute(Qt::WA_DeleteOnClose);
|
||||
ted->setWindowTitle(QStringLiteral("Track Entry #%1 - Detail Data string").arg(te->m_topicId));
|
||||
ted->setText(QString::fromUtf8(QJsonDocument(te->m_detailData).toJson()));
|
||||
ted->setReadOnly(true);
|
||||
ted->show();
|
||||
});
|
||||
|
||||
m->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TrackEntryPreviewWidget::setTopicEnabled(bool enabled)
|
||||
{
|
||||
m_ui->widget->setEnabled(enabled);
|
||||
}
|
||||
|
||||
|
||||
void TrackEntryPreviewWidget::setTrackEntry(TrackEntry *te)
|
||||
{
|
||||
m_ui->lblDnD->setVisible(!te->isSet);
|
||||
m_ui->widget->setVisible(!te->isSet);
|
||||
|
||||
m_ui->lbTopicId->setText(QString::number(te->m_topicId));
|
||||
m_ui->lbLen->setText(QString::number(te->m_length));
|
||||
m_ui->widget->setTrackEntry(te);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user