/** * @RDE_HEADER@ * $Id$ * $HeadURL$ * $Author$ * Created by Philipp Last, SLSE, 2017-10-26 */ #include "ppm_msdl_gui_plugin.h" #include "ppm_msdl_edit.h" #include #include #include namespace ParticipantManagement { std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) { return std::make_shared(session); } InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) : GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Ppm.msdl")) , m_pSession(session) , m_dtc(nullptr) , m_ftc(nullptr) , m_ppmGuiCbxIfc(nullptr) {} bool InterfaceImpl::fetchInterfaces() { if (!m_session->getDtc(m_dtc)) return false; if (!m_session->getFtc(m_ftc)) return false; if (!m_session->getForeignGuiInterface(m_ppmGuiCbxIfc)) return false; return true; } void InterfaceImpl::clearInterfaces() { m_dtc = nullptr; m_ftc = nullptr; m_ppmGuiCbxIfc = nullptr; } QString InterfaceImpl::menuGroup() const { return tr("Participants"); } QVector InterfaceImpl::getActions() { QVector ret; /* * Importing exercise data is only possible if * the operator is actually operating within an exercise */ LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance(); const bool enableMSDL_ImExport = ps->value(QStringLiteral("ppm"), QStringLiteral("enableMSDL_ImExport")).toBool(); if ( (m_pSession->exerciseId() != 0) && enableMSDL_ImExport) { LtsWidgets::PluginData plData; plData.menuGroup = menuGroup(); plData.menuText = tr("MSDL Import/Export"); plData.identifier = QLatin1String("ppmmsdlview"); plData.menuIcon = QIcon(QLatin1String("icon:import_msdl.svg")); plData.operatorRight = OperatorRights::Msdl::MsdlImportExport; // OperatorRights::PartyEdit::PartiesShow plData.exercisePart = LtsWidgets::ExercisePart::ePlanning; plData.createWidgetFunc = [this](QWidget * parent) { return onShowMSDLEdit(parent); }; ret.append(plData); } return ret; } LtsWidgets::LtsDialog *InterfaceImpl::onShowMSDLEdit(QWidget *parent) { return LtsWidgets::initDialog(new ParticipantManagement::MSDLEdit(m_session, parent), m_dtc, m_ftc, m_ppmGuiCbxIfc); } } // namespace ParticipantManagement