QTfrontend/ui/mouseoverfilter.cpp
changeset 6584 5bb48450b978
parent 6477 ad5741c252b9
child 6616 f77bb02b669f
equal deleted inserted replaced
6583:4218782d8ca0 6584:5bb48450b978
     1 #include "mouseoverfilter.h"
       
     2 #include "ui/page/AbstractPage.h"
       
     3 #include "ui_hwform.h"
       
     4 
     1 
     5 #include <QEvent>
     2 #include <QEvent>
     6 #include <QWidget>
     3 #include <QWidget>
     7 #include <QStackedLayout>
     4 #include <QStackedLayout>
     8 #include <QLabel>
     5 #include <QLabel>
       
     6 #include <QLineEdit>
       
     7 #include <QCheckBox>
       
     8 
       
     9 #include "mouseoverfilter.h"
       
    10 #include "ui/page/AbstractPage.h"
       
    11 #include "ui_hwform.h"
       
    12 #include "hwform.h"
       
    13 #include "gameuiconfig.h"
       
    14 #include "HWDataManager.h"
       
    15 #include "SDLInteraction.h"
     9 
    16 
    10 MouseOverFilter::MouseOverFilter(QObject *parent) :
    17 MouseOverFilter::MouseOverFilter(QObject *parent) :
    11     QObject(parent)
    18     QObject(parent)
    12 {
    19 {
    13 }
    20 }
    22 
    29 
    23         if (widget->whatsThis() != NULL)
    30         if (widget->whatsThis() != NULL)
    24             abstractpage->setButtonDescription(widget->whatsThis());
    31             abstractpage->setButtonDescription(widget->whatsThis());
    25         else if (widget->toolTip() != NULL)
    32         else if (widget->toolTip() != NULL)
    26             abstractpage->setButtonDescription(widget->toolTip());
    33             abstractpage->setButtonDescription(widget->toolTip());
       
    34 
       
    35         // play a sound when mouse hovers certain ui elements
       
    36         QPushButton * button = dynamic_cast<QPushButton*>(dist);
       
    37         QLineEdit * textfield = dynamic_cast<QLineEdit*>(dist);
       
    38         QCheckBox * checkbox = dynamic_cast<QCheckBox*>(dist);
       
    39         QComboBox * droplist = dynamic_cast<QComboBox*>(dist);
       
    40         QSlider * slider = dynamic_cast<QSlider*>(dist);
       
    41         QTabWidget * tab = dynamic_cast<QTabWidget*>(dist);
       
    42         if (HWForm::config->isFrontendSoundEnabled() && (button || textfield || checkbox || droplist || slider || tab)) {
       
    43             HWDataManager & dataMgr = HWDataManager::instance();
       
    44             SDLInteraction::instance().playSoundFile(dataMgr.findFileForRead("Sounds/steps.ogg"));
       
    45         }
    27 
    46 
    28         return true;
    47         return true;
    29     }
    48     }
    30     else if (event->type() == QEvent::Leave)
    49     else if (event->type() == QEvent::Leave)
    31     {
    50     {