avmodel: link to deviceEvent signal

Detects when a new device is plugged or unplugged

Change-Id: Ifc9eeefad45f3916bdb26b816995028fda8a08b7
parent 5366d7ed
...@@ -219,6 +219,10 @@ Q_SIGNALS: ...@@ -219,6 +219,10 @@ Q_SIGNALS:
* @param id * @param id
*/ */
void frameUpdated(const std::string& id); void frameUpdated(const std::string& id);
/**
* Emitted when a device is plugged or unplugged
*/
void deviceEvent();
private: private:
std::unique_ptr<AVModelPimpl> pimpl_; std::unique_ptr<AVModelPimpl> pimpl_;
......
...@@ -110,6 +110,10 @@ public Q_SLOTS: ...@@ -110,6 +110,10 @@ public Q_SLOTS:
* @param id * @param id
*/ */
void slotFrameUpdated(const std::string& id); void slotFrameUpdated(const std::string& id);
/**
* Detect when a device is plugged or unplugged
*/
void slotDeviceEvent();
}; };
...@@ -481,6 +485,8 @@ AVModelPimpl::init() ...@@ -481,6 +485,8 @@ AVModelPimpl::init()
#ifndef ENABLE_LIBWRAP #ifndef ENABLE_LIBWRAP
SIZE_RENDERER = renderers_.size(); SIZE_RENDERER = renderers_.size();
#endif #endif
connect(&callbacksHandler, &CallbacksHandler::deviceEvent,
this, &AVModelPimpl::slotDeviceEvent);
connect(&callbacksHandler, &CallbacksHandler::startedDecoding, connect(&callbacksHandler, &CallbacksHandler::startedDecoding,
this, &AVModelPimpl::startedDecoding); this, &AVModelPimpl::startedDecoding);
connect(&callbacksHandler, &CallbacksHandler::stoppedDecoding, connect(&callbacksHandler, &CallbacksHandler::stoppedDecoding,
...@@ -684,6 +690,12 @@ AVModelPimpl::slotFrameUpdated(const std::string& id) ...@@ -684,6 +690,12 @@ AVModelPimpl::slotFrameUpdated(const std::string& id)
emit linked_.frameUpdated(id); emit linked_.frameUpdated(id);
} }
void
AVModelPimpl::slotDeviceEvent()
{
emit linked_.deviceEvent();
}
} // namespace lrc } // namespace lrc
#include "api/moc_avmodel.cpp" #include "api/moc_avmodel.cpp"
......
...@@ -200,6 +200,12 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent) ...@@ -200,6 +200,12 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent)
this, this,
&CallbacksHandler::slotStoppedDecoding, &CallbacksHandler::slotStoppedDecoding,
Qt::QueuedConnection); Qt::QueuedConnection);
connect(&VideoManager::instance(),
&VideoManagerInterface::deviceEvent,
this,
&CallbacksHandler::slotDeviceEvent,
Qt::QueuedConnection);
} }
CallbacksHandler::~CallbacksHandler() CallbacksHandler::~CallbacksHandler()
...@@ -481,5 +487,11 @@ CallbacksHandler::slotStoppedDecoding(const QString& id, const QString& shmPath) ...@@ -481,5 +487,11 @@ CallbacksHandler::slotStoppedDecoding(const QString& id, const QString& shmPath)
emit stoppedDecoding(id.toStdString(), shmPath.toStdString()); emit stoppedDecoding(id.toStdString(), shmPath.toStdString());
} }
void
CallbacksHandler::slotDeviceEvent()
{
emit deviceEvent();
}
} // namespace lrc } // namespace lrc
...@@ -248,6 +248,11 @@ Q_SIGNALS: ...@@ -248,6 +248,11 @@ Q_SIGNALS:
*/ */
void stoppedDecoding(const std::string& id, const std::string& shmPath); void stoppedDecoding(const std::string& id, const std::string& shmPath);
/**
* Emitted when a device is plugged or unplugged
*/
void deviceEvent();
private Q_SLOTS: private Q_SLOTS:
/** /**
* Emit newAccountMessage * Emit newAccountMessage
...@@ -446,6 +451,11 @@ private Q_SLOTS: ...@@ -446,6 +451,11 @@ private Q_SLOTS:
*/ */
void slotStoppedDecoding(const QString& id, const QString& shmPath); void slotStoppedDecoding(const QString& id, const QString& shmPath);
/**
* Detect when a device is plugged or unplugged
*/
void slotDeviceEvent();
private: private:
const api::Lrc& parent; const api::Lrc& parent;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment