QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author nemo
Sat, 10 Mar 2012 16:10:38 -0500
changeset 6762 85ba0c55d077
parent 6700 e04da46ee43c
child 6930 d187ea93fc4f
permissions -rw-r--r--
Set default empty ammo sets. Current mission handling appears to not pass any default ammo set, so script was never getting a chance to set its own.

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