diff --git a/src/avmodel.cpp b/src/avmodel.cpp index 42600a906faa162758d12f470097418ca46d1894..ebf5eeb281b8cf3d6c905bc67029a47cf5d54b11 100644 --- a/src/avmodel.cpp +++ b/src/avmodel.cpp @@ -108,13 +108,13 @@ public Q_SLOTS: * @param width * @param height */ - void startedDecoding(const QString& id, const QString& shmPath, int width, int height); + void onDecodingStarted(const QString& id, const QString& shmPath, int width, int height); /** * Listen from CallbacksHandler when a renderer stops * @param id * @param shmPath */ - void stoppedDecoding(const QString& id, const QString& shmPath); + void onDecodingStopped(const QString& id, const QString& shmPath); /** * Detect when the current frame is updated * @param id @@ -692,13 +692,13 @@ AVModelPimpl::AVModelPimpl(AVModel& linked, const CallbacksHandler& callbacksHan // render connections connect(&callbacksHandler, - &CallbacksHandler::startedDecoding, + &CallbacksHandler::decodingStarted, this, - &AVModelPimpl::startedDecoding); + &AVModelPimpl::onDecodingStarted); connect(&callbacksHandler, - &CallbacksHandler::stoppedDecoding, + &CallbacksHandler::decodingStopped, this, - &AVModelPimpl::stoppedDecoding); + &AVModelPimpl::onDecodingStopped); auto startedPreview = false; auto restartRenderers = [&](const QStringList& callList) { @@ -709,7 +709,7 @@ AVModelPimpl::AVModelPimpl(AVModel& linked, const CallbacksHandler& callbacksHan auto height = rendererInfos[DRing::Media::Details::HEIGHT].toInt(); if (width > 0 && height > 0) { startedPreview = true; - startedDecoding(callId, shmPath, width, height); + onDecodingStarted(callId, shmPath, width, height); } } }; @@ -748,7 +748,7 @@ AVModelPimpl::getRecordingPath() const } void -AVModelPimpl::startedDecoding(const QString& id, const QString& shmPath, int width, int height) +AVModelPimpl::onDecodingStarted(const QString& id, const QString& shmPath, int width, int height) { if (id != "" && id != "local" && !id.contains("://")) // Else managed by callmodel return; @@ -758,7 +758,7 @@ AVModelPimpl::startedDecoding(const QString& id, const QString& shmPath, int wid } void -AVModelPimpl::stoppedDecoding(const QString& id, const QString& shmPath) +AVModelPimpl::onDecodingStopped(const QString& id, const QString& shmPath) { Q_UNUSED(shmPath) removeRenderer(id); diff --git a/src/callbackshandler.cpp b/src/callbackshandler.cpp index 573566a160efdbf468372b8eaf0fa336598b7115..fa74df37f60db2d226535b31766032fcc9c878e1 100644 --- a/src/callbackshandler.cpp +++ b/src/callbackshandler.cpp @@ -270,22 +270,23 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent) Qt::QueuedConnection); connect(&VideoManager::instance(), - &VideoManagerInterface::startedDecoding, + &VideoManagerInterface::decodingStarted, this, - &CallbacksHandler::slotStartedDecoding, + &CallbacksHandler::decodingStarted, Qt::QueuedConnection); connect(&VideoManager::instance(), - &VideoManagerInterface::stoppedDecoding, + &VideoManagerInterface::decodingStopped, this, - &CallbacksHandler::slotStoppedDecoding, + &CallbacksHandler::decodingStopped, Qt::QueuedConnection); connect(&VideoManager::instance(), &VideoManagerInterface::deviceEvent, this, - &CallbacksHandler::slotDeviceEvent, + &CallbacksHandler::deviceEvent, Qt::QueuedConnection); + connect(&ConfigurationManager::instance(), &ConfigurationManagerInterface::audioDeviceEvent, this, @@ -705,27 +706,6 @@ CallbacksHandler::slotDebugMessageReceived(const QString& message) emit parent.getBehaviorController().debugMessageReceived(message); } -void -CallbacksHandler::slotStartedDecoding(const QString& id, - const QString& shmPath, - int width, - int height) -{ - emit startedDecoding(id, shmPath, width, height); -} - -void -CallbacksHandler::slotStoppedDecoding(const QString& id, const QString& shmPath) -{ - emit stoppedDecoding(id, shmPath); -} - -void -CallbacksHandler::slotDeviceEvent() -{ - emit deviceEvent(); -} - void CallbacksHandler::slotAudioDeviceEvent() { diff --git a/src/callbackshandler.h b/src/callbackshandler.h index 1b9db9c721dfb9e7a90dae1a537a17c2303ede10..3417bf947c7d93f6a001138fe5b9382d2e7a3ccb 100644 --- a/src/callbackshandler.h +++ b/src/callbackshandler.h @@ -297,14 +297,14 @@ Q_SIGNALS: * @param width * @param height */ - void startedDecoding(const QString& id, const QString& shmPath, int width, int height); + void decodingStarted(const QString& id, const QString& shmPath, int width, int height); /** * Renderer is stopped * @param id * @param shmrenderer */ - void stoppedDecoding(const QString& id, const QString& shmPath); + void decodingStopped(const QString& id, const QString& shmPath); /** * Emitted when a video device is plugged or unplugged @@ -609,27 +609,6 @@ private Q_SLOTS: */ void slotDebugMessageReceived(const QString& message); - /** - * Renderer is started - * @param id - * @param shmrenderer - * @param width - * @param height - */ - void slotStartedDecoding(const QString& id, const QString& shmPath, int width, int height); - - /** - * Renderer is stopped - * @param id - * @param shmrenderer - */ - void slotStoppedDecoding(const QString& id, const QString& shmPath); - - /** - * Detect when a video device is plugged or unplugged - */ - void slotDeviceEvent(); - /** * Detect when an audio device is plugged or unplugged */ diff --git a/src/newcallmodel.cpp b/src/newcallmodel.cpp index 80af14be2d8c3a987ffbb82956cf02a574240343..4e0188ef9d39dea82c1d6c28423caf747e6eac78 100644 --- a/src/newcallmodel.cpp +++ b/src/newcallmodel.cpp @@ -256,7 +256,7 @@ public Q_SLOTS: * @param width * @param height */ - void startedDecoding(const QString& id, const QString& shmPath, int width, int height); + void onDecodingStarted(const QString& id, const QString& shmPath, int width, int height); }; NewCallModel::NewCallModel(const account::Info& owner, @@ -918,9 +918,9 @@ NewCallModelPimpl::NewCallModelPimpl(const NewCallModel& linked, this, &NewCallModelPimpl::remoteRecordingChanged); connect(&callbacksHandler, - &CallbacksHandler::startedDecoding, + &CallbacksHandler::decodingStarted, this, - &NewCallModelPimpl::startedDecoding); + &NewCallModelPimpl::onDecodingStarted); #ifndef ENABLE_LIBWRAP // Only necessary with dbus since the daemon runs separately @@ -1591,7 +1591,7 @@ NewCallModelPimpl::remoteRecordingChanged(const QString& callId, } void -NewCallModelPimpl::startedDecoding(const QString& id, const QString& shmPath, int width, int height) +NewCallModelPimpl::onDecodingStarted(const QString& id, const QString& shmPath, int width, int height) { auto it = calls.find(id); if (it == calls.end()) diff --git a/src/qtwrapper/videomanager_wrap.cpp b/src/qtwrapper/videomanager_wrap.cpp index 3b202f8a7fdb9f708273469a9de3caec2ceb36db..e1124ae84c323ff43df8d2260ebdbd823bd26646 100644 --- a/src/qtwrapper/videomanager_wrap.cpp +++ b/src/qtwrapper/videomanager_wrap.cpp @@ -21,69 +21,27 @@ VideoManagerInterface::VideoManagerInterface() { #ifdef ENABLE_VIDEO - - proxy = new VideoManagerSignalProxy(this); - sender = new VideoManagerProxySender(); - - QObject::connect(sender, - &VideoManagerProxySender::deviceEvent, - proxy, - &VideoManagerSignalProxy::slotDeviceEvent, - Qt::QueuedConnection); - QObject::connect(sender, - &VideoManagerProxySender::startedDecoding, - proxy, - &VideoManagerSignalProxy::slotStartedDecoding); - QObject::connect(sender, - &VideoManagerProxySender::stoppedDecoding, - proxy, - &VideoManagerSignalProxy::slotStoppedDecoding); - using DRing::exportable_callback; using DRing::VideoSignal; videoHandlers - = {exportable_callback<VideoSignal::DeviceEvent>([this]() { emit sender->deviceEvent(); }), + = {exportable_callback<VideoSignal::DeviceEvent>([this]() { Q_EMIT deviceEvent(); }), exportable_callback<VideoSignal::DecodingStarted>([this](const std::string& id, const std::string& shmPath, int width, int height, bool isMixer) { - emit sender->startedDecoding(QString(id.c_str()), - QString(shmPath.c_str()), - width, - height, - isMixer); + Q_EMIT decodingStarted(QString(id.c_str()), + QString(shmPath.c_str()), + width, + height, + isMixer); }), exportable_callback<VideoSignal::DecodingStopped>([this](const std::string& id, const std::string& shmPath, bool isMixer) { - emit sender->stoppedDecoding(QString(id.c_str()), QString(shmPath.c_str()), isMixer); + Q_EMIT decodingStopped(QString(id.c_str()), QString(shmPath.c_str()), isMixer); })}; #endif } VideoManagerInterface::~VideoManagerInterface() {} - -VideoManagerSignalProxy::VideoManagerSignalProxy(VideoManagerInterface* parent) - : QObject(parent) - , m_pParent(parent) -{} - -void -VideoManagerSignalProxy::slotDeviceEvent() -{ - emit m_pParent->deviceEvent(); -} - -void -VideoManagerSignalProxy::slotStartedDecoding( - const QString& id, const QString& shmPath, int width, int height, bool isMixer) -{ - emit m_pParent->startedDecoding(id, shmPath, width, height, isMixer); -} - -void -VideoManagerSignalProxy::slotStoppedDecoding(const QString& id, const QString& shmPath, bool isMixer) -{ - emit m_pParent->stoppedDecoding(id, shmPath, isMixer); -} diff --git a/src/qtwrapper/videomanager_wrap.h b/src/qtwrapper/videomanager_wrap.h index 779ec3e47946e09832855ef83a75f8f62220a15b..e86c63b564b8f3cd4f326e637da5496c42aac7e9 100644 --- a/src/qtwrapper/videomanager_wrap.h +++ b/src/qtwrapper/videomanager_wrap.h @@ -39,40 +39,6 @@ #include "typedefs.h" #include "conversions_wrap.hpp" -class VideoManagerInterface; - -class VideoManagerSignalProxy : public QObject -{ - Q_OBJECT -public: - VideoManagerSignalProxy(VideoManagerInterface* parent); - -public Q_SLOTS: - void slotDeviceEvent(); - void slotStartedDecoding( - const QString& id, const QString& shmPath, int width, int height, bool isMixer); - void slotStoppedDecoding(const QString& id, const QString& shmPath, bool isMixer); - -private: - VideoManagerInterface* m_pParent; -}; - -class VideoManagerProxySender : public QObject -{ - Q_OBJECT - friend class VideoManagerInterface; - -public: -Q_SIGNALS: - void deviceEvent(); - void startedDecoding( - const QString& id, const QString& shmPath, int width, int height, bool isMixer); - void stoppedDecoding(const QString& id, const QString& shmPath, bool isMixer); -}; - -/* - * Proxy class for interface org.ring.Ring.VideoManager - */ class VideoManagerInterface : public QObject { Q_OBJECT @@ -87,10 +53,6 @@ public: std::map<std::string, std::shared_ptr<DRing::CallbackWrapperBase>> videoHandlers; #endif -private: - VideoManagerSignalProxy* proxy; - VideoManagerProxySender* sender; - public Q_SLOTS: // METHODS void applySettings(const QString& name, MapStringString settings) { @@ -102,7 +64,6 @@ public Q_SLOTS: // METHODS #endif } - // TODO: test!!!!!!!!!!!!!!! MapStringMapStringVectorString getCapabilities(const QString& name) { MapStringMapStringVectorString ret; @@ -222,9 +183,9 @@ public Q_SLOTS: // METHODS Q_SIGNALS: // SIGNALS void deviceEvent(); - void startedDecoding( + void decodingStarted( const QString& id, const QString& shmPath, int width, int height, bool isMixer); - void stoppedDecoding(const QString& id, const QString& shmPath, bool isMixer); + void decodingStopped(const QString& id, const QString& shmPath, bool isMixer); }; namespace org {