diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-12-30 09:55:53 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-12-30 09:55:53 +0100 |
commit | 90d5ffb413bdaa05bc84ff8403ac0399d9ea117a (patch) | |
tree | d86f95cdd16ff22b9b73f205159b2eec3f3ab30f | |
parent | 6e16b672ac49db35d1d0365991de01831d29a0dc (diff) |
use option classes, and remove cruft while we're at it
-rw-r--r-- | ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui | 770 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.cpp | 61 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.h | 82 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp | 243 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp | 32 |
5 files changed, 305 insertions, 883 deletions
diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui index fb6a9565..4ea78c9f 100644 --- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui +++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>347</width> - <height>339</height> + <width>202</width> + <height>241</height> </rect> </property> <property name="sizePolicy"> @@ -21,8 +21,8 @@ </property> <property name="minimumSize"> <size> - <width>347</width> - <height>268</height> + <width>0</width> + <height>0</height> </size> </property> <property name="maximumSize"> @@ -47,555 +47,246 @@ <property name="styleSheet"> <string notr="true"/> </property> - <layout class="QGridLayout" name="gridLayout"> - <property name="margin"> - <number>6</number> - </property> - <property name="spacing"> - <number>4</number> - </property> + <layout class="QFormLayout" name="formLayout"> <item row="0" column="0"> - <widget class="QGroupBox" name="groupbox2"> - <property name="enabled"> - <bool>true</bool> + <widget class="QLabel" name="label_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Rotation</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="rotation_alpha"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="correctionMode"> + <enum>QAbstractSpinBox::CorrectToPreviousValue</enum> + </property> + <property name="decimals"> + <number>4</number> + </property> + <property name="minimum"> + <double>0.100000000000000</double> + </property> + <property name="maximum"> + <double>65535.000000000000000</double> + </property> + <property name="value"> + <double>1.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Translation</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDoubleSpinBox" name="translation_alpha"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="decimals"> + <number>4</number> + </property> + <property name="minimum"> + <double>0.100000000000000</double> + </property> + <property name="maximum"> + <double>65535.000000000000000</double> + </property> + <property name="value"> + <double>1.000000000000000</double> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>Order #2</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QDoubleSpinBox" name="order_2nd"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="correctionMode"> + <enum>QAbstractSpinBox::CorrectToPreviousValue</enum> + </property> + <property name="decimals"> + <number>4</number> + </property> + <property name="minimum"> + <double>0.100000000000000</double> + </property> + <property name="maximum"> + <double>65535.000000000000000</double> + </property> + <property name="value"> + <double>1.000000000000000</double> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>Order #3</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="order_3rd"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="correctionMode"> + <enum>QAbstractSpinBox::CorrectToPreviousValue</enum> + </property> + <property name="decimals"> + <number>4</number> + </property> + <property name="minimum"> + <double>0.100000000000000</double> + </property> + <property name="maximum"> + <double>65535.000000000000000</double> </property> + <property name="value"> + <double>1.000000000000000</double> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="lblSensYaw_6"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>0</width> + <width>25</width> <height>0</height> </size> </property> - <property name="title"> - <string>Basic settings</string> + <property name="maximumSize"> + <size> + <width>150</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">color:#0; +background:none;</string> + </property> + <property name="text"> + <string>Deadband</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QDoubleSpinBox" name="deadzone"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> - <layout class="QFormLayout" name="formLayout_2"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::ExpandingFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Rotation</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QDoubleSpinBox" name="rotation_alpha"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="correctionMode"> - <enum>QAbstractSpinBox::CorrectToPreviousValue</enum> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>65535.000000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Translation</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="translation_alpha"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>65535.000000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Order #2</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="order_2nd"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="correctionMode"> - <enum>QAbstractSpinBox::CorrectToPreviousValue</enum> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>65535.000000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>Order #3</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QDoubleSpinBox" name="order_3rd"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="correctionMode"> - <enum>QAbstractSpinBox::CorrectToPreviousValue</enum> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>65535.000000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="lblSensYaw_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>25</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>150</width> - <height>16777215</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">color:#0; -background:none;</string> - </property> - <property name="text"> - <string>Deadband</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QDoubleSpinBox" name="deadzone"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>0.000000000000000</double> - </property> - <property name="maximum"> - <double>3.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.050000000000000</double> - </property> - <property name="value"> - <double>0.000000000000000</double> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_10"> - <property name="text"> - <string>Exponent</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QDoubleSpinBox" name="expt"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>0.050000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.050000000000000</double> - </property> - </widget> - </item> - </layout> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>0.000000000000000</double> + </property> + <property name="maximum"> + <double>3.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.050000000000000</double> + </property> + <property name="value"> + <double>0.000000000000000</double> + </property> </widget> </item> - <item row="0" column="1"> - <widget class="QGroupBox" name="groupBox"> + <item row="5" column="0"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>Exponent</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QDoubleSpinBox" name="expt"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="title"> - <string>Axis speed</string> - </property> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::ExpandingFieldsGrow</enum> - </property> - <property name="horizontalSpacing"> - <number>20</number> - </property> - <property name="verticalSpacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>10</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>X</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QDoubleSpinBox" name="doubleSpinBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>3.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Y</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="doubleSpinBox_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>3.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_5"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Z</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QDoubleSpinBox" name="doubleSpinBox_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>3.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Yaw</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QDoubleSpinBox" name="doubleSpinBox_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="accelerated"> - <bool>false</bool> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>3.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_7"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Pitch</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QDoubleSpinBox" name="doubleSpinBox_5"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="accelerated"> - <bool>false</bool> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>3.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_8"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Roll</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QDoubleSpinBox" name="doubleSpinBox_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="accelerated"> - <bool>false</bool> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>3.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - </layout> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>0.050000000000000</double> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.050000000000000</double> + </property> </widget> </item> - <item row="1" column="1"> + <item row="6" column="0" colspan="2"> <widget class="QLabel" name="label_9"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> @@ -640,8 +331,14 @@ background:none;</string> </property> </widget> </item> - <item row="2" column="1"> + <item row="7" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> @@ -649,21 +346,6 @@ background:none;</string> </item> </layout> </widget> - <tabstops> - <tabstop>rotation_alpha</tabstop> - <tabstop>translation_alpha</tabstop> - <tabstop>order_2nd</tabstop> - <tabstop>order_3rd</tabstop> - <tabstop>deadzone</tabstop> - <tabstop>expt</tabstop> - <tabstop>doubleSpinBox</tabstop> - <tabstop>doubleSpinBox_2</tabstop> - <tabstop>doubleSpinBox_3</tabstop> - <tabstop>doubleSpinBox_4</tabstop> - <tabstop>doubleSpinBox_5</tabstop> - <tabstop>doubleSpinBox_6</tabstop> - <tabstop>buttonBox</tabstop> - </tabstops> <resources/> <connections/> <slots> diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 1046c268..2e70c1b0 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -10,55 +10,18 @@ #include <QDebug>
#include <QMutexLocker>
#include "facetracknoir/global-settings.h"
-
using namespace std;
-FTNoIR_Filter::FTNoIR_Filter()
-{
- first_run = true;
- loadSettings();
-}
-
-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();
- QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
-
- iniFile.beginGroup ( "Accela" );
- rotation_alpha = iniFile.value("rotation-alpha", ACCELA_SMOOTHING_ROTATION).toDouble();
- translation_alpha = iniFile.value("translation-alpha", ACCELA_SMOOTHING_TRANSLATION).toDouble();
- second_order_alpha = iniFile.value("second-order-alpha", ACCELA_SECOND_ORDER_ALPHA).toDouble();
- third_order_alpha = iniFile.value("third-order-alpha", ACCELA_THIRD_ORDER_ALPHA).toDouble();
- deadzone = iniFile.value("deadzone", 0.0).toDouble();
- // bigger means less filtering
- static const double init_scaling[] = {
- 1, // X
- 1, // Y
- 1, // Z
- 1, // Yaw
- 1, // Pitch
- 1 // Roll
- };
- for (int i = 0; i < 6; i++)
- {
- scaling[i] = iniFile.value(QString("axis-%1").arg(QString::number(i)), init_scaling[i]).toDouble();
- }
- expt = iniFile.value("exponent", 2.0).toDouble();
-
- iniFile.endGroup();
-}
-
-void FTNoIR_Filter::receiveSettings()
+FTNoIR_Filter::FTNoIR_Filter() :
+ first_run(true),
+ b(bundle("Accela")),
+ rotation_alpha(b, "rotation-alpha", ACCELA_SMOOTHING_ROTATION),
+ translation_alpha(b, "translation-alpha", ACCELA_SMOOTHING_TRANSLATION),
+ second_order_alpha(b, "second-order-alpha", ACCELA_SECOND_ORDER_ALPHA),
+ third_order_alpha(b, "third-order-alpha", ACCELA_THIRD_ORDER_ALPHA),
+ deadzone(b, "deadzone", 0),
+ expt(b, "exponent", 2)
{
- QMutexLocker foo(&mutex);
-
- loadSettings();
}
static inline double parabola(const double a, const double x, const double dz, const double expt)
@@ -135,9 +98,9 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, const double a2 = a * second_order_alpha;
const double a3 = a * third_order_alpha;
const double velocity =
- parabola(a, vec * scaling[i], deadzone, expt) +
- parabola(a2, vec2 * scaling[i], deadzone, expt) +
- parabola(a3, vec3 * scaling[i], deadzone, expt);
+ parabola(a, vec, deadzone, expt) +
+ parabola(a2, vec2, deadzone, expt) +
+ parabola(a3, vec3, deadzone, expt);
const double result = last_output[0][i] + velocity;
const bool done = sign > 0 ? result >= target_camera_position[i] : result <= target_camera_position[i];
new_camera_position[i] = done ? target_camera_position[i] : result;
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index d91a5e42..43564bd8 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -1,31 +1,4 @@ -/********************************************************************************
-* 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/>. *
-* *
-********************************************************************************/
#pragma once
-#ifndef INCLUDED_FTN_FILTER_H
-#define INCLUDED_FTN_FILTER_H
-
#include "ftnoir_filter_base/ftnoir_filter_base.h"
#include "ui_ftnoir_accela_filtercontrols.h"
#include "facetracknoir/global-settings.h"
@@ -37,28 +10,31 @@ #define ACCELA_SECOND_ORDER_ALPHA 100.0
#define ACCELA_THIRD_ORDER_ALPHA 180.0
-//*******************************************************************************************************
-// FaceTrackNoIR Filter class.
-//*******************************************************************************************************
+#include "facetracknoir/options.hpp"
+using namespace options;
+
class FTNoIR_Filter : public IFilter
{
public:
FTNoIR_Filter();
- virtual ~FTNoIR_Filter();
void FilterHeadPoseData(const double* target_camera_position, double *new_camera_position);
void Initialize() {
first_run = true;
}
- void receiveSettings();
+ void receiveSettings() {
+ b->reload();
+ }
+
private:
QMutex mutex;
- void loadSettings();
bool first_run;
- double rotation_alpha, translation_alpha;
- double second_order_alpha, third_order_alpha;
- double scaling[6];
- double deadzone;
- double expt;
+ pbundle b;
+ value<double> rotation_alpha,
+ translation_alpha,
+ second_order_alpha,
+ third_order_alpha,
+ deadzone,
+ expt;
double last_input[6];
double last_output[3][6];
QElapsedTimer timer;
@@ -74,43 +50,33 @@ class FilterControls: public QWidget, public IFilterDialog {
Q_OBJECT
public:
- explicit FilterControls();
- virtual ~FilterControls();
- void showEvent (QShowEvent *);
- void Initialize(QWidget *parent);
+ FilterControls();
+ void Initialize(QWidget *);
void registerFilter(IFilter* filter);
void unregisterFilter();
private:
Ui::AccelaUICFilterControls ui;
- void loadSettings();
+ void discard();
void save();
- bool settingsDirty;
FTNoIR_Filter* accela_filter;
+ pbundle b;
+ value<double> rotation_alpha,
+ translation_alpha,
+ second_order_alpha,
+ third_order_alpha,
+ deadzone,
+ expt;
private slots:
void doOK();
void doCancel();
- void settingChanged(bool) { settingsDirty = true; }
- void settingChanged(int) { settingsDirty = true; }
- void settingChanged(double) { settingsDirty = true; }
};
-//*******************************************************************************************************
-// FaceTrackNoIR Filter DLL. Functions used to get general info on the Filter
-//*******************************************************************************************************
class FTNoIR_FilterDll : public Metadata
{
public:
- FTNoIR_FilterDll();
- ~FTNoIR_FilterDll();
-
void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Accela Filter Mk4"); }
void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Accela Mk4"); }
void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Accela filter Mk4"); }
void getIcon(QIcon *icon){ *icon = QIcon(":/images/filter-16.png"); }
};
-
-
-#endif //INCLUDED_FTN_FILTER_H
-//END
-
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index a14db280..256f35b4 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -1,27 +1,3 @@ -/******************************************************************************** -* 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 <cmath> #include <QDebug> @@ -29,60 +5,30 @@ #include <QDoubleSpinBox> #include "facetracknoir/global-settings.h" -//******************************************************************************************************* -// FaceTrackNoIR Filter Settings-dialog. -//******************************************************************************************************* -// -// Constructor for server-settings-dialog -// FilterControls::FilterControls() : - QWidget(), accela_filter(NULL) + accela_filter(NULL), + b(bundle("Accela")), + rotation_alpha(b, "rotation-alpha", ACCELA_SMOOTHING_ROTATION), + translation_alpha(b, "translation-alpha", ACCELA_SMOOTHING_TRANSLATION), + second_order_alpha(b, "second-order-alpha", ACCELA_SECOND_ORDER_ALPHA), + third_order_alpha(b, "third-order-alpha", ACCELA_THIRD_ORDER_ALPHA), + deadzone(b, "deadzone", 0), + expt(b, "exponent", 2) + { ui.setupUi( this ); - - // Load the settings from the current .INI-file - loadSettings(); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - connect(ui.rotation_alpha, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.translation_alpha, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - - QDoubleSpinBox* boxen[] = { - ui.doubleSpinBox, - ui.doubleSpinBox_2, - ui.doubleSpinBox_3, - ui.doubleSpinBox_4, - ui.doubleSpinBox_5, - ui.doubleSpinBox_6, - }; - - for (int i = 0; i < 6; i++) - { - connect(boxen[i], SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - } - - connect(ui.expt, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - - qDebug() << "FilterControls() says: started"; -} -// -// Destructor for server-dialog -// -FilterControls::~FilterControls() { - qDebug() << "~FilterControls() says: started"; + tie_setting(rotation_alpha, ui.rotation_alpha); + tie_setting(translation_alpha, ui.translation_alpha); + tie_setting(second_order_alpha, ui.order_2nd); + tie_setting(third_order_alpha, ui.order_3rd); + tie_setting(deadzone, ui.deadzone); + tie_setting(expt, ui.expt); } -// -// Initialize tracker-client-dialog -// -void FilterControls::Initialize(QWidget *parent) { - loadSettings(); - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } +void FilterControls::Initialize(QWidget *) { show(); } @@ -96,153 +42,50 @@ void FilterControls::unregisterFilter() accela_filter = NULL; } -// -// OK clicked on server-dialog -// void FilterControls::doOK() { save(); this->close(); } -// override show event -void FilterControls::showEvent ( QShowEvent * ) { -} - -// -// 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.rotation_alpha->setValue(iniFile.value("rotation-alpha", ACCELA_SMOOTHING_ROTATION).toDouble()); - ui.translation_alpha->setValue(iniFile.value("translation-alpha", ACCELA_SMOOTHING_TRANSLATION).toDouble()); - ui.order_2nd->setValue(iniFile.value("second-order-alpha", ACCELA_SECOND_ORDER_ALPHA).toDouble()); - ui.order_3rd->setValue(iniFile.value("third-order-alpha", ACCELA_THIRD_ORDER_ALPHA).toDouble()); - ui.deadzone->setValue(iniFile.value("deadzone", 0).toDouble()); - - // bigger means less filtering - static const double init_scaling[] = { - 1.5, // X - 1.5, // Y - 1, // Z - 0.8, // Yaw - 0.9, // Pitch - 1.25 // Roll - }; - - QDoubleSpinBox* boxen[] = { - ui.doubleSpinBox, - ui.doubleSpinBox_2, - ui.doubleSpinBox_3, - ui.doubleSpinBox_4, - ui.doubleSpinBox_5, - ui.doubleSpinBox_6, - }; - - for (int i = 0; i < 6; i++) + if (!b->modifiedp()) { - boxen[i]->setValue(iniFile.value(QString("axis-%1").arg(QString::number(i)), init_scaling[i]).toDouble()); + close(); + return; } + int ret = + QMessageBox::question( this, + "Settings have changed", + "Do you want to save the settings?", + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); + + switch (ret) { + case QMessageBox::Save: + save(); + this->close(); + break; + case QMessageBox::Discard: + this->discard(); + this->close(); + break; + case QMessageBox::Cancel: + default: + break; + } +} - ui.expt->setValue(iniFile.value("exponent", 2.0).toDouble()); - - iniFile.endGroup(); - settingsDirty = false; +void FilterControls::discard() +{ + b->revert(); } -// -// 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; - - iniFile.beginGroup ( "Accela" ); - iniFile.setValue("rotation-alpha", ui.rotation_alpha->value()); - iniFile.setValue("translation-alpha", ui.translation_alpha->value()); - iniFile.setValue("deadzone", ui.deadzone->value()); - iniFile.setValue("exponent", ui.expt->value()); - iniFile.setValue("second-order-alpha", ui.order_2nd->value()); - iniFile.setValue("third-order-alpha", ui.order_3rd->value()); - - QDoubleSpinBox* boxen[] = { - ui.doubleSpinBox, - ui.doubleSpinBox_2, - ui.doubleSpinBox_3, - ui.doubleSpinBox_4, - ui.doubleSpinBox_5, - ui.doubleSpinBox_6, - }; - - for (int i = 0; i < 6; i++) - { - iniFile.setValue(QString("axis-%1").arg(QString::number(i)), boxen[i]->value()); - } - iniFile.endGroup(); - } - - settingsDirty = false; - + b->save(); if (accela_filter) accela_filter->receiveSettings(); } -//////////////////////////////////////////////////////////////////////////////// -// 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 d4a11028..a024e789 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp @@ -1,38 +1,6 @@ -/******************************************************************************** -* 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; |