let animation objects delete themselves after they are not being used anymore
authorsheepluva
Sun, 28 Oct 2012 20:35:08 +0100
changeset 7860 a90936219ffa
parent 7858 2566fc2621d4
child 7862 bd76ca40db68
let animation objects delete themselves after they are not being used anymore PS: I don't like that we create new animation objects every single time before a page transition is done, I'm sure that can be done in a nicer way. But at least we're not keeping those non-reused objects around forever now...
QTfrontend/hwform.cpp
share/hedgewars/Data/Locale/hedgewars_de.ts
--- a/QTfrontend/hwform.cpp	Sun Oct 28 12:36:08 2012 -0400
+++ b/QTfrontend/hwform.cpp	Sun Oct 28 20:35:08 2012 +0100
@@ -693,16 +693,12 @@
         animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo);
 #endif
 
-        QParallelAnimationGroup *group = new QParallelAnimationGroup;
-        group->addAnimation(animationOldSlide);
-        group->addAnimation(animationNewSlide);
-#ifdef false
-        group->addAnimation(animationOldOpacity);
-        group->addAnimation(animationNewOpacity);
-#endif
+        // let's hide the old slide after its animation has finished
+        connect(animationOldSlide, SIGNAL(finished()), ui.Pages->widget(lastid), SLOT(hide()));
 
-        connect(animationOldSlide, SIGNAL(finished()), ui.Pages->widget(lastid), SLOT(hide()));
-        group->start();
+        // start animations
+        animationOldSlide->start(QAbstractAnimation::DeleteWhenStopped);
+        animationNewSlide->start(QAbstractAnimation::DeleteWhenStopped);
 
     	/* this is for the situation when the animation below is interrupted by a new animation.  For some reason, finished is not being fired */ 	
     	for(int i=0;i<MAX_PAGE;i++) if (i!=id && i!=lastid) ui.Pages->widget(i)->hide();
@@ -807,16 +803,12 @@
         animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo);
 #endif
 
-        QParallelAnimationGroup *group = new QParallelAnimationGroup;
-        group->addAnimation(animationOldSlide);
-        group->addAnimation(animationNewSlide);
-#ifdef false
-        group->addAnimation(animationOldOpacity);
-        group->addAnimation(animationNewOpacity);
-#endif
+        // let's hide the old slide after its animation has finished
+        connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide()));
 
-        connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide()));
-        group->start();
+        // start animations
+        animationOldSlide->start(QAbstractAnimation::DeleteWhenStopped);
+        animationNewSlide->start(QAbstractAnimation::DeleteWhenStopped);
     }
 #endif
 
--- a/share/hedgewars/Data/Locale/hedgewars_de.ts	Sun Oct 28 12:36:08 2012 -0400
+++ b/share/hedgewars/Data/Locale/hedgewars_de.ts	Sun Oct 28 20:35:08 2012 +0100
@@ -1171,7 +1171,7 @@
     </message>
     <message>
         <source>Practice your skills in a range of training missions</source>
-        <translation>Verbessere deine Fähigkeiten in verschidenen Trainingsmissionen</translation>
+        <translation>Verbessere deine Fähigkeiten in verschiedenen Trainingsmissionen</translation>
     </message>
     <message>
         <source>Demos</source>