diff options
-rw-r--r-- | facetracknoir/curve-config.cpp | 5 | ||||
-rw-r--r-- | facetracknoir/facetracknoir.cpp | 4 | ||||
-rw-r--r-- | facetracknoir/facetracknoir.h | 24 | ||||
-rw-r--r-- | facetracknoir/plugin-support.cpp | 7 | ||||
-rw-r--r-- | facetracknoir/plugin-support.h | 1 | ||||
-rw-r--r-- | facetracknoir/rotation.h | 11 | ||||
-rw-r--r-- | facetracknoir/shortcuts.cpp | 12 | ||||
-rw-r--r-- | facetracknoir/tracker.cpp | 2 | ||||
-rw-r--r-- | facetracknoir/tracker_types.cpp | 4 | ||||
-rw-r--r-- | ftnoir_csv/csv.cpp | 18 | ||||
-rw-r--r-- | ftnoir_csv/csv.h | 11 | ||||
-rw-r--r-- | ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp | 16 | ||||
-rw-r--r-- | ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp | 5 | ||||
-rw-r--r-- | ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 6 | ||||
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 5 | ||||
-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 |
19 files changed, 44 insertions, 186 deletions
diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index 2bff009a..ef63607d 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -11,7 +11,6 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge QPoint offsetpos(120, 30); this->move(parent->pos() + offsetpos); - // Connect Qt signals to member-functions connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); @@ -39,7 +38,6 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge tie_setting(mainApp->s.a_y.invert, ui.chkInvertY); tie_setting(mainApp->s.a_z.invert, ui.chkInvertZ); - // Load the settings from the current .INI-file loadSettings(); } @@ -54,9 +52,6 @@ void CurveConfigurationDialog::doCancel() { close(); } -// -// Load the current Settings from the currently 'active' INI-file. -// void CurveConfigurationDialog::loadSettings() { QFunctionConfigurator* configs[6] = { ui.txconfig, diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index d717b3be..8df368cd 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -26,7 +26,7 @@ #include "tracker.h" #include "curve-config.h" #include "opentrack-version.h" -#include <QDebug> +#include <QFileDialog> #if defined(_WIN32) # include <windows.h> @@ -185,7 +185,6 @@ void FaceTrackNoIR::GetCameraNameDX() { #if defined(_WIN32) ui.cameraName->setText("No video-capturing device was found in your system: check if it's connected!"); - // Create the System Device Enumerator. HRESULT hr; ICreateDevEnum *pSysDevEnum = NULL; hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); @@ -197,7 +196,6 @@ void FaceTrackNoIR::GetCameraNameDX() { qDebug() << "GetWDM says: CoCreateInstance succeeded!"; - // Obtain a class enumerator for the video compressor category. IEnumMoniker *pEnumCat = NULL; hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index ca8084c2..1da2d6b8 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -22,24 +22,16 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. * *********************************************************************************/ -#ifndef FaceTrackNoIR_H -#define FaceTrackNoIR_H +#pragma once #include <QMainWindow> #include <QApplication> -#include <QFileDialog> -#include <QListView> -#include <QPainter> #include <QWidget> #include <QDialog> #include <QUrl> #include <QList> #include <QKeySequence> -#include <QtGui> -#include <QString> -#include <QByteArray> #include <QShortcut> -#include <vector> #if !defined(_WIN32) # include "qxt-mini/QxtGlobalShortcut" #else @@ -78,7 +70,7 @@ public: FaceTrackNoIR(QWidget *parent = 0); ~FaceTrackNoIR(); - QFrame *get_video_widget(); // Get a pointer to the video-widget, to use in the DLL + QFrame *get_video_widget(); Tracker *tracker; void bindKeyboardShortcuts(); DynamicLibrary* current_tracker1() { @@ -114,12 +106,12 @@ public slots: private: HeadPoseData pose; Ui::OpentrackUI ui; - QTimer timUpdateHeadPose; // Timer to display headpose + QTimer timUpdateHeadPose; - ITrackerDialog* pTrackerDialog; // Pointer to Tracker dialog instance (in DLL) - ITrackerDialog* pSecondTrackerDialog; // Pointer to the second Tracker dialog instance (in DLL) - IProtocolDialog* pProtocolDialog; // Pointer to Protocol dialog instance (in DLL) - IFilterDialog* pFilterDialog; // Pointer to Filter dialog instance (in DLL) + ITrackerDialog* pTrackerDialog; + ITrackerDialog* pSecondTrackerDialog; + IProtocolDialog* pProtocolDialog; + IFilterDialog* pFilterDialog; QWidget *_keyboard_shortcuts; QWidget *_curve_config; @@ -161,5 +153,3 @@ private slots: void startTracker(); void stopTracker(); }; - -#endif // FaceTrackNoIR_H diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp index 5d810ed1..2e80c5e4 100644 --- a/facetracknoir/plugin-support.cpp +++ b/facetracknoir/plugin-support.cpp @@ -1,4 +1,5 @@ #include "plugin-support.h" +#include <QCoreApplication> #if !(defined(_WIN32)) # include <dlfcn.h> @@ -62,15 +63,9 @@ SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : pFilter = (IFilter*) ptr(); } - // Check if the Protocol-server files were installed OK. - // Some servers also create a memory-mapping, for Inter Process Communication. - // The handle of the MainWindow is sent to 'The Game', so it can send a message back. - if (pProtocol) if(!pProtocol->checkServerInstallationOK()) return; - - // retrieve pointers to the User Interface and the main Application if (pTracker) { pTracker->StartTracker( mainApp->get_video_widget() ); } diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index 1c63151a..931f0fa1 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -77,6 +77,7 @@ struct Metadata virtual void getIcon(QIcon *icon) = 0; }; +// merely to break a circular header dependency -sh class IDynamicLibraryProvider { public: virtual DynamicLibrary* current_tracker1() = 0; diff --git a/facetracknoir/rotation.h b/facetracknoir/rotation.h index 22f35abb..d40fb6cf 100644 --- a/facetracknoir/rotation.h +++ b/facetracknoir/rotation.h @@ -5,10 +5,9 @@ * copyright notice and this permission notice appear in all copies. */ -#ifndef ROTATION_H -#define ROTATION_H +#pragma once #include <cmath> -// ---------------------------------------------------------------------------- + class RotationType { public: @@ -16,7 +15,7 @@ public: RotationType(double yaw, double pitch, double roll) { fromEuler(yaw, pitch, roll); } RotationType(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} - RotationType inv(){ // inverse + RotationType inv(){ return RotationType(a,-b,-c, -d); } @@ -58,7 +57,3 @@ public: protected: double a,b,c,d; // quaternion coefficients }; - - - -#endif //ROTATION_H diff --git a/facetracknoir/shortcuts.cpp b/facetracknoir/shortcuts.cpp index 601bbcc6..758617ca 100644 --- a/facetracknoir/shortcuts.cpp +++ b/facetracknoir/shortcuts.cpp @@ -9,9 +9,8 @@ KeyboardShortcutDialog::KeyboardShortcutDialog( FaceTrackNoIR *ftnoir, QWidget * QPoint offsetpos(100, 100); this->move(parent->pos() + offsetpos); - mainApp = ftnoir; // Preserve a pointer to FTNoIR + mainApp = ftnoir; - // Connect Qt signals to member-functions connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); @@ -33,9 +32,6 @@ KeyboardShortcutDialog::KeyboardShortcutDialog( FaceTrackNoIR *ftnoir, QWidget * tie_setting(mainApp->s.dingp, ui.ding); } -// -// OK clicked on server-dialog -// void KeyboardShortcutDialog::doOK() { mainApp->b->save(); this->close(); @@ -112,16 +108,10 @@ static bool isKeyPressed( const Key *key, const BYTE *keystate ) { ctrl = ( (keystate[DIK_LCONTROL] & 0x80) || (keystate[DIK_RCONTROL] & 0x80) ); alt = ( (keystate[DIK_LALT] & 0x80) || (keystate[DIK_RALT] & 0x80) ); - // - // If one of the modifiers is needed and not pressed, return false. - // if (key->shift && !shift) return false; if (key->ctrl && !ctrl) return false; if (key->alt && !alt) return false; - // - // All is well! - // return true; } return false; diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index dfe9bc1d..01fd0b4c 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -160,7 +160,7 @@ void Tracker::run() { t_compensate(output_camera.axes, output_camera.axes, mainApp->s.tcomp_tz);
if (Libraries->pProtocol) {
- Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); // degrees & centimeters
+ Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); }
}
diff --git a/facetracknoir/tracker_types.cpp b/facetracknoir/tracker_types.cpp index dec4ff81..ba3ac552 100644 --- a/facetracknoir/tracker_types.cpp +++ b/facetracknoir/tracker_types.cpp @@ -20,8 +20,7 @@ T6DOF operator-(const T6DOF& A, const T6DOF& B) C.axes[TX] = A.axes[TX] - B.axes[TX]; C.axes[TY] = A.axes[TY] - B.axes[TY]; C.axes[TZ] = A.axes[TZ] - B.axes[TZ]; - //C.frame_number? - return C; + return C; } T6DOF operator+(const T6DOF& A, const T6DOF& B) @@ -39,6 +38,5 @@ T6DOF operator+(const T6DOF& A, const T6DOF& B) C.axes[TX] = A.axes[TX] + B.axes[TX]; C.axes[TY] = A.axes[TY] + B.axes[TY]; C.axes[TZ] = A.axes[TZ] + B.axes[TZ]; - //C.frame_number? return C; } diff --git a/ftnoir_csv/csv.cpp b/ftnoir_csv/csv.cpp index 66823d24..b59b5083 100644 --- a/ftnoir_csv/csv.cpp +++ b/ftnoir_csv/csv.cpp @@ -25,9 +25,9 @@ #define INSIDE_CSV #include "csv.h" #include <QTextDecoder> -#include <QDebug> #include <QFile> #include <QCoreApplication> +#include <QDebug> CSV::CSV(QIODevice * device) { @@ -46,12 +46,10 @@ CSV::CSV(QString &string){ CSV::~CSV() { - //delete m_codec; } void CSV::setCodec(const char* codecName){ - //delete m_codec; m_codec = QTextCodec::codecForName(codecName); } @@ -59,7 +57,6 @@ QString CSV::readLine(){ QString line; if(m_string.isNull()){ - //READ DATA FROM DEVICE if(m_device && m_device->isReadable()){ QTextDecoder dec(m_codec); m_string = dec.toUnicode(m_device->readAll()); @@ -67,8 +64,6 @@ QString CSV::readLine(){ return QString(); } } - - //PARSE if((m_pos = m_rx.indexIn(m_string,m_pos)) != -1) { line = m_rx.cap(1); m_pos += m_rx.matchedLength(); @@ -111,12 +106,9 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename) QStringList gameLine; qDebug() << "getGameData, ID = " << gameID; - // - // Open the supported games list, to get the Name. - // QFile file(QCoreApplication::applicationDirPath() + "/settings/facetracknoir supported games.csv"); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){ - return; + return; } CSV csv(&file); gameLine = csv.parseLine(); @@ -131,9 +123,6 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename) //qDebug() << "Column 6: " << gameLine.at(6); // International ID //qDebug() << "Column 7: " << gameLine.at(7); // FaceTrackNoIR ID - // - // If the gameID was found, fill the shared memory - // if (gameLine.count() > 6) { if (gameLine.at(6).compare( gameID, Qt::CaseInsensitive ) == 0) { QByteArray id = gameLine.at(7).toLatin1(); @@ -172,9 +161,6 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename) gameLine = csv.parseLine(); } - // - // If the gameID was NOT found, fill only the name "Unknown game connected" - // qDebug() << "Unknown game connected" << gameID; file.close(); } diff --git a/ftnoir_csv/csv.h b/ftnoir_csv/csv.h index bfbece58..79e1351e 100644 --- a/ftnoir_csv/csv.h +++ b/ftnoir_csv/csv.h @@ -1,11 +1,4 @@ -/*dummy CSV reader for QT4*/ -/*version 0.1*/ -/*11.1.2009*/ -#ifndef CSV_H -#define CSV_H - -//#include "myclass_api.h" - +#pragma once #include <QObject> #include <QStringList> #include <QIODevice> @@ -41,5 +34,3 @@ private: CSV(QIODevice * device); CSV(QString &string); }; - -#endif // CSV_H diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp index 29d46219..a6fae479 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp @@ -2,13 +2,6 @@ #include <QDebug> #include "facetracknoir/plugin-support.h" -//******************************************************************************************************* -// FaceTrackNoIR Client Settings-dialog. -//******************************************************************************************************* - -// -// Constructor for server-settings-dialog -// FTControls::FTControls() : QWidget() { ui.setupUi( this ); @@ -16,19 +9,10 @@ FTControls::FTControls() : QWidget() connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); } -// -// Destructor for server-dialog - -// -// OK clicked on server-dialog -// void FTControls::doOK() { this->close(); } -// -// Cancel clicked on server-dialog -// void FTControls::doCancel() { this->close(); } diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp index 7bab1651..7d7fb247 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp @@ -1,13 +1,12 @@ #include "ftnoir_protocol_wine.h" -#include <QDebug> #include "facetracknoir/plugin-support.h" -FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() { +FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() +{ } FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() { - } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index bf596f51..e1d92b78 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -54,10 +54,8 @@ static BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, diprg.diph.dwHeaderSize = sizeof( DIPROPHEADER ); diprg.diph.dwHow = DIPH_BYID; diprg.diph.dwObj = pdidoi->dwType; - diprg.lMax = AXIS_MAX; - diprg.lMin = -AXIS_MAX; - - // Set the range for the axis + diprg.lMax = FTNoIR_Tracker::AXIS_MAX; + diprg.lMin = -FTNoIR_Tracker::AXIS_MAX; if( FAILED( self->g_pJoystick->SetProperty( DIPROP_RANGE, &diprg.diph ) ) ) return DIENUM_STOP; diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index b7ec9784..cc8079bf 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -4,9 +4,8 @@ TrackerControls::TrackerControls() : QWidget() { - ui.setupUi( this ); + ui.setupUi( this ); - // Connect Qt signals to member-functions connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); @@ -34,7 +33,7 @@ void TrackerControls::doCancel() { close(); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog() { return new TrackerControls; } 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 |