QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author unc0rr
Sun, 27 May 2012 23:42:43 +0400
changeset 7130 fcab1fd02bc6
parent 6930 d187ea93fc4f
child 7793 3c21da93db9f
permissions -rw-r--r--
- Allow switching colors with mouse wheel - Use indices instead of color values - Introduce a model for colors - Some small fixes, .pro can be used to build again - Yay, tested it to work via network (and fixed a bug!) (TODO: pass colors to engine by index)

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