perf: smooth UI animations and reduce repaint overhead

Batch of performance and animation work: shared FadeHelper/MotionPrefs
primitives, hover animators, shadow pixmap caching, smooth scrolling,
seek time bubble, and widespread component repaint reductions.
This commit is contained in:
dela
2026-07-08 11:29:38 +08:00
parent 03bc33518c
commit ab1accc821
85 changed files with 2308 additions and 661 deletions
+9 -2
View File
@@ -10,6 +10,8 @@
#include <QLabel>
#include <QPushButton>
#include <QFont>
#include "../tokens/AnimationTokens.h"
#include "../utils/motionprefs.h"
ServerWheelView::ServerWheelView(QWidget* parent) : QWidget(parent) {
setAttribute(Qt::WA_StyledBackground, true);
@@ -17,8 +19,8 @@ ServerWheelView::ServerWheelView(QWidget* parent) : QWidget(parent) {
m_scrollAnim = new QVariantAnimation(this);
m_scrollAnim->setEasingCurve(QEasingCurve::OutExpo);
m_scrollAnim->setDuration(450);
m_scrollAnim->setEasingCurve(AnimationTokens::Curve::enter());
m_scrollAnim->setDuration(AnimationTokens::DurationMs::kSlow);
connect(m_scrollAnim, &QVariantAnimation::valueChanged, this, [this](const QVariant& val){
m_scrollOffset = val.toReal();
updateLayout();
@@ -186,6 +188,11 @@ void ServerWheelView::installFilterRecursively(QWidget* w) {
void ServerWheelView::scrollTo(qreal target) {
m_scrollAnim->stop();
if (MotionPrefs::reduceMotion()) {
m_scrollOffset = target;
updateLayout();
return;
}
m_scrollAnim->setStartValue(m_scrollOffset);
m_scrollAnim->setEndValue(target);
m_scrollAnim->start();