From 445eeab7b7f0155a9a52e8bfa5ee8d030151386e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 5 Nov 2018 15:24:20 +0100 Subject: trackmouse: fix toggle tracker shortcut --- variant/trackmouse/window.cpp | 11 ++++++++--- variant/trackmouse/window.hpp | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'variant') diff --git a/variant/trackmouse/window.cpp b/variant/trackmouse/window.cpp index 1cda0694..a1160c50 100644 --- a/variant/trackmouse/window.cpp +++ b/variant/trackmouse/window.cpp @@ -80,6 +80,10 @@ main_window::main_window() : State(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH) this, [&] { qDebug() << "stop tracker"; stop_tracker_(); }, Qt::QueuedConnection); + connect(this, &main_window::toggle_tracker, + this, [&] { qDebug() << "toggle tracker"; toggle_tracker_(); }, + Qt::QueuedConnection); + connect(ui.btnStartTracker, SIGNAL(clicked()), this, SLOT(start_tracker_())); connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stop_tracker_())); @@ -132,7 +136,7 @@ main_window::main_window() : State(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH) void main_window::register_shortcuts() { global_shortcuts.reload({ - { s.key_toggle_tracking1, [this](bool) { main_window::toggle_tracker_(); }, true }, + { s.key_toggle_tracking1, [this](bool) { main_window::toggle_tracker(); }, true }, }); if (work) @@ -372,8 +376,9 @@ void main_window::set_profile_in_registry() void main_window::toggle_tracker_() { + qDebug() << "toggle tracker"; if (work) - stop_tracker(); + stop_tracker_(); else - start_tracker(); + start_tracker_(); } diff --git a/variant/trackmouse/window.hpp b/variant/trackmouse/window.hpp index b62ae2dd..fd5d5f44 100644 --- a/variant/trackmouse/window.hpp +++ b/variant/trackmouse/window.hpp @@ -86,6 +86,7 @@ private slots: signals: void start_tracker(); void stop_tracker(); + void toggle_tracker(); public: main_window(); -- cgit v1.2.3