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:
@@ -1,4 +1,6 @@
|
||||
#include "detailview.h"
|
||||
#include "../../tokens/AnimationTokens.h"
|
||||
#include "../../utils/fadehelper.h"
|
||||
#include "../../components/detailactionwidget.h"
|
||||
#include "../../components/detailbottominfowidget.h"
|
||||
#include "../../components/detailcontentwidget.h"
|
||||
@@ -463,7 +465,7 @@ void DetailView::setupUi() {
|
||||
|
||||
m_vScrollController =
|
||||
new SmoothScrollController(m_mainScrollArea->verticalScrollBar(), this);
|
||||
m_vScrollController->setDuration(170);
|
||||
m_vScrollController->setDuration(AnimationTokens::DurationMs::kFast);
|
||||
|
||||
m_contentWidget = new DetailContentWidget(m_mainScrollArea);
|
||||
m_contentWidget->setObjectName("detail-content-container");
|
||||
@@ -1037,7 +1039,9 @@ QCoro::Task<void> DetailView::loadItem(const QString &itemId,
|
||||
|
||||
|
||||
|
||||
QTimer::singleShot(380, this, [safeThis, itemId]() {
|
||||
// Guard tracks the page-slide duration (kSlow) so the poster shadow / deferred
|
||||
// content reveal lands as the incoming slide settles; kept in sync via the token.
|
||||
QTimer::singleShot(AnimationTokens::DurationMs::kSlow, this, [safeThis, itemId]() {
|
||||
if (!safeThis || safeThis->m_pendingDeferredFetchId != itemId)
|
||||
return;
|
||||
if (safeThis->m_posterShadow)
|
||||
@@ -3253,7 +3257,8 @@ QCoro::Task<void> DetailView::executeLoadImages(QPointer<DetailView> safeThis,
|
||||
if (cachedImages.logo.has_value()) {
|
||||
safeThis->m_logoLabel->setPixmap(
|
||||
QPixmap::fromImage(cachedImages.logo.value()));
|
||||
safeThis->m_logoLabel->show();
|
||||
FadeHelper::fadeIn(safeThis->m_logoLabel,
|
||||
AnimationTokens::DurationMs::kNormal);
|
||||
qDebug() << "[DetailView] Detail logo image cache hit"
|
||||
<< "itemId=" << item.id;
|
||||
}
|
||||
@@ -3357,7 +3362,8 @@ QCoro::Task<void> DetailView::executeLoadImages(QPointer<DetailView> safeThis,
|
||||
if (!result.isNull()) {
|
||||
safeThis->m_logoLabel->setPixmap(
|
||||
QPixmap::fromImage(result));
|
||||
safeThis->m_logoLabel->show();
|
||||
FadeHelper::fadeIn(safeThis->m_logoLabel,
|
||||
AnimationTokens::DurationMs::kNormal);
|
||||
saveDetailImageAsync(
|
||||
cacheServerId, cacheUserId, currentItemId,
|
||||
QStringLiteral("logo"), logoId, logoType, logoTag,
|
||||
|
||||
Reference in New Issue
Block a user