Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+161
@@ -0,0 +1,161 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for PresentationManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-15
|
||||
*/
|
||||
|
||||
#include "pre_edit_gui_plugin.h"
|
||||
#include "pre_dialog.h"
|
||||
#include "pre_mobile_dialog.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <Services/PresentationManagement/pre_operator_rights.h>
|
||||
#include <Plugins/OperatorManagement/opm_data_plugin_interface.h>
|
||||
|
||||
|
||||
namespace PresentationManagement
|
||||
{
|
||||
|
||||
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.Pre.Edit"))
|
||||
{}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
QString menuGroupString(menuGroup());
|
||||
|
||||
if (m_session->app() == LtsAppDescriptor::App::Scripts)
|
||||
{
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroupString;
|
||||
plData.menuText = tr("Edit Scripts");
|
||||
plData.identifier = QLatin1String("preEditScripts");
|
||||
plData.menuIcon = QIcon(QStringLiteral("icon:document-edit.svg"));
|
||||
plData.operatorRight = OperatorRights::PresentationScriptsEdit;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eAfterAction;
|
||||
plData.createWidgetFunc = [this](QWidget *parent)
|
||||
{
|
||||
return onEditPresentationDialog(parent);
|
||||
};
|
||||
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroupString;
|
||||
plData.menuText = tr("Admin Scripts");
|
||||
plData.identifier = QLatin1String("preAdminScripts");
|
||||
plData.menuIcon = QIcon(QStringLiteral("icon:document-open.svg"));
|
||||
plData.operatorRight = OperatorRights::PresentationScriptsAdmin;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eAfterAction;
|
||||
plData.createWidgetFunc = [this](QWidget *parent)
|
||||
{
|
||||
return onAdminPresentationDialog(parent);
|
||||
};
|
||||
|
||||
ret.append(plData);
|
||||
}
|
||||
}
|
||||
else if (m_session->app() == LtsAppDescriptor::App::Situation)
|
||||
{
|
||||
if (m_asmDtc->isAARWorkstation(LtsSession::LtsSession::workstationName()))
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroupString;
|
||||
plData.menuText = tr("Download Scripts for Mobile AAR");
|
||||
plData.identifier = QLatin1String("preMobileScripts");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:import_documents.svg"));
|
||||
plData.operatorRight = OperatorRights::PresentationScriptsShow;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eAfterAction;
|
||||
plData.createWidgetFunc = [this](QWidget *parent)
|
||||
{
|
||||
return onPresentationMobileDialog(parent);
|
||||
};
|
||||
|
||||
ret.append(plData);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
if (!m_session->getDtc<PresentationManagement::DataInterface>(m_dtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getDtc for PresentationManagement::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_session->getFtc<PresentationManagement::DataInterface>(m_ftc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getFtc for PresentationManagement::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_session->getDtc<OperatorManagement::DataInterface>(m_opmDtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getDtc for OperatorManagement::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_session->getDtc<AssetManagement::DataInterface>(m_asmDtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getDtc for AssetManagement::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_session->getForeignDataInterface_NEW(m_avmDataIfc))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "getForeignDataInterface for AVM::DataInterface failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_opmDtc = nullptr;
|
||||
m_ftc = nullptr;
|
||||
m_dtc = nullptr;
|
||||
m_avmDataIfc = nullptr;
|
||||
}
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
return tr("Presentation");
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowPresentationDialog(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new PresentationManagementDialog(parent),
|
||||
PresentationManagement::ScriptsDialogMode::modeView, m_dtc, m_ftc, m_opmDtc, m_session);
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onEditPresentationDialog(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new PresentationManagementDialog(parent),
|
||||
PresentationManagement::ScriptsDialogMode::modeEdit, m_dtc, m_ftc, m_opmDtc, m_session);
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onAdminPresentationDialog(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new PresentationManagementDialog(parent),
|
||||
PresentationManagement::ScriptsDialogMode::modeAdmin, m_dtc, m_ftc, m_opmDtc, m_session);
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onPresentationMobileDialog(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new PreMobileDialog(parent), m_dtc, m_ftc, m_opmDtc, m_avmDataIfc, m_session);
|
||||
}
|
||||
|
||||
} // namespace PresentationManagement
|
||||
Reference in new issue
Block a user