summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir/curve-config.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-09-18 07:24:52 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-09-18 07:39:58 +0200
commitcf5ab7886e8228d1622566cc59277bcf089199a9 (patch)
tree2f35b7e417a634e8736f5a9a75113aee21ec5b57 /facetracknoir/curve-config.cpp
parentf95add4571874c58b35ff4929bcea75dc4080e16 (diff)
cleanup qfc
Issue: #44 Remove confusing logic and retarded comments by the usual offender. Change prototypes a bit for clarity's sake again.
Diffstat (limited to 'facetracknoir/curve-config.cpp')
-rw-r--r--facetracknoir/curve-config.cpp56
1 files changed, 30 insertions, 26 deletions
diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp
index e1f39d03..535655c2 100644
--- a/facetracknoir/curve-config.cpp
+++ b/facetracknoir/curve-config.cpp
@@ -1,7 +1,5 @@
#include "facetracknoir/facetracknoir.h"
#include "facetracknoir/curve-config.h"
-#include <QDebug>
-#include <QCheckBox>
CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidget *parent) :
QWidget( parent, Qt::Dialog ), mainApp(ftnoir)
{
@@ -78,39 +76,45 @@ void CurveConfigurationDialog::loadSettings() {
ui.rzconfig_alt
};
- QSettings settings("opentrack");
- QString currentFile = settings.value("SettingsFile",
- QCoreApplication::applicationDirPath() + "/settings/default.ini" )
- .toString();
-
for (int i = 0; i < 6; i++)
{
- configs[i]->setConfig(&mainApp->axis(i).curve);
- alt_configs[i]->setConfig(&mainApp->axis(i).curveAlt);
+ 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() {
-
- qDebug() << "save() says: started";
-
QSettings settings("opentrack");
QString currentFile =
settings.value("SettingsFile",
QCoreApplication::applicationDirPath() + "/settings/default.ini" )
.toString();
-
- ui.rxconfig->saveSettings(currentFile);
- ui.ryconfig->saveSettings(currentFile);
- ui.rzconfig->saveSettings(currentFile);
- ui.txconfig->saveSettings(currentFile);
- ui.tyconfig->saveSettings(currentFile);
- ui.tzconfig->saveSettings(currentFile);
-
- ui.txconfig_alt->saveSettings(currentFile);
- ui.tyconfig_alt->saveSettings(currentFile);
- ui.tzconfig_alt->saveSettings(currentFile);
- ui.rxconfig_alt->saveSettings(currentFile);
- ui.ryconfig_alt->saveSettings(currentFile);
- ui.rzconfig_alt->saveSettings(currentFile);
+
+ 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);
+ }
}