Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files) - Formatted LtsAppDescriptor module files - Formatted LtsAppManager/AppChooser files - Applied clang-format to all DTC and enum headers across modules - Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/) Cosmetic changes only, no functional modifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
848 files changed
+89305
-100020
No files matched your search
Executable → Regular
+171
-178
@@ -1,225 +1,218 @@
|
||||
|
||||
|
||||
|
||||
#include "evl_topic_editor_model.h"
|
||||
|
||||
#include <Evaluations/evl_translation.h>
|
||||
#include <QDateTime>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <nglwidgets/ngltreeitem.h>
|
||||
|
||||
#include <Evaluations/evl_translation.h>
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
|
||||
|
||||
TopicEditorEvaluationModel::TopicEditorEvaluationModel(QObject *parent) : NGLTreeModel(parent, new NGLTreeItem(QVariant()),,
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) { tr("Id"), tr("Name"), tr("Weight"), tr("Start Time"), tr("Situation"), tr("Video"), tr("Audio") })
|
||||
{}
|
||||
|
||||
TopicEditorEvaluationModel::TopicEditorEvaluationModel(QObject* parent)
|
||||
: NGLTreeModel(parent, new NGLTreeItem(QVariant()), ,
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()){tr("Id"), tr("Name"), tr("Weight"), tr("Start Time"),
|
||||
tr("Situation"), tr("Video"), tr("Audio")})
|
||||
{
|
||||
}
|
||||
|
||||
QVariant TopicEditorEvaluationModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
|
||||
{
|
||||
switch (section)
|
||||
if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
|
||||
{
|
||||
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");
|
||||
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);
|
||||
return NGLTreeModel::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
|
||||
QVariant TopicEditorEvaluationModel::data(const QModelIndex &index, int role) const
|
||||
QVariant TopicEditorEvaluationModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
if (!(index.isValid() && (role == Qt::DisplayRole || role == Qt::UserRole)))
|
||||
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();
|
||||
|
||||
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
|
||||
Qt::ItemFlags TopicEditorEvaluationModel::flags(const QModelIndex& index) const
|
||||
{
|
||||
auto ret = NGLTreeModel::flags(index);
|
||||
auto ret = NGLTreeModel::flags(index);
|
||||
|
||||
|
||||
NGLTreeItem *item = privateData(index);
|
||||
if (item->data().canConvert<Evaluations::EvaluationCriterium>())
|
||||
ret &= ~Qt::ItemIsSelectable;
|
||||
NGLTreeItem* item = privateData(index);
|
||||
if (item->data().canConvert<Evaluations::EvaluationCriterium>())
|
||||
ret &= ~Qt::ItemIsSelectable;
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool TopicEditorEvaluationModel::initModel(const std::shared_ptr<Interface::Dtc> &dtc, int operatorId)
|
||||
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());
|
||||
|
||||
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";
|
||||
if (!dtc)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
QModelIndex pIndex = parentItemIndexCache.value(parentId);
|
||||
int rowPos = -1;
|
||||
DEBUG_LOG(m_logger) << "initModel Folder";
|
||||
|
||||
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 << ")";
|
||||
}
|
||||
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());
|
||||
|
||||
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;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool TopicEditorEvaluationModel::onInsertRow(int &row, const QModelIndex &parent, const QVariant &data)
|
||||
bool TopicEditorEvaluationModel::onInsertRow(int& row, const QModelIndex& parent, const QVariant& data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onInsertRow";
|
||||
DEBUG_LOG(m_logger) << "onInsertRow";
|
||||
|
||||
row = rowCount(parent);
|
||||
NGLTreeItem *item = new NGLTreeItem(data, QIcon());
|
||||
row = rowCount(parent);
|
||||
NGLTreeItem* item = new NGLTreeItem(data, QIcon());
|
||||
|
||||
return NGLTreeModel::insertRow(row, parent, item);
|
||||
return NGLTreeModel::insertRow(row, parent, item);
|
||||
}
|
||||
|
||||
EvaluationElement TopicEditorEvaluationModel::getEvaluationElement(const QModelIndex &index) const
|
||||
EvaluationElement TopicEditorEvaluationModel::getEvaluationElement(const QModelIndex& index) const
|
||||
{
|
||||
NGLTreeItem *item = privateData(index);
|
||||
if (item->data().canConvert<EvaluationElement>())
|
||||
return item->data().value<EvaluationElement>();
|
||||
NGLTreeItem* item = privateData(index);
|
||||
if (item->data().canConvert<EvaluationElement>())
|
||||
return item->data().value<EvaluationElement>();
|
||||
|
||||
return EvaluationElement();
|
||||
return EvaluationElement();
|
||||
}
|
||||
|
||||
|
||||
QModelIndex TopicEditorEvaluationModel::getIndex(const int &elementId) const
|
||||
QModelIndex TopicEditorEvaluationModel::getIndex(const int& elementId) const
|
||||
{
|
||||
QModelIndexList list = match(index(0, 0), Qt::UserRole, QVariant::fromValue(elementId), 1, Qt::MatchRecursive);
|
||||
QModelIndexList list = match(index(0, 0), Qt::UserRole, QVariant::fromValue(elementId), 1, Qt::MatchRecursive);
|
||||
|
||||
if (!list.isEmpty())
|
||||
return list.first();
|
||||
if (!list.isEmpty())
|
||||
return list.first();
|
||||
|
||||
return {};
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+17
-35
@@ -1,60 +1,42 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <nglwidgets/ngltreemodel.h>
|
||||
|
||||
class QTableWidget;
|
||||
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class TopicEditorEvaluationModel : public NGLTreeModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
NAME = 0,
|
||||
ID,
|
||||
WEIGHT,
|
||||
START_TIME,
|
||||
SITUATION,
|
||||
VIDEO,
|
||||
AUDIO
|
||||
};
|
||||
public:
|
||||
enum Columns { NAME = 0, ID, WEIGHT, START_TIME, SITUATION, VIDEO, AUDIO };
|
||||
|
||||
explicit TopicEditorEvaluationModel(QObject *parent);
|
||||
~TopicEditorEvaluationModel() = default;
|
||||
explicit TopicEditorEvaluationModel(QObject* parent);
|
||||
~TopicEditorEvaluationModel() = default;
|
||||
|
||||
bool initModel(const std::shared_ptr<Evaluations::Interface::Dtc> &dtc, int operatorId);
|
||||
bool initModel(const std::shared_ptr<Evaluations::Interface::Dtc>& dtc, int operatorId);
|
||||
|
||||
EvaluationElement getEvaluationElement(const QModelIndex &index) const;
|
||||
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;
|
||||
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);
|
||||
public slots:
|
||||
bool onInsertRow(int& row, const QModelIndex& parent, const QVariant& data);
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Q_DECLARE_METATYPE(Evaluations::EvaluationCriterium)
|
||||
Q_DECLARE_METATYPE(Evaluations::EvaluationElement)
|
||||
|
||||
|
||||
|
||||
|
||||
Executable → Regular
+147
-164
@@ -1,246 +1,229 @@
|
||||
|
||||
|
||||
|
||||
#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>
|
||||
|
||||
#include <nglwidgets/ngltreeitem.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
EvaluationTopicEditor::EvaluationTopicEditor(LtsSession::LtsSession *session, QWidget *parent)
|
||||
: TopicEditorBase::TopicEditor(parent)
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::EvaluationTopicEditor)
|
||||
EvaluationTopicEditor::EvaluationTopicEditor(LtsSession::LtsSession* session, QWidget* parent)
|
||||
: TopicEditorBase::TopicEditor(parent), m_session(session), m_ui(new Ui::EvaluationTopicEditor)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
init(m_ui->widget);
|
||||
setOnlineHelpFilename(QStringLiteral("Script_Editor-Add_Evaluation_Topic"));
|
||||
m_ui->setupUi(this);
|
||||
init(m_ui->widget);
|
||||
setOnlineHelpFilename(QStringLiteral("Script_Editor-Add_Evaluation_Topic"));
|
||||
|
||||
m_ui->cbxOperator->clear();
|
||||
m_ui->widget->setHidden(true);
|
||||
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);
|
||||
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();
|
||||
m_model = new TopicEditorEvaluationModel(this);
|
||||
m_ui->trvEvaluations->setModel(m_model);
|
||||
m_ui->trvEvaluations->expandAll();
|
||||
|
||||
m_ui->trvEvaluations->hideColumn(TopicEditorEvaluationModel::Columns::ID);
|
||||
m_ui->trvEvaluations->hideColumn(TopicEditorEvaluationModel::Columns::ID);
|
||||
|
||||
|
||||
|
||||
QItemSelectionModel *selectionModel = m_ui->trvEvaluations->selectionModel();
|
||||
connect(selectionModel, &QItemSelectionModel::selectionChanged,
|
||||
this, &EvaluationTopicEditor::onSelectionChanged);
|
||||
QItemSelectionModel* selectionModel = m_ui->trvEvaluations->selectionModel();
|
||||
connect(selectionModel, &QItemSelectionModel::selectionChanged, this, &EvaluationTopicEditor::onSelectionChanged);
|
||||
}
|
||||
|
||||
EvaluationTopicEditor::~EvaluationTopicEditor()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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->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;
|
||||
}
|
||||
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);
|
||||
m_model->initModel(m_evlDtc, m_operatorId);
|
||||
|
||||
|
||||
initOperatorComboBox();
|
||||
initOperatorComboBox();
|
||||
|
||||
DEBUG_LOG(m_logger) << "fillOperatorComboBox m_operatorId = " << m_operatorId;
|
||||
return true;
|
||||
DEBUG_LOG(m_logger) << "fillOperatorComboBox m_operatorId = " << m_operatorId;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void EvaluationTopicEditor::updateInternalData()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO;
|
||||
|
||||
if (!hasTopicDataProperties())
|
||||
return;
|
||||
if (!hasTopicDataProperties())
|
||||
return;
|
||||
|
||||
m_operatorId = getTopicDataValue(QStringLiteral("operatorId")).toInt();
|
||||
DEBUG_LOG(m_logger) << "operator id = " << m_operatorId;
|
||||
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_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());
|
||||
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();
|
||||
selectElement();
|
||||
}
|
||||
|
||||
void EvaluationTopicEditor::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Evaluation Topic Editor"));
|
||||
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);
|
||||
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)
|
||||
continue;
|
||||
|
||||
auto it = std::find_if(evaluationCriteria.constBegin(), evaluationCriteria.constEnd(), [this, operatorId](const EvaluationCriterium &ec)
|
||||
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)
|
||||
{
|
||||
return ec.operatorId() == operatorId;
|
||||
});
|
||||
if (it == evaluationCriteria.constEnd())
|
||||
m_ui->cbxOperator->removeItem(index);
|
||||
}
|
||||
m_ui->cbxOperator->setCurrentIndex(m_ui->cbxOperator->findData(m_operatorId));
|
||||
int operatorId = m_ui->cbxOperator->itemData(index).toInt();
|
||||
|
||||
if (operatorId == m_operatorId)
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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());
|
||||
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();
|
||||
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())
|
||||
if (m_evlElement.situation())
|
||||
{
|
||||
QJsonParseError error;
|
||||
QJsonDocument doc(QJsonDocument::fromJson(QString::fromStdString(m_evlElement.situationContent().get()).toUtf8(), &error));
|
||||
TopicEditorBase::TopicData data;
|
||||
data.topicType = TopicEditorBase::TopicType::Situation;
|
||||
setTopicDataProperty(QStringLiteral("end"), m_evlElement.timestamp() + m_evlElement.duration() * 1000);
|
||||
setTopicDataProperty(QStringLiteral("speed"), 1.0);
|
||||
|
||||
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."));
|
||||
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);
|
||||
}
|
||||
|
||||
data.duration = m_evlElement.duration();
|
||||
data.properties = m_topicData.properties;
|
||||
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);
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "topicData - properties: " << QJsonDocument(m_topicData.properties).toJson(QJsonDocument::Compact);
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void EvaluationTopicEditor::onOperatorChanged()
|
||||
{
|
||||
m_operatorId = m_ui->cbxOperator->currentData().toInt();
|
||||
DEBUG_LOG(m_logger) << "operator id = " << m_operatorId;
|
||||
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();
|
||||
m_model->initModel(m_evlDtc, m_operatorId);
|
||||
m_ui->trvEvaluations->expandAll();
|
||||
}
|
||||
|
||||
void EvaluationTopicEditor::onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
|
||||
void EvaluationTopicEditor::onSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
|
||||
{
|
||||
Q_UNUSED(selected);
|
||||
Q_UNUSED(deselected);
|
||||
Q_UNUSED(selected);
|
||||
Q_UNUSED(deselected);
|
||||
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO;
|
||||
|
||||
QModelIndex index = m_ui->trvEvaluations->currentIndex();
|
||||
m_evlElement = m_model->getEvaluationElement(index);
|
||||
DEBUG_LOG(m_logger) << "element id = " << m_evlElement.id();
|
||||
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();
|
||||
m_topicData.description = QString::number(m_evlElement.id());
|
||||
slotChangesMade();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+33
-31
@@ -1,6 +1,5 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "evl_topic_editor_model.h"
|
||||
@@ -11,51 +10,54 @@
|
||||
#include <Plugins/OperatorManagement/opm_gui_combobox_plugin_interface.h>
|
||||
#include <TopicEditorBase/topic_editor_base.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EvaluationTopicEditor;
|
||||
}
|
||||
|
||||
namespace Ui { class EvaluationTopicEditor; }
|
||||
|
||||
namespace LtsScriptTimeline { class TrackEntry; }
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackEntry;
|
||||
}
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class EvaluationTopicEditor : public TopicEditorBase::TopicEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EvaluationTopicEditor(LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~EvaluationTopicEditor();
|
||||
public:
|
||||
explicit EvaluationTopicEditor(LtsSession::LtsSession* session, QWidget* parent = nullptr);
|
||||
~EvaluationTopicEditor();
|
||||
|
||||
void selected();
|
||||
bool fetchInterfaces();
|
||||
void selected();
|
||||
bool fetchInterfaces();
|
||||
|
||||
private:
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void updateInternalData() override final;
|
||||
void retranslate() override final;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void updateInternalData() override final;
|
||||
void retranslate() override final;
|
||||
void selectElement();
|
||||
void initOperatorComboBox();
|
||||
|
||||
void selectElement();
|
||||
void initOperatorComboBox();
|
||||
private slots:
|
||||
bool apply2() override final;
|
||||
|
||||
private slots:
|
||||
bool apply2() override final;
|
||||
void onOperatorChanged();
|
||||
void onSelectionChanged(const QItemSelection&, const QItemSelection&);
|
||||
|
||||
void onOperatorChanged();
|
||||
void onSelectionChanged(const QItemSelection & , const QItemSelection & );
|
||||
private:
|
||||
LtsSession::LtsSession* m_session{nullptr};
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> m_evlDtc{nullptr};
|
||||
std::shared_ptr<OperatorManagement::ForeignGuiComboboxInterface> m_opmCbxIfc{nullptr};
|
||||
|
||||
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};
|
||||
|
||||
int m_operatorId{0};
|
||||
EvaluationElement m_evlElement;
|
||||
TopicEditorEvaluationModel *m_model{nullptr};
|
||||
|
||||
Ui::EvaluationTopicEditor *m_ui{nullptr};
|
||||
Ui::EvaluationTopicEditor* m_ui{nullptr};
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+126
-126
@@ -1,204 +1,204 @@
|
||||
|
||||
|
||||
|
||||
#include "evl_dialog.h"
|
||||
#include "ui_evl_dialog.h"
|
||||
#include "evl_model.h"
|
||||
|
||||
#include "evl_edit_dialog.h"
|
||||
#include "evl_element_dialog.h"
|
||||
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include "evl_model.h"
|
||||
#include "ui_evl_dialog.h"
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.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))
|
||||
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))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog ctor";
|
||||
m_ui->setupUi(this);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &CriteriumDialog::onPrint);
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog ctor";
|
||||
m_ui->setupUi(this);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &CriteriumDialog::onPrint);
|
||||
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
|
||||
if (ownEvlElements)
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Own_Evaluation_Criteria"));
|
||||
else
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-All_Evaluation_Criteria"));
|
||||
if (ownEvlElements)
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Own_Evaluation_Criteria"));
|
||||
else
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-All_Evaluation_Criteria"));
|
||||
}
|
||||
|
||||
CriteriumDialog::~CriteriumDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void CriteriumDialog::retranslate()
|
||||
{
|
||||
if (m_ownEvaluationElements)
|
||||
translate(m_ui, tr("Own Evaluation Criteria"));
|
||||
else
|
||||
translate(m_ui, tr("All Evaluation Criteria"));
|
||||
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();
|
||||
int selected = m_ui->widget->selectedRows().size();
|
||||
|
||||
const QModelIndex srcIdx = m_ui->widget->currentIndex();
|
||||
int operatorId = m_model->getRowData(srcIdx.row()).operatorId();
|
||||
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));
|
||||
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() );
|
||||
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);
|
||||
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()
|
||||
{
|
||||
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
void CriteriumDialog::slotAdd()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog::slotAdd";
|
||||
editCriterium(0 );
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog::slotAdd";
|
||||
editCriterium(0);
|
||||
}
|
||||
|
||||
void CriteriumDialog::slotEdit()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog::slotEdit";
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog::slotEdit";
|
||||
|
||||
const QModelIndex srcIdx = m_ui->widget->currentIndex();
|
||||
editCriterium(m_model->getRowData(srcIdx.row()).id() );
|
||||
const QModelIndex srcIdx = m_ui->widget->currentIndex();
|
||||
editCriterium(m_model->getRowData(srcIdx.row()).id());
|
||||
}
|
||||
|
||||
void CriteriumDialog::slotRemove()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumDialog::slotRemove";
|
||||
const QModelIndex selIndex = m_ui->widget->currentIndex();
|
||||
if (!selIndex.isValid())
|
||||
return;
|
||||
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);
|
||||
});
|
||||
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";
|
||||
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;
|
||||
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);
|
||||
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)
|
||||
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;
|
||||
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);
|
||||
m_model->initModel(dtc, opmDtc);
|
||||
|
||||
if (m_ownEvaluationElements)
|
||||
m_proxyModel->setOperatorId(m_currentOperatorId);
|
||||
if (m_ownEvaluationElements)
|
||||
m_proxyModel->setOperatorId(m_currentOperatorId);
|
||||
|
||||
m_ui->widget->setModel(m_proxyModel);
|
||||
m_ui->widget->setModel(m_proxyModel);
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->widget->hideColumn(CriteriumDialogModel::Id);
|
||||
m_ui->widget->hideColumn(CriteriumDialogModel::Id);
|
||||
#endif
|
||||
|
||||
m_ui->widget->setSortIndicator(CriteriumDialogModel::Name, Qt::AscendingOrder);
|
||||
m_ui->widget->setSortIndicator(CriteriumDialogModel::Name, Qt::AscendingOrder);
|
||||
|
||||
QMap<qint32, Evaluations::EvaluationCriterium> criteria = m_dtc->evaluationCriteriums();
|
||||
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();
|
||||
}
|
||||
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);
|
||||
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);
|
||||
}
|
||||
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();
|
||||
enaDisa();
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+62
-59
@@ -1,22 +1,19 @@
|
||||
|
||||
|
||||
|
||||
#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 <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <OperatorManagement/opm_dtc.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>
|
||||
#include <Plugins/FilterManagement/flt_participant_plugin_interface.h>
|
||||
#include <Plugins/OperatorManagement/opm_gui_combobox_plugin_interface.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -33,65 +30,71 @@ namespace Evaluations
|
||||
class CriteriumDialogModel;
|
||||
class CriteriumFilterModel;
|
||||
|
||||
class CriteriumDialog : public LtsWidgets::LtsDialog
|
||||
, protected Interface::Ftc::EvlCriteriumModifyReplyHandler
|
||||
, protected Interface::Ftc::EvlCriteriumRemoveReplyHandler
|
||||
class CriteriumDialog : public LtsWidgets::LtsDialog,
|
||||
protected Interface::Ftc::EvlCriteriumModifyReplyHandler,
|
||||
protected Interface::Ftc::EvlCriteriumRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CriteriumDialog(const QString &menuGroup, LtsSession::LtsSession *session, bool ownEvlElements, QWidget *parent = nullptr);
|
||||
~CriteriumDialog();
|
||||
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);
|
||||
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:
|
||||
protected:
|
||||
NGL::INGLLogger& m_logger;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
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();
|
||||
void onEvlCriteriumModifyReply(const Core::FunctionReplyObject& replyObject) override final
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void editCriterium(int criteriumId);
|
||||
void tableColumnOrganiserSetting() override;
|
||||
void onEvlCriteriumRemoveReply(const Core::FunctionReplyObject& replyObject) override final
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
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};
|
||||
private slots:
|
||||
void slotAdd();
|
||||
void slotEdit();
|
||||
void slotRemove();
|
||||
void enaDisa();
|
||||
void slotEditElements();
|
||||
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};
|
||||
private slots:
|
||||
void slotAdd();
|
||||
void slotEdit();
|
||||
void slotRemove();
|
||||
void enaDisa();
|
||||
void slotEditElements();
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+87
-96
@@ -1,154 +1,145 @@
|
||||
|
||||
|
||||
|
||||
#include "evl_edit_dialog.h"
|
||||
|
||||
#include "ui_evl_edit_dialog.h"
|
||||
|
||||
#include <Evaluations/evl_translation.h>
|
||||
#include <FileManagement/flm_translation.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>
|
||||
#include <QJsonObject>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
CriteriumEditDialog::CriteriumEditDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkCancel)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_ui(new Ui::CriteriumEditDialog)
|
||||
CriteriumEditDialog::CriteriumEditDialog(QWidget* parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkCancel),
|
||||
m_requestHelper(new LtsUtils::RequestHelper(this)), m_ui(new Ui::CriteriumEditDialog)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "CriteriumEditDialog ctor";
|
||||
DEBUG_LOG(m_logger) << "CriteriumEditDialog ctor";
|
||||
|
||||
m_ui->setupUi(this);
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_uiRequirements->addRequirement({ m_ui->lblName, [this]() { return !m_ui->leName->text().isEmpty(); } });
|
||||
m_uiRequirements->addRequirement({m_ui->lblName, [this]() { return !m_ui->leName->text().isEmpty(); }});
|
||||
}
|
||||
|
||||
CriteriumEditDialog::~CriteriumEditDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void CriteriumEditDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, m_dtc->evaluationCriterium(m_criteriumId), tr("Criterium"));
|
||||
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)
|
||||
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;
|
||||
DEBUG_LOG(m_logger) << "CriteriumEditDialog::init";
|
||||
m_criteriumId = criteriumId;
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
m_session = session;
|
||||
|
||||
opmCbxDtc->fillOperatorComboBox(m_ui->cbxOperators);
|
||||
opmCbxDtc->fillOperatorComboBox(m_ui->cbxOperators);
|
||||
|
||||
if (m_criteriumId > 0)
|
||||
{
|
||||
Evaluations::EvaluationCriterium eval = m_dtc->evaluationCriterium(m_criteriumId);
|
||||
m_ui->leName->setText(QString::fromStdString(eval.name()));
|
||||
m_ui->teDesc->setText(QString::fromStdString(eval.description()));
|
||||
if (m_criteriumId > 0)
|
||||
{
|
||||
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->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();
|
||||
m_ui->leName->setFocus();
|
||||
|
||||
|
||||
m_buttonBox->connectLibraryButton(this, &CriteriumEditDialog::onImportButtonClicked,
|
||||
&CriteriumEditDialog::onExportButtonClicked);
|
||||
m_buttonBox->connectLibraryButton(this, &CriteriumEditDialog::onImportButtonClicked,
|
||||
&CriteriumEditDialog::onExportButtonClicked);
|
||||
|
||||
if (!m_session->getForeignGuiInterface<FileManagement::ForeignGuiInterface>(m_flmGui))
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Library, false);
|
||||
if (!m_session->getForeignGuiInterface<FileManagement::ForeignGuiInterface>(m_flmGui))
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Library, false);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CriteriumEditDialog::apply()
|
||||
{
|
||||
|
||||
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);
|
||||
});
|
||||
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();
|
||||
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);
|
||||
}
|
||||
return QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
}
|
||||
|
||||
void CriteriumEditDialog::jsonToUi(const QByteArray &content)
|
||||
void CriteriumEditDialog::jsonToUi(const QByteArray& content)
|
||||
{
|
||||
|
||||
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();
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content));
|
||||
const QJsonObject obj(doc.object());
|
||||
|
||||
m_ui->leName->setText(name);
|
||||
m_ui->teDesc->setText(description);
|
||||
m_ui->cbxOperators->setCurrentIndex(m_ui->cbxOperators->findData(operatorId));
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
void CriteriumEditDialog::onExportButtonClicked()
|
||||
{
|
||||
QByteArray byteArray = UiToJson();
|
||||
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 ";
|
||||
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)))
|
||||
QByteArray content;
|
||||
int fileId = m_flmGui->loadFileContent(this, content, {FileManagement::FileType::Xml}, m_session->exerciseId(),
|
||||
FileManagement::toString(FileManagement::XmlType::EVLCriteriumEdit));
|
||||
if (fileId > 0)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jsonToUi(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+42
-39
@@ -1,18 +1,16 @@
|
||||
|
||||
|
||||
|
||||
#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 <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#include <Plugins/OperatorManagement/opm_gui_combobox_plugin_interface.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <OperatorManagement/opm_dtc.h>
|
||||
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
||||
#include <Plugins/OperatorManagement/opm_gui_combobox_plugin_interface.h>
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
@@ -27,44 +25,49 @@ class CriteriumEditDialog;
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class CriteriumEditDialog : public LtsWidgets::LtsDialog
|
||||
, protected Interface::Ftc::EvlCriteriumModifyReplyHandler
|
||||
, protected Interface::Ftc::EvlCriteriumRemoveReplyHandler
|
||||
class CriteriumEditDialog : public LtsWidgets::LtsDialog,
|
||||
protected Interface::Ftc::EvlCriteriumModifyReplyHandler,
|
||||
protected Interface::Ftc::EvlCriteriumRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CriteriumEditDialog(QWidget *parent = nullptr);
|
||||
~CriteriumEditDialog();
|
||||
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);
|
||||
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:
|
||||
protected:
|
||||
NGL::INGLLogger& m_logger;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
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 onEvlCriteriumModifyReply(const Core::FunctionReplyObject& replyObject) override final
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
private slots:
|
||||
void onExportButtonClicked();
|
||||
void onImportButtonClicked();
|
||||
void onEvlCriteriumRemoveReply(const Core::FunctionReplyObject& replyObject) override final
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
private:
|
||||
bool apply() override;
|
||||
void retranslate() override;
|
||||
QByteArray UiToJson();
|
||||
void jsonToUi(const QByteArray &content);
|
||||
private slots:
|
||||
void onExportButtonClicked();
|
||||
void onImportButtonClicked();
|
||||
|
||||
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};
|
||||
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};
|
||||
};
|
||||
}
|
||||
} // namespace Evaluations
|
||||
qt6-after/qt6-migrated-legatus/Lts/Plugins/Evaluations/Gui/CriteriumEdit/evl_edit_element_dialog.cpp
Executable → Regular
+206
-231
@@ -1,328 +1,303 @@
|
||||
|
||||
|
||||
|
||||
#include "evl_edit_element_dialog.h"
|
||||
#include <utility>
|
||||
#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 "ui_evl_edit_element_dialog.h"
|
||||
|
||||
#include <AudioVideoManagement/ava_state.h>
|
||||
#include <AudioVideoManagement/stream_name_mapping.h>
|
||||
#include <Evaluations/evl_translation.h>
|
||||
#include <FilterManagement/flt_building_cmpnt_settings.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 <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsWidgets/lts_base_layout_widget.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <utility>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
ElementEditDialog::ElementEditDialog(QWidget *)
|
||||
: LtsWidgets::LtsDialog(nullptr, LtsWidgets::ButtonCombination::OkCancel)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_ui(new Ui::ElementEditDialog)
|
||||
ElementEditDialog::ElementEditDialog(QWidget*)
|
||||
: LtsWidgets::LtsDialog(nullptr, LtsWidgets::ButtonCombination::OkCancel),
|
||||
m_requestHelper(new LtsUtils::RequestHelper(this)), m_ui(new Ui::ElementEditDialog)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ElementEditDialog ctor";
|
||||
DEBUG_LOG(m_logger) << "ElementEditDialog ctor";
|
||||
|
||||
m_ui->setupUi(this);
|
||||
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->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);
|
||||
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.") });
|
||||
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;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void ElementEditDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, m_dtc->evaluationCriterium(m_criteriumId), tr("Criterium Element"));
|
||||
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)
|
||||
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;
|
||||
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);
|
||||
for (int i = 1; i <= 10; ++i)
|
||||
m_ui->cbxRating->addItem(QString::number(i), i);
|
||||
|
||||
fillPhasesComboBox();
|
||||
fillPhasesComboBox();
|
||||
|
||||
if (m_elementId > 0)
|
||||
{
|
||||
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();
|
||||
if (m_elementId > 0)
|
||||
{
|
||||
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->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()));
|
||||
}
|
||||
m_ui->cbxPhase->setCurrentIndex(m_ui->cbxPhase->findData(eval.phaseId()));
|
||||
}
|
||||
|
||||
if (m_avmDataIfc && m_avmDataIfc->hasAvsSession())
|
||||
{
|
||||
onAudioClicked();
|
||||
onVideoClicked();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
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 );
|
||||
if (m_avmDataIfc && m_avmDataIfc->hasAvsSession())
|
||||
{
|
||||
onAudioClicked();
|
||||
onVideoClicked();
|
||||
}
|
||||
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()
|
||||
{
|
||||
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() {}
|
||||
|
||||
bool ElementEditDialog::apply()
|
||||
{
|
||||
|
||||
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;
|
||||
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());
|
||||
|
||||
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 :(";
|
||||
QJsonObject obj;
|
||||
if (m_ui->cbSituation->isChecked())
|
||||
{
|
||||
QJsonObject root;
|
||||
|
||||
root[QStringLiteral("filters")] = getFilterSettings();
|
||||
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 :(";
|
||||
|
||||
req.situationContent().set(QJsonDocument(root).toJson().constData());
|
||||
}
|
||||
root[QStringLiteral("filters")] = getFilterSettings();
|
||||
|
||||
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());
|
||||
}
|
||||
req.situationContent().set(QJsonDocument(root).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());
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
return m_requestHelper->startSingleRequest([this, req]()
|
||||
{
|
||||
return m_ftc->evlElementModifyRequest(req, this);
|
||||
});
|
||||
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);
|
||||
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);
|
||||
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));
|
||||
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;
|
||||
INFO_LOG(m_logger) << "onCheckBoxClicked";
|
||||
if (m_startTime > 0)
|
||||
return;
|
||||
|
||||
m_startTime = QDateTime::currentMSecsSinceEpoch();
|
||||
m_ui->lblStartTime->setText(DTG::toStringMSec(m_startTime));
|
||||
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;
|
||||
Q_ASSERT(m_avmDataIfc && m_avmDataIfc->hasAvsSession());
|
||||
if (!m_avmDataIfc)
|
||||
return;
|
||||
|
||||
m_audioStreams = m_avmDataIfc->avaState()->getRtProfile();
|
||||
m_audioStreams = m_avmDataIfc->avaState()->getRtProfile();
|
||||
|
||||
QString currentText;
|
||||
if (m_ui->cbxRadioCircuit->currentIndex() >= 0)
|
||||
currentText = m_ui->cbxRadioCircuit->currentText();
|
||||
QString currentText;
|
||||
if (m_ui->cbxRadioCircuit->currentIndex() >= 0)
|
||||
currentText = m_ui->cbxRadioCircuit->currentText();
|
||||
|
||||
m_ui->cbxRadioCircuit->clear();
|
||||
m_ui->cbxRadioCircuit->clear();
|
||||
|
||||
for (const QString &audioChannel : std::as_const(m_audioStreams))
|
||||
m_ui->cbxRadioCircuit->addItem(audioChannel);
|
||||
for (const QString& audioChannel : std::as_const(m_audioStreams))
|
||||
m_ui->cbxRadioCircuit->addItem(audioChannel);
|
||||
|
||||
m_ui->cbxRadioCircuit->setCurrentIndex(0);
|
||||
m_ui->cbxRadioCircuit->setCurrentIndex(0);
|
||||
|
||||
int idx = m_ui->cbxRadioCircuit->findText(currentText);
|
||||
if (idx >= 0)
|
||||
m_ui->cbxRadioCircuit->setCurrentIndex(idx);
|
||||
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);
|
||||
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;
|
||||
Q_ASSERT(m_avmDataIfc && m_avmDataIfc->hasAvsSession());
|
||||
if (!m_avmDataIfc)
|
||||
return;
|
||||
|
||||
m_videoStreams = m_avmDataIfc->avaState()->currentLiveVideoStreams();
|
||||
m_videoStreams = m_avmDataIfc->avaState()->currentLiveVideoStreams();
|
||||
|
||||
QVariant currentStream;
|
||||
if (m_ui->cbxVideoChannel->currentIndex() >= 0)
|
||||
currentStream = m_ui->cbxVideoChannel->currentData();
|
||||
QVariant currentStream;
|
||||
if (m_ui->cbxVideoChannel->currentIndex() >= 0)
|
||||
currentStream = m_ui->cbxVideoChannel->currentData();
|
||||
|
||||
m_ui->cbxVideoChannel->clear();
|
||||
m_ui->cbxVideoChannel->clear();
|
||||
|
||||
for (const QString &streamName : std::as_const(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)
|
||||
for (const QString& streamName : std::as_const(m_videoStreams))
|
||||
{
|
||||
m_ui->cbxVideoChannel->setCurrentIndex(i);
|
||||
break;
|
||||
QString displayName = m_avmDataIfc->streamNameMapping()->displayName(streamName);
|
||||
m_ui->cbxVideoChannel->addItem(displayName, streamName);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_ui->cbVideo->isChecked() && m_ui->cbxVideoChannel->count() > 1)
|
||||
m_ui->cbxVideoChannel->setEnabled(true);
|
||||
else
|
||||
m_ui->cbxVideoChannel->setEnabled(false);
|
||||
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;
|
||||
const int operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
|
||||
QJsonObject jsonObj;
|
||||
|
||||
{
|
||||
|
||||
std::shared_ptr<FilterManagement::AesDisplayFilter> aesDisplayFilter =
|
||||
m_fltAesIfc->aesFilterForOperator(operatorId, QString());
|
||||
jsonObj[QStringLiteral("AesFilterJson")] = aesDisplayFilter->filterToJson();
|
||||
}
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
std::shared_ptr<FilterManagement::SymbolAppearanceSettings> symbolAppearanceSettings =
|
||||
m_fltParticipantIfc->symbolAppearanceForOperator(operatorId, QString());
|
||||
jsonObj[QStringLiteral("SymbolAppearanceJson")] = symbolAppearanceSettings->settingsToJson();
|
||||
}
|
||||
std::shared_ptr<FilterManagement::AesDisplayFilter> aesDisplayFilter =
|
||||
m_fltAesIfc->aesFilterForOperator(operatorId, QString());
|
||||
jsonObj[QStringLiteral("AesFilterJson")] = aesDisplayFilter->filterToJson();
|
||||
}
|
||||
|
||||
|
||||
if (m_fltBuildingComponentIfc)
|
||||
{
|
||||
|
||||
std::shared_ptr<FilterManagement::BuildingComponentSettings> buildingComponentSettings =
|
||||
m_fltBuildingComponentIfc->buildingComponentSettingsForOperator(operatorId, QString());
|
||||
jsonObj[QStringLiteral("BuildingComponentSettingsJson")] = buildingComponentSettings->bldCmpSettingsToJson();
|
||||
}
|
||||
{
|
||||
|
||||
std::shared_ptr<FilterManagement::SymbolAppearanceSettings> symbolAppearanceSettings =
|
||||
m_fltParticipantIfc->symbolAppearanceForOperator(operatorId, QString());
|
||||
jsonObj[QStringLiteral("SymbolAppearanceJson")] = symbolAppearanceSettings->settingsToJson();
|
||||
}
|
||||
|
||||
if (m_fltBuildingComponentIfc)
|
||||
{
|
||||
|
||||
return jsonObj;
|
||||
std::shared_ptr<FilterManagement::BuildingComponentSettings> buildingComponentSettings =
|
||||
m_fltBuildingComponentIfc->buildingComponentSettingsForOperator(operatorId, QString());
|
||||
jsonObj[QStringLiteral("BuildingComponentSettingsJson")] = buildingComponentSettings->bldCmpSettingsToJson();
|
||||
}
|
||||
|
||||
return jsonObj;
|
||||
}
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+57
-55
@@ -1,21 +1,19 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
#include <Evaluations/logger.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 <FilterManagement/flt_participant_plugin_interface.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
class UiRequirementList;
|
||||
@@ -34,63 +32,67 @@ class LtsSession;
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class ElementEditDialog : public LtsWidgets::LtsDialog
|
||||
, protected Interface::Ftc::EvlElementModifyReplyHandler
|
||||
, protected Interface::Ftc::EvlElementRemoveReplyHandler
|
||||
class ElementEditDialog : public LtsWidgets::LtsDialog,
|
||||
protected Interface::Ftc::EvlElementModifyReplyHandler,
|
||||
protected Interface::Ftc::EvlElementRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ElementEditDialog(QWidget *parent = nullptr);
|
||||
~ElementEditDialog();
|
||||
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);
|
||||
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:
|
||||
protected:
|
||||
NGL::INGLLogger& m_logger;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onEvlElementModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onEvlElementRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onEvlElementModifyReply(const Core::FunctionReplyObject& replyObject) override final
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
QJsonObject getFilterSettings();
|
||||
void onEvlElementRemoveReply(const Core::FunctionReplyObject& replyObject) override final
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
private slots:
|
||||
void onReturnPressed();
|
||||
void onCheckBoxClicked();
|
||||
void onAudioClicked();
|
||||
void onVideoClicked();
|
||||
QJsonObject getFilterSettings();
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
bool apply() override;
|
||||
void fillPhasesComboBox();
|
||||
private slots:
|
||||
void onReturnPressed();
|
||||
void onCheckBoxClicked();
|
||||
void onAudioClicked();
|
||||
void onVideoClicked();
|
||||
|
||||
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};
|
||||
QStringList m_audioStreams;
|
||||
QStringList m_videoStreams;
|
||||
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};
|
||||
QStringList m_audioStreams;
|
||||
QStringList m_videoStreams;
|
||||
};
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+82
-88
@@ -1,157 +1,151 @@
|
||||
|
||||
|
||||
|
||||
#include "evl_element_dialog.h"
|
||||
#include "ui_evl_element_dialog.h"
|
||||
#include "evl_element_model.h"
|
||||
|
||||
#include "evl_edit_element_dialog.h"
|
||||
#include "evl_element_model.h"
|
||||
#include "ui_evl_element_dialog.h"
|
||||
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.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))
|
||||
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))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ElementDialog ctor";
|
||||
m_ui->setupUi(this);
|
||||
DEBUG_LOG(m_logger) << "ElementDialog ctor";
|
||||
m_ui->setupUi(this);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Own_Evaluation_Criteria"));
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Own_Evaluation_Criteria"));
|
||||
}
|
||||
|
||||
ElementDialog::~ElementDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void ElementDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, m_dtc->evaluationCriterium(m_criteriumId), tr("Evaluation Elements"));
|
||||
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));
|
||||
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";
|
||||
DEBUG_LOG(m_logger) << "ElementDialog::slotAdd";
|
||||
|
||||
addElementEditDialog();
|
||||
addElementEditDialog();
|
||||
}
|
||||
|
||||
void ElementDialog::slotEdit()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ElementDialog::slotEdit";
|
||||
DEBUG_LOG(m_logger) << "ElementDialog::slotEdit";
|
||||
|
||||
addElementEditDialog(m_model->getRowData(m_ui->widget->currentIndex().row()).id() );
|
||||
addElementEditDialog(m_model->getRowData(m_ui->widget->currentIndex().row()).id());
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
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()
|
||||
{
|
||||
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
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;
|
||||
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);
|
||||
});
|
||||
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";
|
||||
if (m_requestHelper->failed())
|
||||
ERROR_LOG(m_logger) << "Failed to remove criterium";
|
||||
}
|
||||
|
||||
QString ElementDialog::dialogIdentifier()
|
||||
{
|
||||
return QStringLiteral("Evl.EditElements");
|
||||
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)
|
||||
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;
|
||||
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 = new ElementDialogModel(this);
|
||||
|
||||
m_model->initModel(dtc, exmDtc, avmDataIfc, criteriumId);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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();
|
||||
|
||||
enaDisa();
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+54
-51
@@ -1,18 +1,17 @@
|
||||
|
||||
|
||||
|
||||
#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 <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <Plugins/FilterManagement/flt_participant_plugin_interface.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
#include <Plugins/FilterManagement/flt_aes_plugin_interface.h>
|
||||
#include <Plugins/FilterManagement/flt_building_cmpnt_plugin_interface.h>
|
||||
#include <Plugins/FilterManagement/flt_participant_plugin_interface.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -30,61 +29,65 @@ namespace Evaluations
|
||||
class ElementDialogModel;
|
||||
class ElementDialogProxyModel;
|
||||
|
||||
class ElementDialog : public LtsWidgets::LtsDialog
|
||||
, protected Interface::Ftc::EvlElementModifyReplyHandler
|
||||
, protected Interface::Ftc::EvlElementRemoveReplyHandler
|
||||
class ElementDialog : public LtsWidgets::LtsDialog,
|
||||
protected Interface::Ftc::EvlElementModifyReplyHandler,
|
||||
protected Interface::Ftc::EvlElementRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ElementDialog(QWidget *parent = nullptr);
|
||||
~ElementDialog();
|
||||
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);
|
||||
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();
|
||||
static QString dialogIdentifier();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
NGL::INGLLogger& m_logger;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onEvlElementModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onEvlElementRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onEvlElementModifyReply(const Core::FunctionReplyObject& replyObject) override final
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void addElementEditDialog(int elementId = 0 );
|
||||
void tableColumnOrganiserSetting() override;
|
||||
void onEvlElementRemoveReply(const Core::FunctionReplyObject& replyObject) override final
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
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;
|
||||
private slots:
|
||||
void slotAdd();
|
||||
void slotEdit();
|
||||
void slotRemove();
|
||||
void enaDisa();
|
||||
private:
|
||||
void retranslate() override;
|
||||
void addElementEditDialog(int elementId = 0);
|
||||
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;
|
||||
private slots:
|
||||
void slotAdd();
|
||||
void slotEdit();
|
||||
void slotRemove();
|
||||
void enaDisa();
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+107
-122
@@ -1,160 +1,145 @@
|
||||
|
||||
|
||||
|
||||
#include "evl_element_model.h"
|
||||
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <QDateTime>
|
||||
#include <LtsUtilsCore/json_object.h>
|
||||
#include <AudioVideoManagement/stream_name_mapping.h>
|
||||
#include <LtsUtilsCore/json_object.h>
|
||||
#include <QDateTime>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
ElementDialogModel::ElementDialogModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<EvaluationElement>(
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{}
|
||||
}
|
||||
|
||||
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,
|
||||
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;
|
||||
m_exmDtc = exmDtc;
|
||||
m_avmDataIfc = avmDataIfc;
|
||||
|
||||
connect(dtc.get(), &Interface::Dtc::evaluationElementChanged,
|
||||
this, &ElementDialogModel::onDataChanged);
|
||||
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);
|
||||
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();
|
||||
INFO_LOG(m_logger) << "initModel - #EvalElements: " << m_vecData.size();
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant ElementDialogModel::data(const QModelIndex &index, int role) const
|
||||
QVariant ElementDialogModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
if ((role != Qt::DisplayRole) || !indexIsValid(index))
|
||||
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();
|
||||
|
||||
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)
|
||||
void ElementDialogProxyModel::setSourceModel(QAbstractItemModel* sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<ElementDialogModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
m_sourceModel = qobject_cast<ElementDialogModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
bool ElementDialogProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
|
||||
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())
|
||||
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);
|
||||
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();
|
||||
if (m_criteriumId == criteriumId)
|
||||
return;
|
||||
m_criteriumId = criteriumId;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
bool ElementDialogProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
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);
|
||||
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);
|
||||
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
|
||||
Executable → Regular
+41
-44
@@ -1,69 +1,66 @@
|
||||
|
||||
|
||||
|
||||
#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>
|
||||
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class ElementDialogModel final : public LtsWidgets::LtsAbstractTableModel<EvaluationElement>
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id = 0,
|
||||
Situation,
|
||||
Video,
|
||||
Audio,
|
||||
Timestamp,
|
||||
Duration,
|
||||
Rating,
|
||||
RadioCircuit,
|
||||
VideoChannel,
|
||||
Note,
|
||||
Phase
|
||||
};
|
||||
public:
|
||||
enum Columns {
|
||||
Id = 0,
|
||||
Situation,
|
||||
Video,
|
||||
Audio,
|
||||
Timestamp,
|
||||
Duration,
|
||||
Rating,
|
||||
RadioCircuit,
|
||||
VideoChannel,
|
||||
Note,
|
||||
Phase
|
||||
};
|
||||
|
||||
explicit ElementDialogModel(QObject *parent = nullptr);
|
||||
~ElementDialogModel() = default;
|
||||
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);
|
||||
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;
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<AudioVideoManagement::ForeignDataInterface> m_avmDataIfc;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
friend class ElementDialogProxyModel;
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
std::shared_ptr<AudioVideoManagement::ForeignDataInterface> m_avmDataIfc;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
friend class ElementDialogProxyModel;
|
||||
};
|
||||
|
||||
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};
|
||||
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};
|
||||
};
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+48
-58
@@ -1,6 +1,5 @@
|
||||
|
||||
|
||||
|
||||
#include "evl_model.h"
|
||||
|
||||
#include <Evaluations/evl_translation.h>
|
||||
@@ -8,78 +7,69 @@
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
CriteriumDialogModel::CriteriumDialogModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<EvaluationCriterium>(
|
||||
CriteriumDialogModel::CriteriumDialogModel(QObject* parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<EvaluationCriterium>({tr("Id"), tr("Name"), tr("Description"), tr("Operator")},
|
||||
parent)
|
||||
{
|
||||
tr("Id"),
|
||||
tr("Name"),
|
||||
tr("Description"),
|
||||
tr("Operator")
|
||||
},
|
||||
parent)
|
||||
{}
|
||||
|
||||
|
||||
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
|
||||
bool CriteriumDialogModel::initModel(const std::shared_ptr<Interface::Dtc>& dtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc>& opmDtc)
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
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();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
void CriteriumFilterModel::setOperatorId(int operatorId)
|
||||
{
|
||||
if (m_operatorId == operatorId)
|
||||
return;
|
||||
m_operatorId = operatorId;
|
||||
invalidateFilter();
|
||||
if (m_operatorId == operatorId)
|
||||
return;
|
||||
m_operatorId = operatorId;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void CriteriumFilterModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
void CriteriumFilterModel::setSourceModel(QAbstractItemModel* sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<CriteriumDialogModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
m_sourceModel = qobject_cast<CriteriumDialogModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
bool CriteriumFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
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())
|
||||
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);
|
||||
|
||||
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
|
||||
Executable → Regular
+26
-34
@@ -1,61 +1,53 @@
|
||||
|
||||
|
||||
|
||||
#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>
|
||||
#include <OperatorManagement/opm_dtc.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
class CriteriumDialogModel final : public LtsWidgets::LtsAbstractTableModel<EvaluationCriterium>
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id = 0,
|
||||
Name,
|
||||
Description,
|
||||
Operator
|
||||
};
|
||||
public:
|
||||
enum Columns { Id = 0, Name, Description, Operator };
|
||||
|
||||
explicit CriteriumDialogModel(QObject *parent = nullptr);
|
||||
~CriteriumDialogModel() = default;
|
||||
explicit CriteriumDialogModel(QObject* parent = nullptr);
|
||||
~CriteriumDialogModel() = default;
|
||||
|
||||
bool initModel(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc);
|
||||
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;
|
||||
QVariant data(const QModelIndex&, int) const override final;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
NGL::INGLLogger& m_logger;
|
||||
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
private:
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
|
||||
friend class CriteriumFilterModel;
|
||||
private:
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
|
||||
friend class CriteriumFilterModel;
|
||||
};
|
||||
|
||||
class CriteriumFilterModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
|
||||
void setOperatorId(int operatorId);
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
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};
|
||||
protected:
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
|
||||
|
||||
private:
|
||||
CriteriumDialogModel* m_sourceModel{nullptr};
|
||||
int m_operatorId{-1};
|
||||
};
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+55
-68
@@ -1,129 +1,116 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#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 "ui_san_nine_liner_dialog.h"
|
||||
|
||||
#include <Plugins/Evaluations/evl_data_plugin_interface.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
#include <Plugins/Evaluations/evl_data_plugin_interface.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
|
||||
|
||||
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))
|
||||
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_ui->setupUi(this);
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-SanNineLiner"));
|
||||
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);
|
||||
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);
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked, this,
|
||||
&SanNineLinerDialog::onEditSanNineLiner);
|
||||
}
|
||||
|
||||
SanNineLinerDialog::~SanNineLinerDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void SanNineLinerDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("SanNineLiner"));
|
||||
translate(m_ui, tr("SanNineLiner"));
|
||||
}
|
||||
|
||||
void SanNineLinerDialog::tableColumnOrganiserSetting()
|
||||
{
|
||||
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
bool SanNineLinerDialog::init(LtsSession::LtsSessionDataDds *session)
|
||||
bool SanNineLinerDialog::init(LtsSession::LtsSessionDataDds* session)
|
||||
{
|
||||
m_session = session;
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> dtc;
|
||||
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;
|
||||
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_model = new SanNineLinerDialogModel(this);
|
||||
m_model->initModel(dtc);
|
||||
auto proxy = new SanNineLinerProxyModel(this);
|
||||
proxy->setSourceModel(m_model);
|
||||
|
||||
m_ui->widget->setModel(proxy);
|
||||
m_ui->widget->setModel(proxy);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &SanNineLinerDialog::enaDisa);
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged, this, &SanNineLinerDialog::enaDisa);
|
||||
|
||||
enaDisa();
|
||||
enaDisa();
|
||||
|
||||
|
||||
return true;
|
||||
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);
|
||||
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 );
|
||||
SanNineLinerEditDialog* dialog = new SanNineLinerEditDialog(this);
|
||||
dialog->init(m_session, m_menuGroup, 0);
|
||||
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("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();
|
||||
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);
|
||||
});
|
||||
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());
|
||||
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();
|
||||
if (san.id() <= 0)
|
||||
return;
|
||||
DEBUG_LOG(m_logger) << "current SanNineLinerId: " << san.id();
|
||||
|
||||
SanNineLinerEditDialog *dialog = new SanNineLinerEditDialog(this);
|
||||
SanNineLinerEditDialog* dialog = new SanNineLinerEditDialog(this);
|
||||
|
||||
dialog->init(m_session, m_menuGroup, san.id());
|
||||
const QString identifier = QStringLiteral("EditSanNineLiner%1").arg(san.id());
|
||||
dialog->init(m_session, m_menuGroup, san.id());
|
||||
const QString identifier = QStringLiteral("EditSanNineLiner%1").arg(san.id());
|
||||
|
||||
addDialog(dialog, m_menuGroup, identifier);
|
||||
addDialog(dialog, m_menuGroup, identifier);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+31
-29
@@ -1,13 +1,12 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -18,36 +17,39 @@ namespace Evaluations
|
||||
{
|
||||
class SanNineLinerDialogModel;
|
||||
|
||||
|
||||
|
||||
class SanNineLinerDialog : public LtsWidgets::LtsDialog
|
||||
, protected Evaluations::Interface::Ftc::SanNineLinerRemoveReplyHandler
|
||||
class SanNineLinerDialog : public LtsWidgets::LtsDialog,
|
||||
protected Evaluations::Interface::Ftc::SanNineLinerRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SanNineLinerDialog(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~SanNineLinerDialog();
|
||||
public:
|
||||
explicit SanNineLinerDialog(const QString& menuGroup, QWidget* parent = nullptr);
|
||||
~SanNineLinerDialog();
|
||||
|
||||
bool init(LtsSession::LtsSessionDataDds *session);
|
||||
bool init(LtsSession::LtsSessionDataDds* session);
|
||||
|
||||
private slots:
|
||||
void enaDisa();
|
||||
void onAddSanNineLiner();
|
||||
void onEditSanNineLiner();
|
||||
void onRemoveSanNineLiner();
|
||||
private slots:
|
||||
void enaDisa();
|
||||
void onAddSanNineLiner();
|
||||
void onEditSanNineLiner();
|
||||
void onRemoveSanNineLiner();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
void onSanNineLinerRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void tableColumnOrganiserSetting() override;
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void retranslate() 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};
|
||||
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};
|
||||
};
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+44
-63
@@ -1,83 +1,64 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#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>
|
||||
#include <LtsUtilsCore/dds_vector.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
SanNineLinerDialogModel::SanNineLinerDialogModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<Evaluations::SanNineLiner>({tr("Id"),
|
||||
tr("Created"),
|
||||
tr("Position"),
|
||||
tr("Radio frequency / Call Sign / Suffix")
|
||||
},
|
||||
parent)
|
||||
{}
|
||||
|
||||
bool SanNineLinerDialogModel::initModel(const std::shared_ptr<Evaluations::Interface::Dtc> &dtc)
|
||||
SanNineLinerDialogModel::SanNineLinerDialogModel(QObject* parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<Evaluations::SanNineLiner>(
|
||||
{tr("Id"), tr("Created"), tr("Position"), tr("Radio frequency / Call Sign / Suffix")}, parent)
|
||||
{
|
||||
m_evlDtc = dtc;
|
||||
|
||||
connect(m_evlDtc.get(), &Evaluations::Interface::Dtc::sanNineLinerChanged,
|
||||
this, &SanNineLinerDialogModel::onDataChanged);
|
||||
|
||||
|
||||
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
|
||||
bool SanNineLinerDialogModel::initModel(const std::shared_ptr<Evaluations::Interface::Dtc>& dtc)
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
m_evlDtc = dtc;
|
||||
|
||||
connect(m_evlDtc.get(), &Evaluations::Interface::Dtc::sanNineLinerChanged, this,
|
||||
&SanNineLinerDialogModel::onDataChanged);
|
||||
|
||||
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();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SanNineLinerProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
void SanNineLinerProxyModel::setSourceModel(QAbstractItemModel* sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<SanNineLinerDialogModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
m_sourceModel = qobject_cast<SanNineLinerDialogModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+20
-29
@@ -1,52 +1,43 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#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
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
class SanNineLinerDialogModel final : public LtsWidgets::LtsAbstractTableModel<Evaluations::SanNineLiner>
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id,
|
||||
Created,
|
||||
Position,
|
||||
RadioFrequencyCallSignSuffix
|
||||
};
|
||||
public:
|
||||
enum Columns { Id, Created, Position, RadioFrequencyCallSignSuffix };
|
||||
|
||||
explicit SanNineLinerDialogModel(QObject *parent = nullptr);
|
||||
bool initModel(const std::shared_ptr<Evaluations::Interface::Dtc> &dtc);
|
||||
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;
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override final;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> m_evlDtc;
|
||||
friend class SanNineLinerProxyModel;
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
std::shared_ptr<Evaluations::Interface::Dtc> m_evlDtc;
|
||||
friend class SanNineLinerProxyModel;
|
||||
};
|
||||
|
||||
class SanNineLinerProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
SanNineLinerDialogModel *m_sourceModel{nullptr};
|
||||
void setSourceModel(QAbstractItemModel* sourceModel) override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
SanNineLinerDialogModel* m_sourceModel{nullptr};
|
||||
};
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+214
-240
@@ -1,326 +1,300 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#include "san_nine_liner_edit_dialog.h"
|
||||
#include <utility>
|
||||
|
||||
#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 <LtsUtilsCore/dds_vector.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
#include <LtsWidgets/lts_message_dialog.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 <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <QIntValidator>
|
||||
#include <QJsonDocument>
|
||||
#include <Services/Evaluations/san_category_line_json.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <ngltranslator/ngltranslator.h>
|
||||
|
||||
#include <QJsonDocument>
|
||||
|
||||
#include <QIntValidator>
|
||||
#include <utility>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
|
||||
|
||||
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))
|
||||
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_ui->setupUi(this);
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_validator->setRange(0, 99);
|
||||
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);
|
||||
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);
|
||||
connect(m_ui->pbClear, &QPushButton::clicked, m_ui->positionEdit, &LtsCoordWidget::LtsCoordWidget::clear);
|
||||
}
|
||||
|
||||
|
||||
SanNineLinerEditDialog::~SanNineLinerEditDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void SanNineLinerEditDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, QLatin1String("SanNineLiner"), m_sanNineLinerId, QLatin1String("Custom"), tr("SanNineLiner Edit"));
|
||||
translate(m_ui, QLatin1String("SanNineLiner"), m_sanNineLinerId, QLatin1String("Custom"), tr("SanNineLiner Edit"));
|
||||
}
|
||||
|
||||
|
||||
bool SanNineLinerEditDialog::init(LtsSession::LtsSessionDataDds *session,
|
||||
const QString &menuGroup,
|
||||
const int sanNineLinerId)
|
||||
bool SanNineLinerEditDialog::init(LtsSession::LtsSessionDataDds* session, const QString& menuGroup,
|
||||
const int sanNineLinerId)
|
||||
{
|
||||
m_session = session;
|
||||
m_menuGroup = menuGroup;
|
||||
m_sanNineLinerId = 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;
|
||||
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);
|
||||
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);
|
||||
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(); });
|
||||
m_ui->dtTime->setRetrieveCurrentTimeCallback([this]() { return m_session->partitionTime(); });
|
||||
|
||||
Evaluations::SanNineLiner data = m_dtc->sanNineLiner(sanNineLinerId);
|
||||
Evaluations::SanNineLiner data = m_dtc->sanNineLiner(sanNineLinerId);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
QVector<Database::SanCategoryLine> linesCategory = SanCategoryLine::fromJson(data.lines(), data.id());
|
||||
|
||||
INFO_LOG(m_logger) << "linesCategory size: " << linesCategory.size();
|
||||
|
||||
for (const Database::SanCategoryLine &cl : std::as_const(linesCategory))
|
||||
if (data.id() > 0)
|
||||
{
|
||||
|
||||
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));
|
||||
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);
|
||||
|
||||
continue;
|
||||
}
|
||||
QVector<Database::SanCategoryLine> linesCategory = SanCategoryLine::fromJson(data.lines(), data.id());
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
INFO_LOG(m_logger) << "linesCategory size: " << linesCategory.size();
|
||||
|
||||
|
||||
for (const Database::SanCategoryLine& cl : std::as_const(linesCategory))
|
||||
{
|
||||
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
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());
|
||||
}
|
||||
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()
|
||||
bool SanNineLinerEditDialog::apply()
|
||||
{
|
||||
|
||||
SanNineLinerModifyRequest request;
|
||||
request.id(m_sanNineLinerId);
|
||||
SanNineLinerModifyRequest request;
|
||||
request.id(m_sanNineLinerId);
|
||||
|
||||
|
||||
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());
|
||||
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();
|
||||
|
||||
int 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;
|
||||
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;
|
||||
setCategoryLine(line, QStringLiteral("A"), m_ui->le5A);
|
||||
setCategoryLine(line, QStringLiteral("B"), m_ui->le5B);
|
||||
|
||||
line = 6;
|
||||
setCategoryLine(line, QStringLiteral("A"), m_ui->rb6A);
|
||||
setCategoryLine(line, QStringLiteral("B"), m_ui->rb6B);
|
||||
|
||||
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;
|
||||
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;
|
||||
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);
|
||||
m_vecCategoryLine.clear();
|
||||
|
||||
QJsonDocument doc = SanCategoryLine::toJson(m_vecCategoryLine);
|
||||
request.lines(doc.toJson().toStdString());
|
||||
int line = 3;
|
||||
|
||||
if (!m_requestHelper->startSingleRequest([this, request]()
|
||||
{
|
||||
return m_ftc->sanNineLinerModifyRequest(request, this);
|
||||
}))
|
||||
return false;
|
||||
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);
|
||||
|
||||
if (request.id() <= 0)
|
||||
{
|
||||
m_sanNineLinerId = m_requestHelper->getRepliedId();
|
||||
ERROR_LOG(m_logger) << "Created new san nine liner with id " << m_sanNineLinerId;
|
||||
}
|
||||
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;
|
||||
setCategoryLine(line, QStringLiteral("A"), m_ui->le5A);
|
||||
setCategoryLine(line, QStringLiteral("B"), m_ui->le5B);
|
||||
|
||||
line = 6;
|
||||
setCategoryLine(line, QStringLiteral("A"), m_ui->rb6A);
|
||||
setCategoryLine(line, QStringLiteral("B"), m_ui->rb6B);
|
||||
|
||||
return true;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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);
|
||||
if (!has2DMap())
|
||||
return;
|
||||
|
||||
m_sitMapGuiIfc->getCoordinate(this, SLOT(onCoordinate(QPointF)), nullptr);
|
||||
}
|
||||
|
||||
void SanNineLinerEditDialog::onCoordinate(const QPointF ¢erPoint)
|
||||
void SanNineLinerEditDialog::onCoordinate(const QPointF& centerPoint)
|
||||
{
|
||||
m_ui->positionEdit->setCoordinate(centerPoint);
|
||||
m_ui->positionEdit->setCoordinate(centerPoint);
|
||||
}
|
||||
|
||||
void SanNineLinerEditDialog::setCategoryLine( int line, const QString &category, QLineEdit* leAmount)
|
||||
void SanNineLinerEditDialog::setCategoryLine(int line, const QString& category, QLineEdit* leAmount)
|
||||
{
|
||||
Database::SanCategoryLine cl;
|
||||
Database::SanCategoryLine cl;
|
||||
|
||||
cl.nineLinerId = m_sanNineLinerId;
|
||||
cl.line = line;
|
||||
cl.category = category;
|
||||
cl.amount = leAmount->text().toInt();
|
||||
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));
|
||||
if (cl.amount > 0)
|
||||
m_vecCategoryLine.push_back(std::move(cl));
|
||||
}
|
||||
|
||||
void SanNineLinerEditDialog::setCategoryLine( int line, const QString &category, QRadioButton *rb)
|
||||
void SanNineLinerEditDialog::setCategoryLine(int line, const QString& category, QRadioButton* rb)
|
||||
{
|
||||
Database::SanCategoryLine cl;
|
||||
Database::SanCategoryLine cl;
|
||||
|
||||
cl.nineLinerId = m_sanNineLinerId;
|
||||
cl.line = line;
|
||||
cl.category = category;
|
||||
cl.amount = 0;
|
||||
cl.nineLinerId = m_sanNineLinerId;
|
||||
cl.line = line;
|
||||
cl.category = category;
|
||||
cl.amount = 0;
|
||||
|
||||
if (rb->isChecked())
|
||||
m_vecCategoryLine.push_back(std::move(cl));
|
||||
if (rb->isChecked())
|
||||
m_vecCategoryLine.push_back(std::move(cl));
|
||||
}
|
||||
|
||||
void SanNineLinerEditDialog::setCategoryLine(int line, const QString &category, QCheckBox *cbx)
|
||||
void SanNineLinerEditDialog::setCategoryLine(int line, const QString& category, QCheckBox* cbx)
|
||||
{
|
||||
Database::SanCategoryLine cl;
|
||||
Database::SanCategoryLine cl;
|
||||
|
||||
cl.nineLinerId = m_sanNineLinerId;
|
||||
cl.line = line;
|
||||
cl.category = category;
|
||||
cl.amount = 0;
|
||||
cl.nineLinerId = m_sanNineLinerId;
|
||||
cl.line = line;
|
||||
cl.category = category;
|
||||
cl.amount = 0;
|
||||
|
||||
if (cbx->isChecked())
|
||||
m_vecCategoryLine.push_back(std::move(cl));
|
||||
if (cbx->isChecked())
|
||||
m_vecCategoryLine.push_back(std::move(cl));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+44
-49
@@ -1,16 +1,14 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
|
||||
#include <Evaluations/evl_db_structs.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -19,7 +17,7 @@ class SanNineLinerEditDialog;
|
||||
|
||||
namespace SituationMap
|
||||
{
|
||||
class ForeignGuiInterface;
|
||||
class ForeignGuiInterface;
|
||||
}
|
||||
|
||||
class QIntValidator;
|
||||
@@ -27,58 +25,55 @@ class QIntValidator;
|
||||
namespace Evaluations
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
class SanNineLinerEditDialog final : public LtsWidgets::LtsDialog
|
||||
, protected Evaluations::Interface::Ftc::SanNineLinerModifyReplyHandler
|
||||
class SanNineLinerEditDialog final : public LtsWidgets::LtsDialog,
|
||||
protected Evaluations::Interface::Ftc::SanNineLinerModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SanNineLinerEditDialog(QWidget *parent = nullptr);
|
||||
public:
|
||||
explicit SanNineLinerEditDialog(QWidget* parent = nullptr);
|
||||
|
||||
bool init(LtsSession::LtsSessionDataDds *session,
|
||||
const QString &menuGroup,
|
||||
const int sanNineLinerId);
|
||||
bool init(LtsSession::LtsSessionDataDds* session, const QString& menuGroup, const int sanNineLinerId);
|
||||
|
||||
~SanNineLinerEditDialog();
|
||||
~SanNineLinerEditDialog();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
NGL::INGLLogger& m_logger;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onSanNineLinerModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onSanNineLinerModifyReply(const Core::FunctionReplyObject& replyObject) override final
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
private slots:
|
||||
void onCoordinate(const QPointF ¢erPoint);
|
||||
void getPosition();
|
||||
private slots:
|
||||
void onCoordinate(const QPointF& centerPoint);
|
||||
void getPosition();
|
||||
|
||||
signals:
|
||||
void sendData(const Evaluations::SanNineLiner& data);
|
||||
|
||||
signals:
|
||||
void sendData(const Evaluations::SanNineLiner &data);
|
||||
private:
|
||||
void retranslate() override;
|
||||
bool apply() override final;
|
||||
bool has2DMap();
|
||||
|
||||
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 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();
|
||||
|
||||
void enaDisa();
|
||||
Ui::SanNineLinerEditDialog* m_ui{nullptr};
|
||||
LtsSession::LtsSessionDataDds* m_session{nullptr};
|
||||
int m_sanNineLinerId{0};
|
||||
std::vector<Database::SanCategoryLine> m_vecCategoryLine;
|
||||
|
||||
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;
|
||||
|
||||
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};
|
||||
QString m_menuGroup;
|
||||
QIntValidator* m_validator{nullptr};
|
||||
LtsUtils::RequestHelper* m_requestHelper{nullptr};
|
||||
};
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+22
-26
@@ -1,11 +1,10 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
|
||||
|
||||
namespace Ui
|
||||
@@ -20,33 +19,30 @@ class EvlCommentDataViewProxyModel;
|
||||
|
||||
class EvlCommentsView : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
EvlCommentsView(const std::shared_ptr<Interface::Dtc>& evlDtc,
|
||||
const std::shared_ptr<OperatorManagement::Interface::Dtc>& opmDtc, QWidget* parent = nullptr);
|
||||
~EvlCommentsView();
|
||||
|
||||
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 slots:
|
||||
void onLtsDataView_DoubleClicked();
|
||||
void onCommentChanged(const Evaluations::EvaluationComment &data, DataModification modType);
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
bool insertComment(const Evaluations::EvaluationComment& c);
|
||||
void retranslate() override;
|
||||
bool eventFilter(QObject* object, QEvent* event) override;
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
private:
|
||||
Ui::EvlCommentsDialog* m_ui{nullptr};
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool insertComment(const Evaluations::EvaluationComment &c);
|
||||
void retranslate() override;
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
void tableColumnOrganiserSetting() override;
|
||||
std::shared_ptr<Interface::Dtc> m_evlDtc;
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
|
||||
|
||||
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};
|
||||
EvlCommentDataViewModel* m_model{nullptr};
|
||||
EvlCommentDataViewProxyModel* m_proxyModel{nullptr};
|
||||
};
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+877
-977
File diff suppressed because it is too large.
Load diff
Executable → Regular
+100
-95
@@ -2,137 +2,142 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include "evl_edit_treemodel_schema.h"
|
||||
|
||||
#include <Evaluations/evl_dtc.h>
|
||||
#include <Evaluations/evl_ftc.h>
|
||||
#include <OcSituationClient/osc_ftc.h>
|
||||
#include <Evaluations/logger.h>
|
||||
#include <FileManagement/flm_dtc.h>
|
||||
#include <FileManagement/flm_ftc.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtils/LtsUtilsGui/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"
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <OcSituationClient/osc_ftc.h>
|
||||
#include <Plugins/FileManagement/Data/flm_data_plugin.h>
|
||||
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.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
|
||||
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
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EditSchemaDialog(bool ocMode, bool runningOnTablet, LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~EditSchemaDialog();
|
||||
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;
|
||||
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:
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void onSendEvaluationReply(const Core::FunctionReplyObject& replyObject) override final;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onSendEvaluationReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void onEvlCommentModifyReply(const Core::FunctionReplyObject& replyObject) override final
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
void onEvlCommentModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onEvlSchemaModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onEvlSchemaModifyReply(const Core::FunctionReplyObject& replyObject) override final
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
|
||||
void onFileContentModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject);}
|
||||
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();
|
||||
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);
|
||||
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();
|
||||
bool onSaveToLibrary();
|
||||
void onLoadFromLibrary();
|
||||
void onAddElement();
|
||||
void onAddFolder();
|
||||
void onAddRootFolder();
|
||||
|
||||
void onCreateNewSchema();
|
||||
void onRemoveSelectedElement();
|
||||
void onCreateNewSchema();
|
||||
void onRemoveSelectedElement();
|
||||
|
||||
void DebugonLoadSchema();
|
||||
void onSendSchema();
|
||||
void DebugonLoadSchema();
|
||||
void onSendSchema();
|
||||
|
||||
private:
|
||||
void loadLatestSchema();
|
||||
void handleUnsentComments();
|
||||
void updateCommentLabel();
|
||||
void markCommentAsSent(const QPersistentModelIndex &idx);
|
||||
private:
|
||||
void loadLatestSchema();
|
||||
void handleUnsentComments();
|
||||
void updateCommentLabel();
|
||||
void markCommentAsSent(const QPersistentModelIndex& idx);
|
||||
|
||||
|
||||
EvlCommentModifyRequest createEvlCommentModifyRequest(const ItemComment &c) const;
|
||||
OcSituationClient::SendEvaluationRequest createSendEvaluationRequest(const ItemComment &c) const;
|
||||
QVector<QPersistentModelIndex> m_vecCommentsInSendState;
|
||||
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);
|
||||
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 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;
|
||||
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};
|
||||
bool m_ocMode{false};
|
||||
bool m_runningOnTablet{false};
|
||||
TreeModelSchema* m_pModel{nullptr};
|
||||
|
||||
QMap<qint32, Evaluations::EvaluationSchema> m_mapSchemata;
|
||||
qint32 m_loadedSchemaId{0};
|
||||
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<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;
|
||||
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};
|
||||
QString m_lastFileName;
|
||||
Evaluations::EvlNewCommentDialog* m_commentDlg{nullptr};
|
||||
LtsSession::LtsSession* m_session{nullptr};
|
||||
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
Ui::EditSchemaDialog *m_ui{nullptr};
|
||||
LtsUtils::RequestHelper* m_requestHelper{nullptr};
|
||||
Ui::EditSchemaDialog* m_ui{nullptr};
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+18
-18
@@ -1,33 +1,33 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <nglwidgets/ngltreemodel.h>
|
||||
#include <nglwidgets/ngltreeitem.h>
|
||||
#include "evl_edit_schema_element_data.h"
|
||||
|
||||
#include <Evaluations/logger.h>
|
||||
#include <nglwidgets/ngltreeitem.h>
|
||||
#include <nglwidgets/ngltreemodel.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class TreeModelGeneral : public NGLTreeModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TreeModelGeneral(QObject *parent,
|
||||
NGL::INGLLogger &logger);
|
||||
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;
|
||||
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;
|
||||
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);
|
||||
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:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
protected:
|
||||
NGL::INGLLogger& m_logger;
|
||||
};
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+224
-245
@@ -1,302 +1,281 @@
|
||||
|
||||
|
||||
|
||||
#include "evl_edit_treemodel_schema.h"
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
TreeModelSchema::TreeModelSchema(QObject *parent, NGL::INGLLogger &logger)
|
||||
: TreeModelGeneral(parent, logger)
|
||||
TreeModelSchema::TreeModelSchema(QObject* parent, NGL::INGLLogger& logger) : TreeModelGeneral(parent, logger)
|
||||
{
|
||||
qRegisterMetaTypeStreamOperators<Evaluations::ElementData>();
|
||||
qRegisterMetaTypeStreamOperators<Evaluations::ElementData>();
|
||||
}
|
||||
|
||||
|
||||
void TreeModelSchema::resetModel()
|
||||
{
|
||||
TreeModelGeneral::resetModel();
|
||||
m_elementId = 1;
|
||||
m_cntComments = 0;
|
||||
m_cntSentComments = 0;
|
||||
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)
|
||||
bool TreeModelSchema::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column,
|
||||
const QModelIndex& parent)
|
||||
{
|
||||
|
||||
|
||||
ElementData p = getSelectedIndexDataAsElement(parent);
|
||||
ElementData p = getSelectedIndexDataAsElement(parent);
|
||||
|
||||
if (!p.isFolder())
|
||||
{
|
||||
emit signalTriedToDropFolderToElement();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool success = TreeModelGeneral::dropMimeData(data, action, row, column, parent);
|
||||
|
||||
if (success)
|
||||
{
|
||||
|
||||
|
||||
int parentId = getSelectedIndexDataAsElement(parent).m_id;
|
||||
iterateModel(parent, [this, parentId](const QModelIndex & idx, const QVariant & v)
|
||||
if (!p.isFolder())
|
||||
{
|
||||
Evaluations::ElementData e = v.value<Evaluations::ElementData>();
|
||||
e.m_parentId = parentId;
|
||||
updateElementData(idx, e);
|
||||
}, false);
|
||||
emit signalTriedToDropFolderToElement();
|
||||
return false;
|
||||
}
|
||||
|
||||
refreshAllIcons();
|
||||
emit signalSuccessfulDropPerformed(parent);
|
||||
}
|
||||
bool success = TreeModelGeneral::dropMimeData(data, action, row, column, parent);
|
||||
|
||||
return success;
|
||||
if (success)
|
||||
{
|
||||
|
||||
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 TreeModelSchema::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
QVariant v = TreeModelGeneral::data(index, role);
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
ElementData TreeModelSchema::getSelectedIndexDataAsElement(const QModelIndex& idx) const
|
||||
{
|
||||
if (!idx.isValid())
|
||||
ElementData();
|
||||
if (!idx.isValid())
|
||||
ElementData();
|
||||
|
||||
QVariant v = TreeModelGeneral::dataAsVariant(idx);
|
||||
return v.value<Evaluations::ElementData>();
|
||||
QVariant v = TreeModelGeneral::dataAsVariant(idx);
|
||||
return v.value<Evaluations::ElementData>();
|
||||
}
|
||||
|
||||
|
||||
QVector<QString> TreeModelSchema::getSelectedIndexHierarchy(const QModelIndex &idx) const
|
||||
QVector<QString> TreeModelSchema::getSelectedIndexHierarchy(const QModelIndex& idx) const
|
||||
{
|
||||
if (!idx.isValid())
|
||||
QString();
|
||||
if (!idx.isValid())
|
||||
QString();
|
||||
|
||||
QVector<QString> vecHierarchy;
|
||||
QVector<QString> vecHierarchy;
|
||||
|
||||
QModelIndex iterIdx = idx;
|
||||
QModelIndex iterIdx = idx;
|
||||
|
||||
while (iterIdx.parent() != QModelIndex())
|
||||
{
|
||||
Evaluations::ElementData e = getSelectedIndexDataAsElement(iterIdx);
|
||||
vecHierarchy.push_front(e.getText());
|
||||
|
||||
iterIdx = iterIdx.parent();
|
||||
}
|
||||
|
||||
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;
|
||||
return vecHierarchy;
|
||||
}
|
||||
|
||||
|
||||
QJsonDocument TreeModelSchema::toJsonDocument() const
|
||||
{
|
||||
QJsonArray arr;
|
||||
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;
|
||||
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());
|
||||
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;
|
||||
|
||||
|
||||
|
||||
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;
|
||||
arr.append(obj);
|
||||
});
|
||||
|
||||
e.switchState(hasUnsentComments ? ElementData::State::ElementWithUnsentComments : ElementData::State::ElementAllCommentsSent);
|
||||
}
|
||||
|
||||
TreeModelGeneral::updateRow(idx, QVariant::fromValue(e), e.getIcon());
|
||||
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;
|
||||
|
||||
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();
|
||||
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());
|
||||
});
|
||||
NGLTreeItem* item = privateData(idx);
|
||||
item->setIcon(d.getIcon());
|
||||
});
|
||||
|
||||
emit dataChanged(QModelIndex(), QModelIndex());
|
||||
emit dataChanged(QModelIndex(), QModelIndex());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+51
-53
@@ -1,94 +1,92 @@
|
||||
|
||||
|
||||
#include "evl_new_comment_dialog.h"
|
||||
|
||||
#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(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
m_ui->setupUi(this);
|
||||
setWindowFlags(Qt::Tool);
|
||||
m_ui->m_ltsComboBox_ReceiverOperator->addItem(tr("All (Default)"), 0);
|
||||
EvlNewCommentDialog::EvlNewCommentDialog(const std::shared_ptr<OperatorManagement::Interface::Dtc>& opmDtc,
|
||||
QWidget* parent)
|
||||
: QDialog(parent), m_ui(new Ui::EvlNewCommentDialog), m_logger(NGL::NGLLoggerBootstrap::getLogger())
|
||||
{
|
||||
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);
|
||||
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);
|
||||
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());
|
||||
m_ui->m_checkBox_SendComment->setChecked(
|
||||
LtsUtils::OperatorSettings::getInstance()
|
||||
->value(QStringLiteral("Evaluations"), QStringLiteral("setAutoSendComments"), false)
|
||||
.toBool());
|
||||
|
||||
onTextChanged();
|
||||
onTextChanged();
|
||||
}
|
||||
|
||||
|
||||
EvlNewCommentDialog::~EvlNewCommentDialog()
|
||||
{
|
||||
LtsUtils::OperatorSettings::getInstance()->setValue(QStringLiteral("Evaluations"), QStringLiteral("setAutoSendComments"), m_ui->m_checkBox_SendComment->isChecked());
|
||||
delete m_ui;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
while (currentUsedChars > m_maxChars)
|
||||
{
|
||||
plainText.chop(1);
|
||||
currentUsedChars = plainText.toUtf8().size();
|
||||
bNeedSetNew = true;
|
||||
}
|
||||
|
||||
|
||||
if (bNeedSetNew)
|
||||
{
|
||||
m_ui->m_plainTextEdit_Comment->setPlainText(plainText);
|
||||
m_ui->m_plainTextEdit_Comment->moveCursor(QTextCursor::End);
|
||||
}
|
||||
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));
|
||||
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();
|
||||
return m_ui->m_checkBox_SendComment->isChecked();
|
||||
}
|
||||
|
||||
|
||||
QString EvlNewCommentDialog::comment() const
|
||||
{
|
||||
return m_ui->m_plainTextEdit_Comment->toPlainText();
|
||||
return m_ui->m_plainTextEdit_Comment->toPlainText();
|
||||
}
|
||||
|
||||
|
||||
int EvlNewCommentDialog::selectedReceiverId() const
|
||||
{
|
||||
return m_ui->m_ltsComboBox_ReceiverOperator->currentData().toInt();
|
||||
return m_ui->m_ltsComboBox_ReceiverOperator->currentData().toInt();
|
||||
}
|
||||
|
||||
void EvlNewCommentDialog::setAsEditComment(const QString &text)
|
||||
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_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"));
|
||||
m_ui->m_pushButton_AddComment->setText(tr("Edit Comment"));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Evaluations
|
||||
Executable → Regular
+16
-19
@@ -1,6 +1,5 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
@@ -11,30 +10,28 @@ namespace Ui
|
||||
class EvlNewCommentDialog;
|
||||
}
|
||||
|
||||
|
||||
namespace Evaluations
|
||||
{
|
||||
class EvlNewCommentDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EvlNewCommentDialog(const std::shared_ptr<OperatorManagement::Interface::Dtc> &opmDtc,
|
||||
QWidget *parent = nullptr);
|
||||
~EvlNewCommentDialog();
|
||||
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);
|
||||
bool autoSend() const;
|
||||
QString comment() const;
|
||||
int selectedReceiverId() const;
|
||||
void setAsEditComment(const QString& text);
|
||||
|
||||
private slots:
|
||||
void onTextChanged();
|
||||
private slots:
|
||||
void onTextChanged();
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
Ui::EvlNewCommentDialog *m_ui{nullptr};
|
||||
const int m_maxChars{255};
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
Ui::EvlNewCommentDialog* m_ui{nullptr};
|
||||
const int m_maxChars{255};
|
||||
};
|
||||
}
|
||||
} // namespace Evaluations
|
||||
Reference in new issue
Block a user