diff options
Diffstat (limited to 'tracker-joystick')
| -rw-r--r-- | tracker-joystick/ftnoir_tracker_joystick.cpp | 12 | ||||
| -rw-r--r-- | tracker-joystick/ftnoir_tracker_joystick.h | 9 | ||||
| -rw-r--r-- | tracker-joystick/ftnoir_tracker_joystick_dialog.cpp | 14 | ||||
| -rw-r--r-- | tracker-joystick/lang/nl_NL.ts | 7 | ||||
| -rw-r--r-- | tracker-joystick/lang/ru_RU.ts | 7 | ||||
| -rw-r--r-- | tracker-joystick/lang/stub.ts | 7 | ||||
| -rw-r--r-- | tracker-joystick/lang/zh_CN.ts | 9 |
7 files changed, 46 insertions, 19 deletions
diff --git a/tracker-joystick/ftnoir_tracker_joystick.cpp b/tracker-joystick/ftnoir_tracker_joystick.cpp index 27a5408d..940abfd1 100644 --- a/tracker-joystick/ftnoir_tracker_joystick.cpp +++ b/tracker-joystick/ftnoir_tracker_joystick.cpp @@ -11,10 +11,10 @@ joystick::joystick() { - if (static_cast<QString>(s.guid) == "") + if (s.guid->isEmpty()) { std::vector<win32_joy_ctx::joy_info> info = joy_ctx.get_joy_info(); - if (info.size()) + if (!info.empty()) { s.guid = info[0].guid; s.b->save(); @@ -22,9 +22,7 @@ joystick::joystick() } } -joystick::~joystick() -{ -} +joystick::~joystick() = default; void joystick::data(double *data) { @@ -58,8 +56,8 @@ void joystick::data(double *data) if (k < 0 || k >= 8) data[i] = 0; else - data[i] = clamp(axes[k] * limits[i] / AXIS_MAX, - -limits[i], limits[i]); + data[i] = std::clamp(axes[k] * limits[i] / AXIS_MAX, + -limits[i], limits[i]); } } } diff --git a/tracker-joystick/ftnoir_tracker_joystick.h b/tracker-joystick/ftnoir_tracker_joystick.h index f84a13d2..d59c70de 100644 --- a/tracker-joystick/ftnoir_tracker_joystick.h +++ b/tracker-joystick/ftnoir_tracker_joystick.h @@ -45,7 +45,7 @@ public: void data(double *data); settings s; QString guid; - static constexpr inline int AXIS_MAX = win32_joy_ctx::joy_axis_size; + static constexpr int AXIS_MAX = win32_joy_ctx::joy_axis_size; win32_joy_ctx joy_ctx; }; @@ -63,7 +63,7 @@ public: QString name; QString guid; }; - QList<joys> _joys; + QList<joys> joys_; private slots: void doOK(); void doCancel(); @@ -71,8 +71,9 @@ private slots: class joystickDll : public Metadata { -public: - QString name() { return otr_tr("Joystick input"); } + Q_OBJECT + + QString name() { return tr("Joystick input"); } QIcon icon() { return QIcon(":/images/opentrack.png"); } }; diff --git a/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp b/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp index aa4b783a..aaf3037b 100644 --- a/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp @@ -12,18 +12,18 @@ dialog_joystick::dialog_joystick() : tracker(nullptr) { win32_joy_ctx joy_ctx; - _joys = QList<joys>(); + joys_ = {}; - for (auto j : joy_ctx.get_joy_info()) - _joys.push_back(joys { j.name, j.guid }); + for (const auto& j : joy_ctx.get_joy_info()) + joys_.push_back(joys { j.name, j.guid }); } { const QString guid = s.guid; int idx = 0; - for (int i = 0; i < _joys.size(); i++) + for (int i = 0; i < joys_.size(); i++) { - const joys& j = _joys[i]; + const joys& j = joys_[i]; if (j.guid == guid) idx = i; ui.joylist->addItem(j.name + " " + j.guid); @@ -41,8 +41,8 @@ dialog_joystick::dialog_joystick() : tracker(nullptr) void dialog_joystick::doOK() { int idx = ui.joylist->currentIndex(); - joys def { "", "" }; - auto val = _joys.value(idx, def); + static const joys def { {}, {} }; + auto val = joys_.value(idx, def); s.guid = val.guid; s.b->save(); close(); diff --git a/tracker-joystick/lang/nl_NL.ts b/tracker-joystick/lang/nl_NL.ts index 0b10b88e..691b7307 100644 --- a/tracker-joystick/lang/nl_NL.ts +++ b/tracker-joystick/lang/nl_NL.ts @@ -76,4 +76,11 @@ <translation>Rol</translation> </message> </context> +<context> + <name>joystickDll</name> + <message> + <source>Joystick input</source> + <translation type="unfinished"></translation> + </message> +</context> </TS> diff --git a/tracker-joystick/lang/ru_RU.ts b/tracker-joystick/lang/ru_RU.ts index 3b1b980e..e737569e 100644 --- a/tracker-joystick/lang/ru_RU.ts +++ b/tracker-joystick/lang/ru_RU.ts @@ -76,4 +76,11 @@ <translation type="unfinished"></translation> </message> </context> +<context> + <name>joystickDll</name> + <message> + <source>Joystick input</source> + <translation type="unfinished"></translation> + </message> +</context> </TS> diff --git a/tracker-joystick/lang/stub.ts b/tracker-joystick/lang/stub.ts index 9a6e7747..a169a05c 100644 --- a/tracker-joystick/lang/stub.ts +++ b/tracker-joystick/lang/stub.ts @@ -76,4 +76,11 @@ <translation type="unfinished"></translation> </message> </context> +<context> + <name>joystickDll</name> + <message> + <source>Joystick input</source> + <translation type="unfinished"></translation> + </message> +</context> </TS> diff --git a/tracker-joystick/lang/zh_CN.ts b/tracker-joystick/lang/zh_CN.ts index 9a6e7747..b4729a64 100644 --- a/tracker-joystick/lang/zh_CN.ts +++ b/tracker-joystick/lang/zh_CN.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="zh_CN"> <context> <name>UIJoystickControls</name> <message> @@ -76,4 +76,11 @@ <translation type="unfinished"></translation> </message> </context> +<context> + <name>joystickDll</name> + <message> + <source>Joystick input</source> + <translation type="unfinished"></translation> + </message> +</context> </TS> |
