QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author unc0rr
Tue, 03 Apr 2012 17:53:33 +0400
changeset 6853 affeaba0af71
parent 6700 e04da46ee43c
child 6930 d187ea93fc4f
permissions -rw-r--r--
Fix withState' not returning lastType

#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"));
}