summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h
blob: 14df7ede79e32d49fba01a725b6b44603a6e940b (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
111
112
113
114
115
116
117
118
119
120
/* Copyright (c) 2012 Patrick Ruoff
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 */

#ifndef FTNOIR_TRACKER_PT_DIALOG_H
#define FTNOIR_TRACKER_PT_DIALOG_H

#ifdef OPENTRACK_API
#include "ftnoir_tracker_base/ftnoir_tracker_base.h"
#else
#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h"
#endif
#include "ftnoir_tracker_pt_settings.h"
#include "ftnoir_tracker_pt.h"
#include "trans_calib.h"
#include "video_widget.h"
#include "ui_FTNoIR_PT_Controls.h"

#include <QTimer>

//-----------------------------------------------------------------------------
// The dialog that shows up when the user presses "Settings"
class TrackerDialog : public QWidget, Ui::UICPTClientControls, public ITrackerDialog
{
	Q_OBJECT
public:
	TrackerDialog();
	~TrackerDialog();

	// ITrackerDialog interface
	void Initialize(QWidget *parent);
	void registerTracker(ITracker *tracker);
	void unRegisterTracker();
	
	void trans_calib_step();

protected slots:
	// ugly qt stuff
	void set_video_widget(bool val)  { settings.video_widget = val;   settings_changed(); }
	void set_dyn_pose_res(bool val)  { settings.dyn_pose_res = val;   settings_changed(); }
	void set_sleep_time(int val)     { settings.sleep_time = val;     settings_changed(); }
	void set_reset_time(int val)     { settings.reset_time = val;     settings_changed(); }
	void set_cam_index(int idx)		 { settings.cam_index = idx;      settings_changed(); }
	void set_cam_f(double val)       { settings.cam_f = val;          settings_changed(); }
	void set_cam_res_x(int val)      { settings.cam_res_x = val;      settings_changed(); }
	void set_cam_res_y(int val)      { settings.cam_res_y = val;      settings_changed(); }
	void set_cam_fps(int val)        { settings.cam_fps = val;        settings_changed(); }
	void set_cam_roll(int idx);
	void set_cam_pitch(int val)      { settings.cam_pitch = val;      settings_changed(); }
	void set_cam_yaw(int val)        { settings.cam_yaw = val;        settings_changed(); }
	void set_min_point_size(int val) { settings.min_point_size = val; settings_changed(); }
	void set_max_point_size(int val) { settings.max_point_size = val; settings_changed(); }
	void set_threshold(int val)      { settings.threshold = val;      settings_changed(); }
	void set_ena_roll(bool val)		 { settings.bEnableRoll = val;    settings_changed(); }
	void set_ena_pitch(bool val)	 { settings.bEnablePitch = val;   settings_changed(); }
	void set_ena_yaw(bool val)		 { settings.bEnableYaw = val;     settings_changed(); }
	void set_ena_x(bool val)		 { settings.bEnableX = val;       settings_changed(); }
	void set_ena_y(bool val)		 { settings.bEnableY = val;       settings_changed(); }
	void set_ena_z(bool val)		 { settings.bEnableZ = val;       settings_changed(); }

	void set_clip_t_height(int val)  { dialog_settings.clip_ty = val; set_model_clip(); }
	void set_clip_t_length(int val)  { dialog_settings.clip_tz = val; set_model_clip(); }
	void set_clip_b_height(int val)  { dialog_settings.clip_by = val; set_model_clip(); }
	void set_clip_b_length(int val)  { dialog_settings.clip_bz = val; set_model_clip(); }
	void set_cap_width(int val)      { dialog_settings.cap_x = val;   set_model_cap(); }
	void set_cap_height(int val)     { dialog_settings.cap_y = val;   set_model_cap(); }
	void set_cap_length(int val)     { dialog_settings.cap_z = val;   set_model_cap(); }
	void set_m1x(int val)            { dialog_settings.M01x = val;	  set_model_custom(); }
	void set_m1y(int val)            { dialog_settings.M01y = val;    set_model_custom(); }
	void set_m1z(int val)            { dialog_settings.M01z = val;    set_model_custom(); }
	void set_m2x(int val)            { dialog_settings.M02x = val;    set_model_custom(); }
	void set_m2y(int val)            { dialog_settings.M02y = val;    set_model_custom(); }
	void set_m2z(int val)            { dialog_settings.M02z = val;    set_model_custom(); }
	void set_tx(int val)             { settings.t_MH[0] = val;        settings_changed(); }
	void set_ty(int val)             { settings.t_MH[1] = val;        settings_changed(); }
	void set_tz(int val)             { settings.t_MH[2] = val;        settings_changed(); }
	void set_model(int model_id);

	void doCenter();
	void doReset();

	void doOK();
	void doCancel();

	void startstop_trans_calib(bool start);

	void widget_destroyed(QObject* obj);

	void create_video_widget();

	void poll_tracker_info();

protected:
	void destroy_video_widget(bool do_delete = true);

	void set_model_clip();
	void set_model_cap();
	void set_model_custom();

	void settings_changed();

	TrackerSettings settings;
	TrackerDialogSettings dialog_settings;
	bool settings_dirty;

	Tracker* tracker;
	QTimer timer;

	VideoWidgetDialog* video_widget_dialog;

	TranslationCalibrator trans_calib;
	bool trans_calib_running;

	Ui::UICPTClientControls ui;
};

#endif //FTNOIR_TRACKER_PT_DIALOG_H