diff options
Diffstat (limited to 'facetracknoir')
-rw-r--r-- | facetracknoir/ui.cpp | 15 | ||||
-rw-r--r-- | facetracknoir/ui.h | 4 |
2 files changed, 16 insertions, 3 deletions
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp index 0876c848..6437b9d1 100644 --- a/facetracknoir/ui.cpp +++ b/facetracknoir/ui.cpp @@ -76,6 +76,9 @@ MainWindow::MainWindow() : connect(&pose_update_timer, SIGNAL(timeout()), this, SLOT(showHeadPose())); connect(&kbd_quit, SIGNAL(activated()), this, SLOT(exit())); + save_timer.setSingleShot(true); + connect(&save_timer, SIGNAL(timeout()), this, SLOT(_save())); + profile_menu.addAction("Create new empty config", this, SLOT(make_empty_config())); profile_menu.addAction("Create new copied config", this, SLOT(make_copied_config())); profile_menu.addAction("Open configuration directory", this, SLOT(open_config_directory())); @@ -116,10 +119,12 @@ bool MainWindow::get_new_config_name_from_dialog(QString& ret) MainWindow::~MainWindow() { + save_timer.stop(); + if (tray) tray->hide(); stopTracker(); - save(); + _save(); } void MainWindow::set_working_directory() @@ -131,7 +136,13 @@ void MainWindow::save_mappings() { pose.save_mappings(); } -void MainWindow::save() { +void MainWindow::save() +{ + save_timer.stop(); + save_timer.start(5000); +} + +void MainWindow::_save() { s.b->save(); save_mappings(); mem<QSettings> settings = group::ini_file(); diff --git a/facetracknoir/ui.h b/facetracknoir/ui.h index 65a7647a..cfaf47cb 100644 --- a/facetracknoir/ui.h +++ b/facetracknoir/ui.h @@ -51,6 +51,7 @@ class MainWindow : public QMainWindow, private State process_detector_worker det; QMenu profile_menu; bool is_refreshing_profiles; + QTimer save_timer; mem<dylib> current_tracker() { @@ -72,10 +73,11 @@ class MainWindow : public QMainWindow, private State void display_pose(const double* mapped, const double* raw); void ensure_tray(); void set_title(const QString& game_title = QStringLiteral("")); - void save(); static bool get_new_config_name_from_dialog(QString &ret); void set_profile(const QString& profile); private slots: + void _save(); + void save(); void exit(); void profileSelected(QString name); |