diff options
Diffstat (limited to 'pacman-c++/animationmanager.cpp')
| -rw-r--r-- | pacman-c++/animationmanager.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/pacman-c++/animationmanager.cpp b/pacman-c++/animationmanager.cpp index 69bec53..f4ddef7 100644 --- a/pacman-c++/animationmanager.cpp +++ b/pacman-c++/animationmanager.cpp | |||
| @@ -11,46 +11,46 @@ AnimationManager::AnimationManager() | |||
| 11 | 11 | ||
| 12 | AnimationManager *AnimationManager::self() | 12 | AnimationManager *AnimationManager::self() |
| 13 | { | 13 | { |
| 14 | if (!instance) | 14 | if (!instance) |
| 15 | instance = new AnimationManager; | 15 | instance = new AnimationManager; |
| 16 | return instance; | 16 | return instance; |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | void AnimationManager::registerAnimation(QAbstractAnimation *anim) | 19 | void AnimationManager::registerAnimation(QAbstractAnimation *anim) |
| 20 | { | 20 | { |
| 21 | QObject::connect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); | 21 | QObject::connect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); |
| 22 | animations.append(anim); | 22 | animations.append(anim); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | void AnimationManager::unregisterAnimation_helper(QObject *obj) | 25 | void AnimationManager::unregisterAnimation_helper(QObject *obj) |
| 26 | { | 26 | { |
| 27 | unregisterAnimation(static_cast<QAbstractAnimation*>(obj)); | 27 | unregisterAnimation(static_cast<QAbstractAnimation*>(obj)); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | void AnimationManager::unregisterAnimation(QAbstractAnimation *anim) | 30 | void AnimationManager::unregisterAnimation(QAbstractAnimation *anim) |
| 31 | { | 31 | { |
| 32 | QObject::disconnect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); | 32 | QObject::disconnect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); |
| 33 | animations.removeAll(anim); | 33 | animations.removeAll(anim); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | void AnimationManager::unregisterAllAnimations() | 36 | void AnimationManager::unregisterAllAnimations() |
| 37 | { | 37 | { |
| 38 | animations.clear(); | 38 | animations.clear(); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | void AnimationManager::pauseAll() | 41 | void AnimationManager::pauseAll() |
| 42 | { | 42 | { |
| 43 | foreach (QAbstractAnimation* animation, animations) | 43 | foreach (QAbstractAnimation* animation, animations) |
| 44 | { | 44 | { |
| 45 | if (animation->state() == QAbstractAnimation::Running) | 45 | if (animation->state() == QAbstractAnimation::Running) |
| 46 | animation->pause(); | 46 | animation->pause(); |
| 47 | } | 47 | } |
| 48 | } | 48 | } |
| 49 | void AnimationManager::resumeAll() | 49 | void AnimationManager::resumeAll() |
| 50 | { | 50 | { |
| 51 | foreach (QAbstractAnimation* animation, animations) | 51 | foreach (QAbstractAnimation* animation, animations) |
| 52 | { | 52 | { |
| 53 | if (animation->state() == QAbstractAnimation::Paused) | 53 | if (animation->state() == QAbstractAnimation::Paused) |
| 54 | animation->resume(); | 54 | animation->resume(); |
| 55 | } | 55 | } |
| 56 | } | 56 | } |
