From 6fdcf9004e0aafb796592ab5120f1bd90190e2c3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 29 Apr 2013 15:53:44 +0200 Subject: Remove rarely-used features to improve maintainability --- facetracknoir/facetracknoir.cpp | 327 +------- facetracknoir/facetracknoir.h | 42 +- facetracknoir/facetracknoir.ui | 133 +--- facetracknoir/ftnoir_keyboardshortcuts.ui | 988 +++++------------------- facetracknoir/ftnoir_preferences.ui | 240 ------ facetracknoir/main-facetracknoir.qrc | 2 - facetracknoir/tracker.cpp | 112 +-- facetracknoir/tracker.h | 25 +- facetracknoir/uielements/aboutfacetracknoir.png | Bin 30557 -> 0 bytes facetracknoir/uielements/donate.png | Bin 778 -> 0 bytes facetracknoir/uielements/setupfacetracknoir.jpg | Bin 21508 -> 0 bytes 11 files changed, 226 insertions(+), 1643 deletions(-) delete mode 100644 facetracknoir/ftnoir_preferences.ui delete mode 100644 facetracknoir/uielements/aboutfacetracknoir.png delete mode 100644 facetracknoir/uielements/donate.png delete mode 100644 facetracknoir/uielements/setupfacetracknoir.jpg (limited to 'facetracknoir') diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 58644f76..e868b02a 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -162,9 +162,6 @@ void KeybindingWorkerDummy::run() { } PROCESS_KEY(kCenter, shortcutRecentered); - PROCESS_KEY(kInhibit, shortcutInhibit); - PROCESS_KEY(kZero, shortcutZero); - PROCESS_KEY(kStartStop, shortcutStartStop); Sleep(25); } @@ -205,7 +202,6 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent, Qt::WFlags flags) : // Initialize Widget handles, to prevent memory-access errors. // _keyboard_shortcuts = 0; - _preferences = 0; _keyboard_shortcuts = 0; _curve_config = 0; @@ -216,14 +212,6 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent, Qt::WFlags flags) : setupFaceTrackNoIR(); - // - // Read the AutoStartTracking value from the registry. If it is '1', start the Tracker and Minimize... - // - QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) - if (settings.value ( "AutoStartTracking", 0 ).toBool()) { - startTracker(); - } - //Q_INIT_RESOURCE(PoseWidget); ui.lblX->setVisible(false); @@ -261,7 +249,6 @@ void FaceTrackNoIR::setupFaceTrackNoIR() { connect(ui.btnSaveAs, SIGNAL(clicked()), this, SLOT(saveAs())); connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(exit())); - connect(ui.actionPreferences, SIGNAL(triggered()), this, SLOT(showPreferences())); connect(ui.actionKeyboard_Shortcuts, SIGNAL(triggered()), this, SLOT(showKeyboardShortcuts())); connect(ui.actionCurve_Configuration, SIGNAL(triggered()), this, SLOT(showCurveConfiguration())); connect(ui.btnEditCurves, SIGNAL(clicked()), this, SLOT(showCurveConfiguration())); @@ -269,7 +256,6 @@ void FaceTrackNoIR::setupFaceTrackNoIR() { connect(ui.actionSupport, SIGNAL(triggered()), this, SLOT(openurl_support())); connect(ui.actionYour_Support, SIGNAL(triggered()), this, SLOT(openurl_donation())); - connect(ui.btnDonate, SIGNAL(clicked()), this, SLOT(openurl_donation())); connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(ui.actionVideoWidget, SIGNAL(triggered()), this, SLOT(showVideoWidget())); @@ -321,7 +307,6 @@ void FaceTrackNoIR::setupFaceTrackNoIR() { timUpdateHeadPose = new QTimer(this); connect(timUpdateHeadPose, SIGNAL(timeout()), this, SLOT(showHeadPose())); ui.txtTracking->setVisible(false); - ui.txtAxisReverse->setVisible(false); settingsDirty = false; } @@ -332,28 +317,7 @@ FaceTrackNoIR::~FaceTrackNoIR() { // Stop the tracker, by simulating a button-push // stopTracker(); - - // - // 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::Discard ); - - switch (ret) { - case QMessageBox::Save: - saveAs(); - break; - case QMessageBox::Discard: - // Don't Save was clicked - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } + save(); } // @@ -673,34 +637,6 @@ void FaceTrackNoIR::loadSettings() { looping = false; } -/** show support page in web-browser **/ -void FaceTrackNoIR::openurl_support() { - QDesktopServices::openUrl(QUrl("http://facetracknoir.sourceforge.net/manual/manual.htm", QUrl::TolerantMode)); -} - -/** show donations page in web-browser **/ -void FaceTrackNoIR::openurl_donation() { - QDesktopServices::openUrl(QUrl("http://facetracknoir.sourceforge.net/information_links/donate.htm", QUrl::TolerantMode)); -} - -/** show about dialog **/ -void FaceTrackNoIR::about() { - - QPoint offsetpos(100, 100); - aboutDialog.move(this->pos() + offsetpos); - aboutDialog.show(); - - /** ABOUT DIALOG **/ - aboutDialog.setBaseSize(270, 440); - - aboutDialog.setMaximumWidth(270); - aboutDialog.setMaximumHeight(440); - - aboutDialog.setMinimumWidth(270); - aboutDialog.setMinimumHeight(440); - aboutDialog.setStyleSheet("background:#fff url(:/uielements/aboutfacetracknoir.png) no-repeat;"); -} - /** start tracking the face **/ void FaceTrackNoIR::startTracker( ) { bindKeyboardShortcuts(); @@ -816,25 +752,6 @@ void FaceTrackNoIR::startTracker( ) { // GetCameraNameDX(); - // - // Get the TimeOut value for minimizing FaceTrackNoIR - // Only start the Timer if value > 0 - // - int timevalue = iniFile.value ( "AutoMinimizeTime", 0 ).toInt() * 1000; - if (timevalue > 0) { - - bool minimizeTaskBar = iniFile.value ( "MinimizeTaskBar", 1 ).toBool(); - if (minimizeTaskBar) { - connect(timMinimizeFTN, SIGNAL(timeout()), this, SLOT(showMinimized())); - } - else { - connect(timMinimizeFTN, SIGNAL(timeout()), this, SLOT(hide())); - } - - timMinimizeFTN->setSingleShot( true ); - timMinimizeFTN->start(timevalue); - } - // // Start the timer to update the head-pose (digits and 'man in black') // @@ -887,7 +804,6 @@ void FaceTrackNoIR::stopTracker( ) { ui.lcdNumOutputRotY->setVisible(false); ui.lcdNumOutputRotZ->setVisible(false); ui.txtTracking->setVisible(false); - ui.txtAxisReverse->setVisible(false); // // Delete the tracker (after stopping things and all). @@ -980,7 +896,6 @@ void FaceTrackNoIR::showHeadPose() { ui.lcdNumRotZ->display(QString("%1").arg(newdata[RZ], 0, 'f', 1)); ui.txtTracking->setVisible(tracker->getTrackingActive()); - ui.txtAxisReverse->setVisible(tracker->getAxisReverse()); // // Get the output-pose and also display it. @@ -1096,23 +1011,6 @@ void FaceTrackNoIR::showFilterControls() { } } } - -/** toggles FaceTrackNoIR Preferences Dialog **/ -void FaceTrackNoIR::showPreferences() { - - // Create if new - if (!_preferences) - { - _preferences = new PreferencesDialog( this, this, Qt::Dialog ); - } - - // Show if already created - if (_preferences) { - _preferences->show(); - _preferences->raise(); - } -} - /** toggles Keyboard Shortcut Dialog **/ void FaceTrackNoIR::showKeyboardShortcuts() { @@ -1361,116 +1259,6 @@ void FaceTrackNoIR::filterSelected(int index) ui.btnShowFilterControls->setEnabled ( true ); } -// -// Constructor for FaceTrackNoIR=Preferences-dialog -// -PreferencesDialog::PreferencesDialog( FaceTrackNoIR *ftnoir, QWidget *parent, Qt::WindowFlags f ) : -QWidget( parent , f) -{ - ui.setupUi( this ); - - QPoint offsetpos(100, 100); - 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())); - - connect(ui.spinAutoMinimizeTime, SIGNAL(valueChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkAutoStartTracking, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.radioMinimize, SIGNAL(toggled(bool)), this, SLOT(keyChanged(bool))); - - // Load the settings from the current .INI-file - loadSettings(); -} - -// -// Destructor for server-dialog -// -PreferencesDialog::~PreferencesDialog() { - qDebug() << "~PreferencesDialog() says: started"; -} - -// -// OK clicked on server-dialog -// -void PreferencesDialog::doOK() { - save(); - this->close(); -} - -// override show event -void PreferencesDialog::showEvent ( QShowEvent * event ) { - loadSettings(); -} - -// -// Cancel clicked on server-dialog -// -void PreferencesDialog::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 PreferencesDialog::loadSettings() { - - QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) - ui.spinAutoMinimizeTime->setValue( settings.value ( "AutoMinimizeTime", 0 ).toInt() ); - ui.chkAutoStartTracking->setChecked( settings.value ( "AutoStartTracking", 0 ).toBool() ); - ui.radioMinimize->setChecked( settings.value ( "MinimizeTaskBar", 1 ).toBool() ); - - settingsDirty = false; - -} - -// -// Save the current Settings to the currently 'active' INI-file. -// -void PreferencesDialog::save() { - - QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) - settings.setValue( "AutoMinimizeTime", ui.spinAutoMinimizeTime->value() ); - settings.setValue( "AutoStartTracking", ui.chkAutoStartTracking->isChecked() ); - settings.setValue( "MinimizeTaskBar", ui.radioMinimize->isChecked() ); - - // - // Send a message to the main program, to update the Settings (for the tracker) - // - mainApp->updateSettings(); - - settingsDirty = false; -} - //**************************************************************************************************// //**************************************************************************************************// // @@ -1495,30 +1283,6 @@ QWidget( parent , f) connect(ui.chkCenterCtrl, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); connect(ui.chkCenterAlt, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.cbxGameZeroKey, SIGNAL(currentIndexChanged(int)), this, SLOT(keyChanged( int ))); - connect(ui.chkGameZeroShift, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkGameZeroCtrl, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkGameZeroAlt, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - - connect(ui.cbxStartStopKey, SIGNAL(currentIndexChanged(int)), this, SLOT(keyChanged( int ))); - connect(ui.chkStartStopShift, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkStartStopCtrl, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkStartStopAlt, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.radioSetZero, SIGNAL(toggled(bool)), this, SLOT(keyChanged(bool))); - - connect(ui.cbxInhibitKey, SIGNAL(currentIndexChanged(int)), this, SLOT(keyChanged( int ))); - connect(ui.chkInhibitShift, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkInhibitCtrl, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkInhibitAlt, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - - // Also add events for the Axis-checkboxes - connect(ui.chkInhibitShift, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkInhibitYaw, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkInhibitRoll, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkInhibitX, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkInhibitY, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - connect(ui.chkInhibitZ, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int))); - // Clear the Lists with key-descriptions and keycodes and build the Lists // The strings will all be added to the ListBoxes for each Shortkey // @@ -1528,9 +1292,6 @@ QWidget( parent , f) for ( int i = 0; i < global_key_sequences.size(); i++) { ui.cbxCenterKey->addItem(global_key_sequences.at(i)); - ui.cbxGameZeroKey->addItem(global_key_sequences.at(i)); - ui.cbxStartStopKey->addItem(global_key_sequences.at(i)); - ui.cbxInhibitKey->addItem(global_key_sequences.at(i)); } // Load the settings from the current .INI-file @@ -1741,38 +1502,6 @@ void KeyboardShortcutDialog::loadSettings() { ui.cbxCenterKey->setCurrentIndex(iniFile.value("Key_index_Center", 0).toInt()); - ui.chkGameZeroShift->setChecked (iniFile.value ( "Shift_GameZero", 0 ).toBool()); - ui.chkGameZeroCtrl->setChecked (iniFile.value ( "Ctrl_GameZero", 0 ).toBool()); - ui.chkGameZeroAlt->setChecked (iniFile.value ( "Alt_GameZero", 0 ).toBool()); - ui.cbxGameZeroKey->setCurrentIndex(iniFile.value("Key_index_GameZero", 0).toInt()); - - ui.chkStartStopShift->setChecked (iniFile.value ( "Shift_StartStop", 0 ).toBool()); - ui.chkStartStopCtrl->setChecked (iniFile.value ( "Ctrl_StartStop", 0 ).toBool()); - ui.chkStartStopAlt->setChecked (iniFile.value ( "Alt_StartStop", 0 ).toBool()); - ui.cbxStartStopKey->setCurrentIndex(iniFile.value("Key_index_StartStop", 0).toInt()); - - ui.radioSetZero->setChecked (iniFile.value ( "SetZero", 1 ).toBool()); - ui.radioSetFreeze->setChecked(!ui.radioSetZero->isChecked()); - - ui.chkInhibitShift->setChecked (iniFile.value ( "Shift_Inhibit", 0 ).toBool()); - ui.chkInhibitCtrl->setChecked (iniFile.value ( "Ctrl_Inhibit", 0 ).toBool()); - ui.chkInhibitAlt->setChecked (iniFile.value ( "Alt_Inhibit", 0 ).toBool()); - ui.cbxInhibitKey->setCurrentIndex(iniFile.value("Key_index_Inhibit", 0).toInt()); - - ui.chkInhibitPitch->setChecked (iniFile.value ( "Inhibit_Pitch", 0 ).toBool()); - ui.chkInhibitYaw->setChecked (iniFile.value ( "Inhibit_Yaw", 0 ).toBool()); - ui.chkInhibitRoll->setChecked (iniFile.value ( "Inhibit_Roll", 0 ).toBool()); - ui.chkInhibitX->setChecked (iniFile.value ( "Inhibit_X", 0 ).toBool()); - ui.chkInhibitY->setChecked (iniFile.value ( "Inhibit_Y", 0 ).toBool()); - ui.chkInhibitZ->setChecked (iniFile.value ( "Inhibit_Z", 0 ).toBool()); - - - // Reverse Axis - ui.chkEnableReverseAxis->setChecked (iniFile.value ( "Enable_ReverseAxis", 0 ).toBool()); - ui.spinYawAngle4ReverseAxis->setValue( iniFile.value ( "RA_Yaw", 40 ).toInt() ); - ui.spinZ_Pos4ReverseAxis->setValue( iniFile.value ( "RA_ZPos", -20 ).toInt() ); - ui.spinZ_PosWhenReverseAxis->setValue( iniFile.value ( "RA_ToZPos", 50 ).toInt() ); - iniFile.endGroup (); settingsDirty = false; @@ -1797,35 +1526,6 @@ void KeyboardShortcutDialog::save() { iniFile.setValue ( "Ctrl_Center", ui.chkCenterCtrl->isChecked() ); iniFile.setValue ( "Alt_Center", ui.chkCenterAlt->isChecked() ); - iniFile.setValue ( "Key_index_GameZero", ui.cbxGameZeroKey->currentIndex() ); - iniFile.setValue ( "Shift_GameZero", ui.chkGameZeroShift->isChecked() ); - iniFile.setValue ( "Ctrl_GameZero", ui.chkGameZeroCtrl->isChecked() ); - iniFile.setValue ( "Alt_GameZero", ui.chkGameZeroAlt->isChecked() ); - - iniFile.setValue ( "Key_index_StartStop", ui.cbxStartStopKey->currentIndex() ); - iniFile.setValue ( "Shift_StartStop", ui.chkStartStopShift->isChecked() ); - iniFile.setValue ( "Ctrl_StartStop", ui.chkStartStopCtrl->isChecked() ); - iniFile.setValue ( "Alt_StartStop", ui.chkStartStopAlt->isChecked() ); - iniFile.setValue ( "SetZero", ui.radioSetZero->isChecked() ); - - iniFile.setValue ( "Key_index_Inhibit", ui.cbxInhibitKey->currentIndex() ); - iniFile.setValue ( "Shift_Inhibit", ui.chkInhibitShift->isChecked() ); - iniFile.setValue ( "Ctrl_Inhibit", ui.chkInhibitCtrl->isChecked() ); - iniFile.setValue ( "Alt_Inhibit", ui.chkInhibitAlt->isChecked() ); - - iniFile.setValue ( "Inhibit_Pitch", ui.chkInhibitPitch->isChecked() ); - iniFile.setValue ( "Inhibit_Yaw", ui.chkInhibitYaw->isChecked() ); - iniFile.setValue ( "Inhibit_Roll", ui.chkInhibitRoll->isChecked() ); - iniFile.setValue ( "Inhibit_X", ui.chkInhibitX->isChecked() ); - iniFile.setValue ( "Inhibit_Y", ui.chkInhibitY->isChecked() ); - iniFile.setValue ( "Inhibit_Z", ui.chkInhibitZ->isChecked() ); - - // Reverse Axis - iniFile.setValue ( "Enable_ReverseAxis", ui.chkEnableReverseAxis->isChecked() ); - iniFile.setValue( "RA_Yaw", ui.spinYawAngle4ReverseAxis->value() ); - iniFile.setValue( "RA_ZPos", ui.spinZ_Pos4ReverseAxis->value() ); - iniFile.setValue( "RA_ToZPos", ui.spinZ_PosWhenReverseAxis->value() ); - iniFile.endGroup (); settingsDirty = false; @@ -2053,28 +1753,3 @@ void FaceTrackNoIR::shortcutRecentered() tracker->do_center = true; } } - -void FaceTrackNoIR::shortcutZero() -{ - if (tracker) - { - tracker->do_game_zero = true; - } -} - -void FaceTrackNoIR::shortcutStartStop() -{ - if (tracker) - { - tracker->do_tracking = !tracker->do_tracking; - qDebug() << "do-tracking" << tracker->do_tracking; - } -} - -void FaceTrackNoIR::shortcutInhibit() -{ - if (tracker) - { - tracker->do_inhibit = !tracker->do_inhibit; - } -} diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 8a2b6c49..cfe440ae 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_preferences.h" #include "ui_ftnoir_curves.h" #include "ftnoir_protocol_base/ftnoir_protocol_base.h" @@ -128,9 +127,6 @@ public: #endif public slots: void shortcutRecentered(); - void shortcutZero(); - void shortcutStartStop(); - void shortcutInhibit(); private: Ui::FaceTrackNoIRClass ui; @@ -185,12 +181,6 @@ private: void save(); void saveAs(); void exit(); - - //about menu - void openurl_support(); - void openurl_donation(); - void about(); - // void setIcon(int index); void iconActivated(QSystemTrayIcon::ActivationReason reason); void profileSelected(int index); @@ -205,7 +195,6 @@ private: void showServerControls(); void showFilterControls(); - void showPreferences(); void showKeyboardShortcuts(); void showCurveConfiguration(); @@ -235,33 +224,6 @@ private: }; -// Widget that has controls for FaceTrackNoIR Preferences. -class PreferencesDialog: public QWidget, public Ui::UICPreferencesDialog -{ - Q_OBJECT -public: - - explicit PreferencesDialog( FaceTrackNoIR *ftnoir, QWidget *parent=0, Qt::WindowFlags f=0 ); - virtual ~PreferencesDialog(); - void showEvent ( QShowEvent * event ); - -private: - Ui::UICPreferencesDialog ui; - void loadSettings(); - void save(); - - /** helper **/ - bool settingsDirty; - FaceTrackNoIR *mainApp; - -private slots: - void doOK(); - void doCancel(); - void keyChanged( int index ) { settingsDirty = true; } - void keyChanged( bool foo ) { settingsDirty = true; } -}; - -// Widget that has controls for Keyboard shortcuts. class KeyboardShortcutDialog: public QWidget, public Ui::UICKeyboardShortcutDialog { Q_OBJECT @@ -283,8 +245,8 @@ private: private slots: void doOK(); void doCancel(); - void keyChanged( int index ) { settingsDirty = true; }; - void keyChanged( bool index ) { settingsDirty = true; }; + void keyChanged( int index ) { settingsDirty = true; } + void keyChanged( bool index ) { settingsDirty = true; } }; // Widget that has controls for Keyboard shortcuts. diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index 63107a80..63961f4e 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -11,7 +11,7 @@ 0 0 890 - 431 + 400 @@ -23,13 +23,13 @@ 890 - 431 + 400 890 - 431 + 410 @@ -39,7 +39,7 @@ FaceTrackNoIR - + :/images/facetracknoir.png:/images/facetracknoir.png @@ -1450,7 +1450,7 @@ background:none; 10 - 50 + 20 231 169 @@ -1698,23 +1698,6 @@ color: rgb(0, 255, 0); Tracking - - - - 110 - 30 - 101 - 16 - - - - border:none; -color: rgb(0, 255, 0); - - - Axis Reverse - - @@ -1738,41 +1721,11 @@ color: rgb(0, 255, 0); 90 - - - - 5 - 0 - 151 - 31 - - - - PointingHandCursor - - - Please help us: make gaming fun... - - - Click here to -Support FaceTrackNoIR! - - - - :/uielements/donate.png:/uielements/donate.png - - - - 18 - 18 - - - 101 - 30 + 19 50 21 @@ -1800,7 +1753,7 @@ Support FaceTrackNoIR! 101 - 48 + 37 50 21 @@ -1828,7 +1781,7 @@ Support FaceTrackNoIR! 101 - 66 + 55 50 21 @@ -1856,7 +1809,7 @@ Support FaceTrackNoIR! 17 - 30 + 19 50 21 @@ -1884,7 +1837,7 @@ Support FaceTrackNoIR! 17 - 48 + 37 50 21 @@ -1912,7 +1865,7 @@ Support FaceTrackNoIR! 17 - 66 + 55 50 21 @@ -1940,7 +1893,7 @@ Support FaceTrackNoIR! 9 - 31 + 20 16 16 @@ -1956,7 +1909,7 @@ Support FaceTrackNoIR! 10 - 51 + 40 16 16 @@ -1972,7 +1925,7 @@ Support FaceTrackNoIR! 10 - 70 + 59 16 16 @@ -1988,7 +1941,7 @@ Support FaceTrackNoIR! 69 - 70 + 59 20 16 @@ -2004,7 +1957,7 @@ Support FaceTrackNoIR! 71 - 31 + 20 20 16 @@ -2020,7 +1973,7 @@ Support FaceTrackNoIR! 69 - 51 + 40 25 16 @@ -2056,57 +2009,6 @@ Support FaceTrackNoIR! - - - - 0 - 0 - 890 - 21 - - - - b - - - - File - - - - - - - - - - View - - - - - - Options - - - - - - - - - Help - - - - - - - - - - - &Open @@ -2283,7 +2185,6 @@ Support FaceTrackNoIR! iconcomboProtocol - diff --git a/facetracknoir/ftnoir_keyboardshortcuts.ui b/facetracknoir/ftnoir_keyboardshortcuts.ui index 0faaf4d0..e70b7536 100644 --- a/facetracknoir/ftnoir_keyboardshortcuts.ui +++ b/facetracknoir/ftnoir_keyboardshortcuts.ui @@ -6,8 +6,8 @@ 0 0 - 591 - 438 + 289 + 81 @@ -23,802 +23,194 @@ false - - - - - - - - - - 50 - 16777215 - - - - Alt - - - - - - - - 50 - 16777215 - - - - Alt - - - - - - - - 50 - 16777215 - - - - Ctrl - - - - - - - - 50 - 16777215 - - - - Ctrl - - - - - - - - 50 - 16777215 - - - - Ctrl - - - - - - - - 50 - 16777215 - - - - Shift - - - - - - - - 90 - 0 - - - - - - - - - 90 - 0 - - - - Select Number - - - QComboBox::InsertAlphabetically - - - - - - - - 0 - 80 - - - - color: rgb(0, 0, 0); - - - Rotations - - - - - 10 - 20 - 50 - 17 - - - - - 50 - 16777215 - - - - Yaw - - - - - - 10 - 40 - 46 - 17 - - - - - 50 - 16777215 - - - - Pitch - - - - - - 10 - 60 - 50 - 17 - - - - - 50 - 16777215 - - - - Roll - - - - - - - - - 60 - 60 - - - - color: rgb(0, 0, 0); - - - View - - - - - 10 - 20 - 46 - 17 - - - - Zero - - - - - - 10 - 40 - 45 - 17 - - - - Stay - - - - - - - - Start/stop - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - color: rgb(0, 0, 0); - - - Translations - - - - - 10 - 20 - 30 - 17 - - - - - 30 - 16777215 - - - - X - - - - - - 10 - 40 - 30 - 17 - - - - - 30 - 16777215 - - - - Y - - - - - - 10 - 60 - 30 - 17 - - - - - 30 - 16777215 - - - - Z - - - - - - - - - 0 - 0 - - - - Game Zero - - - false - - - - - - - - 50 - 16777215 - - - - Shift - - - - - - - - 50 - 16777215 - - - - Ctrl - - - - - - - - 50 - 16777215 - - - - Alt - - - - - - - - 50 - 16777215 - - - - Alt - - - - - - - - 90 - 0 - - - - Select Number - - - QComboBox::InsertAlphabetically - - - - - - - - 0 - 0 - - - - Keyboard - - - Qt::AlignCenter - - - false - - - - - - - Qt::Vertical - - - - - - - - 90 - 0 - - - - - - - - Disables: - - - - - - - When OFF: - - - - - - - - 0 - 0 - - - - Center - - - false - - - - - - - Axis Inhibitor - - - - - - - - 50 - 16777215 - - - - Shift - - - - - - - - 50 - 16777215 - - - - Shift - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - The axis inhibitor shortkey toggles the selected axis Off/On - - - - - - - - - Qt::Horizontal - - - - - - - - - - - Yaw angle for Reverse Axis - - - - - - - - 50 - 0 - - - - - 60 - 16777215 - - - - 90 - - - 45 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - degrees - - - - - - - Z-position for Reverse Axis - - - - - - - - 50 - 0 - - - - - 60 - 16777215 - - - - -50 - - - 150 - - - 50 - - - - - - - cm - - - - - - - When Reverse: - - - - - - - - 50 - 0 - - - - - 60 - 16777215 - - - - -50 - - - 150 - - - -20 - - - - - - - cm - - - - - - - Enable Revers Axis - - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - These settings are saved 'per game' (INI-file) - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QLayout::SetDefaultConstraint - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - OK - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Cancel - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - + + + + 180 + 50 + 100 + 23 + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Cancel + + + + + + 74 + 50 + 100 + 23 + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + OK + + + + + + 179 + 19 + 101 + 20 + + + + + 90 + 0 + + + + Select Number + + + QComboBox::InsertAlphabetically + + + + + + 210 + 0 + 46 + 16 + + + + + 0 + 0 + + + + Keyboard + + + Qt::AlignCenter + + + false + + + + + + 141 + 21 + 36 + 17 + + + + + 50 + 16777215 + + + + Alt + + + + + + 5 + 23 + 33 + 16 + + + + + 0 + 0 + + + + Center + + + false + + + + + + 95 + 21 + 40 + 17 + + + + + 50 + 16777215 + + + + Ctrl + + + + + + 44 + 21 + 45 + 17 + + + + + 50 + 16777215 + + + + Shift + + diff --git a/facetracknoir/ftnoir_preferences.ui b/facetracknoir/ftnoir_preferences.ui deleted file mode 100644 index 9e4bcd34..00000000 --- a/facetracknoir/ftnoir_preferences.ui +++ /dev/null @@ -1,240 +0,0 @@ - - - UICPreferencesDialog - - - - 0 - 0 - 485 - 151 - - - - FaceTrackNoIR Preferences - - - - images/FaceTrackNoIR.pngimages/FaceTrackNoIR.png - - - Qt::LeftToRight - - - false - - - - - - - - - 0 - 0 - - - - Auto Minimize FaceTrackNoIR (0 = disable): - - - false - - - - - - - - - - 1000 - - - 5 - - - - - - - sec. (after 'Start') - - - - - - - Automatically Start tracking on Startup - - - - - - - Taskbar - - - - - - - Tray - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - These settings are saved globally (Registry) - - - false - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QLayout::SetDefaultConstraint - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - OK - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Cancel - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - - - - startEngineClicked() - stopEngineClicked() - cameraSettingsClicked() - - diff --git a/facetracknoir/main-facetracknoir.qrc b/facetracknoir/main-facetracknoir.qrc index 27b7dd30..83c93425 100644 --- a/facetracknoir/main-facetracknoir.qrc +++ b/facetracknoir/main-facetracknoir.qrc @@ -3,12 +3,10 @@ uielements/tools.png images/settings16.png images/settingsopen16.png - uielements/donate.png uielements/curves.png images/rotation_dofs.png images/translation_dofs.png images/330px-6dof_en.png images/facetracknoir.png - uielements/aboutfacetracknoir.png diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 8dbeb6c2..db6c0af2 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -73,51 +73,30 @@ HeadPoseData* GlobalPose = NULL; /** constructor **/ Tracker::Tracker( FaceTrackNoIR *parent ) : confid(false), - useAxisReverse(false), - YawAngle4ReverseAxis(40), - Z_Pos4ReverseAxis(-20.0f), - Z_PosWhenReverseAxis(50.0), should_quit(false), - do_tracking(true), - do_center(false), - do_game_zero(false), - do_axis_reverse(false) + do_center(false) { // Retieve the pointer to the parent mainApp = parent; // Load the settings from the INI-file loadSettings(); - for (int i = 0; i < 6; i++) - { - GlobalPose->axes[i].headPos = 0; - inhibit[i] = false; - } - do_inhibit = false; } Tracker::~Tracker() { } -static void get_curve(bool inhibitp, bool inhibit_zerop, double pos, double& out, THeadPoseDOF& axis) { - if (inhibitp) { - if (inhibit_zerop) - out = 0; - axis.curvePtr->setTrackingActive( true ); - axis.curvePtrAlt->setTrackingActive( false ); +static void get_curve(double pos, double& out, THeadPoseDOF& axis) { + bool altp = (pos < 0) && axis.altp; + if (altp) { + out = axis.invert * axis.curvePtrAlt->getValue(pos); + axis.curvePtr->setTrackingActive( false ); + axis.curvePtrAlt->setTrackingActive( true ); } else { - bool altp = (pos < 0) && axis.altp; - if (altp) { - out = axis.invert * axis.curvePtrAlt->getValue(pos); - axis.curvePtr->setTrackingActive( false ); - axis.curvePtrAlt->setTrackingActive( true ); - } - else { - out = axis.invert * axis.curvePtr->getValue(pos); - axis.curvePtr->setTrackingActive( true ); - axis.curvePtrAlt->setTrackingActive( false ); - } + out = axis.invert * axis.curvePtr->getValue(pos); + axis.curvePtr->setTrackingActive( true ); + axis.curvePtrAlt->setTrackingActive( false ); } } @@ -129,7 +108,6 @@ void Tracker::run() { /** Direct Input variables **/ T6DOF offset_camera; - T6DOF gamezero_camera; T6DOF gameoutput_camera; bool bTracker1Confid = false; @@ -183,13 +161,8 @@ void Tracker::run() { if (Libraries->pFilter) Libraries->pFilter->Initialize(); } - - if (do_game_zero) { - gamezero_camera = gameoutput_camera; - do_game_zero = false; - } - if (do_tracking && confid) { + if (getTrackingActive()) { // get values for (int i = 0; i < 6; i++) target_camera.axes[i] = GlobalPose->axes[i].headPos; @@ -210,26 +183,13 @@ void Tracker::run() { } for (int i = 0; i < 6; i++) - get_curve(do_inhibit && inhibit[i], inhibit_zero, new_camera.axes[i], output_camera.axes[i], GlobalPose->axes[i]); - - if (useAxisReverse) { - do_axis_reverse = ((fabs(output_camera.axes[RX]) > YawAngle4ReverseAxis) && (output_camera.axes[TZ] < Z_Pos4ReverseAxis)); - } else { - do_axis_reverse = false; - } - - // - // Reverse Axis. - // - if (do_axis_reverse) { - output_camera.axes[TZ] = Z_PosWhenReverseAxis; // Set the desired Z-position - } + get_curve(new_camera.axes[i], output_camera.axes[i], GlobalPose->axes[i]); // // Send the headpose to the game // if (Libraries->pProtocol) { - gameoutput_camera = output_camera + gamezero_camera; + gameoutput_camera = output_camera; Libraries->pProtocol->sendHeadposeToGame( gameoutput_camera.axes, newpose ); // degrees & centimeters } } @@ -237,10 +197,10 @@ void Tracker::run() { // // Go to initial position // - if (Libraries->pProtocol && inhibit_zero) { + if (Libraries->pProtocol) { for (int i = 0; i < 6; i++) output_camera.axes[i] = 0; - gameoutput_camera = output_camera + gamezero_camera; + gameoutput_camera = output_camera; Libraries->pProtocol->sendHeadposeToGame( gameoutput_camera.axes, newpose ); // degrees & centimeters } for (int i = 0; i < 6; i++) @@ -263,25 +223,6 @@ void Tracker::run() { } } -// -// Handle the command, send upstream by the game. -// Valid values are: -// 1 = reset Headpose -// -bool Tracker::handleGameCommand ( int command ) { - - qDebug() << "handleGameCommand says: Command =" << command; - - switch ( command ) { - case 1: // reset headtracker - Tracker::do_center = true; - break; - default: - break; - } - return false; -} - // // Get the raw headpose, so it can be displayed. // @@ -311,29 +252,6 @@ void Tracker::loadSettings() { QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "loadSettings says: iniFile = " << currentFile; - - iniFile.beginGroup ( "KB_Shortcuts" ); - // Reverse Axis - useAxisReverse = iniFile.value ( "Enable_ReverseAxis", 0 ).toBool(); - YawAngle4ReverseAxis = iniFile.value ( "RA_Yaw", 40 ).toInt(); - Z_Pos4ReverseAxis = iniFile.value ( "RA_ZPos", 50 ).toInt(); - Z_PosWhenReverseAxis = iniFile.value ( "RA_ToZPos", 80 ).toInt(); - - static const char* names[] = { - "Inhibit_X", - "Inhibit_Y", - "Inhibit_Z", - "Inhibit_Yaw", - "Inhibit_Pitch", - "Inhibit_Roll" - }; - - for (int i = 0; i < 6; i++) - { - inhibit[i] = iniFile.value(names[i], false).toBool(); - } - inhibit_zero = iniFile.value("SetZero", false).toBool(); - iniFile.endGroup (); } void Tracker::setInvertAxis(Axis axis, bool invert) { GlobalPose->axes[axis].invert = invert?-1.0f:1.0f; } diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 035a88ed..c10ae6fb 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -135,15 +135,6 @@ class Tracker : public QThread { Q_OBJECT private: - bool useAxisReverse; // Use Axis Reverse - float YawAngle4ReverseAxis; // Axis Reverse settings - float Z_Pos4ReverseAxis; - float Z_PosWhenReverseAxis; - - - volatile bool inhibit[6]; - volatile bool inhibit_zero; - FaceTrackNoIR *mainApp; protected: @@ -153,17 +144,8 @@ protected: public: Tracker( FaceTrackNoIR *parent ); ~Tracker(); - -// void registerHeadPoseCallback(); - bool handleGameCommand ( int command ); void loadSettings(); // Load settings from the INI-file - //bool isShortKeyPressed( TShortKey *key, BYTE *keystate ); - //bool isMouseKeyPressed( int *key, DIMOUSESTATE *mousestate ); - - bool getTrackingActive() { return do_tracking && confid; } - bool getAxisReverse() { return do_axis_reverse; } - - bool getConfid() { return confid; } + bool getTrackingActive() { return confid; } void setInvertAxis(Axis axis, bool invert); @@ -174,12 +156,7 @@ public: float getRadsFromDegrees ( float degrees ) { return (degrees * 0.017453f); } volatile bool should_quit; // following are now protected by hTrackMutex - volatile bool do_tracking; // Start/stop tracking, using the shortkey volatile bool do_center; // Center head-position, using the shortkey - volatile bool do_inhibit; // Inhibit DOF-axis, using the shortkey - volatile bool do_game_zero; // Set in-game zero, using the shortkey - volatile bool do_axis_reverse; // Axis reverse, using the shortkey - // Flags to start/stop/reset tracking volatile bool confid; // Tracker data is OK; diff --git a/facetracknoir/uielements/aboutfacetracknoir.png b/facetracknoir/uielements/aboutfacetracknoir.png deleted file mode 100644 index 90f8f792..00000000 Binary files a/facetracknoir/uielements/aboutfacetracknoir.png and /dev/null differ diff --git a/facetracknoir/uielements/donate.png b/facetracknoir/uielements/donate.png deleted file mode 100644 index cf4223fb..00000000 Binary files a/facetracknoir/uielements/donate.png and /dev/null differ diff --git a/facetracknoir/uielements/setupfacetracknoir.jpg b/facetracknoir/uielements/setupfacetracknoir.jpg deleted file mode 100644 index 8778c6d5..00000000 Binary files a/facetracknoir/uielements/setupfacetracknoir.jpg and /dev/null differ -- cgit v1.2.3