QTfrontend/ui/mouseoverfilter.cpp
changeset 6584 5bb48450b978
parent 6477 ad5741c252b9
child 6616 f77bb02b669f
--- a/QTfrontend/ui/mouseoverfilter.cpp	Tue Jan 17 23:42:30 2012 +0100
+++ b/QTfrontend/ui/mouseoverfilter.cpp	Wed Jan 18 01:07:07 2012 +0100
@@ -1,11 +1,18 @@
-#include "mouseoverfilter.h"
-#include "ui/page/AbstractPage.h"
-#include "ui_hwform.h"
 
 #include <QEvent>
 #include <QWidget>
 #include <QStackedLayout>
 #include <QLabel>
+#include <QLineEdit>
+#include <QCheckBox>
+
+#include "mouseoverfilter.h"
+#include "ui/page/AbstractPage.h"
+#include "ui_hwform.h"
+#include "hwform.h"
+#include "gameuiconfig.h"
+#include "HWDataManager.h"
+#include "SDLInteraction.h"
 
 MouseOverFilter::MouseOverFilter(QObject *parent) :
     QObject(parent)
@@ -25,6 +32,18 @@
         else if (widget->toolTip() != NULL)
             abstractpage->setButtonDescription(widget->toolTip());
 
+        // play a sound when mouse hovers certain ui elements
+        QPushButton * button = dynamic_cast<QPushButton*>(dist);
+        QLineEdit * textfield = dynamic_cast<QLineEdit*>(dist);
+        QCheckBox * checkbox = dynamic_cast<QCheckBox*>(dist);
+        QComboBox * droplist = dynamic_cast<QComboBox*>(dist);
+        QSlider * slider = dynamic_cast<QSlider*>(dist);
+        QTabWidget * tab = dynamic_cast<QTabWidget*>(dist);
+        if (HWForm::config->isFrontendSoundEnabled() && (button || textfield || checkbox || droplist || slider || tab)) {
+            HWDataManager & dataMgr = HWDataManager::instance();
+            SDLInteraction::instance().playSoundFile(dataMgr.findFileForRead("Sounds/steps.ogg"));
+        }
+
         return true;
     }
     else if (event->type() == QEvent::Leave)