[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.2/kdelibs/kio/kio
From:       Fredrik Höglund <fredrik () kde ! org>
Date:       2009-03-06 21:50:55
Message-ID: 1236376255.311376.4230.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 936070 by fredrik:

Backport r936069.

 M  +17 -10    delegateanimationhandler.cpp  
 M  +3 -2      delegateanimationhandler_p.h  


--- branches/KDE/4.2/kdelibs/kio/kio/delegateanimationhandler.cpp #936069:936070
@@ -110,11 +110,23 @@
 
 
 DelegateAnimationHandler::DelegateAnimationHandler(QObject *parent)
-    : QObject(parent), timerId(0)
+    : QObject(parent)
 {
 }
 
+DelegateAnimationHandler::~DelegateAnimationHandler()
+{
+    timer.stop();
 
+    QMapIterator<const QAbstractItemView*, AnimationList*> i(animationLists);
+    while (i.hasNext()) {
+        i.next();
+        qDeleteAll(*i.value());
+        delete i.value();
+    }
+    animationLists.clear();
+}
+
 AnimationState *DelegateAnimationHandler::animationState(const QStyleOption &option,
                                                          const QModelIndex &index,
                                                          const QAbstractItemView \
*view) @@ -216,10 +228,8 @@
     state->time.start();
     state->animating = true;
 
-    if (!timerId)
-    {
-        timerId = startTimer(1000 / 30); // 30 fps
-    }
+    if (!timer.isActive())
+        timer.start(1000 / 30, this); // 30 fps
 }
 
 
@@ -290,11 +300,8 @@
         activeAnimations += runAnimations(list, view);
     }
 
-    if (activeAnimations == 0 && timerId)
-    {
-        killTimer(timerId);
-        timerId = 0;
-    }
+    if (activeAnimations == 0 && timer.isActive())
+        timer.stop();
 }
 
 }
--- branches/KDE/4.2/kdelibs/kio/kio/delegateanimationhandler_p.h #936069:936070
@@ -22,6 +22,7 @@
 #ifndef DELEGATEANIMATIONHANDLER_P_H
 #define DELEGATEANIMATIONHANDLER_P_H
 
+#include <QBasicTimer>
 #include <QMap>
 #include <QLinkedList>
 #include <QPersistentModelIndex>
@@ -80,7 +81,7 @@
 
 public:
     DelegateAnimationHandler(QObject *parent = 0);
-    ~DelegateAnimationHandler() {}
+    ~DelegateAnimationHandler();
 
     AnimationState *animationState(const QStyleOption &option, const QModelIndex \
&index, const QAbstractItemView *view);  
@@ -97,7 +98,7 @@
 private:
     QMap<const QAbstractItemView*, AnimationList*> animationLists;
     QTime fadeInAddTime;
-    int timerId;
+    QBasicTimer timer;
 };
 
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic