summaryrefslogtreecommitdiffhomepage
path: root/gui/ui.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-04-29 09:21:10 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-04-29 09:21:23 +0200
commit3a7011ff73cce39ecacb4c5651c1a2dbda8eb10e (patch)
tree84d21d48998aaacbad9cb27b7e5edf29b0dd1396 /gui/ui.cpp
parent69cc802722c8264c0fd8b138a298d4820c11f1d8 (diff)
api, main: implement new keybindings
The following keybindings are now implemented: - restart tracking. if not started, starts. - toggle (keep position) while key held - zero (keep zero) while key held The latter two options only work for Windows as libqxt doesn't support them. Closes #291
Diffstat (limited to 'gui/ui.cpp')
-rwxr-xr-xgui/ui.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/gui/ui.cpp b/gui/ui.cpp
index a136f2aa..2832126b 100755
--- a/gui/ui.cpp
+++ b/gui/ui.cpp
@@ -119,6 +119,10 @@ MainWindow::MainWindow() :
connect(this, &MainWindow::emit_toggle_tracker,
this, [&]() -> void { if (keys_paused) return; qDebug() << "toggle tracker"; if (work) stopTracker(); else startTracker(); },
Qt::QueuedConnection);
+
+ connect(this, &MainWindow::emit_restart_tracker,
+ this, [&]() -> void { if (keys_paused) return; qDebug() << "retart tracker"; stopTracker(); startTracker(); },
+ Qt::QueuedConnection);
register_shortcuts();
@@ -129,12 +133,13 @@ MainWindow::MainWindow() :
void MainWindow::register_shortcuts()
{
- using t_shortcut = std::tuple<key_opts&, Shortcuts::fun>;
+ using t_shortcut = std::tuple<key_opts&, Shortcuts::fun, bool>;
std::vector<t_shortcut> keys {
- t_shortcut(s.key_start_tracking, [&]() -> void { emit_start_tracker(); }),
- t_shortcut(s.key_stop_tracking, [&]() -> void { emit_stop_tracker(); }),
- t_shortcut(s.key_toggle_tracking, [&]() -> void { emit_toggle_tracker(); }),
+ t_shortcut(s.key_start_tracking, [&](bool) -> void { emit_start_tracker(); }, true),
+ t_shortcut(s.key_stop_tracking, [&](bool) -> void { emit_stop_tracker(); }, true),
+ t_shortcut(s.key_toggle_tracking, [&](bool) -> void { emit_toggle_tracker(); }, true),
+ t_shortcut(s.key_restart_tracking, [&](bool) -> void { emit_restart_tracker(); }, true),
};
global_shortcuts.reload(keys);