summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_filter_accela
diff options
context:
space:
mode:
Diffstat (limited to 'ftnoir_filter_accela')
-rw-r--r--ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui14
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.cpp4
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.h1
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp380
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp78
5 files changed, 239 insertions, 238 deletions
diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui
index bb27ed47..305b1b1d 100644
--- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui
+++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui
@@ -9,7 +9,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>570</width>
+ <width>620</width>
<height>71</height>
</rect>
</property>
@@ -34,7 +34,7 @@
<rect>
<x>243</x>
<y>10</y>
- <width>76</width>
+ <width>111</width>
<height>22</height>
</rect>
</property>
@@ -55,7 +55,7 @@
background:none;</string>
</property>
<property name="text">
- <string>Zoom slowness:</string>
+ <string>Zoom slowness</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="translation_alpha">
@@ -112,7 +112,7 @@ background:none;</string>
<widget class="QSlider" name="slideZoom">
<property name="geometry">
<rect>
- <x>325</x>
+ <x>346</x>
<y>13</y>
<width>189</width>
<height>15</height>
@@ -146,7 +146,7 @@ background:none;</string>
<widget class="QSpinBox" name="spinZoom">
<property name="geometry">
<rect>
- <x>520</x>
+ <x>541</x>
<y>10</y>
<width>42</width>
<height>22</height>
@@ -190,7 +190,7 @@ background:none;</string>
<widget class="QPushButton" name="btnOK">
<property name="geometry">
<rect>
- <x>409</x>
+ <x>430</x>
<y>40</y>
<width>75</width>
<height>23</height>
@@ -203,7 +203,7 @@ background:none;</string>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
- <x>490</x>
+ <x>511</x>
<y>40</y>
<width>75</width>
<height>23</height>
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
index 413702b5..4060a8eb 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
@@ -26,11 +26,11 @@ FTNoIR_Filter::~FTNoIR_Filter()
void FTNoIR_Filter::loadSettings() {
QSettings settings("opentrack"); // Registry settings (in HK_USER)
- QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
+ QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString();
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
iniFile.beginGroup ( "Accela" );
- zoom_factor = iniFile.value("zoom-slowness", 0).toDouble();
+ zoom_factor = iniFile.value("zoom-slowness", ACCELA_ZOOM_SLOWNESS).toDouble();
rotation_alpha = iniFile.value("rotation-alpha", ACCELA_SMOOTHING_ROTATION).toDouble();
translation_alpha = iniFile.value("translation-alpha", ACCELA_SMOOTHING_TRANSLATION).toDouble();
iniFile.endGroup ();
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h
index c5a74d22..82766293 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.h
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.h
@@ -36,6 +36,7 @@
#define ACCELA_SMOOTHING_ROTATION 60.0
#define ACCELA_SMOOTHING_TRANSLATION 40.0
+#define ACCELA_ZOOM_SLOWNESS 35
//*******************************************************************************************************
// FaceTrackNoIR Filter class.
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp
index 8c7cd386..18ef284e 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp
@@ -1,190 +1,190 @@
-/********************************************************************************
-* FaceTrackNoIR This program is a private project of some enthusiastic *
-* gamers from Holland, who don't like to pay much for *
-* head-tracking. *
-* *
-* Copyright (C) 2013 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 <http://www.gnu.org/licenses/>. *
-* *
-********************************************************************************/
-#include "ftnoir_filter_accela/ftnoir_filter_accela.h"
-#include <math.h>
-#include <QDebug>
-#include <algorithm>
-#include "facetracknoir/global-settings.h"
-
-//*******************************************************************************************************
-// FaceTrackNoIR Filter Settings-dialog.
-//*******************************************************************************************************
-//
-// Constructor for server-settings-dialog
-//
-FilterControls::FilterControls() :
- QWidget(), accela_filter(NULL)
-{
- ui.setupUi( this );
-
- // Load the settings from the current .INI-file
- loadSettings();
- connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
- connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
- connect(ui.rotation_alpha, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(int)));
- connect(ui.translation_alpha, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(int)));
-
- connect(ui.slideZoom, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
- connect(ui.spinZoom, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
-
- qDebug() << "FilterControls() says: started";
-}
-
-//
-// Destructor for server-dialog
-//
-FilterControls::~FilterControls() {
- qDebug() << "~FilterControls() says: started";
-}
-
-//
-// Initialize tracker-client-dialog
-//
-void FilterControls::Initialize(QWidget *parent) {
- loadSettings();
-
- QPoint offsetpos(100, 100);
- if (parent) {
- this->move(parent->pos() + offsetpos);
- }
- show();
-}
-
-void FilterControls::registerFilter(IFilter* filter)
-{
- accela_filter = (FTNoIR_Filter*) filter;
-}
-
-void FilterControls::unregisterFilter()
-{
- accela_filter = NULL;
-}
-
-//
-// OK clicked on server-dialog
-//
-void FilterControls::doOK() {
- save();
- this->close();
-}
-
-// override show event
-void FilterControls::showEvent ( QShowEvent * event ) {
-}
-
-//
-// Cancel clicked on server-dialog
-//
-void FilterControls::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 FilterControls::loadSettings() {
- 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() << "FTNoIR_Filter::loadSettings2 says: iniFile = " << currentFile;
-
- //qDebug() << "FTNoIR_Filter::loadSettings2 says: size = " << NUM_OF(defScaleRotation);
-
- iniFile.beginGroup ( "Accela" );
- ui.slideZoom->setValue(iniFile.value("zoom-slowness", 0).toInt());
- ui.spinZoom->setValue(iniFile.value("zoom-slowness", 0).toInt());
- ui.rotation_alpha->setValue(iniFile.value("rotation-alpha", ACCELA_SMOOTHING_ROTATION).toDouble());
- ui.translation_alpha->setValue(iniFile.value("translation-alpha", ACCELA_SMOOTHING_TRANSLATION).toDouble());
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Save the current Settings to the currently 'active' INI-file.
-//
-void FilterControls::save() {
- 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() << "FTNoIR_Filter::save() says: iniFile = " << currentFile;
-
- double rot, trans, zoom;
-
- iniFile.beginGroup ( "Accela" );
- iniFile.setValue("zoom-slowness", zoom = ui.slideZoom->value());
- iniFile.setValue("rotation-alpha", rot = ui.rotation_alpha->value());
- iniFile.setValue("translation-alpha", trans = ui.translation_alpha->value());
- iniFile.endGroup ();
-
- settingsDirty = false;
-
- if (accela_filter)
- accela_filter->receiveSettings(rot, trans, zoom);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Filter-settings dialog object.
-
-// Export both decorated and undecorated names.
-// GetFilterDialog - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetFilterDialog@0 - Common name decoration for __stdcall functions in C language.
-//#pragma comment(linker, "/export:GetFilterDialog=_GetFilterDialog@0")
-
-extern "C" FTNOIR_FILTER_BASE_EXPORT IFilterDialog* CALLING_CONVENTION GetDialog()
-{
- return new FilterControls;
-}
+/********************************************************************************
+* FaceTrackNoIR This program is a private project of some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
+* *
+* Copyright (C) 2013 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 <http://www.gnu.org/licenses/>. *
+* *
+********************************************************************************/
+#include "ftnoir_filter_accela/ftnoir_filter_accela.h"
+#include <math.h>
+#include <QDebug>
+#include <algorithm>
+#include "facetracknoir/global-settings.h"
+
+//*******************************************************************************************************
+// FaceTrackNoIR Filter Settings-dialog.
+//*******************************************************************************************************
+//
+// Constructor for server-settings-dialog
+//
+FilterControls::FilterControls() :
+ QWidget(), accela_filter(NULL)
+{
+ ui.setupUi( this );
+
+ // Load the settings from the current .INI-file
+ loadSettings();
+ connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
+ connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
+ connect(ui.rotation_alpha, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(int)));
+ connect(ui.translation_alpha, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(int)));
+
+ connect(ui.slideZoom, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.spinZoom, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+
+ qDebug() << "FilterControls() says: started";
+}
+
+//
+// Destructor for server-dialog
+//
+FilterControls::~FilterControls() {
+ qDebug() << "~FilterControls() says: started";
+}
+
+//
+// Initialize tracker-client-dialog
+//
+void FilterControls::Initialize(QWidget *parent) {
+ loadSettings();
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
+void FilterControls::registerFilter(IFilter* filter)
+{
+ accela_filter = (FTNoIR_Filter*) filter;
+}
+
+void FilterControls::unregisterFilter()
+{
+ accela_filter = NULL;
+}
+
+//
+// OK clicked on server-dialog
+//
+void FilterControls::doOK() {
+ save();
+ this->close();
+}
+
+// override show event
+void FilterControls::showEvent ( QShowEvent * event ) {
+}
+
+//
+// Cancel clicked on server-dialog
+//
+void FilterControls::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 FilterControls::loadSettings() {
+ 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() << "FTNoIR_Filter::loadSettings2 says: iniFile = " << currentFile;
+
+ //qDebug() << "FTNoIR_Filter::loadSettings2 says: size = " << NUM_OF(defScaleRotation);
+
+ iniFile.beginGroup ( "Accela" );
+ ui.slideZoom->setValue(iniFile.value("zoom-slowness", ACCELA_ZOOM_SLOWNESS).toInt());
+ ui.spinZoom->setValue(iniFile.value("zoom-slowness", ACCELA_ZOOM_SLOWNESS).toInt());
+ ui.rotation_alpha->setValue(iniFile.value("rotation-alpha", ACCELA_SMOOTHING_ROTATION).toDouble());
+ ui.translation_alpha->setValue(iniFile.value("translation-alpha", ACCELA_SMOOTHING_TRANSLATION).toDouble());
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+//
+// Save the current Settings to the currently 'active' INI-file.
+//
+void FilterControls::save() {
+ 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() << "FTNoIR_Filter::save() says: iniFile = " << currentFile;
+
+ double rot, trans, zoom;
+
+ iniFile.beginGroup ( "Accela" );
+ iniFile.setValue("zoom-slowness", zoom = ui.slideZoom->value());
+ iniFile.setValue("rotation-alpha", rot = ui.rotation_alpha->value());
+ iniFile.setValue("translation-alpha", trans = ui.translation_alpha->value());
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+
+ if (accela_filter)
+ accela_filter->receiveSettings(rot, trans, zoom);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Filter-settings dialog object.
+
+// Export both decorated and undecorated names.
+// GetFilterDialog - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetFilterDialog@0 - Common name decoration for __stdcall functions in C language.
+//#pragma comment(linker, "/export:GetFilterDialog=_GetFilterDialog@0")
+
+extern "C" FTNOIR_FILTER_BASE_EXPORT IFilterDialog* CALLING_CONVENTION GetDialog()
+{
+ return new FilterControls;
+}
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp
index 0235c067..d4a11028 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp
@@ -1,39 +1,39 @@
-/********************************************************************************
-* FaceTrackNoIR This program is a private project of some enthusiastic *
-* gamers from Holland, who don't like to pay much for *
-* head-tracking. *
-* *
-* Copyright (C) 2012 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 <http://www.gnu.org/licenses/>. *
-* *
-********************************************************************************/
-#include "ftnoir_filter_accela.h"
-#include "facetracknoir/global-settings.h"
-
-FTNoIR_FilterDll::FTNoIR_FilterDll() {
-}
-
-FTNoIR_FilterDll::~FTNoIR_FilterDll()
-{
-
-}
-
-extern "C" FTNOIR_FILTER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata()
-{
- return new FTNoIR_FilterDll;
-}
+/********************************************************************************
+* FaceTrackNoIR This program is a private project of some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
+* *
+* Copyright (C) 2012 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 <http://www.gnu.org/licenses/>. *
+* *
+********************************************************************************/
+#include "ftnoir_filter_accela.h"
+#include "facetracknoir/global-settings.h"
+
+FTNoIR_FilterDll::FTNoIR_FilterDll() {
+}
+
+FTNoIR_FilterDll::~FTNoIR_FilterDll()
+{
+
+}
+
+extern "C" FTNOIR_FILTER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata()
+{
+ return new FTNoIR_FilterDll;
+}