From 9f37bac07a06870bc3e5d1c150496ed347a4de99 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 11 Mar 2014 17:27:05 -0300 Subject: Support Animation Speed via Settings. This is very userfull for a ( yet to be implemented ) preference dialog about the animation speed, so the user can enable / disable the animations or make it a bit faster for it's taste. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/animationfunctions.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'qt-ui/profile/animationfunctions.cpp') diff --git a/qt-ui/profile/animationfunctions.cpp b/qt-ui/profile/animationfunctions.cpp index 8cccf616e..608c4c000 100644 --- a/qt-ui/profile/animationfunctions.cpp +++ b/qt-ui/profile/animationfunctions.cpp @@ -1,6 +1,7 @@ #include "animationfunctions.h" #include #include +#include namespace Animations { @@ -22,17 +23,24 @@ namespace Animations animation->start(QAbstractAnimation::DeleteWhenStopped); } - void moveTo(QObject *obj, qreal x, qreal y, int msecs) + void moveTo(QObject *obj, qreal x, qreal y) { - QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos"); - animation->setDuration(msecs); - animation->setStartValue(obj->property("pos").toPointF()); - animation->setEndValue(QPointF(x, y)); - animation->start(QAbstractAnimation::DeleteWhenStopped); + QSettings s; + int msecs = s.value("animation_speed", 500).toInt(); + if (msecs != 0){ + QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos"); + animation->setDuration(msecs); + animation->setStartValue(obj->property("pos").toPointF()); + animation->setEndValue(QPointF(x, y)); + animation->start(QAbstractAnimation::DeleteWhenStopped); + } + else{ + obj->setProperty("pos", QPointF(x,y)); + } } - void moveTo(QObject *obj, const QPointF &pos, int msecs) + void moveTo(QObject *obj, const QPointF &pos) { - moveTo(obj, pos.x(), pos.y(), msecs); + moveTo(obj, pos.x(), pos.y()); } } -- cgit v1.2.3-70-g09d2