/** * @RDE_HEADER@ * $Id$ * $HeadURL$ * $Author$ */ #include "pws_gui_plugin.h" #include "pws_control_dialog.h" #include "pws_operator_settings_loader.h" #include #include #include #include namespace ProjectionWorkstation { std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) { return std::make_shared(session); } InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) : GuiPluginBase::Interface(session, LtsProjectionWorkstation::getLogger("Plugins.Gui.PWS")) , m_isProjectionWorkstation(LtsProjectionWorkstation::LtsProjectionWorkstation::hasInstance()) {} QVector InterfaceImpl::getActions() { QVector 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(m_opmDtc)) return false; if (!m_session->getForeignGuiInterface(m_opmIfc)) return false; if (!m_session->getDtc(m_asmDtc)) return false; } return true; } void InterfaceImpl::clearInterfaces() { m_opmDtc = nullptr; m_opmIfc = nullptr; m_asmDtc = nullptr; } } // namespace ProjectionWorkstation