diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 5af25fe3..f9612d43 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -2523,7 +2523,7 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) { if (event->key() == Qt::Key_F3) { pushButton_BetRaise->click(); } if (event->key() == Qt::Key_F10) { switchLeftToolBox(); } if (event->key() == Qt::Key_F11) { switchRightToolBox(); } - if (event->key() == Qt::Key_S) {} //s + if (event->key() == Qt::Key_S) { setLabelArray[0]->startTimeOutAnimation(myConfig->readConfigInt("NetTimeOutPlayerAction")); } //s if (event->key() == 16777249) { pushButton_break->click(); ctrlPressed = TRUE; diff --git a/src/gui/qt/mainwindow/mysetlabel.cpp b/src/gui/qt/mainwindow/mysetlabel.cpp index 13b91dd0..d68312d9 100644 --- a/src/gui/qt/mainwindow/mysetlabel.cpp +++ b/src/gui/qt/mainwindow/mysetlabel.cpp @@ -16,17 +16,12 @@ using namespace std; MySetLabel::MySetLabel(QGroupBox* parent) - : QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0) + : QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0), waitFrames(0), decreaseWidthIntervall(1), timerIntervall(0) { timeOutAnimationTimer = new QTimer; - timeOutAnimationKickOnTimer = new QTimer; - timeOutAnimationKickOnTimer->setSingleShot(TRUE); - connect(timeOutAnimationKickOnTimer, SIGNAL(timeout()), this, SLOT(startTimeOutAnimationNow())); connect(timeOutAnimationTimer, SIGNAL(timeout()), this, SLOT(nextTimeOutAnimationFrame())); -// flipCardsTimer = new QTimer; -// connect(flipCardsTimer, SIGNAL(timeout()), this, SLOT(nextFlipCardsFrame())); } @@ -36,11 +31,34 @@ MySetLabel::~MySetLabel() void MySetLabel::startTimeOutAnimation(int secs) { - timeOutValue = secs-3; + + decreaseWidthIntervall = 1; + + timeOutValue = secs; timeOutFrame = 1; timeOutAnimationWidth = 118; - timeOutAnimationKickOnTimer->start(3000); + int preTimerIntervall = ((timeOutValue-3) * 1000)/timeOutAnimationWidth; + + timerIntervall = preTimerIntervall; + + //save gfx ressources and never play more the 10 pps + while(timerIntervall < 100) { + if(secs <= 9 && secs >= 6) { + //fix inaccuracies caused by integer division + timerIntervall = timerIntervall + preTimerIntervall + 5; + } + else { + timerIntervall = timerIntervall + preTimerIntervall; + } + decreaseWidthIntervall++; + } + + waitFrames = 3000/timerIntervall; + + std::cout << timerIntervall << endl; + timeOutAnimation = TRUE; + timeOutAnimationTimer->start(timerIntervall); } void MySetLabel::startTimeOutAnimationNow() { @@ -52,7 +70,7 @@ void MySetLabel::startTimeOutAnimationNow() { void MySetLabel::stopTimeOutAnimation() { - timeOutAnimationKickOnTimer->stop(); +// timeOutAnimationKickOnTimer->stop(); timeOutAnimationTimer->stop(); timeOutAnimation = FALSE; update(); @@ -61,8 +79,10 @@ void MySetLabel::stopTimeOutAnimation() { void MySetLabel::nextTimeOutAnimationFrame() { if(timeOutAnimationWidth >=0) { - if(timeOutFrame%(timeOutValue*12/118) == 0) - timeOutAnimationWidth--; + if(timeOutFrame > waitFrames) { + //save gfx ressources and never play more the 10 pps + timeOutAnimationWidth = timeOutAnimationWidth - decreaseWidthIntervall; + } timeOutFrame++; update(); } @@ -76,11 +96,11 @@ void MySetLabel::nextTimeOutAnimationFrame() { void MySetLabel::paintEvent(QPaintEvent * event) { - if(!timeOutAnimation) { + if(!timeOutAnimation || timeOutFrame <= waitFrames) { QLabel::paintEvent(event); } - if(timeOutAnimation) { + if(timeOutAnimation && timeOutFrame > waitFrames) { QPainter painter(this); @@ -92,6 +112,6 @@ void MySetLabel::paintEvent(QPaintEvent * event) { painter.setBrush(linearGrad); painter.setPen(QColor(0,0,0)); - painter.drawRect(0,6,timeOutAnimationWidth,8); + painter.drawRect(0,6,timeOutAnimationWidth-1,8); } } diff --git a/src/gui/qt/mainwindow/mysetlabel.h b/src/gui/qt/mainwindow/mysetlabel.h index 98ec3aa9..9f7e5cc2 100644 --- a/src/gui/qt/mainwindow/mysetlabel.h +++ b/src/gui/qt/mainwindow/mysetlabel.h @@ -12,6 +12,8 @@ #ifndef MYSETLABEL_H #define MYSETLABEL_H +#include + #include #include @@ -50,6 +52,10 @@ private: int timeOutAnimationWidth; int timeOutValue; int timeOutFrame; + int waitFrames; + int decreaseWidthIntervall; + int timerIntervall; + }; #endif diff --git a/src/gui/qt/resources.qrc b/src/gui/qt/resources.qrc index ce6b8dd2..187afb67 100755 --- a/src/gui/qt/resources.qrc +++ b/src/gui/qt/resources.qrc @@ -125,6 +125,10 @@ resources/sounds/call.wav resources/sounds/dealtwocards.wav resources/sounds/raise.wav + resources/sounds/bet.wav + resources/sounds/allin.wav + resources/sounds/check.wav + resources/sounds/fold.wav resources/translations/pokerth_de.qm diff --git a/src/gui/qt/resources/sounds/allin.wav b/src/gui/qt/resources/sounds/allin.wav new file mode 100644 index 00000000..8123eccc Binary files /dev/null and b/src/gui/qt/resources/sounds/allin.wav differ diff --git a/src/gui/qt/resources/sounds/bet.wav b/src/gui/qt/resources/sounds/bet.wav new file mode 100644 index 00000000..8123eccc Binary files /dev/null and b/src/gui/qt/resources/sounds/bet.wav differ diff --git a/src/gui/qt/resources/sounds/check.wav b/src/gui/qt/resources/sounds/check.wav new file mode 100644 index 00000000..bea58cc6 Binary files /dev/null and b/src/gui/qt/resources/sounds/check.wav differ diff --git a/src/gui/qt/resources/sounds/fold.wav b/src/gui/qt/resources/sounds/fold.wav new file mode 100644 index 00000000..47a6883b Binary files /dev/null and b/src/gui/qt/resources/sounds/fold.wav differ