From 766fc776421a85958d52bf6f3bfbc189b65a0d5f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 22 Sep 2014 10:43:58 +0200 Subject: remove "second tracker" support Was always a kludge. --- facetracknoir/facetracknoir.cpp | 43 +++++---------------------------------- facetracknoir/facetracknoir.h | 11 +++------- facetracknoir/facetracknoir.ui | 44 ---------------------------------------- facetracknoir/plugin-support.cpp | 18 +--------------- facetracknoir/plugin-support.h | 2 -- facetracknoir/tracker.cpp | 7 ------- 6 files changed, 9 insertions(+), 116 deletions(-) (limited to 'facetracknoir') diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index eb9ece52..3c36ab56 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -54,7 +54,7 @@ static bool get_metadata(DynamicLibrary* lib, QString& longName, QIcon& icon) return true; } -static void fill_combobox(const QString& filter, QList& list, QComboBox* cbx, QComboBox* cbx2) +static void fill_combobox(const QString& filter, QList& list, QComboBox& cbx) { QDir settingsDir( QCoreApplication::applicationDirPath() ); QStringList filenames = settingsDir.entryList( QStringList() << (LIB_PREFIX + filter + SONAME), QDir::Files, QDir::Name ); @@ -71,9 +71,7 @@ static void fill_combobox(const QString& filter, QList& list, Q continue; } list.push_back(lib); - cbx->addItem(icon, longName); - if (cbx2) - cbx2->addItem(icon, longName); + cbx.addItem(icon, longName); } } @@ -90,7 +88,6 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : pose(std::vector{&s.a_x, &s.a_y, &s.a_z, &s.a_yaw, &s.a_pitch, &s.a_roll}), timUpdateHeadPose(this), pTrackerDialog(NULL), - pSecondTrackerDialog(NULL), pProtocolDialog(NULL), pFilterDialog(NULL), kbd_quit(QKeySequence("Ctrl+Q"), this), @@ -129,20 +126,17 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : connect(ui.btnEditCurves, SIGNAL(clicked()), this, SLOT(showCurveConfiguration())); connect(ui.btnShortcuts, SIGNAL(clicked()), this, SLOT(showKeyboardShortcuts())); connect(ui.btnShowEngineControls, SIGNAL(clicked()), this, SLOT(showTrackerSettings())); - connect(ui.btnShowSecondTrackerSettings, SIGNAL(clicked()), this, SLOT(showSecondTrackerSettings())); connect(ui.btnShowServerControls, SIGNAL(clicked()), this, SLOT(showServerControls())); connect(ui.btnShowFilterControls, SIGNAL(clicked()), this, SLOT(showFilterControls())); - ui.cbxSecondTrackerSource->addItem(QIcon(), ""); dlopen_filters.push_back((DynamicLibrary*) NULL); ui.iconcomboFilter->addItem(QIcon(), ""); - fill_combobox("opentrack-proto-*.", dlopen_protocols, ui.iconcomboProtocol, NULL); - fill_combobox("opentrack-tracker-*.", dlopen_trackers, ui.iconcomboTrackerSource, ui.cbxSecondTrackerSource); - fill_combobox("opentrack-filter-*.", dlopen_filters, ui.iconcomboFilter, NULL); + fill_combobox("opentrack-proto-*.", dlopen_protocols, *ui.iconcomboProtocol); + fill_combobox("opentrack-tracker-*.", dlopen_trackers, *ui.iconcomboTrackerSource); + fill_combobox("opentrack-filter-*.", dlopen_filters, *ui.iconcomboFilter); tie_setting(s.tracker_dll, ui.iconcomboTrackerSource); - tie_setting(s.tracker2_dll, ui.cbxSecondTrackerSource); tie_setting(s.protocol_dll, ui.iconcomboProtocol); tie_setting(s.filter_dll, ui.iconcomboFilter); @@ -287,7 +281,6 @@ void FaceTrackNoIR::updateButtonState(bool running, bool inertialp) ui.iconcomboProtocol->setEnabled ( not_running ); ui.iconcomboFilter->setEnabled ( not_running ); ui.iconcomboTrackerSource->setEnabled(not_running); - ui.cbxSecondTrackerSource->setEnabled(not_running); ui.btnStartTracker->setEnabled(not_running); ui.btnStopTracker->setEnabled(running); ui.video_frame_label->setVisible(not_running || inertialp); @@ -369,12 +362,6 @@ void FaceTrackNoIR::stopTracker( ) { delete pFilterDialog; pFilterDialog = nullptr; } - if (pSecondTrackerDialog) - { - pSecondTrackerDialog->unRegisterTracker(); - delete pSecondTrackerDialog; - pSecondTrackerDialog = nullptr; - } if ( tracker ) { delete tracker; @@ -442,26 +429,6 @@ void FaceTrackNoIR::showTrackerSettings() { } } -void FaceTrackNoIR::showSecondTrackerSettings() { - if (pSecondTrackerDialog) { - delete pSecondTrackerDialog; - pSecondTrackerDialog = NULL; - } - - DynamicLibrary* lib = dlopen_trackers.value(ui.cbxSecondTrackerSource->currentIndex() - 1, (DynamicLibrary*) NULL); - - if (lib) { - pSecondTrackerDialog = (ITrackerDialog*) lib->Dialog(); - if (pSecondTrackerDialog) { - auto foo = dynamic_cast(pSecondTrackerDialog); - foo->setFixedSize(foo->size()); - if (Libraries && Libraries->pSecondTracker) - pSecondTrackerDialog->registerTracker(Libraries->pSecondTracker); - dynamic_cast(pSecondTrackerDialog)->show(); - } - } -} - void FaceTrackNoIR::showServerControls() { if (pProtocolDialog) { delete pProtocolDialog; diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index bdec333f..9bdda749 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -68,16 +68,13 @@ public: QFrame *get_video_widget(); Tracker *tracker; void bindKeyboardShortcuts(); - DynamicLibrary* current_tracker1() { + DynamicLibrary* current_tracker1() override { return dlopen_trackers.value(ui.iconcomboTrackerSource->currentIndex(), (DynamicLibrary*) NULL); } - DynamicLibrary* current_tracker2() { - return dlopen_trackers.value(ui.cbxSecondTrackerSource->currentIndex() - 1, (DynamicLibrary*) NULL); - } - DynamicLibrary* current_protocol() { + DynamicLibrary* current_protocol() override { return dlopen_protocols.value(ui.iconcomboProtocol->currentIndex(), (DynamicLibrary*) NULL); } - DynamicLibrary* current_filter() { + DynamicLibrary* current_filter() override { return dlopen_filters.value(ui.iconcomboFilter->currentIndex(), (DynamicLibrary*) NULL); } THeadPoseDOF& axis(int idx) { @@ -104,7 +101,6 @@ private: QTimer timUpdateHeadPose; ITrackerDialog* pTrackerDialog; - ITrackerDialog* pSecondTrackerDialog; IProtocolDialog* pProtocolDialog; IFilterDialog* pFilterDialog; @@ -137,7 +133,6 @@ private slots: void profileSelected(int index); void showTrackerSettings(); - void showSecondTrackerSettings(); void showServerControls(); void showFilterControls(); diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index d2c78461..481260d3 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -426,50 +426,6 @@ - - - - 625 - 180 - 221 - 65 - - - - Auxiliary tracker - - - - - - - 0 - 0 - - - - 42 - - - - - - - true - - - - 0 - 0 - - - - Settings - - - - - diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp index 50b8ad1a..71279cb9 100644 --- a/facetracknoir/plugin-support.cpp +++ b/facetracknoir/plugin-support.cpp @@ -14,11 +14,6 @@ SelectedLibraries::~SelectedLibraries() pTracker = NULL; } - if (pSecondTracker) { - delete pSecondTracker; - pSecondTracker = NULL; - } - if (pFilter) delete pFilter; @@ -27,7 +22,7 @@ SelectedLibraries::~SelectedLibraries() } SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : - pTracker(NULL), pSecondTracker(NULL), pFilter(NULL), pProtocol(NULL) + pTracker(NULL), pFilter(NULL), pProtocol(NULL) { correct = false; if (!mainApp) @@ -42,13 +37,6 @@ SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : pTracker = (ITracker*) ptr(); } - lib = mainApp->current_tracker2(); - - if (lib && lib->Constructor) { - ptr = (CTOR_FUNPTR) lib->Constructor; - pSecondTracker = (ITracker*) ptr(); - } - lib = mainApp->current_protocol(); if (lib && lib->Constructor) { @@ -69,15 +57,11 @@ SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : if (pTracker) { pTracker->StartTracker( mainApp->get_video_widget() ); } - if (pSecondTracker) { - pSecondTracker->StartTracker( mainApp->get_video_widget() ); - } correct = true; } DynamicLibrary::DynamicLibrary(const QString& filename) : - handle(nullptr), Dialog(nullptr), Constructor(nullptr), Metadata(nullptr) diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index f3270aa6..1e02bd60 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -27,7 +27,6 @@ class IDynamicLibraryProvider; struct SelectedLibraries { public: ITracker* pTracker; - ITracker* pSecondTracker; IFilter* pFilter; IProtocol* pProtocol; SelectedLibraries(IDynamicLibraryProvider* main = NULL); @@ -64,7 +63,6 @@ private: class IDynamicLibraryProvider { public: virtual DynamicLibrary* current_tracker1() = 0; - virtual DynamicLibrary* current_tracker2() = 0; virtual DynamicLibrary* current_protocol() = 0; virtual DynamicLibrary* current_filter() = 0; virtual QFrame* get_video_widget() = 0; diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index dd37e883..90e9bdad 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -91,9 +91,6 @@ void Tracker::run() { if (Libraries->pTracker) sleep_ms = std::min(sleep_ms, 1000 / Libraries->pTracker->preferredHz()); - if (Libraries->pSecondTracker) - sleep_ms = std::min(sleep_ms, 1000 / Libraries->pSecondTracker->preferredHz()); - qDebug() << "tracker Hz:" << 1000 / sleep_ms; #if defined(_WIN32) @@ -107,10 +104,6 @@ void Tracker::run() { if (should_quit) break; - if (Libraries->pSecondTracker) { - Libraries->pSecondTracker->GetHeadPoseData(newpose); - } - if (Libraries->pTracker) { Libraries->pTracker->GetHeadPoseData(newpose); } -- cgit v1.2.3