From 985f2199c8ae3879d831a43ca0b92633eccc1855 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 7 May 2013 23:44:35 +0200 Subject: Remove Linux-only crash bug and dead code --- facetracknoir/facetracknoir.cpp | 104 ++++------------------------------------ facetracknoir/facetracknoir.h | 15 ++---- 2 files changed, 14 insertions(+), 105 deletions(-) diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 0c9915a4..94a5257d 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -79,8 +79,8 @@ KeybindingWorkerDummy::~KeybindingWorkerDummy() { din->Release(); } -KeybindingWorkerDummy::KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter, Key keyInhibit, Key keyStartStop, Key keyZero) -: kCenter(keyCenter), kInhibit(keyInhibit), kStartStop(keyStartStop), kZero(keyZero), window(w), should_quit(true), din(0), dinkeyboard(0) +KeybindingWorkerDummy::KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter) +: kCenter(keyCenter), window(w), should_quit(true), din(0), dinkeyboard(0) { if (DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&din, NULL) != DI_OK) { qDebug() << "setup DirectInput8 Creation failed!" << GetLastError(); @@ -118,7 +118,6 @@ KeybindingWorkerDummy::KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter, Ke qDebug() << "setup dinkeyboard Acquire failed!" << GetLastError(); return; } - qDebug() << "keycodes bound:" << kCenter.keycode << kInhibit.keycode << kStartStop.keycode << kZero.keycode; should_quit = false; } @@ -179,14 +178,16 @@ void KeybindingWorkerDummy::run() { // Setup the Main Dialog // FaceTrackNoIR::FaceTrackNoIR(QWidget *parent, Qt::WFlags flags) : + #if defined(__WIN32) || defined(_WIN32) + keybindingWorker(NULL), + #else + keyCenter(0), + #endif QMainWindow(parent, flags), pTrackerDialog(NULL), pSecondTrackerDialog(NULL), pProtocolDialog(NULL), pFilterDialog(NULL), -#if defined(__WIN32) || defined(_WIN32) - keybindingWorker(NULL), -#endif looping(false), timUpdateHeadPose(this) { @@ -628,7 +629,7 @@ void FaceTrackNoIR::startTracker( ) { } #if defined(_WIN32) || defined(__WIN32) - keybindingWorker = new KeybindingWorker(*this, keyCenter, keyInhibit, keyStartStop, keyZero); + keybindingWorker = new KeybindingWorker(*this, keyCenter); keybindingWorker->start(); #endif @@ -1253,9 +1254,6 @@ void FaceTrackNoIR::bindKeyboardShortcuts() QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "KB_Shortcuts" ); int idxCenter = iniFile.value("Key_index_Center", 0).toInt(); - int idxGameZero = iniFile.value("Key_index_GameZero", 0).toInt(); - int idxStartStop = iniFile.value("Key_index_StartStop", 0).toInt(); - int idxInhibit = iniFile.value("Key_index_Inhibit", 0).toInt(); #if !defined(_WIN32) && !defined(__WIN32) if (keyCenter) { @@ -1263,21 +1261,6 @@ void FaceTrackNoIR::bindKeyboardShortcuts() keyCenter = NULL; } - if (keyZero) { - delete keyZero; - keyZero = NULL; - } - - if (keyStartStop) { - delete keyStartStop; - keyStartStop = NULL; - } - - if (keyInhibit) { - delete keyInhibit; - keyInhibit = NULL; - } - if (idxCenter > 0) { QString seq(global_key_sequences.value(idxCenter, "")); @@ -1294,83 +1277,14 @@ void FaceTrackNoIR::bindKeyboardShortcuts() } } - if (idxGameZero > 0) - { - QString seq(global_key_sequences.value(idxGameZero, "")); - if (!seq.isEmpty()) - { - if (iniFile.value("Shift_GameZero", false).toBool()) - seq = "Shift+" + seq; - if (iniFile.value("Alt_GameZero", false).toBool()) - seq = "Alt+" + seq; - if (iniFile.value("Ctrl_GameZero", false).toBool()) - seq = "Ctrl+" + seq; - } - keyZero = new QxtGlobalShortcut(QKeySequence(seq)); - connect(keyZero, SIGNAL(activated()), this, SLOT(shortcutZero())); - } - - if (idxStartStop > 0) - { - QString seq(global_key_sequences.value(idxStartStop, "")); - if (!seq.isEmpty()) - { - if (iniFile.value("Shift_StartStop", false).toBool()) - seq = "Shift+" + seq; - if (iniFile.value("Alt_StartStop", false).toBool()) - seq = "Alt+" + seq; - if (iniFile.value("Ctrl_StartStop", false).toBool()) - seq = "Ctrl+" + seq; - } - keyStartStop = new QxtGlobalShortcut(QKeySequence(seq)); - connect(keyStartStop, SIGNAL(activated()), this, SLOT(shortcutStartStop())); - } - - if (idxInhibit > 0) - { - QString seq(global_key_sequences.value(idxInhibit, "")); - if (!seq.isEmpty()) - { - if (iniFile.value("Shift_Inhibit", false).toBool()) - seq = "Shift+" + seq; - if (iniFile.value("Alt_Inhibit", false).toBool()) - seq = "Alt+" + seq; - if (iniFile.value("Ctrl_Inhibit", false).toBool()) - seq = "Ctrl+" + seq; - } - keyInhibit = new QxtGlobalShortcut(QKeySequence(seq)); - connect(keyInhibit, SIGNAL(activated()), this, SLOT(shortcutInhibit())); - } #else - keyCenter.keycode = keyZero.keycode = keyInhibit.keycode = keyStartStop.keycode = 0; + keyCenter.keycode = 0; keyCenter.shift = keyCenter.alt = keyCenter.ctrl = 0; - keyZero.shift = keyZero.alt = keyZero.ctrl = 0; - keyInhibit.shift = keyInhibit.alt = keyInhibit.ctrl = 0; - keyStartStop.shift = keyStartStop.alt = keyStartStop.ctrl = 0; if (idxCenter > 0 && idxCenter < global_windows_key_sequences.size()) keyCenter.keycode = global_windows_key_sequences[idxCenter]; - if (idxGameZero > 0 && idxCenter < global_windows_key_sequences.size()) - keyZero.keycode = global_windows_key_sequences[idxGameZero]; - if (idxInhibit > 0 && idxInhibit < global_windows_key_sequences.size()) - keyInhibit.keycode = global_windows_key_sequences[idxInhibit]; - if (idxStartStop > 0 && idxStartStop < global_windows_key_sequences.size()) - keyStartStop.keycode = global_windows_key_sequences[idxStartStop]; - keyCenter.shift = iniFile.value("Shift_Center", false).toBool(); keyCenter.alt = iniFile.value("Alt_Center", false).toBool(); keyCenter.ctrl = iniFile.value("Ctrl_Center", false).toBool(); - - keyInhibit.shift = iniFile.value("Shift_Inhibit", false).toBool(); - keyInhibit.alt = iniFile.value("Alt_Inhibit", false).toBool(); - keyInhibit.ctrl = iniFile.value("Ctrl_Inhibit", false).toBool(); - - keyZero.shift = iniFile.value("Shift_GameZero", false).toBool(); - keyZero.alt = iniFile.value("Alt_GameZero", false).toBool(); - keyZero.ctrl = iniFile.value("Ctrl_GameZero", false).toBool(); - - keyStartStop.shift = iniFile.value("Shift_StartStop", false).toBool(); - keyStartStop.alt = iniFile.value("Alt_StartStop", false).toBool(); - keyStartStop.ctrl = iniFile.value("Ctrl_StartStop", false).toBool(); #endif iniFile.endGroup (); } diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index aa657c0e..ece1d9b9 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -122,13 +122,10 @@ public: } #if defined(_WIN32) || defined(__WIN32) - Key keyCenter, keyZero, keyStartStop, keyInhibit; + Key keyCenter; KeybindingWorker* keybindingWorker; #else QxtGlobalShortcut* keyCenter; - QxtGlobalShortcut* keyZero; - QxtGlobalShortcut* keyStartStop; - QxtGlobalShortcut* keyInhibit; #endif public slots: void shortcutRecentered(); @@ -272,18 +269,18 @@ class KeybindingWorkerDummy { private: LPDIRECTINPUT8 din; LPDIRECTINPUTDEVICE8 dinkeyboard; - Key kCenter, kInhibit, kStartStop, kZero; + Key kCenter; FaceTrackNoIR& window; public: volatile bool should_quit; ~KeybindingWorkerDummy(); - KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter, Key keyInhibit, Key keyStartStop, Key keyZero); + KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter); void run(); }; #else class KeybindingWorkerDummy { public: - KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter, Key keyInhibit, Key keyStartStop, Key keyZero); + KeybindingWorkerDummy(FaceTrackNoIR& w, Key keyCenter); void run() {} }; #endif @@ -291,12 +288,10 @@ public: class KeybindingWorker : public QThread, public KeybindingWorkerDummy { Q_OBJECT public: - KeybindingWorker(FaceTrackNoIR& w, Key keyCenter, Key keyInhibit, Key keyStartStop, Key keyZero) : KeybindingWorkerDummy(w, keyCenter, keyInhibit, keyStartStop, keyZero) + KeybindingWorker(FaceTrackNoIR& w, Key keyCenter) : KeybindingWorkerDummy(w, keyCenter) { } void run() { KeybindingWorkerDummy::run(); } - - }; -- cgit v1.2.3