QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author koda
Sat, 18 Feb 2012 19:33:04 +0100
changeset 6713 3a02e9c25ac5
parent 6700 e04da46ee43c
child 6930 d187ea93fc4f
permissions -rw-r--r--
this apparently didn't get updated, but it was enough to reassign the outlets

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