]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Turn off animations if they are globally disabled
authorPeter Penz <peter.penz19@gmail.com>
Sun, 18 Dec 2011 14:33:53 +0000 (15:33 +0100)
committerPeter Penz <peter.penz19@gmail.com>
Sun, 18 Dec 2011 14:38:42 +0000 (15:38 +0100)
Respect the graphicseffect level in the system settings. This will disable
all item-animations if the graphicseffect level is "NoEffect".

The smooth scrolling won't be disabled in this case, but the duration has been
made smaller so that it is not recognized as an animation.

BUG: 289238
FIXED-IN: 4.8.0

src/kitemviews/kitemlistsmoothscroller.cpp
src/kitemviews/kitemlistviewanimation.cpp
src/kitemviews/kitemlistviewanimation_p.h

index 5c1bf3c5a3b441cfecd53b1282679404606eb810..d966920cb41258374722b5c199ade4d1dc202bdd 100644 (file)
@@ -35,7 +35,7 @@ KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar,
     m_animation(0)
 {
     m_animation = new QPropertyAnimation(this);
-    m_animation->setDuration(300);
+    m_animation->setDuration(200);
     connect(m_animation, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)),
             this, SLOT(slotAnimationStateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
 
index 9b122ee8c4af43a49c2152adfb630562bdc84237..9184b7144f01a7dca1d4b2a24b232bf19b72ec6f 100644 (file)
 #include "kitemlistview.h"
 
 #include <KDebug>
+#include <KGlobalSettings>
 
 #include <QGraphicsWidget>
 #include <QPropertyAnimation>
 
 KItemListViewAnimation::KItemListViewAnimation(QObject* parent) :
     QObject(parent),
+    m_animationDuration(200),
     m_scrollOrientation(Qt::Vertical),
     m_scrollOffset(0),
     m_animation()
 {
+    if (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) {
+        m_animationDuration = 1;
+    }
 }
 
 KItemListViewAnimation::~KItemListViewAnimation()
@@ -117,7 +122,6 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
 {
     stop(widget, type);
 
-    const int duration = 200;
     QPropertyAnimation* propertyAnim = 0;
 
     switch (type) {
@@ -128,7 +132,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
         }
 
         propertyAnim = new QPropertyAnimation(widget, "pos");
-        propertyAnim->setDuration(duration);
+        propertyAnim->setDuration(m_animationDuration);
         propertyAnim->setEndValue(newPos);
         break;
     }
@@ -136,7 +140,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
     case CreateAnimation: {
         propertyAnim = new QPropertyAnimation(widget, "opacity");
         propertyAnim->setEasingCurve(QEasingCurve::InQuart);
-        propertyAnim->setDuration(duration);
+        propertyAnim->setDuration(m_animationDuration);
         propertyAnim->setStartValue(0.0);
         propertyAnim->setEndValue(1.0);
         break;
@@ -145,7 +149,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
     case DeleteAnimation: {
         propertyAnim = new QPropertyAnimation(widget, "opacity");
         propertyAnim->setEasingCurve(QEasingCurve::OutQuart);
-        propertyAnim->setDuration(duration);
+        propertyAnim->setDuration(m_animationDuration);
         propertyAnim->setStartValue(1.0);
         propertyAnim->setEndValue(0.0);
         break;
@@ -158,7 +162,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
         }
 
         propertyAnim = new QPropertyAnimation(widget, "size");
-        propertyAnim->setDuration(duration);
+        propertyAnim->setDuration(m_animationDuration);
         propertyAnim->setEndValue(newSize);
         break;
     }
index b3a95a871017c37b487705010a1575bb4bcd9b24..ecaa5ff8be38d68195d7e3f45291fca1b52f7e0b 100644 (file)
@@ -69,6 +69,7 @@ private slots:
 private:
     enum { AnimationTypeCount = 4 };
 
+    int m_animationDuration;
     Qt::Orientation m_scrollOrientation;
     qreal m_scrollOffset;
     QHash<QGraphicsWidget*, QPropertyAnimation*> m_animation[AnimationTypeCount];