Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+178
@@ -0,0 +1,178 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Topic Editor for the Situation Topic in the Script Editor
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Iuliana Ojog, SLSE, 2018-03-24
|
||||
*/
|
||||
|
||||
#include "topic_editor.h"
|
||||
#include "ui_topic_editor.h"
|
||||
|
||||
#include <LtsScriptTimeline/track_entry.h>
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <Plugins/ReportManagement/rep_data_plugin_interface.h>
|
||||
#include <Plugins/ReportManagement/rep_gui_plugin_interface.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <ReportManagement/Gui/ReportViewer/rep_report_model.h>
|
||||
#include <TopicEditorBase/topic_previewer.h>
|
||||
|
||||
|
||||
namespace ReportManagement
|
||||
{
|
||||
|
||||
ReportTopicEditor::ReportTopicEditor(
|
||||
const std::shared_ptr<ReportManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc, QWidget *parent
|
||||
)
|
||||
: TopicEditorBase::TopicEditor(parent)
|
||||
, m_reportModel(new ReportModel(this))
|
||||
, m_ui(new Ui::ReportTopicEditor)
|
||||
, m_logger(getLogger("ReportTopicEditor"))
|
||||
{
|
||||
// init UI
|
||||
m_ui->setupUi(this);
|
||||
init(m_ui->widget);
|
||||
connect(m_ui->reportsDataView, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &ReportTopicEditor::onReportSelected);
|
||||
|
||||
m_reportModel->initModel(dtc, opmDtc, ppmDtc, ppmGuiCbxIfc);
|
||||
ReportProxyModel *reportProxyModel = new ReportProxyModel(this);
|
||||
reportProxyModel->setSourceModel(m_reportModel);
|
||||
m_ui->reportsDataView->setModel(reportProxyModel);
|
||||
m_ui->reportsDataView->hideColumn(ReportModel::Description);
|
||||
m_ui->reportsDataView->hideColumn(ReportModel::Interval);
|
||||
m_ui->reportsDataView->hideColumn(ReportModel::FileStatus);
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->reportsDataView->hideColumn(ReportModel::Id);
|
||||
#endif
|
||||
#if 0
|
||||
m_ui->pbSetTopicPosition->setEnabled(false);
|
||||
connect(m_ui->pbSetTopicPosition, &QPushButton::clicked, this, [this]()
|
||||
{
|
||||
emit signalSetTopicPosition(m_ui->widget, m_topicData.id);
|
||||
});
|
||||
#else
|
||||
{
|
||||
connect(m_ui->pbSetTopicPosition, &QPushButton::clicked, this, &ReportTopicEditor::onPreview);
|
||||
}
|
||||
#endif
|
||||
setOnlineHelpFilename(QStringLiteral("Script_Editor-Add_Report_Topic"));
|
||||
}
|
||||
|
||||
ReportTopicEditor::~ReportTopicEditor()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE
|
||||
|
||||
void ReportTopicEditor::updateInternalData()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION;
|
||||
|
||||
if (m_topicData.x < 0 && m_topicData.y < 0 && m_topicData.h < 0 && m_topicData.w < 0)
|
||||
{
|
||||
m_topicData.x = 0.05;
|
||||
m_topicData.y = m_topicData.x;
|
||||
m_topicData.h = 1 - (m_topicData.x * 2);
|
||||
m_topicData.w = m_topicData.h;
|
||||
}
|
||||
|
||||
m_ui->reportsDataView->selectionModel()->clear();
|
||||
m_reportId = getTopicDataValue(QStringLiteral("ReportId")).toInt();
|
||||
|
||||
if (m_reportId > 0) // there is a report id saved (not a new topic)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " report id = " << m_reportId;
|
||||
|
||||
QModelIndex idx = m_reportModel->findIndexForId(m_reportId);
|
||||
const ReportManagement::ReportInfo report = m_reportModel->getRowData(idx.row());
|
||||
|
||||
if (idx.isValid())
|
||||
{
|
||||
m_ui->reportsDataView->selectRow(idx);
|
||||
m_ui->lblName->setText(QString::fromStdString(report.name()));
|
||||
m_reportInfo = m_reportModel->getRowData(idx.row());
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " selected report: " << m_reportInfo.name();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->lblName->setText(m_topicData.properties.value(QStringLiteral("ReportId")).toString(QStringLiteral("<font color='red'>%1</font>").arg(tr("unknown"))));
|
||||
}
|
||||
}
|
||||
else // new topic
|
||||
{
|
||||
m_ui->lblName->setText(QStringLiteral("<font color='red'>%1</font>").arg(tr("Please select a valid report")));
|
||||
}
|
||||
|
||||
m_ui->pbSetTopicPosition->setEnabled(!m_topicData.channel.isEmpty() || !m_topicData.parentChannel.isEmpty()); // preview only available if topic is at a screen
|
||||
}
|
||||
|
||||
void ReportTopicEditor::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Report Topic Editor"));
|
||||
|
||||
m_uiRequirements->clear();
|
||||
m_uiRequirements->addRequirement( { m_ui->lbxNamePre, [this]() { return (m_reportId >= 0); }, tr("Invalid or no report selected") } );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE SLOTS
|
||||
|
||||
bool ReportTopicEditor::apply2()
|
||||
{
|
||||
if (m_reportId < 0)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this, tr("Invalid or no report selected"));
|
||||
return false;
|
||||
}
|
||||
|
||||
setTopicDataProperty(QStringLiteral("ReportId"), m_reportId);
|
||||
if (m_ui->widget->description().isEmpty())
|
||||
setDescription(QString::fromStdString(m_reportInfo.name()));
|
||||
else
|
||||
setDescription(m_ui->widget->description());
|
||||
m_ui->widget->previewer()->setTopicData(m_topicData);
|
||||
|
||||
emit changesSaved(m_topicData); // map changes on preview window
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ReportTopicEditor::onReportSelected()
|
||||
{
|
||||
const QModelIndex idx = m_ui->reportsDataView->currentIndex();
|
||||
m_reportInfo = m_reportModel->getRowData(idx.row());
|
||||
m_reportId = m_reportInfo.id();
|
||||
m_ui->lblName->setText(QString::fromStdString(m_reportInfo.name()));
|
||||
slotChangesMade();
|
||||
}
|
||||
/*!
|
||||
* \brief ReportTopicEditor::onPreview
|
||||
* in this Method the scroll area and the widget will be used as parent
|
||||
* A new Object will be created and used instead of the parent. to avoid sofware crashed on preview
|
||||
* setWidget in topic designer: ownership of created scrollArea will be changed there => on delete will be
|
||||
* automatically deleted.
|
||||
*/
|
||||
void ReportTopicEditor::onPreview()
|
||||
{
|
||||
if(m_ui->widget == nullptr)
|
||||
return;
|
||||
TopicEditorBase::TopicPreviewWidget *widget = new TopicEditorBase::TopicPreviewWidget(m_ui->widget);
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
sizePolicy1.setHorizontalStretch(0);
|
||||
sizePolicy1.setVerticalStretch(0);
|
||||
sizePolicy1.setHeightForWidth(widget->sizePolicy().hasHeightForWidth());
|
||||
widget->setSizePolicy(sizePolicy1);
|
||||
widget->setMinimumSize(QSize(0, 60));
|
||||
emit signalSetTopicPosition(widget, m_topicData.id);
|
||||
|
||||
}
|
||||
|
||||
} // namespace ReportManagement
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Topic Editor for the Reports in the Script Editor
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Iuliana Ojog, SLSE, 2018-03-24
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <OperatorManagement/opm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <Plugins/ReportManagement/rep_data_plugin_interface.h>
|
||||
#include <Plugins/ReportManagement/rep_gui_plugin_interface.h>
|
||||
#include <Plugins/ReportManagement/Gui/ReportViewer/rep_report_preview.h>
|
||||
#include <ReportManagement/logger.h>
|
||||
#include <TopicEditorBase/topic_editor_base.h>
|
||||
|
||||
|
||||
namespace Ui { class ReportTopicEditor; }
|
||||
|
||||
|
||||
namespace ReportManagement
|
||||
{
|
||||
|
||||
class ReportModel;
|
||||
|
||||
|
||||
class ReportTopicEditor : public TopicEditorBase::TopicEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReportTopicEditor(
|
||||
const std::shared_ptr<ReportManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc, QWidget *parent = nullptr
|
||||
);
|
||||
~ReportTopicEditor();
|
||||
|
||||
private:
|
||||
void updateInternalData() override final;
|
||||
void retranslate() override final;
|
||||
|
||||
private slots:
|
||||
bool apply2() override final;
|
||||
|
||||
void onReportSelected();
|
||||
void onPreview();
|
||||
|
||||
private:
|
||||
int m_reportId;
|
||||
ReportInfo m_reportInfo;
|
||||
ReportModel *m_reportModel{nullptr};
|
||||
|
||||
Ui::ReportTopicEditor *m_ui{nullptr};
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} // namespace ReportManagement
|
||||
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ReportTopicEditor</class>
|
||||
<widget class="QWidget" name="ReportTopicEditor">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>868</width>
|
||||
<height>388</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Script Editor</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="pbSetTopicPosition">
|
||||
<property name="text">
|
||||
<string>Preview Positioning</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Available Reports:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbxNamePre">
|
||||
<property name="text">
|
||||
<string>Selected Report:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>511</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" rowspan="2" colspan="2">
|
||||
<widget class="TopicEditorBase::TopicPreviewWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" rowspan="3" colspan="4">
|
||||
<widget class="LtsDataView::LtsDataView" name="reportsDataView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="showColumnCount" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolButtonsVisible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TopicEditorBase::TopicPreviewWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>TopicEditorBase/topic_preview_widget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in new issue
Block a user