diff options
-rw-r--r-- | facetracknoir/ui.cpp | 21 | ||||
-rw-r--r-- | facetracknoir/ui.h | 2 |
2 files changed, 14 insertions, 9 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() diff --git a/facetracknoir/ui.h b/facetracknoir/ui.h index 46a97b3f..021f327d 100644 --- a/facetracknoir/ui.h +++ b/facetracknoir/ui.h @@ -73,7 +73,7 @@ class MainWindow : public QMainWindow, private State void set_title(const QString& game_title = QStringLiteral("")); void save(); static bool get_new_config_name_from_dialog(QString &ret); - static void set_profile(const QString& profile); + void set_profile(const QString& profile); private slots: void exit(); void profileSelected(int index); |