summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-02-07 16:54:12 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-08 07:19:58 -0800
commit266daa326d9a2de21c8f119864d7030526fec14e (patch)
treec06b48679e24226487861e04f2ed36768e23c626 /qt-ui
parentd66e4b5236441f3ac83a314055e4981571197d86 (diff)
downloadsubsurface-266daa326d9a2de21c8f119864d7030526fec14e.tar.gz
Start the profile state
The setup of the item positions for the profile state should be done here. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/animationfunctions.cpp3
-rw-r--r--qt-ui/profile/animationfunctions.h2
-rw-r--r--qt-ui/profile/profilewidget2.cpp32
3 files changed, 33 insertions, 4 deletions
diff --git a/qt-ui/profile/animationfunctions.cpp b/qt-ui/profile/animationfunctions.cpp
index d0c7af559..917be3858 100644
--- a/qt-ui/profile/animationfunctions.cpp
+++ b/qt-ui/profile/animationfunctions.cpp
@@ -21,9 +21,10 @@ void animDelete(QObject* obj)
animation->start(QAbstractAnimation::DeleteWhenStopped);
}
-void moveTo(QObject* obj, qreal x, qreal y)
+void moveTo(QObject* obj, qreal x, qreal y, int msecs)
{
QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos");
+ animation->setDuration(msecs);
animation->setStartValue(obj->property("pos").toPointF());
animation->setEndValue(QPointF(x, y));
animation->start(QAbstractAnimation::DeleteWhenStopped);
diff --git a/qt-ui/profile/animationfunctions.h b/qt-ui/profile/animationfunctions.h
index ff2c34d50..d5f900cb3 100644
--- a/qt-ui/profile/animationfunctions.h
+++ b/qt-ui/profile/animationfunctions.h
@@ -6,7 +6,7 @@ class QObject;
namespace Animations{
void hide(QObject *obj);
- void moveTo(QObject *obj, qreal x, qreal y);
+ void moveTo(QObject *obj, qreal x, qreal y, int msecs = 500);
void animDelete(QObject *obj);
};
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 8bef3f184..1a1f9e30f 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -217,6 +217,7 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
if (!d)
return;
+ setProfileState();
// Here we need to probe for the limits of the dive.
// There's already a function that does exactly that,
// but it's using the graphics context, and I need to
@@ -377,8 +378,7 @@ void ProfileWidget2::setEmptyState()
backgroundFile = QString(":poster%1").arg( rand()%3 +1);
currentState = EMPTY;
fixBackgroundPos();
- background->setVisible(true);
- Animations::moveTo(background, background->x(), 0);
+ Animations::moveTo(background, background->x(), itemPos.background.on.y());
toolTipItem->setVisible(false);
profileYAxis->setVisible(false);
@@ -407,5 +407,33 @@ void ProfileWidget2::setEmptyState()
void ProfileWidget2::setProfileState()
{
+ // Then starting Empty State, move the background up.
+ if (currentState == PROFILE)
+ return;
+ currentState = PROFILE;
+ Animations::moveTo(background, background->x(), itemPos.background.off.y(), 1500);
+ toolTipItem->setVisible(true);
+ profileYAxis->setVisible(true);
+ gasYAxis->setVisible(true);
+ temperatureAxis->setVisible(true);
+ timeAxis->setVisible(true);
+ diveProfileItem->setVisible(true);
+ cylinderPressureAxis->setVisible(true);
+ temperatureItem->setVisible(true);
+ gasPressureItem->setVisible(true);
+ cartesianPlane->setVisible(true);
+ meanDepth->setVisible(true);
+ diveComputerText->setVisible(true);
+ diveCeiling->setVisible(true);
+ reportedCeiling->setVisible(true);
+ pn2GasItem->setVisible(true);
+ pheGasItem->setVisible(true);
+ po2GasItem->setVisible(true);
+ Q_FOREACH(DiveCalculatedTissue *tissue, allTissues){
+ tissue->setVisible(true);
+ }
+ Q_FOREACH(DiveEventItem *event, eventItems){
+ event->setVisible(true);
+ }
}