QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author Xeli
Mon, 28 May 2012 19:33:57 +0200
changeset 7141 ea6ad9a97fca
parent 6930 d187ea93fc4f
child 7793 3c21da93db9f
permissions -rw-r--r--
change the array which represents the keyboard state to be a boolean array rather than byte array

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