diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-08-30 09:28:22 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-08-30 09:28:31 +0200 |
commit | 77542be46d3b56c48735f72d7345a1f1034a0a90 (patch) | |
tree | cce871bdbd22830f892c7ea9f79a774489463384 /facetracknoir/ui.cpp | |
parent | f281b514b060a2225702b2e7c9420b73d0b2bb72 (diff) |
ui: save settings on a timer
The QSettings IO is damn slow on Windows. Save only after five seconds
have elapsed with nothing being changed.
Diffstat (limited to 'facetracknoir/ui.cpp')
-rw-r--r-- | facetracknoir/ui.cpp | 15 |
1 files changed, 13 insertions, 2 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(); |