summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2016-08-25 11:38:22 +0200
committerSean Harmer <sean.harmer@kdab.com>2016-11-18 18:45:18 +0000
commitaee2148ba6a3c922ffbe4b9e80a65f3030d11d32 (patch)
treea809ad7a693a166bbe9b6e3c8b6b394d28f2b9ff
parentf725abcfcc41fb9bd012a0efd0858f63c472e4a2 (diff)
Input: move createPhysicalDevice into input handler
This will avoid code duplication when the device wrapper loader job is introduced Change-Id: Ia970b88f8c6aa484b30b5154d107fa7a1f155612 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/input/backend/inputhandler.cpp11
-rw-r--r--src/input/backend/inputhandler_p.h3
-rw-r--r--src/input/frontend/qinputaspect.cpp8
3 files changed, 15 insertions, 7 deletions
diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp
index ba94029e5..82b5c7c7c 100644
--- a/src/input/backend/inputhandler.cpp
+++ b/src/input/backend/inputhandler.cpp
@@ -47,6 +47,7 @@
#include <Qt3DCore/private/qeventfilterservice_p.h>
#include "inputsettings_p.h"
#include "eventsourcesetterhelper_p.h"
+#include <Qt3DInput/private/qinputdeviceintegration_p.h>
QT_BEGIN_NAMESPACE
@@ -302,6 +303,16 @@ EventSourceSetterHelper *InputHandler::eventSourceHelper() const
return m_eventSourceSetter.data();
}
+QAbstractPhysicalDevice *Qt3DInput::Input::InputHandler::createPhysicalDevice(const QString &name)
+{
+ QAbstractPhysicalDevice *device = nullptr;
+ for (Qt3DInput::QInputDeviceIntegration *integration : qAsConst(m_inputDeviceIntegrations)) {
+ if ((device = integration->createPhysicalDevice(name)) != nullptr)
+ break;
+ }
+ return device;
+}
+
void InputHandler::updateEventSource()
{
if (m_settings != nullptr) {
diff --git a/src/input/backend/inputhandler_p.h b/src/input/backend/inputhandler_p.h
index 573a1f9dc..1628f3975 100644
--- a/src/input/backend/inputhandler_p.h
+++ b/src/input/backend/inputhandler_p.h
@@ -67,6 +67,7 @@ class QNodeId;
namespace Qt3DInput {
class QInputDeviceIntegration;
+class QAbstractPhysicalDevice;
namespace Input {
@@ -146,6 +147,8 @@ public:
void setEventSourceHelper(EventSourceSetterHelper *helper);
EventSourceSetterHelper *eventSourceHelper() const;
+ QAbstractPhysicalDevice *createPhysicalDevice(const QString &name);
+
void updateEventSource();
AbstractActionInput *lookupActionInput(Qt3DCore::QNodeId id) const;
diff --git a/src/input/frontend/qinputaspect.cpp b/src/input/frontend/qinputaspect.cpp
index bae22ee0a..2e12f1fb0 100644
--- a/src/input/frontend/qinputaspect.cpp
+++ b/src/input/frontend/qinputaspect.cpp
@@ -188,13 +188,7 @@ void QInputAspectPrivate::loadInputDevicePlugins()
QAbstractPhysicalDevice *QInputAspect::createPhysicalDevice(const QString &name)
{
Q_D(QInputAspect);
- const auto integrations = d->m_inputHandler->inputDeviceIntegrations();
- QAbstractPhysicalDevice *device = nullptr;
- for (Qt3DInput::QInputDeviceIntegration *integration : integrations) {
- if ((device = integration->createPhysicalDevice(name)) != nullptr)
- break;
- }
- return device;
+ return d->m_inputHandler->createPhysicalDevice(name);
}
/*!