summaryrefslogtreecommitdiffhomepage
path: root/gui/ui.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-06-12 18:32:49 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-06-14 18:14:46 +0200
commit0c029da344b45154d4c68debe127d8cdf3843751 (patch)
treec760accf448eb4d9d8eadd30f43051b3a228c10e /gui/ui.cpp
parent251d2c45a37da6fed01c1f37529c3cd899b434e6 (diff)
gui, spline-widget, compat/options: ensure no qsettings IO when not modified
Turns out every MainWindow::save() and friends were doing useless IO several times during each save. I blame the bundle abstraction. For bundles we track the modified state, but the spline widget needs equality check since it doesn't use the options api. It was found by accident when adding qDebug() into the slider_value {de,}serializer code. The .ini file was being rewritten over and over again causing hundres of milliseconds pauses on Windows. Remove the save timer kludge from gui. Saves are now fast.
Diffstat (limited to 'gui/ui.cpp')
-rw-r--r--gui/ui.cpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/gui/ui.cpp b/gui/ui.cpp
index fabcb5e4..40ac6c8d 100644
--- a/gui/ui.cpp
+++ b/gui/ui.cpp
@@ -74,9 +74,6 @@ 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()));
@@ -156,11 +153,10 @@ bool MainWindow::get_new_config_name_from_dialog(QString& ret)
MainWindow::~MainWindow()
{
- maybe_save();
-
if (tray)
tray->hide();
stopTracker();
+ save();
}
void MainWindow::set_working_directory()
@@ -168,30 +164,15 @@ void MainWindow::set_working_directory()
QDir::setCurrent(QCoreApplication::applicationDirPath());
}
-void MainWindow::save_mappings() {
+void MainWindow::save_mappings()
+{
pose.save_mappings();
}
void MainWindow::save()
{
- save_timer.stop();
- save_timer.start(5000);
-}
-
-void MainWindow::maybe_save()
-{
- if (save_timer.isActive())
- {
- save_timer.stop();
- _save();
- }
-}
-
-void MainWindow::_save() {
s.b->save();
save_mappings();
- mem<QSettings> settings = group::ini_file();
- settings->sync();
#if defined(__unix) || defined(__linux)
QString currentFile = group::ini_pathname();