Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Malte Diers, SLSE, 2017-10-23
|
||||
#
|
||||
|
||||
SET(opm_change_pw_gui_SRCS
|
||||
operator_change_password.cpp
|
||||
operator_change_password.h
|
||||
|
||||
operator_dialog_model.cpp
|
||||
operator_dialog_model.h
|
||||
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(opm_change_pw_gui_SRCS
|
||||
operator_change_password.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY2(WS OpmChangePasswordGui SHARED ${opm_change_pw_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(OpmChangePasswordGui
|
||||
OpmDataPluginInterface
|
||||
OpmGuiPluginInterface
|
||||
PpmDataPluginInterface
|
||||
ExmDataPluginInterface
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsSessionData
|
||||
LtsUtilsGuiDds
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* OperatorManagement - Operator Change Password (Frameless) Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Malte Diers, SLSE, 2017-10-11
|
||||
*/
|
||||
|
||||
#include "operator_change_password.h"
|
||||
#include "ui_operator_change_password.h"
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
|
||||
#include <OperatorManagement/opm_operator_rights.h>
|
||||
|
||||
OperatorChangePassword::OperatorChangePassword(QWidget *parent, int operatorId)
|
||||
: LtsWidgets::LtsFramelessDialog(parent)
|
||||
, m_session(nullptr)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_operatorId(operatorId)
|
||||
, m_ui(new Ui::OperatorChangePassword)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
connect(m_ui->pbDisplay, &QPushButton::toggled, this, &OperatorChangePassword::onViewPasswordToggled);
|
||||
|
||||
connect(m_ui->pbCancel, &QPushButton::clicked, this, &OperatorChangePassword::reject);
|
||||
connect(m_ui->pbOk, &QPushButton::clicked, this, &OperatorChangePassword::onOkay);
|
||||
|
||||
connect(m_ui->leOldPassword, &QLineEdit::textChanged, m_ui->lblError, &QLabel::clear);
|
||||
connect(m_ui->leNewPassword, &QLineEdit::textChanged, m_ui->lblError, &QLabel::clear);
|
||||
connect(m_ui->leConfirmPassword, &QLineEdit::textChanged, m_ui->lblError, &QLabel::clear);
|
||||
}
|
||||
|
||||
OperatorChangePassword::~OperatorChangePassword()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void OperatorChangePassword::onOperatorChangePasswordReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
if (replyObject.error())
|
||||
m_ui->lblError->setText(replyObject.translated());
|
||||
else
|
||||
accept();
|
||||
}
|
||||
|
||||
bool OperatorChangePassword::init(LtsSession::LtsSessionDataDds *session)
|
||||
{
|
||||
m_session = session;
|
||||
if (!m_session->getDtc<OperatorManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!m_session->getFtc<OperatorManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
|
||||
if (m_operatorId == LtsSessionData::LtsSessionData::getInstance()->getOperatorId())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Organizer Or Admin Mode. No Need to know old Password.
|
||||
m_ui->leOldPassword->hide();
|
||||
m_ui->lblOldPassword->hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OperatorChangePassword::onViewPasswordToggled(bool checked)
|
||||
{
|
||||
m_ui->leNewPassword->setEchoMode(checked ? QLineEdit::EchoMode::Normal : QLineEdit::EchoMode::Password);
|
||||
m_ui->leConfirmPassword->setEchoMode(checked ? QLineEdit::EchoMode::Normal : QLineEdit::EchoMode::Password);
|
||||
}
|
||||
|
||||
void OperatorChangePassword::onOkay()
|
||||
{
|
||||
if (m_ui->leNewPassword->text().length() < 4)
|
||||
{
|
||||
m_ui->lblError->setText(tr("New password is too short"));
|
||||
return;
|
||||
}
|
||||
if (m_ui->leNewPassword->text() != m_ui->leConfirmPassword->text())
|
||||
{
|
||||
m_ui->lblError->setText(tr("New password and confirmation do not match"));
|
||||
return;
|
||||
}
|
||||
|
||||
OperatorManagement::OperatorChangePasswordRequest req;
|
||||
req.id(m_operatorId);
|
||||
// Transmit anyways. If ForceSet is true, it doesn't matter if set or not.
|
||||
req.oldPassword(m_ui->leOldPassword->text().toStdString());
|
||||
req.password(m_ui->leNewPassword->text().toStdString());
|
||||
req.forceSet(m_ui->leOldPassword->isHidden());
|
||||
m_requestHelper->addRequest([this,req]()
|
||||
{
|
||||
return m_ftc->operatorChangePasswordRequest(req, this);
|
||||
});
|
||||
m_requestHelper->startRequests();
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* OperatorManagement - Operator Change Password (Frameless) Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Malte Diers, SLSE, 2017-10-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <LtsWidgets/lts_frameless_dialog.h>
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <OperatorManagement/opm_ftc.h>
|
||||
#include <OperatorManagement/opm_dtc.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
#include <Plugins/OperatorManagement/Gui/Common/opmchangepasswordgui_export.h>
|
||||
|
||||
namespace Ui {
|
||||
class OperatorChangePassword;
|
||||
}
|
||||
namespace LtsSession {
|
||||
class LtsSessionDataDds;
|
||||
}
|
||||
|
||||
class OPMCHANGEPASSWORDGUI_EXPORT OperatorChangePassword : public LtsWidgets::LtsFramelessDialog,
|
||||
protected OperatorManagement::Interface::Ftc::OperatorChangePasswordReplyHandler
|
||||
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OperatorChangePassword(QWidget *parent = nullptr, int operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId());
|
||||
~OperatorChangePassword();
|
||||
void onOperatorChangePasswordReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
bool init(LtsSession::LtsSessionDataDds *session);
|
||||
|
||||
private slots:
|
||||
void onViewPasswordToggled(bool checked);
|
||||
void onOkay();
|
||||
|
||||
private:
|
||||
LtsSession::LtsSessionDataDds *m_session;
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<OperatorManagement::Interface::Ftc> m_ftc;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
int m_operatorId;
|
||||
Ui::OperatorChangePassword *m_ui;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OperatorChangePassword</class>
|
||||
<widget class="LtsWidgets::LtsFramelessDialog" name="OperatorChangePassword">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>369</width>
|
||||
<height>196</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="5" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbOk">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbCancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblOldPassword">
|
||||
<property name="text">
|
||||
<string>Old Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leOldPassword">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="leNewPassword">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="leConfirmPassword">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblPasswordConfirmation">
|
||||
<property name="text">
|
||||
<string>Confirm Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblPassword">
|
||||
<property name="text">
|
||||
<string>New Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QLabel" name="lblError">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" rowspan="2">
|
||||
<widget class="QPushButton" name="pbDisplay">
|
||||
<property name="text">
|
||||
<string>Display</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsFramelessDialog</class>
|
||||
<extends>QDialog</extends>
|
||||
<header>LtsWidgets/lts_frameless_dialog.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,290 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for OperatorManangement - Operator Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
|
||||
#include "operator_dialog_model.h"
|
||||
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
#include <ExerciseManagement/exm_data_plugin_interface.h>
|
||||
#include <LtsUtilsCore/dds_vector_to_pixmap.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
|
||||
namespace OperatorManagement
|
||||
{
|
||||
//---------------------------------
|
||||
// OperatorManagementDialogModel
|
||||
//---------------------------------
|
||||
OperatorManagementDialogModel::OperatorManagementDialogModel(QObject *parent, int exerciseId )
|
||||
: LtsWidgets::LtsAbstractTableModel<OperatorManagement::User>({tr("Id"),
|
||||
tr("Name"),
|
||||
tr("Info"),
|
||||
tr("Effective ACLs"),
|
||||
tr("Visible Parties"),
|
||||
tr("Primary Group Id"),
|
||||
tr("Projection Priority"),
|
||||
tr("Audio Channel Priority"),
|
||||
tr("Image"),
|
||||
tr("Workstation"),
|
||||
tr("Exercises"),
|
||||
tr("Preset Role")},
|
||||
parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_exmDtc(nullptr)
|
||||
, m_logger(getLogger("OpeartorManagementDialogModel"))
|
||||
, m_exerciseId(exerciseId)
|
||||
{}
|
||||
|
||||
OperatorManagementDialogModel::~OperatorManagementDialogModel()
|
||||
{}
|
||||
|
||||
bool OperatorManagementDialogModel::initModel(LtsSession::LtsSession *session, const std::shared_ptr<OperatorManagement::Interface::Dtc> &dtc)
|
||||
{
|
||||
m_dtc = dtc;
|
||||
session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc);
|
||||
session->getDtc<ExerciseManagement::DataInterface>(m_exmDtc);
|
||||
|
||||
connect(m_dtc.get(), &OperatorManagement::Interface::Dtc::userChanged,
|
||||
this, &OperatorManagementDialogModel::onDataChanged);
|
||||
m_dtc->users([this](const OperatorManagement::User &op) { insertRow(op); });
|
||||
|
||||
if (m_ppmDtc)
|
||||
{
|
||||
connect(m_ppmDtc.get(), &ParticipantManagement::Interface::Dtc::partyChanged,
|
||||
this, &OperatorManagementDialogModel::onPartyChanged);
|
||||
// Get 'static' data for all parties
|
||||
{
|
||||
auto cb = [this](const ParticipantManagement::Party & party)
|
||||
{
|
||||
onPartyChanged(party, DataModification::eAdded);
|
||||
};
|
||||
if (!m_ppmDtc->partys(cb))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_exmDtc)
|
||||
{
|
||||
connect(m_exmDtc.get(), &ExerciseManagement::Interface::Dtc::exerciseChanged,
|
||||
this, &OperatorManagementDialogModel::onExerciseChanged);
|
||||
// Get 'static' data for all exercises
|
||||
{
|
||||
auto cb = [this](const ExerciseManagement::Exercise &exercise)
|
||||
{
|
||||
onExerciseChanged(exercise, DataModification::eAdded);
|
||||
};
|
||||
if (!m_exmDtc->exercises(cb))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto cb = [this](const Group &group)
|
||||
{
|
||||
if (group.type() == GroupType_def::PresetGroup)
|
||||
m_roles[group.id()] = QString::fromStdString(group.name());
|
||||
};
|
||||
dtc->groups(cb);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OperatorManagementDialogModel::onPartyChanged(const ParticipantManagement::Party &data, DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
m_parties.remove(data.id());
|
||||
else
|
||||
m_parties[data.id()] = ParticipantManagement::trPartyName(data.name());
|
||||
for (int row = 0; row < m_vecData.size(); ++row)
|
||||
{
|
||||
const QModelIndex idx(index(row, VisibleParties));
|
||||
emit dataChanged(idx, idx);
|
||||
}
|
||||
}
|
||||
|
||||
void OperatorManagementDialogModel::onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
m_exercises.remove(data.id());
|
||||
else
|
||||
m_exercises[data.id()] = QString::fromStdString(data.name());
|
||||
for (int row = 0; row < m_vecData.size(); ++row)
|
||||
{
|
||||
const QModelIndex idx(index(row, Exercises));
|
||||
emit dataChanged(idx, idx);
|
||||
}
|
||||
}
|
||||
|
||||
QVariant OperatorManagementDialogModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole && role != Qt::DecorationRole)
|
||||
return QVariant();
|
||||
|
||||
if (!indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::DecorationRole && index.column() == Name)
|
||||
return QIcon(QLatin1String("icon:list-add-user.svg"));
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
const OperatorManagement::User &op = m_vecData.at(index.row());
|
||||
std::vector<OperatorManagement::PartiesByExercise> pbe = op.visiblePartiesByExercise();
|
||||
switch (index.column())
|
||||
{
|
||||
case Name:
|
||||
return QString::fromStdString(op.name());
|
||||
case Description:
|
||||
return QString::fromStdString(op.description());
|
||||
case VisibleParties:
|
||||
return hasVisibleParties(pbe);
|
||||
case RolePreset:
|
||||
return rolePreset(op.rolePresetId());
|
||||
case Id:
|
||||
return QString::number(op.id());
|
||||
case EffectiveAcls:
|
||||
return effectiveAcls(op.effectiveAcls());
|
||||
case PrimaryGroupId:
|
||||
return QString::number(op.primaryGroupId());
|
||||
case ProjectionPriority:
|
||||
return priority(op.projectionPriority());
|
||||
case AudioChannelPriority:
|
||||
return priority(op.audioChannelPriority());
|
||||
case Image:
|
||||
return LtsUtils::getPixmap(op.image());
|
||||
case Workstation:
|
||||
return workstation(op.workstationId(), op.workstationIp());
|
||||
case Exercises:
|
||||
return exercises(op.exerciseIds());
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QString OperatorManagementDialogModel::workstation(int wsId, int wsIp) const
|
||||
{
|
||||
if (!wsId)
|
||||
return QString();
|
||||
|
||||
quint8 oct1,oct2,oct3,oct4;
|
||||
oct1 = (wsIp >> 24) & 0xFF;
|
||||
oct2 = (wsIp >> 16) & 0xFF;
|
||||
oct3 = (wsIp >> 8) & 0xFF;
|
||||
oct4 = (wsIp >> 0) & 0xFF;
|
||||
QString ip = tr("%1.%2.%3.%4").arg(oct1).arg(oct2).arg(oct3).arg(oct4);
|
||||
|
||||
return tr("ID: %1, IP: %2").arg(wsId).arg(ip);
|
||||
|
||||
}
|
||||
|
||||
QString OperatorManagementDialogModel::rolePreset(const dds::core::optional<int32_t> &rolePresetId) const
|
||||
{
|
||||
if (!rolePresetId.is_set())
|
||||
return tr("---");
|
||||
|
||||
int32_t id = rolePresetId.get();
|
||||
|
||||
if (id <= 0)
|
||||
return tr("---");
|
||||
|
||||
return m_roles.value(id, tr("Id: %1").arg(id));
|
||||
}
|
||||
|
||||
QString OperatorManagementDialogModel::hasVisibleParties(const std::vector<OperatorManagement::PartiesByExercise> &vpbe) const
|
||||
{
|
||||
int exerciseId = (m_exerciseId != -1) ? m_exerciseId
|
||||
: 0 /*new exercise*/;
|
||||
std::vector<int32_t> parties = {};
|
||||
|
||||
for (const auto &pbe : vpbe)
|
||||
{
|
||||
if (pbe.exerciseId() != exerciseId)
|
||||
continue;
|
||||
|
||||
std::vector<int32_t> hiddenParties = {};
|
||||
if (pbe.hiddenParties().is_set()) //has_value not support on windows yet so we need depricated is_set
|
||||
hiddenParties = pbe.hiddenParties().get();
|
||||
|
||||
if(!pbe.visibleParties().is_set()) //has_value not support on windows yet so we need depricated is_set
|
||||
return {};
|
||||
|
||||
for (const auto &partyId : pbe.visibleParties().get())
|
||||
{
|
||||
bool isHidden = false;
|
||||
for (const int &hiddenId : hiddenParties)
|
||||
{
|
||||
if (hiddenId != partyId)
|
||||
continue;
|
||||
isHidden = true;
|
||||
}
|
||||
|
||||
if(!isHidden)
|
||||
parties.push_back(partyId);
|
||||
}
|
||||
return visibleParties(parties);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
QString OperatorManagementDialogModel::visibleParties(const std::vector<int32_t> &parties) const
|
||||
{
|
||||
QStringList result;
|
||||
result.reserve(parties.size());
|
||||
for (const int partyId : parties)
|
||||
result.append(m_parties.value(partyId, tr("Id: %1").arg(partyId)));
|
||||
|
||||
return result.join(QStringLiteral(", "));
|
||||
}
|
||||
|
||||
|
||||
QString OperatorManagementDialogModel::exercises(const std::vector<int32_t> &exercises) const
|
||||
{
|
||||
QStringList result;
|
||||
result.reserve(exercises.size());
|
||||
for (const int exerciseId : exercises)
|
||||
result.append(m_exercises.value(exerciseId, tr("Id: %1").arg(exerciseId)));
|
||||
|
||||
return result.join(QStringLiteral(", "));
|
||||
}
|
||||
|
||||
QString OperatorManagementDialogModel::effectiveAcls(std::vector<int32_t> acls) const
|
||||
{
|
||||
std::sort(acls.begin(), acls.end());
|
||||
QStringList sl;
|
||||
sl.reserve(acls.size());
|
||||
for (const int32_t acl : acls)
|
||||
sl.append(QString::number(acl));
|
||||
return sl.join(QStringLiteral(", "));
|
||||
}
|
||||
|
||||
QString OperatorManagementDialogModel::priority(int16_t prio) const
|
||||
{
|
||||
// Todo: Names?
|
||||
return QString::number(prio);
|
||||
}
|
||||
|
||||
bool OperatorManagementDialogModel::isFiltered(const OperatorManagement::User &data, DataModification modType) const
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
|
||||
if (m_exerciseId == 0)
|
||||
return false; // no operator filtered out
|
||||
for (auto exId : data.exerciseIds())
|
||||
if (exId == m_exerciseId)
|
||||
return false; // operator not filtered out
|
||||
|
||||
return true; // operator filtered out
|
||||
}
|
||||
|
||||
} // namespace OperatorManagement
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for OperatorManagement - Operator Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <OperatorManagement/opm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
#include <OperatorManagement/logger.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <Plugins/OperatorManagement/Gui/Common/opmchangepasswordgui_export.h>
|
||||
|
||||
namespace OperatorManagement
|
||||
{
|
||||
// --------------------------------------------------------
|
||||
// OperatorManagementModel
|
||||
// --------------------------------------------------------
|
||||
class OPMCHANGEPASSWORDGUI_EXPORT OperatorManagementDialogModel final : public LtsWidgets::LtsAbstractTableModel<OperatorManagement::User>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id,
|
||||
Name,
|
||||
Description,
|
||||
EffectiveAcls,
|
||||
VisibleParties,
|
||||
PrimaryGroupId,
|
||||
ProjectionPriority,
|
||||
AudioChannelPriority,
|
||||
Image,
|
||||
Workstation,
|
||||
Exercises,
|
||||
RolePreset
|
||||
};
|
||||
|
||||
explicit OperatorManagementDialogModel(QObject *parent = nullptr, int exerciseId = 0);
|
||||
~OperatorManagementDialogModel();
|
||||
|
||||
bool initModel(LtsSession::LtsSession *session, const std::shared_ptr<OperatorManagement::Interface::Dtc> &dtc);
|
||||
|
||||
QVariant data(const QModelIndex &, int) const override final;
|
||||
|
||||
bool isFiltered( const OperatorManagement::User &data, DataModification modType ) const override;
|
||||
|
||||
private:
|
||||
QString hasVisibleParties(const std::vector<PartiesByExercise> &vpbe) const;
|
||||
QString visibleParties(const std::vector<int32_t> &parties) const;
|
||||
QString effectiveAcls(std::vector<int32_t> acls) const;
|
||||
QString priority(int16_t prio) const;
|
||||
QString exercises(const std::vector<int32_t> &exercises) const;
|
||||
QString rolePreset(const dds::core::optional<int32_t> &rolePresetId) const;
|
||||
QString workstation(int wsId, int wsIp) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onPartyChanged(const ParticipantManagement::Party &data, DataModification modType);
|
||||
void onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType);
|
||||
|
||||
private:
|
||||
std::shared_ptr<OperatorManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
QMap<int,QString> m_parties;
|
||||
QMap<int,QString> m_exercises;
|
||||
QMap<int,QString> m_roles;
|
||||
LOGGER_T m_logger;
|
||||
int m_exerciseId;
|
||||
};
|
||||
|
||||
} // namespace OperatorManagement
|
||||
Reference in new issue
Block a user