QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author unc0rr
Sat, 09 Jun 2012 17:05:16 +0400
changeset 7204 522f165cd2e7
parent 6930 d187ea93fc4f
child 7793 3c21da93db9f
permissions -rw-r--r--
- Fix damage calculation in TestSniperRifle, aim a bit lower to compensate initial angle shift in sniper rifle. As a result, AI seems to never fail sniper rifle shots. - Temporarily make AI tell its expectations in chat

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