From e49badc027dbc16eb509766bb764cc31d33199e0 Mon Sep 17 00:00:00 2001
From: Paul Beuchat <beuchatp@control.ee.ethz.ch>
Date: Fri, 29 Nov 2019 09:54:04 +0100
Subject: [PATCH] Added placeholder code for how to add a sound effect when the
 controller is changed

---
 .../src/dfall_pkg/GUI_Qt/flyingAgentGUI/flyingAgentGUI.pro | 2 ++
 .../GUI_Qt/flyingAgentGUI/include/controllertabs.h         | 4 ++++
 .../dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp | 7 +++++++
 install/dfall_install_ros_kinetic_ubuntu16.sh              | 7 +++++++
 install/dfall_install_ros_melodic_ubuntu18.sh              | 7 +++++++
 5 files changed, 27 insertions(+)

diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/flyingAgentGUI.pro b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/flyingAgentGUI.pro
index c7e2f5ac..78fdb9b5 100644
--- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/flyingAgentGUI.pro
+++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/flyingAgentGUI.pro
@@ -12,6 +12,8 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
 greaterThan(QT_MAJOR_VERSION, 4): QT += charts
 
+#greaterThan(QT_MAJOR_VERSION, 4): QT += multimedia
+
 TARGET = flyingAgentGUI
 TEMPLATE = app
 
diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllertabs.h b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllertabs.h
index 41af9a3b..772a6807 100644
--- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllertabs.h
+++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/controllertabs.h
@@ -40,6 +40,7 @@
 #include <QWidget>
 #include <QMutex>
 #include <QVector>
+//#include <QSoundEffect>
 
 #ifdef CATKIN_MAKE
 #include <ros/ros.h>
@@ -141,6 +142,9 @@ private:
     QColor m_tab_text_colour_normal;
     QColor m_tab_text_colour_highlight;
 
+    // Sound effect for when the controller changes while flying
+    //QSoundEffect m_soundEffect_controllerChanged;
+
 
 #ifdef CATKIN_MAKE
     // --------------------------------------------------- //
diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp
index 2df07eab..617745e2 100644
--- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp
+++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp
@@ -48,6 +48,13 @@ ControllerTabs::ControllerTabs(QWidget *parent) :
     m_tab_text_colour_normal = Qt::black;
     m_tab_text_colour_highlight = QColor(0,200,0);
 
+    // Initialise the sound effect for when the controller changes while flying
+    //QSoundEffect m_soundEffect_controllerChanged;
+    //m_soundEffect_controllerChanged.setSource(QUrl::fromLocalFile("engine.wav"));
+    //m_soundEffect_controllerChanged.setLoopCount(1);
+    //m_soundEffect_controllerChanged.setVolume(0.25f);
+    //m_soundEffect_controllerChanged.play();
+
 
     // Initialise the object name as blank
     m_object_name_for_emitting_pose_data = "";
diff --git a/install/dfall_install_ros_kinetic_ubuntu16.sh b/install/dfall_install_ros_kinetic_ubuntu16.sh
index ecc29b27..ae1f9471 100755
--- a/install/dfall_install_ros_kinetic_ubuntu16.sh
+++ b/install/dfall_install_ros_kinetic_ubuntu16.sh
@@ -88,6 +88,13 @@ sudo apt -y install qt5-default
 # Install the development version of the Qt5svg library
 sudo apt -y install libqt5svg5-dev
 
+# Install the charting library
+sudo apt install libqt5charts5-dev
+
+# Install the multimedia library (used for sound effects)
+sudo apt install libqt5multimedia5
+sudo apt install qtmultimedia5-dev
+
 # Install the "Qt Creator" IDE
 # > NOTE: this is not necessary to compile and run the dfall ROS package,
 #         but it is required to edit the GUIs
diff --git a/install/dfall_install_ros_melodic_ubuntu18.sh b/install/dfall_install_ros_melodic_ubuntu18.sh
index abcfc1df..982da3ce 100755
--- a/install/dfall_install_ros_melodic_ubuntu18.sh
+++ b/install/dfall_install_ros_melodic_ubuntu18.sh
@@ -88,6 +88,13 @@ sudo apt -y install qt5-default
 # Install the development version of the Qt5svg library
 sudo apt -y install libqt5svg5-dev
 
+# Install the charting library
+sudo apt install libqt5charts5-dev
+
+# Install the multimedia library (used for sound effects)
+sudo apt install libqt5multimedia5
+sudo apt install qtmultimedia5-dev
+
 # Install the "Qt Creator" IDE
 # > NOTE: this is not necessary to compile and run the dfall ROS package,
 #         but it is required to edit the GUIs
-- 
GitLab