From c58c0af311892929dbce4e5437c4035214552438 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 15:34:44 +0200 Subject: Run dos2unix on the tree. No user-facing changes. --- facetracknoir/facetracknoir.h | 588 +++++++++++++++++++++--------------------- 1 file changed, 294 insertions(+), 294 deletions(-) (limited to 'facetracknoir/facetracknoir.h') diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index ff0b3642..768f6107 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -1,295 +1,295 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of the some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2010 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see . * -*********************************************************************************/ - -#ifndef FaceTrackNoIR_H -#define FaceTrackNoIR_H - -#undef FTNOIR_PROTOCOL_BASE_LIB -#undef FTNOIR_TRACKER_BASE_LIB -#undef FTNOIR_FILTER_BASE_LIB -#define FTNOIR_PROTOCOL_BASE_EXPORT Q_DECL_IMPORT -#define FTNOIR_TRACKER_BASE_EXPORT Q_DECL_IMPORT -#define FTNOIR_FILTER_BASE_EXPORT Q_DECL_IMPORT - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if !defined(_WIN32) && !defined(__WIN32) -# include -#else -# include -#endif -#include -#include -#include - - -#include "ui_facetracknoir.h" -#include "ui_ftnoir_keyboardshortcuts.h" -#include "ui_ftnoir_curves.h" - -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "ftnoir_filter_base/ftnoir_filter_base.h" - -#include "global-settings.h" -#include "tracker.h" - -class Tracker; // pre-define class to avoid circular includes -class FaceTrackNoIR; - -class KeybindingWorker; - -#if defined(__WIN32) || defined(_WIN32) -extern QList global_windows_key_sequences; -#undef DIRECTINPUT_VERSION -#define DIRECTINPUT_VERSION 0x0800 -#include -struct Key { - BYTE keycode; - bool shift; - bool ctrl; - bool alt; - bool ever_pressed; - QElapsedTimer timer; -public: - Key() : keycode(0), shift(false), ctrl(false), alt(false), ever_pressed(false) - { - } -}; -#else -typedef unsigned char BYTE; -struct Key { int foo; }; -#endif - -class FaceTrackNoIR : public QMainWindow, IDynamicLibraryProvider -{ - Q_OBJECT - -public: - FaceTrackNoIR(QWidget *parent = 0, Qt::WFlags flags = 0); - ~FaceTrackNoIR(); - - void updateSettings(); // Update the settings (let Tracker read INI-file). - - QFrame *get_video_widget(); // Get a pointer to the video-widget, to use in the DLL - Tracker *tracker; - void bindKeyboardShortcuts(); - DynamicLibrary* current_tracker1() { - return dlopen_trackers.value(ui.iconcomboTrackerSource->currentIndex(), (DynamicLibrary*) NULL); - } - DynamicLibrary* current_tracker2() { - return dlopen_trackers.value(ui.cbxSecondTrackerSource->currentIndex() - 1, (DynamicLibrary*) NULL); - } - DynamicLibrary* current_protocol() { - return dlopen_protocols.value(ui.iconcomboProtocol->currentIndex(), (DynamicLibrary*) NULL); - } - DynamicLibrary* current_filter() { - return dlopen_filters.value(ui.iconcomboFilter->currentIndex(), (DynamicLibrary*) NULL); - } - THeadPoseDOF& axis(int idx) { - return *pose.axes[idx]; - } - -#if defined(_WIN32) || defined(__WIN32) - Key keyCenter; - KeybindingWorker* keybindingWorker; -#else - QxtGlobalShortcut* keyCenter; -#endif -public slots: - void shortcutRecentered(); - -private: - HeadPoseData pose; - Ui::FaceTrackNoIRClass ui; - QTimer timUpdateHeadPose; // Timer to display headpose - QStringList iniFileList; // List of INI-files, that are present in the Settings folder - - 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) - - /** Widget variables **/ - QWidget *_keyboard_shortcuts; - QWidget *_curve_config; - - void createIconGroupBox(); -// void createMessageGroupBox(); - - /** helper **/ - bool cameraDetected; - bool settingsDirty; - - void GetCameraNameDX(); - void loadSettings(); - void setupFaceTrackNoIR(); - - QList dlopen_filters; - QList dlopen_trackers; - QList dlopen_protocols; - - bool looping; - - private slots: - //file menu - void open(); - void save(); - void saveAs(); - void exit(); -// void setIcon(int index); - void profileSelected(int index); - void protocolSelected(int index); - void filterSelected(int index); - void trackingSourceSelected(int index); - - void showVideoWidget(); - void showHeadPoseWidget(); - void showTrackerSettings(); - void showSecondTrackerSettings(); - - void showServerControls(); - void showFilterControls(); - void showKeyboardShortcuts(); - void showCurveConfiguration(); - - void setInvertAxis( Axis axis, int invert ); - void setInvertYaw(int invert) { - setInvertAxis(Yaw, invert); - } - void setInvertPitch(int invert) { - setInvertAxis(Pitch, invert); - } - void setInvertRoll(int invert) { - setInvertAxis(Roll, invert); - } - void setInvertX(int invert) { - setInvertAxis(TX, invert); - } - void setInvertY(int invert) { - setInvertAxis(TY, invert); - } - void setInvertZ(int invert) { - setInvertAxis(TZ, invert); - } - void showHeadPose(); - - void startTracker(); - void stopTracker(); - -}; - -class KeyboardShortcutDialog: public QWidget -{ - Q_OBJECT -public: - - explicit KeyboardShortcutDialog( FaceTrackNoIR *ftnoir, QWidget *parent=0, Qt::WindowFlags f=0 ); - virtual ~KeyboardShortcutDialog(); - void showEvent ( QShowEvent * event ); - -private: - Ui::UICKeyboardShortcutDialog ui; - void loadSettings(); - void save(); - - /** helper **/ - bool settingsDirty; - FaceTrackNoIR *mainApp; - -private slots: - void doOK(); - void doCancel(); -}; - -// Widget that has controls for Keyboard shortcuts. -class CurveConfigurationDialog: public QWidget -{ - Q_OBJECT -public: - - explicit CurveConfigurationDialog( FaceTrackNoIR *ftnoir, QWidget *parent=0, Qt::WindowFlags f=0 ); - virtual ~CurveConfigurationDialog(); - void showEvent ( QShowEvent * event ); - -private: - Ui::UICCurveConfigurationDialog ui; - void loadSettings(); - void save(); - - /** helper **/ - bool settingsDirty; - FaceTrackNoIR *mainApp; - -private slots: - void doOK(); - void doCancel(); - void curveChanged( bool change ) { settingsDirty = true; } - void curveChanged( int change ) { settingsDirty = true; } -}; - -extern QList global_key_sequences; -#if defined(__WIN32) || defined(_WIN32) -class KeybindingWorkerDummy { -private: - LPDIRECTINPUT8 din; - LPDIRECTINPUTDEVICE8 dinkeyboard; - Key kCenter; - FaceTrackNoIR& window; -public: - volatile bool should_quit; - ~KeybindingWorkerDummy(); - KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter); - void run(); -}; -#else -class KeybindingWorkerDummy { -public: - KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter); - void run() {} -}; -#endif - -class KeybindingWorker : public QThread, public KeybindingWorkerDummy { - Q_OBJECT -public: - KeybindingWorker(FaceTrackNoIR& w, Key keyCenter) : KeybindingWorkerDummy(w, keyCenter) - { - } - void run() { - KeybindingWorkerDummy::run(); - } -}; - +/******************************************************************************** +* FaceTrackNoIR This program is a private project of the some enthusiastic * +* gamers from Holland, who don't like to pay much for * +* head-tracking. * +* * +* Copyright (C) 2010 Wim Vriend (Developing) * +* Ron Hendriks (Researching and Testing) * +* * +* Homepage * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU General Public License as published by the * +* Free Software Foundation; either version 3 of the License, or (at your * +* option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but * +* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * +* more details. * +* * +* You should have received a copy of the GNU General Public License along * +* with this program; if not, see . * +*********************************************************************************/ + +#ifndef FaceTrackNoIR_H +#define FaceTrackNoIR_H + +#undef FTNOIR_PROTOCOL_BASE_LIB +#undef FTNOIR_TRACKER_BASE_LIB +#undef FTNOIR_FILTER_BASE_LIB +#define FTNOIR_PROTOCOL_BASE_EXPORT Q_DECL_IMPORT +#define FTNOIR_TRACKER_BASE_EXPORT Q_DECL_IMPORT +#define FTNOIR_FILTER_BASE_EXPORT Q_DECL_IMPORT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if !defined(_WIN32) && !defined(__WIN32) +# include +#else +# include +#endif +#include +#include +#include + + +#include "ui_facetracknoir.h" +#include "ui_ftnoir_keyboardshortcuts.h" +#include "ui_ftnoir_curves.h" + +#include "ftnoir_protocol_base/ftnoir_protocol_base.h" +#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#include "ftnoir_filter_base/ftnoir_filter_base.h" + +#include "global-settings.h" +#include "tracker.h" + +class Tracker; // pre-define class to avoid circular includes +class FaceTrackNoIR; + +class KeybindingWorker; + +#if defined(__WIN32) || defined(_WIN32) +extern QList global_windows_key_sequences; +#undef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION 0x0800 +#include +struct Key { + BYTE keycode; + bool shift; + bool ctrl; + bool alt; + bool ever_pressed; + QElapsedTimer timer; +public: + Key() : keycode(0), shift(false), ctrl(false), alt(false), ever_pressed(false) + { + } +}; +#else +typedef unsigned char BYTE; +struct Key { int foo; }; +#endif + +class FaceTrackNoIR : public QMainWindow, IDynamicLibraryProvider +{ + Q_OBJECT + +public: + FaceTrackNoIR(QWidget *parent = 0, Qt::WFlags flags = 0); + ~FaceTrackNoIR(); + + void updateSettings(); // Update the settings (let Tracker read INI-file). + + QFrame *get_video_widget(); // Get a pointer to the video-widget, to use in the DLL + Tracker *tracker; + void bindKeyboardShortcuts(); + DynamicLibrary* current_tracker1() { + return dlopen_trackers.value(ui.iconcomboTrackerSource->currentIndex(), (DynamicLibrary*) NULL); + } + DynamicLibrary* current_tracker2() { + return dlopen_trackers.value(ui.cbxSecondTrackerSource->currentIndex() - 1, (DynamicLibrary*) NULL); + } + DynamicLibrary* current_protocol() { + return dlopen_protocols.value(ui.iconcomboProtocol->currentIndex(), (DynamicLibrary*) NULL); + } + DynamicLibrary* current_filter() { + return dlopen_filters.value(ui.iconcomboFilter->currentIndex(), (DynamicLibrary*) NULL); + } + THeadPoseDOF& axis(int idx) { + return *pose.axes[idx]; + } + +#if defined(_WIN32) || defined(__WIN32) + Key keyCenter; + KeybindingWorker* keybindingWorker; +#else + QxtGlobalShortcut* keyCenter; +#endif +public slots: + void shortcutRecentered(); + +private: + HeadPoseData pose; + Ui::FaceTrackNoIRClass ui; + QTimer timUpdateHeadPose; // Timer to display headpose + QStringList iniFileList; // List of INI-files, that are present in the Settings folder + + 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) + + /** Widget variables **/ + QWidget *_keyboard_shortcuts; + QWidget *_curve_config; + + void createIconGroupBox(); +// void createMessageGroupBox(); + + /** helper **/ + bool cameraDetected; + bool settingsDirty; + + void GetCameraNameDX(); + void loadSettings(); + void setupFaceTrackNoIR(); + + QList dlopen_filters; + QList dlopen_trackers; + QList dlopen_protocols; + + bool looping; + + private slots: + //file menu + void open(); + void save(); + void saveAs(); + void exit(); +// void setIcon(int index); + void profileSelected(int index); + void protocolSelected(int index); + void filterSelected(int index); + void trackingSourceSelected(int index); + + void showVideoWidget(); + void showHeadPoseWidget(); + void showTrackerSettings(); + void showSecondTrackerSettings(); + + void showServerControls(); + void showFilterControls(); + void showKeyboardShortcuts(); + void showCurveConfiguration(); + + void setInvertAxis( Axis axis, int invert ); + void setInvertYaw(int invert) { + setInvertAxis(Yaw, invert); + } + void setInvertPitch(int invert) { + setInvertAxis(Pitch, invert); + } + void setInvertRoll(int invert) { + setInvertAxis(Roll, invert); + } + void setInvertX(int invert) { + setInvertAxis(TX, invert); + } + void setInvertY(int invert) { + setInvertAxis(TY, invert); + } + void setInvertZ(int invert) { + setInvertAxis(TZ, invert); + } + void showHeadPose(); + + void startTracker(); + void stopTracker(); + +}; + +class KeyboardShortcutDialog: public QWidget +{ + Q_OBJECT +public: + + explicit KeyboardShortcutDialog( FaceTrackNoIR *ftnoir, QWidget *parent=0, Qt::WindowFlags f=0 ); + virtual ~KeyboardShortcutDialog(); + void showEvent ( QShowEvent * event ); + +private: + Ui::UICKeyboardShortcutDialog ui; + void loadSettings(); + void save(); + + /** helper **/ + bool settingsDirty; + FaceTrackNoIR *mainApp; + +private slots: + void doOK(); + void doCancel(); +}; + +// Widget that has controls for Keyboard shortcuts. +class CurveConfigurationDialog: public QWidget +{ + Q_OBJECT +public: + + explicit CurveConfigurationDialog( FaceTrackNoIR *ftnoir, QWidget *parent=0, Qt::WindowFlags f=0 ); + virtual ~CurveConfigurationDialog(); + void showEvent ( QShowEvent * event ); + +private: + Ui::UICCurveConfigurationDialog ui; + void loadSettings(); + void save(); + + /** helper **/ + bool settingsDirty; + FaceTrackNoIR *mainApp; + +private slots: + void doOK(); + void doCancel(); + void curveChanged( bool change ) { settingsDirty = true; } + void curveChanged( int change ) { settingsDirty = true; } +}; + +extern QList global_key_sequences; +#if defined(__WIN32) || defined(_WIN32) +class KeybindingWorkerDummy { +private: + LPDIRECTINPUT8 din; + LPDIRECTINPUTDEVICE8 dinkeyboard; + Key kCenter; + FaceTrackNoIR& window; +public: + volatile bool should_quit; + ~KeybindingWorkerDummy(); + KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter); + void run(); +}; +#else +class KeybindingWorkerDummy { +public: + KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter); + void run() {} +}; +#endif + +class KeybindingWorker : public QThread, public KeybindingWorkerDummy { + Q_OBJECT +public: + KeybindingWorker(FaceTrackNoIR& w, Key keyCenter) : KeybindingWorkerDummy(w, keyCenter) + { + } + void run() { + KeybindingWorkerDummy::run(); + } +}; + #endif // FaceTrackNoIR_H \ No newline at end of file -- cgit v1.2.3 From b8fd03ece0aca5ac01b04d5df1beee1c93438ec0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 15:42:57 +0200 Subject: Remove unused member variable --- facetracknoir/facetracknoir.cpp | 8 +++++++- facetracknoir/facetracknoir.h | 6 ++---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'facetracknoir/facetracknoir.h') diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index e834b6be..58381c13 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -168,7 +168,6 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent, Qt::WFlags flags) : timUpdateHeadPose(this) { ui.setupUi(this); - cameraDetected = false; // // Initialize Widget handles, to prevent memory-access errors. @@ -571,6 +570,13 @@ void FaceTrackNoIR::loadSettings() { } } + if (!_curve_config) + { + _curve_config = new CurveConfigurationDialog( this, this, Qt::Dialog ); + } + + ((CurveConfigurationDialog*) _curve_config)->loadSettings(); + settingsDirty = false; looping = false; } diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 768f6107..ee4e9132 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -149,7 +149,6 @@ private: // void createMessageGroupBox(); /** helper **/ - bool cameraDetected; bool settingsDirty; void GetCameraNameDX(); @@ -242,10 +241,9 @@ public: explicit CurveConfigurationDialog( FaceTrackNoIR *ftnoir, QWidget *parent=0, Qt::WindowFlags f=0 ); virtual ~CurveConfigurationDialog(); void showEvent ( QShowEvent * event ); - + void loadSettings(); private: Ui::UICCurveConfigurationDialog ui; - void loadSettings(); void save(); /** helper **/ @@ -292,4 +290,4 @@ public: } }; -#endif // FaceTrackNoIR_H \ No newline at end of file +#endif // FaceTrackNoIR_H -- cgit v1.2.3 From 8c3c17c9e0e9d377a69ad44c4a3e350bf9f1d505 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 17:11:36 +0200 Subject: Move spline configuration into separate file Unfortunately, there's still a circular dependency between spline configuration and the main widget which *still* contains the most logic for the software. --- facetracknoir/curve-config.cpp | 248 ++++++++++++++++++++++++++++++++++++++++ facetracknoir/curve-config.h | 28 +++++ facetracknoir/facetracknoir.cpp | 244 --------------------------------------- facetracknoir/facetracknoir.h | 63 +++------- 4 files changed, 295 insertions(+), 288 deletions(-) create mode 100644 facetracknoir/curve-config.cpp create mode 100644 facetracknoir/curve-config.h (limited to 'facetracknoir/facetracknoir.h') diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp new file mode 100644 index 00000000..05b2e065 --- /dev/null +++ b/facetracknoir/curve-config.cpp @@ -0,0 +1,248 @@ +#include "facetracknoir/facetracknoir.h" +#include "facetracknoir/curve-config.h" +#include +//**************************************************************************************************// +//**************************************************************************************************// +// +// Constructor for Curve-configuration-dialog +// +CurveConfigurationDialog::CurveConfigurationDialog( FaceTrackNoIR *ftnoir, QWidget *parent, Qt::WindowFlags f ) : +QWidget( parent , f) +{ + ui.setupUi( this ); + + QPoint offsetpos(120, 30); + this->move(parent->pos() + offsetpos); + + mainApp = ftnoir; // Preserve a pointer to FTNoIR + + // Connect Qt signals to member-functions + connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); + connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); + + // Load the settings from the current .INI-file + loadSettings(); +} + +// +// Destructor for server-dialog +// +CurveConfigurationDialog::~CurveConfigurationDialog() { + qDebug() << "~CurveConfigurationDialog() says: started"; +} + +// +// OK clicked on server-dialog +// +void CurveConfigurationDialog::doOK() { + save(); + this->close(); +} + +// override show event +void CurveConfigurationDialog::showEvent ( QShowEvent * event ) { + loadSettings(); +} + +// +// Cancel clicked on server-dialog +// +void CurveConfigurationDialog::doCancel() { + // + // Ask if changed Settings should be saved + // + if (settingsDirty) { + int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); + + qDebug() << "doCancel says: answer =" << ret; + + switch (ret) { + case QMessageBox::Save: + save(); + this->close(); + break; + case QMessageBox::Discard: + this->close(); + break; + case QMessageBox::Cancel: + // Cancel was clicked + break; + default: + // should never be reached + break; + } + } + else { + this->close(); + } +} + +// +// Load the current Settings from the currently 'active' INI-file. +// +void CurveConfigurationDialog::loadSettings() { + qDebug() << "CurveConfigurationDialog::loadSettings says: Starting "; + QSettings settings("opentrack"); // Registry settings (in HK_USER) + + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) + + qDebug() << "CurveConfigurationDialog::loadSettings says: iniFile = " << currentFile; + + static const char* names[] = { + "tx_alt", + "ty_alt", + "tz_alt", + "rx_alt", + "ry_alt", + "rz_alt" + }; + + iniFile.beginGroup("Tracking"); + + for (int i = 0; i < 6; i++) + mainApp->axis(i).altp = iniFile.value(names[i], false).toBool(); + + QCheckBox* widgets[] = { + ui.tx_altp, + ui.ty_altp, + ui.tz_altp, + ui.rx_altp, + ui.ry_altp, + ui.rz_altp + }; + + for (int i = 0; i < 6; i++) + widgets[i]->setChecked(mainApp->axis(i).altp); + + QDoubleSpinBox* widgets2[] = { + ui.pos_tx, + ui.pos_ty, + ui.pos_tz, + ui.pos_tx, + ui.pos_ry, + ui.pos_rz + }; + + const char* names2[] = { + "zero_tx", + "zero_ty", + "zero_tz", + "zero_rx", + "zero_ry", + "zero_rz" + }; + + + for (int i = 0; i < 6; i++) + widgets2[i]->setValue(iniFile.value(names2[i], 0).toDouble()); + + iniFile.endGroup(); + + 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 + }; + + QCheckBox* checkboxes[6] = { + ui.rx_altp, + ui.ry_altp, + ui.rz_altp, + ui.tx_altp, + ui.ty_altp, + ui.tz_altp + }; + + for (int i = 0; i < 6; i++) + { + configs[i]->setConfig(&mainApp->axis(i).curve, currentFile); + alt_configs[i]->setConfig(&mainApp->axis(i).curveAlt, currentFile); + configs[i]->loadSettings(currentFile); + alt_configs[i]->loadSettings(currentFile); + connect(configs[i], SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); + connect(alt_configs[i], SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); + connect(checkboxes[i], SIGNAL(stateChanged(int)), this, SLOT(curveChanged(int))); + } + + settingsDirty = false; +} + +// +// Save the current Settings to the currently 'active' INI-file. +// +void CurveConfigurationDialog::save() { + + qDebug() << "save() says: started"; + + QSettings settings("opentrack"); // Registry settings (in HK_USER) + + 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); + + QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) + + iniFile.beginGroup("Tracking"); + + iniFile.setValue("rx_alt", ui.rx_altp->checkState() != Qt::Unchecked); + iniFile.setValue("ry_alt", ui.ry_altp->checkState() != Qt::Unchecked); + iniFile.setValue("rz_alt", ui.rz_altp->checkState() != Qt::Unchecked); + iniFile.setValue("tx_alt", ui.tx_altp->checkState() != Qt::Unchecked); + iniFile.setValue("ty_alt", ui.ty_altp->checkState() != Qt::Unchecked); + iniFile.setValue("tz_alt", ui.tz_altp->checkState() != Qt::Unchecked); + + QDoubleSpinBox* widgets2[] = { + ui.pos_tx, + ui.pos_ty, + ui.pos_tz, + ui.pos_tx, + ui.pos_ry, + ui.pos_rz + }; + + const char* names2[] = { + "zero_tx", + "zero_ty", + "zero_tz", + "zero_rx", + "zero_ry", + "zero_rz" + }; + + for (int i = 0; i < 6; i++) + iniFile.setValue(names2[i], widgets2[i]->value()); + + iniFile.endGroup(); + + settingsDirty = false; + + // + // Send a message to the main program, to update the Settings (for the tracker) + // + mainApp->updateSettings(); +} diff --git a/facetracknoir/curve-config.h b/facetracknoir/curve-config.h new file mode 100644 index 00000000..e783dd33 --- /dev/null +++ b/facetracknoir/curve-config.h @@ -0,0 +1,28 @@ +#pragma once +#include +#include "ui_ftnoir_curves.h" + +class FaceTrackNoIR; + +class CurveConfigurationDialog: public QWidget +{ + Q_OBJECT +public: + + explicit CurveConfigurationDialog( FaceTrackNoIR *ftnoir, QWidget *parent=0, Qt::WindowFlags f=0 ); + virtual ~CurveConfigurationDialog(); + void showEvent ( QShowEvent * event ); + void loadSettings(); +private: + Ui::UICCurveConfigurationDialog ui; + void save(); + + bool settingsDirty; + FaceTrackNoIR *mainApp; + +private slots: + void doOK(); + void doCancel(); + void curveChanged( bool change ) { settingsDirty = true; } + void curveChanged( int change ) { settingsDirty = true; } +}; diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 8e368b8d..313673c6 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -1319,250 +1319,6 @@ void KeyboardShortcutDialog::save() { mainApp->updateSettings(); } -//**************************************************************************************************// -//**************************************************************************************************// -// -// Constructor for Curve-configuration-dialog -// -CurveConfigurationDialog::CurveConfigurationDialog( FaceTrackNoIR *ftnoir, QWidget *parent, Qt::WindowFlags f ) : -QWidget( parent , f) -{ - ui.setupUi( this ); - - QPoint offsetpos(120, 30); - this->move(parent->pos() + offsetpos); - - mainApp = ftnoir; // Preserve a pointer to FTNoIR - - // Connect Qt signals to member-functions - connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); - - // Load the settings from the current .INI-file - loadSettings(); -} - -// -// Destructor for server-dialog -// -CurveConfigurationDialog::~CurveConfigurationDialog() { - qDebug() << "~CurveConfigurationDialog() says: started"; -} - -// -// OK clicked on server-dialog -// -void CurveConfigurationDialog::doOK() { - save(); - this->close(); -} - -// override show event -void CurveConfigurationDialog::showEvent ( QShowEvent * event ) { - loadSettings(); -} - -// -// Cancel clicked on server-dialog -// -void CurveConfigurationDialog::doCancel() { - // - // Ask if changed Settings should be saved - // - if (settingsDirty) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - save(); - this->close(); - break; - case QMessageBox::Discard: - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } -} - -// -// Load the current Settings from the currently 'active' INI-file. -// -void CurveConfigurationDialog::loadSettings() { - qDebug() << "CurveConfigurationDialog::loadSettings says: Starting "; - QSettings settings("opentrack"); // Registry settings (in HK_USER) - - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - - qDebug() << "CurveConfigurationDialog::loadSettings says: iniFile = " << currentFile; - - static const char* names[] = { - "tx_alt", - "ty_alt", - "tz_alt", - "rx_alt", - "ry_alt", - "rz_alt" - }; - - iniFile.beginGroup("Tracking"); - - for (int i = 0; i < 6; i++) - mainApp->axis(i).altp = iniFile.value(names[i], false).toBool(); - - QCheckBox* widgets[] = { - ui.tx_altp, - ui.ty_altp, - ui.tz_altp, - ui.rx_altp, - ui.ry_altp, - ui.rz_altp - }; - - for (int i = 0; i < 6; i++) - widgets[i]->setChecked(mainApp->axis(i).altp); - - QDoubleSpinBox* widgets2[] = { - ui.pos_tx, - ui.pos_ty, - ui.pos_tz, - ui.pos_tx, - ui.pos_ry, - ui.pos_rz - }; - - const char* names2[] = { - "zero_tx", - "zero_ty", - "zero_tz", - "zero_rx", - "zero_ry", - "zero_rz" - }; - - - for (int i = 0; i < 6; i++) - widgets2[i]->setValue(iniFile.value(names2[i], 0).toDouble()); - - iniFile.endGroup(); - - 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 - }; - - QCheckBox* checkboxes[6] = { - ui.rx_altp, - ui.ry_altp, - ui.rz_altp, - ui.tx_altp, - ui.ty_altp, - ui.tz_altp - }; - - for (int i = 0; i < 6; i++) - { - configs[i]->setConfig(&mainApp->axis(i).curve, currentFile); - alt_configs[i]->setConfig(&mainApp->axis(i).curveAlt, currentFile); - connect(configs[i], SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - connect(alt_configs[i], SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - connect(checkboxes[i], SIGNAL(stateChanged(int)), this, SLOT(curveChanged(int))); - } - - settingsDirty = false; -} - -// -// Save the current Settings to the currently 'active' INI-file. -// -void CurveConfigurationDialog::save() { - - qDebug() << "save() says: started"; - - QSettings settings("opentrack"); // Registry settings (in HK_USER) - - 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); - - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - - iniFile.beginGroup("Tracking"); - - iniFile.setValue("rx_alt", ui.rx_altp->checkState() != Qt::Unchecked); - iniFile.setValue("ry_alt", ui.ry_altp->checkState() != Qt::Unchecked); - iniFile.setValue("rz_alt", ui.rz_altp->checkState() != Qt::Unchecked); - iniFile.setValue("tx_alt", ui.tx_altp->checkState() != Qt::Unchecked); - iniFile.setValue("ty_alt", ui.ty_altp->checkState() != Qt::Unchecked); - iniFile.setValue("tz_alt", ui.tz_altp->checkState() != Qt::Unchecked); - - QDoubleSpinBox* widgets2[] = { - ui.pos_tx, - ui.pos_ty, - ui.pos_tz, - ui.pos_tx, - ui.pos_ry, - ui.pos_rz - }; - - const char* names2[] = { - "zero_tx", - "zero_ty", - "zero_tz", - "zero_rx", - "zero_ry", - "zero_rz" - }; - - for (int i = 0; i < 6; i++) - iniFile.setValue(names2[i], widgets2[i]->value()); - - iniFile.endGroup(); - - settingsDirty = false; - - // - // Send a message to the main program, to update the Settings (for the tracker) - // - mainApp->updateSettings(); -} - void FaceTrackNoIR::shortcutRecentered() { if (tracker) diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index ee4e9132..ab0b8bc5 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -56,7 +56,6 @@ #include "ui_facetracknoir.h" #include "ui_ftnoir_keyboardshortcuts.h" -#include "ui_ftnoir_curves.h" #include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ftnoir_tracker_base/ftnoir_tracker_base.h" @@ -64,6 +63,7 @@ #include "global-settings.h" #include "tracker.h" +#include "facetracknoir/curve-config.h" class Tracker; // pre-define class to avoid circular includes class FaceTrackNoIR; @@ -161,27 +161,27 @@ private: bool looping; - private slots: - //file menu - void open(); - void save(); - void saveAs(); - void exit(); +private slots: + //file menu + void open(); + void save(); + void saveAs(); + void exit(); // void setIcon(int index); - void profileSelected(int index); - void protocolSelected(int index); - void filterSelected(int index); - void trackingSourceSelected(int index); + void profileSelected(int index); + void protocolSelected(int index); + void filterSelected(int index); + void trackingSourceSelected(int index); - void showVideoWidget(); - void showHeadPoseWidget(); - void showTrackerSettings(); - void showSecondTrackerSettings(); + void showVideoWidget(); + void showHeadPoseWidget(); + void showTrackerSettings(); + void showSecondTrackerSettings(); - void showServerControls(); - void showFilterControls(); - void showKeyboardShortcuts(); - void showCurveConfiguration(); + void showServerControls(); + void showFilterControls(); + void showKeyboardShortcuts(); + void showCurveConfiguration(); void setInvertAxis( Axis axis, int invert ); void setInvertYaw(int invert) { @@ -232,31 +232,6 @@ private slots: void doCancel(); }; -// Widget that has controls for Keyboard shortcuts. -class CurveConfigurationDialog: public QWidget -{ - Q_OBJECT -public: - - explicit CurveConfigurationDialog( FaceTrackNoIR *ftnoir, QWidget *parent=0, Qt::WindowFlags f=0 ); - virtual ~CurveConfigurationDialog(); - void showEvent ( QShowEvent * event ); - void loadSettings(); -private: - Ui::UICCurveConfigurationDialog ui; - void save(); - - /** helper **/ - bool settingsDirty; - FaceTrackNoIR *mainApp; - -private slots: - void doOK(); - void doCancel(); - void curveChanged( bool change ) { settingsDirty = true; } - void curveChanged( int change ) { settingsDirty = true; } -}; - extern QList global_key_sequences; #if defined(__WIN32) || defined(_WIN32) class KeybindingWorkerDummy { -- cgit v1.2.3 From f5a465e829ce817e8b0fdaf2d240a34f37ca1c35 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 17:59:21 +0200 Subject: Move keyboard shortcuts to a new file Windows build could be interminently broken. Will resolve in following commits. --- facetracknoir/facetracknoir.cpp | 106 +--------------------------------------- facetracknoir/facetracknoir.h | 80 ------------------------------ facetracknoir/shortcuts.cpp | 102 ++++++++++++++++++++++++++++++++++++++ facetracknoir/shortcuts.h | 89 +++++++++++++++++++++++++++++++++ 4 files changed, 193 insertions(+), 184 deletions(-) create mode 100644 facetracknoir/shortcuts.cpp create mode 100644 facetracknoir/shortcuts.h (limited to 'facetracknoir/facetracknoir.h') diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 313673c6..2d5fe4a0 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -22,12 +22,14 @@ * with this program; if not, see . * *********************************************************************************/ #include "facetracknoir.h" +#include "shortcuts.h" #include "tracker.h" #include #include #if defined(__WIN32) || defined(_WIN32) # include +# include #endif #if defined(__APPLE__) @@ -40,110 +42,6 @@ #include -#if defined(__WIN32) || defined(_WIN32) -#undef DIRECTINPUT_VERSION -#define DIRECTINPUT_VERSION 0x0800 -#include -#include - -KeybindingWorkerDummy::~KeybindingWorkerDummy() { - if (dinkeyboard) { - dinkeyboard->Unacquire(); - dinkeyboard->Release(); - } - if (din) - din->Release(); -} - -KeybindingWorkerDummy::KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter) -: kCenter(keyCenter), window(w), should_quit(true), din(0), dinkeyboard(0) -{ - if (DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&din, NULL) != DI_OK) { - qDebug() << "setup DirectInput8 Creation failed!" << GetLastError(); - return; - } - if (din->CreateDevice(GUID_SysKeyboard, &dinkeyboard, NULL) != DI_OK) { - din->Release(); - din = 0; - qDebug() << "setup CreateDevice function failed!" << GetLastError(); - return; - } - if (dinkeyboard->SetDataFormat(&c_dfDIKeyboard) != DI_OK) { - qDebug() << "setup SetDataFormat function failed!" << GetLastError(); - dinkeyboard->Release(); - dinkeyboard = 0; - din->Release(); - din = 0; - return; - } - - if (dinkeyboard->SetCooperativeLevel(window.winId(), DISCL_NONEXCLUSIVE | DISCL_BACKGROUND) != DI_OK) { - dinkeyboard->Release(); - din->Release(); - din = 0; - dinkeyboard = 0; - qDebug() << "setup SetCooperativeLevel function failed!" << GetLastError(); - return; - } - if (dinkeyboard->Acquire() != DI_OK) - { - dinkeyboard->Release(); - din->Release(); - din = 0; - dinkeyboard = 0; - qDebug() << "setup dinkeyboard Acquire failed!" << GetLastError(); - return; - } - should_quit = false; -} - -#define PROCESS_KEY(k, s) \ - if (isKeyPressed(&k, keystate) && (!k.ever_pressed ? (k.timer.start(), k.ever_pressed = true) : k.timer.restart() > 100)) \ - window.s(); - -static bool isKeyPressed( const Key *key, const BYTE *keystate ) { - bool shift; - bool ctrl; - bool alt; - - if (keystate[key->keycode] & 0x80) { - shift = ( (keystate[DIK_LSHIFT] & 0x80) || (keystate[DIK_RSHIFT] & 0x80) ); - 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; -} - -void KeybindingWorkerDummy::run() { - BYTE keystate[256]; - while (!should_quit) - { - if (dinkeyboard->GetDeviceState(256, (LPVOID)keystate) != DI_OK) { - qDebug() << "Tracker::run GetDeviceState function failed!" << GetLastError(); - Sleep(25); - continue; - } - - PROCESS_KEY(kCenter, shortcutRecentered); - - Sleep(25); - } -} -#else -#endif - #ifdef _MSC_VER # define LIB_PREFIX "" #else diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index ab0b8bc5..b1a1cb42 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -53,9 +53,7 @@ #include #include - #include "ui_facetracknoir.h" -#include "ui_ftnoir_keyboardshortcuts.h" #include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ftnoir_tracker_base/ftnoir_tracker_base.h" @@ -70,28 +68,6 @@ class FaceTrackNoIR; class KeybindingWorker; -#if defined(__WIN32) || defined(_WIN32) -extern QList global_windows_key_sequences; -#undef DIRECTINPUT_VERSION -#define DIRECTINPUT_VERSION 0x0800 -#include -struct Key { - BYTE keycode; - bool shift; - bool ctrl; - bool alt; - bool ever_pressed; - QElapsedTimer timer; -public: - Key() : keycode(0), shift(false), ctrl(false), alt(false), ever_pressed(false) - { - } -}; -#else -typedef unsigned char BYTE; -struct Key { int foo; }; -#endif - class FaceTrackNoIR : public QMainWindow, IDynamicLibraryProvider { Q_OBJECT @@ -209,60 +185,4 @@ private slots: }; -class KeyboardShortcutDialog: public QWidget -{ - Q_OBJECT -public: - - explicit KeyboardShortcutDialog( FaceTrackNoIR *ftnoir, QWidget *parent=0, Qt::WindowFlags f=0 ); - virtual ~KeyboardShortcutDialog(); - void showEvent ( QShowEvent * event ); - -private: - Ui::UICKeyboardShortcutDialog ui; - void loadSettings(); - void save(); - - /** helper **/ - bool settingsDirty; - FaceTrackNoIR *mainApp; - -private slots: - void doOK(); - void doCancel(); -}; - -extern QList global_key_sequences; -#if defined(__WIN32) || defined(_WIN32) -class KeybindingWorkerDummy { -private: - LPDIRECTINPUT8 din; - LPDIRECTINPUTDEVICE8 dinkeyboard; - Key kCenter; - FaceTrackNoIR& window; -public: - volatile bool should_quit; - ~KeybindingWorkerDummy(); - KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter); - void run(); -}; -#else -class KeybindingWorkerDummy { -public: - KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter); - void run() {} -}; -#endif - -class KeybindingWorker : public QThread, public KeybindingWorkerDummy { - Q_OBJECT -public: - KeybindingWorker(FaceTrackNoIR& w, Key keyCenter) : KeybindingWorkerDummy(w, keyCenter) - { - } - void run() { - KeybindingWorkerDummy::run(); - } -}; - #endif // FaceTrackNoIR_H diff --git a/facetracknoir/shortcuts.cpp b/facetracknoir/shortcuts.cpp new file mode 100644 index 00000000..1a80c8dc --- /dev/null +++ b/facetracknoir/shortcuts.cpp @@ -0,0 +1,102 @@ +#if defined(__WIN32) || defined(_WIN32) +#include "facetracknoir/facetracknoir.h" +#include "facetracknoir/shortcut-dialog.h" +#include + +KeybindingWorkerDummy::~KeybindingWorkerDummy() { + if (dinkeyboard) { + dinkeyboard->Unacquire(); + dinkeyboard->Release(); + } + if (din) + din->Release(); +} + +KeybindingWorkerDummy::KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter) +: kCenter(keyCenter), window(w), should_quit(true), din(0), dinkeyboard(0) +{ + if (DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&din, NULL) != DI_OK) { + qDebug() << "setup DirectInput8 Creation failed!" << GetLastError(); + return; + } + if (din->CreateDevice(GUID_SysKeyboard, &dinkeyboard, NULL) != DI_OK) { + din->Release(); + din = 0; + qDebug() << "setup CreateDevice function failed!" << GetLastError(); + return; + } + if (dinkeyboard->SetDataFormat(&c_dfDIKeyboard) != DI_OK) { + qDebug() << "setup SetDataFormat function failed!" << GetLastError(); + dinkeyboard->Release(); + dinkeyboard = 0; + din->Release(); + din = 0; + return; + } + + if (dinkeyboard->SetCooperativeLevel(window.winId(), DISCL_NONEXCLUSIVE | DISCL_BACKGROUND) != DI_OK) { + dinkeyboard->Release(); + din->Release(); + din = 0; + dinkeyboard = 0; + qDebug() << "setup SetCooperativeLevel function failed!" << GetLastError(); + return; + } + if (dinkeyboard->Acquire() != DI_OK) + { + dinkeyboard->Release(); + din->Release(); + din = 0; + dinkeyboard = 0; + qDebug() << "setup dinkeyboard Acquire failed!" << GetLastError(); + return; + } + should_quit = false; +} + +#define PROCESS_KEY(k, s) \ + if (isKeyPressed(&k, keystate) && (!k.ever_pressed ? (k.timer.start(), k.ever_pressed = true) : k.timer.restart() > 100)) \ + window.s(); + +static bool isKeyPressed( const Key *key, const BYTE *keystate ) { + bool shift; + bool ctrl; + bool alt; + + if (keystate[key->keycode] & 0x80) { + shift = ( (keystate[DIK_LSHIFT] & 0x80) || (keystate[DIK_RSHIFT] & 0x80) ); + 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; +} + +void KeybindingWorkerDummy::run() { + BYTE keystate[256]; + while (!should_quit) + { + if (dinkeyboard->GetDeviceState(256, (LPVOID)keystate) != DI_OK) { + qDebug() << "Tracker::run GetDeviceState function failed!" << GetLastError(); + Sleep(25); + continue; + } + + PROCESS_KEY(kCenter, shortcutRecentered); + + Sleep(25); + } +} +#else +#endif diff --git a/facetracknoir/shortcuts.h b/facetracknoir/shortcuts.h new file mode 100644 index 00000000..9f2fd5f6 --- /dev/null +++ b/facetracknoir/shortcuts.h @@ -0,0 +1,89 @@ +#pragma once +#include +#include +#include +#include "ui_ftnoir_keyboardshortcuts.h" + +class FaceTrackNoIR; + +class KeyboardShortcutDialog: public QWidget +{ + Q_OBJECT +public: + + explicit KeyboardShortcutDialog( FaceTrackNoIR *ftnoir, QWidget *parent=0, Qt::WindowFlags f=0 ); + virtual ~KeyboardShortcutDialog(); + void showEvent ( QShowEvent * event ); + +private: + Ui::UICKeyboardShortcutDialog ui; + void loadSettings(); + void save(); + + bool settingsDirty; + FaceTrackNoIR *mainApp; + +private slots: + void doOK(); + void doCancel(); +}; + +extern QList global_key_sequences; + +#if defined(__WIN32) || defined(_WIN32) +extern QList global_windows_key_sequences; +# undef DIRECTINPUT_VERSION +# define DIRECTINPUT_VERSION 0x0800 +# include +# undef DIRECTINPUT_VERSION +# define DIRECTINPUT_VERSION 0x0800 +# include + +struct Key { + BYTE keycode; + bool shift; + bool ctrl; + bool alt; + bool ever_pressed; + QElapsedTimer timer; +public: + Key() : keycode(0), shift(false), ctrl(false), alt(false), ever_pressed(false) + { + } +}; +#else +typedef unsigned char BYTE; +struct Key { int foo; }; +#endif + +#if defined(__WIN32) || defined(_WIN32) +class KeybindingWorkerImpl { +private: + LPDIRECTINPUT8 din; + LPDIRECTINPUTDEVICE8 dinkeyboard; + Key kCenter; + FaceTrackNoIR& window; +public: + volatile bool should_quit; + ~KeybindingWorkerImpl(); + KeybindingWorkerImpl(FaceTrackNoIR& w, Key keyCenter); + void run(); +}; +#else +class KeybindingWorkerImpl { +public: + KeybindingWorkerImpl(FaceTrackNoIR& w, Key keyCenter); + void run() {} +}; +#endif + +class KeybindingWorker : public QThread, public KeybindingWorkerImpl { + Q_OBJECT +public: + KeybindingWorker(FaceTrackNoIR& w, Key keyCenter) : KeybindingWorkerImpl(w, keyCenter) + { + } + void run() { + KeybindingWorkerImpl::run(); + } +}; -- cgit v1.2.3 From fc83b218cb5297071ce154f60c815588bbbeb769 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 18:12:56 +0200 Subject: Remove unused functions --- facetracknoir/facetracknoir.cpp | 32 -------------------------------- facetracknoir/facetracknoir.h | 7 ------- 2 files changed, 39 deletions(-) (limited to 'facetracknoir/facetracknoir.h') diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 087de81c..16691c5d 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -139,14 +139,10 @@ void FaceTrackNoIR::setupFaceTrackNoIR() { //Load the tracker-settings, from the INI-file loadSettings(); - connect(ui.iconcomboProtocol, SIGNAL(currentIndexChanged(int)), this, SLOT(protocolSelected(int))); connect(ui.iconcomboProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(profileSelected(int))); - connect(ui.iconcomboTrackerSource, SIGNAL(currentIndexChanged(int)), this, SLOT(trackingSourceSelected(int))); - connect(ui.iconcomboFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(filterSelected(int))); //Setup the timer for showing the headpose. connect(&timUpdateHeadPose, SIGNAL(timeout()), this, SLOT(showHeadPose())); - settingsDirty = false; } /** destructor stops the engine and quits the faceapi **/ @@ -309,8 +305,6 @@ void FaceTrackNoIR::save() { iniFile.setValue ( "DLL", filter == NULL ? "" : filter->filename); } iniFile.endGroup (); - - settingsDirty = false; } // @@ -486,7 +480,6 @@ void FaceTrackNoIR::loadSettings() { ((CurveConfigurationDialog*)_curve_config)->loadSettings(); - settingsDirty = false; looping = false; } @@ -713,7 +706,6 @@ void FaceTrackNoIR::stopTracker( ) { void FaceTrackNoIR::setInvertAxis(Axis axis, int invert ) { if (tracker) tracker->setInvertAxis (axis, (invert != 0)?true:false ); - settingsDirty = true; } /** Show the headpose in the widget (triggered by timer) **/ @@ -959,22 +951,6 @@ void FaceTrackNoIR::createIconGroupBox() connect(ui.cbxSecondTrackerSource, SIGNAL(currentIndexChanged(int)), this, SLOT(trackingSourceSelected(int))); } -// -// Handle changes of the Protocol selection -// -void FaceTrackNoIR::protocolSelected(int index) -{ - settingsDirty = true; -} - -// -// Handle changes of the Tracking Source selection -// -void FaceTrackNoIR::trackingSourceSelected(int index) -{ - settingsDirty = true; -} - // // Handle changes of the Profile selection // @@ -996,14 +972,6 @@ void FaceTrackNoIR::profileSelected(int index) loadSettings(); } -// -// Handle changes of the Filter selection -// -void FaceTrackNoIR::filterSelected(int index) -{ - settingsDirty = true; -} - void FaceTrackNoIR::bindKeyboardShortcuts() { QSettings settings("opentrack"); // Registry settings (in HK_USER) diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index b1a1cb42..ba9538f6 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -122,10 +122,6 @@ private: QWidget *_curve_config; void createIconGroupBox(); -// void createMessageGroupBox(); - - /** helper **/ - bool settingsDirty; void GetCameraNameDX(); void loadSettings(); @@ -145,9 +141,6 @@ private slots: void exit(); // void setIcon(int index); void profileSelected(int index); - void protocolSelected(int index); - void filterSelected(int index); - void trackingSourceSelected(int index); void showVideoWidget(); void showHeadPoseWidget(); -- cgit v1.2.3 From 349ed6430b02b1b92fe5aa60a9b5daf2b29ae381 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 18:24:52 +0200 Subject: Rename for clarity --- facetracknoir/curve-config.cpp | 2 +- facetracknoir/facetracknoir.cpp | 2 +- facetracknoir/facetracknoir.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'facetracknoir/facetracknoir.h') diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index 68303b44..ba734111 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -239,5 +239,5 @@ void CurveConfigurationDialog::save() { // // Send a message to the main program, to update the Settings (for the tracker) // - mainApp->updateSettings(); + mainApp->update_tracker_settings(); } diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 508c616c..84daff52 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -200,7 +200,7 @@ FaceTrackNoIR::~FaceTrackNoIR() { // // Update the Settings, after a value has changed. This way, the Tracker does not have to re-start. // -void FaceTrackNoIR::updateSettings() { +void FaceTrackNoIR::update_tracker_settings() { if ( tracker != NULL ) { tracker->loadSettings(); } diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index ba9538f6..763b5dad 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -76,7 +76,7 @@ public: FaceTrackNoIR(QWidget *parent = 0, Qt::WFlags flags = 0); ~FaceTrackNoIR(); - void updateSettings(); // Update the settings (let Tracker read INI-file). + void update_tracker_settings(); // Update the settings (let Tracker read INI-file). QFrame *get_video_widget(); // Get a pointer to the video-widget, to use in the DLL Tracker *tracker; -- cgit v1.2.3 From ec1c2b16379d657db92c90e25b9e01393267b596 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 18:51:32 +0200 Subject: Clean up preprocessor mingw-isms No functional changes. --- compat/compat.cpp | 2 +- compat/compat.h | 6 +++--- facetracknoir/facetracknoir.cpp | 17 ++++++++--------- facetracknoir/facetracknoir.h | 4 ++-- facetracknoir/global-settings.cpp | 6 +++--- facetracknoir/global-settings.h | 6 +++--- facetracknoir/global-shortcuts.cpp | 2 +- facetracknoir/shortcuts.cpp | 2 +- facetracknoir/shortcuts.h | 4 ++-- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 6 +++--- 11 files changed, 29 insertions(+), 30 deletions(-) (limited to 'facetracknoir/facetracknoir.h') diff --git a/compat/compat.cpp b/compat/compat.cpp index 8eedc845..d8aac9bc 100644 --- a/compat/compat.cpp +++ b/compat/compat.cpp @@ -7,7 +7,7 @@ #define IN_FTNOIR_COMPAT #include "compat.h" -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) PortableLockedShm::PortableLockedShm(const char* shmName, const char* mutexName, int mapSize) { diff --git a/compat/compat.h b/compat/compat.h index 7692b38a..6a95f167 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -6,7 +6,7 @@ */ #pragma once -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) #include #else #include @@ -19,7 +19,7 @@ #include #endif -#if defined(IN_FTNOIR_COMPAT) && (defined(_WIN32) || defined(__WIN32)) +#if defined(IN_FTNOIR_COMPAT) && defined(_WIN32) # define COMPAT_EXPORT __declspec(dllexport) #else # define COMPAT_EXPORT @@ -33,7 +33,7 @@ public: void unlock(); void* mem; private: -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) HANDLE hMutex, hMapFile; #else int fd, size; diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 85607329..6ff1759b 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -27,14 +27,14 @@ #include #include -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) # include # include #endif #if defined(__APPLE__) # define SONAME "dylib" -#elif defined(_WIN32) || defined(__WIN32) +#elif defined(_WIN32) # define SONAME "dll" #else # define SONAME "so" @@ -86,7 +86,7 @@ static void fill_combobox(const QString& filter, QList& list, Q // Setup the Main Dialog // FaceTrackNoIR::FaceTrackNoIR(QWidget *parent, Qt::WFlags flags) : - #if defined(__WIN32) || defined(_WIN32) + #if defined(_WIN32) keybindingWorker(NULL), #else keyCenter(0), @@ -544,7 +544,7 @@ void FaceTrackNoIR::startTracker( ) { return; } -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) keybindingWorker = new KeybindingWorker(*this, keyCenter); keybindingWorker->start(); #endif @@ -657,7 +657,7 @@ void FaceTrackNoIR::startTracker( ) { /** stop tracking the face **/ void FaceTrackNoIR::stopTracker( ) { ui.game_name->setText("Not connected"); -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) if (keybindingWorker) { keybindingWorker->should_quit = true; @@ -958,7 +958,7 @@ void FaceTrackNoIR::bindKeyboardShortcuts() iniFile.beginGroup ( "KB_Shortcuts" ); int idxCenter = iniFile.value("Key_index_Center", 0).toInt(); -#if !defined(_WIN32) && !defined(__WIN32) +#if !defined(_WIN32) if (keyCenter) { delete keyCenter; keyCenter = NULL; @@ -979,7 +979,6 @@ void FaceTrackNoIR::bindKeyboardShortcuts() connect(keyCenter, SIGNAL(activated()), this, SLOT(shortcutRecentered())); } } - #else keyCenter.keycode = 0; keyCenter.shift = keyCenter.alt = keyCenter.ctrl = 0; @@ -993,7 +992,7 @@ void FaceTrackNoIR::bindKeyboardShortcuts() if (tracker) /* running already */ { -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) if (keybindingWorker) { keybindingWorker->should_quit = true; @@ -1011,7 +1010,7 @@ void FaceTrackNoIR::shortcutRecentered() { if (tracker) { -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) MessageBeep(MB_OK); #else QApplication::beep(); diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 763b5dad..8f83a851 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -44,7 +44,7 @@ #include #include #include -#if !defined(_WIN32) && !defined(__WIN32) +#if !defined(_WIN32) # include #else # include @@ -97,7 +97,7 @@ public: return *pose.axes[idx]; } -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) Key keyCenter; KeybindingWorker* keybindingWorker; #else diff --git a/facetracknoir/global-settings.cpp b/facetracknoir/global-settings.cpp index f605b591..4a655171 100644 --- a/facetracknoir/global-settings.cpp +++ b/facetracknoir/global-settings.cpp @@ -1,6 +1,6 @@ #include "global-settings.h" -#if !(defined(__WIN32) || defined(_WIN32)) +#if !(defined(_WIN32)) # include #endif @@ -92,7 +92,7 @@ DynamicLibrary::DynamicLibrary(const QString& filename) { this->filename = filename; QString fullPath = QCoreApplication::applicationDirPath() + "/" + this->filename; -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) handle = new QLibrary(fullPath); Dialog = (SETTINGS_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetDialog" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); Constructor = (NULLARY_DYNAMIC_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetConstructor" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); @@ -128,7 +128,7 @@ DynamicLibrary::DynamicLibrary(const QString& filename) DynamicLibrary::~DynamicLibrary() { -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) handle->unload(); #else if (handle) diff --git a/facetracknoir/global-settings.h b/facetracknoir/global-settings.h index 29a8da62..b2a54e20 100644 --- a/facetracknoir/global-settings.h +++ b/facetracknoir/global-settings.h @@ -1,6 +1,6 @@ #pragma once -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) # define CALLING_CONVENTION_SUFFIX_VOID_FUNCTION "@0" # ifdef _MSC_VER # define MAYBE_STDCALL_UNDERSCORE "_" @@ -21,7 +21,7 @@ #include "ftnoir_filter_base/ftnoir_filter_base.h" #include "ftnoir_protocol_base/ftnoir_protocol_base.h" -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) # define CALLING_CONVENTION __stdcall #else # define CALLING_CONVENTION @@ -57,7 +57,7 @@ public: METADATA_FUNCTION Metadata; QString filename; private: -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) QLibrary* handle; #else void* handle; diff --git a/facetracknoir/global-shortcuts.cpp b/facetracknoir/global-shortcuts.cpp index 286200c0..8666333c 100644 --- a/facetracknoir/global-shortcuts.cpp +++ b/facetracknoir/global-shortcuts.cpp @@ -1,6 +1,6 @@ #include "facetracknoir/facetracknoir.h" -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) #include #include #include diff --git a/facetracknoir/shortcuts.cpp b/facetracknoir/shortcuts.cpp index cf4b81f8..cdb2c3b7 100644 --- a/facetracknoir/shortcuts.cpp +++ b/facetracknoir/shortcuts.cpp @@ -125,7 +125,7 @@ void KeyboardShortcutDialog::save() { settingsDirty = false; } -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) #include KeybindingWorkerImpl::~KeybindingWorkerImpl() { diff --git a/facetracknoir/shortcuts.h b/facetracknoir/shortcuts.h index 15256b6c..685c78b6 100644 --- a/facetracknoir/shortcuts.h +++ b/facetracknoir/shortcuts.h @@ -34,7 +34,7 @@ private slots: extern QList global_key_sequences; -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) extern QList global_windows_key_sequences; # undef DIRECTINPUT_VERSION # define DIRECTINPUT_VERSION 0x0800 @@ -60,7 +60,7 @@ typedef unsigned char BYTE; struct Key { int foo; }; #endif -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) class KeybindingWorkerImpl { private: LPDIRECTINPUT8 din; diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index dcd91994..3f5960ef 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -17,7 +17,7 @@ #include #include -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) #include #else #include @@ -26,7 +26,7 @@ // delicious copypasta static QList get_camera_names(void) { QList ret; -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) // Create the System Device Enumerator. HRESULT hr; ICreateDevEnum *pSysDevEnum = NULL; diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 45c62f55..9be50efa 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -7,7 +7,7 @@ #include "facetracknoir/global-settings.h" #include -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) #include #else #include @@ -16,7 +16,7 @@ // delicious copypasta static QList get_camera_names(void) { QList ret; -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) // Create the System Device Enumerator. HRESULT hr; ICreateDevEnum *pSysDevEnum = NULL; @@ -175,7 +175,7 @@ void Tracker::StartTracker(QFrame* videoframe) shm->pause = shm->terminate = shm->running = false; shm->timer = 0; subprocess.setWorkingDirectory(QCoreApplication::applicationDirPath() + "/tracker-ht"); -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) subprocess.start("\"" + QCoreApplication::applicationDirPath() + "/tracker-ht/headtracker-ftnoir" + "\""); #else subprocess.start(QCoreApplication::applicationDirPath() + "/tracker-ht/headtracker-ftnoir"); -- cgit v1.2.3 From 94c0368c1a008d089ab780ffcea4f8aa24a0ee35 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 23:46:24 +0200 Subject: Unbreak Windows build --- facetracknoir/facetracknoir.h | 1 + freetrackclient/freetrackclient.cpp | 18 +++++++----------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'facetracknoir/facetracknoir.h') diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 8f83a851..b4ea2912 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -62,6 +62,7 @@ #include "global-settings.h" #include "tracker.h" #include "facetracknoir/curve-config.h" +#include "facetracknoir/shortcuts.h" class Tracker; // pre-define class to avoid circular includes class FaceTrackNoIR; diff --git a/freetrackclient/freetrackclient.cpp b/freetrackclient/freetrackclient.cpp index 52aa6190..0f8ced65 100644 --- a/freetrackclient/freetrackclient.cpp +++ b/freetrackclient/freetrackclient.cpp @@ -34,7 +34,7 @@ #include #include -#include "ftnoir_protocol_ft\fttypes.h" +#include "ftnoir_protocol_ft/fttypes.h" // // Functions to create/open the file-mapping @@ -58,8 +58,8 @@ static FILE *debug_stream = fopen("c:\\FreeTrackClient.log", "a"); static HANDLE hFTMemMap = 0; static FTMemMap *pMemData = 0; static HANDLE hFTMutex = 0; -static char* dllVersion = "1.0.0.0"; -static char* dllProvider = "FreeTrack"; +static const char* dllVersion = "1.0.0.0"; +static const char* dllProvider = "FreeTrack"; static unsigned short gameid = 0; @@ -92,13 +92,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) /****************************************************************** * FTGetData (FreeTrackClient.1) */ + #pragma comment(linker, "/export:FTGetData@4=FTGetData") FT_EXPORT(bool) FTGetData(PFreetrackData data) { - static int frame = 0; static int prevDataID = 0; static int dlyTrackingOff = 0; - static int tracking = 0; + // dbg_report("NP_GetData called."); if (FTCreateMapping() == false) return false; @@ -117,7 +117,6 @@ FT_EXPORT(bool) FTGetData(PFreetrackData data) dlyTrackingOff++; if (dlyTrackingOff > 20) { dlyTrackingOff = 100; - tracking = false; } } prevDataID = pMemData->data.DataID; @@ -161,7 +160,7 @@ FT_EXPORT(void) FTReportName( int name ) * FTGetDllVersion (FreeTrackClient.3) */ #pragma comment(linker, "/export:FTGetDllVersion@0=FTGetDllVersion") -extern "C" __declspec( dllexport ) char* FTGetDllVersion(void) +extern "C" __declspec( dllexport ) const char* FTGetDllVersion(void) { dbg_report("FTGetDllVersion request.\n"); @@ -172,7 +171,7 @@ extern "C" __declspec( dllexport ) char* FTGetDllVersion(void) * FTProvider (FreeTrackClient.4) */ #pragma comment(linker, "/export:FTProvider@0=FTProvider") -extern "C" __declspec( dllexport ) char* FTProvider(void) +extern "C" __declspec( dllexport ) const char* FTProvider(void) { dbg_report("FTProvider request.\n"); @@ -186,8 +185,6 @@ extern "C" __declspec( dllexport ) char* FTProvider(void) // bool FTCreateMapping() { - bool bMappingExists = false; - // // Memory-mapping already exists! // @@ -211,7 +208,6 @@ bool FTCreateMapping() if ( ( hFTMemMap != 0 ) && ( GetLastError() == ERROR_ALREADY_EXISTS ) ) { dbg_report("FTCreateMapping: Mapping already exists.\n"); - bMappingExists = true; // So the server was (probably) already started! CloseHandle( hFTMemMap ); hFTMemMap = 0; } -- cgit v1.2.3