Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+182
@@ -0,0 +1,182 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for AudioVideoSystem
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-08-17
|
||||
*/
|
||||
|
||||
#include "avm_data_plugin.h"
|
||||
#include <AudioVideoManagement/Shared/plugin_settings.h>
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
#include <AudioVideoManagement/ava_control.h>
|
||||
#include <AudioVideoManagement/ava_session.h>
|
||||
#include <AudioVideoManagement/ava_state.h>
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
#include <AudioVideoManagement/stream_name_mapping.h>
|
||||
#include <AudioVideoManagement/avs_menus.h>
|
||||
#include <AudioVideoManagement/avs_dialog.h>
|
||||
#include <AudioVideoManagement/vd_session.h>
|
||||
#include <AudioVideoManagement/Shared/avs_app.h>
|
||||
#include <AudioVideoManagement/stream_name_mapping.h>
|
||||
#include <OperatorManagement/opm.hpp>
|
||||
#include <QMap>
|
||||
#include <QPair>
|
||||
#include <QtGlobal>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <StyleManager/style_manager.h>
|
||||
#include <ngltranslator/ngltranslator.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
using namespace AudioVideoManagement;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
AvaGuiStyle determineGuiStyle()
|
||||
{
|
||||
LtsUtils::StyleManager *styleManager = LtsUtils::StyleManager::getInstance();
|
||||
|
||||
if (styleManager->currentStyleName() == QStringLiteral("rme.dark"))
|
||||
return AvaGuiStyle::Dark;
|
||||
|
||||
return AvaGuiStyle::Light;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
DataPlugin::DataPlugin()
|
||||
: m_pluginSettings(new PluginSettings)
|
||||
{}
|
||||
|
||||
DataPlugin::~DataPlugin() = default;
|
||||
|
||||
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
|
||||
{
|
||||
Q_ASSERT(session);
|
||||
|
||||
int exerciseId = session->exerciseId();
|
||||
return std::make_shared<DataInterfaceImpl>(session, AvmExerciseContextHandle(&m_exerciseContext, exerciseId, session), &m_avsSessionContext);
|
||||
}
|
||||
|
||||
|
||||
DataInterfaceImpl::DataInterfaceImpl(LtsSession::LtsSessionDataDds *session, AvmExerciseContextHandle &&exerciseContextHandle, AvsSessionContext *sessionContext)
|
||||
: m_exerciseContextHandle(std::move(exerciseContextHandle))
|
||||
, m_session(qobject_cast<LtsSession::LtsSession *>(session))
|
||||
{
|
||||
Q_ASSERT(session);
|
||||
Q_ASSERT(session->partitionType() == IDL::PartitionType::Exercise ||
|
||||
session->partitionType() == IDL::PartitionType::Replay ||
|
||||
session->partitionType() == IDL::PartitionType::Global);
|
||||
Q_ASSERT(sessionContext);
|
||||
|
||||
if (session->exerciseId() > 0 && sessionContext->canAcquire(session->exerciseId()))
|
||||
{
|
||||
LtsSessionData::LtsSessionData *sessionData = LtsSessionData::LtsSessionData::getInstance();
|
||||
m_avsSessionContextHandle = AvsSessionContextHandle(sessionContext, session->exerciseId(),
|
||||
sessionData->getOperatorId(),
|
||||
QString::fromLatin1(NGL::translationLocale()),
|
||||
determineGuiStyle(), m_exerciseContextHandle);
|
||||
}
|
||||
}
|
||||
|
||||
DataInterfaceImpl::~DataInterfaceImpl() = default;
|
||||
|
||||
AvaSession *DataInterfaceImpl::avaSession()
|
||||
{
|
||||
return m_avsSessionContextHandle.avaSession();
|
||||
}
|
||||
|
||||
AvaState *DataInterfaceImpl::avaState()
|
||||
{
|
||||
return m_avsSessionContextHandle.avaState();
|
||||
}
|
||||
|
||||
StreamNameMapping *DataInterfaceImpl::streamNameMapping()
|
||||
{
|
||||
return m_exerciseContextHandle.streamNameMapping();
|
||||
}
|
||||
|
||||
AvsMenus *DataInterfaceImpl::menus()
|
||||
{
|
||||
return m_avsSessionContextHandle.menus();
|
||||
}
|
||||
|
||||
VdSession *DataInterfaceImpl::vdSession()
|
||||
{
|
||||
return m_avsSessionContextHandle.vdSession();
|
||||
}
|
||||
|
||||
bool DataInterfaceImpl::vdSessionEstablished() const
|
||||
{
|
||||
return m_avsSessionContextHandle.vdSession()->isEstablished();
|
||||
};
|
||||
|
||||
void DataInterfaceImpl::showCamera(QWidget *irreplacableWidget, int mountingPointId)
|
||||
{
|
||||
if (!m_avsSessionContextHandle)
|
||||
return;
|
||||
|
||||
|
||||
// build list of irreplacable widgets by the dependency tree of its dependencies and their dependencies' dependencies
|
||||
QVector<QWidget *> irreplacableWidgets {m_session->baseLayoutWidget(), irreplacableWidget};
|
||||
LtsSession::LtsSession *dependency = m_session->dependency();
|
||||
int runaway = 100;
|
||||
while (dependency && runaway > 0)
|
||||
{
|
||||
irreplacableWidgets += dependency->baseLayoutWidget();
|
||||
dependency = dependency->dependency();
|
||||
runaway--;
|
||||
}
|
||||
|
||||
qWarning() << "irreplacableWidgets count" << irreplacableWidgets.count() << "from" << m_session;
|
||||
|
||||
for (QWidget *w : irreplacableWidgets)
|
||||
qWarning() << "irre" << w;
|
||||
|
||||
m_avsSessionContextHandle.liveVideoApp()->show(irreplacableWidgets);
|
||||
QString streamName = streamNameMapping()->internalName(mountingPointId);
|
||||
m_avsSessionContextHandle.avaSession()->control()->chooseStreamOverview(AvsDialog::VIDEO_1, {streamName});
|
||||
}
|
||||
|
||||
void DataInterfaceImpl::showAnnouncementUnit(int mountingPointId)
|
||||
{
|
||||
if (!m_avsSessionContextHandle)
|
||||
return;
|
||||
|
||||
m_avsSessionContextHandle.menus()->setAnnouncementUnit(mountingPointId);
|
||||
}
|
||||
|
||||
void DataInterfaceImpl::showOrCloseAvsApp()
|
||||
{
|
||||
if (!m_avsSessionContextHandle)
|
||||
return;
|
||||
|
||||
auto liveVideoApp = m_avsSessionContextHandle.liveVideoApp();
|
||||
|
||||
qWarning() << "showOrCloseAvsApp" << liveVideoApp->isVisible();
|
||||
if (liveVideoApp->isActive())
|
||||
liveVideoApp->hide(true /* and close */);
|
||||
else
|
||||
liveVideoApp->show();
|
||||
|
||||
}
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
Reference in new issue
Block a user