summaryrefslogtreecommitdiffhomepage
path: root/variant
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-01-16 04:38:04 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-01-16 06:45:52 +0100
commitf99eef18c475df2a4080bc652774e8e9f001037c (patch)
tree695f01a4768591d91c2d3adb2335b90f0bc2a78c /variant
parent2b1c5593b0bc1ebfcd2e808f128e4b0312f59d93 (diff)
trackmouse: more work
Diffstat (limited to 'variant')
-rw-r--r--variant/trackmouse/trackmouse-settings.cpp110
-rw-r--r--variant/trackmouse/trackmouse.icobin0 -> 67134 bytes
-rw-r--r--variant/trackmouse/trackmouse.rc2
-rw-r--r--variant/trackmouse/window.cpp4
4 files changed, 116 insertions, 0 deletions
diff --git a/variant/trackmouse/trackmouse-settings.cpp b/variant/trackmouse/trackmouse-settings.cpp
new file mode 100644
index 00000000..f889a949
--- /dev/null
+++ b/variant/trackmouse/trackmouse-settings.cpp
@@ -0,0 +1,110 @@
+#include "logic/main-settings.hpp"
+#include "logic/mappings.hpp"
+
+#include "tracker-pt/pt-settings.hpp"
+#include "filter-accela/accela-settings.hpp"
+#include "proto-mouse/mouse-settings.hpp"
+
+#include "options/options.hpp"
+
+#include <QSettings>
+
+using namespace options;
+
+static void force_spline_settings()
+{
+ main_settings main;
+
+ axis_opts** all_axis_opts = main.all_axis_opts;
+ Mappings mappings { all_axis_opts };
+
+ for (unsigned k = 0; k < 6; k++)
+ {
+ Map& map = mappings(k);
+ const QString& prefix = all_axis_opts[k]->prefix();
+
+ const QString& name1 = map.name;
+ const QString& name2 = map.alt_name;
+
+ bundle b = make_bundle(prefix);
+
+ spline_detail::settings s1(b, name1, Axis(k));
+ spline_detail::settings s2(b, name2, Axis(k));
+
+ s1.points = QList<QPointF> { { 180, 180 } };
+ s2.points = QList<QPointF> { { 180, 180 } };
+
+ b->save();
+ }
+}
+
+static void force_main_settings()
+{
+ main_settings s;
+ s.center_at_startup = true;
+ s.tcomp_p = false;
+ s.neck_enable = false;
+
+ module_settings m;
+
+ m.tracker_dll = "PointTracker 1.1";
+ m.protocol_dll = "Mouse";
+ m.filter_dll = "Accela";
+
+ s.b->save();
+ s.b_map->save();
+}
+
+static void force_pt_settings()
+{
+ pt_settings s("tracker-pt");
+
+ enum { Clip = 0 };
+
+ s.active_model_panel = Clip;
+ // XXX TODO trackmouse clip sizes
+
+ s.cam_fps = 60;
+ s.cam_res_x = 640;
+ s.cam_res_y = 480;
+ s.camera_name = "PS3Eye Camera";
+
+ s.min_point_size = 6;
+ s.max_point_size = 15;
+
+ // XXX TODO auto threshold slider position
+ s.auto_threshold = true;
+
+ s.t_MH_x = 0, s.t_MH_y = 0, s.t_MH_z = 0;
+ s.blob_color = pt_color_natural;
+ s.fov = 56;
+ s.dynamic_pose = false;
+
+ s.b->save();
+}
+
+static void force_mouse_settings()
+{
+ mouse_settings s;
+
+ s.Mouse_X = Yaw + 1;
+ s.Mouse_Y = Pitch + 1;
+
+ s.b->save();
+}
+
+static void force_accela_settings()
+{
+ // TODO
+}
+
+void force_trackmouse_settings()
+{
+ group::with_settings_object([](QSettings&) { // batch config save
+ force_main_settings();
+ force_spline_settings();
+ force_pt_settings();
+ force_mouse_settings();
+ force_accela_settings();
+ });
+}
diff --git a/variant/trackmouse/trackmouse.ico b/variant/trackmouse/trackmouse.ico
new file mode 100644
index 00000000..5cac8da1
--- /dev/null
+++ b/variant/trackmouse/trackmouse.ico
Binary files differ
diff --git a/variant/trackmouse/trackmouse.rc b/variant/trackmouse/trackmouse.rc
new file mode 100644
index 00000000..8df1e9b1
--- /dev/null
+++ b/variant/trackmouse/trackmouse.rc
@@ -0,0 +1,2 @@
+#include <windows.h>
+IDI_ICON1 ICON "trackmouse.ico"
diff --git a/variant/trackmouse/window.cpp b/variant/trackmouse/window.cpp
index 7566f6ca..73f91c74 100644
--- a/variant/trackmouse/window.cpp
+++ b/variant/trackmouse/window.cpp
@@ -2,6 +2,8 @@
#include <QApplication>
+void force_trackmouse_settings();
+
void window::closeEvent(QCloseEvent* e)
{
e->accept();
@@ -13,6 +15,8 @@ window::window() : QMainWindow()
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose);
+ force_trackmouse_settings();
+
show();
}