88 lines
2.1 KiB
C++
Executable File
88 lines
2.1 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* GUI Plugin for ExerciseManangement
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Mike Wille, SLSE, 2016-03-30
|
|
*/
|
|
|
|
#include "scm_edit_gui_plugin.h"
|
|
#include "scm_dialog.h"
|
|
|
|
#include <LtsSession/lts_session.h>
|
|
#include <Services/ServiceManagement/scm_operator_rights.h>
|
|
#include <Plugins/ExerciseManagement/exm_data_plugin_interface.h>
|
|
|
|
namespace ServiceManagement
|
|
{
|
|
|
|
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.Scm.Edit"))
|
|
, m_dtcExm(nullptr)
|
|
, m_dtc(nullptr)
|
|
, m_ftc(nullptr)
|
|
{}
|
|
|
|
|
|
bool InterfaceImpl::fetchInterfaces()
|
|
{
|
|
if (!m_session->getDtc<DataInterface>(m_dtc))
|
|
return false;
|
|
if (!m_session->getFtc<DataInterface>(m_ftc))
|
|
return false;
|
|
if (!m_session->getDtc<ExerciseManagement::DataInterface>(m_dtcExm))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void InterfaceImpl::clearInterfaces()
|
|
{
|
|
m_ftc = nullptr;
|
|
m_dtc = nullptr;
|
|
}
|
|
|
|
|
|
QString InterfaceImpl::menuGroup() const
|
|
{
|
|
return tr("Services");
|
|
}
|
|
|
|
|
|
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
|
{
|
|
QVector<LtsWidgets::PluginData> ret;
|
|
|
|
LtsWidgets::PluginData plData;
|
|
plData.menuGroup = menuGroup();
|
|
plData.menuText = tr("Service Management");
|
|
plData.menuIcon = QIcon(QLatin1String("icon:service.svg"));
|
|
plData.identifier = QLatin1String("scmServiceEdit");
|
|
plData.operatorRight = OperatorRights::ServicesEdit;
|
|
plData.exercisePart = LtsWidgets::ExercisePart::eSpecial;
|
|
plData.createWidgetFunc = [this](QWidget * parent)
|
|
{
|
|
m_dtc->enableGroupInformation();
|
|
m_dtc->enableServiceInformation();
|
|
|
|
m_ftc->enableRestartService();
|
|
|
|
m_ftc->enableStopGroup();
|
|
m_ftc->enableStartGroup();
|
|
m_ftc->enableRestartGroup();
|
|
|
|
return LtsWidgets::initDialog(new ServiceManagementDialog(parent),
|
|
m_dtc, m_ftc, m_dtcExm);
|
|
};
|
|
ret.append(plData);
|
|
|
|
return ret;
|
|
}
|
|
|
|
} // namespace ServiceManagement
|