QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author unc0rr
Tue, 03 Apr 2012 17:53:33 +0400
changeset 6853 affeaba0af71
parent 6700 e04da46ee43c
child 6930 d187ea93fc4f
permissions -rw-r--r--
Fix withState' not returning lastType
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6700
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     1
#include <QMessageBox>
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     2
#include <QDir>
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     3
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     4
#include "qpushbuttonwithsound.h"
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     5
#include "HWDataManager.h"
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     6
#include "SDLInteraction.h"
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     7
#include "hwform.h"
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     8
#include "gameuiconfig.h"
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     9
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    10
QPushButtonWithSound::QPushButtonWithSound(QWidget *parent) :
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    11
    QPushButton(parent),
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    12
    isSoundEnabled(true)
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    13
{
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    14
    connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()));
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    15
}
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    16
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    17
void QPushButtonWithSound::buttonClicked()
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    18
{
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    19
    if ( !isSoundEnabled || !HWForm::config->isFrontendSoundEnabled())
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    20
        return;
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    21
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    22
    HWDataManager & dataMgr = HWDataManager::instance();
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    23
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    24
    if (this->isEnabled())
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    25
        SDLInteraction::instance().playSoundFile(dataMgr.findFileForRead("Sounds/roperelease.ogg"));
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    26
}