mirror of
https://invent.kde.org/system/dolphin
synced 2024-07-15 18:01:11 +00:00
Port away from KGlobalSettings::graphicEffectsLevel()
REVIEW: 122309
This commit is contained in:
parent
f8187b982a
commit
08252ffc69
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include <QDebug>
|
||||
|
||||
#include <KGlobalSettings>
|
||||
#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);
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -19,12 +19,11 @@
|
|||
|
||||
#include "kitemlistsmoothscroller.h"
|
||||
|
||||
#include <KGlobalSettings>
|
||||
#include <QEvent>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QScrollBar>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include <QStyle>
|
||||
#include <QDebug>
|
||||
|
||||
KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar,
|
||||
|
@ -36,7 +35,7 @@ KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar,
|
|||
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);
|
||||
|
|
|
@ -22,21 +22,16 @@
|
|||
#include <kitemviews/kitemlistview.h>
|
||||
|
||||
#include <QDebug>
|
||||
#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()
|
||||
|
@ -123,6 +118,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
|
|||
stop(widget, type);
|
||||
|
||||
QPropertyAnimation* propertyAnim = 0;
|
||||
const int animationDuration = widget->style()->styleHint(QStyle::SH_Widget_Animate) ? 200 : 1;
|
||||
|
||||
switch (type) {
|
||||
case MovingAnimation: {
|
||||
|
@ -132,7 +128,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
|
|||
}
|
||||
|
||||
propertyAnim = new QPropertyAnimation(widget, "pos");
|
||||
propertyAnim->setDuration(m_animationDuration);
|
||||
propertyAnim->setDuration(animationDuration);
|
||||
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);
|
||||
propertyAnim->setDuration(m_animationDuration);
|
||||
propertyAnim->setDuration(animationDuration);
|
||||
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);
|
||||
propertyAnim->setDuration(m_animationDuration);
|
||||
propertyAnim->setDuration(animationDuration);
|
||||
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->setDuration(m_animationDuration);
|
||||
propertyAnim->setDuration(animationDuration);
|
||||
propertyAnim->setEndValue(newSize);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,6 @@ private slots:
|
|||
private:
|
||||
enum { AnimationTypeCount = 4 };
|
||||
|
||||
int m_animationDuration;
|
||||
Qt::Orientation m_scrollOrientation;
|
||||
qreal m_scrollOffset;
|
||||
QHash<QGraphicsWidget*, QPropertyAnimation*> m_animation[AnimationTypeCount];
|
||||
|
|
Loading…
Reference in a new issue