168 lines
5.6 KiB
C++
Executable File
168 lines
5.6 KiB
C++
Executable File
/**
|
|
* @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 <stdlib.h> // for abort
|
|
|
|
#include <LtsSession/lts_session.h>
|
|
#include <LtsSession/lts_session_manager.h>
|
|
#include <LtsSession/lts_session_data.h>
|
|
|
|
#include <QTimer>
|
|
|
|
namespace Timeline
|
|
{
|
|
|
|
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("View"))
|
|
{}
|
|
|
|
|
|
bool InterfaceImpl::fetchInterfaces()
|
|
{
|
|
if (!m_session->getForeignDataInterface<TimeLineManagement::DataInterface>(m_eemForeign))
|
|
return false;
|
|
if (!m_session->getDtc<MarkerManagement::DataInterface>(m_mrkDtc))
|
|
return false;
|
|
if (!m_session->getDtc<ExerciseManagement::DataInterface>(m_exmDtc))
|
|
return false;
|
|
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
|
return false;
|
|
if (!m_session->getForeignGuiInterface<FileManagement::ForeignGuiInterface>(m_flmIfc))
|
|
return false;
|
|
if (!m_session->getForeignGuiInterface<ParticipantManagement::ForeignParticipantInfoGuiInterface>(m_ppmInfoIfc))
|
|
return false;
|
|
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(m_pdmDtc))
|
|
return false;
|
|
// if (!m_session->getDtc<InfrastructureManagement::DataInterface>(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<SituationReplayManagement::DataInterface>(m_srmDataIfc)) // to start the replay situation app
|
|
WARNING_LOG(m_logger) << "no srm data ifc, no situation replay app";
|
|
if (!m_session->getDtc<SituationReplayManagement::DataInterface>(m_coreDtc))
|
|
WARNING_LOG(m_logger) << "no core dtc, no situation replay app";
|
|
if (!m_session->getForeignGuiInterface<AudioVideoManagement::ForeignMenuEditGuiInterface>(m_avmIfc))
|
|
WARNING_LOG(m_logger) << "Timeline Gui Plugin: no avm ifc";
|
|
if (!m_session->getForeignGuiInterface<MarkerManagement::ForeignGuiInterface>(m_mrkIfc))
|
|
WARNING_LOG(m_logger) << "Timeline Gui Plugin: no mrk ifc";
|
|
if (!m_session->getForeignGuiInterface<FilterManagement::ForeignFltParticipantGuiInterface>(m_fltParticipantIfc))
|
|
WARNING_LOG(m_logger) << "Timeline Gui Plugin: no flt Part ifc";
|
|
if (!m_session->getForeignGuiInterface<FilterManagement::ForeignAesGuiInterface>(m_fltAesIfc))
|
|
WARNING_LOG(m_logger) << "Timeline Gui Plugin: no flt Aes ifc";
|
|
if (!m_session->getForeignGuiInterface<FilterManagement::ForeignFltBuildingComponentGuiInterface>(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<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
|
{
|
|
QVector<LtsWidgets::PluginData> 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<InfrastructureManagement::Interface::Dtc> ismDtc;
|
|
if (!m_session->getDtc<InfrastructureManagement::DataInterface>(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
|