Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,57 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Patric Karwat, SLSE, 2016-10-05
|
||||
#
|
||||
|
||||
SET(ppm_operational_planing_gui_SRCS
|
||||
ppm_party_edit_gui_plugin.cpp
|
||||
ppm_party_edit_gui_plugin.h
|
||||
ppm_party_view.cpp
|
||||
ppm_party_view.h
|
||||
ppm_party_model.cpp
|
||||
ppm_party_model.h
|
||||
participant_show.cpp
|
||||
participant_show.h
|
||||
ppm_planning_model.cpp
|
||||
ppm_planning_model.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(ppm_operational_planing_gui_SRCS
|
||||
ppm_party_view.ui
|
||||
participant_show.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS PpmOperationalPlaningGuiPlugin MODULE ${ppm_operational_planing_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(PpmOperationalPlaningGuiPlugin
|
||||
AsbDataPluginInterface
|
||||
NGLLogger
|
||||
LtsPrinting
|
||||
LtsSession
|
||||
PpmGuiPartyPluginInterface
|
||||
PpmDataPluginInterface
|
||||
PpmGuiComboboxPluginInterface
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsDataView
|
||||
LtsUtilsGuiDds
|
||||
|
||||
|
||||
AsbDataPluginInterface
|
||||
AsbHelper
|
||||
nglwidgets
|
||||
NGLLogger
|
||||
LtsPrinting
|
||||
PpmCommon
|
||||
PpmGuiParticipantsPluginInterface
|
||||
PpmGuiComboboxPluginInterface
|
||||
PpmGuiTemplatesPluginInterface
|
||||
PpmDataPluginInterface
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsSession
|
||||
LtsUtilsGuiDds
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(PpmOperationalPlaningGuiPlugin)
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for ParticipantManagement - Participant Edit
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-17
|
||||
*/
|
||||
|
||||
#include "participant_show.h"
|
||||
#include "ui_participant_show.h"
|
||||
#include <../Common/participant_edit_model.h>
|
||||
#include <../Common/participant_edit_item.h>
|
||||
#include <../Common/participant_tree_edit_handler.h>
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
ParticipantShow::ParticipantShow(LtsSession::LtsSession *session,
|
||||
bool asSupportService,
|
||||
QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_asSupportService(asSupportService)
|
||||
, m_pTreehandler(nullptr)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_session(session)
|
||||
, m_model(nullptr)
|
||||
, m_ui(new Ui::ParticipantShow)
|
||||
, m_logger(getLogger("ParticipantShow"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &ParticipantShow::onPrint);
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Operational_Planing"));
|
||||
}
|
||||
|
||||
|
||||
ParticipantShow::~ParticipantShow()
|
||||
{
|
||||
delete m_pTreehandler;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void ParticipantShow::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Operational Planning - Party: %1").arg(m_nameParty));
|
||||
}
|
||||
|
||||
|
||||
bool ParticipantShow::init(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc,
|
||||
const int partyId,
|
||||
const QString &nameParty)
|
||||
{
|
||||
if (!dtc || !ftc)
|
||||
return false;
|
||||
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
m_partyId = partyId;
|
||||
m_nameParty = nameParty;
|
||||
|
||||
m_model = new ParticipantPlanningModel(this, m_dtc, asbIfc);
|
||||
connect(m_model, &ParticipantPlanningModel::internalDataChanged, this, &ParticipantShow::slotChangesMade);
|
||||
|
||||
m_ui->treeViewEdit->setModel(m_model);
|
||||
m_ui->treeViewEdit->expandAll();
|
||||
m_ui->treeViewEdit->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_ui->treeViewEdit->moveSection(8, 1);
|
||||
|
||||
m_pTreehandler = new ParticipantTreeEditHandler(m_ui->treeViewEdit, m_dtc, m_ftc, m_asSupportService);
|
||||
|
||||
onPartyChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ParticipantShow::onPartyChanged()
|
||||
{
|
||||
|
||||
if (hasUnsavedChanges())
|
||||
{
|
||||
switch (askApplyDiscardCancel())
|
||||
{
|
||||
case LtsWidgets::Button::Cancel:
|
||||
{
|
||||
return;
|
||||
}
|
||||
case LtsWidgets::Button::Discard:
|
||||
__unchange__(); // can't call resetChanges() by myself :(
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_pTreehandler->partyHasChanged(m_partyId);
|
||||
}
|
||||
|
||||
void ParticipantShow::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->treeViewEdit->treeView() );
|
||||
}
|
||||
|
||||
} //namespace ParticipantManagement
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for ParticipantManagement - Participant Edit
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-17
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
#include <Services/ParticipantManagement/ppm_ftc.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include "ppm_planning_model.h"
|
||||
|
||||
|
||||
namespace AdvancedSymbology
|
||||
{
|
||||
class ForeignDataInterface;
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ParticipantShow;
|
||||
}
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class ParticipantPlanningModel;
|
||||
class ParticipantTreeEditHandler;
|
||||
|
||||
class ParticipantShow : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ParticipantShow(LtsSession::LtsSession *session,
|
||||
bool asSupportService,
|
||||
QWidget *parent = nullptr);
|
||||
virtual ~ParticipantShow();
|
||||
bool init(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc,
|
||||
const int partyId,
|
||||
const QString &nameParty);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
|
||||
protected slots:
|
||||
void onPartyChanged();
|
||||
void onPrint();
|
||||
|
||||
private:
|
||||
bool m_asSupportService;
|
||||
|
||||
ParticipantTreeEditHandler* m_pTreehandler;
|
||||
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ftc;
|
||||
int m_partyId;
|
||||
QString m_nameParty;
|
||||
LtsSession::LtsSession *m_session;
|
||||
|
||||
ParticipantPlanningModel *m_model;
|
||||
Ui::ParticipantShow *m_ui;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} //ParticipantManagement
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ParticipantShow</class>
|
||||
<widget class="QWidget" name="ParticipantShow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>423</width>
|
||||
<height>438</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">setwindowtitle in source</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="LtsDataView::LtsDataView" name="treeViewEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for ParticipantManagement - Party
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-11-11
|
||||
*/
|
||||
|
||||
#include "ppm_party_edit_gui_plugin.h"
|
||||
#include "ppm_party_view.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <Plugins/AdvancedSymbology/asb_data_plugin_interface.h>
|
||||
#include <Services/ParticipantManagement/ppm_operator_rights.h>
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Ppm.OperationalPlanning"))
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_ppmGuiCbxIfc(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!m_session->getFtc<ParticipantManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
if (!m_session->getForeignGuiInterface<ParticipantManagement::ForeignGuiComboboxInterface>(m_ppmGuiCbxIfc))
|
||||
return false;
|
||||
m_session->getForeignDataInterface<AdvancedSymbology::DataInterface>(m_asb);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_dtc = nullptr;
|
||||
m_ftc = nullptr;
|
||||
m_ppmGuiCbxIfc = nullptr;
|
||||
m_asb = nullptr;
|
||||
}
|
||||
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
return tr("Participants");
|
||||
}
|
||||
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
if (m_session->isExercisePartition())
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = tr("Exercise Documents");
|
||||
plData.menuText = tr("Operational Planning");
|
||||
plData.identifier = QLatin1String("ppmOperationalPlanningView");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:operational_planning.svg"));
|
||||
plData.operatorRight = OperatorRights::OperationalPlanning::OperationalPlanningView; // Todo
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
||||
plData.createWidgetFunc = [this](QWidget *parent)
|
||||
{
|
||||
return onShowParties(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowParties(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new PartyView(menuGroup(), m_session, parent),
|
||||
m_dtc, m_ftc, m_ppmGuiCbxIfc, m_asb);
|
||||
}
|
||||
|
||||
} // namespace ParticipantManagement
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for ParticipantManagement - Party
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-11-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_party_gui_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
|
||||
namespace AdvancedSymbology
|
||||
{
|
||||
class ForeignDataInterface;
|
||||
}
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:ppm.operationalplaning")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("ParticipantManagement.GuiPlugin.OperationalPlanning"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return (partition == IDL::PartitionType::Global ||
|
||||
partition == IDL::PartitionType::Exercise);
|
||||
}
|
||||
};
|
||||
|
||||
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
QString menuGroup() const override;
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Global || partition == IDL::PartitionType::Exercise; }
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowParties(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onShowAddParty(QWidget *parent);
|
||||
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
|
||||
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asb;
|
||||
};
|
||||
|
||||
|
||||
} // namespace ParticipantManagement
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for ParticipantManagement - Party Overview Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-11-11
|
||||
*/
|
||||
|
||||
#include "ppm_party_model.h"
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
//---------------------------------
|
||||
// PartyModel
|
||||
//---------------------------------
|
||||
PartyModel::PartyModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<PartyData>({tr("Id"),
|
||||
tr("Name")}, parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_logger(getLogger("PartyModel"))
|
||||
{}
|
||||
|
||||
bool PartyModel::initModel(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc)
|
||||
{
|
||||
if (!dtc)
|
||||
return false;
|
||||
m_dtc = dtc;
|
||||
|
||||
|
||||
// Insert Operator
|
||||
|
||||
PartyData partyData;
|
||||
partyData.id = -1;
|
||||
partyData.name = tr("Operator");
|
||||
insertRow(partyData);
|
||||
|
||||
// Insert Parties
|
||||
auto cb = [this](const ParticipantManagement::Party &p)
|
||||
{
|
||||
insertRow(PartyData(p));
|
||||
};
|
||||
m_dtc->partys(cb);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant PartyModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const PartyData &party = m_vecData.at(index.row());
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return party.id;
|
||||
case Name:
|
||||
return party.name;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
} // namespace ParticipantManagement
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for ParticipantManagement - Party Overview Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-11-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
struct PartyData
|
||||
{
|
||||
int id = 0;
|
||||
QString name;
|
||||
PartyData() = default;
|
||||
explicit PartyData(const ParticipantManagement::Party &p)
|
||||
: id(p.id())
|
||||
, name(ParticipantManagement::trPartyName(p.name()))
|
||||
{}
|
||||
};
|
||||
// --------------------------------------------------------
|
||||
// PartyModel
|
||||
// --------------------------------------------------------
|
||||
class PartyModel final : public LtsWidgets::LtsAbstractTableModel<PartyData>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id,
|
||||
Name
|
||||
};
|
||||
|
||||
explicit PartyModel(QObject *parent = nullptr);
|
||||
|
||||
bool initModel(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc);
|
||||
|
||||
QVariant data(const QModelIndex &, int) const override;
|
||||
|
||||
protected:
|
||||
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
} //namespace ParticipantManagement
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for ParticipantManagement - Party View
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-11-11
|
||||
*/
|
||||
|
||||
#include "ppm_party_view.h"
|
||||
#include "ui_ppm_party_view.h"
|
||||
#include "participant_show.h"
|
||||
|
||||
#include <LtsSession/lts_session_manager.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
|
||||
PartyView::PartyView(const QString &menuGroup, LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_model(nullptr)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::PartyView)
|
||||
, m_logger(getLogger("PartyView"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &PartyView::onSelectionChanged);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked,
|
||||
this, &PartyView::onShowParty);
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &PartyView::onShowParty);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &PartyView::onPrint);
|
||||
|
||||
m_buttonBox->setButtonVisible(LtsWidgets::DialogButton::Load, false);
|
||||
m_buttonBox->setButtonVisible(LtsWidgets::DialogButton::Print, false);
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Add, false);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, false);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Operational_Planing"));
|
||||
}
|
||||
|
||||
PartyView::~PartyView()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void PartyView::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Operational Planing"));
|
||||
}
|
||||
|
||||
bool PartyView::init(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<ForeignGuiComboboxInterface> &ppmGuiCbxIfc, const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc)
|
||||
{
|
||||
if (!dtc || !ftc || !ppmGuiCbxIfc)
|
||||
return false;
|
||||
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
m_ppmGuiCbxIfc = ppmGuiCbxIfc;
|
||||
m_asbIfc = asbIfc;
|
||||
m_model = new PartyModel(this);
|
||||
m_model->initModel(m_dtc);
|
||||
m_ui->widget->setModel(m_model);
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->widget->hideColumn(PartyModel::Id);
|
||||
#endif
|
||||
m_ui->widget->setSortingEnabled(false);
|
||||
m_ui->widget->setSortIndicator(-1, Qt::AscendingOrder);
|
||||
|
||||
m_buttonBox->setButtonVisible(LtsWidgets::DialogButton::Show, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void PartyView::onSelectionChanged()
|
||||
{
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
|
||||
int row = idx.row();
|
||||
|
||||
if (m_ui->widget->selectedRows().size() == 0
|
||||
|| row < 0)
|
||||
{
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, false);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
|
||||
|
||||
return;
|
||||
}
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, true);
|
||||
}
|
||||
|
||||
void PartyView::onShowParty()
|
||||
{
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
|
||||
int row = idx.row();
|
||||
if (row < 0)
|
||||
return;
|
||||
|
||||
PartyData party = m_model->getRowData(row);
|
||||
if (party.id < 0)
|
||||
{
|
||||
// Show Operator-List
|
||||
std::shared_ptr<OperatorManagement::OverviewForeignGuiInterface> opmOverviewIfc;
|
||||
if (m_session->getForeignGuiInterface(opmOverviewIfc))
|
||||
{
|
||||
opmOverviewIfc->showOperators(tr("Operational Planning - Operators"));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
bool asSupportService = false;
|
||||
ParticipantShow *diag = new ParticipantShow(m_session, asSupportService, this);
|
||||
if (diag->init(m_dtc, m_ftc, m_asbIfc, party.id , party.name))
|
||||
addDialog(diag, m_menuGroup, QStringLiteral("Participants") + QString::number(party.id), LtsWidgets::LayoutArea::eDialogTab);
|
||||
else
|
||||
delete diag;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PartyView::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView() );
|
||||
}
|
||||
|
||||
void PartyView::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace ParticipantManagement
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for ParticipantManagement - Party View
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-11-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ppm_party_model.h"
|
||||
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
#include <Services/ParticipantManagement/ppm_ftc.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <Plugins/OperatorManagement/opm_overview_gui_plugin_interface.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
|
||||
namespace AdvancedSymbology
|
||||
{
|
||||
class ForeignDataInterface;
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PartyView;
|
||||
}
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
|
||||
class PartyView : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PartyView(const QString &menuGroup, LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~PartyView();
|
||||
|
||||
bool init(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc,
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
|
||||
void onSelectionChanged();
|
||||
void onShowParty();
|
||||
void onPrint();
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
private:
|
||||
QString m_menuGroup;
|
||||
PartyModel *m_model;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
|
||||
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asbIfc;
|
||||
|
||||
LtsSession::LtsSession *m_session;
|
||||
Ui::PartyView *m_ui;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace ParticipantManagement
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PartyView</class>
|
||||
<widget class="QWidget" name="PartyView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>455</width>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="LtsDataView::LtsDataView" name="widget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Model for ParticipantsMoveDialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Gerlinde Rudolphus, SLSE, 2018-01-02
|
||||
*/
|
||||
|
||||
#include "ppm_planning_model.h"
|
||||
|
||||
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
//----------------------------------------------------------------------------
|
||||
ParticipantPlanningModel::ParticipantPlanningModel(QObject *parent,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc)
|
||||
: ParticipantManagement::ParticipantEditModel(parent, ppmDtc, asbIfc)
|
||||
, m_logger(getLogger("ParticipantPlanningModel"))
|
||||
{
|
||||
m_titles += tr("Hierarchy");
|
||||
|
||||
DEBUG_LOG(m_logger) << "ParticipantPlanningModel::ParticipantPlanningModel";
|
||||
}
|
||||
|
||||
QVariant ParticipantPlanningModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
const CheckedTreeItem *item = privateData(index);
|
||||
const ParticipantManagement::ParticipantData &participantData = item->participant;
|
||||
|
||||
if (role == Qt::DisplayRole && index.column() == columnCount() - 1)
|
||||
return m_dtc->hierarchyFromParticipant(participantData.id());
|
||||
|
||||
return ParticipantManagement::ParticipantEditModel::data(index, role);
|
||||
}
|
||||
|
||||
} // namespace ParticipantManagement
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Model for ParticipantsMoveDialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Gerlinde Rudolphus, SLSE, 2018-01-02
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <nglwidgets/ngltreeitem.h>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
#include <QStringList>
|
||||
|
||||
//ParticipantManagement
|
||||
#include <Plugins/ParticipantManagement/Gui/Common/participant_edit_model.h>
|
||||
#include <ParticipantManagement/logger.h>
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class ParticipantPlanningModel final : public ParticipantManagement::ParticipantEditModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ParticipantPlanningModel(QObject *parent,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
signals:
|
||||
void newData();
|
||||
|
||||
private:
|
||||
//void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType);
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace ParticipantManagement
|
||||
Reference in new issue
Block a user