QTfrontend/ui/widget/qpushbuttonwithsound.cpp
author nemo
Wed, 08 Aug 2012 20:32:27 -0400
changeset 7523 0790527b4e00
parent 6930 d187ea93fc4f
child 7793 3c21da93db9f
permissions -rw-r--r--
When exiting a room where one was host, server sends a REMOVE_TEAM for the local team. It appears that this loop would not break in that case. Add a log message and a break. (I've hit a frozen frontend twice now)
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
}