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 "configfile.h"
|
||||||
#include "sdlplayer.h"
|
#include "sdlplayer.h"
|
||||||
|
#include "soundevents.h"
|
||||||
#include "gametablestylereader.h"
|
#include "gametablestylereader.h"
|
||||||
#include "carddeckstylereader.h"
|
#include "carddeckstylereader.h"
|
||||||
#include <gamedata.h>
|
#include <gamedata.h>
|
||||||
@@ -76,6 +77,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
|
|
||||||
//Sound
|
//Sound
|
||||||
mySDLPlayer = new SDLPlayer(myConfig);
|
mySDLPlayer = new SDLPlayer(myConfig);
|
||||||
|
mySoundEventHandler = new SoundEvents(myConfig, this);
|
||||||
|
|
||||||
// Init game table style
|
// Init game table style
|
||||||
myGameTableStyle = new GameTableStyleReader(myConfig, this);
|
myGameTableStyle = new GameTableStyleReader(myConfig, this);
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class GameTableStyleReader;
|
|||||||
class CardDeckStyleReader;
|
class CardDeckStyleReader;
|
||||||
|
|
||||||
class SDLPlayer;
|
class SDLPlayer;
|
||||||
|
class SoundEvents;
|
||||||
|
|
||||||
enum SeatState { SEAT_UNDEFINED, SEAT_ACTIVE, SEAT_AUTOFOLD, SEAT_STAYONTABLE, SEAT_CLEAR };
|
enum SeatState { SEAT_UNDEFINED, SEAT_ACTIVE, SEAT_AUTOFOLD, SEAT_STAYONTABLE, SEAT_CLEAR };
|
||||||
|
|
||||||
@@ -63,9 +64,13 @@ public:
|
|||||||
~gameTableImpl();
|
~gameTableImpl();
|
||||||
|
|
||||||
boost::shared_ptr<Session> getSession();
|
boost::shared_ptr<Session> getSession();
|
||||||
|
|
||||||
SDLPlayer* getMySDLPlayer() const {
|
SDLPlayer* getMySDLPlayer() const {
|
||||||
return mySDLPlayer;
|
return mySDLPlayer;
|
||||||
}
|
}
|
||||||
|
SoundEvents* getMySoundEventHandler() const{
|
||||||
|
return mySoundEventHandler;
|
||||||
|
}
|
||||||
ChatTools* getMyChat() const {
|
ChatTools* getMyChat() const {
|
||||||
return myChat;
|
return myChat;
|
||||||
}
|
}
|
||||||
@@ -405,6 +410,7 @@ private:
|
|||||||
|
|
||||||
//Sound
|
//Sound
|
||||||
SDLPlayer *mySDLPlayer;
|
SDLPlayer *mySDLPlayer;
|
||||||
|
SoundEvents *mySoundEventHandler;
|
||||||
QString myAppDataPath;
|
QString myAppDataPath;
|
||||||
|
|
||||||
int distributePotAnimCounter;
|
int distributePotAnimCounter;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "gametableimpl.h"
|
#include "gametableimpl.h"
|
||||||
#include "startwindowimpl.h"
|
#include "startwindowimpl.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
|
#include "soundevents.h"
|
||||||
#include <net/socket_msg.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)
|
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()));
|
myGuiLog->signalLogNewBlindsSetsMsg(sbSet, bbSet, QString::fromUtf8(sbName.c_str()), QString::fromUtf8(bbName.c_str()));
|
||||||
|
|
||||||
}
|
}
|
||||||
void GuiWrapper::logPlayerWinsMsg(std::string playerName, int pot, bool main)
|
void GuiWrapper::logPlayerWinsMsg(std::string playerName, int pot, bool main)
|
||||||
{
|
{
|
||||||
|
|||||||
+101
-108
@@ -3349,13 +3349,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_5">
|
<widget class="QWidget" name="page_5">
|
||||||
<layout class="QGridLayout">
|
<layout class="QGridLayout" name="gridLayout_21">
|
||||||
<property name="margin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
@@ -3513,109 +3507,109 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
|
||||||
<item>
|
|
||||||
<widget class="QTreeWidget" name="treeWidget_logFiles">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="indentation">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="rootIsDecorated">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="allColumnsShowFocus">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Log File</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_37">
|
|
||||||
<property name="text">
|
|
||||||
<string>Preview:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTextBrowser" name="textBrowser_logPreview">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_exportLogHtml">
|
|
||||||
<property name="text">
|
|
||||||
<string>Export as HTML</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="resources/pokerth.qrc">
|
|
||||||
<normaloff>:/gfx/text-html.png</normaloff>:/gfx/text-html.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_exportLogTxt">
|
|
||||||
<property name="text">
|
|
||||||
<string>Export as txt</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="resources/pokerth.qrc">
|
|
||||||
<normaloff>:/gfx/text-plain.png</normaloff>:/gfx/text-plain.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_saveLogAs">
|
|
||||||
<property name="text">
|
|
||||||
<string>Save as ...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="resources/pokerth.qrc">
|
|
||||||
<normaloff>:/gfx/filesave.png</normaloff>:/gfx/filesave.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_deleteLog">
|
|
||||||
<property name="text">
|
|
||||||
<string>Delete</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="resources/pokerth.qrc">
|
|
||||||
<normaloff>:/gfx/editdelete.png</normaloff>:/gfx/editdelete.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="treeWidget_logFiles">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="indentation">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rootIsDecorated">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="allColumnsShowFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Log File</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_37">
|
||||||
|
<property name="text">
|
||||||
|
<string>Preview:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextBrowser" name="textBrowser_logPreview">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_exportLogHtml">
|
||||||
|
<property name="text">
|
||||||
|
<string>Export as HTML</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources/pokerth.qrc">
|
||||||
|
<normaloff>:/gfx/text-html.png</normaloff>:/gfx/text-html.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_exportLogTxt">
|
||||||
|
<property name="text">
|
||||||
|
<string>Export as txt</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources/pokerth.qrc">
|
||||||
|
<normaloff>:/gfx/text-plain.png</normaloff>:/gfx/text-plain.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_saveLogAs">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save as ...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources/pokerth.qrc">
|
||||||
|
<normaloff>:/gfx/filesave.png</normaloff>:/gfx/filesave.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_deleteLog">
|
||||||
|
<property name="text">
|
||||||
|
<string>Delete</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources/pokerth.qrc">
|
||||||
|
<normaloff>:/gfx/editdelete.png</normaloff>:/gfx/editdelete.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -3753,7 +3747,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
<tabstop>comboBox_logInterval</tabstop>
|
<tabstop>comboBox_logInterval</tabstop>
|
||||||
<tabstop>lineEdit_logDir</tabstop>
|
<tabstop>lineEdit_logDir</tabstop>
|
||||||
<tabstop>pushButton_openLogDir</tabstop>
|
<tabstop>pushButton_openLogDir</tabstop>
|
||||||
<tabstop>treeWidget_logFiles</tabstop>
|
|
||||||
<tabstop>pushButton_exportLogHtml</tabstop>
|
<tabstop>pushButton_exportLogHtml</tabstop>
|
||||||
<tabstop>pushButton_exportLogTxt</tabstop>
|
<tabstop>pushButton_exportLogTxt</tabstop>
|
||||||
<tabstop>pushButton_saveLogAs</tabstop>
|
<tabstop>pushButton_saveLogAs</tabstop>
|
||||||
|
|||||||
@@ -1,8 +1,46 @@
|
|||||||
#include "sdlplayer.h"
|
#include "sdlplayer.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
|
#include "gametableimpl.h"
|
||||||
|
#include "session.h"
|
||||||
|
#include "game.h"
|
||||||
#include "soundevents.h"
|
#include "soundevents.h"
|
||||||
|
|
||||||
SoundEvents::SoundEvents(ConfigFile *c): myConfig(c)
|
SoundEvents::SoundEvents(ConfigFile *c, gameTableImpl *w): myConfig(c), myW(w)
|
||||||
{
|
{
|
||||||
mySDLPlayer = new SDLPlayer(myConfig);
|
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 SDLPlayer;
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
|
class gameTableImpl;
|
||||||
class SoundEvents
|
class SoundEvents
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SoundEvents(ConfigFile*);
|
SoundEvents(ConfigFile*, gameTableImpl*);
|
||||||
|
~SoundEvents();
|
||||||
|
|
||||||
|
void blindsWereSet(int sB);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDLPlayer *mySDLPlayer;
|
SDLPlayer *mySDLPlayer;
|
||||||
|
gameTableImpl *myW;
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
|
|
||||||
|
unsigned int lastSBValue;
|
||||||
|
unsigned int lastSBLevel;
|
||||||
|
unsigned int lastGameId;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user