src/hbcore/image/hbiconanimator.cpp
changeset 21 4633027730f5
parent 5 627c4a0fd0e7
child 23 e6ad4ef83b23
--- a/src/hbcore/image/hbiconanimator.cpp	Tue Jul 06 14:36:53 2010 +0300
+++ b/src/hbcore/image/hbiconanimator.cpp	Wed Aug 18 10:05:37 2010 +0300
@@ -203,6 +203,10 @@
         if (d->animation && !d->view) {
             d->animation->setView(0);
         }
+
+        if (d->animation && d->mLoopCountSet && !d->animation->loopCountSet()) {
+            d->animation->setLoopCount(d->mLoopCount);
+        }
     }
 }
 
@@ -246,7 +250,7 @@
     }
 }
 
-/**
+/*!
 * Sets the \a view showing the animated icon that this animator instance is associated with.
 * The animation is then paused automatically when the view is deactivated and resumed when it is activated.
 * If the owner view is not set the animation does not care about view switches.
@@ -267,4 +271,30 @@
     }
 }
 
+/*!
+  Sets a manual loop count.
+
+  Note that the interpretation depends on the underlying format, for
+  example animated XML only supports enabling/disabling looping,
+  i.e. a loop count cannot explicitly be specified. On the other hand
+  animated GIF and MNG supports explicit loop counts too.
+
+  Generally -1 means infinite looping and 0 means no loop, i.e. play
+  only once.
+
+  When this function is not called, the looping behavior is based on
+  what is specified in the file, e.g. in case of axml the playmode
+  attribute, in case of GIF the value returned by loopCount() of the
+  underlying QImageReader, etc.
+ */
+void HbIconAnimator::setLoopCount(int loopCount)
+{
+    d->mLoopCountSet = true;
+    d->mLoopCount = loopCount;
+    if (d->animation) {
+        d->animation->setLoopCount(d->mLoopCount);
+    }
+}
+
+
 // End of File