From c0165f8b48852a1aca782d606ba4f1ea48eee6ba Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 5 Apr 2018 03:23:38 +0200 Subject: modules: now use i18n --- filter-accela/ftnoir_filter_accela.h | 5 +++-- filter-ewma2/ftnoir_filter_ewma2.h | 5 +++-- filter-kalman/kalman.h | 5 +++-- proto-flightgear/ftnoir_protocol_fg.cpp | 2 +- proto-flightgear/ftnoir_protocol_fg.h | 12 ++++++++---- proto-fsuipc/ftnoir_protocol_fsuipc.cpp | 2 +- proto-fsuipc/ftnoir_protocol_fsuipc.h | 11 +++++++---- proto-ft/ftnoir_protocol_ft.cpp | 4 ++-- proto-ft/ftnoir_protocol_ft.h | 10 +++++++--- proto-iokit-foohid/iokitprotocol.h | 5 +++-- proto-libevdev/ftnoir_protocol_libevdev.h | 16 +++++++++++----- proto-mouse/ftnoir_protocol_mouse.cpp | 2 +- proto-mouse/ftnoir_protocol_mouse.h | 10 +++++++--- proto-simconnect/ftnoir_protocol_sc.cpp | 2 +- proto-simconnect/ftnoir_protocol_sc.h | 10 ++++++---- proto-udp/ftnoir_protocol_ftn.h | 10 ++++++---- proto-vjoystick/vjoystick.cpp | 14 +++++++------- proto-vjoystick/vjoystick.h | 11 +++++++---- proto-wine/ftnoir_protocol_wine.h | 3 ++- tracker-aruco/ftnoir_tracker_aruco.h | 1 + tracker-freepie-udp/ftnoir_tracker_freepie-udp.h | 5 +++-- tracker-fusion/fusion.h | 5 +++-- tracker-hatire/ftnoir_tracker_hat.h | 4 +++- tracker-hydra/ftnoir_tracker_hydra.h | 3 ++- tracker-joystick/ftnoir_tracker_joystick.h | 5 +++-- tracker-pt/export.hpp | 15 --------------- tracker-pt/module/export.hpp | 11 +++++++++++ tracker-pt/module/module.cpp | 11 ++++------- tracker-pt/module/module.hpp | 18 ++++++++++++++++++ tracker-pt/pt-api.hpp | 16 +++++++--------- tracker-pt/pt-settings.hpp | 1 - tracker-rift-025/ftnoir_tracker_rift_025.h | 5 +++-- tracker-rift-042/ftnoir_tracker_rift_042.h | 5 +++-- tracker-rift-080/ftnoir_tracker_rift_080.h | 5 +++-- tracker-rift-140/rift-140.hpp | 5 +++-- tracker-rs/ftnoir_tracker_rs.cpp | 2 +- tracker-rs/ftnoir_tracker_rs.h | 3 ++- tracker-s2bot/ftnoir_tracker_s2bot.h | 5 +++-- tracker-steamvr/steamvr.hpp | 5 +++-- tracker-test/test.h | 5 +++-- tracker-tobii-eyex/tobii-eyex.cpp | 2 +- tracker-tobii-eyex/tobii-eyex.hpp | 7 +++++-- tracker-udp/ftnoir_tracker_udp.h | 5 +++-- tracker-wii/export.hpp | 11 +++++++++++ tracker-wii/wii_module.cpp | 17 ++++++++++------- tracker-wii/wii_module.hpp | 14 ++++++++++++++ 46 files changed, 209 insertions(+), 121 deletions(-) delete mode 100644 tracker-pt/export.hpp create mode 100644 tracker-pt/module/export.hpp create mode 100644 tracker-pt/module/module.hpp create mode 100644 tracker-wii/export.hpp create mode 100644 tracker-wii/wii_module.hpp diff --git a/filter-accela/ftnoir_filter_accela.h b/filter-accela/ftnoir_filter_accela.h index 1d7925dc..8cf74ac1 100644 --- a/filter-accela/ftnoir_filter_accela.h +++ b/filter-accela/ftnoir_filter_accela.h @@ -56,7 +56,8 @@ private slots: class accelaDll : public Metadata { -public: - QString name() { return otr_tr("Accela"); } + Q_OBJECT + + QString name() { return tr("Accela"); } QIcon icon() { return QIcon(":/images/filter-16.png"); } }; diff --git a/filter-ewma2/ftnoir_filter_ewma2.h b/filter-ewma2/ftnoir_filter_ewma2.h index 426af0c9..ea2d6e41 100644 --- a/filter-ewma2/ftnoir_filter_ewma2.h +++ b/filter-ewma2/ftnoir_filter_ewma2.h @@ -58,7 +58,8 @@ private slots: class ewmaDll : public Metadata { -public: - QString name() { return otr_tr("EWMA"); } + Q_OBJECT + + QString name() { return tr("EWMA"); } QIcon icon() { return QIcon(":/images/filter-16.png"); } }; diff --git a/filter-kalman/kalman.h b/filter-kalman/kalman.h index 431041dc..decd540d 100644 --- a/filter-kalman/kalman.h +++ b/filter-kalman/kalman.h @@ -157,8 +157,9 @@ public: class kalmanDll : public Metadata { -public: - QString name() { return otr_tr("Kalman"); } + Q_OBJECT + + QString name() { return tr("Kalman"); } QIcon icon() { return QIcon(":/images/filter-16.png"); } }; diff --git a/proto-flightgear/ftnoir_protocol_fg.cpp b/proto-flightgear/ftnoir_protocol_fg.cpp index b36a2f47..c06feefb 100644 --- a/proto-flightgear/ftnoir_protocol_fg.cpp +++ b/proto-flightgear/ftnoir_protocol_fg.cpp @@ -30,7 +30,7 @@ module_status flightgear::initialize() if (outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) return status_ok(); else - return error(otr_tr("Can't bind to [%1.%2.%3.%4]:%5") + return error(tr("Can't bind to [%1.%2.%3.%4]:%5") .arg(s.ip1).arg(s.ip2).arg(s.ip3).arg(s.ip4) .arg(s.port)); } diff --git a/proto-flightgear/ftnoir_protocol_fg.h b/proto-flightgear/ftnoir_protocol_fg.h index f92c3072..45cd0cad 100644 --- a/proto-flightgear/ftnoir_protocol_fg.h +++ b/proto-flightgear/ftnoir_protocol_fg.h @@ -15,6 +15,7 @@ #include #include "api/plugin-api.hpp" #include "options/options.hpp" +#include "compat/tr.hpp" using namespace options; // x,y,z position in meters, heading, pitch and roll in degrees @@ -38,11 +39,13 @@ struct settings : opts { {} }; -class flightgear : public IProtocol +class flightgear : TR, public IProtocol { + Q_OBJECT + public: void pose(const double *headpose); - QString game_name() { return otr_tr("FlightGear"); } + QString game_name() { return tr("FlightGear"); } module_status initialize() override; private: settings s; @@ -68,7 +71,8 @@ private slots: class flightgearDll : public Metadata { -public: - QString name() { return otr_tr("FlightGear"); } + Q_OBJECT + + QString name() { return tr("FlightGear"); } QIcon icon() { return QIcon(":/images/flightgear.png"); } }; diff --git a/proto-fsuipc/ftnoir_protocol_fsuipc.cpp b/proto-fsuipc/ftnoir_protocol_fsuipc.cpp index 64a14f5f..4db85ac5 100644 --- a/proto-fsuipc/ftnoir_protocol_fsuipc.cpp +++ b/proto-fsuipc/ftnoir_protocol_fsuipc.cpp @@ -150,7 +150,7 @@ module_status fsuipc::initialize() FSUIPCLib.setLoadHints(QLibrary::PreventUnloadHint); if (FSUIPCLib.load() != true) - return error(_("Can't load fsuipc at '%1'").arg(s.LocationOfDLL)); + return error(tr("Can't load fsuipc at '%1'").arg(s.LocationOfDLL)); else return status_ok(); } diff --git a/proto-fsuipc/ftnoir_protocol_fsuipc.h b/proto-fsuipc/ftnoir_protocol_fsuipc.h index c0560efe..fa8bcd45 100644 --- a/proto-fsuipc/ftnoir_protocol_fsuipc.h +++ b/proto-fsuipc/ftnoir_protocol_fsuipc.h @@ -45,14 +45,16 @@ typedef struct } TFSState; #pragma pack(pop) -class fsuipc : public IProtocol +class fsuipc : public TR, public IProtocol { + Q_OBJECT + public: fsuipc(); ~fsuipc() override; module_status initialize() override; void pose(const double* headpose); - QString game_name() { return otr_tr("Microsoft Flight Simulator X"); } + QString game_name() { return tr("Microsoft Flight Simulator X"); } private: QLibrary FSUIPCLib; double prevPosX, prevPosY, prevPosZ, prevRotX, prevRotY, prevRotZ; @@ -80,8 +82,9 @@ private slots: class fsuipcDll : public Metadata { -public: - QString name() { return otr_tr("FSUIPC -- Microsoft FS2002/FS2004"); } + Q_OBJECT + + QString name() { return tr("FSUIPC -- Microsoft FS2002/FS2004"); } QIcon icon() { return QIcon(":/images/fs9.png"); } }; diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp index 1c3dcafe..6b245ed3 100644 --- a/proto-ft/ftnoir_protocol_ft.cpp +++ b/proto-ft/ftnoir_protocol_ft.cpp @@ -115,7 +115,7 @@ void freetrack::pose(const double* headpose) (void)CSV::getGameData(id, t.table, gamename); if (gamename.isEmpty() && id > 0) - gamename = _("Unknown game"); + gamename = tr("Unknown game"); static_assert(sizeof(LONG) == 4, ""); static_assert(sizeof(int) == 4, ""); @@ -171,7 +171,7 @@ void freetrack::set_protocols(bool ft, bool npclient) module_status freetrack::initialize() { if (!shm.success()) - return error(_("Can't load freetrack memory mapping")); + return error(tr("Can't load freetrack memory mapping")); bool use_ft = false, use_npclient = false; diff --git a/proto-ft/ftnoir_protocol_ft.h b/proto-ft/ftnoir_protocol_ft.h index 843d1f34..18a5596f 100644 --- a/proto-ft/ftnoir_protocol_ft.h +++ b/proto-ft/ftnoir_protocol_ft.h @@ -13,6 +13,7 @@ #include "freetrackclient/fttypes.h" #include "compat/shm.h" +#include "compat/tr.hpp" #include "options/options.hpp" #include "api/plugin-api.hpp" @@ -33,8 +34,10 @@ struct settings : opts { {} }; -class freetrack : public IProtocol +class freetrack : public TR, public IProtocol { + Q_OBJECT + public: freetrack(); ~freetrack() override; @@ -81,7 +84,8 @@ private slots: class freetrackDll : public Metadata { -public: - QString name() { return otr_tr("freetrack 2.0 Enhanced"); } + Q_OBJECT + + QString name() { return tr("freetrack 2.0 Enhanced"); } QIcon icon() { return QIcon(":/images/freetrack.png"); } }; diff --git a/proto-iokit-foohid/iokitprotocol.h b/proto-iokit-foohid/iokitprotocol.h index e3a1355c..2590b382 100644 --- a/proto-iokit-foohid/iokitprotocol.h +++ b/proto-iokit-foohid/iokitprotocol.h @@ -28,7 +28,8 @@ private: class IOKitProtocolMetadata : public Metadata { -public: - QString name() { return otr_tr("Virtual joystick"); } + Q_OBJECT + + QString name() { return tr("Virtual joystick"); } QIcon icon() { return QIcon(":/images/opentrack.png"); } }; diff --git a/proto-libevdev/ftnoir_protocol_libevdev.h b/proto-libevdev/ftnoir_protocol_libevdev.h index 7cf59053..4c220df4 100644 --- a/proto-libevdev/ftnoir_protocol_libevdev.h +++ b/proto-libevdev/ftnoir_protocol_libevdev.h @@ -14,8 +14,10 @@ #include -class evdev : public IProtocol +class evdev : public TR, public IProtocol { + Q_OBJECT + public: evdev(); ~evdev() override; @@ -23,8 +25,10 @@ public: return dev != NULL; } void pose(const double *headpose); - QString game_name() { - return _("Virtual joystick for Linux"); + + QString game_name() + { + return tr("Virtual joystick for Linux"); } module_status initialize() override; @@ -37,6 +41,7 @@ private: class LibevdevControls: public IProtocolDialog { Q_OBJECT + public: LibevdevControls(); void register_protocol(IProtocol *) {} @@ -53,7 +58,8 @@ private slots: class evdevDll : public Metadata { -public: - QString name() { return _("libevdev joystick receiver"); } + Q_OBJECT + + QString name() { return tr("libevdev joystick receiver"); } QIcon icon() { return QIcon(":/images/linux.png"); } }; diff --git a/proto-mouse/ftnoir_protocol_mouse.cpp b/proto-mouse/ftnoir_protocol_mouse.cpp index b4b27ea9..9e782384 100644 --- a/proto-mouse/ftnoir_protocol_mouse.cpp +++ b/proto-mouse/ftnoir_protocol_mouse.cpp @@ -60,7 +60,7 @@ void mouse::pose(const double *headpose) QString mouse::game_name() { - return otr_tr("Mouse tracker"); + return tr("Mouse tracker"); } int mouse::get_delta(int val, int prev) diff --git a/proto-mouse/ftnoir_protocol_mouse.h b/proto-mouse/ftnoir_protocol_mouse.h index 55b26fe5..22e78b69 100644 --- a/proto-mouse/ftnoir_protocol_mouse.h +++ b/proto-mouse/ftnoir_protocol_mouse.h @@ -10,13 +10,16 @@ #include "ui_ftnoir_mousecontrols.h" #include "mouse-settings.hpp" +#include "compat/tr.hpp" #include #include "api/plugin-api.hpp" using namespace options; -class mouse : public IProtocol +class mouse : public TR, public IProtocol { + Q_OBJECT + public: mouse(); module_status initialize() override { return status_ok(); } @@ -48,7 +51,8 @@ private slots: class mouseDll : public Metadata { -public: - QString name() { return otr_tr("mouse emulation"); } + Q_OBJECT + + QString name() { return tr("mouse emulation"); } QIcon icon() { return QIcon(":/images/mouse.png"); } }; diff --git a/proto-simconnect/ftnoir_protocol_sc.cpp b/proto-simconnect/ftnoir_protocol_sc.cpp index 6a695cb1..05cc3d0b 100644 --- a/proto-simconnect/ftnoir_protocol_sc.cpp +++ b/proto-simconnect/ftnoir_protocol_sc.cpp @@ -170,7 +170,7 @@ module_status simconnect::initialize() return error(tr("dll load failed -- %1").arg(SCClientLib.errorString())); } else - return error(_("can't load SDK -- check selected simconnect version")); + return error(tr("can't load SDK -- check selected simconnect version")); } simconnect_open = (importSimConnect_Open) SCClientLib.resolve("SimConnect_Open"); diff --git a/proto-simconnect/ftnoir_protocol_sc.h b/proto-simconnect/ftnoir_protocol_sc.h index 6f9a908f..6932bfc8 100644 --- a/proto-simconnect/ftnoir_protocol_sc.h +++ b/proto-simconnect/ftnoir_protocol_sc.h @@ -43,8 +43,9 @@ public: module_status initialize() override; void pose(const double* headpose); void handle(); - QString game_name() { - return otr_tr("FS2004/FSX"); + QString game_name() + { + return tr("FS2004/FSX"); } private: enum { @@ -110,7 +111,8 @@ private slots: class simconnectDll : public Metadata { -public: - QString name() { return otr_tr("Microsoft FSX SimConnect"); } + Q_OBJECT + + QString name() { return tr("Microsoft FSX SimConnect"); } QIcon icon() { return QIcon(":/images/fsx.png"); } }; diff --git a/proto-udp/ftnoir_protocol_ftn.h b/proto-udp/ftnoir_protocol_ftn.h index c0454699..5fc72d91 100644 --- a/proto-udp/ftnoir_protocol_ftn.h +++ b/proto-udp/ftnoir_protocol_ftn.h @@ -36,8 +36,9 @@ public: udp(); module_status initialize() override; void pose(const double *headpose); - QString game_name() { - return otr_tr("UDP over network"); + QString game_name() + { + return tr("UDP over network"); } private: QUdpSocket outSocket; @@ -69,7 +70,8 @@ private slots: class udpDll : public Metadata { -public: - QString name() { return otr_tr("UDP over network"); } + Q_OBJECT + + QString name() { return tr("UDP over network"); } QIcon icon() { return QIcon(":/images/opentrack.png"); } }; diff --git a/proto-vjoystick/vjoystick.cpp b/proto-vjoystick/vjoystick.cpp index e5e18157..a55f8ca4 100644 --- a/proto-vjoystick/vjoystick.cpp +++ b/proto-vjoystick/vjoystick.cpp @@ -115,11 +115,11 @@ module_status vjoystick_proto::initialize() { QMessageBox msgbox; msgbox.setIcon(QMessageBox::Critical); - msgbox.setText(otr_tr("vjoystick driver missing")); - msgbox.setInformativeText(otr_tr("vjoystick won't work without the driver installed.")); + msgbox.setText(tr("vjoystick driver missing")); + msgbox.setInformativeText(tr("vjoystick won't work without the driver installed.")); - QPushButton* driver_button = msgbox.addButton(otr_tr("Download the driver"), QMessageBox::ActionRole); - QPushButton* project_site_button = msgbox.addButton(otr_tr("Visit project site"), QMessageBox::ActionRole); + QPushButton* driver_button = msgbox.addButton(tr("Download the driver"), QMessageBox::ActionRole); + QPushButton* project_site_button = msgbox.addButton(tr("Visit project site"), QMessageBox::ActionRole); msgbox.addButton(QMessageBox::Close); (void) msgbox.exec(); @@ -139,13 +139,13 @@ module_status vjoystick_proto::initialize() switch (h.get_state()) { case state_notent: - return error(_("vjoystick not installed or disabled")); + return error(tr("vjoystick not installed or disabled")); case state_fail: - return error(_("can't initialize vjoystick")); + return error(tr("can't initialize vjoystick")); case state_success: return status_ok(); default: - return error(_("unknown error")); + return error(tr("unknown error")); } } diff --git a/proto-vjoystick/vjoystick.h b/proto-vjoystick/vjoystick.h index 72dde0f0..d859d8a9 100644 --- a/proto-vjoystick/vjoystick.h +++ b/proto-vjoystick/vjoystick.h @@ -38,15 +38,17 @@ public: LONG to_axis_value(unsigned axis_id, double val); }; -class vjoystick_proto : public IProtocol +class vjoystick_proto : public TR, public IProtocol { + Q_OBJECT + handle h; public: vjoystick_proto(); ~vjoystick_proto() override; module_status initialize() override; void pose( const double *headpose ) override; - QString game_name() override { return otr_tr("Virtual joystick"); } + QString game_name() override { return tr("Virtual joystick"); } private: }; @@ -64,7 +66,8 @@ private: class vjoystick_metadata : public Metadata { -public: - QString name() { return otr_tr("Joystick emulation -- vjoystick"); } + Q_OBJECT + + QString name() { return tr("Joystick emulation -- vjoystick"); } QIcon icon() { return QIcon(":/images/vjoystick.png"); } }; diff --git a/proto-wine/ftnoir_protocol_wine.h b/proto-wine/ftnoir_protocol_wine.h index 0f300ff3..b0737613 100644 --- a/proto-wine/ftnoir_protocol_wine.h +++ b/proto-wine/ftnoir_protocol_wine.h @@ -53,7 +53,8 @@ private slots: class wineDll : public Metadata { -public: + Q_OBJECT + QString name() override { return QString("Wine -- Windows layer for Unix"); } QIcon icon() override { return QIcon(":/images/wine.png"); } }; diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h index b753fdec..e671046a 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.h +++ b/tracker-aruco/ftnoir_tracker_aruco.h @@ -168,6 +168,7 @@ private Q_SLOTS: class aruco_metadata : public Metadata { + Q_OBJECT QString name() { return QString("aruco -- paper marker tracker"); } QIcon icon() { return QIcon(":/images/aruco.png"); } }; diff --git a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.h b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.h index cc5d0be0..522f3b80 100644 --- a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.h +++ b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.h @@ -61,8 +61,9 @@ private slots: class meta_freepie : public Metadata { -public: - QString name() { return otr_tr("FreePIE UDP receiver"); } + Q_OBJECT + + QString name() { return tr("FreePIE UDP receiver"); } QIcon icon() { return QIcon(":/glovepie.png"); } }; diff --git a/tracker-fusion/fusion.h b/tracker-fusion/fusion.h index 6b0e0b1e..9b199487 100644 --- a/tracker-fusion/fusion.h +++ b/tracker-fusion/fusion.h @@ -51,8 +51,9 @@ private slots: class fusion_metadata : public Metadata { -public: - QString name() { return otr_tr("Fusion"); } + Q_OBJECT + + QString name() { return tr("Fusion"); } QIcon icon() { return QIcon(":/images/fusion-tracker-logo.png"); } }; diff --git a/tracker-hatire/ftnoir_tracker_hat.h b/tracker-hatire/ftnoir_tracker_hat.h index 0f4b2c9c..b1faacd3 100644 --- a/tracker-hatire/ftnoir_tracker_hat.h +++ b/tracker-hatire/ftnoir_tracker_hat.h @@ -48,6 +48,8 @@ private: class hatire_metadata : public Metadata { - QString name() { return otr_tr("Hatire Arduino"); } + Q_OBJECT + + QString name() { return tr("Hatire Arduino"); } QIcon icon() { return QIcon(":/images/hat.png"); } }; diff --git a/tracker-hydra/ftnoir_tracker_hydra.h b/tracker-hydra/ftnoir_tracker_hydra.h index 474a93f8..9d0ab835 100644 --- a/tracker-hydra/ftnoir_tracker_hydra.h +++ b/tracker-hydra/ftnoir_tracker_hydra.h @@ -41,7 +41,8 @@ private slots: class hydraDll : public Metadata { -public: + Q_OBJECT + QString name() { return QString("Razer Hydra -- inertial device"); } QIcon icon() { return QIcon(":/images/opentrack.png"); } }; diff --git a/tracker-joystick/ftnoir_tracker_joystick.h b/tracker-joystick/ftnoir_tracker_joystick.h index f84a13d2..c61a1c8f 100644 --- a/tracker-joystick/ftnoir_tracker_joystick.h +++ b/tracker-joystick/ftnoir_tracker_joystick.h @@ -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-pt/export.hpp b/tracker-pt/export.hpp deleted file mode 100644 index cef63f83..00000000 --- a/tracker-pt/export.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// generates export.hpp for each module from compat/linkage.hpp - -#pragma once - -#if 0 -# include "compat/linkage-macros.hpp" -# ifdef BUILD_TRACKER_PT -# define OTR_PT_EXPORT OTR_GENERIC_EXPORT -# else -# define OTR_PT_EXPORT OTR_GENERIC_IMPORT -# endif -#else -// static link -# define OTR_PT_EXPORT -#endif diff --git a/tracker-pt/module/export.hpp b/tracker-pt/module/export.hpp new file mode 100644 index 00000000..a733c9fe --- /dev/null +++ b/tracker-pt/module/export.hpp @@ -0,0 +1,11 @@ +// generates export.hpp for each module from compat/linkage.hpp + +#pragma once + +#include "compat/linkage-macros.hpp" + +#ifdef BUILD_TRACKER_PT +# define OTR_PT_EXPORT OTR_GENERIC_EXPORT +#else +# define OTR_PT_EXPORT OTR_GENERIC_IMPORT +#endif diff --git a/tracker-pt/module/module.cpp b/tracker-pt/module/module.cpp index 5c298ca5..4731175a 100644 --- a/tracker-pt/module/module.cpp +++ b/tracker-pt/module/module.cpp @@ -1,6 +1,6 @@ #include "ftnoir_tracker_pt.h" -#include "api/plugin-api.hpp" +#include "module.hpp" #include "camera.h" #include "frame.hpp" #include "point_extractor.h" @@ -54,16 +54,13 @@ struct dialog_pt : TrackerDialog_PT dialog_pt(); }; -class metadata_pt : public Metadata -{ - QString name() { return _("PointTracker 1.1"); } - QIcon icon() { return QIcon(":/Resources/Logo_IR.png"); } -}; - // ns pt_module using namespace pt_module; dialog_pt::dialog_pt() : TrackerDialog_PT(module_name) {} +QString metadata_pt::name() { return tr("PointTracker 1.1"); } +QIcon metadata_pt::icon() { return QIcon(":/Resources/Logo_IR.png"); } + OPENTRACK_DECLARE_TRACKER(tracker_pt, dialog_pt, metadata_pt) diff --git a/tracker-pt/module/module.hpp b/tracker-pt/module/module.hpp new file mode 100644 index 00000000..4a2cb919 --- /dev/null +++ b/tracker-pt/module/module.hpp @@ -0,0 +1,18 @@ +#pragma once + +#include "api/plugin-api.hpp" +#include +#include + +namespace pt_module +{ + +class Q_DECL_EXPORT metadata_pt : public Metadata +{ + Q_OBJECT + + QString name(); + QIcon icon(); +}; + +} // ns pt_module diff --git a/tracker-pt/pt-api.hpp b/tracker-pt/pt-api.hpp index de097a04..ba200253 100644 --- a/tracker-pt/pt-api.hpp +++ b/tracker-pt/pt-api.hpp @@ -1,7 +1,5 @@ #pragma once -#include "export.hpp" - #include "pt-settings.hpp" #include "cv/numeric.hpp" @@ -15,7 +13,7 @@ #include -struct OTR_PT_EXPORT pt_camera_info final +struct pt_camera_info final { typedef typename types::f f; @@ -30,13 +28,13 @@ struct OTR_PT_EXPORT pt_camera_info final int idx = -1; }; -struct OTR_PT_EXPORT pt_pixel_pos_mixin +struct pt_pixel_pos_mixin { static std::tuple to_pixel_pos(double x, double y, int w, int h); static std::tuple to_screen_pos(double px, double py, int w, int h); }; -struct OTR_PT_EXPORT pt_frame : pt_pixel_pos_mixin +struct pt_frame : pt_pixel_pos_mixin { pt_frame(); virtual ~pt_frame(); @@ -57,14 +55,14 @@ struct OTR_PT_EXPORT pt_frame : pt_pixel_pos_mixin } }; -struct OTR_PT_EXPORT pt_preview : pt_frame +struct pt_preview : pt_frame { virtual pt_preview& operator=(const pt_frame&) = 0; virtual QImage get_bitmap() = 0; virtual void draw_head_center(double x, double y) = 0; }; -struct OTR_PT_EXPORT pt_camera +struct pt_camera { using result = std::tuple; @@ -85,7 +83,7 @@ struct OTR_PT_EXPORT pt_camera virtual void show_camera_settings() = 0; }; -struct OTR_PT_EXPORT pt_point_extractor : pt_pixel_pos_mixin +struct pt_point_extractor : pt_pixel_pos_mixin { using vec2 = types::vec2; @@ -96,7 +94,7 @@ struct OTR_PT_EXPORT pt_point_extractor : pt_pixel_pos_mixin static double threshold_radius_value(int w, int h, int threshold); }; -struct OTR_PT_EXPORT pt_runtime_traits +struct pt_runtime_traits { template using pointer = std::shared_ptr; diff --git a/tracker-pt/pt-settings.hpp b/tracker-pt/pt-settings.hpp index 471bb941..a1b9d4f6 100644 --- a/tracker-pt/pt-settings.hpp +++ b/tracker-pt/pt-settings.hpp @@ -1,6 +1,5 @@ #pragma once -#include "export.hpp" #include "options/options.hpp" #include diff --git a/tracker-rift-025/ftnoir_tracker_rift_025.h b/tracker-rift-025/ftnoir_tracker_rift_025.h index f71c3cd8..18b3cb8d 100644 --- a/tracker-rift-025/ftnoir_tracker_rift_025.h +++ b/tracker-rift-025/ftnoir_tracker_rift_025.h @@ -58,8 +58,9 @@ private slots: class rift_025Dll : public Metadata { -public: - QString name() { return otr_tr("Oculus Rift runtime 0.2.5 -- HMD"); } + Q_OBJECT + + QString name() { return tr("Oculus Rift runtime 0.2.5 -- HMD"); } QIcon icon() { return QIcon(":/images/rift_tiny.png"); } }; diff --git a/tracker-rift-042/ftnoir_tracker_rift_042.h b/tracker-rift-042/ftnoir_tracker_rift_042.h index a662b564..b620a76c 100644 --- a/tracker-rift-042/ftnoir_tracker_rift_042.h +++ b/tracker-rift-042/ftnoir_tracker_rift_042.h @@ -55,8 +55,9 @@ private slots: class rift_042Dll : public Metadata { -public: - QString name() { return otr_tr("Oculus Rift runtime 0.4.2 -- HMD"); } + Q_OBJECT + + QString name() { return tr("Oculus Rift runtime 0.4.2 -- HMD"); } QIcon icon() { return QIcon(":/images/rift_tiny.png"); } }; diff --git a/tracker-rift-080/ftnoir_tracker_rift_080.h b/tracker-rift-080/ftnoir_tracker_rift_080.h index e5e92e3d..bcdd8c25 100644 --- a/tracker-rift-080/ftnoir_tracker_rift_080.h +++ b/tracker-rift-080/ftnoir_tracker_rift_080.h @@ -52,8 +52,9 @@ private slots: class rift_080Dll : public Metadata { -public: - QString name() { return otr_tr("Oculus Rift runtime 0.8.0 -- HMD"); } + Q_OBJECT + + QString name() { return tr("Oculus Rift runtime 0.8.0 -- HMD"); } QIcon icon() { return QIcon(":/images/rift_tiny.png"); } }; diff --git a/tracker-rift-140/rift-140.hpp b/tracker-rift-140/rift-140.hpp index 1a6714d5..dd314432 100644 --- a/tracker-rift-140/rift-140.hpp +++ b/tracker-rift-140/rift-140.hpp @@ -53,8 +53,9 @@ private slots: class rift_140Dll : public Metadata { -public: - QString name() { return otr_tr("Oculus Rift runtime 1.4.0 -- HMD"); } + Q_OBJECT + + QString name() { return tr("Oculus Rift runtime 1.4.0 -- HMD"); } QIcon icon() { return QIcon(":/images/rift_tiny.png"); } }; diff --git a/tracker-rs/ftnoir_tracker_rs.cpp b/tracker-rs/ftnoir_tracker_rs.cpp index 7918b6dc..12e56f00 100644 --- a/tracker-rs/ftnoir_tracker_rs.cpp +++ b/tracker-rs/ftnoir_tracker_rs.cpp @@ -147,7 +147,7 @@ RSTracker::~RSTracker() { } QString RSTrackerMetaData::name() { - return otr_tr("Intel® RealSense™ Technology"); + return tr("Intel® RealSense™ Technology"); } QIcon RSTrackerMetaData::icon() { diff --git a/tracker-rs/ftnoir_tracker_rs.h b/tracker-rs/ftnoir_tracker_rs.h index bcf787a0..881e03ca 100644 --- a/tracker-rs/ftnoir_tracker_rs.h +++ b/tracker-rs/ftnoir_tracker_rs.h @@ -48,7 +48,8 @@ private slots: class RSTrackerMetaData : public Metadata { -public: + Q_OBJECT + QString name(); QIcon icon(); }; diff --git a/tracker-s2bot/ftnoir_tracker_s2bot.h b/tracker-s2bot/ftnoir_tracker_s2bot.h index eddf58f4..b05a226c 100644 --- a/tracker-s2bot/ftnoir_tracker_s2bot.h +++ b/tracker-s2bot/ftnoir_tracker_s2bot.h @@ -65,8 +65,9 @@ private slots: class meta_s2bot : public Metadata { -public: - QString name() { return otr_tr("S2Bot receiver"); } + Q_OBJECT + + QString name() { return tr("S2Bot receiver"); } QIcon icon() { return QIcon(":/s2bot.png"); } }; diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp index 479f517f..fb7cd4c5 100644 --- a/tracker-steamvr/steamvr.hpp +++ b/tracker-steamvr/steamvr.hpp @@ -106,7 +106,8 @@ private slots: class steamvr_metadata : public Metadata { -public: - QString name() override { return otr_tr("Valve SteamVR"); } + Q_OBJECT + + QString name() override { return tr("Valve SteamVR"); } QIcon icon() override { return QIcon(":/images/rift_tiny.png"); } }; diff --git a/tracker-test/test.h b/tracker-test/test.h index c7f19698..3d5e92bd 100644 --- a/tracker-test/test.h +++ b/tracker-test/test.h @@ -36,8 +36,9 @@ private slots: class test_metadata : public Metadata { -public: - QString name() { return _("Testing - sine wave"); } + Q_OBJECT + + QString name() { return tr("Testing - sine wave"); } QIcon icon() { return QIcon(":/images/opentrack.png"); } }; diff --git a/tracker-tobii-eyex/tobii-eyex.cpp b/tracker-tobii-eyex/tobii-eyex.cpp index a559c8dd..8f2edd62 100644 --- a/tracker-tobii-eyex/tobii-eyex.cpp +++ b/tracker-tobii-eyex/tobii-eyex.cpp @@ -229,7 +229,7 @@ module_status tobii_eyex_tracker::start_tracker(QFrame*) status &= txEnableConnection(dev_ctx) == TX_RESULT_OK; if (!status) - return error(otr_tr("Connection can't be established. device missing?")); + return error(tr("Connection can't be established. device missing?")); else return status_ok(); } diff --git a/tracker-tobii-eyex/tobii-eyex.hpp b/tracker-tobii-eyex/tobii-eyex.hpp index 170e74c1..84407930 100644 --- a/tracker-tobii-eyex/tobii-eyex.hpp +++ b/tracker-tobii-eyex/tobii-eyex.hpp @@ -23,8 +23,10 @@ using namespace options; #include #include -class tobii_eyex_tracker : public ITracker +class tobii_eyex_tracker : public TR, public ITracker { + Q_OBJECT + public: tobii_eyex_tracker(); ~tobii_eyex_tracker() override; @@ -80,7 +82,8 @@ private: class tobii_eyex_metadata : public Metadata { -public: + Q_OBJECT + QString name() { return QString("Tobii EyeX"); } QIcon icon() { return QIcon(":/images/tobii-eyex-logo.png"); } }; diff --git a/tracker-udp/ftnoir_tracker_udp.h b/tracker-udp/ftnoir_tracker_udp.h index bccb2891..5a048ecb 100644 --- a/tracker-udp/ftnoir_tracker_udp.h +++ b/tracker-udp/ftnoir_tracker_udp.h @@ -53,8 +53,9 @@ private slots: class udpDll : public Metadata { -public: - QString name() { return otr_tr("UDP over network"); } + Q_OBJECT + + QString name() { return tr("UDP over network"); } QIcon icon() { return QIcon(":/images/opentrack.png"); } }; diff --git a/tracker-wii/export.hpp b/tracker-wii/export.hpp new file mode 100644 index 00000000..e186b1aa --- /dev/null +++ b/tracker-wii/export.hpp @@ -0,0 +1,11 @@ +// generates export.hpp for each module from compat/linkage.hpp + +#pragma once + +#include "compat/linkage-macros.hpp" + +#ifdef BUILD_TRACKER_WII +# define OTR_WII_EXPORT OTR_GENERIC_EXPORT +#else +# define OTR_WII_EXPORT OTR_GENERIC_IMPORT +#endif diff --git a/tracker-wii/wii_module.cpp b/tracker-wii/wii_module.cpp index 5ef75f57..9f2a4b04 100644 --- a/tracker-wii/wii_module.cpp +++ b/tracker-wii/wii_module.cpp @@ -6,11 +6,12 @@ * copyright notice and this permission notice appear in all copies. */ #include "ftnoir_tracker_pt.h" -#include "api/plugin-api.hpp" +#include "wii_module.hpp" #include "wii_camera.h" #include "wii_frame.hpp" #include "wii_point_extractor.h" +#include "wii_module.hpp" #include "ftnoir_tracker_pt_dialog.h" #include "pt-api.hpp" @@ -62,18 +63,20 @@ struct wii_dialog_pt : TrackerDialog_PT wii_dialog_pt(); }; -class wii_metadata_pt : public Metadata +QString wii_metadata_pt::name() { - QString name() { return _("WiiPointTracker 1.1"); } - QIcon icon() { return QIcon(":/Resources/wii.png"); } -}; + return tr("WiiPointTracker 1.1"); +} + +QIcon wii_metadata_pt::icon() +{ + return QIcon(":/Resources/wii.png"); +} // ns pt_module using namespace pt_module; - - wii_dialog_pt::wii_dialog_pt() : TrackerDialog_PT(module_name) { ui.tabWidget->removeTab(0); diff --git a/tracker-wii/wii_module.hpp b/tracker-wii/wii_module.hpp new file mode 100644 index 00000000..34a8561d --- /dev/null +++ b/tracker-wii/wii_module.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include "api/plugin-api.hpp" + +#include +#include + +class Q_DECL_EXPORT wii_metadata_pt : public Metadata +{ + Q_OBJECT + + QString name(); + QIcon icon(); +}; -- cgit v1.2.3