QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author koda
Wed, 18 Jan 2012 01:07:07 +0100
changeset 6584 5bb48450b978
parent 6583 4218782d8ca0
child 6700 e04da46ee43c
permissions -rw-r--r--
simplify qpushbuttonwithsound and add a mouseover sound (I tried selecting the least annoying ones, maybe it'd be better to look for proper button sound effects)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6572
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
     1
#include <QMessageBox>
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
     2
#include <QDir>
6584
5bb48450b978 simplify qpushbuttonwithsound and add a mouseover sound (I tried selecting the least annoying ones, maybe it'd be better to look for proper button sound effects)
koda
parents: 6583
diff changeset
     3
5bb48450b978 simplify qpushbuttonwithsound and add a mouseover sound (I tried selecting the least annoying ones, maybe it'd be better to look for proper button sound effects)
koda
parents: 6583
diff changeset
     4
#include "qpushbuttonwithsound.h"
5bb48450b978 simplify qpushbuttonwithsound and add a mouseover sound (I tried selecting the least annoying ones, maybe it'd be better to look for proper button sound effects)
koda
parents: 6583
diff changeset
     5
#include "HWDataManager.h"
5bb48450b978 simplify qpushbuttonwithsound and add a mouseover sound (I tried selecting the least annoying ones, maybe it'd be better to look for proper button sound effects)
koda
parents: 6583
diff changeset
     6
#include "SDLInteraction.h"
5bb48450b978 simplify qpushbuttonwithsound and add a mouseover sound (I tried selecting the least annoying ones, maybe it'd be better to look for proper button sound effects)
koda
parents: 6583
diff changeset
     7
#include "hwform.h"
5bb48450b978 simplify qpushbuttonwithsound and add a mouseover sound (I tried selecting the least annoying ones, maybe it'd be better to look for proper button sound effects)
koda
parents: 6583
diff changeset
     8
#include "gameuiconfig.h"
6572
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
     9
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    10
QPushButtonWithSound::QPushButtonWithSound(QWidget *parent) :
6583
4218782d8ca0 skip button sound when exiting
bovi
parents: 6572
diff changeset
    11
    QPushButton(parent),
4218782d8ca0 skip button sound when exiting
bovi
parents: 6572
diff changeset
    12
    isSoundEnabled(true)
6572
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    13
{
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    14
    connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()));
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    15
}
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    16
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    17
void QPushButtonWithSound::buttonClicked()
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    18
{
6583
4218782d8ca0 skip button sound when exiting
bovi
parents: 6572
diff changeset
    19
    if ( !isSoundEnabled || !HWForm::config->isFrontendSoundEnabled())
6572
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    20
        return;
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    21
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    22
    HWDataManager & dataMgr = HWDataManager::instance();
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    23
6584
5bb48450b978 simplify qpushbuttonwithsound and add a mouseover sound (I tried selecting the least annoying ones, maybe it'd be better to look for proper button sound effects)
koda
parents: 6583
diff changeset
    24
    if (this->isEnabled())
5bb48450b978 simplify qpushbuttonwithsound and add a mouseover sound (I tried selecting the least annoying ones, maybe it'd be better to look for proper button sound effects)
koda
parents: 6583
diff changeset
    25
        SDLInteraction::instance().playSoundFile(dataMgr.findFileForRead("Sounds/roperelease.ogg"));
6572
0d0af531c1c7 GCI task: ping
bovi
parents:
diff changeset
    26
}