diff -r da5cfded818b -r 0d0af531c1c7 QTfrontend/ui/widget/qpushbuttonwithsound.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/qpushbuttonwithsound.cpp Sun Jan 15 22:57:49 2012 +0100 @@ -0,0 +1,33 @@ +#include "qpushbuttonwithsound.h" +#include +#include +#include +#include +#include +#include +#include + +QPushButtonWithSound::QPushButtonWithSound(QWidget *parent) : + QPushButton(parent) +{ + connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked())); +} + +void QPushButtonWithSound::buttonClicked() +{ + if (!HWForm::config->isFrontendSoundEnabled()) + return; + + HWDataManager & dataMgr = HWDataManager::instance(); + + QString soundsDir = QString("Sounds/"); + + QStringList list = dataMgr.entryList( + soundsDir, + QDir::Files, + QStringList() << + "shotgunreload.ogg" + ); + if(!list.empty()) + SDLInteraction::instance().playSoundFile(dataMgr.findFileForRead(soundsDir + "/" + list[0])); +}