]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Port away from KGlobalSettings::graphicEffectsLevel()
authorEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Thu, 29 Jan 2015 15:02:39 +0000 (16:02 +0100)
committerEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Fri, 30 Jan 2015 08:02:08 +0000 (09:02 +0100)
REVIEW: 122309

src/kitemviews/kitemlistwidget.cpp
src/kitemviews/private/kitemlistsmoothscroller.cpp
src/kitemviews/private/kitemlistviewanimation.cpp
src/kitemviews/private/kitemlistviewanimation.h

index 75251c9f40d08c165d76484c379591d7d3999843..d7bf57f5a91a41b175a6d322a671ca6faffdb7f2 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <QDebug>
 
 
 #include <QDebug>
 
-#include <KGlobalSettings>
 #include <QApplication>
 #include <QPainter>
 #include <QPropertyAnimation>
 #include <QApplication>
 #include <QPainter>
 #include <QPropertyAnimation>
@@ -250,7 +249,7 @@ void KItemListWidget::setHovered(bool hovered)
 
     if (!m_hoverAnimation) {
         m_hoverAnimation = new QPropertyAnimation(this, "hoverOpacity", this);
 
     if (!m_hoverAnimation) {
         m_hoverAnimation = new QPropertyAnimation(this, "hoverOpacity", this);
-        const int duration = (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) ? 1 : 200;
+        const int duration = style()->styleHint(QStyle::SH_Widget_Animate) ? 200 : 1;
         m_hoverAnimation->setDuration(duration);
         connect(m_hoverAnimation, &QPropertyAnimation::finished, this, &KItemListWidget::slotHoverAnimationFinished);
     }
         m_hoverAnimation->setDuration(duration);
         connect(m_hoverAnimation, &QPropertyAnimation::finished, this, &KItemListWidget::slotHoverAnimationFinished);
     }
index 697d3f5262579484d9d2488afcdc94ed7b0b5264..d5efc2c61d1f1c49318d10e3fdc8c13d606a4346 100644 (file)
 
 #include "kitemlistsmoothscroller.h"
 
 
 #include "kitemlistsmoothscroller.h"
 
-#include <KGlobalSettings>
 #include <QEvent>
 #include <QPropertyAnimation>
 #include <QScrollBar>
 #include <QWheelEvent>
 #include <QEvent>
 #include <QPropertyAnimation>
 #include <QScrollBar>
 #include <QWheelEvent>
-
+#include <QStyle>
 #include <QDebug>
 
 KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar,
 #include <QDebug>
 
 KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar,
