From d361f57c8064ce13a0478653050b169dc94e2e99 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 18 Jan 2018 19:35:08 +0100 Subject: compat/util: retire Adjust usages. --- compat/check-visible.hpp | 2 +- compat/clamp.hpp | 54 ---------------- compat/correlation-calibrator.cpp | 2 +- compat/library-path.hpp | 4 ++ compat/macros.hpp | 4 -- compat/math-imports.hpp | 8 +-- compat/math.hpp | 74 ++++++++++++++++++++++ compat/meta.hpp | 5 ++ compat/round.hpp | 15 ----- compat/timer.hpp | 8 +-- compat/util.hpp | 10 --- csv/csv.cpp | 2 +- cv/translation-calibrator.cpp | 4 +- cv/video-property-page.cpp | 2 +- cv/video-widget.cpp | 2 - dinput/keybinding-worker.cpp | 5 +- ext-falcon-bms-linear-acc/falcon-bms-ext.hpp | 1 - filter-accela/ftnoir_filter_accela.cpp | 4 +- gui/init.cpp | 2 +- gui/process_detector.cpp | 3 +- gui/settings.cpp | 2 +- logic/extensions.cpp | 1 - logic/pipeline.cpp | 2 +- logic/shortcuts.h | 1 - logic/work.cpp | 2 +- migration/20160917_00-accela.cpp | 1 - migration/20170420_00-udp-naming.cpp | 1 - migration/20171013_00-tracker-pt-threshold.cpp | 1 - migration/migration.cpp | 1 - options/base-value.hpp | 1 + options/bundle.hpp | 1 - options/connector.cpp | 1 - options/group.cpp | 2 +- options/group.hpp | 2 - options/options.hpp | 2 - options/slider.hpp | 3 +- options/tie.cpp | 1 + options/tie.hpp | 1 + options/value.hpp | 3 +- pose-widget/pose-widget.cpp | 3 +- proto-flightgear/ftnoir_protocol_fg_dialog.cpp | 2 +- proto-ft/ftnoir_protocol_ft.cpp | 4 +- proto-ft/ftnoir_protocol_ft_dialog.cpp | 2 +- proto-libevdev/ftnoir_protocol_libevdev.cpp | 2 - proto-mouse/ftnoir_protocol_mouse.cpp | 3 + proto-simconnect/ftnoir_protocol_sc.cpp | 2 +- proto-vjoystick/vjoystick.cpp | 2 +- proto-wine/ftnoir_protocol_wine.cpp | 2 +- proto-wine/opentrack-wrapper-wine-windows.cxx | 2 +- qxt-mini/qxtglobalshortcut.cpp | 2 - qxt-mini/qxtglobalshortcut_x11.cpp | 1 - spline/spline-widget.cpp | 2 +- spline/spline.cpp | 7 +- spline/spline.hpp | 1 - tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp | 2 +- tracker-fusion/fusion.cpp | 3 +- tracker-hatire/thread.cpp | 2 +- tracker-joystick/ftnoir_tracker_joystick.cpp | 2 +- tracker-pt/camera.h | 1 - tracker-pt/frame.cpp | 2 + tracker-pt/ftnoir_tracker_pt.h | 1 - tracker-pt/ftnoir_tracker_pt_dialog.cpp | 1 + tracker-pt/point_extractor.cpp | 5 +- tracker-pt/point_tracker.h | 4 +- tracker-rift-080/ftnoir_tracker_rift_080.cpp | 1 - tracker-rift-140/rift-140.cpp | 1 - tracker-rs/ftnoir_tracker_rs.cpp | 2 +- tracker-s2bot/ftnoir_tracker_s2bot.cpp | 2 +- tracker-steamvr/steamvr.cpp | 1 - tracker-steamvr/steamvr.hpp | 1 - tracker-test/test.h | 3 +- tracker-udp/ftnoir_tracker_udp.cpp | 1 - variant/default/main-window.cpp | 3 +- 73 files changed, 144 insertions(+), 171 deletions(-) delete mode 100644 compat/clamp.hpp create mode 100644 compat/library-path.hpp create mode 100644 compat/math.hpp delete mode 100644 compat/round.hpp delete mode 100644 compat/util.hpp diff --git a/compat/check-visible.hpp b/compat/check-visible.hpp index f5420a39..a0211982 100644 --- a/compat/check-visible.hpp +++ b/compat/check-visible.hpp @@ -1,7 +1,7 @@ #pragma once #include "export.hpp" -#include "util.hpp" +#include "macros.hpp" #include diff --git a/compat/clamp.hpp b/compat/clamp.hpp deleted file mode 100644 index 8141e25f..00000000 --- a/compat/clamp.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include -#include - -#include "macros.hpp" - -namespace util_detail { - -template -inline auto clamp_float(n val, n min_, n max_) -{ - return std::fmin(std::fmax(val, min_), max_); -} - -template -struct clamp final -{ - static inline auto clamp_(const n& val, const n& min_, const n& max_) - { - if (unlikely(val > max_)) - return max_; - if (unlikely(val < min_)) - return min_; - return val; - } -}; - -template -struct clamp -{ - static inline auto clamp_(float val, float min_, float max_) - { - return clamp_float(val, min_, max_); - } -}; - -template -struct clamp -{ - static inline auto clamp_(double val, double min_, double max_) - { - return clamp_float(val, min_, max_); - } -}; - -} // ns util_detail - -template -inline auto clamp(const t& val, const u& min, const w& max) -{ - using tp = decltype(val + min + max); - return ::util_detail::clamp, tp>::clamp_(val, min, max); -} diff --git a/compat/correlation-calibrator.cpp b/compat/correlation-calibrator.cpp index 1d3339d3..aef804d2 100644 --- a/compat/correlation-calibrator.cpp +++ b/compat/correlation-calibrator.cpp @@ -1,6 +1,6 @@ #include "correlation-calibrator.hpp" #include "variance.hpp" -#include "util.hpp" +#include "compat/math.hpp" #include #include diff --git a/compat/library-path.hpp b/compat/library-path.hpp new file mode 100644 index 00000000..e14cf5e0 --- /dev/null +++ b/compat/library-path.hpp @@ -0,0 +1,4 @@ +#pragma once + +// from build directory +#include "__opentrack-library-path.h" diff --git a/compat/macros.hpp b/compat/macros.hpp index d51bace7..766730db 100644 --- a/compat/macros.hpp +++ b/compat/macros.hpp @@ -71,7 +71,3 @@ # define unlikely(x) (x) #endif -#define progn(...) (([&]() { __VA_ARGS__ })()) -#define prog1(x, ...) (([&]() { auto _ret1324 = (x); do { __VA_ARGS__; } while (0); return _ret1324; })()) - -#define once_only(...) do { static bool once__ = false; if (!once__) { once__ = true; __VA_ARGS__; } } while(false) diff --git a/compat/math-imports.hpp b/compat/math-imports.hpp index 4d8d5a5f..67b7e6ed 100644 --- a/compat/math-imports.hpp +++ b/compat/math-imports.hpp @@ -1,11 +1,5 @@ #pragma once -template -static inline constexpr auto signum(T x) -{ - return x < T(0) ? -1 : 1; -} - #include using std::copysign; @@ -51,3 +45,5 @@ using std::uint8_t; using std::min; using std::max; + +#include "math.hpp" diff --git a/compat/math.hpp b/compat/math.hpp new file mode 100644 index 00000000..5d80dace --- /dev/null +++ b/compat/math.hpp @@ -0,0 +1,74 @@ +#pragma once + +#include "macros.hpp" + +#include +#include + +namespace util_detail { + +template +inline auto clamp_float(n val, n min_, n max_) +{ + return std::fmin(std::fmax(val, min_), max_); +} + +template +struct clamp final +{ + static inline auto clamp_(const n& val, const n& min_, const n& max_) + { + if (unlikely(val > max_)) + return max_; + if (unlikely(val < min_)) + return min_; + return val; + } +}; + +template +struct clamp +{ + static inline auto clamp_(float val, float min_, float max_) + { + return clamp_float(val, min_, max_); + } +}; + +template +struct clamp +{ + static inline auto clamp_(double val, double min_, double max_) + { + return clamp_float(val, min_, max_); + } +}; + +} // ns util_detail + +template +inline auto clamp(const t& val, const u& min, const w& max) +{ + using tp = decltype(val + min + max); + return ::util_detail::clamp, tp>::clamp_(val, min, max); +} + +template +inline int iround(const t& val) +{ + return int(std::round(val)); +} + +template +inline unsigned uround(const t& val) +{ + return std::round(std::fmax(t(0), val)); +} + +#include "macros.hpp" + +template +static force_inline constexpr auto signum(T x) +{ + return x < T(0) ? -1 : 1; +} diff --git a/compat/meta.hpp b/compat/meta.hpp index ce81b3d0..80eca89a 100644 --- a/compat/meta.hpp +++ b/compat/meta.hpp @@ -12,6 +12,11 @@ template using cv_qualified = std::conditional_t>, std::decay_t, const t&>; +#define progn(...) (([&]() { __VA_ARGS__ })()) +#define prog1(x, ...) (([&]() { auto _ret1324 = (x); do { __VA_ARGS__; } while (0); return _ret1324; })()) + +#define once_only(...) do { static bool once__ = false; if (!once__) { once__ = true; __VA_ARGS__; } } while(false) + #if 0 #include diff --git a/compat/round.hpp b/compat/round.hpp deleted file mode 100644 index 90a0ccb3..00000000 --- a/compat/round.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -template -inline int iround(const t& val) -{ - return int(std::round(val)); -} - -template -inline unsigned uround(const t& val) -{ - return std::round(std::fmax(t(0), val)); -} diff --git a/compat/timer.hpp b/compat/timer.hpp index ac255a9d..a92d3f68 100644 --- a/compat/timer.hpp +++ b/compat/timer.hpp @@ -9,6 +9,9 @@ #pragma once #include "export.hpp" +#include "time.hpp" + +#include #if defined (_WIN32) # include @@ -17,11 +20,6 @@ # include #endif -#include - -#include "time.hpp" -#include "util.hpp" - class OTR_COMPAT_EXPORT Timer final { struct timespec state; diff --git a/compat/util.hpp b/compat/util.hpp deleted file mode 100644 index dda947e5..00000000 --- a/compat/util.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "opentrack-library-path.h" -#include "run-in-thread.hpp" -#include "meta.hpp" -#include "macros.hpp" -#include "round.hpp" -#include "clamp.hpp" - -#include diff --git a/csv/csv.cpp b/csv/csv.cpp index 05df7da0..189d05d9 100644 --- a/csv/csv.cpp +++ b/csv/csv.cpp @@ -10,7 +10,7 @@ */ #include "csv.h" -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include #include #include diff --git a/cv/translation-calibrator.cpp b/cv/translation-calibrator.cpp index 8d8494b2..aac2434f 100644 --- a/cv/translation-calibrator.cpp +++ b/cv/translation-calibrator.cpp @@ -7,10 +7,12 @@ #include "translation-calibrator.hpp" #include "compat/euler.hpp" -#include "compat/util.hpp" +#include "compat/math.hpp" #include +#include + constexpr double TranslationCalibrator::pitch_spacing_in_degrees; constexpr double TranslationCalibrator::yaw_spacing_in_degrees; constexpr double TranslationCalibrator::roll_spacing_in_degrees; diff --git a/cv/video-property-page.cpp b/cv/video-property-page.cpp index 58670e83..80395c79 100644 --- a/cv/video-property-page.cpp +++ b/cv/video-property-page.cpp @@ -12,7 +12,7 @@ #include "compat/camera-names.hpp" #include "compat/sleep.hpp" #include "compat/run-in-thread.hpp" -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include diff --git a/cv/video-widget.cpp b/cv/video-widget.cpp index 146ddc3f..fd4fe350 100644 --- a/cv/video-widget.cpp +++ b/cv/video-widget.cpp @@ -9,8 +9,6 @@ #include "video-widget.hpp" #include "compat/check-visible.hpp" -#include "compat/util.hpp" - #include #include diff --git a/dinput/keybinding-worker.cpp b/dinput/keybinding-worker.cpp index 3850d80b..30d21534 100644 --- a/dinput/keybinding-worker.cpp +++ b/dinput/keybinding-worker.cpp @@ -8,9 +8,8 @@ #ifdef _WIN32 -#include "compat/sleep.hpp" -#include "compat/util.hpp" #include "keybinding-worker.hpp" +#include "compat/meta.hpp" #include #include @@ -195,7 +194,7 @@ void KeybindingWorker::run() } } - portable::sleep(100); + Sleep(100); } } diff --git a/ext-falcon-bms-linear-acc/falcon-bms-ext.hpp b/ext-falcon-bms-linear-acc/falcon-bms-ext.hpp index 6fee7a76..e08d5377 100644 --- a/ext-falcon-bms-linear-acc/falcon-bms-ext.hpp +++ b/ext-falcon-bms-linear-acc/falcon-bms-ext.hpp @@ -1,7 +1,6 @@ #pragma once #include "api/plugin-api.hpp" -#include "compat/util.hpp" struct falcon_bms_acceleration_ext : IExtension { diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp index 8a403211..c22d1c3d 100644 --- a/filter-accela/ftnoir_filter_accela.cpp +++ b/filter-accela/ftnoir_filter_accela.cpp @@ -5,10 +5,12 @@ * copyright notice and this permission notice appear in all copies. */ #include "ftnoir_filter_accela.h" +#include "compat/math.hpp" +#include "api/plugin-api.hpp" + #include #include #include -#include "api/plugin-api.hpp" #include "compat/math-imports.hpp" diff --git a/gui/init.cpp b/gui/init.cpp index 7580ba5f..e648cfa0 100644 --- a/gui/init.cpp +++ b/gui/init.cpp @@ -14,7 +14,7 @@ #include "migration/migration.hpp" #include "options/options.hpp" using namespace options; -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include #include diff --git a/gui/process_detector.cpp b/gui/process_detector.cpp index f7aeb164..b29df7fb 100644 --- a/gui/process_detector.cpp +++ b/gui/process_detector.cpp @@ -7,8 +7,9 @@ */ #include "process_detector.h" -#include "compat/process-list.hpp" #include "options/options.hpp" +#include "compat/process-list.hpp" +#include "compat/base-path.hpp" #include #include diff --git a/gui/settings.cpp b/gui/settings.cpp index c1381915..fe0b3261 100644 --- a/gui/settings.cpp +++ b/gui/settings.cpp @@ -8,7 +8,7 @@ #include "settings.hpp" #include "keyboard.h" -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include #include #include diff --git a/logic/extensions.cpp b/logic/extensions.cpp index 395d35ce..22eef6df 100644 --- a/logic/extensions.cpp +++ b/logic/extensions.cpp @@ -1,7 +1,6 @@ #include "extensions.hpp" #include -#include "compat/util.hpp" using namespace options; diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp index 43cc74c7..de7d94e6 100644 --- a/logic/pipeline.cpp +++ b/logic/pipeline.cpp @@ -14,7 +14,7 @@ #include "compat/nan.hpp" #include "compat/sleep.hpp" -#include "compat/util.hpp" +#include "compat/math.hpp" #include "pipeline.hpp" diff --git a/logic/shortcuts.h b/logic/shortcuts.h index 457c0d8e..046e68de 100644 --- a/logic/shortcuts.h +++ b/logic/shortcuts.h @@ -11,7 +11,6 @@ #include "options/options.hpp" #include "main-settings.hpp" -#include "compat/util.hpp" #ifdef _WIN32 # include "dinput/keybinding-worker.hpp" diff --git a/logic/work.cpp b/logic/work.cpp index a2d06245..cdc27b05 100644 --- a/logic/work.cpp +++ b/logic/work.cpp @@ -1,5 +1,5 @@ #include "work.hpp" -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include #include diff --git a/migration/20160917_00-accela.cpp b/migration/20160917_00-accela.cpp index c5c6f579..33d85273 100644 --- a/migration/20160917_00-accela.cpp +++ b/migration/20160917_00-accela.cpp @@ -8,7 +8,6 @@ #include "migration.hpp" #include "options/options.hpp" -#include "compat/util.hpp" #include "filter-accela/accela-settings.hpp" diff --git a/migration/20170420_00-udp-naming.cpp b/migration/20170420_00-udp-naming.cpp index b1224c5d..de4674bd 100644 --- a/migration/20170420_00-udp-naming.cpp +++ b/migration/20170420_00-udp-naming.cpp @@ -8,7 +8,6 @@ #include "migration.hpp" #include "options/options.hpp" -#include "compat/util.hpp" #include "logic/main-settings.hpp" using namespace migrations; diff --git a/migration/20171013_00-tracker-pt-threshold.cpp b/migration/20171013_00-tracker-pt-threshold.cpp index 4408ccc0..32e69f6d 100644 --- a/migration/20171013_00-tracker-pt-threshold.cpp +++ b/migration/20171013_00-tracker-pt-threshold.cpp @@ -8,7 +8,6 @@ #include "migration.hpp" #include "options/options.hpp" -#include "compat/util.hpp" //#include "tracker-pt/ftnoir_tracker_pt_settings.h" using namespace options; diff --git a/migration/migration.cpp b/migration/migration.cpp index 747ea06b..b92d6384 100644 --- a/migration/migration.cpp +++ b/migration/migration.cpp @@ -11,7 +11,6 @@ #include "migration.hpp" #include "options/options.hpp" -#include "compat/util.hpp" #include #include diff --git a/options/base-value.hpp b/options/base-value.hpp index aabced2a..b094d693 100644 --- a/options/base-value.hpp +++ b/options/base-value.hpp @@ -5,6 +5,7 @@ #include "connector.hpp" #include "export.hpp" +#include "compat/meta.hpp" #include #include diff --git a/options/bundle.hpp b/options/bundle.hpp index b6189ba6..9b7b7f02 100644 --- a/options/bundle.hpp +++ b/options/bundle.hpp @@ -25,7 +25,6 @@ #include -#include "compat/util.hpp" #include "export.hpp" namespace options { diff --git a/options/connector.cpp b/options/connector.cpp index 075a57e1..6031d9ed 100644 --- a/options/connector.cpp +++ b/options/connector.cpp @@ -6,7 +6,6 @@ * notice appear in all copies. */ -#include "compat/util.hpp" #include "connector.hpp" #include "value.hpp" diff --git a/options/group.cpp b/options/group.cpp index 2d5588a1..69378d51 100644 --- a/options/group.cpp +++ b/options/group.cpp @@ -10,7 +10,7 @@ #include "defs.hpp" #include "compat/timer.hpp" -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include diff --git a/options/group.hpp b/options/group.hpp index 0f806f75..c933b134 100644 --- a/options/group.hpp +++ b/options/group.hpp @@ -2,8 +2,6 @@ #include "export.hpp" -#include "compat/util.hpp" - // included here to propagate into callers of options::group #include "metatype.hpp" diff --git a/options/options.hpp b/options/options.hpp index 45697597..bc892120 100644 --- a/options/options.hpp +++ b/options/options.hpp @@ -6,8 +6,6 @@ */ #pragma once -#include "compat/util.hpp" - #include "defs.hpp" #include "bundle.hpp" #include "group.hpp" diff --git a/options/slider.hpp b/options/slider.hpp index 5657ab82..f3ba44f8 100644 --- a/options/slider.hpp +++ b/options/slider.hpp @@ -8,8 +8,7 @@ #pragma once #include "export.hpp" - -#include "compat/util.hpp" +#include "compat/macros.hpp" #include #include diff --git a/options/tie.cpp b/options/tie.cpp index 9e693f5c..baa8bb82 100644 --- a/options/tie.cpp +++ b/options/tie.cpp @@ -7,6 +7,7 @@ */ #include "tie.hpp" +#include "compat/run-in-thread.hpp" namespace options { diff --git a/options/tie.hpp b/options/tie.hpp index 8d5fe6c5..4ebc1846 100644 --- a/options/tie.hpp +++ b/options/tie.hpp @@ -10,6 +10,7 @@ #include "export.hpp" #include "value.hpp" +#include "compat/run-in-thread.hpp" #include #include diff --git a/options/value.hpp b/options/value.hpp index 1da1dd9c..87bb2a85 100644 --- a/options/value.hpp +++ b/options/value.hpp @@ -10,12 +10,11 @@ #include "export.hpp" -#include "compat/util.hpp" - #include "bundle.hpp" #include "slider.hpp" #include "base-value.hpp" #include "value-traits.hpp" +#include "compat/macros.hpp" #include #include diff --git a/pose-widget/pose-widget.cpp b/pose-widget/pose-widget.cpp index 5b8fdbbf..69861b24 100644 --- a/pose-widget/pose-widget.cpp +++ b/pose-widget/pose-widget.cpp @@ -6,10 +6,11 @@ */ #include "pose-widget.hpp" -#include "compat/util.hpp" #include "compat/timer.hpp" #include "compat/sleep.hpp" #include "compat/check-visible.hpp" +#include "compat/math.hpp" + #include #include diff --git a/proto-flightgear/ftnoir_protocol_fg_dialog.cpp b/proto-flightgear/ftnoir_protocol_fg_dialog.cpp index 43a702f6..f6f8e00d 100644 --- a/proto-flightgear/ftnoir_protocol_fg_dialog.cpp +++ b/proto-flightgear/ftnoir_protocol_fg_dialog.cpp @@ -10,7 +10,7 @@ */ #include "ftnoir_protocol_fg.h" #include "api/plugin-api.hpp" -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include #include diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp index 04a5a4cf..f8c5afb8 100644 --- a/proto-ft/ftnoir_protocol_ft.cpp +++ b/proto-ft/ftnoir_protocol_ft.cpp @@ -6,11 +6,9 @@ * copyright notice and this permission notice appear in all copies. */ -#include "compat/util.hpp" - #include "ftnoir_protocol_ft.h" #include "csv/csv.h" -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include #include diff --git a/proto-ft/ftnoir_protocol_ft_dialog.cpp b/proto-ft/ftnoir_protocol_ft_dialog.cpp index 35f03586..df2878ec 100644 --- a/proto-ft/ftnoir_protocol_ft_dialog.cpp +++ b/proto-ft/ftnoir_protocol_ft_dialog.cpp @@ -9,7 +9,7 @@ * copyright notice and this permission notice appear in all copies. * */ #include "ftnoir_protocol_ft.h" -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include #include diff --git a/proto-libevdev/ftnoir_protocol_libevdev.cpp b/proto-libevdev/ftnoir_protocol_libevdev.cpp index 42201b6e..fee7b790 100644 --- a/proto-libevdev/ftnoir_protocol_libevdev.cpp +++ b/proto-libevdev/ftnoir_protocol_libevdev.cpp @@ -10,8 +10,6 @@ #include #include -#include "compat/util.hpp" - #include #define CHECK_LIBEVDEV(expr) if ((error = (expr)) != 0) goto error; diff --git a/proto-mouse/ftnoir_protocol_mouse.cpp b/proto-mouse/ftnoir_protocol_mouse.cpp index 3245adf4..ccc91e33 100644 --- a/proto-mouse/ftnoir_protocol_mouse.cpp +++ b/proto-mouse/ftnoir_protocol_mouse.cpp @@ -4,8 +4,11 @@ * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. */ + #include "ftnoir_protocol_mouse.h" + #include "api/plugin-api.hpp" +#include "compat/math.hpp" #include #include #include diff --git a/proto-simconnect/ftnoir_protocol_sc.cpp b/proto-simconnect/ftnoir_protocol_sc.cpp index 812fdcb3..f2a9dd14 100644 --- a/proto-simconnect/ftnoir_protocol_sc.cpp +++ b/proto-simconnect/ftnoir_protocol_sc.cpp @@ -11,8 +11,8 @@ */ #include "ftnoir_protocol_sc.h" #include "api/plugin-api.hpp" -#include "opentrack-library-path.h" #include "compat/timer.hpp" +#include "compat/library-path.hpp" simconnect::simconnect() : hSimConnect(nullptr), should_reconnect(false) { diff --git a/proto-vjoystick/vjoystick.cpp b/proto-vjoystick/vjoystick.cpp index a0e5b5b9..73cf74c6 100644 --- a/proto-vjoystick/vjoystick.cpp +++ b/proto-vjoystick/vjoystick.cpp @@ -7,7 +7,7 @@ */ #include "vjoystick.h" #include "api/plugin-api.hpp" -#include "compat/util.hpp" +#include "compat/math.hpp" #include #include diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index 07501632..42fb4896 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -1,5 +1,4 @@ #include "ftnoir_protocol_wine.h" -#include "opentrack-library-path.h" #include #include #include @@ -10,6 +9,7 @@ #include /* For O_* constants */ #include "csv/csv.h" #include "compat/macros.hpp" +#include "compat/library-path.hpp" wine::wine() : lck_shm(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)), shm(NULL), gameid(0) { diff --git a/proto-wine/opentrack-wrapper-wine-windows.cxx b/proto-wine/opentrack-wrapper-wine-windows.cxx index 3c315d84..e1f91797 100644 --- a/proto-wine/opentrack-wrapper-wine-windows.cxx +++ b/proto-wine/opentrack-wrapper-wine-windows.cxx @@ -7,7 +7,7 @@ #include "compat/shm.cpp" #include "wine-shm.h" #define OPENTRACK_NO_QT_PATH -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include using std::strcat; diff --git a/qxt-mini/qxtglobalshortcut.cpp b/qxt-mini/qxtglobalshortcut.cpp index fc0984b6..40a64d80 100644 --- a/qxt-mini/qxtglobalshortcut.cpp +++ b/qxt-mini/qxtglobalshortcut.cpp @@ -31,8 +31,6 @@ #include "qxtglobalshortcut_p.h" -#include "compat/util.hpp" - #include #include #include diff --git a/qxt-mini/qxtglobalshortcut_x11.cpp b/qxt-mini/qxtglobalshortcut_x11.cpp index 12a69637..2609aa7c 100644 --- a/qxt-mini/qxtglobalshortcut_x11.cpp +++ b/qxt-mini/qxtglobalshortcut_x11.cpp @@ -46,7 +46,6 @@ #include #include "powerset.hpp" -#include "compat/util.hpp" #include #include diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp index e4e43f71..c578d70d 100644 --- a/spline/spline-widget.cpp +++ b/spline/spline-widget.cpp @@ -5,8 +5,8 @@ * copyright notice and this permission notice appear in all copies. */ -#include "compat/util.hpp" #include "spline-widget.hpp" +#include "compat/math.hpp" #include #include #include diff --git a/spline/spline.cpp b/spline/spline.cpp index b6fdd9c5..823fd64f 100644 --- a/spline/spline.cpp +++ b/spline/spline.cpp @@ -7,6 +7,7 @@ */ #include "spline.hpp" +#include "compat/math.hpp" #include #include @@ -105,12 +106,6 @@ warn_result_unused bool spline::get_last_value(QPointF& point) return activep; } -template -static T signum(T val) -{ - return (T(0) < val) - (val < T(0)); -} - float spline::get_value_internal(int x) { if (!validp) diff --git a/spline/spline.hpp b/spline/spline.hpp index 1bfe3b46..0d080cef 100644 --- a/spline/spline.hpp +++ b/spline/spline.hpp @@ -10,7 +10,6 @@ #include "compat/copyable-mutex.hpp" #include "options/options.hpp" -#include "compat/util.hpp" using namespace options; #include "axis-opts.hpp" diff --git a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp index ab2b5b72..14498861 100644 --- a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -1,6 +1,6 @@ #include "ftnoir_tracker_freepie-udp.h" #include "api/plugin-api.hpp" -#include "compat/util.hpp" +#include "compat/math.hpp" #include #include diff --git a/tracker-fusion/fusion.cpp b/tracker-fusion/fusion.cpp index beeb7f53..98e2465e 100644 --- a/tracker-fusion/fusion.cpp +++ b/tracker-fusion/fusion.cpp @@ -7,8 +7,7 @@ */ #include "fusion.h" - -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include #include diff --git a/tracker-hatire/thread.cpp b/tracker-hatire/thread.cpp index cb338c4a..6025d74c 100644 --- a/tracker-hatire/thread.cpp +++ b/tracker-hatire/thread.cpp @@ -1,6 +1,6 @@ #include "thread.hpp" #include "compat/sleep.hpp" -#include "compat/util.hpp" +#include "compat/base-path.hpp" #include #include diff --git a/tracker-joystick/ftnoir_tracker_joystick.cpp b/tracker-joystick/ftnoir_tracker_joystick.cpp index 42c2214a..27a5408d 100644 --- a/tracker-joystick/ftnoir_tracker_joystick.cpp +++ b/tracker-joystick/ftnoir_tracker_joystick.cpp @@ -5,8 +5,8 @@ * copyright notice and this permission notice appear in all copies. */ #include "ftnoir_tracker_joystick.h" -#include "compat/util.hpp" #include "api/plugin-api.hpp" +#include "compat/math.hpp" #include joystick::joystick() diff --git a/tracker-pt/camera.h b/tracker-pt/camera.h index 42eda9f5..96234840 100644 --- a/tracker-pt/camera.h +++ b/tracker-pt/camera.h @@ -9,7 +9,6 @@ #include "pt-api.hpp" -#include "compat/util.hpp" #include "compat/timer.hpp" #include diff --git a/tracker-pt/frame.cpp b/tracker-pt/frame.cpp index 330c2313..e403af07 100644 --- a/tracker-pt/frame.cpp +++ b/tracker-pt/frame.cpp @@ -1,5 +1,7 @@ #include "frame.hpp" +#include "compat/math.hpp" + #include #include diff --git a/tracker-pt/ftnoir_tracker_pt.h b/tracker-pt/ftnoir_tracker_pt.h index 0b2a8578..d1f7e1d7 100644 --- a/tracker-pt/ftnoir_tracker_pt.h +++ b/tracker-pt/ftnoir_tracker_pt.h @@ -15,7 +15,6 @@ #include "pt-api.hpp" #include "point_tracker.h" #include "cv/video-widget.hpp" -#include "compat/util.hpp" #include #include diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp index 350cdb24..2c01c073 100644 --- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp +++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp @@ -8,6 +8,7 @@ #include "ftnoir_tracker_pt_dialog.h" +#include "compat/math.hpp" #include "compat/camera-names.hpp" #include #include diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index defdcedc..b67c4036 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -7,13 +7,12 @@ */ #include "point_extractor.h" -#include "compat/util.hpp" #include "point_tracker.h" #include "frame.hpp" -#include - #include "cv/numeric.hpp" +#include "compat/math.hpp" + #include #undef PREVIEW diff --git a/tracker-pt/point_tracker.h b/tracker-pt/point_tracker.h index 26677042..6abe5df9 100644 --- a/tracker-pt/point_tracker.h +++ b/tracker-pt/point_tracker.h @@ -12,11 +12,13 @@ #include "cv/numeric.hpp" #include "pt-api.hpp" -#include #include #include #include #include + +#include + #include namespace pt_module { diff --git a/tracker-rift-080/ftnoir_tracker_rift_080.cpp b/tracker-rift-080/ftnoir_tracker_rift_080.cpp index 4d351dbc..c9f5e4ee 100644 --- a/tracker-rift-080/ftnoir_tracker_rift_080.cpp +++ b/tracker-rift-080/ftnoir_tracker_rift_080.cpp @@ -15,7 +15,6 @@ #include "ftnoir_tracker_rift_080.h" #include "api/plugin-api.hpp" -#include "compat/util.hpp" #include diff --git a/tracker-rift-140/rift-140.cpp b/tracker-rift-140/rift-140.cpp index 9880cb1e..bf02191a 100644 --- a/tracker-rift-140/rift-140.cpp +++ b/tracker-rift-140/rift-140.cpp @@ -15,7 +15,6 @@ #include "rift-140.hpp" #include "api/plugin-api.hpp" -#include "compat/util.hpp" #include #include diff --git a/tracker-rs/ftnoir_tracker_rs.cpp b/tracker-rs/ftnoir_tracker_rs.cpp index 7c4f42a4..7918b6dc 100644 --- a/tracker-rs/ftnoir_tracker_rs.cpp +++ b/tracker-rs/ftnoir_tracker_rs.cpp @@ -9,7 +9,7 @@ #include "ftnoir_tracker_rs_controls.h" #include "imagewidget.h" #include "api/plugin-api.hpp" -#include "opentrack-library-path.h" +#include "compat/library-path.hpp" #include #include #include diff --git a/tracker-s2bot/ftnoir_tracker_s2bot.cpp b/tracker-s2bot/ftnoir_tracker_s2bot.cpp index 8bd1f5db..a7411fb7 100644 --- a/tracker-s2bot/ftnoir_tracker_s2bot.cpp +++ b/tracker-s2bot/ftnoir_tracker_s2bot.cpp @@ -1,6 +1,6 @@ #include "ftnoir_tracker_s2bot.h" #include "api/plugin-api.hpp" -#include "compat/util.hpp" +#include "compat/math.hpp" #include #include diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index 82a38fb7..80a0e6f1 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -19,7 +19,6 @@ #include "steamvr.hpp" #include "api/plugin-api.hpp" -#include "compat/util.hpp" #include #include diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp index 95829492..4ba4da6d 100644 --- a/tracker-steamvr/steamvr.hpp +++ b/tracker-steamvr/steamvr.hpp @@ -1,7 +1,6 @@ #pragma once #include "api/plugin-api.hpp" #include "ui_dialog.h" -#include "compat/util.hpp" #include "options/options.hpp" #include "compat/euler.hpp" diff --git a/tracker-test/test.h b/tracker-test/test.h index 0d1c9b8d..0f71005f 100644 --- a/tracker-test/test.h +++ b/tracker-test/test.h @@ -2,6 +2,7 @@ #include "ui_test.h" #include "api/plugin-api.hpp" #include "compat/timer.hpp" +#include "compat/macros.hpp" #include @@ -36,7 +37,7 @@ private slots: class test_metadata : public Metadata { public: - QString name() { return otr_tr("Testing - sine wave"); } + QString name() { return _("Testing - sine wave"); } QIcon icon() { return QIcon(":/images/facetracknoir.png"); } }; diff --git a/tracker-udp/ftnoir_tracker_udp.cpp b/tracker-udp/ftnoir_tracker_udp.cpp index 41aa96c2..f147e5c6 100644 --- a/tracker-udp/ftnoir_tracker_udp.cpp +++ b/tracker-udp/ftnoir_tracker_udp.cpp @@ -9,7 +9,6 @@ #include "ftnoir_tracker_udp.h" #include "api/plugin-api.hpp" #include "compat/nan.hpp" -#include "compat/util.hpp" #include diff --git a/variant/default/main-window.cpp b/variant/default/main-window.cpp index 30efb138..7a9905d0 100644 --- a/variant/default/main-window.cpp +++ b/variant/default/main-window.cpp @@ -9,12 +9,13 @@ #include "main-window.hpp" #include "logic/pipeline.hpp" #include "options/options.hpp" -#include "opentrack-library-path.h" #include "new_file_dialog.h" #include "migration/migration.hpp" #include "compat/check-visible.hpp" #include "compat/sleep.hpp" #include "compat/macros.hpp" +#include "compat/library-path.hpp" +#include "compat/math.hpp" #include #include -- cgit v1.2.3