equal
deleted
inserted
replaced
|
1 #include "qpushbuttonwithsound.h" |
|
2 #include <QMessageBox> |
|
3 #include <HWDataManager.h> |
|
4 #include <QDir> |
|
5 #include <SDLInteraction.h> |
|
6 #include <hwform.h> |
|
7 #include <QSettings> |
|
8 #include <gameuiconfig.h> |
|
9 |
|
10 QPushButtonWithSound::QPushButtonWithSound(QWidget *parent) : |
|
11 QPushButton(parent) |
|
12 { |
|
13 connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked())); |
|
14 } |
|
15 |
|
16 void QPushButtonWithSound::buttonClicked() |
|
17 { |
|
18 if (!HWForm::config->isFrontendSoundEnabled()) |
|
19 return; |
|
20 |
|
21 HWDataManager & dataMgr = HWDataManager::instance(); |
|
22 |
|
23 QString soundsDir = QString("Sounds/"); |
|
24 |
|
25 QStringList list = dataMgr.entryList( |
|
26 soundsDir, |
|
27 QDir::Files, |
|
28 QStringList() << |
|
29 "shotgunreload.ogg" |
|
30 ); |
|
31 if(!list.empty()) |
|
32 SDLInteraction::instance().playSoundFile(dataMgr.findFileForRead(soundsDir + "/" + list[0])); |
|
33 } |