From 864a59265d7f89856d1f5093e4708a7ae7b10018 Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Sun, 5 Aug 2012 11:55:58 +0000 Subject: Busy adapting changes from Stan. git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@117 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui | 515 ++++++--------------- FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h | 12 +- FTNoIR_Filter_Accela/FTNoIR_Filter_accela.vcproj | 4 +- FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp | 57 ++- .../ftnoir_filter_accela_dialog.cpp | 62 +-- 5 files changed, 204 insertions(+), 446 deletions(-) diff --git a/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui b/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui index f753df0c..f22e3cc7 100644 --- a/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui +++ b/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui @@ -9,8 +9,8 @@ 0 0 - 350 - 473 + 1118 + 649 @@ -31,314 +31,143 @@ - - - - - QLayout::SetNoConstraint + + + true + + + + 0 + 0 + + + + + 1100 + 600 + + + + + 65535 + 65535 + + + + 0 + + + + Rotation + + + + + 420 + 30 + 215 + 220 + - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">c</span><span style=" font-size:10pt; vertical-align:sub;">4 </span><span style=" font-size:8pt;">=</span></p></body></html> - - - - - - - 3 - - - 1000000.000000000000000 - - - 0.100000000000000 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">factor</span><span style=" font-size:12pt; vertical-align:sub;">rotation</span><span style=" font-size:8pt;"> =</span></p></body></html> - - - - - - - 3 - - - 5.000000000000000 - - - 1000000.000000000000000 - - - 0.500000000000000 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">c</span><span style=" font-size:10pt; vertical-align:sub;">3 </span><span style=" font-size:8pt;">=</span></p></body></html> - - - - - - - 3 - - - 1000000.000000000000000 - - - 0.100000000000000 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">c</span><span style=" font-size:10pt; vertical-align:sub;">2</span><span style=" font-size:10pt;"> </span><span style=" font-size:8pt;">=</span></p></body></html> - - - - - - - 3 - - - 1000000.000000000000000 - - - 0.075000000000000 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">c</span><span style=" font-size:10pt; vertical-align:sub;">1 </span><span style=" font-size:8pt;">=</span></p></body></html> - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">sensitivity</span><span style=" font-size:12pt; vertical-align:sub;">rotation</span><span style=" font-size:8pt;"> = </span></p></body></html> - - - - - - - 3 - - - 1000000.000000000000000 - - - 0.050000000000000 - - - - - - - 3 - - - 1000000.000000000000000 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">c</span><span style=" font-size:10pt; vertical-align:sub;">0</span><span style=" font-size:8pt;"> =</span></p></body></html> - - - - - - - 3 - - - 1000000.000000000000000 - - - 0.005000000000000 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">factor</span><span style=" font-size:12pt; vertical-align:sub;">translation</span><span style=" font-size:10pt;"> =</span></p></body></html> - - - - - - - 3 - - - 5.000000000000000 - - - 1000000.000000000000000 - - - 0.500000000000000 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">sensitivity</span><span style=" font-size:12pt; vertical-align:sub;">translation</span><span style=" font-size:8pt;"> =</span></p></body></html> - - - - - - - 3 - - - 1000000.000000000000000 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">%</span></p></body></html> - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">%</span></p></body></html> - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - background-color: rgb(214, 214, 214); -border-color: rgb(0, 0, 0); + + 4 - - QFrame::Box + + 8 - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">The Accela-filter uses a polynomial to calculate the</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">'next value' of the filtered output. The maths:</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-style:italic;">let x = input / factor (behold: smaller than 1!)</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-style:italic;">let y' = c</span><span style=" font-size:12pt; font-style:italic; vertical-align:sub;">4</span><span style=" font-size:10pt; font-style:italic; vertical-align:sub;"> * </span><span style=" font-size:10pt; font-style:italic;">x</span><span style=" font-size:12pt; font-style:italic; vertical-align:super;">4</span><span style=" font-size:10pt; font-style:italic;"> + c</span><span style=" font-size:12pt; font-style:italic; vertical-align:sub;">3 *</span><span style=" font-size:10pt; font-style:italic;"> x</span><span style=" font-size:11pt; font-style:italic; vertical-align:super;">3</span><span style=" font-size:10pt; font-style:italic;"> + c</span><span style=" font-size:12pt; font-style:italic; vertical-align:sub;">2 *</span><span style=" font-size:10pt; font-style:italic;"> x</span><span style=" font-size:12pt; font-style:italic; vertical-align:super;">2</span><span style=" font-size:10pt; font-style:italic;"> + c</span><span style=" font-size:12pt; font-style:italic; vertical-align:sub;">1 *</span><span style=" font-size:10pt; font-style:italic;"> x</span><span style=" font-size:12pt; font-style:italic; vertical-align:super;">1</span><span style=" font-size:10pt; font-style:italic;"> + c</span><span style=" font-size:12pt; font-style:italic; vertical-align:sub;">0 </span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-style:italic;">y = y' * sensitivity</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-style:italic;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Higher values for c</span><span style=" font-size:12pt; vertical-align:sub;">0 </span><span style=" font-size:10pt;">to</span><span style=" font-size:12pt; vertical-align:sub;"> </span><span style=" font-size:10pt;">c</span><span style=" font-size:12pt; vertical-align:sub;">4 </span><span style=" font-size:10pt;">: more responsive, less stable</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Lower values for c</span><span style=" font-size:12pt; vertical-align:sub;">0 </span><span style=" font-size:10pt;">to</span><span style=" font-size:12pt; vertical-align:sub;"> </span><span style=" font-size:10pt;">c</span><span style=" font-size:12pt; vertical-align:sub;">4 </span><span style=" font-size:10pt;">: less responsive, more stable</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Remark: c</span><span style=" font-size:12pt; vertical-align:sub;">0 </span><span style=" font-size:10pt;">has the strongest influence, c</span><span style=" font-size:12pt; vertical-align:sub;">4 </span><span style=" font-size:10pt;">the weakest.</span></p></body></html> + + 40 + + + 20 + + + 1 + + + 1 + + + + 255 + 170 + 0 + + + + + 192 + 192 + 192 + + + + Input Yaw (degr.) - - 5 + + Output Yaw (degr.) - - + + + + 80 + 30 + 215 + 220 + + + + 4 + + + 8 + + + 40 + + + 20 + + + 1 + + + 1 + + + + 255 + 170 + 0 + + + + + 192 + 192 + 192 + + + + Input Yaw (degr.) + + + Output Yaw (degr.) + + + + + + Translation + + + - + Qt::Horizontal @@ -351,86 +180,30 @@ p, li { white-space: pre-wrap; } - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - + + + OK - + - - - QLayout::SetDefaultConstraint + + + Cancel - - - - - 0 - 0 - - - - - 52 - 0 - - - - - 100 - 16777215 - - - - OK - - - - - - - - 0 - 0 - - - - - 52 - 0 - - - - - 100 - 16777215 - - - - Cancel - - - - + - - btnOK - btnCancel - + + + QFunctionConfigurator + QWidget +
qfunctionconfigurator.h
+
+
diff --git a/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h b/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h index 884da3a9..4b918f5a 100644 --- a/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h +++ b/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h @@ -28,6 +28,8 @@ #include "..\ftnoir_filter_base\ftnoir_filter_base.h" #include "ui_FTNoIR_FilterControls.h" +#include +//#include class FTNoIR_Filter : public IFilter { @@ -51,11 +53,12 @@ private: bool first_run; double kFactor, kFactorTranslation; double kSensitivity, kSensitivityTranslation; - double kC1, kC2, kC3, kC4, kC0; QString filterFullName; // Filters' name and description QString filterShortName; QString filterDescription; + FunctionConfig functionConfig; + FunctionConfig translationFunctionConfig; }; //******************************************************************************************************* @@ -78,7 +81,6 @@ public: void getShortName(QString *strToBeFilled); void getDescription(QString *strToBeFilled); void getIcon(QIcon *icon); - private: Ui::UICFilterControls ui; void loadSettings(); @@ -91,13 +93,13 @@ private: QString filterShortName; QString filterDescription; IFilterPtr pFilter; // If the filter was active when the dialog was opened, this will hold a pointer to the Filter instance + FunctionConfig functionConfig; + FunctionConfig translationFunctionConfig; private slots: void doOK(); void doCancel(); - void settingChanged() { settingsDirty = true; }; - void settingChanged( int ) { settingsDirty = true; }; - void settingChanged( double ) { settingsDirty = true; }; + void settingChanged(bool) { settingsDirty = true; }; }; #endif //INCLUDED_FTN_FILTER_H diff --git a/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.vcproj b/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.vcproj index 6d2ca558..74d39021 100644 --- a/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.vcproj +++ b/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.vcproj @@ -1,7 +1,7 @@ +#include -FTNoIR_Filter::FTNoIR_Filter() +FTNoIR_Filter::FTNoIR_Filter() : + functionConfig("Accela-Scaling-Rotation", 4, 8), + translationFunctionConfig("Accela-Scaling-Translation", 4, 8) { //populate the description strings - filterFullName = "Accela Filter"; - filterShortName = "Accela"; - filterDescription = "Accela filter"; + filterFullName = "Accela Filter mkII"; + filterShortName = "Accela mkII"; + filterDescription = "Accela filter mkII"; first_run = true; loadSettings(); // Load the Settings - } FTNoIR_Filter::~FTNoIR_Filter() @@ -42,20 +44,8 @@ void FTNoIR_Filter::loadSettings() { QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - qDebug() << "FTNoIR_Filter::loadSettings says: iniFile = " << currentFile; - - iniFile.beginGroup ( "Filter_Accela" ); - kFactor = iniFile.value ( "factor", 8.0 ).toDouble(); - kSensitivity = iniFile.value("sensitivity", 12.0).toDouble(); - kC0 = iniFile.value("c0", 0.005).toDouble(); - kC1 = iniFile.value("c1", 0.125).toDouble(); - kC2 = iniFile.value("c2", 0.33333).toDouble(); - kC3 = iniFile.value("c3", 0.75).toDouble(); - kC4 = iniFile.value("c4", 1.0).toDouble(); - kFactorTranslation = iniFile.value("factor_translation", 1.0).toDouble(); - kSensitivityTranslation = iniFile.value("sensitivity_translation", 1.0).toDouble(); - - iniFile.endGroup (); + functionConfig.loadSettings(iniFile); + translationFunctionConfig.loadSettings(iniFile); } void FTNoIR_Filter::FilterHeadPoseData(THeadPoseData *current_camera_position, THeadPoseData *target_camera_position, THeadPoseData *new_camera_position, bool newTarget) @@ -94,27 +84,44 @@ void FTNoIR_Filter::FilterHeadPoseData(THeadPoseData *current_camera_position, T for (i=0;i<6;i++) { + volatile double bleh; + + bleh = target[i]; + + if (bleh != bleh) + return; + + bleh = prev_output[i]; + + if (bleh != bleh) + return; + double e2 = target[i]; double start = prev_output[i]; double vec = e2 - start; int sign = vec < 0 ? -1 : 1; - double max = i >= 3 ? kFactor : kFactorTranslation; - double x = fabs(vec) / max; - double foo = kC4 * x * x * x * x + kC3 * x * x * x + kC2 * x * x + kC1 * x + kC0; + double x = fabs(vec); + double foo = (i >= 3 ? functionConfig : translationFunctionConfig).getValue((x > 4 ? 4 : x)); + if (x > 4) + foo = x * x * log(x) / log(4.0); // the idea is that "empty" updates without new head pose data are still // useful for filtering, as skipping them would result in jerky output. // the magic "100" is the amount of calls to the filter by FTNOIR per sec. - double velocity = foo * (i >= 3 ? kSensitivity : kSensitivityTranslation) / 100.0; + double velocity = foo / 100.0; double sum = start + velocity * sign; - bool done = sign > 0 ? sum >= e2 : sum <= e2; + bool done = /*x >= 6 || */(sign > 0 ? sum >= e2 : sum <= e2); if (done) { output[i] = e2; } else { output[i] = sum; } + + bleh = output[i]; + + if (bleh != bleh) + return; } -end: new_camera_position->x=output[0]; new_camera_position->y=output[1]; new_camera_position->z=output[2]; diff --git a/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp b/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp index a77a32fa..44d0292e 100644 --- a/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp +++ b/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp @@ -33,7 +33,9 @@ // Constructor for server-settings-dialog // FilterControls::FilterControls() : -QWidget() + QWidget(), + functionConfig("Accela-Scaling-Rotation", 4, 8), + translationFunctionConfig("Accela-Scaling-Translation", 4, 8) { ui.setupUi( this ); @@ -41,29 +43,12 @@ QWidget() filterFullName = "Accela Filter"; filterShortName = "Accela"; filterDescription = "Accela Filter"; - // Load the settings from the current .INI-file loadSettings(); - - QPoint offsetpos(100, 100); - //if (parent) { - // this->move(parent->pos() + offsetpos); - //} - - // Connect Qt signals to member-functions connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); - - // Connect sliders for reduction factor - connect(ui.sensitivity, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.factor, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.sensitivity_translation, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.factor_translation, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.c_0, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.c_1, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.c_2, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.c_3, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.c_4, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); + connect(ui.scalingConfig, SIGNAL(CurveChanged(bool)), this, SLOT(settingChanged(bool))); + connect(ui.translationScalingConfig, SIGNAL(CurveChanged(bool)), this, SLOT(settingChanged(bool))); qDebug() << "FilterControls() says: started"; } @@ -159,17 +144,17 @@ void FilterControls::loadSettings() { qDebug() << "FTNoIR_Filter::loadSettings says: iniFile = " << currentFile; - iniFile.beginGroup ( "Filter_Accela" ); - ui.factor->setValue(iniFile.value ("factor", 8.0).toDouble()); - ui.sensitivity->setValue(iniFile.value("sensitivity", 12.0).toDouble()); - ui.factor_translation->setValue(iniFile.value ("factor_translation", 1.0).toDouble()); - ui.sensitivity_translation->setValue(iniFile.value("sensitivity_translation", 1.0).toDouble()); - ui.c_0->setValue(iniFile.value("c0", 0.005).toDouble()); - ui.c_1->setValue(iniFile.value("c1", 0.125).toDouble()); - ui.c_2->setValue(iniFile.value("c2", 0.33333).toDouble()); - ui.c_3->setValue(iniFile.value("c3", 0.75).toDouble()); - ui.c_4->setValue(iniFile.value("c4", 1.0).toDouble()); - iniFile.endGroup (); + //ui.scalingConfig->setBounds(0, 0, 4.0, 8, 0.25, 0.25); + //ui.scalingConfig->setSize(1000, 550); + + //ui.translationScalingConfig->setBounds(0, 0, 4.0, 8, 0.25, 0.25); + //ui.translationScalingConfig->setSize(1000, 550); + + functionConfig.loadSettings(iniFile); + translationFunctionConfig.loadSettings(iniFile); + + ui.translationScalingConfig->setConfig(&translationFunctionConfig); + ui.scalingConfig->setConfig(&functionConfig); settingsDirty = false; } @@ -183,17 +168,8 @@ void FilterControls::save() { QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - iniFile.beginGroup ( "Filter_Accela" ); - iniFile.setValue ( "sensitivity", ui.sensitivity->value() ); - iniFile.setValue("factor", ui.factor->value()); - iniFile.setValue ( "sensitivity_translation", ui.sensitivity_translation->value() ); - iniFile.setValue("factor_translation", ui.factor_translation->value()); - iniFile.setValue("c0", ui.c_0->value()); - iniFile.setValue("c1", ui.c_1->value()); - iniFile.setValue("c2", ui.c_2->value()); - iniFile.setValue("c3", ui.c_3->value()); - iniFile.setValue("c4", ui.c_4->value()); - iniFile.endGroup (); + functionConfig.saveSettings(iniFile); + translationFunctionConfig.saveSettings(iniFile); settingsDirty = false; } @@ -217,7 +193,7 @@ void FilterControls::getDescription(QString *strToBeFilled) void FilterControls::getIcon(QIcon *icon) { - *icon = QIcon(":/images/filter-16-ac.png"); + *icon = QIcon(":/images/filter-16.png"); }; //////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3