QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author sheepluva
Thu, 26 Apr 2012 09:48:52 +0200
changeset 6933 78d194a30520
parent 6930 d187ea93fc4f
child 7793 3c21da93db9f
permissions -rw-r--r--
mapContainer: use DataManager, reload maps after data update (e.g. by DLC)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6700
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     1
#include <QMessageBox>
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     2
#include <QDir>
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     3
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     4
#include "qpushbuttonwithsound.h"
6930
d187ea93fc4f renaming HWDataManager -> DataManager
sheepluva
parents: 6700
diff changeset
     5
#include "DataManager.h"
6700
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     6
#include "SDLInteraction.h"
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     7
#include "hwform.h"
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     8
#include "gameuiconfig.h"
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
     9
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    10
QPushButtonWithSound::QPushButtonWithSound(QWidget *parent) :
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    11
    QPushButton(parent),
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    12
    isSoundEnabled(true)
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    13
{
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    14
    connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()));
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    15
}
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    16
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    17
void QPushButtonWithSound::buttonClicked()
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    18
{
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    19
    if ( !isSoundEnabled || !HWForm::config->isFrontendSoundEnabled())
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    20
        return;
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    21
6930
d187ea93fc4f renaming HWDataManager -> DataManager
sheepluva
parents: 6700
diff changeset
    22
    DataManager & dataMgr = DataManager::instance();
6700
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    23
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    24
    if (this->isEnabled())
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    25
        SDLInteraction::instance().playSoundFile(dataMgr.findFileForRead("Sounds/roperelease.ogg"));
e04da46ee43c the most important commit of the year
koda
parents: 6584
diff changeset
    26
}