QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author sheepluva
Wed, 25 Apr 2012 08:23:48 +0200
changeset 6928 9562ace15141
parent 6700 e04da46ee43c
child 6930 d187ea93fc4f
permissions -rw-r--r--
nemo said I was boring for removing the "hello" randomizer on room join. That was actually an accident, fixed by this commit. Now find an actual reason to call me boring (there are many to choose from :P) nemo!
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
}