diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-09-13 14:09:08 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-09-13 14:09:08 +0200 |
commit | d4dd9675276093817756187c04d89f10da2df02e (patch) | |
tree | 3fefb989b5eb7cbacb39e242ecb05780dea7ff13 /qfunctionconfigurator | |
parent | 96e5dcb54b932d65c6d3bf9e9364226da21486ee (diff) |
nix comment cancer
Diffstat (limited to 'qfunctionconfigurator')
-rw-r--r-- | qfunctionconfigurator/functionconfig.cpp | 48 | ||||
-rw-r--r-- | qfunctionconfigurator/functionconfig.h | 14 | ||||
-rw-r--r-- | qfunctionconfigurator/qfunctionconfigurator.cpp | 6 | ||||
-rw-r--r-- | qfunctionconfigurator/qfunctionconfigurator.h | 31 |
4 files changed, 19 insertions, 80 deletions
diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 97a6db24..85d058fb 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -17,9 +17,6 @@ #include <math.h> #include <QPixmap> -// -// Constructor with List of Points in argument. -// FunctionConfig::FunctionConfig(QString title, int intMaxInput, int intMaxOutput) : _mutex(QMutex::Recursive) { @@ -29,9 +26,9 @@ FunctionConfig::FunctionConfig(QString title, int intMaxInput, int intMaxOutput) _size = 0; lastValueTracked = QPointF(0,0); _tracking_active = false; - _max_Input = intMaxInput; // Added WVR 20120805 + _max_Input = intMaxInput; _max_Output = intMaxOutput; - QSettings settings("opentrack"); // Registry settings (in HK_USER) + QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); loadSettings(iniFile); @@ -53,11 +50,6 @@ FunctionConfig::FunctionConfig() : { } -// -// Calculate the value of the function, given the input 'x'. -// Used to draw the curve and, most importantly, to translate input to output. -// The return-value is also stored internally, so the Widget can show the current value, when the Tracker is running. -// float FunctionConfig::getValue(float x) { QMutexLocker foo(&_mutex); int x2 = (int) (std::min<float>(std::max<float>(x, -360), 360) * MEMOIZE_PRECISION); @@ -67,9 +59,6 @@ float FunctionConfig::getValue(float x) { return ret; } -// -// The return-value is also stored internally, so the Widget can show the current value, when the Tracker is running. -// bool FunctionConfig::getLastPoint(QPointF& point ) { QMutexLocker foo(&_mutex); point = lastValueTracked; @@ -172,10 +161,6 @@ FunctionConfig::~FunctionConfig() { delete[] _data; } -// -// Remove a Point from the Function. -// Used by the Widget. -// void FunctionConfig::removePoint(int i) { QMutexLocker foo(&_mutex); if (i >= 0 && i < _points.size()) @@ -185,20 +170,12 @@ void FunctionConfig::removePoint(int i) { } } -// -// Add a Point to the Function. -// Used by the Widget and by loadSettings. -// void FunctionConfig::addPoint(QPointF pt) { QMutexLocker foo(&_mutex); _points.append(pt); reload(); } -// -// Move a Function Point. -// Used by the Widget. -// void FunctionConfig::movePoint(int idx, QPointF pt) { QMutexLocker foo(&_mutex); if (idx >= 0 && idx < _points.size()) @@ -208,10 +185,6 @@ void FunctionConfig::movePoint(int idx, QPointF pt) { } } -// -// Return the List of Points. -// Used by the Widget. -// QList<QPointF> FunctionConfig::getPoints() { QList<QPointF> ret; QMutexLocker foo(&_mutex); @@ -221,10 +194,6 @@ QList<QPointF> FunctionConfig::getPoints() { return ret; } -// -// Load the Points for the Function from the INI-file designated by settings. -// Settings for a specific Curve are loaded from their own Group in the INI-file. -// void FunctionConfig::loadSettings(QSettings& settings) { QMutexLocker foo(&_mutex); QPointF newPoint; @@ -235,12 +204,8 @@ void FunctionConfig::loadSettings(QSettings& settings) { int max = settings.value("point-count", 0).toInt(); for (int i = 0; i < max; i++) { - newPoint = QPointF(settings.value(QString("point-%1-x").arg(i), 0).toFloat(), - settings.value(QString("point-%1-y").arg(i), 0).toFloat()); - // - // Make sure the new Point fits in the Function Range. - // Maybe this can be improved? - // + newPoint = QPointF(settings.value(QString("point-%1-x").arg(i), 0).toFloat(), + settings.value(QString("point-%1-y").arg(i), 0).toFloat()); if (newPoint.x() > _max_Input) { newPoint.setX(_max_Input); } @@ -254,11 +219,6 @@ void FunctionConfig::loadSettings(QSettings& settings) { reload(); } -// -// Save the Points for the Function to the INI-file designated by settings. -// Settings for a specific Curve are saved in their own Group in the INI-file. -// The number of Points is also saved, to make loading more convenient. -// void FunctionConfig::saveSettings(QSettings& settings) { QMutexLocker foo(&_mutex); settings.beginGroup(QString("Curves-%1").arg(_title)); diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index 4d771dfd..9b43f0bd 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -26,7 +26,7 @@ private: int _size; QString _title; float getValueInternal(int x); - QPointF lastValueTracked; // The last input value requested by the Tracker, with it's output-value. + QPointF lastValueTracked; volatile bool _tracking_active; int _max_Input; int _max_Output; @@ -34,19 +34,12 @@ private: public: int maxInput() const { return _max_Input; } int maxOutput() const { return _max_Output; } - // - // Contructor(s) and destructor - // FunctionConfig(); FunctionConfig(QString title, int intMaxInput, int intMaxOutput); ~FunctionConfig(); float getValue(float x); - bool getLastPoint(QPointF& point); // Get the last Point that was requested. - - // - // Functions to manipulate the Function - // + bool getLastPoint(QPointF& point); void removePoint(int i); void removeAllPoints() { QMutexLocker foo(&_mutex); @@ -64,9 +57,6 @@ public: _max_Output = MaxOutput; } - // - // Functions to load/save the Function-Points to an INI-file - // void saveSettings(QSettings& settings); void loadSettings(QSettings& settings); diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index 55d1e1bc..e94eded4 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -28,7 +28,7 @@ static const int pointSize = 5; QFunctionConfigurator::QFunctionConfigurator(QWidget *parent) : QWidget(parent) { - movingPoint = -1; // Index of that same point + movingPoint = -1; _config = 0; _draw_background = true; _draw_function = true; @@ -37,9 +37,9 @@ QFunctionConfigurator::QFunctionConfigurator(QWidget *parent) } void QFunctionConfigurator::setConfig(FunctionConfig* config) { - QSettings settings("opentrack"); // Registry settings (in HK_USER) + QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) + QSettings iniFile( currentFile, QSettings::IniFormat ); config->loadSettings(iniFile); _config = config; diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index 1f6b4f78..d3a8741f 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -4,8 +4,7 @@ * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. */ -#ifndef QFUNCTIONCONFIGURATOR_H -#define QFUNCTIONCONFIGURATOR_H +#pragma once #include <QWidget> #include <QtGui> @@ -14,14 +13,6 @@ #include "qfunctionconfigurator/functionconfig.h" #include "ftnoir_tracker_base/ftnoir_tracker_base.h" -// -// The FunctionConfigurator Widget is used to display and configure a function (curve). -// The Function is used by FaceTrackNoIR to 'translate' the actual head-pose to the virtual headpose. Every axis is configured by a separate Function. -// -// The Function is coded in a separate Class and can exists, without the Widget. When the widget is displayed (therefore 'created'), the Function can be attached to the -// Widget and the Widget used to change the Function. -// - class FTNOIR_TRACKER_BASE_EXPORT QFunctionConfigurator : public QWidget { Q_OBJECT @@ -70,23 +61,21 @@ private: _draw_function = _draw_background = true; } - QRectF range; // The actual rectangle for the Bezier-curve - QPointF lastPoint; // The right-most point of the Function - QPointF pixel_coord_to_point (QPointF point) const; // Convert the graphical Point to a real-life Point - QPointF point_to_pixel (QPointF point) const; // Convert the Point to a graphical Point + QRectF range; + QPointF lastPoint; + QPointF pixel_coord_to_point (QPointF point) const; + QPointF point_to_pixel (QPointF point) const; int movingPoint; QElapsedTimer timer; QPointF c; - QColor colBezier; // Color of Bezier curve + QColor colBezier; - bool _draw_background; // Flag to determine if the background should be (re-)drawn on the QPixmap - QPixmap _background; // Image of the static parts (axis, lines, etc.) - bool _draw_function; // Flag to determine if the function should be (re-)drawn on the QPixmap - QPixmap _function; // Image of the function (static unless edited by the user) + bool _draw_background; + QPixmap _background; + bool _draw_function; + QPixmap _function; FunctionConfig* _config; }; - -#endif // QFUNCTIONCONFIGURATOR_H |