QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author koda
Sun, 05 Feb 2012 15:52:26 +0100
changeset 6624 e049b5bb0ad1
parent 6584 5bb48450b978
child 6700 e04da46ee43c
permissions -rw-r--r--
BUUUUURN OBJC AMMOMENU BUUUURNhg diff! (on a separate note, this reduces the codesize by ~37k)

#include <QMessageBox>
#include <QDir>

#include "qpushbuttonwithsound.h"
#include "HWDataManager.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;

    HWDataManager & dataMgr = HWDataManager::instance();

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