QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author unc0rr
Wed, 10 Oct 2012 23:55:09 +0400
changeset 7742 e5e529dcc9bb
parent 6930 d187ea93fc4f
child 7793 3c21da93db9f
permissions -rw-r--r--
- Finish conversion to nicks model - Remove unneeded header includes in chatwidget.cpp

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