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>
|
||||
+212
@@ -0,0 +1,212 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Evaluations - Crtierium Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, SLSE, 2017-11-01
|
||||
*/
|
||||
|
||||
#include "evl_dialog.h"
|
||||
#include "ui_evl_dialog.h"
|
||||
#include "evl_model.h"
|
||||
#include "evl_edit_dialog.h"
|
||||
#include "evl_element_dialog.h"
|
||||
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
CriteriumDialog::CriteriumDialog(const QString &menuGroup, LtsSession::LtsSession *session, bool ownEvlElements, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_model(new CriteriumDialogModel(this))
|
||||
, m_proxyModel(new CriteriumFilterModel(this))
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::CriteriumDialog)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_ownEvaluationElements(ownEvlElements)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("CriteriumDialog"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog ctor";
|
||||
m_ui->setupUi(this);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &CriteriumDialog::onPrint);
|
||||
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
|
||||
if (ownEvlElements)
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Own_Evaluation_Criteria"));
|
||||
else
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-All_Evaluation_Criteria"));
|
||||
}
|
||||
|
||||
CriteriumDialog::~CriteriumDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void CriteriumDialog::retranslate()
|
||||
{
|
||||
if (m_ownEvaluationElements)
|
||||
translate(m_ui, tr("Own Evaluation Criteria"));
|
||||
else
|
||||
translate(m_ui, tr("All Evaluation Criteria"));
|
||||
}
|
||||
|
||||
void CriteriumDialog::enaDisa()
|
||||
{
|
||||
int selected = m_ui->widget->selectedRows().size();
|
||||
|
||||
const QModelIndex srcIdx = m_ui->widget->currentIndex();
|
||||
int operatorId = m_model->getRowData(srcIdx.row()).operatorId();
|
||||
|
||||
if (m_currentOperatorId == operatorId)
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Load, true && selected == 1);
|
||||
else
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Load, false);
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Add, true);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, (selected == 1));
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, (selected > 0));
|
||||
|
||||
}
|
||||
void CriteriumDialog::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView() );
|
||||
}
|
||||
|
||||
|
||||
void CriteriumDialog::editCriterium(int criteriumId)
|
||||
{
|
||||
addDialog(LtsWidgets::initDialog(new CriteriumEditDialog(),
|
||||
criteriumId,
|
||||
m_session, m_dtc, m_ftc, m_opmCbxDtc),
|
||||
m_menuGroup, QStringLiteral("CriteriumEditDialog%1").arg(criteriumId), LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
|
||||
void CriteriumDialog::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
void CriteriumDialog::slotAdd()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog::slotAdd";
|
||||
editCriterium(0 /* new */);
|
||||
}
|
||||
|
||||
void CriteriumDialog::slotEdit()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog::slotEdit";
|
||||
|
||||
const QModelIndex srcIdx = m_ui->widget->currentIndex();
|
||||
editCriterium(m_model->getRowData(srcIdx.row()).id() /* existing - edit criterium */);
|
||||
}
|
||||
|
||||
void CriteriumDialog::slotRemove()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog::slotRemove";
|
||||
const QModelIndex selIndex = m_ui->widget->currentIndex();
|
||||
if (!selIndex.isValid())
|
||||
return;
|
||||
|
||||
Core::RemoveElementRequest req(m_model->getRowData(selIndex.row()).id());
|
||||
DEBUG_LOG(m_logger) << "Removing criterium id = " << req.id();
|
||||
m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ftc->evlCriteriumRemoveRequest(req, this);
|
||||
});
|
||||
|
||||
if (m_requestHelper->failed())
|
||||
ERROR_LOG(m_logger) << "Failed to remove criterium";
|
||||
}
|
||||
|
||||
|
||||
void CriteriumDialog::slotEditElements()
|
||||
{
|
||||
const QModelIndex selIndex = m_ui->widget->currentIndex();
|
||||
if (!selIndex.isValid())
|
||||
return;
|
||||
|
||||
int criteriumId = m_model->getRowData(selIndex.row()).id();
|
||||
addDialog(LtsWidgets::initDialog(new ElementDialog(),
|
||||
criteriumId,
|
||||
m_exerciseId, m_menuGroup, m_dtc, m_ftc, m_exmDtc, m_avmDataIfc, m_fltParticipantIfc, m_fltAesIfc, m_fltBuildingComponentIfc, m_session),
|
||||
m_menuGroup, ElementDialog::dialogIdentifier() + QString::number(criteriumId), LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
|
||||
bool CriteriumDialog::init(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
|
||||
const std::shared_ptr<OperatorManagement::ForeignGuiComboboxInterface> &opmCbxDtc,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignDataInterface> &avmDataIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltParticipantGuiInterface> &fltParticipantIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignAesGuiInterface> &fltAesIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltBuildingComponentGuiInterface> &fltBuildingComponentIfc,
|
||||
int exerciseId,
|
||||
int currentOperatorId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog::init";
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
m_opmCbxDtc = opmCbxDtc;
|
||||
m_exmDtc = exmDtc;
|
||||
m_avmDataIfc = avmDataIfc;
|
||||
m_fltParticipantIfc = fltParticipantIfc;
|
||||
m_fltAesIfc = fltAesIfc;
|
||||
m_fltBuildingComponentIfc = fltBuildingComponentIfc;
|
||||
m_exerciseId = exerciseId;
|
||||
m_currentOperatorId = currentOperatorId;
|
||||
|
||||
m_model->initModel(dtc, opmDtc);
|
||||
|
||||
if (m_ownEvaluationElements)
|
||||
m_proxyModel->setOperatorId(m_currentOperatorId);
|
||||
|
||||
m_ui->widget->setModel(m_proxyModel);
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->widget->hideColumn(CriteriumDialogModel::Id);
|
||||
#endif
|
||||
|
||||
m_ui->widget->setSortIndicator(CriteriumDialogModel::Name, Qt::AscendingOrder);
|
||||
|
||||
QMap<qint32, Evaluations::EvaluationCriterium> criteria = m_dtc->evaluationCriteriums();
|
||||
|
||||
for (auto i = criteria.constBegin(); i != criteria.constEnd(); ++i)
|
||||
{
|
||||
const EvaluationCriterium &p = (*i);
|
||||
DEBUG_LOG(m_logger) << "Criterium: id = " << p.id() << ", name = " << p.name().c_str() << ", desc = " << p.description().c_str();
|
||||
}
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged, this, &CriteriumDialog::enaDisa, Qt::UniqueConnection);
|
||||
|
||||
if (!m_ownEvaluationElements)
|
||||
{
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, this, &CriteriumDialog::slotAdd, Qt::UniqueConnection);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &CriteriumDialog::slotEdit, Qt::UniqueConnection);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &CriteriumDialog::slotRemove, Qt::UniqueConnection);
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked, this, &CriteriumDialog::slotEdit, Qt::UniqueConnection);
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalEnterPressed, this, &CriteriumDialog::slotEdit, Qt::UniqueConnection);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Load, this, &CriteriumDialog::slotEditElements, Qt::UniqueConnection);
|
||||
m_buttonBox->setText(LtsWidgets::DialogButton::Load, tr("Edit Elements"));
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked, this, &CriteriumDialog::slotEditElements, Qt::UniqueConnection);
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalEnterPressed, this, &CriteriumDialog::slotEditElements, Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
enaDisa();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Evaluations
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Evaluations - Script Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-15
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
#include <OperatorManagement/opm_dtc.h>
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
#include <Plugins/OperatorManagement/opm_gui_combobox_plugin_interface.h>
|
||||
#include <Plugins/FilterManagement/flt_participant_plugin_interface.h>
|
||||
#include <Plugins/FilterManagement/flt_aes_plugin_interface.h>
|
||||
#include <Plugins/FilterManagement/flt_building_cmpnt_plugin_interface.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CriteriumDialog;
|
||||
}
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class CriteriumDialogModel;
|
||||
class CriteriumFilterModel;
|
||||
|
||||
class CriteriumDialog : public LtsWidgets::LtsDialog
|
||||
, protected Interface::Ftc::EvlCriteriumModifyReplyHandler
|
||||
, protected Interface::Ftc::EvlCriteriumRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CriteriumDialog(const QString &menuGroup, LtsSession::LtsSession *session, bool ownEvlElements, QWidget *parent = nullptr);
|
||||
~CriteriumDialog();
|
||||
|
||||
bool init(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
|
||||
const std::shared_ptr<OperatorManagement::ForeignGuiComboboxInterface> &opmCbxDtc,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignDataInterface> &avmDataIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltParticipantGuiInterface> &fltParticipantIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignAesGuiInterface> &fltAesIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltBuildingComponentGuiInterface> &fltBuildingComponentIfc,
|
||||
int exerciseId,
|
||||
int currentOperatorId);
|
||||
|
||||
protected:
|
||||
void onEvlCriteriumModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onEvlCriteriumRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onPrint();
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void editCriterium(int criteriumId);
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
CriteriumDialogModel *m_model{nullptr};
|
||||
CriteriumFilterModel *m_proxyModel{nullptr};
|
||||
LtsSession::LtsSession *m_session{nullptr};
|
||||
Ui::CriteriumDialog *m_ui{nullptr};
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<Evaluations::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
|
||||
std::shared_ptr<OperatorManagement::ForeignGuiComboboxInterface> m_opmCbxDtc;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
std::shared_ptr<AudioVideoManagement::ForeignDataInterface> m_avmDataIfc;
|
||||
std::shared_ptr<FilterManagement::ForeignFltParticipantGuiInterface> m_fltParticipantIfc;
|
||||
std::shared_ptr<FilterManagement::ForeignAesGuiInterface> m_fltAesIfc;
|
||||
std::shared_ptr<FilterManagement::ForeignFltBuildingComponentGuiInterface> m_fltBuildingComponentIfc;
|
||||
QString m_menuGroup;
|
||||
int m_exerciseId{-1};
|
||||
int m_currentOperatorId{-1};
|
||||
bool m_ownEvaluationElements{false};
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
|
||||
LOGGER_T m_logger;
|
||||
|
||||
private slots:
|
||||
void slotAdd();
|
||||
void slotEdit();
|
||||
void slotRemove();
|
||||
void enaDisa();
|
||||
void slotEditElements();
|
||||
|
||||
};
|
||||
|
||||
} // namespace Evaluations
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CriteriumDialog</class>
|
||||
<widget class="QWidget" name="CriteriumDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Evaluation Criteria</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="LtsDataView::LtsDataView" name="widget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</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>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Evaluations - Criterium Create / Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, SLSE, 2017-11-01
|
||||
*/
|
||||
|
||||
#include "evl_edit_dialog.h"
|
||||
#include "ui_evl_edit_dialog.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <Evaluations/evl_translation.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <FileManagement/flm_translation.h>
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
CriteriumEditDialog::CriteriumEditDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkCancel)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_ui(new Ui::CriteriumEditDialog)
|
||||
, m_logger(getLogger("CriteriumEditDialog"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumEditDialog ctor";
|
||||
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_uiRequirements->addRequirement({ m_ui->lblName, [this]() { return !m_ui->leName->text().isEmpty(); } });
|
||||
}
|
||||
|
||||
CriteriumEditDialog::~CriteriumEditDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void CriteriumEditDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, m_dtc->evaluationCriterium(m_criteriumId), tr("Criterium"));
|
||||
}
|
||||
|
||||
bool CriteriumEditDialog::init(int criteriumId,
|
||||
LtsSession::LtsSession *session,
|
||||
const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<OperatorManagement::ForeignGuiComboboxInterface> &opmCbxDtc)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumEditDialog::init";
|
||||
m_criteriumId = criteriumId;
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
m_session = session;
|
||||
|
||||
opmCbxDtc->fillOperatorComboBox(m_ui->cbxOperators);
|
||||
|
||||
if (m_criteriumId > 0) //edit
|
||||
{
|
||||
Evaluations::EvaluationCriterium eval = m_dtc->evaluationCriterium(m_criteriumId);
|
||||
m_ui->leName->setText(QString::fromStdString(eval.name()));
|
||||
m_ui->teDesc->setText(QString::fromStdString(eval.description()));
|
||||
|
||||
m_ui->cbxOperators->setCurrentIndex(m_ui->cbxOperators->findData(eval.operatorId()));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->cbxOperators->setCurrentIndex(m_ui->cbxOperators->findData(LtsSessionData::LtsSessionData::getInstance()->getOperatorId()));
|
||||
}
|
||||
|
||||
m_ui->leName->setFocus();
|
||||
|
||||
// Save/Load from Library Button
|
||||
m_buttonBox->connectLibraryButton(this, &CriteriumEditDialog::onImportButtonClicked,
|
||||
&CriteriumEditDialog::onExportButtonClicked);
|
||||
|
||||
if (!m_session->getForeignGuiInterface<FileManagement::ForeignGuiInterface>(m_flmGui))
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Library, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CriteriumEditDialog::apply()
|
||||
{
|
||||
// prepare request
|
||||
EvlCriteriumModifyRequest req;
|
||||
req.id(m_criteriumId);
|
||||
req.name(m_ui->leName->text().toStdString());
|
||||
req.description(m_ui->teDesc->toPlainText().toStdString());
|
||||
req.operatorId(m_ui->cbxOperators->currentData().toInt());
|
||||
|
||||
return m_requestHelper->startSingleRequest([this, req]()
|
||||
{
|
||||
return m_ftc->evlCriteriumModifyRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
QByteArray CriteriumEditDialog::UiToJson()
|
||||
{
|
||||
QJsonObject obj;
|
||||
obj[QStringLiteral("XmlType")] = FileManagement::toString(FileManagement::XmlType::EVLCriteriumEdit);
|
||||
obj[QStringLiteral("Name")] = m_ui->leName->text();
|
||||
obj[QStringLiteral("Description")] = m_ui->teDesc->toPlainText();
|
||||
obj[QStringLiteral("OperatorId")] = m_ui->cbxOperators->currentData().toInt();
|
||||
|
||||
return QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
} // end UiToJson
|
||||
|
||||
void CriteriumEditDialog::jsonToUi(const QByteArray &content)
|
||||
{
|
||||
// TODO: check for json error ...
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content));
|
||||
const QJsonObject obj(doc.object());
|
||||
|
||||
QString name = obj[QStringLiteral("Name")].toString();
|
||||
QString description = obj[QStringLiteral("Description")].toString();;
|
||||
int operatorId = obj[QStringLiteral("OperatorId")].toInt();
|
||||
|
||||
m_ui->leName->setText(name);
|
||||
m_ui->teDesc->setText(description);
|
||||
m_ui->cbxOperators->setCurrentIndex(m_ui->cbxOperators->findData(operatorId));
|
||||
} // end jsonToUi
|
||||
|
||||
void CriteriumEditDialog::onExportButtonClicked()
|
||||
{
|
||||
QByteArray byteArray = UiToJson();
|
||||
|
||||
int fileId = m_flmGui->saveFileContent(this, FileManagement::FileType::Xml, m_session->exerciseId(), byteArray);
|
||||
if (fileId > 0)
|
||||
DEBUG_LOG(m_logger) << "Saved file with id = " << fileId;
|
||||
else
|
||||
ERROR_LOG(m_logger) << "Could not save file in library ";
|
||||
}
|
||||
|
||||
void CriteriumEditDialog::onImportButtonClicked()
|
||||
{
|
||||
QByteArray content;
|
||||
int fileId = m_flmGui->loadFileContent(this, content, {FileManagement::FileType::Xml}, m_session->exerciseId(), FileManagement::toString(FileManagement::XmlType::EVLCriteriumEdit));
|
||||
if (fileId > 0)
|
||||
{
|
||||
if (!m_flmGui->isXmlType(content, FileManagement::toString(FileManagement::XmlType::EVLCriteriumEdit)))
|
||||
{
|
||||
QHash<LtsWidgets::Button, QString> texts({{LtsWidgets::Button::Yes, tr("Ok")}});
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this,
|
||||
tr("Invalid xml file content"),
|
||||
windowTitle(),
|
||||
LtsWidgets::Behaviour::Modal,
|
||||
LtsWidgets::Button::Yes,
|
||||
texts);
|
||||
}
|
||||
else
|
||||
{
|
||||
jsonToUi(content);
|
||||
}
|
||||
}
|
||||
} // end onImportButtonClicked
|
||||
|
||||
} // namespace Evaluations
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Evaluations - Script Create / Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-20
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <OperatorManagement/opm_dtc.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#include <Plugins/OperatorManagement/opm_gui_combobox_plugin_interface.h>
|
||||
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
class UiRequirementList;
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CriteriumEditDialog;
|
||||
}
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class CriteriumEditDialog : public LtsWidgets::LtsDialog
|
||||
, protected Interface::Ftc::EvlCriteriumModifyReplyHandler
|
||||
, protected Interface::Ftc::EvlCriteriumRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CriteriumEditDialog(QWidget *parent = nullptr);
|
||||
~CriteriumEditDialog();
|
||||
|
||||
bool init(int criteriumId,
|
||||
LtsSession::LtsSession *session,
|
||||
const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<OperatorManagement::ForeignGuiComboboxInterface> &opmCbxDtc);
|
||||
|
||||
protected:
|
||||
void onEvlCriteriumModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onEvlCriteriumRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
private slots:
|
||||
void onExportButtonClicked();
|
||||
void onImportButtonClicked();
|
||||
|
||||
private:
|
||||
bool apply() override;
|
||||
void retranslate() override;
|
||||
QByteArray UiToJson();
|
||||
void jsonToUi(const QByteArray &content);
|
||||
|
||||
LtsSession::LtsSession *m_session{nullptr};
|
||||
std::shared_ptr<Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
|
||||
int m_criteriumId{-1};
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
Ui::CriteriumEditDialog *m_ui{nullptr};
|
||||
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CriteriumEditDialog</class>
|
||||
<widget class="QWidget" name="CriteriumEditDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>662</width>
|
||||
<height>295</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Evaluation Criteria Editor</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblName">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leName">
|
||||
<property name="toolTip">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblDesc">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QTextEdit" name="teDesc"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblOperator">
|
||||
<property name="text">
|
||||
<string>Operator:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbxOperators"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,335 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Evaluations - Criterium Create / Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, SLSE, 2017-11-01
|
||||
*/
|
||||
|
||||
#include "evl_edit_element_dialog.h"
|
||||
#include "ui_evl_edit_element_dialog.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsWidgets/lts_base_layout_widget.h>
|
||||
#include <Evaluations/evl_translation.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
#include <AudioVideoManagement/ava_state.h>
|
||||
#include <AudioVideoManagement/stream_name_mapping.h>
|
||||
#include <FilterManagement/flt_data_plugin_aes_display_filter.h>
|
||||
#include <FilterManagement/flt_symbol_appearance_settings.h>
|
||||
#include <FilterManagement/flt_building_cmpnt_settings.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
ElementEditDialog::ElementEditDialog(QWidget *)
|
||||
: LtsWidgets::LtsDialog(nullptr, LtsWidgets::ButtonCombination::OkCancel)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_ui(new Ui::ElementEditDialog)
|
||||
, m_logger(getLogger("ElementEditDialog"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ElementEditDialog ctor";
|
||||
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->cbSituation, &QCheckBox::clicked, this, &ElementEditDialog::onCheckBoxClicked);
|
||||
connect(m_ui->cbVideo, &QCheckBox::clicked, this, &ElementEditDialog::onCheckBoxClicked);
|
||||
connect(m_ui->cbAudio, &QCheckBox::clicked, this, &ElementEditDialog::onCheckBoxClicked);
|
||||
|
||||
connect(m_ui->cbVideo, &QCheckBox::stateChanged, this, &ElementEditDialog::onVideoClicked);
|
||||
connect(m_ui->cbAudio, &QCheckBox::stateChanged, this, &ElementEditDialog::onAudioClicked);
|
||||
|
||||
m_uiRequirements->addRequirement({m_ui->lblMedium, [this]() { return m_ui->cbSituation->isChecked() ||
|
||||
(m_ui->cbAudio->isChecked() && !m_audioStreams.isEmpty()) ||
|
||||
(m_ui->cbVideo->isChecked() && !m_videoStreams.isEmpty()); },
|
||||
tr("Select one or more media. If you have selected audio or video, make sure that a audio / video stream has been selected.") });
|
||||
}
|
||||
|
||||
|
||||
ElementEditDialog::~ElementEditDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void ElementEditDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, m_dtc->evaluationCriterium(m_criteriumId), tr("Criterium Element"));
|
||||
}
|
||||
|
||||
|
||||
bool ElementEditDialog::init(int elementId,
|
||||
int criteriumId,
|
||||
int exerciseId,
|
||||
const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignDataInterface> &avmDataIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltParticipantGuiInterface> &fltParticipantIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignAesGuiInterface> &fltAesIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltBuildingComponentGuiInterface> &fltBuildingComponentIfc,
|
||||
LtsSession::LtsSession *session)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ElementEditDialog::init";
|
||||
m_elementId = elementId;
|
||||
m_criteriumId = criteriumId;
|
||||
m_exerciseId = exerciseId;
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
m_exmDtc = exmDtc;
|
||||
m_avmDataIfc = avmDataIfc;
|
||||
m_fltParticipantIfc = fltParticipantIfc;
|
||||
m_fltAesIfc = fltAesIfc;
|
||||
m_fltBuildingComponentIfc = fltBuildingComponentIfc;
|
||||
m_session = session;
|
||||
|
||||
for (int i = 1; i <= 10; ++i)
|
||||
m_ui->cbxRating->addItem(QString::number(i), i);
|
||||
|
||||
fillPhasesComboBox();
|
||||
|
||||
if (m_elementId > 0) //edit
|
||||
{
|
||||
Evaluations::EvaluationElement eval = m_dtc->evaluationElement(m_elementId);
|
||||
m_ui->cbxRating->setCurrentIndex(m_ui->cbxRating->findData(eval.rating()));
|
||||
m_ui->teDesc->setText(QString::fromStdString(eval.note()));
|
||||
m_ui->lblStartTime->setText(DTG::toStringMSec(eval.timestamp()));
|
||||
ERROR_LOG(m_logger) << "set start time label to " << m_ui->lblStartTime->text();
|
||||
m_startTime = eval.timestamp();
|
||||
|
||||
m_ui->cbSituation->setChecked(eval.situation());
|
||||
m_ui->cbVideo->setChecked(eval.video());
|
||||
m_ui->cbAudio->setChecked(eval.audio());
|
||||
|
||||
m_ui->cbxPhase->setCurrentIndex(m_ui->cbxPhase->findData(eval.phaseId()));
|
||||
}
|
||||
|
||||
if (m_avmDataIfc && m_avmDataIfc->hasAvsSession())
|
||||
{
|
||||
onAudioClicked();
|
||||
onVideoClicked();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Someone else has access to the AvaSession in a different exercise context -- or we don't even have the AVM-Plugin.
|
||||
// Disable all Video/Audio stuff
|
||||
m_ui->cbxVideoChannel->setEnabled(false);
|
||||
m_ui->cbxRadioCircuit->setEnabled(false);
|
||||
}
|
||||
|
||||
if (m_avmDataIfc && m_avmDataIfc->hasAvsSession())
|
||||
{
|
||||
m_videoStreams = m_avmDataIfc->avaState()->currentLiveVideoStreams();
|
||||
|
||||
if ( m_videoStreams.size() > 0 )
|
||||
m_ui->cbVideo->setEnabled( true );
|
||||
else
|
||||
m_ui->cbVideo->setEnabled( false );
|
||||
|
||||
m_audioStreams = m_avmDataIfc->avaState()->getRtProfile();
|
||||
|
||||
if ( m_audioStreams.size() > 0 )
|
||||
m_ui->cbAudio->setEnabled( true );
|
||||
else
|
||||
m_ui->cbAudio->setEnabled( false );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ElementEditDialog::onReturnPressed()
|
||||
{
|
||||
// if (m_ui->ltsDialogButtonBox->getButton(LtsWidgets::DialogButton::Add)->isEnabled())
|
||||
// m_ui->ltsDialogButtonBox->getButton(LtsWidgets::DialogButton::Add)->setFocus();
|
||||
}
|
||||
|
||||
|
||||
bool ElementEditDialog::apply()
|
||||
{
|
||||
// prepare request
|
||||
EvlElementModifyRequest req;
|
||||
req.id(m_elementId);
|
||||
req.criteriumId(m_criteriumId);
|
||||
req.rating(m_ui->cbxRating->currentData().toInt());
|
||||
req.note(m_ui->teDesc->toPlainText().toStdString());
|
||||
req.timestamp(m_startTime);
|
||||
req.duration((QDateTime::currentMSecsSinceEpoch() - m_startTime) / 1000);
|
||||
req.phaseId(m_ui->cbxPhase->currentData().toInt());
|
||||
|
||||
QJsonObject obj;
|
||||
if (m_ui->cbSituation->isChecked())
|
||||
{
|
||||
QJsonObject root;
|
||||
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> sitMapIfc;
|
||||
if (m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(sitMapIfc))
|
||||
root[QStringLiteral("settings")] = sitMapIfc->operatorMapSettings();
|
||||
else
|
||||
ERROR_LOG(m_logger) << "sit map ifc not available, can't save map settings :(";
|
||||
|
||||
root[QStringLiteral("filters")] = getFilterSettings();
|
||||
|
||||
req.situationContent().set(QJsonDocument(root).toJson().constData());
|
||||
}
|
||||
|
||||
if (m_ui->cbVideo->isChecked() && m_ui->cbxVideoChannel->currentData().isValid())
|
||||
{
|
||||
obj[QStringLiteral("actualStream")] = QJsonValue(m_ui->cbxVideoChannel->currentData().toString());
|
||||
obj[QStringLiteral("allStreams")] = QJsonValue(QString(m_videoStreams.join(QStringLiteral(", "))));
|
||||
req.videoContent().set(QJsonDocument(obj).toJson().constData());
|
||||
}
|
||||
|
||||
if (m_ui->cbAudio->isChecked() && !m_ui->cbxRadioCircuit->currentText().isNull())
|
||||
{
|
||||
obj[QStringLiteral("actualStream")] = QJsonValue(m_ui->cbxRadioCircuit->currentText());
|
||||
obj[QStringLiteral("allStreams")] = QJsonValue(QString(m_audioStreams.join(QStringLiteral(", "))));
|
||||
req.audioContent().set(QJsonDocument(obj).toJson().constData());
|
||||
}
|
||||
|
||||
return m_requestHelper->startSingleRequest([this, req]()
|
||||
{
|
||||
return m_ftc->evlElementModifyRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void ElementEditDialog::fillPhasesComboBox()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "fillPhasesComboBox";
|
||||
QSignalBlocker blocker(m_ui->cbxPhase);
|
||||
m_ui->cbxPhase->clear();
|
||||
m_ui->cbxPhase->addItem(tr("<not set>"), 0);
|
||||
|
||||
auto cb = [this] (const ExerciseManagement::ExercisePhase &ph)
|
||||
{
|
||||
if (ph.exerciseId() == m_exerciseId)
|
||||
m_ui->cbxPhase->addItem(QString::fromStdString(ph.name()), ph.id());
|
||||
};
|
||||
m_exmDtc->exercisePhases(cb);
|
||||
|
||||
if (m_session->exerciseData()->phId > 0)
|
||||
m_ui->cbxPhase->setCurrentIndex(m_ui->cbxPhase->findData(m_session->exerciseData()->phId));
|
||||
}
|
||||
|
||||
|
||||
void ElementEditDialog::onCheckBoxClicked()
|
||||
{
|
||||
INFO_LOG(m_logger) << "onCheckBoxClicked";
|
||||
if (m_startTime > 0)
|
||||
return;
|
||||
|
||||
m_startTime = QDateTime::currentMSecsSinceEpoch();
|
||||
m_ui->lblStartTime->setText(DTG::toStringMSec(m_startTime));
|
||||
}
|
||||
|
||||
|
||||
void ElementEditDialog::onAudioClicked()
|
||||
{
|
||||
Q_ASSERT(m_avmDataIfc && m_avmDataIfc->hasAvsSession());
|
||||
if (!m_avmDataIfc)
|
||||
return;
|
||||
|
||||
m_audioStreams = m_avmDataIfc->avaState()->getRtProfile();
|
||||
|
||||
QString currentText;
|
||||
if (m_ui->cbxRadioCircuit->currentIndex() >= 0)
|
||||
currentText = m_ui->cbxRadioCircuit->currentText();
|
||||
|
||||
m_ui->cbxRadioCircuit->clear();
|
||||
|
||||
for (const QString &audioChannel : qAsConst(m_audioStreams))
|
||||
m_ui->cbxRadioCircuit->addItem(audioChannel);
|
||||
|
||||
m_ui->cbxRadioCircuit->setCurrentIndex(0);
|
||||
|
||||
int idx = m_ui->cbxRadioCircuit->findText(currentText);
|
||||
if (idx >= 0)
|
||||
m_ui->cbxRadioCircuit->setCurrentIndex(idx);
|
||||
|
||||
if (m_ui->cbAudio->isChecked() && m_ui->cbxRadioCircuit->count() > 1)
|
||||
m_ui->cbxRadioCircuit->setEnabled(true);
|
||||
else
|
||||
m_ui->cbxRadioCircuit->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
void ElementEditDialog::onVideoClicked()
|
||||
{
|
||||
Q_ASSERT(m_avmDataIfc && m_avmDataIfc->hasAvsSession());
|
||||
if (!m_avmDataIfc)
|
||||
return;
|
||||
|
||||
m_videoStreams = m_avmDataIfc->avaState()->currentLiveVideoStreams();
|
||||
|
||||
QVariant currentStream;
|
||||
if (m_ui->cbxVideoChannel->currentIndex() >= 0)
|
||||
currentStream = m_ui->cbxVideoChannel->currentData();
|
||||
|
||||
m_ui->cbxVideoChannel->clear();
|
||||
|
||||
for (const QString &streamName : qAsConst(m_videoStreams))
|
||||
{
|
||||
QString displayName = m_avmDataIfc->streamNameMapping()->displayName(streamName);
|
||||
m_ui->cbxVideoChannel->addItem(displayName, streamName);
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_ui->cbxVideoChannel->count(); ++i)
|
||||
{
|
||||
if ( m_ui->cbxVideoChannel->itemData(i).toString() == currentStream)
|
||||
{
|
||||
m_ui->cbxVideoChannel->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_ui->cbVideo->isChecked() && m_ui->cbxVideoChannel->count() > 1)
|
||||
m_ui->cbxVideoChannel->setEnabled(true);
|
||||
else
|
||||
m_ui->cbxVideoChannel->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
QJsonObject ElementEditDialog::getFilterSettings()
|
||||
{
|
||||
const int operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
|
||||
QJsonObject jsonObj;
|
||||
|
||||
{
|
||||
// AesFilter
|
||||
std::shared_ptr<FilterManagement::AesDisplayFilter> aesDisplayFilter =
|
||||
m_fltAesIfc->aesFilterForOperator(operatorId, QString());
|
||||
jsonObj[QStringLiteral("AesFilterJson")] = aesDisplayFilter->filterToJson();
|
||||
}
|
||||
|
||||
{
|
||||
// SymbolAppearance
|
||||
std::shared_ptr<FilterManagement::SymbolAppearanceSettings> symbolAppearanceSettings =
|
||||
m_fltParticipantIfc->symbolAppearanceForOperator(operatorId, QString());
|
||||
jsonObj[QStringLiteral("SymbolAppearanceJson")] = symbolAppearanceSettings->settingsToJson();
|
||||
}
|
||||
|
||||
// Nachtrag zu GUEZE-1769: since fltBuildingComponentIfc is optional:
|
||||
if (m_fltBuildingComponentIfc)
|
||||
{
|
||||
// BuildingComponentSettings
|
||||
std::shared_ptr<FilterManagement::BuildingComponentSettings> buildingComponentSettings =
|
||||
m_fltBuildingComponentIfc->buildingComponentSettingsForOperator(operatorId, QString());
|
||||
jsonObj[QStringLiteral("BuildingComponentSettingsJson")] = buildingComponentSettings->bldCmpSettingsToJson();
|
||||
}
|
||||
|
||||
// qCritical() << " filter_param = " << filter_param.c_str();
|
||||
|
||||
return jsonObj;
|
||||
}
|
||||
} // namespace Evaluations
|
||||
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Evaluations - Script Create / Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-20
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
#include <FilterManagement/flt_participant_plugin_interface.h>
|
||||
#include <FilterManagement/flt_aes_plugin_interface.h>
|
||||
#include <FilterManagement/flt_building_cmpnt_plugin_interface.h>
|
||||
#include <FilterManagement/flt_data_plugin_interface.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
class UiRequirementList;
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ElementEditDialog;
|
||||
}
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class ElementEditDialog : public LtsWidgets::LtsDialog
|
||||
, protected Interface::Ftc::EvlElementModifyReplyHandler
|
||||
, protected Interface::Ftc::EvlElementRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ElementEditDialog(QWidget *parent = nullptr);
|
||||
~ElementEditDialog();
|
||||
|
||||
bool init(int elementId,
|
||||
int criteriumId,
|
||||
int exerciseId,
|
||||
const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignDataInterface> &avmDataIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltParticipantGuiInterface> &fltParticipantIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignAesGuiInterface> &fltAesIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltBuildingComponentGuiInterface> &fltBuildingComponentIfc,
|
||||
LtsSession::LtsSession *session);
|
||||
|
||||
protected:
|
||||
void onEvlElementModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onEvlElementRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
QJsonObject getFilterSettings();
|
||||
|
||||
private slots:
|
||||
void onReturnPressed();
|
||||
void onCheckBoxClicked();
|
||||
void onAudioClicked();
|
||||
void onVideoClicked();
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
bool apply() override;
|
||||
void fillPhasesComboBox();
|
||||
|
||||
std::shared_ptr<Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
std::shared_ptr<AudioVideoManagement::ForeignDataInterface> m_avmDataIfc;
|
||||
std::shared_ptr<FilterManagement::ForeignFltParticipantGuiInterface> m_fltParticipantIfc;
|
||||
std::shared_ptr<FilterManagement::ForeignAesGuiInterface> m_fltAesIfc;
|
||||
std::shared_ptr<FilterManagement::ForeignFltBuildingComponentGuiInterface> m_fltBuildingComponentIfc;
|
||||
std::shared_ptr<FilterManagement::Interface::Dtc> m_fltDtc;
|
||||
LtsSession::LtsSession *m_session{nullptr};
|
||||
int m_elementId{0};
|
||||
int m_criteriumId{-1};
|
||||
int m_exerciseId{-1};
|
||||
qint64 m_startTime { 0 };
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
Ui::ElementEditDialog *m_ui{nullptr};
|
||||
LOGGER_T m_logger;
|
||||
QStringList m_audioStreams;
|
||||
QStringList m_videoStreams;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ElementEditDialog</class>
|
||||
<widget class="QWidget" name="ElementEditDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>662</width>
|
||||
<height>359</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Evaluation Elements Editor</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="lblStartTime">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="cbxRating"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="cbxVideoChannel"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="cbSituation">
|
||||
<property name="text">
|
||||
<string>Situation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblOperator">
|
||||
<property name="text">
|
||||
<string>Phase:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblDesc">
|
||||
<property name="text">
|
||||
<string>Note:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="cbVideo">
|
||||
<property name="text">
|
||||
<string>Video</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Video Channel:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblMedium">
|
||||
<property name="text">
|
||||
<string>Medium:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Radio Circuit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="cbAudio">
|
||||
<property name="text">
|
||||
<string>Audio</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbTimeStamp">
|
||||
<property name="text">
|
||||
<string>Start Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Rating:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="3">
|
||||
<widget class="QTextEdit" name="teDesc"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cbxRadioCircuit"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbxPhase"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,165 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Evaluations - Crtierium Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, SLSE, 2017-11-01
|
||||
*/
|
||||
|
||||
#include "evl_element_dialog.h"
|
||||
#include "ui_evl_element_dialog.h"
|
||||
#include "evl_element_model.h"
|
||||
#include "evl_edit_element_dialog.h"
|
||||
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
ElementDialog::ElementDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_model(new ElementDialogModel(this))
|
||||
, m_ui(new Ui::ElementDialog)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("ElementDialog"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ElementDialog ctor";
|
||||
m_ui->setupUi(this);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Own_Evaluation_Criteria"));
|
||||
}
|
||||
|
||||
ElementDialog::~ElementDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void ElementDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, m_dtc->evaluationCriterium(m_criteriumId), tr("Evaluation Elements"));
|
||||
}
|
||||
|
||||
void ElementDialog::enaDisa()
|
||||
{
|
||||
int selected = m_ui->widget->selectedRows().size();
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Add, true);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, (selected == 1));
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, (selected > 0));
|
||||
|
||||
}
|
||||
|
||||
void ElementDialog::slotAdd()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ElementDialog::slotAdd";
|
||||
|
||||
addElementEditDialog(/* new element */);
|
||||
}
|
||||
|
||||
void ElementDialog::slotEdit()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ElementDialog::slotEdit";
|
||||
|
||||
addElementEditDialog(m_model->getRowData(m_ui->widget->currentIndex().row()).id() /* existing - edit element */);
|
||||
}
|
||||
|
||||
|
||||
void ElementDialog::addElementEditDialog(int elementId)
|
||||
{
|
||||
addDialog(LtsWidgets::initDialog(new ElementEditDialog(),
|
||||
elementId, m_criteriumId, m_exerciseId, m_dtc, m_ftc, m_exmDtc, m_avmDataIfc, m_fltParticipantIfc, m_fltAesIfc, m_fltBuildingComponentIfc, m_session),
|
||||
m_menuGroup, QStringLiteral("ElementEditDialog%1").arg(elementId), LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
|
||||
void ElementDialog::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
|
||||
void ElementDialog::slotRemove()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ElementDialog::slotRemove";
|
||||
QModelIndex selIndex = m_ui->widget->currentIndex();
|
||||
if (!selIndex.isValid())
|
||||
return;
|
||||
|
||||
m_requestHelper->startSingleRequest([this]()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Removing element id = " << m_model->getRowData(m_ui->widget->currentIndex().row()).id();
|
||||
return m_ftc->evlElementRemoveRequest(EvlElementRemoveRequest(m_model->getRowData(m_ui->widget->currentIndex().row()).id(), m_criteriumId), this);
|
||||
});
|
||||
|
||||
if (m_requestHelper->failed())
|
||||
ERROR_LOG(m_logger) << "Failed to remove criterium";
|
||||
}
|
||||
|
||||
QString ElementDialog::dialogIdentifier()
|
||||
{
|
||||
return QStringLiteral("Evl.EditElements");
|
||||
}
|
||||
|
||||
bool ElementDialog::init(int criteriumId,
|
||||
int exerciseId,
|
||||
const QString &menuGroup,
|
||||
const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignDataInterface> &avmDataIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltParticipantGuiInterface> &fltParticipantIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignAesGuiInterface> &fltAesIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltBuildingComponentGuiInterface> &fltBuildingComponentIfc,
|
||||
LtsSession::LtsSession *session)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ElementDialog::init";
|
||||
m_criteriumId = criteriumId;
|
||||
m_exerciseId = exerciseId;
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
m_exmDtc = exmDtc;
|
||||
m_avmDataIfc = avmDataIfc;
|
||||
m_fltParticipantIfc = fltParticipantIfc;
|
||||
m_fltAesIfc = fltAesIfc;
|
||||
m_fltBuildingComponentIfc = fltBuildingComponentIfc;
|
||||
m_session = session;
|
||||
m_menuGroup = menuGroup;
|
||||
|
||||
m_model = new ElementDialogModel(this);
|
||||
|
||||
m_model->initModel(dtc, exmDtc, avmDataIfc, criteriumId);
|
||||
|
||||
m_proxyModel = new ElementDialogProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
m_proxyModel->setCriteriumId(m_criteriumId);
|
||||
m_ui->widget->setModel(m_proxyModel);
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->widget->hideColumn(ElementDialogModel::Id);
|
||||
#endif
|
||||
|
||||
auto cb = [this](const Evaluations::EvaluationElement &e)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Element: id = " << e.id() << ", medium = " << e.rating();
|
||||
};
|
||||
m_dtc->evaluationElements(cb);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged, this, &ElementDialog::enaDisa, Qt::UniqueConnection);
|
||||
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, this, &ElementDialog::slotAdd, Qt::UniqueConnection);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &ElementDialog::slotEdit, Qt::UniqueConnection);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &ElementDialog::slotRemove, Qt::UniqueConnection);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked, this, &ElementDialog::slotEdit, Qt::UniqueConnection);
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalEnterPressed, this, &ElementDialog::slotEdit, Qt::UniqueConnection);
|
||||
|
||||
enaDisa();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Evaluations
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Evaluations - Script Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-15
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <Plugins/FilterManagement/flt_participant_plugin_interface.h>
|
||||
#include <Plugins/FilterManagement/flt_aes_plugin_interface.h>
|
||||
#include <Plugins/FilterManagement/flt_building_cmpnt_plugin_interface.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ElementDialog;
|
||||
}
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class ElementDialogModel;
|
||||
class ElementDialogProxyModel;
|
||||
|
||||
class ElementDialog : public LtsWidgets::LtsDialog
|
||||
, protected Interface::Ftc::EvlElementModifyReplyHandler
|
||||
, protected Interface::Ftc::EvlElementRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ElementDialog(QWidget *parent = nullptr);
|
||||
~ElementDialog();
|
||||
|
||||
bool init(int criteriumId,
|
||||
int exerciseId, const QString &menuGroup,
|
||||
const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignDataInterface> &avmDataIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltParticipantGuiInterface> &fltParticipantIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignAesGuiInterface> &fltAesIfc,
|
||||
const std::shared_ptr<FilterManagement::ForeignFltBuildingComponentGuiInterface> &fltBuildingComponentIfc,
|
||||
LtsSession::LtsSession *session);
|
||||
|
||||
static QString dialogIdentifier();
|
||||
|
||||
protected:
|
||||
void onEvlElementModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onEvlElementRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void addElementEditDialog(int elementId = 0 /* new */);
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
ElementDialogModel *m_model{nullptr};
|
||||
ElementDialogProxyModel *m_proxyModel{nullptr};
|
||||
Ui::ElementDialog *m_ui{nullptr};
|
||||
int m_criteriumId{-1};
|
||||
int m_exerciseId{-1};
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<Evaluations::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
std::shared_ptr<AudioVideoManagement::ForeignDataInterface> m_avmDataIfc;
|
||||
std::shared_ptr<FilterManagement::ForeignFltParticipantGuiInterface> m_fltParticipantIfc;
|
||||
std::shared_ptr<FilterManagement::ForeignAesGuiInterface> m_fltAesIfc;
|
||||
std::shared_ptr<FilterManagement::ForeignFltBuildingComponentGuiInterface> m_fltBuildingComponentIfc;
|
||||
LtsSession::LtsSession *m_session{nullptr};
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
QString m_menuGroup;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
|
||||
private slots:
|
||||
void slotAdd();
|
||||
void slotEdit();
|
||||
void slotRemove();
|
||||
void enaDisa();
|
||||
|
||||
};
|
||||
|
||||
} // namespace Evaluations
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ElementDialog</class>
|
||||
<widget class="QWidget" name="ElementDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Evaluation Elements</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="LtsDataView::LtsDataView" name="widget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</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>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,168 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* PresentationManangement - Script Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-15
|
||||
*/
|
||||
|
||||
#include "evl_element_model.h"
|
||||
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <QDateTime>
|
||||
#include <LtsUtilsCore/json_object.h>
|
||||
#include <AudioVideoManagement/stream_name_mapping.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
ElementDialogModel::ElementDialogModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<EvaluationElement>(
|
||||
{
|
||||
tr("Id"),
|
||||
tr("Situation"),
|
||||
tr("Video"),
|
||||
tr("Audio"),
|
||||
tr("Start Time"),
|
||||
tr("Duration"),
|
||||
tr("Rating"),
|
||||
tr("Radio Circuit"),
|
||||
tr("Video Channel"),
|
||||
tr("Note"),
|
||||
tr("Phase")
|
||||
},
|
||||
parent)
|
||||
, m_logger(getLogger("ElementDialogModel"))
|
||||
{}
|
||||
|
||||
bool ElementDialogModel::initModel(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignDataInterface> &avmDataIfc,
|
||||
int criteriumId)
|
||||
{
|
||||
m_exmDtc = exmDtc;
|
||||
m_avmDataIfc = avmDataIfc;
|
||||
|
||||
connect(dtc.get(), &Interface::Dtc::evaluationElementChanged,
|
||||
this, &ElementDialogModel::onDataChanged);
|
||||
|
||||
auto cb = [this, criteriumId](const EvaluationElement &e)
|
||||
{
|
||||
if (e.criteriumId() == criteriumId)
|
||||
insertRow(e);
|
||||
};
|
||||
dtc->evaluationElements(cb);
|
||||
|
||||
INFO_LOG(m_logger) << "initModel - #EvalElements: " << m_vecData.size();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant ElementDialogModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if ((role != Qt::DisplayRole) || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const Evaluations::EvaluationElement &eval = m_vecData.at(index.row());
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return eval.id();
|
||||
case Situation:
|
||||
return eval.situation() ? tr("Yes") : tr("No");
|
||||
case Video:
|
||||
return eval.video() ? tr("Yes") : tr("No");
|
||||
case Audio:
|
||||
return eval.audio() ? tr("Yes") : tr("No");
|
||||
case Timestamp:
|
||||
return QDateTime::fromMSecsSinceEpoch(eval.timestamp());
|
||||
case Duration:
|
||||
return eval.duration();
|
||||
case Rating:
|
||||
return eval.rating();
|
||||
case RadioCircuit:
|
||||
if (eval.audioContent().is_set())
|
||||
{
|
||||
LtsUtils::JsonObject jsonObj = LtsUtils::JsonObject::fromJson(eval.audioContent().get());
|
||||
return jsonObj.value<QString>("actualStream");
|
||||
}
|
||||
else
|
||||
return QString();
|
||||
case VideoChannel:
|
||||
if (eval.videoContent().is_set())
|
||||
{
|
||||
LtsUtils::JsonObject jsonObj = LtsUtils::JsonObject::fromJson(eval.videoContent().get());
|
||||
QString streamName = jsonObj.value<QString>("actualStream");
|
||||
QString displayName = m_avmDataIfc->streamNameMapping()->displayName(streamName);
|
||||
return displayName;
|
||||
}
|
||||
else
|
||||
return QString();
|
||||
case Note:
|
||||
return QString::fromStdString(eval.note());
|
||||
case Phase:
|
||||
return QString::fromStdString(m_exmDtc->exercisePhase(eval.phaseId()).name());
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void ElementDialogProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<ElementDialogModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
bool ElementDialogProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
|
||||
{
|
||||
if (!m_sourceModel ||
|
||||
source_left.column() != source_right.column() ||
|
||||
!source_left.isValid() ||
|
||||
!source_right.isValid())
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
const auto &dataLeft = m_sourceModel->m_vecData.at(source_left.row());
|
||||
const auto dataRight = m_sourceModel->m_vecData.at(source_right.row());
|
||||
switch (source_left.column())
|
||||
{
|
||||
case ElementDialogModel::Timestamp:
|
||||
return dataLeft.timestamp() < dataRight.timestamp();
|
||||
case ElementDialogModel::Id:
|
||||
case ElementDialogModel::Situation:
|
||||
case ElementDialogModel::Video:
|
||||
case ElementDialogModel::Audio:
|
||||
|
||||
case ElementDialogModel::Duration:
|
||||
case ElementDialogModel::Rating:
|
||||
case ElementDialogModel::RadioCircuit:
|
||||
case ElementDialogModel::VideoChannel:
|
||||
case ElementDialogModel::Note:
|
||||
case ElementDialogModel::Phase:
|
||||
break;
|
||||
}
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
}
|
||||
|
||||
void ElementDialogProxyModel::setCriteriumId(int criteriumId)
|
||||
{
|
||||
if (m_criteriumId == criteriumId)
|
||||
return;
|
||||
m_criteriumId = criteriumId;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
bool ElementDialogProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
{
|
||||
if (m_criteriumId < 0 || !m_sourceModel || source_parent.isValid() || source_row < 0 || source_row >= m_sourceModel->m_vecData.size())
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
|
||||
const auto &data = m_sourceModel->m_vecData.at(source_row);
|
||||
if (data.criteriumId() != m_criteriumId)
|
||||
return false;
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
}
|
||||
|
||||
} // namespace Evaluations
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* PresentationManangement - Script Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-15
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class ElementDialogModel final : public LtsWidgets::LtsAbstractTableModel<EvaluationElement>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id = 0,
|
||||
Situation,
|
||||
Video,
|
||||
Audio,
|
||||
Timestamp,
|
||||
Duration,
|
||||
Rating,
|
||||
RadioCircuit,
|
||||
VideoChannel,
|
||||
Note,
|
||||
Phase
|
||||
};
|
||||
|
||||
explicit ElementDialogModel(QObject *parent = nullptr);
|
||||
~ElementDialogModel() = default;
|
||||
|
||||
bool initModel(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignDataInterface> &avmDataIfc,
|
||||
int criteriumId);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<AudioVideoManagement::ForeignDataInterface> m_avmDataIfc;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
friend class ElementDialogProxyModel;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
class ElementDialogProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
void setCriteriumId(int criteriumId);
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
|
||||
private:
|
||||
ElementDialogModel *m_sourceModel{nullptr};
|
||||
int m_criteriumId{-1};
|
||||
};
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* PresentationManangement - Script Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-15
|
||||
*/
|
||||
|
||||
#include "evl_model.h"
|
||||
|
||||
#include <Evaluations/evl_translation.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
CriteriumDialogModel::CriteriumDialogModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<EvaluationCriterium>(
|
||||
{
|
||||
tr("Id"),
|
||||
tr("Name"),
|
||||
tr("Description"),
|
||||
tr("Operator")
|
||||
},
|
||||
parent)
|
||||
, m_logger(getLogger("CriteriumDialogModel"))
|
||||
{}
|
||||
|
||||
|
||||
bool CriteriumDialogModel::initModel(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc
|
||||
)
|
||||
{
|
||||
m_opmDtc = opmDtc;
|
||||
connect(dtc.get(), &Interface::Dtc::evaluationCriteriumChanged,
|
||||
this, &CriteriumDialogModel::onDataChanged);
|
||||
dtc->evaluationCriteriums([this](const EvaluationCriterium & e) { insertRow(e); });
|
||||
|
||||
INFO_LOG(m_logger) << "initModel - #EvalCriteria: " << m_vecData.size();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant CriteriumDialogModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const Evaluations::EvaluationCriterium &eval = m_vecData.at(index.row());
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return eval.id();
|
||||
case Name:
|
||||
return QString::fromStdString(eval.name());
|
||||
case Description:
|
||||
return QString::fromStdString(eval.description());
|
||||
case Operator:
|
||||
return QString::fromStdString(m_opmDtc->user(eval.operatorId()).name());
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// CriteriumFilterModel
|
||||
void CriteriumFilterModel::setOperatorId(int operatorId)
|
||||
{
|
||||
if (m_operatorId == operatorId)
|
||||
return;
|
||||
m_operatorId = operatorId;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void CriteriumFilterModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<CriteriumDialogModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
bool CriteriumFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
{
|
||||
if (m_operatorId < 0 || !m_sourceModel || source_parent.isValid() || source_row < 0 || source_row >= m_sourceModel->m_vecData.size())
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
|
||||
const auto &data = m_sourceModel->m_vecData.at(source_row);
|
||||
if (data.operatorId() != m_operatorId)
|
||||
return false;
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
}
|
||||
|
||||
} // namespace Evaluations
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* PresentationManangement - Script Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-15
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <OperatorManagement/opm_dtc.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class CriteriumDialogModel final : public LtsWidgets::LtsAbstractTableModel<EvaluationCriterium>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id = 0,
|
||||
Name,
|
||||
Description,
|
||||
Operator
|
||||
};
|
||||
|
||||
explicit CriteriumDialogModel(QObject *parent = nullptr);
|
||||
~CriteriumDialogModel() = default;
|
||||
|
||||
bool initModel(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc);
|
||||
|
||||
QVariant data(const QModelIndex &, int) const override final;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
|
||||
LOGGER_T m_logger;
|
||||
|
||||
friend class CriteriumFilterModel;
|
||||
};
|
||||
|
||||
class CriteriumFilterModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
|
||||
void setOperatorId(int operatorId);
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
|
||||
private:
|
||||
CriteriumDialogModel *m_sourceModel{nullptr};
|
||||
int m_operatorId{-1};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user