add timeoutanimation for network player actions

This commit is contained in:
doitux
2007-05-29 21:31:30 +00:00
parent ccb339be04
commit ba82acbd06
6 changed files with 565 additions and 428 deletions
+3 -1
View File
@@ -32,6 +32,7 @@
#include "startsplash.h"
#include "mycardspixmaplabel.h"
#include "mysetlabel.h"
#include "playerinterface.h"
#include "boardinterface.h"
@@ -2502,7 +2503,8 @@ 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_F) { switchFullscreen(); } //f
if (event->key() == Qt::Key_D) { setLabelArray[0]->startTimeOutAnimation(10); } //f
if (event->key() == Qt::Key_E) { setLabelArray[0]->stopTimeOutAnimation(); } //f
if (event->key() == Qt::Key_S) { playSound(); } //s
if (event->key() == 16777249) {
pushButton_break->click();
+1 -1
View File
@@ -329,7 +329,7 @@ private:
QLabel *buttonLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *cashLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *cashTopLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *setLabelArray[MAX_NUMBER_OF_PLAYERS];
MySetLabel *setLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *actionLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *playerAvatarLabelArray[MAX_NUMBER_OF_PLAYERS];
+81
View File
@@ -0,0 +1,81 @@
//
// C++ Implementation: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "mysetlabel.h"
// using namespace std;
MySetLabel::MySetLabel(QGroupBox* parent)
: QLabel(parent), timeOutAnimation(FALSE), timeOutValue(0), timeOutFrame(0)
{
timeOutAnimationTimer = new QTimer;
connect(timeOutAnimationTimer, SIGNAL(timeout()), this, SLOT(nextTimeOutAnimationFrame()));
// flipCardsTimer = new QTimer;
// connect(flipCardsTimer, SIGNAL(timeout()), this, SLOT(nextFlipCardsFrame()));
}
MySetLabel::~MySetLabel()
{
}
void MySetLabel::startTimeOutAnimation(int secs) {
timeOutValue = secs;
timeOutFrame = 1;
timeOutAnimationWidth = 118;
timeOutAnimation = TRUE;
timeOutAnimationTimer->start(40);
}
void MySetLabel::stopTimeOutAnimation() {
timeOutAnimationTimer->stop();
timeOutAnimation = FALSE;
update();
}
void MySetLabel::nextTimeOutAnimationFrame() {
if(timeOutAnimationWidth >=0) {
if(timeOutFrame%(timeOutValue*25/118) == 0)
timeOutAnimationWidth--;
timeOutFrame++;
update();
}
else stopTimeOutAnimation();
}
void MySetLabel::paintEvent(QPaintEvent * event) {
if(!timeOutAnimation) {
QLabel::paintEvent(event);
}
if(timeOutAnimation) {
QPainter painter(this);
QLinearGradient linearGrad(QPointF(0, 10), QPointF(113, 10));
linearGrad.setColorAt(0, Qt::red);
linearGrad.setColorAt(0.5, Qt::yellow);
linearGrad.setColorAt(1, Qt::green);
painter.setBrush(linearGrad);
painter.setPen(QColor(0,0,0));
painter.drawRect(0,6,timeOutAnimationWidth,8);
}
}
+47
View File
@@ -0,0 +1,47 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MYSETLABEL_H
#define MYSETLABEL_H
#include <QtGui>
#include <QtCore>
#include <iostream>
class MySetLabel : public QLabel
{
Q_OBJECT
public:
MySetLabel(QGroupBox*);
~MySetLabel();
void startTimeOutAnimation(int secs);
void stopTimeOutAnimation();
void paintEvent(QPaintEvent * event);
public slots:
void nextTimeOutAnimationFrame();
private:
QTimer *timeOutAnimationTimer;
bool timeOutAnimation;
int timeOutAnimationWidth;
int timeOutValue;
int timeOutFrame;
};
#endif