diff options
author | Mike Krus <mike.krus@kdab.com> | 2016-01-25 20:25:18 +0000 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2016-05-31 12:55:46 +0000 |
commit | ecd0a55a0bfbcb597de5550e2be96e52b9ec27c5 (patch) | |
tree | 787032b847d25a8c1c6a099384da8fb51329e67c | |
parent | 4e8538d5a4596eb546c1dd55073e2482b1f6b594 (diff) |
Rename iOS backend to darwin as it applies to iOS, OS X and tvOS
Change-Id: Ie58d8aeb862d632e48611d23ff2cec7f0b9ce36c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/plugins/gamepads/darwin/darwin.json | 3 | ||||
-rw-r--r-- | src/plugins/gamepads/darwin/darwin.pro (renamed from src/plugins/gamepads/ios/ios.pro) | 12 | ||||
-rw-r--r-- | src/plugins/gamepads/darwin/main.cpp (renamed from src/plugins/gamepads/ios/main.cpp) | 10 | ||||
-rw-r--r-- | src/plugins/gamepads/darwin/qdarwingamepadbackend.mm (renamed from src/plugins/gamepads/ios/qiosgamepadbackend.mm) | 138 | ||||
-rw-r--r-- | src/plugins/gamepads/darwin/qdarwingamepadbackend_p.h (renamed from src/plugins/gamepads/ios/qiosgamepadbackend_p.h) | 26 | ||||
-rw-r--r-- | src/plugins/gamepads/gamepads.pro | 2 | ||||
-rw-r--r-- | src/plugins/gamepads/ios/ios.json | 3 |
8 files changed, 97 insertions, 99 deletions
@@ -7,7 +7,7 @@ Native Backends - Linux (evdev) - Window (xinput) - Android - - iOS + - OS X/iOS/tvOS For other platforms there is a backend that uses SDL2 for gamepad support. diff --git a/src/plugins/gamepads/darwin/darwin.json b/src/plugins/gamepads/darwin/darwin.json new file mode 100644 index 0000000..f72350b --- /dev/null +++ b/src/plugins/gamepads/darwin/darwin.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "darwin" ] +} diff --git a/src/plugins/gamepads/ios/ios.pro b/src/plugins/gamepads/darwin/darwin.pro index 2fa1f2f..9a35c75 100644 --- a/src/plugins/gamepads/ios/ios.pro +++ b/src/plugins/gamepads/darwin/darwin.pro @@ -1,21 +1,19 @@ -TARGET = iosgamepad +TARGET = darwingamepad QT += gamepad gamepad-private PLUGIN_TYPE = gamepads PLUGIN_EXTENDS = gamepad -PLUGIN_CLASS_NAME = QIosGamepadBackendPlugin +PLUGIN_CLASS_NAME = QDarwinGamepadBackendPlugin load(qt_plugin) LIBS += -framework GameController -framework Foundation -HEADERS += qiosgamepadbackend_p.h +HEADERS += qdarwingamepadbackend_p.h OBJECTIVE_SOURCES += \ - qiosgamepadbackend.mm + qdarwingamepadbackend.mm SOURCES += \ main.cpp OTHER_FILES += \ - ios.json - - + darwin.json diff --git a/src/plugins/gamepads/ios/main.cpp b/src/plugins/gamepads/darwin/main.cpp index d6ab9c7..f1dc667 100644 --- a/src/plugins/gamepads/ios/main.cpp +++ b/src/plugins/gamepads/darwin/main.cpp @@ -37,23 +37,23 @@ #include <QtGamepad/private/qgamepadbackendfactory_p.h> #include <QtGamepad/private/qgamepadbackendplugin_p.h> -#include "qiosgamepadbackend_p.h" +#include "qdarwingamepadbackend_p.h" QT_BEGIN_NAMESPACE -class QIosGamepadBackendPlugin : public QGamepadBackendPlugin +class QDarwinGamepadBackendPlugin : public QGamepadBackendPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID QtGamepadBackendFactoryInterface_iid FILE "ios.json") + Q_PLUGIN_METADATA(IID QtGamepadBackendFactoryInterface_iid FILE "darwin.json") public: QGamepadBackend *create(const QString &key, const QStringList ¶mList) Q_DECL_OVERRIDE; }; -QGamepadBackend *QIosGamepadBackendPlugin::create(const QString &key, const QStringList ¶mList) { +QGamepadBackend *QDarwinGamepadBackendPlugin::create(const QString &key, const QStringList ¶mList) { Q_UNUSED(key) Q_UNUSED(paramList) - return new QIosGamepadBackend(); + return new QDarwinGamepadBackend(); } QT_END_NAMESPACE diff --git a/src/plugins/gamepads/ios/qiosgamepadbackend.mm b/src/plugins/gamepads/darwin/qdarwingamepadbackend.mm index 245c0d3..6da7650 100644 --- a/src/plugins/gamepads/ios/qiosgamepadbackend.mm +++ b/src/plugins/gamepads/darwin/qdarwingamepadbackend.mm @@ -33,15 +33,15 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qiosgamepadbackend_p.h" +#include "qdarwingamepadbackend_p.h" #include <QtCore/QDebug> #import <GameController/GameController.h> -@interface QT_MANGLE_NAMESPACE(IosGamepadManager) : NSObject +@interface QT_MANGLE_NAMESPACE(DarwinGamepadManager) : NSObject { - QIosGamepadBackend *backend; + QDarwinGamepadBackend *backend; NSMutableArray *connectedControllers; } @@ -53,11 +53,11 @@ @end -@implementation QT_MANGLE_NAMESPACE(IosGamepadManager) +@implementation QT_MANGLE_NAMESPACE(DarwinGamepadManager) --(id)initWithBackend:(QIosGamepadBackend *)iosGamepadBackend { +-(id)initWithBackend:(QDarwinGamepadBackend *)gamepadBackend { if (self = [super init]) { - backend = iosGamepadBackend; + backend = gamepadBackend; connectedControllers = [[NSMutableArray alloc] init]; //Setup observers for monitoring controller connections/disconnections self.connectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidConnectNotification @@ -111,7 +111,7 @@ controller.playerIndex = index; #endif - QMetaObject::invokeMethod(backend, "iosGamepadAdded", Qt::AutoConnection, Q_ARG(int, index)); + QMetaObject::invokeMethod(backend, "darwinGamepadAdded", Qt::AutoConnection, Q_ARG(int, index)); //Pause button handler [controller setControllerPausedHandler:^(GCController *controller) { @@ -124,12 +124,12 @@ [controller.extendedGamepad.leftShoulder setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonL1), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonL1)); } @@ -138,12 +138,12 @@ [controller.extendedGamepad.rightShoulder setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonR1), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonR1)); } @@ -153,43 +153,43 @@ Q_UNUSED(dpad) if (xValue > 0) { //right - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonRight), Q_ARG(double, 1)); } else if (xValue < 0) { //left - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonLeft), Q_ARG(double, 1)); } else { //released - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonRight)); - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonLeft)); } if (yValue > 0) { //up - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonUp), Q_ARG(double, 1)); } else if (yValue < 0) { //down - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonDown), Q_ARG(double, 1)); } else { //released - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonUp)); - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonDown)); } @@ -198,12 +198,12 @@ [controller.extendedGamepad.buttonA setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonA), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonA)); } @@ -212,12 +212,12 @@ [controller.extendedGamepad.buttonB setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonB), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonB)); } @@ -226,12 +226,12 @@ [controller.extendedGamepad.buttonX setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonX), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonX)); } @@ -241,12 +241,12 @@ //Invoke slot Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonY), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonY)); } @@ -255,11 +255,11 @@ //leftThumbstick [controller.extendedGamepad.leftThumbstick setValueChangedHandler:^(GCControllerDirectionPad *dpad, float xValue, float yValue) { Q_UNUSED(dpad) - QMetaObject::invokeMethod(backend, "iosGamepadAxisMoved", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadAxisMoved", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadAxis, QGamepadManager::AxisLeftX), Q_ARG(double, xValue)); - QMetaObject::invokeMethod(backend, "iosGamepadAxisMoved", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadAxisMoved", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadAxis, QGamepadManager::AxisLeftY), Q_ARG(double, -yValue)); @@ -267,11 +267,11 @@ //rightTumbstick [controller.extendedGamepad.rightThumbstick setValueChangedHandler:^(GCControllerDirectionPad *dpad, float xValue, float yValue) { Q_UNUSED(dpad) - QMetaObject::invokeMethod(backend, "iosGamepadAxisMoved", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadAxisMoved", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadAxis, QGamepadManager::AxisRightX), Q_ARG(double, xValue)); - QMetaObject::invokeMethod(backend, "iosGamepadAxisMoved", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadAxisMoved", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadAxis, QGamepadManager::AxisRightY), Q_ARG(double, -yValue)); @@ -280,12 +280,12 @@ [controller.extendedGamepad.leftTrigger setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonL2), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonL2)); } @@ -294,12 +294,12 @@ [controller.extendedGamepad.rightTrigger setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonR2), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonR2)); } @@ -310,12 +310,12 @@ [controller.gamepad.leftShoulder setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonL1), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonL1)); } @@ -324,12 +324,12 @@ [controller.gamepad.rightShoulder setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonR1), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonR1)); } @@ -339,43 +339,43 @@ Q_UNUSED(dpad) if (xValue > 0) { //right - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonRight), Q_ARG(double, 1)); } else if (xValue < 0) { //left - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonLeft), Q_ARG(double, 1)); } else { //released - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonRight)); - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonLeft)); } if (yValue > 0) { //up - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonUp), Q_ARG(double, 1)); } else if (yValue < 0) { //down - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonDown), Q_ARG(double, 1)); } else { //released - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonUp)); - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonDown)); } @@ -384,12 +384,12 @@ [controller.gamepad.buttonA setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonA), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonA)); } @@ -398,12 +398,12 @@ [controller.gamepad.buttonB setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonB), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonB)); } @@ -412,12 +412,12 @@ [controller.gamepad.buttonX setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonX), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonX)); } @@ -426,12 +426,12 @@ [controller.gamepad.buttonY setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { Q_UNUSED(button) if (pressed) { - QMetaObject::invokeMethod(backend, "iosGamepadButtonPressed", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonPressed", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonY), Q_ARG(double, value)); } else { - QMetaObject::invokeMethod(backend, "iosGamepadButtonReleased", Qt::AutoConnection, + QMetaObject::invokeMethod(backend, "darwinGamepadButtonReleased", Qt::AutoConnection, Q_ARG(int, index), Q_ARG(QGamepadManager::GamepadButton, QGamepadManager::ButtonY)); } @@ -451,38 +451,38 @@ } } - QMetaObject::invokeMethod(backend, "iosGamepadRemoved", Qt::AutoConnection, Q_ARG(int, index)); + QMetaObject::invokeMethod(backend, "darwinGamepadRemoved", Qt::AutoConnection, Q_ARG(int, index)); } @end QT_BEGIN_NAMESPACE -QIosGamepadBackend::QIosGamepadBackend(QObject *parent) +QDarwinGamepadBackend::QDarwinGamepadBackend(QObject *parent) : QGamepadBackend(parent) - , m_iosGamepadManager(Q_NULLPTR) + , m_darwinGamepadManager(Q_NULLPTR) , m_isMonitoringActive(false) { - m_iosGamepadManager = [[IosGamepadManager alloc] initWithBackend:this]; + m_darwinGamepadManager = [[DarwinGamepadManager alloc] initWithBackend:this]; } -QIosGamepadBackend::~QIosGamepadBackend() +QDarwinGamepadBackend::~QDarwinGamepadBackend() { - [m_iosGamepadManager release]; + [m_darwinGamepadManager release]; } -bool QIosGamepadBackend::start() +bool QDarwinGamepadBackend::start() { m_isMonitoringActive = true; return true; } -void QIosGamepadBackend::stop() +void QDarwinGamepadBackend::stop() { m_isMonitoringActive = false; } -void QIosGamepadBackend::iosGamepadAdded(int index) +void QDarwinGamepadBackend::darwinGamepadAdded(int index) { if (m_isMonitoringActive) { emit gamepadAdded(index); @@ -490,7 +490,7 @@ void QIosGamepadBackend::iosGamepadAdded(int index) } } -void QIosGamepadBackend::iosGamepadRemoved(int index) +void QDarwinGamepadBackend::darwinGamepadRemoved(int index) { if (m_isMonitoringActive) { emit gamepadRemoved(index); @@ -498,25 +498,25 @@ void QIosGamepadBackend::iosGamepadRemoved(int index) } } -void QIosGamepadBackend::iosGamepadAxisMoved(int index, QGamepadManager::GamepadAxis axis, double value) +void QDarwinGamepadBackend::darwinGamepadAxisMoved(int index, QGamepadManager::GamepadAxis axis, double value) { if (m_isMonitoringActive) emit gamepadAxisMoved(index, axis, value); } -void QIosGamepadBackend::iosGamepadButtonPressed(int index, QGamepadManager::GamepadButton button, double value) +void QDarwinGamepadBackend::darwinGamepadButtonPressed(int index, QGamepadManager::GamepadButton button, double value) { if (m_isMonitoringActive) emit gamepadButtonPressed(index, button, value); } -void QIosGamepadBackend::iosGamepadButtonReleased(int index, QGamepadManager::GamepadButton button) +void QDarwinGamepadBackend::darwinGamepadButtonReleased(int index, QGamepadManager::GamepadButton button) { if (m_isMonitoringActive) emit gamepadButtonReleased(index, button); } -void QIosGamepadBackend::handlePauseButton(int index) +void QDarwinGamepadBackend::handlePauseButton(int index) { //If already pressed if (m_pauseButtonMap.value(index)) { diff --git a/src/plugins/gamepads/ios/qiosgamepadbackend_p.h b/src/plugins/gamepads/darwin/qdarwingamepadbackend_p.h index a5486cc..632d5b3 100644 --- a/src/plugins/gamepads/ios/qiosgamepadbackend_p.h +++ b/src/plugins/gamepads/darwin/qdarwingamepadbackend_p.h @@ -34,8 +34,8 @@ ** ****************************************************************************/ -#ifndef QIOSGAMEPADCONTROLLER_H -#define QIOSGAMEPADCONTROLLER_H +#ifndef QDARWINGAMEPADCONTROLLER_H +#define QDARWINGAMEPADCONTROLLER_H #include <QtCore/QTimer> #include <QtCore/QMap> @@ -43,35 +43,35 @@ #include <QtGamepad/QGamepadManager> #include <QtGamepad/private/qgamepadbackend_p.h> -Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(IosGamepadManager)); +Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(DarwinGamepadManager)); QT_BEGIN_NAMESPACE -class QIosGamepadBackend : public QGamepadBackend +class QDarwinGamepadBackend : public QGamepadBackend { Q_OBJECT public: - explicit QIosGamepadBackend(QObject *parent = 0); - ~QIosGamepadBackend(); + explicit QDarwinGamepadBackend(QObject *parent = 0); + ~QDarwinGamepadBackend(); protected: bool start(); void stop(); public slots: - void iosGamepadAdded(int index); - void iosGamepadRemoved(int index); - void iosGamepadAxisMoved(int index, QGamepadManager::GamepadAxis axis, double value); - void iosGamepadButtonPressed(int index, QGamepadManager::GamepadButton button, double value); - void iosGamepadButtonReleased(int index, QGamepadManager::GamepadButton button); + void darwinGamepadAdded(int index); + void darwinGamepadRemoved(int index); + void darwinGamepadAxisMoved(int index, QGamepadManager::GamepadAxis axis, double value); + void darwinGamepadButtonPressed(int index, QGamepadManager::GamepadButton button, double value); + void darwinGamepadButtonReleased(int index, QGamepadManager::GamepadButton button); void handlePauseButton(int index); private: - QT_MANGLE_NAMESPACE(IosGamepadManager) *m_iosGamepadManager; + QT_MANGLE_NAMESPACE(DarwinGamepadManager) *m_darwinGamepadManager; bool m_isMonitoringActive; QMap<int, bool> m_pauseButtonMap; }; QT_END_NAMESPACE -#endif // QIOSGAMEPADCONTROLLER_H +#endif // QDARWINGAMEPADCONTROLLER_H diff --git a/src/plugins/gamepads/gamepads.pro b/src/plugins/gamepads/gamepads.pro index 980f81f..f2ce56b 100644 --- a/src/plugins/gamepads/gamepads.pro +++ b/src/plugins/gamepads/gamepads.pro @@ -2,5 +2,5 @@ TEMPLATE = subdirs config_sdl:SUBDIRS += sdl2 !android: contains(QT_CONFIG, evdev): SUBDIRS += evdev win32: !wince*: SUBDIRS += xinput -ios: SUBDIRS += ios +darwin: SUBDIRS += darwin android: SUBDIRS += android diff --git a/src/plugins/gamepads/ios/ios.json b/src/plugins/gamepads/ios/ios.json deleted file mode 100644 index f0b766d..0000000 --- a/src/plugins/gamepads/ios/ios.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Keys": [ "ios" ] -} |