timeoutanimation changes

This commit is contained in:
doitux
2007-06-08 20:35:36 +00:00
parent 056ae1aa32
commit 17cf5825c2
2 changed files with 18 additions and 6 deletions
+14 -4
View File
@@ -20,6 +20,10 @@ MySetLabel::MySetLabel(QGroupBox* parent)
{ {
timeOutAnimationTimer = new QTimer; timeOutAnimationTimer = new QTimer;
timeOutAnimationKickOnTimer = new QTimer;
timeOutAnimationKickOnTimer->setSingleShot(TRUE);
connect(timeOutAnimationKickOnTimer, SIGNAL(timeout()), this, SLOT(startTimeOutAnimationNow()));
connect(timeOutAnimationTimer, SIGNAL(timeout()), this, SLOT(nextTimeOutAnimationFrame())); connect(timeOutAnimationTimer, SIGNAL(timeout()), this, SLOT(nextTimeOutAnimationFrame()));
// flipCardsTimer = new QTimer; // flipCardsTimer = new QTimer;
// connect(flipCardsTimer, SIGNAL(timeout()), this, SLOT(nextFlipCardsFrame())); // connect(flipCardsTimer, SIGNAL(timeout()), this, SLOT(nextFlipCardsFrame()));
@@ -32,17 +36,23 @@ MySetLabel::~MySetLabel()
void MySetLabel::startTimeOutAnimation(int secs) { void MySetLabel::startTimeOutAnimation(int secs) {
timeOutValue = secs; timeOutValue = secs-3;
timeOutFrame = 1; timeOutFrame = 1;
timeOutAnimationWidth = 118; timeOutAnimationWidth = 118;
timeOutAnimation = TRUE; timeOutAnimationKickOnTimer->start(3000);
timeOutAnimationTimer->start(40);
} }
void MySetLabel::startTimeOutAnimationNow() {
timeOutAnimation = TRUE;
timeOutAnimationTimer->start(83);
}
void MySetLabel::stopTimeOutAnimation() { void MySetLabel::stopTimeOutAnimation() {
timeOutAnimationKickOnTimer->stop();
timeOutAnimationTimer->stop(); timeOutAnimationTimer->stop();
timeOutAnimation = FALSE; timeOutAnimation = FALSE;
update(); update();
@@ -51,7 +61,7 @@ void MySetLabel::stopTimeOutAnimation() {
void MySetLabel::nextTimeOutAnimationFrame() { void MySetLabel::nextTimeOutAnimationFrame() {
if(timeOutAnimationWidth >=0) { if(timeOutAnimationWidth >=0) {
if(timeOutFrame%(timeOutValue*25/118) == 0) if(timeOutFrame%(timeOutValue*12/118) == 0)
timeOutAnimationWidth--; timeOutAnimationWidth--;
timeOutFrame++; timeOutFrame++;
update(); update();
+3 -1
View File
@@ -30,12 +30,13 @@ public:
void setMyW ( mainWindowImpl* theValue ) { myW = theValue; } void setMyW ( mainWindowImpl* theValue ) { myW = theValue; }
void startTimeOutAnimation(int secs); void startTimeOutAnimation(int secs);
void stopTimeOutAnimation(); void stopTimeOutAnimation();
void paintEvent(QPaintEvent * event); void paintEvent(QPaintEvent * event);
public slots: public slots:
void startTimeOutAnimationNow();
void nextTimeOutAnimationFrame(); void nextTimeOutAnimationFrame();
@@ -43,6 +44,7 @@ private:
mainWindowImpl *myW; mainWindowImpl *myW;
QTimer *timeOutAnimationTimer; QTimer *timeOutAnimationTimer;
QTimer *timeOutAnimationKickOnTimer;
bool timeOutAnimation; bool timeOutAnimation;
int timeOutAnimationWidth; int timeOutAnimationWidth;