Added the Animations for the transitions of the States.

This code creates the animations that will be triggered when an state
changes. Things like hiding items and such should be handled this way.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-01-15 13:01:29 -02:00 committed by Dirk Hohndel
parent 74cb7d6b2a
commit c301367259

View file

@ -8,6 +8,7 @@
#include <QStateMachine>
#include <QSignalTransition>
#include <QPropertyAnimation>
ProfileWidget2::ProfileWidget2(QWidget *parent) :
QGraphicsView(parent),
@ -176,6 +177,30 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
planState->assignProperty(depthController, "y", depthControllerOnCanvas);
planState->assignProperty(timeController, "y", timeControllerOnCanvas);
// All animations for the State Transitions.
QPropertyAnimation *backgroundYAnim = new QPropertyAnimation(background, "y");
QPropertyAnimation *depthAxisAnim = new QPropertyAnimation(profileYAxis, "x");
QPropertyAnimation *gasAxisanim = new QPropertyAnimation(gasYAxis, "x");
QPropertyAnimation *timeAxisAnim = new QPropertyAnimation(timeAxis, "y");
QPropertyAnimation *depthControlAnim = new QPropertyAnimation(depthController, "y");
QPropertyAnimation *timeControlAnim = new QPropertyAnimation(timeController, "y");
QPropertyAnimation *profileAxisAnim = new QPropertyAnimation(profileYAxis, "line");
// Animations
QList<QSignalTransition*> transitions;
transitions << tAddToEmpty << tAddToPlan << tAddToProfile << tEditToAdd << tEditToEmpty << tEditToPlan
<< tEditToProfile << tEmptyToAdd << tEmptyToPlan << tEmptyToProfile << tProfileToAdd << tProfileToEdit
<< tProfileToEmpty << tProfileToPlan << tPlanToAdd << tPlanToEmpty << tPlanToProfile;
Q_FOREACH(QSignalTransition *s, transitions){
s->addAnimation(backgroundYAnim);
s->addAnimation(depthAxisAnim);
s->addAnimation(gasAxisanim);
s->addAnimation(timeAxisAnim);
s->addAnimation(depthControlAnim);
s->addAnimation(timeControlAnim);
s->addAnimation(profileAxisAnim);
}
}
// Currently just one dive, but the plan is to enable All of the selected dives.