summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir/ui.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-08-26 19:55:01 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-08-27 09:37:14 +0200
commit844d9a6f4d62227fbf22e65614c84693438080bf (patch)
treea0392d36c9c24dc409b41445e7383015bd80c2c1 /facetracknoir/ui.cpp
parenta220e0af0fb7f9a8efdf24d325e5188f14d386f6 (diff)
ui: don't reload settings if config wasn't changed
Since combobox is reloaded on a timer, the "current" config changes all the time.
Diffstat (limited to 'facetracknoir/ui.cpp')
-rw-r--r--facetracknoir/ui.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp
index 0befd813..3c2d8db6 100644
--- a/facetracknoir/ui.cpp
+++ b/facetracknoir/ui.cpp
@@ -70,7 +70,7 @@ MainWindow::MainWindow() :
connect(ui.btnStartTracker, SIGNAL(clicked()), this, SLOT(startTracker()));
connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stopTracker()));
- connect(ui.iconcomboProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(profileSelected(int)));
+ connect(ui.iconcomboProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(profileSelected(int)), Qt::QueuedConnection);
connect(&pose_update_timer, SIGNAL(timeout()), this, SLOT(showHeadPose()));
connect(&kbd_quit, SIGNAL(activated()), this, SLOT(exit()));
@@ -438,15 +438,20 @@ void MainWindow::profileSelected(int index)
{
if (index == -1)
return;
-
- {
- QSettings settings(OPENTRACK_ORG);
- settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, ui.iconcomboProfile->itemText(index));
- }
- set_title();
+ const auto old_name = group::ini_filename();
+ const auto new_name = ui.iconcomboProfile->itemText(index);
- load_settings();
+ if (old_name != new_name)
+ {
+ {
+ QSettings settings(OPENTRACK_ORG);
+ settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, new_name);
+ }
+
+ set_title();
+ load_settings();
+ }
}
void MainWindow::shortcutRecentered()