Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Data)
|
||||
ADD_SUBDIRECTORY(Gui)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(EvlGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/evl_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
GuiPluginInterface
|
||||
)
|
||||
|
||||
#
|
||||
# Data Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(EvlDataPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/evl_data_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
DataPluginInterface
|
||||
svcEvlCommon
|
||||
)
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Hanna E. Rathje, SLSE, 2017-10-27
|
||||
#
|
||||
|
||||
#
|
||||
# Data Plugin
|
||||
#
|
||||
NGL_ADD_LIBRARY(WS EvlDataPlugin MODULE evl_data_plugin.cpp evl_data_plugin.h)
|
||||
NGL_TARGET_LINK_LIBRARIES(EvlDataPlugin
|
||||
Qt5::Core
|
||||
EvlDataPluginInterface
|
||||
svcEvlClient
|
||||
NGLLogger
|
||||
LtsSessionDataDds
|
||||
)
|
||||
NGL_INSTALL_TARGET(EvlDataPlugin)
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for ExerciseManangement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#include "evl_data_plugin.h"
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
|
||||
{
|
||||
std::shared_ptr<Interface::Dtc> dtc;
|
||||
std::shared_ptr<Interface::Ftc> ftc;
|
||||
if (!session->createTopicClient(dtc, ftc))
|
||||
return std::shared_ptr<DataPluginBase::Interface>();
|
||||
|
||||
return std::make_shared<DataInterfaceImpl>(dtc, ftc);
|
||||
}
|
||||
|
||||
|
||||
DataInterfaceImpl::DataInterfaceImpl(const std::shared_ptr<Evaluations::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<Evaluations::Interface::Ftc> &ftc)
|
||||
: DataInterface()
|
||||
, m_dtc(dtc)
|
||||
, m_ftc(ftc)
|
||||
{}
|
||||
|
||||
|
||||
} // namespace Evaluations
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for ExerciseManangement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <Plugins/Evaluations/evl_data_plugin_interface.h>
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class DataPlugin final : public QObject, public DataPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "data:3:evl")
|
||||
Q_INTERFACES(DataPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataPlugin() = default;
|
||||
~DataPlugin() = default;
|
||||
|
||||
QString pluginName() const override { return QStringLiteral("Evaluation"); }
|
||||
std::shared_ptr<DataPluginBase::Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Replay;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class DataInterfaceImpl final : public DataInterface
|
||||
{
|
||||
public:
|
||||
DataInterfaceImpl(const std::shared_ptr<Evaluations::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<Evaluations::Interface::Ftc> &ftc);
|
||||
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> getDtc() override { return m_dtc; }
|
||||
std::shared_ptr<Evaluations::Interface::Ftc> getFtc() override { return m_ftc; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<Evaluations::Interface::Ftc> m_ftc;
|
||||
};
|
||||
|
||||
} // namespace Evaluations
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Mike Wille, SLSE, 2017-03-15
|
||||
#
|
||||
ADD_SUBDIRECTORY(SanNineLinerEdit)
|
||||
|
||||
SET(evl_edit_gui_SRCS
|
||||
evl_edit_gui_plugin.cpp
|
||||
evl_edit_gui_plugin.h
|
||||
|
||||
CriteriumEdit/evl_dialog.h
|
||||
CriteriumEdit/evl_dialog.cpp
|
||||
CriteriumEdit/evl_edit_dialog.cpp
|
||||
CriteriumEdit/evl_edit_dialog.h
|
||||
CriteriumEdit/evl_model.cpp
|
||||
CriteriumEdit/evl_model.h
|
||||
CriteriumEdit/evl_element_dialog.cpp
|
||||
CriteriumEdit/evl_element_dialog.h
|
||||
CriteriumEdit/evl_element_model.cpp
|
||||
CriteriumEdit/evl_element_model.h
|
||||
CriteriumEdit/evl_edit_element_dialog.cpp
|
||||
CriteriumEdit/evl_edit_element_dialog.h
|
||||
CriteriumEdit/TopicEditor/topic_editor.cpp
|
||||
CriteriumEdit/TopicEditor/topic_editor.h
|
||||
CriteriumEdit/TopicEditor/evl_topic_editor_model.cpp
|
||||
CriteriumEdit/TopicEditor/evl_topic_editor_model.h
|
||||
|
||||
|
||||
SchemaEdit/evl_comment_model.cpp
|
||||
SchemaEdit/evl_comment_model.h
|
||||
SchemaEdit/evl_comment_tuple.h
|
||||
SchemaEdit/evl_comments.cpp
|
||||
SchemaEdit/evl_comments.h
|
||||
SchemaEdit/evl_edit_schema_element_data.cpp
|
||||
SchemaEdit/evl_edit_schema_element_data.h
|
||||
SchemaEdit/evl_edit_schema.cpp
|
||||
SchemaEdit/evl_edit_schema.h
|
||||
|
||||
SchemaEdit/evl_edit_treemodel_general.cpp
|
||||
SchemaEdit/evl_edit_treemodel_general.h
|
||||
SchemaEdit/evl_edit_treemodel_schema.cpp
|
||||
SchemaEdit/evl_edit_treemodel_schema.h
|
||||
SchemaEdit/evl_new_comment_dialog.cpp
|
||||
SchemaEdit/evl_new_comment_dialog.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(evl_edit_gui_SRCS
|
||||
CriteriumEdit/evl_dialog.ui
|
||||
CriteriumEdit/evl_element_dialog.ui
|
||||
CriteriumEdit/evl_edit_dialog.ui
|
||||
CriteriumEdit/evl_edit_element_dialog.ui
|
||||
CriteriumEdit/TopicEditor/topic_editor.ui
|
||||
|
||||
SchemaEdit/evl_comments.ui
|
||||
SchemaEdit/evl_edit_schema.ui
|
||||
SchemaEdit/evl_new_comment_dialog.ui
|
||||
)
|
||||
|
||||
|
||||
|
||||
NGL_ADD_LIBRARY(WS EvlEditGuiPlugin MODULE ${evl_edit_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(EvlEditGuiPlugin
|
||||
LtsPrinting
|
||||
NGLLogger
|
||||
LtsSession
|
||||
EvlDataPluginInterface
|
||||
EvlGuiPluginInterface
|
||||
OpmDataPluginInterface
|
||||
AvmDataPluginInterface
|
||||
ExmDataPluginInterface
|
||||
FlmDataPluginInterface
|
||||
OscDataPluginInterface
|
||||
|
||||
svcEvlCommon
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsDataView
|
||||
LtsUtilsGuiDds
|
||||
LtsUtilsSettings
|
||||
LtsSessionData
|
||||
ProjectConfig
|
||||
ngltools
|
||||
nglwidgets
|
||||
FltAesGuiCommon
|
||||
FltAesGuiPluginInterface
|
||||
FlmDataPluginInterface
|
||||
TopicEditorBase
|
||||
LtsScriptTimeline # TopicEditor
|
||||
LtsUtilsSettings
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(EvlEditGuiPlugin)
|
||||
+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};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
#
|
||||
|
||||
SET(san_edit_gui_SRCS
|
||||
san_nine_liner_edit_gui_plugin.cpp
|
||||
san_nine_liner_edit_gui_plugin.h
|
||||
san_nine_liner_dialog.cpp
|
||||
san_nine_liner_dialog.h
|
||||
san_nine_liner_dialog_model.cpp
|
||||
san_nine_liner_dialog_model.h
|
||||
san_nine_liner_edit_dialog.cpp
|
||||
san_nine_liner_edit_dialog.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(san_edit_gui_SRCS
|
||||
san_nine_liner_dialog.ui
|
||||
san_nine_liner_edit_dialog.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS EvlSanNineLinerEditGuiPlugin MODULE ${san_edit_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(EvlSanNineLinerEditGuiPlugin
|
||||
ngltools # dtg
|
||||
ngltranslator
|
||||
NGLLogger
|
||||
LtsSession
|
||||
EvlDataPluginInterface
|
||||
EvlGuiPluginInterface
|
||||
|
||||
svcEvlCommon
|
||||
Qt5::Widgets
|
||||
LtsCoordTrans
|
||||
ltsCoordWidget
|
||||
LtsWidgets
|
||||
LtsDataView
|
||||
LtsUtilsGuiDds
|
||||
LtsUtilsSettings
|
||||
LtsSessionData
|
||||
ProjectConfig
|
||||
LtsUtilsGuiConnectDialog
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(EvlSanNineLinerEditGuiPlugin)
|
||||
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SanNineLiner - Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2020-05-14
|
||||
*/
|
||||
|
||||
|
||||
#include "san_nine_liner_dialog.h"
|
||||
#include "ui_san_nine_liner_dialog.h"
|
||||
|
||||
#include "san_nine_liner_dialog_model.h"
|
||||
#include "san_nine_liner_edit_dialog.h"
|
||||
|
||||
#include <Plugins/Evaluations/evl_data_plugin_interface.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
//---------------------------------
|
||||
// SanNineLinerDialog
|
||||
//---------------------------------
|
||||
SanNineLinerDialog::SanNineLinerDialog(const QString &menuGroup, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_ui(new Ui::SanNineLinerDialog)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("SanNineLinerDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-SanNineLiner"));
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, this, &SanNineLinerDialog::onAddSanNineLiner);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &SanNineLinerDialog::onEditSanNineLiner);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &SanNineLinerDialog::onRemoveSanNineLiner);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked,
|
||||
this, &SanNineLinerDialog::onEditSanNineLiner);
|
||||
}
|
||||
|
||||
SanNineLinerDialog::~SanNineLinerDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void SanNineLinerDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("SanNineLiner"));
|
||||
}
|
||||
|
||||
void SanNineLinerDialog::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
bool SanNineLinerDialog::init(LtsSession::LtsSessionDataDds *session)
|
||||
{
|
||||
m_session = session;
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> dtc;
|
||||
|
||||
if (!m_session->getDtc<Evaluations::DataInterface>(dtc))
|
||||
return false;
|
||||
if (!m_session->getFtc<Evaluations::DataInterface>(m_ftc))
|
||||
return false;
|
||||
|
||||
m_model = new SanNineLinerDialogModel(this);
|
||||
m_model->initModel(dtc);
|
||||
auto proxy = new SanNineLinerProxyModel(this);
|
||||
proxy->setSourceModel(m_model);
|
||||
|
||||
m_ui->widget->setModel(proxy);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &SanNineLinerDialog::enaDisa);
|
||||
|
||||
enaDisa();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SanNineLinerDialog::enaDisa()
|
||||
{
|
||||
QModelIndexList selectedRows = m_ui->widget->selectedRows();
|
||||
const int cntSelectedRows = selectedRows.size();
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, cntSelectedRows == 1);
|
||||
const QModelIndex curIdx = m_ui->widget->currentIndex();
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, curIdx.isValid() && cntSelectedRows == 1);
|
||||
}
|
||||
|
||||
void SanNineLinerDialog::onAddSanNineLiner()
|
||||
{
|
||||
SanNineLinerEditDialog *dialog = new SanNineLinerEditDialog(this);
|
||||
dialog->init(m_session, m_menuGroup, 0 /* new sanNineLiner */);
|
||||
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("New SanNineLiner"));
|
||||
}
|
||||
|
||||
void SanNineLinerDialog::onRemoveSanNineLiner()
|
||||
{
|
||||
const QModelIndex curIdx = m_ui->widget->currentIndex();
|
||||
if (!curIdx.isValid())
|
||||
return;
|
||||
const int sanNineLinerId = m_model->getRowData(curIdx.row()).id();
|
||||
|
||||
|
||||
Core::RemoveElementRequest req(sanNineLinerId);
|
||||
m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ftc->sanNineLinerRemoveRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
void SanNineLinerDialog::onEditSanNineLiner()
|
||||
{
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
const Evaluations::SanNineLiner san = m_model->getRowData(idx.row());
|
||||
|
||||
if (san.id() <= 0)
|
||||
return;
|
||||
DEBUG_LOG(m_logger) << "current SanNineLinerId: " << san.id();
|
||||
|
||||
SanNineLinerEditDialog *dialog = new SanNineLinerEditDialog(this);
|
||||
|
||||
dialog->init(m_session, m_menuGroup, san.id());
|
||||
const QString identifier = QStringLiteral("EditSanNineLiner%1").arg(san.id());
|
||||
|
||||
addDialog(dialog, m_menuGroup, identifier);
|
||||
}
|
||||
|
||||
} // namespace Evaluations
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SanNineLiner - Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2020-05-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class SanNineLinerDialog;
|
||||
}
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class SanNineLinerDialogModel;
|
||||
// --------------------------------------------------------
|
||||
// SanNineLinerDialog
|
||||
// --------------------------------------------------------
|
||||
class SanNineLinerDialog : public LtsWidgets::LtsDialog
|
||||
, protected Evaluations::Interface::Ftc::SanNineLinerRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SanNineLinerDialog(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~SanNineLinerDialog();
|
||||
|
||||
bool init(LtsSession::LtsSessionDataDds *session);
|
||||
|
||||
private slots:
|
||||
void enaDisa();
|
||||
void onAddSanNineLiner();
|
||||
void onEditSanNineLiner();
|
||||
void onRemoveSanNineLiner();
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void onSanNineLinerRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
SanNineLinerDialogModel *m_model{nullptr};
|
||||
Ui::SanNineLinerDialog *m_ui{nullptr};
|
||||
LtsSession::LtsSessionDataDds *m_session{nullptr};
|
||||
std::shared_ptr<Evaluations::Interface::Ftc> m_ftc;
|
||||
QString m_menuGroup;
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SanNineLinerDialog</class>
|
||||
<widget class="QWidget" name="SanNineLinerDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Exercise Management</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>
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for SanNineLiner - San NineLiner Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, 2020-05-18
|
||||
*/
|
||||
|
||||
|
||||
#include "san_nine_liner_dialog_model.h"
|
||||
|
||||
#include <LtsUtilsCore/dds_vector.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <Evaluations/evl_translation.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
//---------------------------------
|
||||
// SanNineLinerDialogModel
|
||||
//---------------------------------
|
||||
SanNineLinerDialogModel::SanNineLinerDialogModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<Evaluations::SanNineLiner>({tr("Id"),
|
||||
tr("Created"),
|
||||
tr("Position"),
|
||||
tr("Radio frequency / Call Sign / Suffix")
|
||||
},
|
||||
parent)
|
||||
, m_logger(getLogger("SanNineLinerDialogModel"))
|
||||
{}
|
||||
|
||||
bool SanNineLinerDialogModel::initModel(const std::shared_ptr<Evaluations::Interface::Dtc> &dtc)
|
||||
{
|
||||
m_evlDtc = dtc;
|
||||
|
||||
connect(m_evlDtc.get(), &Evaluations::Interface::Dtc::sanNineLinerChanged,
|
||||
this, &SanNineLinerDialogModel::onDataChanged);
|
||||
|
||||
// insert Model
|
||||
m_evlDtc->sanNineLiners([this](const Evaluations::SanNineLiner &san)
|
||||
{
|
||||
insertRow(san);
|
||||
});
|
||||
|
||||
INFO_LOG(m_logger) << "initModel - #sanNineLiner: " << m_vecData.size();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant SanNineLinerDialogModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const Evaluations::SanNineLiner &san = m_vecData.at(index.row());
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case SanNineLinerDialogModel::Columns::Id:
|
||||
return san.id();
|
||||
case SanNineLinerDialogModel::Columns::Created:
|
||||
return QDateTime::fromMSecsSinceEpoch(san.lastModified());
|
||||
case SanNineLinerDialogModel::Columns::Position:
|
||||
{
|
||||
if (std::isnan(san.line1_position().lat()) || std::isnan(san.line1_position().lon()))
|
||||
return tr("---");
|
||||
return LtsCoordTrans::mgrsFromGeographic(san.line1_position().lon(), san.line1_position().lat());
|
||||
}
|
||||
case SanNineLinerDialogModel::Columns::RadioFrequencyCallSignSuffix:
|
||||
return QString::fromStdString(san.line2_RadioFrequencyCallSignSuffix());
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
//
|
||||
// SanNineLinerProxyModel
|
||||
//
|
||||
|
||||
void SanNineLinerProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<SanNineLinerDialogModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Evaluations
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for SanNineLiner - San NineLiner Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, 2020-05-18
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
// --------------------------------------------------------
|
||||
// SanNineLinerModel
|
||||
// --------------------------------------------------------
|
||||
class SanNineLinerDialogModel final : public LtsWidgets::LtsAbstractTableModel<Evaluations::SanNineLiner>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id,
|
||||
Created,
|
||||
Position,
|
||||
RadioFrequencyCallSignSuffix
|
||||
};
|
||||
|
||||
explicit SanNineLinerDialogModel(QObject *parent = nullptr);
|
||||
bool initModel(const std::shared_ptr<Evaluations::Interface::Dtc> &dtc);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override final;
|
||||
|
||||
private:
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> m_evlDtc;
|
||||
LOGGER_T m_logger;
|
||||
|
||||
friend class SanNineLinerProxyModel;
|
||||
};
|
||||
|
||||
class SanNineLinerProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
private:
|
||||
SanNineLinerDialogModel *m_sourceModel{nullptr};
|
||||
};
|
||||
}
|
||||
+332
@@ -0,0 +1,332 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Evaluations - SanNineLiner Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2020-05-18
|
||||
*/
|
||||
|
||||
|
||||
#include "san_nine_liner_edit_dialog.h"
|
||||
#include "ui_san_nine_liner_edit_dialog.h"
|
||||
#include <Services/Evaluations/san_category_line_json.h>
|
||||
|
||||
#include <LtsWidgets/lts_message_dialog.h>
|
||||
#include <LtsUtilsCore/dds_vector.h>
|
||||
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <Plugins/Evaluations/evl_data_plugin_interface.h>
|
||||
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <ngltranslator/ngltranslator.h>
|
||||
|
||||
#include <QJsonDocument>
|
||||
|
||||
#include <QIntValidator>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
// --------------------------------------------------------
|
||||
// ExerciseManangementEditDialog
|
||||
// --------------------------------------------------------
|
||||
SanNineLinerEditDialog::SanNineLinerEditDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_ui(new Ui::SanNineLinerEditDialog)
|
||||
, m_validator(new QIntValidator(this))
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("SanNineLinerEditDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_validator->setRange(0, 99);
|
||||
|
||||
m_ui->le3A->setValidator(m_validator);
|
||||
m_ui->le3B->setValidator(m_validator);
|
||||
m_ui->le3C->setValidator(m_validator);
|
||||
m_ui->le3D->setValidator(m_validator);
|
||||
m_ui->le3E->setValidator(m_validator);
|
||||
m_ui->le4A->setValidator(m_validator);
|
||||
m_ui->le4B->setValidator(m_validator);
|
||||
m_ui->le4C->setValidator(m_validator);
|
||||
m_ui->le4D->setValidator(m_validator);
|
||||
m_ui->le5A->setValidator(m_validator);
|
||||
m_ui->le5B->setValidator(m_validator);
|
||||
m_ui->le8A->setValidator(m_validator);
|
||||
m_ui->le8B->setValidator(m_validator);
|
||||
m_ui->le8C->setValidator(m_validator);
|
||||
m_ui->le8D->setValidator(m_validator);
|
||||
m_ui->le8E->setValidator(m_validator);
|
||||
|
||||
connect(m_ui->pbClear, &QPushButton::clicked,
|
||||
m_ui->positionEdit, &LtsCoordWidget::LtsCoordWidget::clear);
|
||||
}
|
||||
|
||||
|
||||
SanNineLinerEditDialog::~SanNineLinerEditDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void SanNineLinerEditDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, QLatin1String("SanNineLiner"), m_sanNineLinerId, QLatin1String("Custom"), tr("SanNineLiner Edit"));
|
||||
}
|
||||
|
||||
|
||||
bool SanNineLinerEditDialog::init(LtsSession::LtsSessionDataDds *session,
|
||||
const QString &menuGroup,
|
||||
const int sanNineLinerId)
|
||||
{
|
||||
m_session = session;
|
||||
m_menuGroup = menuGroup;
|
||||
m_sanNineLinerId = sanNineLinerId;
|
||||
|
||||
if (!m_session->getDtc<Evaluations::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!m_session->getFtc<Evaluations::DataInterface>(m_ftc))
|
||||
return false;
|
||||
|
||||
m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc);
|
||||
|
||||
if (m_sitMapGuiIfc)
|
||||
connect(m_ui->pbPosition, &QPushButton::clicked, this, &SanNineLinerEditDialog::getPosition);
|
||||
else
|
||||
m_ui->pbPosition->setEnabled(false);
|
||||
|
||||
m_ui->dtTime->setRetrieveCurrentTimeCallback([this]() { return m_session->partitionTime(); });
|
||||
|
||||
Evaluations::SanNineLiner data = m_dtc->sanNineLiner(sanNineLinerId);
|
||||
|
||||
// set data from dds
|
||||
if (data.id() > 0)
|
||||
{
|
||||
m_ui->dtTime->setMsecsSinceEpoch(data.lastModified());
|
||||
m_ui->leRadioFrequencyCallSignSuffix->setText(QString::fromStdString(data.line2_RadioFrequencyCallSignSuffix()));
|
||||
QPointF position(data.line1_position().lon(), data.line1_position().lat());
|
||||
if (!position.isNull())
|
||||
m_ui->positionEdit->setCoordinate(position);
|
||||
|
||||
// FromJson line 3 - 9
|
||||
QVector<Database::SanCategoryLine> linesCategory = SanCategoryLine::fromJson(data.lines(), data.id());
|
||||
|
||||
INFO_LOG(m_logger) << "linesCategory size: " << linesCategory.size();
|
||||
|
||||
for (const Database::SanCategoryLine &cl : qAsConst(linesCategory))
|
||||
{
|
||||
// line 3,4,5,8
|
||||
QString leName = QStringLiteral("le") + QString::number(cl.line) + cl.category;
|
||||
QLineEdit *leLineAmount = findChild<QLineEdit*>(leName);
|
||||
if (leLineAmount)
|
||||
{
|
||||
INFO_LOG(m_logger) << "leName: " << leName << ", amount: " << cl.amount;
|
||||
leLineAmount->setText(QString::number(cl.amount));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// line 6
|
||||
QString rbName = QStringLiteral("rb") + QString::number(cl.line) + cl.category;
|
||||
QRadioButton *rbCategory = findChild<QRadioButton*>(rbName);
|
||||
if (rbCategory)
|
||||
{
|
||||
INFO_LOG(m_logger) << "rbName: " << rbName;
|
||||
rbCategory->setChecked(true);
|
||||
continue;
|
||||
}
|
||||
|
||||
// line 7, 9
|
||||
|
||||
QString cbxName = QStringLiteral("cbx") + QString::number(cl.line) + cl.category + (cl.category == QStringLiteral("N") ? QStringLiteral("u") : QString());
|
||||
QCheckBox *cbxCategory = findChild<QCheckBox*>(cbxName);
|
||||
if (cbxCategory)
|
||||
{
|
||||
INFO_LOG(m_logger) << "cbxName: " << cbxName;
|
||||
cbxCategory->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->dtTime->setMsecsSinceEpoch(m_session->partitionTime());
|
||||
}
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-SanNineLiner"));
|
||||
enaDisa();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void SanNineLinerEditDialog::enaDisa()
|
||||
{
|
||||
m_ui->lblLine1_DE->hide();
|
||||
m_ui->lblLine2_DE->hide();
|
||||
m_ui->lblLine3_DE->hide();
|
||||
m_ui->lblLine4_DE->hide();
|
||||
m_ui->lblLine5_DE->hide();
|
||||
m_ui->lblLine6_DE->hide();
|
||||
m_ui->lblLine7_DE->hide();
|
||||
m_ui->lblLine8_DE->hide();
|
||||
m_ui->lblLine9_DE->hide();
|
||||
if (NGL::translationLocale() == "de_DE")
|
||||
{
|
||||
m_ui->lblLine1_DE->show();
|
||||
m_ui->lblLine2_DE->show();
|
||||
m_ui->gbLine3->setTitle(m_ui->gbLine3->title()+m_ui->lblLine3_DE->text());
|
||||
m_ui->gbLine4->setTitle(m_ui->gbLine4->title()+m_ui->lblLine4_DE->text());
|
||||
m_ui->gbLine5->setTitle(m_ui->gbLine5->title()+m_ui->lblLine5_DE->text());
|
||||
m_ui->gbLine6->setTitle(m_ui->gbLine6->title()+m_ui->lblLine6_DE->text());
|
||||
m_ui->gbLine7->setTitle(m_ui->gbLine7->title()+m_ui->lblLine7_DE->text());
|
||||
m_ui->gbLine8->setTitle(m_ui->gbLine8->title()+m_ui->lblLine8_DE->text());
|
||||
m_ui->gbLine9->setTitle(m_ui->gbLine9->title()+m_ui->lblLine9_DE->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SanNineLinerEditDialog::apply() // TODO: clean me up !
|
||||
{
|
||||
|
||||
SanNineLinerModifyRequest request;
|
||||
request.id(m_sanNineLinerId);
|
||||
|
||||
// Update Data of Existing san nine liner
|
||||
request.id(m_sanNineLinerId);
|
||||
request.lastModified(m_ui->dtTime->msecsSinceEpoch());
|
||||
const Core::GeoPosition2D pos(m_ui->positionEdit->coordinate().x(), m_ui->positionEdit->coordinate().y());
|
||||
request.line1_position(pos);
|
||||
request.line2_radioFrequencyCallSignSuffix(m_ui->leRadioFrequencyCallSignSuffix->text().toStdString());
|
||||
|
||||
m_vecCategoryLine.clear();
|
||||
// line 3 to 9 in m_vecCategoryLine
|
||||
int line = 3;
|
||||
// line 3
|
||||
setCategoryLine(line, QStringLiteral("A"), m_ui->le3A);
|
||||
setCategoryLine(line, QStringLiteral("B"), m_ui->le3B);
|
||||
setCategoryLine(line, QStringLiteral("C"), m_ui->le3C);
|
||||
setCategoryLine(line, QStringLiteral("D"), m_ui->le3D);
|
||||
setCategoryLine(line, QStringLiteral("E"), m_ui->le3E);
|
||||
// line 4
|
||||
line = 4;
|
||||
setCategoryLine(line, QStringLiteral("A"), m_ui->le4A);
|
||||
setCategoryLine(line, QStringLiteral("B"), m_ui->le4B);
|
||||
setCategoryLine(line, QStringLiteral("C"), m_ui->le4C);
|
||||
setCategoryLine(line, QStringLiteral("D"), m_ui->le4D);
|
||||
// line 5
|
||||
line = 5;
|
||||
setCategoryLine(line, QStringLiteral("A"), m_ui->le5A);
|
||||
setCategoryLine(line, QStringLiteral("B"), m_ui->le5B);
|
||||
// line 6
|
||||
line = 6;
|
||||
setCategoryLine(line, QStringLiteral("A"), m_ui->rb6A);
|
||||
setCategoryLine(line, QStringLiteral("B"), m_ui->rb6B);
|
||||
// line 7
|
||||
line = 7;
|
||||
setCategoryLine(line, QStringLiteral("A"), m_ui->cbx7A);
|
||||
setCategoryLine(line, QStringLiteral("B"), m_ui->cbx7B);
|
||||
setCategoryLine(line, QStringLiteral("C"), m_ui->cbx7C);
|
||||
setCategoryLine(line, QStringLiteral("D"), m_ui->cbx7D);
|
||||
setCategoryLine(line, QStringLiteral("E"), m_ui->cbx7E);
|
||||
// line 8
|
||||
line = 8;
|
||||
setCategoryLine(line, QStringLiteral("A"), m_ui->le8A);
|
||||
setCategoryLine(line, QStringLiteral("B"), m_ui->le8B);
|
||||
setCategoryLine(line, QStringLiteral("C"), m_ui->le8C);
|
||||
setCategoryLine(line, QStringLiteral("D"), m_ui->le8D);
|
||||
setCategoryLine(line, QStringLiteral("E"), m_ui->le8E);
|
||||
// line 9
|
||||
line = 9;
|
||||
setCategoryLine(line, QStringLiteral("N"), m_ui->cbx9Nu);
|
||||
setCategoryLine(line, QStringLiteral("B"), m_ui->cbx9B);
|
||||
setCategoryLine(line, QStringLiteral("C"), m_ui->cbx9C);
|
||||
setCategoryLine(line, QStringLiteral("None"), m_ui->cbx9None);
|
||||
|
||||
QJsonDocument doc = SanCategoryLine::toJson(m_vecCategoryLine);
|
||||
request.lines(doc.toJson().toStdString());
|
||||
|
||||
if (!m_requestHelper->startSingleRequest([this, request]()
|
||||
{
|
||||
return m_ftc->sanNineLinerModifyRequest(request, this);
|
||||
}))
|
||||
return false;
|
||||
|
||||
if (request.id() <= 0)
|
||||
{
|
||||
m_sanNineLinerId = m_requestHelper->getRepliedId();
|
||||
ERROR_LOG(m_logger) << "Created new san nine liner with id " << m_sanNineLinerId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SanNineLinerEditDialog::has2DMap()
|
||||
{
|
||||
if (!m_sitMapGuiIfc)
|
||||
return false;
|
||||
if (m_sitMapGuiIfc->mapMode() != SituationMap::MapMode::MapMode_2D)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this, tr("Only available in 2D mode"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void SanNineLinerEditDialog::getPosition()
|
||||
{
|
||||
if (!has2DMap())
|
||||
return;
|
||||
|
||||
m_sitMapGuiIfc->getCoordinate(this, SLOT(onCoordinate(QPointF)), nullptr);
|
||||
|
||||
}
|
||||
|
||||
void SanNineLinerEditDialog::onCoordinate(const QPointF ¢erPoint)
|
||||
{
|
||||
m_ui->positionEdit->setCoordinate(centerPoint);
|
||||
}
|
||||
|
||||
void SanNineLinerEditDialog::setCategoryLine( int line, const QString &category, QLineEdit* leAmount)
|
||||
{
|
||||
Database::SanCategoryLine cl;
|
||||
|
||||
cl.nineLinerId = m_sanNineLinerId;
|
||||
cl.line = line;
|
||||
cl.category = category;
|
||||
cl.amount = leAmount->text().toInt();
|
||||
|
||||
if (cl.amount > 0)
|
||||
m_vecCategoryLine.push_back(std::move(cl));
|
||||
}
|
||||
|
||||
void SanNineLinerEditDialog::setCategoryLine( int line, const QString &category, QRadioButton *rb)
|
||||
{
|
||||
Database::SanCategoryLine cl;
|
||||
|
||||
cl.nineLinerId = m_sanNineLinerId;
|
||||
cl.line = line;
|
||||
cl.category = category;
|
||||
cl.amount = 0;
|
||||
|
||||
if (rb->isChecked())
|
||||
m_vecCategoryLine.push_back(std::move(cl));
|
||||
}
|
||||
|
||||
void SanNineLinerEditDialog::setCategoryLine(int line, const QString &category, QCheckBox *cbx)
|
||||
{
|
||||
Database::SanCategoryLine cl;
|
||||
|
||||
cl.nineLinerId = m_sanNineLinerId;
|
||||
cl.line = line;
|
||||
cl.category = category;
|
||||
cl.amount = 0;
|
||||
|
||||
if (cbx->isChecked())
|
||||
m_vecCategoryLine.push_back(std::move(cl));
|
||||
}
|
||||
|
||||
} // namespace Evaluations
|
||||
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Evaluations - SanNineLiner Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2020-05-18
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
|
||||
#include <Evaluations/evl_db_structs.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class SanNineLinerEditDialog;
|
||||
}
|
||||
|
||||
namespace SituationMap
|
||||
{
|
||||
class ForeignGuiInterface;
|
||||
}
|
||||
|
||||
class QIntValidator;
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
// --------------------------------------------------------
|
||||
// SanNineLinerEditDialog
|
||||
// --------------------------------------------------------
|
||||
class SanNineLinerEditDialog final : public LtsWidgets::LtsDialog
|
||||
, protected Evaluations::Interface::Ftc::SanNineLinerModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SanNineLinerEditDialog(QWidget *parent = nullptr);
|
||||
|
||||
bool init(LtsSession::LtsSessionDataDds *session,
|
||||
const QString &menuGroup,
|
||||
const int sanNineLinerId);
|
||||
|
||||
~SanNineLinerEditDialog();
|
||||
|
||||
protected:
|
||||
|
||||
void onSanNineLinerModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
private slots:
|
||||
void onCoordinate(const QPointF ¢erPoint);
|
||||
void getPosition();
|
||||
|
||||
|
||||
signals:
|
||||
void sendData(const Evaluations::SanNineLiner &data);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
bool apply() override final;
|
||||
bool has2DMap();
|
||||
|
||||
void setCategoryLine(int line, const QString &category, QLineEdit* leAmount);
|
||||
void setCategoryLine( int line, const QString &category, QRadioButton *rb);
|
||||
void setCategoryLine( int line, const QString &category, QCheckBox *cbx);
|
||||
|
||||
void enaDisa();
|
||||
|
||||
Ui::SanNineLinerEditDialog *m_ui{nullptr};
|
||||
LtsSession::LtsSessionDataDds *m_session{nullptr};
|
||||
int m_sanNineLinerId{0};
|
||||
std::vector<Database::SanCategoryLine> m_vecCategoryLine;
|
||||
|
||||
std::shared_ptr<Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
||||
|
||||
QString m_menuGroup;
|
||||
QIntValidator *m_validator{nullptr};
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
}
|
||||
+1076
File diff suppressed because it is too large.
Load diff
+78
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for ExerciseManangement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#include "san_nine_liner_edit_gui_plugin.h"
|
||||
#include "san_nine_liner_dialog.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <Evaluations/evl_operator_rights.h>
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, getLogger("Plugins.Gui.San.Edit"))
|
||||
, m_dtc(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("SanNineLiner");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:set_exercise_process.svg"));
|
||||
plData.identifier = QLatin1String("sanNineLinerEdit");
|
||||
plData.operatorRight = OperatorRights::SanNineLinerEdit;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget *parent)
|
||||
{
|
||||
return onShowSanNineLinerDialog(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
if (!m_session->getDtc<Evaluations::DataInterface>(m_dtc))
|
||||
return false;
|
||||
|
||||
for (const QString &option : getOptions())
|
||||
DEBUG_LOG(m_logger) << "option: " << option;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_dtc = nullptr;
|
||||
}
|
||||
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowSanNineLinerDialog(QWidget *parent)
|
||||
{
|
||||
SanNineLinerDialog *dialog = new SanNineLinerDialog(menuGroup(), parent);
|
||||
dialog->init(m_session);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
} // namespace Evaluations
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for ExerciseManangement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Common/ProjectConfig/project_defines.h>
|
||||
#include <Plugins/Evaluations/evl_data_plugin_interface.h>
|
||||
#include <Plugins/Evaluations/evl_gui_plugin_interface.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:san.edit")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QLatin1String("EvlSanNineLinerEditGuiPlugin"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return (partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Replay) ;
|
||||
}
|
||||
};
|
||||
|
||||
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
QString menuGroup() const override { return tr("Evaluation"); }
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return (partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Replay);
|
||||
}
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowSanNineLinerDialog(QWidget *parent);
|
||||
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> m_dtc;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Evaluations
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Last, NLSE, 2018-01-11
|
||||
*/
|
||||
|
||||
#include "evl_comment_model.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QColor>
|
||||
#include <LtsSession/lts_session_manager.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
EvlCommentDataViewModel::EvlCommentDataViewModel(QObject *parent) : LtsAbstractTableModel(
|
||||
{
|
||||
tr("Id"),
|
||||
tr("Timestamp"),
|
||||
tr("Sender"),
|
||||
tr("Is personal"),
|
||||
tr("Comment"),
|
||||
tr("Hierarchy")
|
||||
},
|
||||
parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
QVariant EvlCommentDataViewModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::BackgroundRole)
|
||||
{
|
||||
const CommentTuple &row = m_vecData.at(index.row());
|
||||
|
||||
if (row.m_receiver.size())
|
||||
return QColor(188, 210, 238);
|
||||
}
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
const CommentTuple &row = m_vecData.at(index.row());
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return index.row() + 1;
|
||||
case Timestamp:
|
||||
return QDateTime::fromMSecsSinceEpoch(row.m_timestamp.currentMSecsSinceEpoch());
|
||||
case Sender:
|
||||
return row.m_sender;
|
||||
case IsPersonal:
|
||||
return row.m_receiver.size() ? tr("Yes") : tr("No");
|
||||
case Comment:
|
||||
return row.m_text;
|
||||
case Hierarchy:
|
||||
return row.m_hierarchy;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void EvlCommentDataViewProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<EvlCommentDataViewModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
bool EvlCommentDataViewProxyModel::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 EvlCommentDataViewModel::Timestamp:
|
||||
return dataLeft.m_timestamp.currentMSecsSinceEpoch() < dataRight.m_timestamp.currentMSecsSinceEpoch();
|
||||
case EvlCommentDataViewModel::Id:
|
||||
case EvlCommentDataViewModel::Sender:
|
||||
case EvlCommentDataViewModel::IsPersonal:
|
||||
case EvlCommentDataViewModel::Comment:
|
||||
case EvlCommentDataViewModel::Hierarchy:
|
||||
|
||||
break;
|
||||
}
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
*
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Last, NLSE, 2018-01-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
|
||||
#include "evl_comment_tuple.h"
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class ForeignDataInterface;
|
||||
class CommunicationInterface;
|
||||
|
||||
class EvlCommentDataViewModel : public LtsWidgets::LtsAbstractTableModel<CommentTuple>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
enum columns
|
||||
{
|
||||
Id,
|
||||
Timestamp,
|
||||
Sender,
|
||||
IsPersonal,
|
||||
Comment,
|
||||
Hierarchy
|
||||
};
|
||||
public:
|
||||
explicit EvlCommentDataViewModel(QObject *parent = nullptr);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
friend class EvlCommentDataViewProxyModel;
|
||||
};
|
||||
|
||||
class EvlCommentDataViewProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
|
||||
private:
|
||||
EvlCommentDataViewModel *m_sourceModel{nullptr};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
*
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Last, NLSE, 2018-01-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
struct CommentTuple
|
||||
{
|
||||
int m_commentId = 0;
|
||||
QDateTime m_timestamp;
|
||||
QString m_sender;
|
||||
QString m_receiver;
|
||||
QString m_text;
|
||||
QString m_hierarchy;
|
||||
// id schema?
|
||||
};
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Last, NLSE, 2018-01-11
|
||||
*/
|
||||
|
||||
#include "evl_comments.h"
|
||||
#include "ui_evl_comments.h"
|
||||
#include "evl_comment_model.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
EvlCommentsView::EvlCommentsView(const std::shared_ptr<Interface::Dtc> &evlDtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
|
||||
QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly),
|
||||
m_ui(new Ui::EvlCommentsDialog),
|
||||
m_evlDtc(evlDtc),
|
||||
m_opmDtc(opmDtc),
|
||||
m_logger(getLogger("EvlComments::EvlCommentsView"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Display_O-C_Evaluations"));
|
||||
|
||||
m_ui->m_tableComments->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
connect(m_ui->m_tableComments, &LtsDataView::LtsDataView::signalDoubleClicked, this, &EvlCommentsView::onLtsDataView_DoubleClicked);
|
||||
|
||||
m_model = new EvlCommentDataViewModel(this);
|
||||
m_proxyModel = new EvlCommentDataViewProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
m_ui->m_tableComments->setModel(m_proxyModel);
|
||||
|
||||
m_ui->m_tableComments->installEventFilter(this);
|
||||
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Ok)->hide();
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Apply)->hide();
|
||||
|
||||
// Get historical comments
|
||||
auto cb = [this](const Evaluations::EvaluationComment & c)
|
||||
{
|
||||
insertComment(c);
|
||||
};
|
||||
m_evlDtc->evaluationComments(cb);
|
||||
|
||||
// Subscribe for new comments
|
||||
connect(m_evlDtc.get(), &Evaluations::Interface::Dtc::evaluationCommentChanged, this, &EvlCommentsView::onCommentChanged, Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
|
||||
EvlCommentsView::~EvlCommentsView()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void EvlCommentsView::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Display O/C Evaluations"));
|
||||
}
|
||||
|
||||
|
||||
bool EvlCommentsView::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
if (object == m_ui->m_tableComments)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent *pKeyEvent = static_cast<QKeyEvent *>(event);
|
||||
// Enter: Enter on numpad
|
||||
if (pKeyEvent->key() == Qt::Key_Return || pKeyEvent->key() == Qt::Key_Enter)
|
||||
onLtsDataView_DoubleClicked();
|
||||
}
|
||||
}
|
||||
|
||||
return LtsWidgets::LtsDialog::eventFilter(object, event);
|
||||
}
|
||||
|
||||
void EvlCommentsView::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->m_tableComments->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
|
||||
void EvlCommentsView::onLtsDataView_DoubleClicked()
|
||||
{
|
||||
const QModelIndex idx = m_ui->m_tableComments->currentIndex();
|
||||
|
||||
if (idx.row() >= 0)
|
||||
{
|
||||
Evaluations::CommentTuple row = m_model->getRowData(idx.row());
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this, tr("Comment:") + QStringLiteral("\n") + row.m_text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EvlCommentsView::onCommentChanged(const EvaluationComment &data, DataModification modType)
|
||||
{
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
insertComment(data);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool EvlCommentsView::insertComment(const Evaluations::EvaluationComment &c)
|
||||
{
|
||||
QString strSenderOperatorName, strReceiverOperatorName;
|
||||
|
||||
OperatorManagement::User sender = m_opmDtc->user(c.senderOperatorId());
|
||||
strSenderOperatorName = QString::fromStdString(sender.name());
|
||||
|
||||
if (c.receiverOperatorId().is_set())
|
||||
{
|
||||
// Add only if receiver id matches to the current operator!
|
||||
OperatorManagement::User loggedInOperator = m_opmDtc->user(LtsSessionData::LtsSessionData::getInstance()->getOperatorId());
|
||||
|
||||
if (c.receiverOperatorId().get() != loggedInOperator.id())
|
||||
return false;
|
||||
|
||||
OperatorManagement::User receiver = m_opmDtc->user(c.receiverOperatorId().get());
|
||||
strReceiverOperatorName = QString::fromStdString(receiver.name());
|
||||
}
|
||||
|
||||
CommentTuple t;
|
||||
t.m_commentId = c.id();
|
||||
t.m_timestamp = QDateTime::fromMSecsSinceEpoch(c.ts());
|
||||
t.m_sender = strSenderOperatorName;
|
||||
t.m_receiver = strReceiverOperatorName;
|
||||
t.m_text = QString::fromStdString(c.text());
|
||||
t.m_hierarchy = QString::fromStdString(c.hierarchy());
|
||||
|
||||
return m_model->insertRow(t);
|
||||
}
|
||||
}
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Last, NLSE, 2018-01-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EvlCommentsDialog;
|
||||
}
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class EvlCommentDataViewModel;
|
||||
class EvlCommentDataViewProxyModel;
|
||||
|
||||
class EvlCommentsView : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
EvlCommentsView(const std::shared_ptr<Interface::Dtc> &evlDtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
|
||||
QWidget *parent = nullptr);
|
||||
~EvlCommentsView();
|
||||
|
||||
private slots:
|
||||
void onLtsDataView_DoubleClicked();
|
||||
void onCommentChanged(const Evaluations::EvaluationComment &data, DataModification modType);
|
||||
|
||||
private:
|
||||
bool insertComment(const Evaluations::EvaluationComment &c);
|
||||
void retranslate() override;
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
Ui::EvlCommentsDialog *m_ui{nullptr};
|
||||
|
||||
std::shared_ptr<Interface::Dtc> m_evlDtc;
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
|
||||
|
||||
EvlCommentDataViewModel *m_model{nullptr};
|
||||
EvlCommentDataViewProxyModel *m_proxyModel{nullptr};
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace BuildingViewer
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EvlCommentsDialog</class>
|
||||
<widget class="QWidget" name="EvlCommentsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>455</width>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="LtsDataView::LtsDataView" name="m_tableComments">
|
||||
<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>
|
||||
+1280
File diff suppressed because it is too large.
Load diff
+143
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Philipp Last, NLSE, 02.01.2018
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <OcSituationClient/osc_ftc.h>
|
||||
#include <FileManagement/flm_dtc.h>
|
||||
#include <FileManagement/flm_ftc.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
|
||||
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
||||
#include <Plugins/FileManagement/Data/flm_data_plugin.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#include "evl_edit_treemodel_schema.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EditSchemaDialog;
|
||||
}
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class EvlNewCommentDialog;
|
||||
|
||||
class EditSchemaDialog : public LtsWidgets::LtsDialog
|
||||
, protected Interface::Ftc::EvlCommentModifyReplyHandler
|
||||
, protected Interface::Ftc::EvlSchemaModifyReplyHandler
|
||||
, protected FileManagement::Interface::Ftc::FileContentModifyReplyHandler
|
||||
, protected OcSituationClient::Interface::Ftc::SendEvaluationReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EditSchemaDialog(bool ocMode, bool runningOnTablet, LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~EditSchemaDialog();
|
||||
|
||||
bool init(const std::shared_ptr<OcSituationClient::Interface::Ftc> &ocFtc,
|
||||
const std::shared_ptr<Interface::Ftc> &evlFtc,
|
||||
const std::shared_ptr<Interface::Dtc> &evlDtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
|
||||
const std::shared_ptr<FileManagement::Interface::Ftc> &flmFtc,
|
||||
const std::shared_ptr<FileManagement::Interface::Dtc> &flmDtc,
|
||||
const std::shared_ptr<FileManagement::ForeignGuiInterface> &flmGui);
|
||||
void retranslate() override;
|
||||
|
||||
private:
|
||||
void onSendEvaluationReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
|
||||
void onEvlCommentModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onEvlSchemaModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
// FileManagement
|
||||
void onFileContentModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject);}
|
||||
|
||||
private slots:
|
||||
void onRequestSchema();
|
||||
void onNotifyAboutSchema(const Evaluations::EvaluationSchema &data, DataModification modType);
|
||||
void onAddNewComment();
|
||||
void onCommentAccepted();
|
||||
void onCommentEditAccepted();
|
||||
void onSendComment();
|
||||
void onSendAllComments();
|
||||
|
||||
void onTreeViewDoubleClicked();
|
||||
void onEditComment();
|
||||
void onModifySelectedEntry();
|
||||
void onTreeViewModelIndexChanged(const QModelIndex &curr);
|
||||
void onTriedToDropFolderToElement();
|
||||
void onDropActionFinished(const QModelIndex &parent);
|
||||
void onShowContextMenu(const QPoint &position);
|
||||
|
||||
bool onSaveToLibrary();
|
||||
void onLoadFromLibrary();
|
||||
void onAddElement();
|
||||
void onAddFolder();
|
||||
void onAddRootFolder();
|
||||
|
||||
void onCreateNewSchema();
|
||||
void onRemoveSelectedElement();
|
||||
|
||||
void DebugonLoadSchema();
|
||||
void onSendSchema();
|
||||
|
||||
private:
|
||||
void loadLatestSchema();
|
||||
void handleUnsentComments();
|
||||
void updateCommentLabel();
|
||||
void markCommentAsSent(const QPersistentModelIndex &idx);
|
||||
|
||||
// Somehow identically...
|
||||
EvlCommentModifyRequest createEvlCommentModifyRequest(const ItemComment &c) const;
|
||||
OcSituationClient::SendEvaluationRequest createSendEvaluationRequest(const ItemComment &c) const;
|
||||
QVector<QPersistentModelIndex> m_vecCommentsInSendState;
|
||||
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
void addEntry(bool isFolder, bool isNewRoot = false);
|
||||
|
||||
void removeEntry(const QModelIndex &idx);
|
||||
void removeComment(const QModelIndex &idx);
|
||||
void sendComment(const QModelIndex &idx);
|
||||
|
||||
void createExampleSchema();
|
||||
void loadSchema(qint32 schemaId);
|
||||
void saveSchema(bool sendToTa);
|
||||
bool apply() override;
|
||||
|
||||
bool m_ocMode{false};
|
||||
bool m_runningOnTablet{false};
|
||||
TreeModelSchema *m_pModel{nullptr};
|
||||
|
||||
QMap<qint32, Evaluations::EvaluationSchema> m_mapSchemata;
|
||||
qint32 m_loadedSchemaId{0};
|
||||
|
||||
std::shared_ptr<OcSituationClient::Interface::Ftc> m_ocFtc;
|
||||
std::shared_ptr<Interface::Dtc> m_evlDtc;
|
||||
std::shared_ptr<Interface::Ftc> m_evlFtc;
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
|
||||
|
||||
std::shared_ptr<FileManagement::Interface::Ftc> m_flmFtc;
|
||||
std::shared_ptr<FileManagement::Interface::Dtc> m_flmDtc;
|
||||
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
|
||||
|
||||
QString m_lastFileName;
|
||||
Evaluations::EvlNewCommentDialog *m_commentDlg{nullptr};
|
||||
LtsSession::LtsSession *m_session{nullptr};
|
||||
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
Ui::EditSchemaDialog *m_ui{nullptr};
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
|
||||
+223
@@ -0,0 +1,223 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EditSchemaDialog</class>
|
||||
<widget class="QWidget" name="EditSchemaDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1900</width>
|
||||
<height>515</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Presentation Editor</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QTreeView" name="m_treeViewSchema">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
<property name="defaultDropAction">
|
||||
<enum>Qt::MoveAction</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="expandsOnDoubleClick">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>27</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_RequestSchema">
|
||||
<property name="text">
|
||||
<string>Request schema</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_labelComments">
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_SendComment">
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_SendAllComments">
|
||||
<property name="text">
|
||||
<string>Send all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_NewComment">
|
||||
<property name="text">
|
||||
<string>New comment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_EditComment">
|
||||
<property name="text">
|
||||
<string>Edit comment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_RemoveComment">
|
||||
<property name="text">
|
||||
<string>Remove comment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_CreateNewSchema">
|
||||
<property name="text">
|
||||
<string>Create new schema</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_SendSchema">
|
||||
<property name="text">
|
||||
<string>Send schema</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_LoadSchemaDebug">
|
||||
<property name="text">
|
||||
<string>Load schema (DEBUG)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_SaveToLibrary">
|
||||
<property name="text">
|
||||
<string>Save to library</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_LoadFromLibrary">
|
||||
<property name="text">
|
||||
<string>Load from library</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_AddRootFolder">
|
||||
<property name="text">
|
||||
<string>Add root folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_AddFolder">
|
||||
<property name="text">
|
||||
<string>Add folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_AddElement">
|
||||
<property name="text">
|
||||
<string>Add element</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_Modify">
|
||||
<property name="text">
|
||||
<string>Modify</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pushButton_Remove">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Philipp Last, NLSE, 08.01.2018
|
||||
*/
|
||||
|
||||
#include "evl_edit_schema_element_data.h"
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
QDataStream &operator<<(QDataStream &out, const ElementData &e)
|
||||
{
|
||||
out << e.m_id;
|
||||
out << e.m_parentId;
|
||||
out << e.m_text;
|
||||
out << int(e.m_state);
|
||||
out << e.m_icon; // Not working
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator >>(QDataStream &in, ElementData::State &s)
|
||||
{
|
||||
int state;
|
||||
in >> state;
|
||||
s = static_cast<ElementData::State>(state);
|
||||
return in;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, ElementData &e)
|
||||
{
|
||||
in >> e.m_id;
|
||||
in >> e.m_parentId;
|
||||
in >> e.m_text;
|
||||
in >> e.m_state;
|
||||
in >> e.m_icon; // Not working
|
||||
return in;
|
||||
}
|
||||
} // namespace Evaluations
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Philipp Last, NLSE, 08.01.2018
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QIcon>
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
#include <QDataStream>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class ItemComment
|
||||
{
|
||||
public:
|
||||
ItemComment()
|
||||
: m_timeStamp(QDateTime::currentDateTimeUtc())
|
||||
, m_icon(QIcon(QStringLiteral("icon:messages_disabled.svg")))
|
||||
{}
|
||||
|
||||
|
||||
ItemComment(const QString &text, int32_t senderId, int32_t receiverId, int32_t elementId, const QString &hierarchy)
|
||||
: m_elementId(elementId)
|
||||
, m_senderId(senderId)
|
||||
, m_receiverId(receiverId)
|
||||
, m_timeStamp(QDateTime::currentDateTimeUtc())
|
||||
, m_text(text)
|
||||
, m_hierarchy(hierarchy)
|
||||
, m_icon(QIcon(QStringLiteral("icon:messages_disabled.svg")))
|
||||
{}
|
||||
|
||||
|
||||
ItemComment(const QString &text, int32_t senderId, int32_t receiverId, int32_t elementId, const QDateTime &timeStamp)
|
||||
: m_elementId(elementId)
|
||||
, m_senderId(senderId)
|
||||
, m_receiverId(receiverId)
|
||||
, m_timeStamp(timeStamp)
|
||||
, m_text(text)
|
||||
, m_icon(QIcon(QStringLiteral("icon:messages.svg")))
|
||||
{}
|
||||
|
||||
bool isSent() const
|
||||
{
|
||||
return m_isSent;
|
||||
}
|
||||
|
||||
void markAsSent()
|
||||
{
|
||||
m_icon = QIcon(QStringLiteral("icon:messages.svg"));
|
||||
m_isSent = true;
|
||||
}
|
||||
|
||||
const QString &getText() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
const QString &getHierarchy() const
|
||||
{
|
||||
return m_hierarchy;
|
||||
}
|
||||
|
||||
void setText(const QString &strText)
|
||||
{
|
||||
m_text = strText;
|
||||
}
|
||||
|
||||
const QDateTime &getTimeStamp() const
|
||||
{
|
||||
return m_timeStamp;
|
||||
}
|
||||
|
||||
const QIcon &getIcon() const
|
||||
{
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
bool hasReceiverId() const
|
||||
{
|
||||
return m_receiverId != 0;
|
||||
}
|
||||
|
||||
int32_t receiverId() const
|
||||
{
|
||||
return m_receiverId;
|
||||
}
|
||||
|
||||
int32_t senderId() const
|
||||
{
|
||||
return m_senderId;
|
||||
}
|
||||
|
||||
int32_t elementId() const
|
||||
{
|
||||
return m_elementId;
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_isSent{false};
|
||||
int32_t m_elementId{0}; // Parent id (which is an element)
|
||||
int32_t m_senderId{0};
|
||||
int32_t m_receiverId{0};
|
||||
QDateTime m_timeStamp;
|
||||
QString m_text;
|
||||
QString m_hierarchy;
|
||||
QIcon m_icon;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ElementData
|
||||
{
|
||||
public:
|
||||
enum class State {IsFolder, ElementWithoutComments, ElementWithUnsentComments, ElementAllCommentsSent};
|
||||
|
||||
ElementData()
|
||||
{
|
||||
refreshIcon();
|
||||
}
|
||||
|
||||
explicit ElementData(const QString &text, bool isFolder = true)
|
||||
: m_state(isFolder ? State::IsFolder : State::ElementWithoutComments), m_text(text)
|
||||
{
|
||||
refreshIcon();
|
||||
}
|
||||
|
||||
int m_id{0};
|
||||
int m_parentId{0};
|
||||
|
||||
|
||||
void switchState(State newState)
|
||||
{
|
||||
m_state = newState;
|
||||
refreshIcon();
|
||||
}
|
||||
|
||||
bool hasComments() const
|
||||
{
|
||||
return (m_state != State::IsFolder) && (m_state != State::ElementWithoutComments);
|
||||
}
|
||||
|
||||
bool hasUnsentComments() const
|
||||
{
|
||||
return hasComments() && (m_state != State::ElementAllCommentsSent);
|
||||
}
|
||||
|
||||
bool isFolder() const
|
||||
{
|
||||
return m_state == State::IsFolder;
|
||||
}
|
||||
|
||||
QIcon getIcon() const
|
||||
{
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
void setText(const QString &strText)
|
||||
{
|
||||
m_text = strText;
|
||||
}
|
||||
|
||||
void markAsFolder(bool isFolder)
|
||||
{
|
||||
m_state = isFolder ? State::IsFolder : State::ElementWithoutComments;
|
||||
refreshIcon();
|
||||
}
|
||||
|
||||
QString getText() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
void refreshIcon()
|
||||
{
|
||||
switch (m_state)
|
||||
{
|
||||
case State::IsFolder:
|
||||
m_icon = QIcon(QStringLiteral("icon:evaluation_folder.svg"));
|
||||
break;
|
||||
|
||||
case State::ElementAllCommentsSent:
|
||||
m_icon = QIcon(QStringLiteral("icon:evaluation_sent_comments.svg"));
|
||||
break;
|
||||
|
||||
case State::ElementWithUnsentComments:
|
||||
m_icon = QIcon(QStringLiteral("icon:evaluation_unsent_comment.svg"));
|
||||
break;
|
||||
|
||||
case State::ElementWithoutComments:
|
||||
m_icon = QIcon(QStringLiteral("icon:evaluation_no_comments.svg"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
State getState() const
|
||||
{
|
||||
return m_state;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
State m_state{State::IsFolder};
|
||||
QString m_text;
|
||||
QIcon m_icon;
|
||||
|
||||
friend QDataStream &operator<<(QDataStream &out, const ElementData &e);
|
||||
friend QDataStream &operator>>(QDataStream &in, ElementData &e);
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const ElementData &e);
|
||||
QDataStream &operator>>(QDataStream &in, ElementData &e);
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(Evaluations::ItemComment)
|
||||
Q_DECLARE_METATYPE(Evaluations::ElementData)
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Philipp Last, NLSE, 05.01.2018
|
||||
*/
|
||||
|
||||
#include "evl_edit_treemodel_general.h"
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
TreeModelGeneral::TreeModelGeneral(QObject *parent, NGL::INGLLogger &logger)
|
||||
: NGLTreeModel(parent, new NGLTreeItem(QVariant()), {QString()}), m_logger(logger)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void TreeModelGeneral::iterateModel(const QModelIndex &parent, const std::function<void(const QModelIndex &, const QVariant &)> &fCallback, bool recursive) const
|
||||
{
|
||||
for (int r = 0; r < rowCount(parent); ++r)
|
||||
{
|
||||
QModelIndex idx = index(r, 0, parent);
|
||||
QVariant v = TreeModelGeneral::data(idx);
|
||||
fCallback(idx, v);
|
||||
|
||||
if (recursive && hasChildren(idx))
|
||||
iterateModel(idx, fCallback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QVariant TreeModelGeneral::dataAsVariant(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
NGLTreeItem *item = privateData(index);
|
||||
return item->data();
|
||||
}
|
||||
|
||||
|
||||
QVariant TreeModelGeneral::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return NGLTreeModel::data(index, role);
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
return NGLTreeModel::data(index, role);
|
||||
|
||||
NGLTreeItem *item = privateData(index);
|
||||
return item->data();
|
||||
}
|
||||
|
||||
|
||||
QModelIndex TreeModelGeneral::insertRow(const QModelIndex &parent, const QVariant &data, const QIcon &icon)
|
||||
{
|
||||
int row = rowCount(parent);
|
||||
|
||||
NGLTreeItem *item = static_cast<NGLTreeItem *>(createItem(data, icon));
|
||||
item->setModified(true);
|
||||
|
||||
if (!NGLTreeModel::insertRow(row, parent, item))
|
||||
return {};
|
||||
|
||||
QModelIndex newIdx = index(row, 0, parent);
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
|
||||
bool TreeModelGeneral::updateRow(const QModelIndex &index, const QVariant &data, const QIcon &icon)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return false;
|
||||
|
||||
return setItemData(index, data, icon);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* All sub elements are also removed.
|
||||
*/
|
||||
void TreeModelGeneral::removeRow(const QModelIndex &idx, bool deleteRootAllowed)
|
||||
{
|
||||
if (!idx.parent().isValid() && !deleteRootAllowed)
|
||||
return;
|
||||
|
||||
removeRows(idx.row(), 1, idx.parent());
|
||||
}
|
||||
} // namespace Evaluations
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Philipp Last, NLSE, 05.01.2018
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <nglwidgets/ngltreemodel.h>
|
||||
#include <nglwidgets/ngltreeitem.h>
|
||||
#include "evl_edit_schema_element_data.h"
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class TreeModelGeneral : public NGLTreeModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TreeModelGeneral(QObject *parent,
|
||||
NGL::INGLLogger &logger);
|
||||
|
||||
void iterateModel(const QModelIndex &parent, const std::function<void(const QModelIndex &, const QVariant &)> &fCallback, bool recursive = true) const;
|
||||
|
||||
QVariant dataAsVariant(const QModelIndex &index) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
QModelIndex insertRow(const QModelIndex &parent, const QVariant &data, const QIcon &icon);
|
||||
bool updateRow(const QModelIndex &index, const QVariant &data, const QIcon &icon);
|
||||
void removeRow(const QModelIndex &idx, bool deleteRootAllowed = false);
|
||||
|
||||
protected:
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Philipp Last, NLSE, 05.01.2018
|
||||
*/
|
||||
|
||||
#include "evl_edit_treemodel_schema.h"
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
TreeModelSchema::TreeModelSchema(QObject *parent, NGL::INGLLogger &logger)
|
||||
: TreeModelGeneral(parent, logger)
|
||||
{
|
||||
qRegisterMetaTypeStreamOperators<Evaluations::ElementData>();
|
||||
}
|
||||
|
||||
|
||||
void TreeModelSchema::resetModel()
|
||||
{
|
||||
TreeModelGeneral::resetModel();
|
||||
m_elementId = 1;
|
||||
m_cntComments = 0;
|
||||
m_cntSentComments = 0;
|
||||
}
|
||||
|
||||
|
||||
bool TreeModelSchema::dropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||
int row, int column, const QModelIndex &parent)
|
||||
{
|
||||
/*
|
||||
* Prevent dropping/appending elements to other elements!
|
||||
* Only dropping to folders is allowed!
|
||||
*/
|
||||
ElementData p = getSelectedIndexDataAsElement(parent);
|
||||
|
||||
if (!p.isFolder())
|
||||
{
|
||||
emit signalTriedToDropFolderToElement();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool success = TreeModelGeneral::dropMimeData(data, action, row, column, parent);
|
||||
|
||||
if (success)
|
||||
{
|
||||
/*
|
||||
* User may have moved a folder with some elements into another folder.
|
||||
* Hence, we have to update the parent ids.
|
||||
*/
|
||||
int parentId = getSelectedIndexDataAsElement(parent).m_id;
|
||||
iterateModel(parent, [this, parentId](const QModelIndex & idx, const QVariant & v)
|
||||
{
|
||||
Evaluations::ElementData e = v.value<Evaluations::ElementData>();
|
||||
e.m_parentId = parentId;
|
||||
updateElementData(idx, e);
|
||||
}, false);
|
||||
|
||||
refreshAllIcons();
|
||||
emit signalSuccessfulDropPerformed(parent);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
QVariant TreeModelSchema::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
QVariant v = TreeModelGeneral::data(index, role);
|
||||
|
||||
if (v.isNull())
|
||||
return v;
|
||||
|
||||
if (v.canConvert<Evaluations::ElementData>())
|
||||
{
|
||||
Evaluations::ElementData e = v.value<Evaluations::ElementData>();
|
||||
return e.getText();
|
||||
}
|
||||
else if (v.canConvert<Evaluations::ItemComment>())
|
||||
{
|
||||
Evaluations::ItemComment c = v.value<Evaluations::ItemComment>();
|
||||
QString str(DTG::toStringMSec(c.getTimeStamp().toMSecsSinceEpoch()));
|
||||
str += QLatin1Char(' ');
|
||||
str += c.getText();
|
||||
return str;
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
ElementData TreeModelSchema::getSelectedIndexDataAsElement(const QModelIndex &idx) const
|
||||
{
|
||||
if (!idx.isValid())
|
||||
ElementData();
|
||||
|
||||
QVariant v = TreeModelGeneral::dataAsVariant(idx);
|
||||
return v.value<Evaluations::ElementData>();
|
||||
}
|
||||
|
||||
|
||||
QVector<QString> TreeModelSchema::getSelectedIndexHierarchy(const QModelIndex &idx) const
|
||||
{
|
||||
if (!idx.isValid())
|
||||
QString();
|
||||
|
||||
QVector<QString> vecHierarchy;
|
||||
|
||||
QModelIndex iterIdx = idx;
|
||||
|
||||
while (iterIdx.parent() != QModelIndex())
|
||||
{
|
||||
Evaluations::ElementData e = getSelectedIndexDataAsElement(iterIdx);
|
||||
vecHierarchy.push_front(e.getText());
|
||||
|
||||
iterIdx = iterIdx.parent();
|
||||
}
|
||||
|
||||
Evaluations::ElementData e = getSelectedIndexDataAsElement(iterIdx);
|
||||
vecHierarchy.push_front(e.getText());
|
||||
|
||||
return vecHierarchy;
|
||||
}
|
||||
|
||||
|
||||
QJsonDocument TreeModelSchema::toJsonDocument() const
|
||||
{
|
||||
QJsonArray arr;
|
||||
|
||||
QModelIndex root;
|
||||
iterateModel(root, [this, &arr](const QModelIndex & idx, const QVariant & v)
|
||||
{
|
||||
Q_UNUSED(idx);
|
||||
Evaluations::ElementData e = v.value<Evaluations::ElementData>();
|
||||
INFO_LOG(m_logger) << "toJsonDocument: Name: " << e.getText() << ", elementId: " << e.m_id << ", parent id: " << e.m_parentId;
|
||||
|
||||
QJsonObject obj;
|
||||
obj[QStringLiteral("id")] = e.m_id;
|
||||
obj[QStringLiteral("parentId")] = e.m_parentId;
|
||||
obj[QStringLiteral("text")] = e.getText();
|
||||
obj[QStringLiteral("state")] = int(e.getState());
|
||||
|
||||
arr.append(obj);
|
||||
});
|
||||
|
||||
QJsonDocument doc(arr);
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
bool TreeModelSchema::fromQJsonDocument(const QJsonDocument &doc)
|
||||
{
|
||||
resetModel();
|
||||
|
||||
const QJsonArray arr(doc.array());
|
||||
|
||||
if (!arr.size())
|
||||
return false;
|
||||
|
||||
QHash<int, QPersistentModelIndex> mapId2Index;
|
||||
|
||||
for (const QJsonValue &val : arr)
|
||||
{
|
||||
const QJsonObject obj = val.toObject();
|
||||
|
||||
ElementData d(obj[QStringLiteral("text")].toString());
|
||||
d.m_id = obj[QStringLiteral("id")].toInt();
|
||||
d.m_parentId = obj[QStringLiteral("parentId")].toInt();
|
||||
d.switchState((ElementData::State)obj[QStringLiteral("state")].toInt());
|
||||
|
||||
QPersistentModelIndex parent = (d.m_parentId == 0) ? QPersistentModelIndex() : mapId2Index[d.m_parentId];
|
||||
QModelIndex newIdx = TreeModelGeneral::insertRow(parent, QVariant::fromValue(d), d.getIcon());
|
||||
|
||||
mapId2Index[d.m_id] = newIdx;
|
||||
|
||||
/*
|
||||
* Get current max element id. This is required since
|
||||
* the user will most likely add new elements to the loaded treeview / element list
|
||||
*/
|
||||
m_elementId = std::max(m_elementId, d.m_id);
|
||||
INFO_LOG(m_logger) << "fromQJsonDocument: " << d.getText() << ", own id = " << d.m_id << ", parent id = " << d.m_parentId;
|
||||
}
|
||||
|
||||
++m_elementId;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QModelIndex TreeModelSchema::insertComment(const QModelIndex &parent, const ItemComment &data)
|
||||
{
|
||||
QModelIndex idx = TreeModelGeneral::insertRow(parent, QVariant::fromValue(data), data.getIcon());
|
||||
|
||||
if (idx.isValid())
|
||||
{
|
||||
++m_cntComments;
|
||||
|
||||
if (data.isSent())
|
||||
++m_cntSentComments;
|
||||
|
||||
refreshElementDataIconState(parent);
|
||||
}
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
||||
void TreeModelSchema::insertComment(const ItemComment &data)
|
||||
{
|
||||
QModelIndex root = QModelIndex();
|
||||
iterateModel(root, [&data, this](const QModelIndex & idx, const QVariant & v)
|
||||
{
|
||||
if (v.canConvert<Evaluations::ElementData>())
|
||||
{
|
||||
ElementData e = v.value<Evaluations::ElementData>();
|
||||
if (e.m_id == data.elementId())
|
||||
TreeModelSchema::insertComment(idx, data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
bool TreeModelSchema::updateComment(const QModelIndex &index, const ItemComment &data)
|
||||
{
|
||||
bool success = TreeModelGeneral::updateRow(index, QVariant::fromValue(data), data.getIcon());
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (data.isSent())
|
||||
++m_cntSentComments;
|
||||
|
||||
refreshElementDataIconState(index.parent());
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
void TreeModelSchema::removeComment(const QModelIndex &idx)
|
||||
{
|
||||
if (!idx.isValid())
|
||||
return;
|
||||
|
||||
--m_cntComments;
|
||||
QModelIndex idxParentElement = idx.parent();
|
||||
removeRow(idx);
|
||||
refreshElementDataIconState(idxParentElement);
|
||||
}
|
||||
|
||||
|
||||
QModelIndex TreeModelSchema::insertElementData(const QModelIndex &parent, const ElementData &data)
|
||||
{
|
||||
ElementData d(data);
|
||||
d.m_id = m_elementId++;
|
||||
d.m_parentId = !parent.isValid() ? 0 : getSelectedIndexDataAsElement(parent).m_id;
|
||||
|
||||
return TreeModelGeneral::insertRow(parent, QVariant::fromValue(d), d.getIcon());
|
||||
}
|
||||
|
||||
|
||||
bool TreeModelSchema::updateElementData(const QModelIndex &index, const ElementData &data)
|
||||
{
|
||||
return TreeModelGeneral::updateRow(index, QVariant::fromValue(data), data.getIcon());
|
||||
}
|
||||
|
||||
|
||||
void TreeModelSchema::refreshElementDataIconState(const QModelIndex &idx)
|
||||
{
|
||||
ElementData e = getSelectedIndexDataAsElement(idx);
|
||||
|
||||
if (e.isFolder())
|
||||
return;
|
||||
|
||||
if (!rowCount(idx))
|
||||
e.switchState(ElementData::State::ElementWithoutComments);
|
||||
else
|
||||
{
|
||||
bool hasUnsentComments = false;
|
||||
iterateModel(idx, [&hasUnsentComments](const QModelIndex & idx, const QVariant & v)
|
||||
{
|
||||
Q_UNUSED(idx);
|
||||
const Evaluations::ItemComment d = v.value<Evaluations::ItemComment>();
|
||||
if (!d.isSent())
|
||||
hasUnsentComments = true;
|
||||
});
|
||||
|
||||
e.switchState(hasUnsentComments ? ElementData::State::ElementWithUnsentComments : ElementData::State::ElementAllCommentsSent);
|
||||
}
|
||||
|
||||
TreeModelGeneral::updateRow(idx, QVariant::fromValue(e), e.getIcon());
|
||||
}
|
||||
|
||||
|
||||
void TreeModelSchema::refreshAllIcons()
|
||||
{
|
||||
QModelIndex root;
|
||||
iterateModel(root, [this](const QModelIndex & idx, const QVariant & v)
|
||||
{
|
||||
Evaluations::ElementData d = v.value<Evaluations::ElementData>();
|
||||
d.refreshIcon();
|
||||
|
||||
NGLTreeItem *item = privateData(idx);
|
||||
item->setIcon(d.getIcon());
|
||||
});
|
||||
|
||||
emit dataChanged(QModelIndex(), QModelIndex());
|
||||
}
|
||||
} // namespace Evaluations
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Philipp Last, NLSE, 05.01.2018
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include "evl_edit_treemodel_general.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EditSchemaDialog;
|
||||
}
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class TreeModelSchema : public TreeModelGeneral
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TreeModelSchema(QObject *parent,
|
||||
NGL::INGLLogger &logger);
|
||||
|
||||
void resetModel();
|
||||
|
||||
// We can only move elements around but not copy them
|
||||
Qt::DropActions supportedDropActions() const override { return Qt::MoveAction; }
|
||||
Qt::DropActions supportedDragActions() const override { return Qt::MoveAction; }
|
||||
|
||||
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||
int row, int column, const QModelIndex &parent) override;
|
||||
|
||||
QJsonDocument toJsonDocument() const;
|
||||
bool fromQJsonDocument(const QJsonDocument &doc);
|
||||
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
ElementData getSelectedIndexDataAsElement(const QModelIndex &idx) const;
|
||||
QVector<QString> getSelectedIndexHierarchy(const QModelIndex &idx) const;
|
||||
|
||||
|
||||
// Comments
|
||||
unsigned int cntComments() const
|
||||
{
|
||||
return m_cntComments;
|
||||
}
|
||||
|
||||
unsigned int cntSentComments() const
|
||||
{
|
||||
return m_cntSentComments;
|
||||
}
|
||||
|
||||
QModelIndex insertComment(const QModelIndex &parent, const ItemComment &data);
|
||||
void insertComment(const ItemComment &data);
|
||||
bool updateComment(const QModelIndex &index, const ItemComment &data);
|
||||
void removeComment(const QModelIndex &idx);
|
||||
|
||||
// ElementData (Folder or Elements)
|
||||
QModelIndex insertElementData(const QModelIndex &parent, const ElementData &data);
|
||||
bool updateElementData(const QModelIndex &index, const ElementData &data);
|
||||
|
||||
signals:
|
||||
void signalTriedToDropFolderToElement();
|
||||
void signalSuccessfulDropPerformed(const QModelIndex &parent);
|
||||
|
||||
private:
|
||||
void refreshElementDataIconState(const QModelIndex &idx);
|
||||
void refreshAllIcons();
|
||||
|
||||
unsigned int m_cntComments{0};
|
||||
unsigned int m_cntSentComments{0};
|
||||
|
||||
int m_elementId{1};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Last, NLSE, 2018-01-11
|
||||
*/
|
||||
#include "ui_evl_new_comment_dialog.h"
|
||||
#include "evl_new_comment_dialog.h"
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
EvlNewCommentDialog::EvlNewCommentDialog(const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
|
||||
QWidget *parent)
|
||||
: QDialog(parent),
|
||||
m_ui(new Ui::EvlNewCommentDialog),
|
||||
m_logger(getLogger("EvlComments::EvlNewCommentDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
setWindowFlags(Qt::Tool);
|
||||
m_ui->m_ltsComboBox_ReceiverOperator->addItem(tr("All (Default)"), 0);
|
||||
|
||||
auto cbUser = [this](const OperatorManagement::User &user)
|
||||
{
|
||||
m_ui->m_ltsComboBox_ReceiverOperator->addItem(QString::fromStdString(user.name()), user.id());
|
||||
};
|
||||
opmDtc->users(cbUser);
|
||||
|
||||
connect(m_ui->m_pushButton_AddComment, &QPushButton::clicked, this, &QDialog::accept);
|
||||
connect(m_ui->m_pushButton_Cancel, &QPushButton::clicked, this, &QDialog::reject);
|
||||
connect(m_ui->m_plainTextEdit_Comment, &QPlainTextEdit::textChanged, this, &EvlNewCommentDialog::onTextChanged);
|
||||
|
||||
m_ui->m_checkBox_SendComment->setChecked(LtsUtils::OperatorSettings::getInstance()->value(QStringLiteral("Evaluations"), QStringLiteral("setAutoSendComments"), false).toBool());
|
||||
|
||||
onTextChanged();
|
||||
}
|
||||
|
||||
|
||||
EvlNewCommentDialog::~EvlNewCommentDialog()
|
||||
{
|
||||
LtsUtils::OperatorSettings::getInstance()->setValue(QStringLiteral("Evaluations"), QStringLiteral("setAutoSendComments"), m_ui->m_checkBox_SendComment->isChecked());
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void EvlNewCommentDialog::onTextChanged()
|
||||
{
|
||||
QString plainText(m_ui->m_plainTextEdit_Comment->toPlainText());
|
||||
int currentUsedChars = plainText.toUtf8().size();
|
||||
bool bNeedSetNew = false;
|
||||
|
||||
while (currentUsedChars > m_maxChars)
|
||||
{
|
||||
plainText.chop(1);
|
||||
currentUsedChars = plainText.toUtf8().size();
|
||||
bNeedSetNew = true; // do not set text directly, results in recursion
|
||||
}
|
||||
|
||||
// if text longer than allowed
|
||||
if (bNeedSetNew)
|
||||
{
|
||||
m_ui->m_plainTextEdit_Comment->setPlainText(plainText);
|
||||
m_ui->m_plainTextEdit_Comment->moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
m_ui->m_label_CharsLeft->setText(tr("Characters left: %1").arg(m_maxChars - currentUsedChars));
|
||||
}
|
||||
|
||||
|
||||
bool EvlNewCommentDialog::autoSend() const
|
||||
{
|
||||
return m_ui->m_checkBox_SendComment->isChecked();
|
||||
}
|
||||
|
||||
|
||||
QString EvlNewCommentDialog::comment() const
|
||||
{
|
||||
return m_ui->m_plainTextEdit_Comment->toPlainText();
|
||||
}
|
||||
|
||||
|
||||
int EvlNewCommentDialog::selectedReceiverId() const
|
||||
{
|
||||
return m_ui->m_ltsComboBox_ReceiverOperator->currentData().toInt();
|
||||
}
|
||||
|
||||
void EvlNewCommentDialog::setAsEditComment(const QString &text)
|
||||
{
|
||||
m_ui->m_plainTextEdit_Comment->setPlainText(text);
|
||||
m_ui->m_label_CharsLeft->hide();
|
||||
m_ui->label->hide();
|
||||
m_ui->m_ltsComboBox_ReceiverOperator->hide();
|
||||
m_ui->m_checkBox_SendComment->hide();
|
||||
|
||||
m_ui->m_pushButton_AddComment->setText(tr("Edit Comment"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Last, NLSE, 2018-01-12
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EvlNewCommentDialog;
|
||||
}
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class EvlNewCommentDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EvlNewCommentDialog(const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
|
||||
QWidget *parent = nullptr);
|
||||
~EvlNewCommentDialog();
|
||||
|
||||
bool autoSend() const;
|
||||
QString comment() const;
|
||||
int selectedReceiverId() const;
|
||||
void setAsEditComment(const QString &text);
|
||||
|
||||
private slots:
|
||||
void onTextChanged();
|
||||
|
||||
private:
|
||||
Ui::EvlNewCommentDialog *m_ui{nullptr};
|
||||
const int m_maxChars{255};
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace Evaluations
|
||||
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EvlNewCommentDialog</class>
|
||||
<widget class="QWidget" name="EvlNewCommentDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>540</width>
|
||||
<height>347</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="7">
|
||||
<widget class="QPushButton" name="m_pushButton_Cancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="8">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Comment:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPlainTextEdit" name="m_plainTextEdit_Comment">
|
||||
<property name="toolTip">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="m_label_CharsLeft">
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Receiver operator:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4" colspan="2">
|
||||
<widget class="QCheckBox" name="m_checkBox_SendComment">
|
||||
<property name="text">
|
||||
<string>Send comment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="8">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="4">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>240</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="6">
|
||||
<widget class="QPushButton" name="m_pushButton_AddComment">
|
||||
<property name="text">
|
||||
<string>Add comment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5" colspan="3">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="m_ltsComboBox_ReceiverOperator"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+297
@@ -0,0 +1,297 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for Evaluations
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-15
|
||||
*/
|
||||
|
||||
#include "evl_edit_gui_plugin.h"
|
||||
#include "CriteriumEdit/evl_dialog.h"
|
||||
#include "CriteriumEdit/TopicEditor/topic_editor.h"
|
||||
#include "SchemaEdit/evl_edit_schema.h"
|
||||
#include "SchemaEdit/evl_comments.h"
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
|
||||
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
#include <Plugins/ExerciseManagement/exm_data_plugin_interface.h>
|
||||
#include <Plugins/OcSituationClient/osc_data_plugin_interface.h>
|
||||
|
||||
#include <Evaluations/evl_operator_rights.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Evl.Edit"))
|
||||
{}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
const bool enableEvaluationsElements = ps->value(QStringLiteral("evl"),
|
||||
QStringLiteral("enableEvaluationsElements")).toBool();
|
||||
|
||||
const bool enableEvaluations = ps->value(QStringLiteral("evl"),
|
||||
QStringLiteral("enableEvaluations")).toBool();
|
||||
|
||||
|
||||
if (appId() != LtsAppDescriptor::App::OC)
|
||||
{
|
||||
if (enableEvaluationsElements)
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Own Evaluation Criteria");
|
||||
plData.menuIcon = QIcon(QStringLiteral("icon:evaluate.svg"));
|
||||
plData.identifier = QLatin1String("evlEditE");
|
||||
plData.operatorRight = OperatorRights::EvaluationElementEdit;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
bool ownEvlElements = true;
|
||||
return onEditCriteriumDialog(parent, ownEvlElements );
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
if (enableEvaluations)
|
||||
{
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("All Evaluation Criteria");
|
||||
plData.menuIcon = QIcon(QStringLiteral("icon:evaluation_elements.svg"));
|
||||
plData.identifier = QLatin1String("evlEditCriteria");
|
||||
plData.operatorRight = OperatorRights::EvaluationEdit;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
bool ownEvlElements = false;
|
||||
return onEditCriteriumDialog(parent, ownEvlElements );
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("O/C Evaluation Schemes");
|
||||
plData.menuIcon = QIcon(QStringLiteral("icon:oc_evaluation_schemes.svg"));
|
||||
plData.identifier = QLatin1String("evlEditSchemes");
|
||||
plData.operatorRight = OperatorRights::EvaluationEdit;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onEditSchemaDialog(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Display O/C Evaluations");
|
||||
plData.menuIcon = QIcon(QStringLiteral("icon:display_oc_evaluations.svg"));
|
||||
plData.identifier = QLatin1String("evlDisplayOCEvaluations");
|
||||
plData.operatorRight = OperatorRights::EvaluationShow;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onCommentsDialog(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Provide possibility to test oc stuff on workstation
|
||||
#ifndef LTS_DEBUG
|
||||
if (appId() == LtsAppDescriptor::App::OC)
|
||||
#endif
|
||||
{
|
||||
|
||||
if (enableEvaluations)
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("O/C Evaluations");
|
||||
plData.menuIcon = QIcon(QStringLiteral("icon:oc_evaluation_schemes.svg"));
|
||||
plData.identifier = QLatin1String("evlOCEvaluations");
|
||||
plData.operatorRight = OperatorRights::EvaluationShow;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onCreateCommentsDialog(parent, true);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
if (!m_session->getDtc<Evaluations::DataInterface>(m_evlDtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getDtc for Evaluations::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_session->getFtc<Evaluations::DataInterface>(m_evlFtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getFtc for Evaluations::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_session->getDtc<FileManagement::DataInterface>(m_flmDtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_flmDtc for FileManagement::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_session->getFtc<FileManagement::DataInterface>(m_flmFtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getFtc for FileManagement::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_session->getForeignGuiInterface(m_flmGui))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getForeignGuiInterface for FileManagement failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_session->getDtc<OperatorManagement::DataInterface>(m_opmDtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getDtc for OperatorManagement::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_session->getDtc<ExerciseManagement::DataInterface>(m_exmDtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getDtc for ExerciseManagement::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// optional, only needed in ElementEditDialog and checked there if available
|
||||
m_session->getForeignDataInterface_NEW<AudioVideoManagement::DataInterface>(m_avmDataIfc);
|
||||
|
||||
|
||||
if (!m_session->getForeignGuiInterface(m_fltParticipantIfc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getForeignGuiInterface for Filter Management Participan Gui failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_session->getForeignGuiInterface(m_fltAesIfc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getForeignGuiInterface for Filter Management Aes Gui failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_session->getForeignGuiInterface(m_fltBuildingComponentfc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getForeignGuiInterface for Filter Management BuildingComponent Gui failed.";
|
||||
|
||||
// Nachtrag zu GUEZE-1769: since fltBuildingComponentIfc is optional:
|
||||
// return false;
|
||||
}
|
||||
|
||||
if (!m_session->getForeignGuiInterface<OperatorManagement::ForeignGuiComboboxInterface>(m_opmCbxDtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getForeignGuiInterface for OperatorManagement failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_session->getFtc<OcSituationClient::DataInterface>(m_ocFtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_ocFtc for OcSituationClient::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "fetchInterfaces successful";
|
||||
return true;
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_opmDtc = nullptr;
|
||||
m_opmCbxDtc = nullptr;
|
||||
m_exmDtc = nullptr;
|
||||
m_avmDataIfc = nullptr;
|
||||
m_flmDtc = nullptr;
|
||||
m_flmFtc = nullptr;
|
||||
m_flmGui = nullptr;
|
||||
m_evlFtc = nullptr;
|
||||
m_evlDtc = nullptr;
|
||||
m_ocFtc = nullptr;
|
||||
m_fltParticipantIfc = nullptr;
|
||||
m_fltAesIfc = nullptr;
|
||||
m_fltBuildingComponentfc = nullptr;
|
||||
}
|
||||
|
||||
TopicEditorBase::TopicEditor *InterfaceImpl::createTopicEditor(const TopicEditorBase::TopicData &data)
|
||||
{
|
||||
EvaluationTopicEditor *editor = new EvaluationTopicEditor(m_session);
|
||||
|
||||
if (!editor->fetchInterfaces())
|
||||
{
|
||||
delete editor;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
editor->setTopicData(data);
|
||||
return editor;
|
||||
}
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
return tr("Evaluation");
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onEditCriteriumDialog(QWidget *parent, bool ownEvlElements)
|
||||
{
|
||||
CriteriumDialog *dialog = new CriteriumDialog(menuGroup(), m_session, ownEvlElements, parent);
|
||||
dialog->init(m_evlDtc, m_evlFtc, m_opmDtc, m_opmCbxDtc, m_exmDtc,
|
||||
m_avmDataIfc, m_fltParticipantIfc, m_fltAesIfc, m_fltBuildingComponentfc, m_session->exerciseId(),
|
||||
LtsSessionData::LtsSessionData::getInstance()->getOperatorId());
|
||||
return dialog;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onEditSchemaDialog(QWidget *parent)
|
||||
{
|
||||
EditSchemaDialog *dialog = new EditSchemaDialog(false, false, m_session, parent);
|
||||
dialog->init(m_ocFtc, m_evlFtc, m_evlDtc, m_opmDtc, m_flmFtc, m_flmDtc, m_flmGui);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onCreateCommentsDialog(QWidget *parent, bool runningOnTablet)
|
||||
{
|
||||
EditSchemaDialog *dialog = new EditSchemaDialog(true, runningOnTablet, m_session, parent);
|
||||
dialog->init(m_ocFtc, m_evlFtc, m_evlDtc, m_opmDtc, m_flmFtc, m_flmDtc, m_flmGui);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onCommentsDialog(QWidget *parent)
|
||||
{
|
||||
EvlCommentsView *dialog = new EvlCommentsView(m_evlDtc, m_opmDtc, parent);
|
||||
return dialog;
|
||||
}
|
||||
} // namespace Evaluations
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for Evaluations
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, SLSE, 2017-11-01
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <Services/OcSituationClient/osc_ftc.h>
|
||||
#include <Services/ExerciseManagement/exm_dtc.h>
|
||||
#include <Services/OperatorManagement/opm_dtc.h>
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/Evaluations/evl_data_plugin_interface.h>
|
||||
#include <Plugins/Evaluations/evl_gui_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>
|
||||
#include <Plugins/FileManagement/flm_data_plugin_interface.h>
|
||||
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
||||
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
|
||||
|
||||
namespace TopicEditorBase { struct TopicData; }
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:evl.edit")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("EvlEditGuiPlugin"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Replay;
|
||||
}
|
||||
};
|
||||
|
||||
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface, public ForeignGuiInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
QString menuGroup() const override;
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Replay; }
|
||||
|
||||
//topiceditor
|
||||
TopicEditorBase::TopicEditor *createTopicEditor(const TopicEditorBase::TopicData &data) override;
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onEditCriteriumDialog(QWidget *parent, bool ownEvlElements);
|
||||
LtsWidgets::LtsDialog *onEditSchemaDialog(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onCreateCommentsDialog(QWidget *parent, bool runningOnTablet);
|
||||
LtsWidgets::LtsDialog *onCommentsDialog(QWidget *parent);
|
||||
|
||||
std::shared_ptr<OcSituationClient::Interface::Ftc> m_ocFtc;
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> m_evlDtc;
|
||||
std::shared_ptr<Evaluations::Interface::Ftc> m_evlFtc;
|
||||
std::shared_ptr<FileManagement::Interface::Dtc> m_flmDtc;
|
||||
std::shared_ptr<FileManagement::Interface::Ftc> m_flmFtc;
|
||||
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
|
||||
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_fltBuildingComponentfc;
|
||||
};
|
||||
|
||||
} // namespace Evaluations
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Exercisemanagemt (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
/**
|
||||
* @brief The DataInterface class provides the Topics Clients only for the GUI Plugins
|
||||
*/
|
||||
class DataInterface : public DataPluginBase::Interface
|
||||
{
|
||||
public:
|
||||
using DataPluginBase::Interface::Interface;
|
||||
|
||||
virtual std::shared_ptr<Evaluations::Interface::Dtc> getDtc() = 0;
|
||||
virtual std::shared_ptr<Evaluations::Interface::Ftc> getFtc() = 0;
|
||||
};
|
||||
|
||||
} // namespace Evaluations
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Exercisemanagemt (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <TopicEditorBase/topic_editor_interface.h>
|
||||
#include <QString>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class ForeignGuiInterface : public TopicEditorBase::Interface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
|
||||
static QString pluginName() { return QStringLiteral("EvlEvaluationGuiPlugin"); }
|
||||
|
||||
};
|
||||
|
||||
} // namespace Evaluations
|
||||
Reference in new issue
Block a user