diff options
Diffstat (limited to 'proto-iokit-foohid')
-rw-r--r-- | proto-iokit-foohid/CMakeLists.txt | 2 | ||||
-rw-r--r-- | proto-iokit-foohid/foohidjoystick.cpp | 10 | ||||
-rw-r--r-- | proto-iokit-foohid/foohidjoystick.h | 2 | ||||
-rw-r--r-- | proto-iokit-foohid/iokitprotocol.cpp | 18 | ||||
-rw-r--r-- | proto-iokit-foohid/lang/zh_CN.ts | 2 |
5 files changed, 16 insertions, 18 deletions
diff --git a/proto-iokit-foohid/CMakeLists.txt b/proto-iokit-foohid/CMakeLists.txt index 31d3dcdc..6a4bf89a 100644 --- a/proto-iokit-foohid/CMakeLists.txt +++ b/proto-iokit-foohid/CMakeLists.txt @@ -1,4 +1,4 @@ -if(CMAKE_SYSTEM_NAME MATCHES "Darwin") +if(APPLE) otr_module(proto-iokit-foohid) target_link_options(${self} PRIVATE -framework IOKit) endif() diff --git a/proto-iokit-foohid/foohidjoystick.cpp b/proto-iokit-foohid/foohidjoystick.cpp index 0b305d08..b4964bb7 100644 --- a/proto-iokit-foohid/foohidjoystick.cpp +++ b/proto-iokit-foohid/foohidjoystick.cpp @@ -7,8 +7,6 @@ #include "foohidjoystick.h" -#include "compat/macros.hpp" - const char FOOHID_SERVICE_NAME[] = "it_unbit_foohid"; enum class FooHIDMethod { @@ -51,7 +49,7 @@ static bool connectToService(io_connect_t *connection, QString *errorMessage) IOServiceMatching(FOOHID_SERVICE_NAME), &iterator); if (ret != KERN_SUCCESS) { - *errorMessage = otr_tr("Unable to find FooHID IOService."); + *errorMessage = QObject::tr("Unable to find FooHID IOService."); return false; } // Iterate over services and try to open connection @@ -66,7 +64,7 @@ static bool connectToService(io_connect_t *connection, QString *errorMessage) } IOObjectRelease(iterator); if (!found) { - *errorMessage = otr_tr("Unable to connect to FooHID IOService."); + *errorMessage = QObject::tr("Unable to connect to FooHID IOService."); return false; } return true; @@ -89,7 +87,7 @@ FooHIDJoystick::FooHIDJoystick(const QByteArray &name, const QByteArray &serialN deviceCreated = createDevice(); _hasError = !deviceCreated; if (!deviceCreated) - _errorMessage = otr_tr("Failed to create virtual joystick"); + _errorMessage = tr("Failed to create virtual joystick"); } } @@ -116,7 +114,7 @@ void FooHIDJoystick::setValue(JoystickValues newValues) values = newValues; if (!sendToDevice()) { _hasError = true; - _errorMessage = otr_tr("Failed to send values to virtual joystick"); + _errorMessage = tr("Failed to send values to virtual joystick"); } } diff --git a/proto-iokit-foohid/foohidjoystick.h b/proto-iokit-foohid/foohidjoystick.h index a1f74304..e987c229 100644 --- a/proto-iokit-foohid/foohidjoystick.h +++ b/proto-iokit-foohid/foohidjoystick.h @@ -9,6 +9,7 @@ #include <QByteArray> #include <QString> +#include <QCoreApplication> #include <IOKit/IOKitLib.h> @@ -23,6 +24,7 @@ struct JoystickValues { class FooHIDJoystick { + Q_DECLARE_TR_FUNCTIONS(FooHIDJoystick) public: FooHIDJoystick(const QByteArray &name, const QByteArray &serialNumber); ~FooHIDJoystick(); diff --git a/proto-iokit-foohid/iokitprotocol.cpp b/proto-iokit-foohid/iokitprotocol.cpp index 6f163d8f..a364fd8a 100644 --- a/proto-iokit-foohid/iokitprotocol.cpp +++ b/proto-iokit-foohid/iokitprotocol.cpp @@ -10,8 +10,6 @@ #include "foohidjoystick.h" #include "iokitprotocoldialog.h" -#include "compat/macros.hpp" - #include <QDebug> IOKitProtocol::IOKitProtocol() @@ -25,14 +23,14 @@ IOKitProtocol::IOKitProtocol() module_status IOKitProtocol::initialize() { if (!joystick) - return otr_tr("Load failure"); + return tr("Load failure"); if (joystick->hasError()) { QString msg = joystick->errorMessage(); if (msg.isEmpty()) - msg = otr_tr("Unknown error"); + msg = tr("Unknown error"); return error(msg); } @@ -49,12 +47,12 @@ static uint8_t valueToStick(FooHIDJoystick *stick, double min, double value, dou void IOKitProtocol::pose(const double *headpose, const double*) { - const uint8_t x = valueToStick(joystick.get(), -75., headpose[0], +75.); - const uint8_t y = valueToStick(joystick.get(), -75., headpose[1], +75.); - const uint8_t z = valueToStick(joystick.get(), -75., headpose[2], +75.); - const uint8_t rx = valueToStick(joystick.get(), -180., headpose[3], +180.); - const uint8_t ry = valueToStick(joystick.get(), -180., headpose[4], +180.); - const uint8_t rz = valueToStick(joystick.get(), -180., headpose[5], +180.); + const uint8_t x = valueToStick(&*joystick, -75., headpose[0], +75.); + const uint8_t y = valueToStick(&*joystick, -75., headpose[1], +75.); + const uint8_t z = valueToStick(&*joystick, -75., headpose[2], +75.); + const uint8_t rx = valueToStick(&*joystick, -180., headpose[3], +180.); + const uint8_t ry = valueToStick(&*joystick, -180., headpose[4], +180.); + const uint8_t rz = valueToStick(&*joystick, -180., headpose[5], +180.); joystick->setValue({x, y, z, rx, ry, rz}); } diff --git a/proto-iokit-foohid/lang/zh_CN.ts b/proto-iokit-foohid/lang/zh_CN.ts index 6401616d..e5ca8aa9 100644 --- a/proto-iokit-foohid/lang/zh_CN.ts +++ b/proto-iokit-foohid/lang/zh_CN.ts @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="zh_CN"> </TS> |