summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-08-28 09:04:43 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-08-28 09:04:43 +0200
commit5dd01a9a8ba94a61462340446031904629d12792 (patch)
tree33c75420f92890c14b8e25a704ee02a95dd055a7
parent418c2f4f98ecac56098153e61e38d9694c4eb32c (diff)
ui: really don't switch profiles while refreshing combobox
-rw-r--r--facetracknoir/ui.cpp9
-rw-r--r--facetracknoir/ui.h1
2 files changed, 7 insertions, 3 deletions
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp
index 04baaf5a..89b25fe4 100644
--- a/facetracknoir/ui.cpp
+++ b/facetracknoir/ui.cpp
@@ -22,7 +22,8 @@
MainWindow::MainWindow() :
pose_update_timer(this),
kbd_quit(QKeySequence("Ctrl+Q"), this),
- no_feed_pixmap(":/images/no-feed.png")
+ no_feed_pixmap(":/images/no-feed.png"),
+ is_refreshing_profiles(false)
{
ui.setupUi(this);
@@ -70,7 +71,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)), Qt::QueuedConnection);
+ connect(ui.iconcomboProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(profileSelected(int)));
connect(&pose_update_timer, SIGNAL(timeout()), this, SLOT(showHeadPose()));
connect(&kbd_quit, SIGNAL(activated()), this, SLOT(exit()));
@@ -204,9 +205,11 @@ void MainWindow::refresh_config_list()
QStringList ini_list = group::ini_list();
set_title();
QString current = group::ini_filename();
+ is_refreshing_profiles = true;
ui.iconcomboProfile->clear();
for (auto x : ini_list)
ui.iconcomboProfile->addItem(QIcon(":/images/settings16.png"), x);
+ is_refreshing_profiles = false;
ui.iconcomboProfile->setCurrentText(current);
}
@@ -434,7 +437,7 @@ void MainWindow::exit() {
void MainWindow::profileSelected(int index)
{
- if (index == -1)
+ if (index == -1 || is_refreshing_profiles)
return;
const auto old_name = group::ini_filename();
diff --git a/facetracknoir/ui.h b/facetracknoir/ui.h
index 021f327d..5d81507f 100644
--- a/facetracknoir/ui.h
+++ b/facetracknoir/ui.h
@@ -50,6 +50,7 @@ class MainWindow : public QMainWindow, private State
mem<ITrackerDialog> pTrackerDialog;
process_detector_worker det;
QMenu profile_menu;
+ bool is_refreshing_profiles;
mem<dylib> current_tracker()
{