Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+232
@@ -0,0 +1,232 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* FileManangement - Folder model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Iuliana Ojog, SLSE, 2017-05-11
|
||||
*/
|
||||
|
||||
#include "evl_topic_editor_model.h"
|
||||
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <nglwidgets/ngltreeitem.h>
|
||||
|
||||
#include <Evaluations/evl_translation.h>
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
// TopicEditorEvaluationModel
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
TopicEditorEvaluationModel::TopicEditorEvaluationModel(QObject *parent)
|
||||
: NGLTreeModel(parent, new NGLTreeItem(QVariant()), { tr("Id"), tr("Name"), tr("Weight"), tr("Start Time"), tr("Situation"), tr("Video"), tr("Audio") })
|
||||
, m_logger(getLogger("TopicEditorEvaluationModel"))
|
||||
{}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
QVariant TopicEditorEvaluationModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
|
||||
{
|
||||
switch (section)
|
||||
{
|
||||
case ID:
|
||||
return tr("Id");
|
||||
case WEIGHT:
|
||||
return tr("Weight");
|
||||
case NAME:
|
||||
return tr("Name");
|
||||
case START_TIME:
|
||||
return tr("Start time");
|
||||
case SITUATION:
|
||||
return tr("Situation");
|
||||
case VIDEO:
|
||||
return tr("Video");
|
||||
case AUDIO:
|
||||
return tr("Audio");
|
||||
}
|
||||
}
|
||||
return NGLTreeModel::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
QVariant TopicEditorEvaluationModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!(index.isValid() && (role == Qt::DisplayRole || role == Qt::UserRole)))
|
||||
return QVariant();
|
||||
|
||||
NGLTreeItem *item = privateData(index);
|
||||
if (item->data().canConvert<Evaluations::EvaluationCriterium>())
|
||||
{
|
||||
EvaluationCriterium crt = item->data().value<Evaluations::EvaluationCriterium>();
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
switch (index.column())
|
||||
{
|
||||
case NAME:
|
||||
return QString::fromStdString(crt.name());
|
||||
case ID:
|
||||
return crt.id();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (role == Qt::UserRole)
|
||||
return crt.id();
|
||||
}
|
||||
else if (item->data().canConvert<Evaluations::EvaluationElement>())
|
||||
{
|
||||
|
||||
EvaluationElement elem = item->data().value<Evaluations::EvaluationElement>();
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
switch (index.column())
|
||||
{
|
||||
case ID:
|
||||
return elem.id();
|
||||
case NAME:
|
||||
return QString::fromStdString(elem.note());
|
||||
case WEIGHT:
|
||||
return elem.rating();
|
||||
case SITUATION:
|
||||
return elem.situation() ? tr("Yes") : tr("No");
|
||||
case AUDIO:
|
||||
return elem.audio() ? tr("Yes") : tr("No");
|
||||
case VIDEO:
|
||||
return elem.video() ? tr("Yes") : tr("No");
|
||||
case START_TIME:
|
||||
return QDateTime::fromMSecsSinceEpoch(elem.timestamp());
|
||||
}
|
||||
}
|
||||
else if (role == Qt::UserRole)
|
||||
return elem.id();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
Qt::ItemFlags TopicEditorEvaluationModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
auto ret = NGLTreeModel::flags(index);
|
||||
|
||||
// criteria not selectable
|
||||
NGLTreeItem *item = privateData(index);
|
||||
if (item->data().canConvert<Evaluations::EvaluationCriterium>())
|
||||
ret &= ~Qt::ItemIsSelectable;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
bool TopicEditorEvaluationModel::initModel(const std::shared_ptr<Interface::Dtc> &dtc, int operatorId)
|
||||
{
|
||||
if (!dtc)
|
||||
return false;
|
||||
DEBUG_LOG(m_logger) << "initModel Folder";
|
||||
|
||||
NGLTreeModel::resetModel();
|
||||
|
||||
QHash<int, QModelIndex> parentItemIndexCache;
|
||||
const QMap<qint32, Evaluations::EvaluationCriterium> critMap = dtc->evaluationCriteriums();
|
||||
|
||||
const QMap<qint32, Evaluations::EvaluationElement> elemMap = dtc->evaluationElements();
|
||||
|
||||
parentItemIndexCache.insert(0, QModelIndex()); //root
|
||||
|
||||
for (QMap<qint32, Evaluations::EvaluationCriterium>::const_iterator iter = critMap.constBegin();
|
||||
iter != critMap.constEnd(); ++iter)
|
||||
{
|
||||
int criteriumId = iter.key();
|
||||
|
||||
int parentId = 0;
|
||||
EvaluationCriterium crit = iter.value();
|
||||
|
||||
if (crit.operatorId() != operatorId)
|
||||
continue;
|
||||
|
||||
if (!parentItemIndexCache.contains(parentId))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Invalid folder structure";
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
QModelIndex pIndex = parentItemIndexCache.value(parentId);
|
||||
int rowPos = -1;
|
||||
|
||||
QVariant data;
|
||||
data.setValue(crit);
|
||||
onInsertRow(rowPos, pIndex, data);
|
||||
parentItemIndexCache.insert(criteriumId+10000, index(rowPos, 0, pIndex));
|
||||
DEBUG_LOG(m_logger) << "Added to tree (criterium id, parent id) : (" << criteriumId << ", " << parentId << ")";
|
||||
}
|
||||
|
||||
for (QMap<qint32, Evaluations::EvaluationElement>::const_iterator iter2 = elemMap.constBegin();
|
||||
iter2 != elemMap.constEnd(); ++iter2)
|
||||
{
|
||||
Evaluations::EvaluationElement elem = iter2.value();
|
||||
if (elem.criteriumId() != criteriumId)
|
||||
continue;
|
||||
|
||||
parentId = criteriumId + 10000;
|
||||
|
||||
if (!parentItemIndexCache.contains(parentId))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Invalid folder structure";
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
QModelIndex pIndex = parentItemIndexCache.value(parentId);
|
||||
int rowPos = -1;
|
||||
|
||||
QVariant data;
|
||||
data.setValue(elem);
|
||||
onInsertRow(rowPos, pIndex, data);
|
||||
int elementId = elem.id();
|
||||
parentItemIndexCache.insert(elementId,index(rowPos, 0, pIndex));
|
||||
DEBUG_LOG(m_logger) << "Added to tree (element id, parent id) : (" << elementId << ", " << parentId << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool TopicEditorEvaluationModel::onInsertRow(int &row, const QModelIndex &parent, const QVariant &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onInsertRow";
|
||||
|
||||
row = rowCount(parent);
|
||||
NGLTreeItem *item = new NGLTreeItem(data, QIcon());
|
||||
|
||||
return NGLTreeModel::insertRow(row, parent, item);
|
||||
}
|
||||
|
||||
EvaluationElement TopicEditorEvaluationModel::getEvaluationElement(const QModelIndex &index) const
|
||||
{
|
||||
NGLTreeItem *item = privateData(index);
|
||||
if (item->data().canConvert<EvaluationElement>())
|
||||
return item->data().value<EvaluationElement>();
|
||||
|
||||
return EvaluationElement();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
QModelIndex TopicEditorEvaluationModel::getIndex(const int &elementId) const
|
||||
{
|
||||
QModelIndexList list = match(index(0, 0), Qt::UserRole, QVariant::fromValue(elementId), 1, Qt::MatchRecursive);
|
||||
|
||||
if (!list.isEmpty())
|
||||
return list.first();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace Evaluations
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* FileManangement - Folder Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Iuliana Ojog, SLSE, 2017-05-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <nglwidgets/ngltreemodel.h>
|
||||
|
||||
class QTableWidget;
|
||||
// -------------------------------------------------------------------------------------
|
||||
// TopicEditorEvaluationModel
|
||||
// -------------------------------------------------------------------------------------
|
||||
namespace Evaluations
|
||||
{
|
||||
class TopicEditorEvaluationModel : public NGLTreeModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
NAME = 0,
|
||||
ID,
|
||||
WEIGHT,
|
||||
START_TIME,
|
||||
SITUATION,
|
||||
VIDEO,
|
||||
AUDIO
|
||||
};
|
||||
|
||||
explicit TopicEditorEvaluationModel(QObject *parent);
|
||||
~TopicEditorEvaluationModel() = default;
|
||||
|
||||
bool initModel(const std::shared_ptr<Evaluations::Interface::Dtc> &dtc, int operatorId);
|
||||
|
||||
EvaluationElement getEvaluationElement(const QModelIndex &index) const;
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override final;
|
||||
QVariant data(const QModelIndex &, int) const override final;
|
||||
QModelIndex getIndex(const int &elementId) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
public slots:
|
||||
bool onInsertRow(int &row, const QModelIndex &parent, const QVariant &data);
|
||||
|
||||
private:
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
} // namespace Evaluations
|
||||
Q_DECLARE_METATYPE(Evaluations::EvaluationCriterium)
|
||||
Q_DECLARE_METATYPE(Evaluations::EvaluationElement)
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Topic Editor for the Situation Topic in the Script Editor
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-04-04
|
||||
*/
|
||||
|
||||
#include "topic_editor.h"
|
||||
#include "ui_topic_editor.h"
|
||||
|
||||
#include <LtsScriptTimeline/track_entry.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsUtilsCore/json_object.h>
|
||||
#include <LtsWidgets/lts_combo_box.h>
|
||||
#include <nglwidgets/ngltreeitem.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonParseError>
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
EvaluationTopicEditor::EvaluationTopicEditor(LtsSession::LtsSession *session, QWidget *parent)
|
||||
: TopicEditorBase::TopicEditor(parent)
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::EvaluationTopicEditor)
|
||||
, m_logger(getLogger("EvaluationTopicEditor"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
init(m_ui->widget);
|
||||
setOnlineHelpFilename(QStringLiteral("Script_Editor-Add_Evaluation_Topic"));
|
||||
|
||||
m_ui->cbxOperator->clear();
|
||||
m_ui->widget->setHidden(true);
|
||||
|
||||
connect(m_ui->cbxOperator, static_cast<void (LtsWidgets::LtsComboBox::*)(int)>(&LtsWidgets::LtsComboBox::currentIndexChanged),
|
||||
this, &EvaluationTopicEditor::onOperatorChanged);
|
||||
|
||||
m_model = new TopicEditorEvaluationModel(this);
|
||||
m_ui->trvEvaluations->setModel(m_model);
|
||||
m_ui->trvEvaluations->expandAll();
|
||||
//#ifndef LTS_DEBUG
|
||||
m_ui->trvEvaluations->hideColumn(TopicEditorEvaluationModel::Columns::ID);
|
||||
//#endif
|
||||
|
||||
// SelectionModel
|
||||
QItemSelectionModel *selectionModel = m_ui->trvEvaluations->selectionModel();
|
||||
connect(selectionModel, &QItemSelectionModel::selectionChanged,
|
||||
this, &EvaluationTopicEditor::onSelectionChanged);
|
||||
}
|
||||
|
||||
EvaluationTopicEditor::~EvaluationTopicEditor()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
bool EvaluationTopicEditor::fetchInterfaces()
|
||||
{
|
||||
if (!m_session->getDtc<Evaluations::DataInterface>(m_evlDtc))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Failed to retrieve Evl Dtc";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_session->getForeignGuiInterface<OperatorManagement::ForeignGuiComboboxInterface>(m_opmCbxIfc))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Failed to retrieve Evl ForeignGuiInterface";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_model->initModel(m_evlDtc, m_operatorId);
|
||||
|
||||
// get all Operators without OC and filter out operators without evaluations
|
||||
initOperatorComboBox();
|
||||
|
||||
DEBUG_LOG(m_logger) << "fillOperatorComboBox m_operatorId = " << m_operatorId;
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE
|
||||
|
||||
void EvaluationTopicEditor::updateInternalData()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION;
|
||||
|
||||
if (!hasTopicDataProperties())
|
||||
return;
|
||||
|
||||
m_operatorId = getTopicDataValue(QStringLiteral("operatorId")).toInt();
|
||||
DEBUG_LOG(m_logger) << "operator id = " << m_operatorId;
|
||||
|
||||
m_ui->cbxOperator->setCurrentIndex(m_ui->cbxOperator->findData(m_operatorId));
|
||||
m_model->initModel(m_evlDtc, m_operatorId);
|
||||
|
||||
m_evlElement.id(getTopicDataValue(QStringLiteral("elementId")).toDouble());
|
||||
DEBUG_LOG(m_logger) << "element id = " << m_evlElement.id();
|
||||
m_evlElement.timestamp(getTopicDataValue(QStringLiteral("start")).toDouble());
|
||||
m_evlElement.situation(getTopicDataValue(QStringLiteral("situation")).toBool());
|
||||
m_evlElement.audio(getTopicDataValue(QStringLiteral("audio")).toBool());
|
||||
m_evlElement.video(getTopicDataValue(QStringLiteral("video")).toBool());
|
||||
|
||||
selectElement();
|
||||
}
|
||||
|
||||
void EvaluationTopicEditor::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Evaluation Topic Editor"));
|
||||
}
|
||||
|
||||
|
||||
void EvaluationTopicEditor::selectElement()
|
||||
{
|
||||
QModelIndex idx;
|
||||
QItemSelectionModel *selectionModel = m_ui->trvEvaluations->selectionModel();
|
||||
if (m_evlElement.id() > 0)
|
||||
idx = m_model->getIndex(m_evlElement.id());
|
||||
if (idx.isValid())
|
||||
selectionModel->setCurrentIndex(idx, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
||||
else
|
||||
selectionModel->setCurrentIndex(m_model->index(0, 0), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
||||
}
|
||||
|
||||
void EvaluationTopicEditor::initOperatorComboBox()
|
||||
{
|
||||
m_opmCbxIfc->fillOperatorComboBox(m_ui->cbxOperator);
|
||||
m_operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
|
||||
QMap<int, EvaluationCriterium> evaluationCriteria = m_evlDtc->evaluationCriteriums();
|
||||
for (int index = m_ui->cbxOperator->count() - 1; index >= 0; --index)
|
||||
{
|
||||
int operatorId = m_ui->cbxOperator->itemData(index).toInt();
|
||||
|
||||
if (operatorId == m_operatorId) // NOTE: this will ensure that the combo box is not empty
|
||||
continue;
|
||||
|
||||
auto it = std::find_if(evaluationCriteria.constBegin(), evaluationCriteria.constEnd(), [this, operatorId](const EvaluationCriterium &ec)
|
||||
{
|
||||
return ec.operatorId() == operatorId;
|
||||
});
|
||||
if (it == evaluationCriteria.constEnd())
|
||||
m_ui->cbxOperator->removeItem(index);
|
||||
}
|
||||
m_ui->cbxOperator->setCurrentIndex(m_ui->cbxOperator->findData(m_operatorId));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE SLOTS
|
||||
|
||||
bool EvaluationTopicEditor::apply2()
|
||||
{
|
||||
setTopicDataProperty(QStringLiteral("operatorId"), m_operatorId);
|
||||
setTopicDataProperty(QStringLiteral("elementId"), m_evlElement.id());
|
||||
setTopicDataProperty(QStringLiteral("start"), m_evlElement.timestamp());
|
||||
setTopicDataProperty(QStringLiteral("situation"), m_evlElement.situation());
|
||||
setTopicDataProperty(QStringLiteral("audio"), m_evlElement.audio());
|
||||
setTopicDataProperty(QStringLiteral("video"), m_evlElement.video());
|
||||
|
||||
DEBUG_LOG(m_logger) << "operator id = " << m_operatorId << ", element id = " << m_evlElement.id();
|
||||
DEBUG_LOG(m_logger) << "timestamp: " << m_evlElement.timestamp();
|
||||
|
||||
if (m_evlElement.situation())
|
||||
{
|
||||
TopicEditorBase::TopicData data;
|
||||
data.topicType = TopicEditorBase::TopicType::Situation;
|
||||
setTopicDataProperty(QStringLiteral("end"), m_evlElement.timestamp() + m_evlElement.duration() * 1000);
|
||||
setTopicDataProperty(QStringLiteral("speed"), 1.0);
|
||||
|
||||
if (m_evlElement.situationContent())
|
||||
{
|
||||
QJsonParseError error;
|
||||
QJsonDocument doc(QJsonDocument::fromJson(QString::fromStdString(m_evlElement.situationContent().get()).toUtf8(), &error));
|
||||
|
||||
if (error.error == QJsonParseError::NoError)
|
||||
{
|
||||
QJsonObject root(doc.object());
|
||||
setTopicDataProperty(QStringLiteral("filters"), root[QStringLiteral("filters")]);
|
||||
setTopicDataProperty(QStringLiteral("settings"), root[QStringLiteral("settings")]);
|
||||
}
|
||||
else
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("The selected marker has invalid filter and/or map settings."));
|
||||
}
|
||||
|
||||
data.duration = m_evlElement.duration();
|
||||
data.properties = m_topicData.properties;
|
||||
|
||||
DEBUG_LOG(m_logger) << "topicData - properties: " << QJsonDocument(m_topicData.properties).toJson(QJsonDocument::Compact);
|
||||
|
||||
emit topicEditorRequested(data);
|
||||
}
|
||||
|
||||
if (m_evlElement.audio())
|
||||
{
|
||||
TopicEditorBase::TopicData data;
|
||||
data.topicType = TopicEditorBase::TopicType::Audio;
|
||||
setTopicDataProperty(QStringLiteral("end"), m_evlElement.timestamp() + m_evlElement.duration() * 1000);
|
||||
LtsUtils::JsonObject jsonObj = LtsUtils::JsonObject::fromJson(m_evlElement.audioContent().get());
|
||||
setTopicDataProperty(QStringLiteral("stream"), jsonObj.value<QString>("actualStream"));
|
||||
data.duration = m_evlElement.duration();
|
||||
data.properties = m_topicData.properties;
|
||||
emit topicEditorRequested(data);
|
||||
}
|
||||
|
||||
if (m_evlElement.video())
|
||||
{
|
||||
LtsUtils::JsonObject jsonObj = LtsUtils::JsonObject::fromJson(m_evlElement.videoContent().get());
|
||||
TopicEditorBase::TopicData data;
|
||||
data.topicType = TopicEditorBase::TopicType::Video;
|
||||
setTopicDataProperty(QStringLiteral("end"), m_evlElement.timestamp() + m_evlElement.duration() * 1000);
|
||||
setTopicDataProperty(QStringLiteral("stream"), jsonObj.value<QString>("actualStream"));
|
||||
data.duration = m_evlElement.duration();
|
||||
data.properties = m_topicData.properties;
|
||||
emit topicEditorRequested(data);
|
||||
}
|
||||
|
||||
// TODO: Audio/Video Topic
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void EvaluationTopicEditor::onOperatorChanged()
|
||||
{
|
||||
m_operatorId = m_ui->cbxOperator->currentData().toInt();
|
||||
DEBUG_LOG(m_logger) << "operator id = " << m_operatorId;
|
||||
|
||||
m_model->initModel(m_evlDtc, m_operatorId);
|
||||
m_ui->trvEvaluations->expandAll();
|
||||
}
|
||||
|
||||
void EvaluationTopicEditor::onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
|
||||
{
|
||||
Q_UNUSED(selected);
|
||||
Q_UNUSED(deselected);
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION;
|
||||
|
||||
QModelIndex index = m_ui->trvEvaluations->currentIndex();
|
||||
m_evlElement = m_model->getEvaluationElement(index);
|
||||
DEBUG_LOG(m_logger) << "element id = " << m_evlElement.id();
|
||||
|
||||
m_topicData.description = QString::number(m_evlElement.id());
|
||||
slotChangesMade(); // Enable Apply
|
||||
}
|
||||
|
||||
|
||||
} // namespace Evaluations
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Topic Editor for the Situation Topic in the Script Editor
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-04-04
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "evl_topic_editor_model.h"
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <Plugins/Evaluations/evl_data_plugin_interface.h>
|
||||
#include <Plugins/OperatorManagement/opm_gui_combobox_plugin_interface.h>
|
||||
#include <TopicEditorBase/topic_editor_base.h>
|
||||
|
||||
|
||||
namespace Ui { class EvaluationTopicEditor; }
|
||||
|
||||
namespace LtsScriptTimeline { class TrackEntry; }
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class EvaluationTopicEditor : public TopicEditorBase::TopicEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EvaluationTopicEditor(LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~EvaluationTopicEditor();
|
||||
|
||||
void selected();
|
||||
bool fetchInterfaces();
|
||||
|
||||
private:
|
||||
void updateInternalData() override final;
|
||||
void retranslate() override final;
|
||||
|
||||
void selectElement();
|
||||
void initOperatorComboBox();
|
||||
|
||||
private slots:
|
||||
bool apply2() override final;
|
||||
|
||||
void onOperatorChanged();
|
||||
void onSelectionChanged(const QItemSelection & /*selected*/, const QItemSelection & /*deselected*/);
|
||||
|
||||
private:
|
||||
LtsSession::LtsSession *m_session{nullptr};
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> m_evlDtc{nullptr};
|
||||
std::shared_ptr<OperatorManagement::ForeignGuiComboboxInterface> m_opmCbxIfc{nullptr};
|
||||
|
||||
int m_operatorId{0};
|
||||
EvaluationElement m_evlElement;
|
||||
TopicEditorEvaluationModel *m_model{nullptr};
|
||||
|
||||
Ui::EvaluationTopicEditor *m_ui{nullptr};
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace FileManagement
|
||||
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EvaluationTopicEditor</class>
|
||||
<widget class="QWidget" name="EvaluationTopicEditor">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>838</width>
|
||||
<height>525</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">File Topic Editor</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="TopicEditorBase::TopicPreviewWidget" name="widget" native="true"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblSelectedFile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Operator:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbxOperator">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="LtsDataView::LtsDataView" name="trvEvaluations"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
<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