diff options
-rw-r--r-- | facetracknoir/facetracknoir.cpp | 22 | ||||
-rw-r--r-- | facetracknoir/facetracknoir.h | 12 | ||||
-rw-r--r-- | opentrack/work.hpp | 9 |
3 files changed, 21 insertions, 22 deletions
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 0333c120..638bd543 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -26,7 +26,7 @@ #include <QFileDialog> FaceTrackNoIR::FaceTrackNoIR() : - timUpdateHeadPose(this), + pose_update_timer(this), kbd_quit(QKeySequence("Ctrl+Q"), this), no_feed_pixmap(":/uielements/no-feed.png") { @@ -69,7 +69,7 @@ FaceTrackNoIR::FaceTrackNoIR() : connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stopTracker())); connect(ui.iconcomboProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(profileSelected(int))); - connect(&timUpdateHeadPose, SIGNAL(timeout()), this, SLOT(showHeadPose())); + connect(&pose_update_timer, SIGNAL(timeout()), this, SLOT(showHeadPose())); connect(&kbd_quit, SIGNAL(activated()), this, SLOT(exit())); kbd_quit.setEnabled(true); } @@ -97,7 +97,7 @@ void FaceTrackNoIR::open() { settings.setValue ("SettingsFile", QFileInfo(fileName).absoluteFilePath()); } fill_profile_combobox(); - loadSettings(); + load_settings(); } } @@ -159,7 +159,7 @@ void FaceTrackNoIR::load_mappings() { pose.load_mappings(); } -void FaceTrackNoIR::loadSettings() { +void FaceTrackNoIR::load_settings() { b->reload(); load_mappings(); } @@ -199,12 +199,12 @@ void FaceTrackNoIR::updateButtonState(bool running, bool inertialp) void FaceTrackNoIR::bindKeyboardShortcuts() { if (work) - work->sc = std::make_shared<Shortcuts>(winId()); + work->reload_shortcuts(); } void FaceTrackNoIR::startTracker( ) { b->save(); - loadSettings(); + load_settings(); bindKeyboardShortcuts(); // tracker dtor needs run first @@ -228,7 +228,7 @@ void FaceTrackNoIR::startTracker( ) { } ui.video_frame->show(); - timUpdateHeadPose.start(50); + pose_update_timer.start(50); // NB check valid since SelectedLibraries ctor called // trackers take care of layout state updates @@ -239,7 +239,7 @@ void FaceTrackNoIR::startTracker( ) { void FaceTrackNoIR::stopTracker( ) { ui.game_name->setText("Not connected"); - timUpdateHeadPose.stop(); + pose_update_timer.stop(); ui.pose_display->rotateBy(0, 0, 0); if (pTrackerDialog) @@ -372,22 +372,20 @@ void FaceTrackNoIR::showKeyboardShortcuts() { void FaceTrackNoIR::showCurveConfiguration() { mapping_widget = std::make_shared<MapWidget>(pose, s); mapping_widget->setWindowFlags(Qt::Dialog); - mapping_widget->raise(); + mapping_widget->show(); } void FaceTrackNoIR::exit() { QCoreApplication::exit(0); } -extern "C" volatile const char* opentrack_version; - void FaceTrackNoIR::profileSelected(int index) { QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QFileInfo pathInfo ( currentFile ); settings.setValue ("SettingsFile", pathInfo.absolutePath() + "/" + ui.iconcomboProfile->itemText(index)); - loadSettings(); + load_settings(); } void FaceTrackNoIR::shortcutRecentered() diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 4d4ec9e1..e3a438e4 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -58,16 +58,14 @@ using namespace options; class FaceTrackNoIR : public QMainWindow, private State { Q_OBJECT - Ui::OpentrackUI ui; - QTimer timUpdateHeadPose; + Ui::OpentrackUI ui; + QTimer pose_update_timer; ptr<KeyboardShortcutDialog> shortcuts_widget; ptr<MapWidget> mapping_widget; - QShortcut kbd_quit; QPixmap no_feed_pixmap; - ptr<IFilterDialog> pFilterDialog; ptr<IProtocolDialog> pProtocolDialog; ptr<ITrackerDialog> pTrackerDialog; @@ -86,11 +84,9 @@ class FaceTrackNoIR : public QMainWindow, private State } void createIconGroupBox(); - void loadSettings(); + void load_settings(); void updateButtonState(bool running, bool inertialp); - void fill_profile_combobox(); - void display_pose(const double* mapped, const double* raw); public slots: @@ -105,12 +101,10 @@ private slots: void profileSelected(int index); void showTrackerSettings(); - void showProtocolSettings(); void showFilterSettings(); void showKeyboardShortcuts(); void showCurveConfiguration(); - void showHeadPose(); void startTracker(); diff --git a/opentrack/work.hpp b/opentrack/work.hpp index c0962b9a..73ba691b 100644 --- a/opentrack/work.hpp +++ b/opentrack/work.hpp @@ -15,11 +15,13 @@ struct Work SelectedLibraries libs; ptr<Tracker> tracker; ptr<Shortcuts> sc; + WId handle; Work(main_settings& s, Mappings& m, SelectedLibraries& libs, QObject* recv, WId handle) : s(s), libs(libs), tracker(std::make_shared<Tracker>(s, m, libs)), - sc(std::make_shared<Shortcuts>(handle)) + sc(std::make_shared<Shortcuts>(handle)), + handle(handle) { #ifndef _WIN32 QObject::connect(&sc->keyCenter, SIGNAL(activated()), recv, SLOT(shortcutRecentered())); @@ -31,6 +33,11 @@ struct Work tracker->start(); } + void reload_shortcuts() + { + sc = std::make_shared<Shortcuts>(handle); + } + ~Work() { // order matters, otherwise use-after-free -sh |