QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author Xeli
Sun, 22 Jan 2012 23:36:36 +0100
changeset 6589 2fa0a274a1e3
parent 6584 5bb48450b978
child 6700 e04da46ee43c
permissions -rw-r--r--
some tweaks to the build process, cmake now generates some vital files, fpc only compiles those files which have been changed since the last time, SDL still does not work

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