aboutsummaryrefslogtreecommitdiffstats
path: root/src/gamepad/qgamepadmanager.cpp
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2015-10-26 12:38:33 +0200
committerAndy Nichols <andy.nichols@theqtcompany.com>2015-10-26 12:40:37 +0000
commitc32e995bc79035e600893e91fdcec984f8293c75 (patch)
tree6de9a857b695fedfb3a52c5e4e34334759a09acc /src/gamepad/qgamepadmanager.cpp
parent00871e531f7fb44feb3dac7abfe4eff0af5dfada (diff)
Enable the usage of unknown gamepads.
Allowing the user to configure every button & axis of (s)his gamepad, will enable the usage of any gamepad. Currently only evdev backed has this feature. Change-Id: I6e0692980e77b448d20d5ba818b787a7b89e7257 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'src/gamepad/qgamepadmanager.cpp')
-rw-r--r--src/gamepad/qgamepadmanager.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gamepad/qgamepadmanager.cpp b/src/gamepad/qgamepadmanager.cpp
index 91ca70f..2c737f6 100644
--- a/src/gamepad/qgamepadmanager.cpp
+++ b/src/gamepad/qgamepadmanager.cpp
@@ -58,6 +58,9 @@ QGamepadManager::QGamepadManager() :
connect(m_gamepadBackend, SIGNAL(gamepadAxisMoved(int,QGamepadManager::GamepadAxis,double)), this, SLOT(forwardGamepadAxisEvent(int,QGamepadManager::GamepadAxis,double)));
connect(m_gamepadBackend, SIGNAL(gamepadButtonPressed(int,QGamepadManager::GamepadButton,double)), this, SLOT(forwardGamepadButtonPressEvent(int,QGamepadManager::GamepadButton,double)));
connect(m_gamepadBackend, SIGNAL(gamepadButtonReleased(int,QGamepadManager::GamepadButton)), this, SLOT(forwardGamepadButtonReleaseEvent(int,QGamepadManager::GamepadButton)));
+ connect(m_gamepadBackend, &QGamepadBackend::buttonConfigured, this, &QGamepadManager::buttonConfigured);
+ connect(m_gamepadBackend, &QGamepadBackend::axisConfigured, this, &QGamepadManager::axisConfigured);
+ connect(m_gamepadBackend, &QGamepadBackend::configurationCanceled, this, &QGamepadManager::configurationCanceled);
if (!m_gamepadBackend->start())
qCWarning(gp) << "Failed to start gamepad backend";
@@ -107,6 +110,36 @@ const QList<int> QGamepadManager::connectedGamepads() const
return m_connectedGamepads.toList();
}
+bool QGamepadManager::isConfigurationNeeded(int deviceId)
+{
+ return m_gamepadBackend->isConfigurationNeeded(deviceId);
+}
+
+bool QGamepadManager::configureButton(int deviceId, QGamepadManager::GamepadButton button)
+{
+ return m_gamepadBackend->configureButton(deviceId, button);
+}
+
+bool QGamepadManager::configureAxis(int deviceId, QGamepadManager::GamepadAxis axis)
+{
+ return m_gamepadBackend->configureAxis(deviceId, axis);
+}
+
+bool QGamepadManager::setCancelConfigureButton(int deviceId, QGamepadManager::GamepadButton button)
+{
+ return m_gamepadBackend->setCancelConfigureButton(deviceId, button);
+}
+
+void QGamepadManager::resetConfiguration(int deviceId)
+{
+ m_gamepadBackend->resetConfiguration(deviceId);
+}
+
+void QGamepadManager::setSettingsFile(const QString &file)
+{
+ m_gamepadBackend->setSettingsFile(file);
+}
+
void QGamepadManager::forwardGamepadConnected(int deviceId)
{
//qDebug() << "gamepad connected: " << index;