QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author belphegorr <szabibibi@gmail.com>
Tue, 10 Jul 2012 23:06:56 +0300
changeset 7251 cba4960b426f
parent 6930 d187ea93fc4f
child 7793 3c21da93db9f
permissions -rw-r--r--
Fixed a bug where certain ammo types were added to the wrong hogs.

#include <QMessageBox>
#include <QDir>

#include "qpushbuttonwithsound.h"
#include "DataManager.h"
#include "SDLInteraction.h"
#include "hwform.h"
#include "gameuiconfig.h"

QPushButtonWithSound::QPushButtonWithSound(QWidget *parent) :
    QPushButton(parent),
    isSoundEnabled(true)
{
    connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()));
}

void QPushButtonWithSound::buttonClicked()
{
    if ( !isSoundEnabled || !HWForm::config->isFrontendSoundEnabled())
        return;

    DataManager & dataMgr = DataManager::instance();

    if (this->isEnabled())
        SDLInteraction::instance().playSoundFile(dataMgr.findFileForRead("Sounds/roperelease.ogg"));
}