@@ -36,7 +35,7 @@ KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar,
     m_animation(0)
 {
     m_animation = new QPropertyAnimation(this);
     m_animation(0)
 {
     m_animation = new QPropertyAnimation(this);
-    const int duration = (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) ? 1 : 100;
+    const int duration = m_scrollBar->style()->styleHint(QStyle::SH_Widget_Animate, nullptr, m_scrollBar) ? 100 : 1;
     m_animation->setDuration(duration);
     connect(m_animation, &QPropertyAnimation::stateChanged,
             this, &KItemListSmoothScroller::slotAnimationStateChanged);
     m_animation->setDuration(duration);
     connect(m_animation, &QPropertyAnimation::stateChanged,
             this, &KItemListSmoothScroller::slotAnimationStateChanged);
index 955eac6034110a313e92b176c1722a52caf0229e..5d8dade6eed6948289e91e6a41398239dc6b2fc1 100644 (file)
 #include <kitemviews/kitemlistview.h>
 
 #include <QDebug>
 #include <kitemviews/kitemlistview.h>
 
 #include <QDebug>
-#include <KGlobalSettings>
 
 #include <QGraphicsWidget>
 #include <QPropertyAnimation>
 
 KItemListViewAnimation::KItemListViewAnimation(QObject* parent) :
     QObject(parent),
 
 #include <QGraphicsWidget>
 #include <QPropertyAnimation>
 
 KItemListViewAnimation::KItemListViewAnimation(QObject* parent) :
     QObject(parent),
-    m_animationDuration(200),
     m_scrollOrientation(Qt::Vertical),
     m_scrollOffset(0),
     m_animation()
 {
     m_scrollOrientation(Qt::Vertical),
     m_scrollOffset(0),
     m_animation()
 {
-    if (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) {
-        m_animationDuration = 1;
-    }
 }
 
 KItemListViewAnimation::~KItemListViewAnimation()
 }
 
 KItemListViewAnimation::~KItemListViewAnimation()
@@ -123,6 +118,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
     stop(widget, type);
 
     QPropertyAnimation* propertyAnim = 0;
     stop(widget, type);
 
     QPropertyAnimation* propertyAnim = 0;
+    const int animationDuration = widget->style()->styleHint(QStyle::SH_Widget_Animate) ? 200 : 1;
 
     switch (type) {
     case MovingAnimation: {
 
     switch (type) {
     case MovingAnimation: {
@@ -132,7 +128,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
         }
 
         propertyAnim = new QPropertyAnimation(widget, "pos");
         }
 
         propertyAnim = new QPropertyAnimation(widget, "pos");
-        propertyAnim->setDuration(m_animationDuration);
+        propertyAnim->setDuration(animationDuration);
         propertyAnim->setEndValue(newPos);
         break;
     }
         propertyAnim->setEndValue(newPos);
         break;
     }
@@ -140,7 +136,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
     case CreateAnimation: {
         propertyAnim = new QPropertyAnimation(widget, "opacity");
         propertyAnim->setEasingCurve(QEasingCurve::InQuart);
     case CreateAnimation: {
         propertyAnim = new QPropertyAnimation(widget, "opacity");
         propertyAnim->setEasingCurve(QEasingCurve::InQuart);
-        propertyAnim->setDuration(m_animationDuration);
+        propertyAnim->setDuration(animationDuration);
         propertyAnim->setStartValue(0.0);
         propertyAnim->setEndValue(1.0);
         break;
         propertyAnim->setStartValue(0.0);
         propertyAnim->setEndValue(1.0);
         break;
@@ -149,7 +145,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
     case DeleteAnimation: {
         propertyAnim = new QPropertyAnimation(widget, "opacity");
         propertyAnim->setEasingCurve(QEasingCurve::OutQuart);
     case DeleteAnimation: {
         propertyAnim = new QPropertyAnimation(widget, "opacity");
         propertyAnim->setEasingCurve(QEasingCurve::OutQuart);
-        propertyAnim->setDuration(m_animationDuration);
+        propertyAnim->setDuration(animationDuration);
         propertyAnim->setStartValue(1.0);
         propertyAnim->setEndValue(0.0);
         break;
         propertyAnim->setStartValue(1.0);
         propertyAnim->setEndValue(0.0);
         break;
@@ -162,7 +158,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
         }
 
         propertyAnim = new QPropertyAnimation(widget, "size");
         }
 
         propertyAnim = new QPropertyAnimation(widget, "size");
-        propertyAnim->setDuration(m_animationDuration);
+        propertyAnim->setDuration(animationDuration);
         propertyAnim->setEndValue(newSize);
         break;
     }
         propertyAnim->setEndValue(newSize);
         break;
     }
index ee4a08bce24ea2badf66403438aeb725a24a2d70..ed4ec49024630248d8412db28cab22e3d2cad0ee 100644 (file)
@@ -94,7 +94,6 @@ private slots:
 private:
     enum { AnimationTypeCount = 4 };
 
 private:
     enum { AnimationTypeCount = 4 };
 
-    int m_animationDuration;
     Qt::Orientation m_scrollOrientation;
     qreal m_scrollOffset;
     QHash<QGraphicsWidget*, QPropertyAnimation*> m_animation[AnimationTypeCount];
     Qt::Orientation m_scrollOrientation;
     qreal m_scrollOffset;
     QHash<QGraphicsWidget*, QPropertyAnimation*> m_animation[AnimationTypeCount];