mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Support Events for Grabbers generically
This commit is contained in:
@@ -23,3 +23,8 @@ endif(UNIX)
|
||||
target_include_directories(events PUBLIC
|
||||
${CURRENT_HEADER_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(events
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
)
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
#include <grabber/VideoWrapper.h>
|
||||
|
||||
#include <events/EventHandler.h>
|
||||
|
||||
// qt includes
|
||||
#include <QTimer>
|
||||
|
||||
@@ -24,8 +22,6 @@ VideoWrapper::VideoWrapper()
|
||||
connect(&_grabber, SIGNAL(readError(const char*)), this, SLOT(readError(const char*)), Qt::DirectConnection);
|
||||
|
||||
connect(&_grabber, SIGNAL(readError(const char*)), this, SLOT(readError(const char*)), Qt::DirectConnection);
|
||||
|
||||
QObject::connect(EventHandler::getInstance(), &EventHandler::signalEvent, this, &VideoWrapper::handleEvent);
|
||||
}
|
||||
|
||||
VideoWrapper::~VideoWrapper()
|
||||
@@ -44,11 +40,6 @@ void VideoWrapper::stop()
|
||||
GrabberWrapper::stop();
|
||||
}
|
||||
|
||||
void VideoWrapper::handleEvent(Event event)
|
||||
{
|
||||
_grabber.handleEvent(event);
|
||||
}
|
||||
|
||||
void VideoWrapper::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::V4L2 && _grabberName.startsWith("V4L2"))
|
||||
|
@@ -5,6 +5,7 @@
|
||||
|
||||
// utils includes
|
||||
#include <utils/GlobalSignals.h>
|
||||
#include <events/EventHandler.h>
|
||||
|
||||
// qt
|
||||
#include <QTimer>
|
||||
@@ -49,6 +50,8 @@ GrabberWrapper::GrabberWrapper(const QString& grabberName, Grabber * ggrabber, i
|
||||
|
||||
// listen for source requests
|
||||
connect(GlobalSignals::getInstance(), &GlobalSignals::requestSource, this, &GrabberWrapper::handleSourceRequest);
|
||||
|
||||
QObject::connect(EventHandler::getInstance(), &EventHandler::signalEvent, this, &GrabberWrapper::handleEvent);
|
||||
}
|
||||
|
||||
GrabberWrapper::~GrabberWrapper()
|
||||
@@ -83,6 +86,11 @@ void GrabberWrapper::stop()
|
||||
}
|
||||
}
|
||||
|
||||
void GrabberWrapper::handleEvent(Event event)
|
||||
{
|
||||
_ggrabber->handleEvent(event);
|
||||
}
|
||||
|
||||
bool GrabberWrapper::isActive() const
|
||||
{
|
||||
return _timer->isActive();
|
||||
|
Reference in New Issue
Block a user