From 2d6fafe25505b0f7a521cd867f41063f0ea73c5d Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Fri, 11 Sep 2020 09:52:14 -0600 Subject: [PATCH] Scale smooth scroll durations according to the global animation speed Now people who don't like animations can set thenm to "Instant" globally and smooth scrolling will be effectively disabled off in Okular. There is no change in speed for people using the default global animation duration. BUG: 420755 FIXED-IN: 1.12.0 --- ui/pageview.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/pageview.cpp b/ui/pageview.cpp index b0000107d..9619cc75c 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -439,6 +439,13 @@ PageView::PageView(QWidget *parent, Okular::Document *document) horizontalScrollBar()->setCursor(Qt::ArrowCursor); horizontalScrollBar()->setSingleStep(20); + // make the smooth scroll animation durations respect the global animation + // scale + KConfigGroup kdeglobalsConfig = KConfigGroup(KSharedConfig::openConfig(), QStringLiteral("KDE")); + const qreal globalAnimationScale = qMax(0.0, kdeglobalsConfig.readEntry("AnimationDurationFactor", 1.0)); + d->smoothScrollShortDuration *= globalAnimationScale; + d->smoothScrollLongDuration *= globalAnimationScale; + // connect the padding of the viewport to pixmaps requests connect(horizontalScrollBar(), &QAbstractSlider::valueChanged, this, &PageView::slotRequestVisiblePixmaps); connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &PageView::slotRequestVisiblePixmaps);