QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author belphegorr <szabibibi@gmail.com>
Mon, 25 Jun 2012 10:46:48 +0300
changeset 7201 dc17ffdf0702
parent 6930 d187ea93fc4f
child 7793 3c21da93db9f
permissions -rw-r--r--
The first campaign commit with a lot of changes... branch 'default' added QTfrontend/campaign.cpp added QTfrontend/campaign.h changed QTfrontend/CMakeLists.txt changed QTfrontend/game.cpp changed QTfrontend/game.h changed QTfrontend/hwform.cpp changed QTfrontend/hwform.h changed QTfrontend/ui/page/pagecampaign.cpp changed QTfrontend/ui/page/pagecampaign.h changed QTfrontend/ui/page/pagesingleplayer.cpp changed hedgewars/uCommandHandlers.pas changed hedgewars/uIO.pas changed hedgewars/uScript.pas changed hedgewars/uVariables.pas
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
}