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
|
#include "facetracknoir/facetracknoir.h"
#include "facetracknoir/curve-config.h"
CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidget *parent) :
QWidget( parent, Qt::Dialog ), mainApp(ftnoir)
{
ui.setupUi( this );
setFont(qApp->font());
QPoint offsetpos(120, 30);
this->move(parent->pos() + offsetpos);
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
tie_setting(mainApp->s.a_x.altp, ui.tx_altp);
tie_setting(mainApp->s.a_y.altp, ui.ty_altp);
tie_setting(mainApp->s.a_z.altp, ui.tz_altp);
tie_setting(mainApp->s.a_yaw.altp, ui.rx_altp);
tie_setting(mainApp->s.a_pitch.altp, ui.ry_altp);
tie_setting(mainApp->s.a_roll.altp, ui.rz_altp);
tie_setting(mainApp->s.tcomp_p, ui.tcomp_enable);
tie_setting(mainApp->s.tcomp_tz, ui.tcomp_rz);
tie_setting(mainApp->s.a_x.zero, ui.pos_tx);
tie_setting(mainApp->s.a_y.zero, ui.pos_ty);
tie_setting(mainApp->s.a_z.zero, ui.pos_tz);
tie_setting(mainApp->s.a_yaw.zero, ui.pos_rx);
tie_setting(mainApp->s.a_pitch.zero, ui.pos_ry);
tie_setting(mainApp->s.a_roll.zero, ui.pos_rz);
tie_setting(mainApp->s.a_yaw.invert, ui.invert_yaw);
tie_setting(mainApp->s.a_pitch.invert, ui.invert_pitch);
tie_setting(mainApp->s.a_roll.invert, ui.invert_roll);
tie_setting(mainApp->s.a_x.invert, ui.invert_x);
tie_setting(mainApp->s.a_y.invert, ui.invert_y);
tie_setting(mainApp->s.a_z.invert, ui.invert_z);
tie_setting(mainApp->s.a_yaw.src, ui.src_yaw);
tie_setting(mainApp->s.a_pitch.src, ui.src_pitch);
tie_setting(mainApp->s.a_roll.src, ui.src_roll);
tie_setting(mainApp->s.a_x.src, ui.src_x);
tie_setting(mainApp->s.a_y.src, ui.src_y);
tie_setting(mainApp->s.a_z.src, ui.src_z);
loadSettings();
}
void CurveConfigurationDialog::doOK() {
save();
this->close();
}
void CurveConfigurationDialog::doCancel() {
mainApp->b->revert();
loadSettings();
close();
}
void CurveConfigurationDialog::loadSettings() {
QFunctionConfigurator* configs[6] = {
ui.txconfig,
ui.tyconfig,
ui.tzconfig,
ui.rxconfig,
ui.ryconfig,
ui.rzconfig
};
QFunctionConfigurator* alt_configs[6] = {
ui.txconfig_alt,
ui.tyconfig_alt,
ui.tzconfig_alt,
ui.rxconfig_alt,
ui.ryconfig_alt,
ui.rzconfig_alt
};
for (int i = 0; i < 6; i++)
{
configs[i]->setConfig(&mainApp->axis(i).curve, mainApp->axis(i).name1);
alt_configs[i]->setConfig(&mainApp->axis(i).curveAlt, mainApp->axis(i).name2);
}
}
void CurveConfigurationDialog::save() {
QSettings settings("opentrack");
QString currentFile =
settings.value("SettingsFile",
QCoreApplication::applicationDirPath() + "/settings/default.ini" )
.toString();
struct {
QFunctionConfigurator* qfc;
Axis axis;
bool altp;
} qfcs[] =
{
{ ui.rxconfig, Yaw, false },
{ ui.ryconfig, Pitch, false},
{ ui.rzconfig, Roll, false },
{ ui.txconfig, TX, false },
{ ui.tyconfig, TY, false },
{ ui.tzconfig, TZ, false },
{ ui.rxconfig_alt, Yaw, true },
{ ui.ryconfig_alt, Pitch, true},
{ ui.rzconfig_alt, Roll, true },
{ ui.txconfig_alt, TX, true },
{ ui.tyconfig_alt, TY, true },
{ ui.tzconfig_alt, TZ, true },
{ nullptr, Yaw, false }
};
for (int i = 0; qfcs[i].qfc; i++)
{
THeadPoseDOF& axis = mainApp->axis(qfcs[i].axis);
qfcs[i].qfc->saveSettings(currentFile, qfcs[i].altp ? axis.name2 : axis.name1);
}
}
|