diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-08-09 15:50:09 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-08-10 10:41:56 +0200 |
commit | 0eec855f4f5ac86f70525418918fd1ebb4d45e03 (patch) | |
tree | b8014ad75774e00ba3c26f2b781d6ad0c6021c9a /opentrack-logic | |
parent | f56f30f1d076c8b48a0bd4ce47b26ede618d2880 (diff) |
spline-widget, gui: rename mapping-related files and classes
Adjust usages.
Diffstat (limited to 'opentrack-logic')
-rw-r--r-- | opentrack-logic/main-settings.hpp | 15 | ||||
-rw-r--r-- | opentrack-logic/mappings.hpp | 46 | ||||
-rw-r--r-- | opentrack-logic/tracker.cpp | 12 | ||||
-rw-r--r-- | opentrack-logic/tracker.h | 2 |
4 files changed, 38 insertions, 37 deletions
diff --git a/opentrack-logic/main-settings.hpp b/opentrack-logic/main-settings.hpp index 81eb99cf..29f7f62c 100644 --- a/opentrack-logic/main-settings.hpp +++ b/opentrack-logic/main-settings.hpp @@ -62,7 +62,7 @@ struct module_settings struct main_settings { - pbundle b; + pbundle b, b_map; axis_opts a_x, a_y, a_z, a_yaw, a_pitch, a_roll; value<bool> tcomp_p, tcomp_tz; value<bool> tray_enabled; @@ -77,12 +77,13 @@ struct main_settings value<QString> tracklogging_filename; main_settings() : b(bundle("opentrack-ui")), - a_x(b, "x", TX), - a_y(b, "y", TY), - a_z(b, "z", TZ), - a_yaw(b, "yaw", Yaw), - a_pitch(b, "pitch", Pitch), - a_roll(b, "roll", Roll), + b_map(bundle("opentrack-mappings")), + a_x(b_map, "x", TX), + a_y(b_map, "y", TY), + a_z(b_map, "z", TZ), + a_yaw(b_map, "yaw", Yaw), + a_pitch(b_map, "pitch", Pitch), + a_roll(b_map, "roll", Roll), tcomp_p(b, "compensate-translation", true), tcomp_tz(b, "compensate-translation-disable-z-axis", false), tray_enabled(b, "use-system-tray", false), diff --git a/opentrack-logic/mappings.hpp b/opentrack-logic/mappings.hpp index 9475ecb4..3e396980 100644 --- a/opentrack-logic/mappings.hpp +++ b/opentrack-logic/mappings.hpp @@ -13,46 +13,46 @@ using namespace options; #include "spline-widget/spline.hpp" #include "main-settings.hpp" -class Mapping { +class Map { public: - Mapping(QString primary, + Map(QString primary, QString secondary, int max_x, int max_y, axis_opts& opts) : - curve(max_x, max_y), - curveAlt(max_x, max_y), + spline_main(max_x, max_y), + spline_alt(max_x, max_y), opts(opts), name1(primary), name2(secondary) { mem<QSettings> iniFile = group::ini_file(); - curve.loadSettings(*iniFile, primary); - curveAlt.loadSettings(*iniFile, secondary); + spline_main.loadSettings(*iniFile, primary); + spline_alt.loadSettings(*iniFile, secondary); } - Map curve; - Map curveAlt; + spline spline_main; + spline spline_alt; axis_opts& opts; QString name1, name2; }; class Mappings { private: - Mapping axes[6]; + Map axes[6]; public: Mappings(std::vector<axis_opts*> opts) : axes { - Mapping("tx","tx_alt", 30, 75, *opts[TX]), - Mapping("ty","ty_alt", 30, 75, *opts[TY]), - Mapping("tz","tz_alt", 30, 75, *opts[TZ]), - Mapping("rx", "rx_alt", 180, 180, *opts[Yaw]), - Mapping("ry", "ry_alt", 180, 180, *opts[Pitch]), - Mapping("rz", "rz_alt", 180, 180, *opts[Roll]) + Map("tx","tx_alt", 30, 75, *opts[TX]), + Map("ty","ty_alt", 30, 75, *opts[TY]), + Map("tz","tz_alt", 30, 75, *opts[TZ]), + Map("rx", "rx_alt", 180, 180, *opts[Yaw]), + Map("ry", "ry_alt", 180, 180, *opts[Pitch]), + Map("rz", "rz_alt", 180, 180, *opts[Roll]) } {} - inline Mapping& operator()(int i) { return axes[i]; } - inline const Mapping& operator()(int i) const { return axes[i]; } + inline Map& operator()(int i) { return axes[i]; } + inline const Map& operator()(int i) const { return axes[i]; } void load_mappings() { @@ -60,8 +60,8 @@ public: for (int i = 0; i < 6; i++) { - axes[i].curve.loadSettings(*iniFile, axes[i].name1); - axes[i].curveAlt.loadSettings(*iniFile, axes[i].name2); + axes[i].spline_main.loadSettings(*iniFile, axes[i].name1); + axes[i].spline_alt.loadSettings(*iniFile, axes[i].name2); axes[i].opts.b->reload(); } } @@ -71,8 +71,8 @@ public: for (int i = 0; i < 6; i++) { - axes[i].curve.saveSettings(*iniFile, axes[i].name1); - axes[i].curveAlt.saveSettings(*iniFile, axes[i].name2); + axes[i].spline_main.saveSettings(*iniFile, axes[i].name1); + axes[i].spline_alt.saveSettings(*iniFile, axes[i].name2); axes[i].opts.b->save(); } } @@ -81,8 +81,8 @@ public: { for (int i = 0; i < 6; i++) { - axes[i].curve.invalidate_unsaved_settings(); - axes[i].curveAlt.invalidate_unsaved_settings(); + axes[i].spline_main.invalidate_unsaved_settings(); + axes[i].spline_alt.invalidate_unsaved_settings(); axes[i].opts.b->reload(); } } diff --git a/opentrack-logic/tracker.cpp b/opentrack-logic/tracker.cpp index 746a29f4..ab1a7406 100644 --- a/opentrack-logic/tracker.cpp +++ b/opentrack-logic/tracker.cpp @@ -54,12 +54,12 @@ Tracker::rmat Tracker::get_camera_offset_matrix(double c) return euler::euler_to_rmat(off); } -double Tracker::map(double pos, Mapping& axis) +double Tracker::map(double pos, Map& axis) { bool altp = (pos < 0) && axis.opts.altp; - axis.curve.setTrackingActive( !altp ); - axis.curveAlt.setTrackingActive( altp ); - auto& fc = altp ? axis.curveAlt : axis.curve; + axis.spline_main.setTrackingActive( !altp ); + axis.spline_alt.setTrackingActive( altp ); + auto& fc = altp ? axis.spline_alt : axis.spline_main; return fc.getValue(pos); } @@ -355,8 +355,8 @@ void Tracker::run() for (int i = 0; i < 6; i++) { - m(i).curve.setTrackingActive(false); - m(i).curveAlt.setTrackingActive(false); + m(i).spline_main.setTrackingActive(false); + m(i).spline_alt.setTrackingActive(false); } } diff --git a/opentrack-logic/tracker.h b/opentrack-logic/tracker.h index 91ac3f2f..2153f7c0 100644 --- a/opentrack-logic/tracker.h +++ b/opentrack-logic/tracker.h @@ -57,7 +57,7 @@ private: rmat r_b, r_b_real; double t_b[3]; - double map(double pos, Mapping& axis); + double map(double pos, Map& axis); void logic(); void t_compensate(const rmat& rmat, const euler_t& ypr, euler_t& output, bool rz); void run() override; |