QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author sheepluva
Sat, 28 Apr 2012 11:56:09 +0200
changeset 6947 1be3e48e1d53
parent 6930 d187ea93fc4f
child 7793 3c21da93db9f
permissions -rw-r--r--
MapModel: add getters for random maps based on type, so that the mapContainer does not have to magically know how maps and separators are ordered within the model

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