notification-sound for "its your turn" in online game

This commit is contained in:
doitux
2007-06-15 03:15:27 +00:00
parent e84c0cbfb8
commit 9b766c26c8
6 changed files with 29 additions and 7 deletions
+5 -2
View File
@@ -1535,7 +1535,10 @@ void mainWindowImpl::meInAction() {
void mainWindowImpl::startTimeoutAnimation(int playerId, int timeoutSec) { void mainWindowImpl::startTimeoutAnimation(int playerId, int timeoutSec) {
assert(playerId >= 0 && playerId < mySession->getCurrentGame()->getStartQuantityPlayers()); assert(playerId >= 0 && playerId < mySession->getCurrentGame()->getStartQuantityPlayers());
setLabelArray[playerId]->startTimeOutAnimation(timeoutSec);
//beep for player 0
if(playerId) { setLabelArray[playerId]->startTimeOutAnimation(timeoutSec, FALSE); }
else { setLabelArray[playerId]->startTimeOutAnimation(timeoutSec, TRUE); }
} }
void mainWindowImpl::stopTimeoutAnimation(int playerId) { void mainWindowImpl::stopTimeoutAnimation(int playerId) {
@@ -2549,7 +2552,7 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
if (event->key() == Qt::Key_F3) { pushButton_BetRaise->click(); } if (event->key() == Qt::Key_F3) { pushButton_BetRaise->click(); }
if (event->key() == Qt::Key_F10) { switchLeftToolBox(); } if (event->key() == Qt::Key_F10) { switchLeftToolBox(); }
if (event->key() == Qt::Key_F11) { switchRightToolBox(); } if (event->key() == Qt::Key_F11) { switchRightToolBox(); }
if (event->key() == Qt::Key_S) { setLabelArray[0]->startTimeOutAnimation(myConfig->readConfigInt("NetTimeOutPlayerAction")); } //s if (event->key() == Qt::Key_S) { setLabelArray[0]->startTimeOutAnimation(myConfig->readConfigInt("NetTimeOutPlayerAction"),TRUE); } //s
if (event->key() == 16777249) { if (event->key() == 16777249) {
pushButton_break->click(); pushButton_break->click();
ctrlPressed = TRUE; ctrlPressed = TRUE;
+4
View File
@@ -69,6 +69,8 @@ public:
void setLog(Log* l) { myLog = l; } void setLog(Log* l) { myLog = l; }
void setChat(Chat* c) { myChat = c; } void setChat(Chat* c) { myChat = c; }
SDLPlayer* getMySDLPlayer() const { return mySDLPlayer; }
void setSpeeds(); void setSpeeds();
signals: signals:
@@ -269,6 +271,8 @@ public slots:
void quitPokerTH(); void quitPokerTH();
private: private:
boost::shared_ptr<GuiInterface> myServerGuiInterface; boost::shared_ptr<GuiInterface> myServerGuiInterface;
+10 -2
View File
@@ -16,7 +16,7 @@
using namespace std; using namespace std;
MySetLabel::MySetLabel(QGroupBox* parent) MySetLabel::MySetLabel(QGroupBox* parent)
: QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0), waitFrames(0), timerIntervall(0) : QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0), waitFrames(0), timerIntervall(0), isBeep(0), isBeepPlayed(0)
{ {
timeOutAnimationTimer = new QTimer; timeOutAnimationTimer = new QTimer;
@@ -29,7 +29,10 @@ MySetLabel::~MySetLabel()
{ {
} }
void MySetLabel::startTimeOutAnimation(int secs) { void MySetLabel::startTimeOutAnimation(int secs, bool beep) {
isBeepPlayed = FALSE;
isBeep = beep;
timeOutValue = secs; timeOutValue = secs;
timeOutFrame = 1; timeOutFrame = 1;
@@ -80,6 +83,11 @@ void MySetLabel::nextTimeOutAnimationFrame() {
if(timeOutAnimationWidth >=0) { if(timeOutAnimationWidth >=0) {
if(timeOutFrame > waitFrames) { if(timeOutFrame > waitFrames) {
//play beep after waitFrames one time
if(!isBeepPlayed) {
myW->getMySDLPlayer()->playSound("yourturn",0);
isBeepPlayed = TRUE;
}
//save gfx ressources and never play more the 10 pps //save gfx ressources and never play more the 10 pps
unsigned int realTimerValue = realTimer.elapsed().total_milliseconds(); unsigned int realTimerValue = realTimer.elapsed().total_milliseconds();
timeOutAnimationWidth = 118-(((realTimerValue-3000)*118)/((timeOutValue-3)*1000)); timeOutAnimationWidth = 118-(((realTimerValue-3000)*118)/((timeOutValue-3)*1000));
+8 -2
View File
@@ -17,6 +17,7 @@
#include <QtGui> #include <QtGui>
#include <QtCore> #include <QtCore>
#include <core/boost/timer.hpp> #include <core/boost/timer.hpp>
#include "sdlplayer.h"
class mainWindowImpl; class mainWindowImpl;
@@ -31,12 +32,12 @@ public:
void setMyW ( mainWindowImpl* theValue ) { myW = theValue; } void setMyW ( mainWindowImpl* theValue ) { myW = theValue; }
void startTimeOutAnimation(int secs); void startTimeOutAnimation(int secs, bool beep);
void stopTimeOutAnimation(); void stopTimeOutAnimation();
void paintEvent(QPaintEvent * event); void paintEvent(QPaintEvent * event);
public slots: public slots:
void startTimeOutAnimationNow(); void startTimeOutAnimationNow();
void nextTimeOutAnimationFrame(); void nextTimeOutAnimationFrame();
@@ -48,6 +49,8 @@ private:
QTimer *timeOutAnimationTimer; QTimer *timeOutAnimationTimer;
QTimer *timeOutAnimationKickOnTimer; QTimer *timeOutAnimationKickOnTimer;
// boost::shared_ptr<SDLPlayer> mySDLPlayer;
boost::microsec_timer realTimer; boost::microsec_timer realTimer;
bool timeOutAnimation; bool timeOutAnimation;
@@ -58,6 +61,9 @@ private:
int waitFrames; int waitFrames;
int decreaseWidthIntervall; int decreaseWidthIntervall;
int timerIntervall; int timerIntervall;
bool isBeep;
bool isBeepPlayed;
}; };
+1
View File
@@ -132,6 +132,7 @@
<file>resources/sounds/allin.wav</file> <file>resources/sounds/allin.wav</file>
<file>resources/sounds/check.wav</file> <file>resources/sounds/check.wav</file>
<file>resources/sounds/fold.wav</file> <file>resources/sounds/fold.wav</file>
<file>resources/sounds/yourturn.wav</file>
</qresource> </qresource>
<qresource prefix="/translations" > <qresource prefix="/translations" >
<file>resources/translations/pokerth_de.qm</file> <file>resources/translations/pokerth_de.qm</file>
Binary file not shown.