summaryrefslogtreecommitdiffhomepage
path: root/variant/trackmouse/trackmouse-settings.cpp
blob: f889a949574e0c1de2b94cc42515b1e01f388dcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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();
    });
}