QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author sheepluva
Mon, 30 Apr 2012 23:14:40 +0200
changeset 6968 23722ba0f89a
parent 6930 d187ea93fc4f
child 7793 3c21da93db9f
permissions -rw-r--r--
Qt: fix issue with hog count being not visible on low resolutions/long team names and hard to read on very high resolutions

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