summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-13 10:49:43 +0100
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-13 10:49:49 +0100
commit6e209bb09f3feef210bc65f94cf8f58dd8e3b4a9 (patch)
tree94da799a697ebf32a98ccc13a53adfb2569f7c16 /demos
parentb664d54867139b371e158f1c63076c4a970cbb2a (diff)
parent4f2dcef95299f2da628b30607021e8deb1d868b6 (diff)
Merge oslo-staging-2/4.6 into upstream/4.6
Diffstat (limited to 'demos')
-rw-r--r--demos/sub-attaq/animationmanager.cpp7
-rw-r--r--demos/sub-attaq/animationmanager.h3
-rw-r--r--demos/sub-attaq/boat.cpp6
-rw-r--r--demos/sub-attaq/graphicsscene.cpp1
4 files changed, 14 insertions, 3 deletions
diff --git a/demos/sub-attaq/animationmanager.cpp b/demos/sub-attaq/animationmanager.cpp
index eb5a125353..b3fc8e1b05 100644
--- a/demos/sub-attaq/animationmanager.cpp
+++ b/demos/sub-attaq/animationmanager.cpp
@@ -62,11 +62,18 @@ AnimationManager *AnimationManager::self()
void AnimationManager::registerAnimation(QAbstractAnimation *anim)
{
+ QObject::connect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*)));
animations.append(anim);
}
+void AnimationManager::unregisterAnimation_helper(QObject *obj)
+{
+ unregisterAnimation(static_cast<QAbstractAnimation*>(obj));
+}
+
void AnimationManager::unregisterAnimation(QAbstractAnimation *anim)
{
+ QObject::disconnect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*)));
animations.removeAll(anim);
}
diff --git a/demos/sub-attaq/animationmanager.h b/demos/sub-attaq/animationmanager.h
index 8db13ebc43..48d84d1a3b 100644
--- a/demos/sub-attaq/animationmanager.h
+++ b/demos/sub-attaq/animationmanager.h
@@ -62,6 +62,9 @@ public slots:
void pauseAll();
void resumeAll();
+private slots:
+ void unregisterAnimation_helper(QObject *obj);
+
private:
static AnimationManager *instance;
QList<QAbstractAnimation *> animations;
diff --git a/demos/sub-attaq/boat.cpp b/demos/sub-attaq/boat.cpp
index 0ad31b1246..6fed9a9228 100644
--- a/demos/sub-attaq/boat.cpp
+++ b/demos/sub-attaq/boat.cpp
@@ -62,7 +62,7 @@ static QAbstractAnimation *setupDestroyAnimation(Boat *boat)
for (int i = 1; i <= 4; i++) {
PixmapItem *step = new PixmapItem(QString("explosion/boat/step%1").arg(i),GraphicsScene::Big, boat);
step->setZValue(6);
- step->setOpacity(0);
+ step->setOpacity(0);
//fade-in
QPropertyAnimation *anim = new QPropertyAnimation(step, "opacity");
@@ -92,10 +92,10 @@ Boat::Boat() : PixmapItem(QString("boat"), GraphicsScene::Big),
//The movement animation used to animate the boat
movementAnimation = new QPropertyAnimation(this, "pos");
- //The movement animation used to animate the boat
+ //The destroy animation used to explode the boat
destroyAnimation = setupDestroyAnimation(this);
- //We setup the state machien of the boat
+ //We setup the state machine of the boat
machine = new QStateMachine(this);
QState *moving = new QState(machine);
StopState *stopState = new StopState(this, moving);
diff --git a/demos/sub-attaq/graphicsscene.cpp b/demos/sub-attaq/graphicsscene.cpp
index e29095ed03..71d4fe73a0 100644
--- a/demos/sub-attaq/graphicsscene.cpp
+++ b/demos/sub-attaq/graphicsscene.cpp
@@ -278,4 +278,5 @@ void GraphicsScene::clearScene()
boat->stop();
boat->hide();
+ boat->setEnabled(true);
}