Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+93
View File
@@ -0,0 +1,93 @@
/**
* @RDE_HEADER@
* $Id$
* $HeadURL$
* $Author$
*/
#include "pws_gui_plugin.h"
#include "pws_control_dialog.h"
#include "pws_operator_settings_loader.h"
#include <LtsSession/lts_session.h>
#include <LtsUtilsSettings/settings.h>
#include <LtsProjectionWorkstation/lts_projection_workstation.h>
#include <Services/ProjectionWorkstation/pws_operator_rights.h>
namespace ProjectionWorkstation
{
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
{
return std::make_shared<InterfaceImpl>(session);
}
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
: GuiPluginBase::Interface(session, LtsProjectionWorkstation::getLogger("Plugins.Gui.PWS"))
, m_isProjectionWorkstation(LtsProjectionWorkstation::LtsProjectionWorkstation::hasInstance())
{}
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
QVector<LtsWidgets::PluginData> ret;
if (m_session->isReplayPartition())
return ret;
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
const bool enableProjection = ps->value(QStringLiteral("pws"),
QStringLiteral("enableProjection")).toBool();
if (!m_isProjectionWorkstation && enableProjection)
{
LtsWidgets::PluginData plData;
plData.menuGroup = menuGroup();
plData.menuText = tr("Projection Control");
plData.identifier = QLatin1String("pwsControl");
plData.menuIcon = QIcon(QLatin1String("icon:projection.svg"));
plData.operatorRight = OperatorRights::ProjectionStart;
plData.exercisePart = LtsWidgets::ExercisePart::eSpecial;
plData.createWidgetFunc = [this](QWidget * parent)
{
return LtsWidgets::initDialog(new ControlDialog(menuGroup(), parent),
m_session, m_opmDtc, m_opmIfc, m_asmDtc, m_session->exerciseId());
};
ret.append(plData);
}
return ret;
}
bool InterfaceImpl::fetchInterfaces()
{
if (m_isProjectionWorkstation)
{
LtsProjectionWorkstation::LoginInformation request = LtsProjectionWorkstation::LtsProjectionWorkstation::getInstance()->lastLoginRequest();
OperatorSettingsLoader loader(request.m_userId);
if (!loader.init(m_session))
return false;
loader.execute();
}
else
{
if (!m_session->getDtc<OperatorManagement::DataInterface>(m_opmDtc))
return false;
if (!m_session->getForeignGuiInterface<OperatorManagement::ForeignSettingsGuiInterface>(m_opmIfc))
return false;
if (!m_session->getDtc<AssetManagement::DataInterface>(m_asmDtc))
return false;
}
return true;
}
void InterfaceImpl::clearInterfaces()
{
m_opmDtc = nullptr;
m_opmIfc = nullptr;
m_asmDtc = nullptr;
}
} // namespace ProjectionWorkstation