Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+118
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for ParticipantManagement - ParticipantTemplate
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "participant_templates_gui_plugin.h"
|
||||
#include "participant_template_chooser.h"
|
||||
#include "participant_template_chooser_model.h"
|
||||
#include "participant_template_edit.h"
|
||||
|
||||
#include <LtsWidgets/lts_base_layout_widget.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#include <QGridLayout>
|
||||
|
||||
#include <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.ParticipantTemplates"))
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_ppmGuiCbxIfc(nullptr)
|
||||
, m_ppmGuiOrgChartIfc(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
//no dialoges in exercise
|
||||
if(m_session->partitionType() == IDL::PartitionType::Exercise)
|
||||
return ret;
|
||||
|
||||
LtsWidgets::PluginData pd;
|
||||
pd.menuGroup = menuGroup();
|
||||
pd.layoutArea = LtsWidgets::LayoutArea::eDialogTab;
|
||||
|
||||
pd.menuText = tr("Participant Templates");
|
||||
pd.identifier = QStringLiteral("viewTemplates");
|
||||
pd.menuIcon = QIcon(QLatin1String("icon:define_force_templates.svg"));
|
||||
pd.createWidgetFunc = [this](QWidget *parent) { return onShowTemplateChooser(parent, false); };
|
||||
pd.operatorRight = OperatorRights::ParticipantTemplates::ParticipantTemplatesShow;
|
||||
pd.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
||||
ret.append(pd);
|
||||
|
||||
pd.menuText = tr("Support Templates");
|
||||
pd.identifier = QStringLiteral("viewSupTemplates");
|
||||
pd.menuIcon = QIcon(QLatin1String("icon:define_force_templates.svg"));
|
||||
pd.createWidgetFunc = [this](QWidget *parent) { return onShowTemplateChooser(parent, true); };
|
||||
pd.operatorRight = OperatorRights::ParticipantTemplates::SupportParticipantTemplatesShow;
|
||||
pd.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
||||
ret.append(pd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
return tr("Participants");
|
||||
}
|
||||
|
||||
bool InterfaceImpl::getTemplateModel(QTreeView *treeView, bool asSupportService)
|
||||
{
|
||||
ParticipantTemplateChooserModel *model = new ParticipantTemplateChooserModel(asSupportService, treeView);
|
||||
if (model->initModel(m_session, m_dtc))
|
||||
{
|
||||
treeView->setModel(model);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
//optional
|
||||
m_session->getForeignGuiInterface<ParticipantManagement::ForeignGuiOrgChartInterface>(m_ppmGuiOrgChartIfc);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_dtc = nullptr;
|
||||
m_ftc = nullptr;
|
||||
m_ppmGuiCbxIfc = nullptr;
|
||||
m_ppmGuiOrgChartIfc = nullptr;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowTemplateChooser(QWidget *parent, bool asSupportService)
|
||||
{
|
||||
return LtsWidgets::initDialog(new ParticipantTemplateChooser(menuGroup(), asSupportService, m_session, parent),
|
||||
m_dtc, m_ftc, m_ppmGuiCbxIfc, m_ppmGuiOrgChartIfc);
|
||||
}
|
||||
|
||||
} // namespace ParticipantManagement
|
||||
Reference in new issue
Block a user