From 616f6d784f56ba38059a299f6d21b925768951f9 Mon Sep 17 00:00:00 2001
From: beuchatp <beuchatp@control.ee.ethz.ch>
Date: Tue, 1 May 2018 13:27:11 +0200
Subject: [PATCH] Added motors off and crtl C to close to both GUIs, needs
 testing

---
 .../d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp    | 7 +++++++
 pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp
index 9a2fadab..bfefa911 100755
--- a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp
+++ b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp
@@ -223,6 +223,13 @@ void MainGUIWindow::_init()
 
     ui->checkBox_vicon_highlight_markers->setEnabled(false);
 
+    // Add keyboard shortcuts
+    // > for "all motors off", press the space bar
+    ui->all_motors_off_button->setShortcut(tr("Space"));
+    // > for "kill GUI node", press "CTRL+C" while the GUI window is the focus
+    QShortcut* close_GUI_shortcut = new QShortcut(QKeySequence(tr("CTRL+C")), this, SLOT(close()));
+
+
     #ifdef CATKIN_MAKE
     _rosNodeThread->init();
     qRegisterMetaType<ptrToMessage>("ptrToMessage");
diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp
index f93c6358..1a2d5895 100644
--- a/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp
+++ b/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp
@@ -154,6 +154,13 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) :
     ui->error_label->setStyleSheet("QLabel { color : red; }");
     ui->error_label->clear();
 
+    // Add keyboard shortcuts
+    // > for "all motors off", press the space bar
+    ui->motors_OFF_button->setShortcut(tr("Space"));
+    // > for "kill GUI node", press "CTRL+C" while the GUI window is the focus
+    QShortcut* close_GUI_shortcut = new QShortcut(QKeySequence(tr("CTRL+C")), this, SLOT(close()));
+
+
     initialize_demo_setpoint();
     initialize_student_setpoint();
     initialize_mpc_setpoint();
-- 
GitLab