implement sounds when blinds increases (ticket #83)
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -43,6 +43,7 @@
|
||||
|
||||
#include "configfile.h"
|
||||
#include "sdlplayer.h"
|
||||
#include "soundevents.h"
|
||||
#include "gametablestylereader.h"
|
||||
#include "carddeckstylereader.h"
|
||||
#include <gamedata.h>
|
||||
@@ -76,6 +77,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
|
||||
//Sound
|
||||
mySDLPlayer = new SDLPlayer(myConfig);
|
||||
mySoundEventHandler = new SoundEvents(myConfig, this);
|
||||
|
||||
// Init game table style
|
||||
myGameTableStyle = new GameTableStyleReader(myConfig, this);
|
||||
|
||||
@@ -50,6 +50,7 @@ class GameTableStyleReader;
|
||||
class CardDeckStyleReader;
|
||||
|
||||
class SDLPlayer;
|
||||
class SoundEvents;
|
||||
|
||||
enum SeatState { SEAT_UNDEFINED, SEAT_ACTIVE, SEAT_AUTOFOLD, SEAT_STAYONTABLE, SEAT_CLEAR };
|
||||
|
||||
@@ -63,9 +64,13 @@ public:
|
||||
~gameTableImpl();
|
||||
|
||||
boost::shared_ptr<Session> getSession();
|
||||
|
||||
SDLPlayer* getMySDLPlayer() const {
|
||||
return mySDLPlayer;
|
||||
}
|
||||
SoundEvents* getMySoundEventHandler() const{
|
||||
return mySoundEventHandler;
|
||||
}
|
||||
ChatTools* getMyChat() const {
|
||||
return myChat;
|
||||
}
|
||||
@@ -405,6 +410,7 @@ private:
|
||||
|
||||
//Sound
|
||||
SDLPlayer *mySDLPlayer;
|
||||
SoundEvents *mySoundEventHandler;
|
||||
QString myAppDataPath;
|
||||
|
||||
int distributePotAnimCounter;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "gametableimpl.h"
|
||||
#include "startwindowimpl.h"
|
||||
#include "configfile.h"
|
||||
#include "soundevents.h"
|
||||
#include <net/socket_msg.h>
|
||||
|
||||
|
||||
@@ -247,7 +248,9 @@ void GuiWrapper::logNewGameHandMsg(int gameID, int handID)
|
||||
}
|
||||
void GuiWrapper::logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName)
|
||||
{
|
||||
myW->getMySoundEventHandler()->blindsWereSet(sbSet);
|
||||
myGuiLog->signalLogNewBlindsSetsMsg(sbSet, bbSet, QString::fromUtf8(sbName.c_str()), QString::fromUtf8(bbName.c_str()));
|
||||
|
||||
}
|
||||
void GuiWrapper::logPlayerWinsMsg(std::string playerName, int pot, bool main)
|
||||
{
|
||||
|
||||
@@ -3349,13 +3349,7 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_5">
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_21">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="styleSheet">
|
||||
@@ -3513,8 +3507,11 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget_logFiles">
|
||||
<property name="sizePolicy">
|
||||
@@ -3543,7 +3540,7 @@ p, li { white-space: pre-wrap; }
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_37">
|
||||
<property name="text">
|
||||
@@ -3565,7 +3562,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="4" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_exportLogHtml">
|
||||
@@ -3615,9 +3612,6 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -3753,7 +3747,6 @@ p, li { white-space: pre-wrap; }
|
||||
<tabstop>comboBox_logInterval</tabstop>
|
||||
<tabstop>lineEdit_logDir</tabstop>
|
||||
<tabstop>pushButton_openLogDir</tabstop>
|
||||
<tabstop>treeWidget_logFiles</tabstop>
|
||||
<tabstop>pushButton_exportLogHtml</tabstop>
|
||||
<tabstop>pushButton_exportLogTxt</tabstop>
|
||||
<tabstop>pushButton_saveLogAs</tabstop>
|
||||
|
||||
@@ -1,8 +1,46 @@
|
||||
#include "sdlplayer.h"
|
||||
#include "configfile.h"
|
||||
#include "gametableimpl.h"
|
||||
#include "session.h"
|
||||
#include "game.h"
|
||||
#include "soundevents.h"
|
||||
|
||||
SoundEvents::SoundEvents(ConfigFile *c): myConfig(c)
|
||||
SoundEvents::SoundEvents(ConfigFile *c, gameTableImpl *w): myConfig(c), myW(w)
|
||||
{
|
||||
mySDLPlayer = new SDLPlayer(myConfig);
|
||||
}
|
||||
|
||||
SoundEvents::~SoundEvents()
|
||||
{
|
||||
mySDLPlayer->deleteLater();
|
||||
}
|
||||
|
||||
void SoundEvents::blindsWereSet(int sB)
|
||||
{
|
||||
int currentGameId = myW->getSession()->getCurrentGame()->getMyGameID();
|
||||
if(currentGameId != lastGameId)
|
||||
{
|
||||
lastSBLevel = 0;
|
||||
lastSBValue = sB;
|
||||
lastGameId = currentGameId;
|
||||
}
|
||||
|
||||
if(sB > lastSBValue) {
|
||||
|
||||
lastSBValue = sB;
|
||||
++lastSBLevel;
|
||||
|
||||
if(lastSBLevel == 1 || lastSBLevel == 2)
|
||||
{
|
||||
mySDLPlayer->playSound("blinds_raises_level1", 0);
|
||||
}
|
||||
if(lastSBLevel == 3 || lastSBLevel == 4)
|
||||
{
|
||||
mySDLPlayer->playSound("blinds_raises_level2", 0);
|
||||
}
|
||||
if(lastSBLevel >= 5)
|
||||
{
|
||||
mySDLPlayer->playSound("blinds_raises_level3", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,24 @@
|
||||
|
||||
class SDLPlayer;
|
||||
class ConfigFile;
|
||||
class gameTableImpl;
|
||||
class SoundEvents
|
||||
{
|
||||
public:
|
||||
SoundEvents(ConfigFile*);
|
||||
SoundEvents(ConfigFile*, gameTableImpl*);
|
||||
~SoundEvents();
|
||||
|
||||
void blindsWereSet(int sB);
|
||||
|
||||
|
||||
private:
|
||||
SDLPlayer *mySDLPlayer;
|
||||
gameTableImpl *myW;
|
||||
ConfigFile *myConfig;
|
||||
|
||||
unsigned int lastSBValue;
|
||||
unsigned int lastSBLevel;
|
||||
unsigned int lastGameId;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user