summaryrefslogtreecommitdiffhomepage
path: root/gui/ui.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-12-06 05:14:07 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-12-06 05:14:07 +0100
commit4e74d6edef94e4f2f7caae76088f91e9ee993fba (patch)
tree47f6eaf6bc8950b610483df90a4824b4365ae478 /gui/ui.cpp
parent0bd32bf56d5b31e7d7e8288b33f536158903e95e (diff)
gui/keys: allow for pausing global keystrokes for options dialog
Toggling tracking while prompting for toggle tracking key causes a deadlock somewhere.
Diffstat (limited to 'gui/ui.cpp')
-rw-r--r--gui/ui.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/gui/ui.cpp b/gui/ui.cpp
index 26fcd9ed..e59b1c23 100644
--- a/gui/ui.cpp
+++ b/gui/ui.cpp
@@ -23,7 +23,8 @@ MainWindow::MainWindow() :
pose_update_timer(this),
kbd_quit(QKeySequence("Ctrl+Q"), this),
no_feed_pixmap(":/images/no-feed.png"),
- is_refreshing_profiles(false)
+ is_refreshing_profiles(false),
+ keys_paused(false)
{
ui.setupUi(this);
@@ -110,15 +111,15 @@ MainWindow::MainWindow() :
QMessageBox::Ok, QMessageBox::NoButton);
connect(this, &MainWindow::emit_start_tracker,
- this, [&]() -> void { qDebug() << "start tracker"; startTracker(); },
+ this, [&]() -> void { if (keys_paused) return; qDebug() << "start tracker"; startTracker(); },
Qt::QueuedConnection);
connect(this, &MainWindow::emit_stop_tracker,
- this, [&]() -> void { qDebug() << "stop tracker"; stopTracker(); },
+ this, [&]() -> void { if (keys_paused) return; qDebug() << "stop tracker"; stopTracker(); },
Qt::QueuedConnection);
connect(this, &MainWindow::emit_toggle_tracker,
- this, [&]() -> void { qDebug() << "toggle tracker"; if (work) stopTracker(); else startTracker(); },
+ this, [&]() -> void { if (keys_paused) return; qDebug() << "toggle tracker"; if (work) stopTracker(); else startTracker(); },
Qt::QueuedConnection);
register_shortcuts();
@@ -493,7 +494,8 @@ bool mk_window(mem<t>* place, Args&&... params)
void MainWindow::show_options_dialog() {
if (mk_window(&options_widget,
s,
- [&]() -> void { register_shortcuts(); }))
+ [&]() -> void { register_shortcuts(); },
+ [&](bool flag) -> void { keys_paused = flag; }))
connect(options_widget.get(), SIGNAL(reload()), this, SLOT(reload_options()));
}