/** * @RDE_HEADER@ * GUI Plugin for ExerciseManangement * $Id$ * $HeadURL$ * $Author$ * * Created by Mike Wille, SLSE, 2017-02-10 */ #include "EventFilter/FilterWindow.h" #include "tln_view_gui_plugin.h" #include "tln_dialog.h" #include "logger.h" #include // for abort #include #include #include #include namespace Timeline { std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) { return std::make_shared(session); } InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) : GuiPluginBase::Interface(session, getLogger("View")) {} bool InterfaceImpl::fetchInterfaces() { if (!m_session->getForeignDataInterface(m_eemForeign)) return false; if (!m_session->getDtc(m_mrkDtc)) return false; if (!m_session->getDtc(m_exmDtc)) return false; if (!m_session->getDtc(m_ppmDtc)) return false; if (!m_session->getForeignGuiInterface(m_flmIfc)) return false; if (!m_session->getForeignGuiInterface(m_ppmInfoIfc)) return false; if (!m_session->getDtc(m_pdmDtc)) return false; // if (!m_session->getDtc(m_ismDtc)) // return false; if (!m_session->getForeignDataInterface_NEW(m_avmDataIfc)) WARNING_LOG(m_logger) << "no avm data ifc, no stream name mapping"; if (!m_session->getForeignDataInterface(m_srmDataIfc)) // to start the replay situation app WARNING_LOG(m_logger) << "no srm data ifc, no situation replay app"; if (!m_session->getDtc(m_coreDtc)) WARNING_LOG(m_logger) << "no core dtc, no situation replay app"; if (!m_session->getForeignGuiInterface(m_avmIfc)) WARNING_LOG(m_logger) << "Timeline Gui Plugin: no avm ifc"; if (!m_session->getForeignGuiInterface(m_mrkIfc)) WARNING_LOG(m_logger) << "Timeline Gui Plugin: no mrk ifc"; if (!m_session->getForeignGuiInterface(m_fltParticipantIfc)) WARNING_LOG(m_logger) << "Timeline Gui Plugin: no flt Part ifc"; if (!m_session->getForeignGuiInterface(m_fltAesIfc)) WARNING_LOG(m_logger) << "Timeline Gui Plugin: no flt Aes ifc"; if (!m_session->getForeignGuiInterface(m_fltBuildingComponentIfc)) WARNING_LOG(m_logger) << "Timeline Gui Plugin: no flt BuildingComponent ifc"; return true; } void InterfaceImpl::clearInterfaces() { m_eemForeign = nullptr; m_mrkDtc = nullptr; m_exmDtc = nullptr; m_ppmDtc = nullptr; m_flmIfc = nullptr; m_ppmInfoIfc = nullptr; m_srmDataIfc = nullptr; m_coreDtc = nullptr; m_avmIfc = nullptr; m_mrkIfc = nullptr; m_avmDataIfc = nullptr; m_pdmDtc = nullptr; //m_ismDtc = nullptr; m_fltParticipantIfc = nullptr; m_fltAesIfc = nullptr; m_fltBuildingComponentIfc = nullptr; } QVector InterfaceImpl::getActions() { QVector ret; { LtsWidgets::PluginData plData; plData.menuGroup = menuGroup(); plData.menuText = tr("Timeline"); plData.identifier = QLatin1String("tlnView"); plData.exercisePart = LtsWidgets::ExercisePart::eExecution; plData.menuIcon = QIcon(QLatin1String("icon:timeline.svg")); if (getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::MAIN)) { plData.layoutArea = LtsWidgets::LayoutArea::eMainTab; plData.createInstant = LtsWidgets::CreateInstantType::CreateInstantAndDiscardAction; plData.createWidgetFunc = [this](QWidget *) { return onShowTimelineViewDialog(true); }; } else { plData.layoutArea = LtsWidgets::LayoutArea::eDialogTab; plData.createWidgetFunc = [this](QWidget *) { return onShowTimelineViewDialog(false); }; } ret.append(plData); } return ret; } QString InterfaceImpl::menuGroup() const { return tr("Timeline"); // TODO: oder Events? } LtsWidgets::LtsDialog *InterfaceImpl::onShowTimelineViewDialog(bool isMain) { std::shared_ptr ismDtc; if (!m_session->getDtc(ismDtc)) { new LtsWidgets::LtsMessageDialogNew(m_session->baseLayoutWidget(), tr("The Infrastructure Management is not available!"), tr("Cannot open Timeline")); return nullptr; } LtsWidgets::ButtonCombination buttonCombo = /*isMain ? LtsWidgets::ButtonCombination::SeamlessDialog : */LtsWidgets::ButtonCombination::CloseOnly; AudioVideoManagement::StreamNameMapping *streamNameMapping = nullptr; if (m_avmDataIfc) streamNameMapping = m_avmDataIfc->streamNameMapping(); return LtsWidgets::initDialog(new TimelineViewDialog(menuGroup(), buttonCombo, isMain, nullptr), m_eemForeign, m_mrkDtc, m_exmDtc, m_flmIfc, m_ppmDtc, m_ppmInfoIfc, m_avmIfc, m_mrkIfc,m_srmDataIfc, m_coreDtc, m_pdmDtc, ismDtc, m_fltParticipantIfc, m_fltAesIfc, m_fltBuildingComponentIfc, m_session, streamNameMapping); } } // namespace Timeline