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:
* @param id
*/
void frameUpdated(const std::string& id);
/**
* Emitted when a device is plugged or unplugged
*/
void deviceEvent();
private:
std::unique_ptr<AVModelPimpl> pimpl_;
......
......@@ -110,6 +110,10 @@ public Q_SLOTS:
* @param id
*/
void slotFrameUpdated(const std::string& id);
/**
* Detect when a device is plugged or unplugged
*/
void slotDeviceEvent();
};
......@@ -481,6 +485,8 @@ AVModelPimpl::init()
#ifndef ENABLE_LIBWRAP
SIZE_RENDERER = renderers_.size();
#endif
connect(&callbacksHandler, &CallbacksHandler::deviceEvent,
this, &AVModelPimpl::slotDeviceEvent);
connect(&callbacksHandler, &CallbacksHandler::startedDecoding,
this, &AVModelPimpl::startedDecoding);
connect(&callbacksHandler, &CallbacksHandler::stoppedDecoding,
......@@ -684,6 +690,12 @@ AVModelPimpl::slotFrameUpdated(const std::string& id)
emit linked_.frameUpdated(id);
}
void
AVModelPimpl::slotDeviceEvent()
{
emit linked_.deviceEvent();
}
} // namespace lrc
#include "api/moc_avmodel.cpp"
......
......@@ -200,6 +200,12 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent)
this,
&CallbacksHandler::slotStoppedDecoding,
Qt::QueuedConnection);
connect(&VideoManager::instance(),
&VideoManagerInterface::deviceEvent,
this,
&CallbacksHandler::slotDeviceEvent,
Qt::QueuedConnection);
}
CallbacksHandler::~CallbacksHandler()
......@@ -481,5 +487,11 @@ CallbacksHandler::slotStoppedDecoding(const QString& id, const QString& shmPath)
emit stoppedDecoding(id.toStdString(), shmPath.toStdString());
}
void
CallbacksHandler::slotDeviceEvent()
{
emit deviceEvent();
}
} // namespace lrc
......@@ -248,6 +248,11 @@ Q_SIGNALS:
*/
void stoppedDecoding(const std::string& id, const std::string& shmPath);
/**
* Emitted when a device is plugged or unplugged
*/
void deviceEvent();
private Q_SLOTS:
/**
* Emit newAccountMessage
......@@ -446,6 +451,11 @@ private Q_SLOTS:
*/
void slotStoppedDecoding(const QString& id, const QString& shmPath);
/**
* Detect when a device is plugged or unplugged
*/
void slotDeviceEvent();
private:
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