Show
Ignore:
Timestamp:
04/07/08 04:33:22 (8 months ago)
Author:
flynd
Message:

Fixed timer handling for contact animations so animations won't stop working after removing a contact.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt4-gui/src/contactlist/contactuserdata.cpp

    r6112 r6132  
    9999{ 
    100100  // Free up animation timer resource if we were using it 
    101   myFlash = false; 
    102   myOnlCounter = 0; 
    103   myCarCounter = 0; 
    104   stopAnimation(); 
     101  if (myFlash || myOnlCounter > 0 || myCarCounter > 0) 
     102    stopAnimation(); 
    105103 
    106104  // Remove this user from all groups 
     
    119117      if (sig->Argument() == 0) 
    120118      { 
    121         // User came online 
     119        // User fetched our auto respons message 
    122120        myCarCounter = ((5*1000/FLASH_TIME)+1)&(-2); 
    123121        startAnimation(); 
     
    129127      if (sig->Argument() == 1) 
    130128      { 
    131         // User fetched our auto respons message 
     129        // User came online 
    132130        myOnlCounter = 5*1000/FLASH_TIME; // run about 5 seconds 
    133131        startAnimation(); 
     
    495493{ 
    496494  // Start common timer if not already running 
    497   if (myAnimatorCount == 0) 
     495  if (!myAnimateTimer->isActive()) 
    498496    myAnimateTimer->start(); 
    499497 
     
    509507void ContactUserData::stopAnimation() 
    510508{ 
    511   myAnimating = myFlash || myOnlCounter || myCarCounter; 
    512  
    513   // If this was the only or last animation disconnect from timer 
    514   if (!myAnimating) 
    515   { 
    516     disconnect(myAnimateTimer, SIGNAL(timeout()), this, SLOT(animate())); 
    517     myAnimatorCount--; 
    518  
    519     // Stop animation timer if noone is using it anymore 
    520     if (myAnimatorCount == 0) 
    521       myAnimateTimer->stop(); 
    522   } 
     509  // Disconnect from timer and keep track of usage 
     510  disconnect(myAnimateTimer, SIGNAL(timeout()), this, SLOT(animate())); 
     511  myAnimatorCount--; 
     512 
     513  // Stop animation timer if noone is using it anymore 
     514  if (myAnimatorCount == 0) 
     515    myAnimateTimer->stop(); 
     516 
     517  myAnimating = false; 
    523518} 
    524519 
     
    538533 
    539534  // Release timer if this was last animation 
    540   stopAnimation(); 
     535  if (!myFlash && myOnlCounter == 0 && myCarCounter == 0) 
     536    stopAnimation(); 
    541537 
    542538  // data() will check the counter value to determine which icon to show so nothing to do here except triggering an update