From 731fb96a386154fdac15b3b53c1f73ef3f305648 Mon Sep 17 00:00:00 2001 From: Liu Zhangjian Date: Tue, 10 Feb 2026 13:57:34 +0800 Subject: [PATCH] refactor: improve loading widget animation and structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Removed background logo layer and simplified widget hierarchy 2. Replaced oscillating opacity effect with smoother breathing animation 3. Changed opacity range from full oscillation (1.0 to -0.9) to breathing effect (0.3 to 1.0) 4. Updated icon theme from "deepin_unioncode_logo" to "ide" 5. Increased animation frequency by reducing timer interval from 150ms to 50ms 6. Added proper member variables for opacity state management Log: Improved loading animation with smoother breathing effect Influence: 1. Verify loading widget displays correctly during application startup 2. Test animation smoothness and visual appeal 3. Confirm icon displays properly with new theme name 4. Check animation performance on different hardware 5. Verify loading text alignment and positioning 6. Test widget behavior during different loading scenarios refactor: 优化加载控件动画和结构 1. 移除了背景logo层,简化了控件层次结构 2. 将振荡透明度效果改为更平滑的呼吸动画 3. 将透明度范围从完全振荡(1.0到-0.9)改为呼吸效果(0.3到1.0) 4. 将图标主题从"deepin_unioncode_logo"更新为"ide" 5. 通过将定时器间隔从150ms减少到50ms来提高动画频率 6. 添加了适当的成员变量用于透明度状态管理 Log: 改进了加载动画,采用更平滑的呼吸效果 Influence: 1. 验证应用程序启动时加载控件是否正确显示 2. 测试动画流畅度和视觉效果 3. 确认图标使用新主题名称正确显示 4. 在不同硬件上检查动画性能 5. 验证加载文本的对齐和定位 6. 测试不同加载场景下控件的行为 --- debian/changelog | 9 +++++ src/plugins/core/gui/loadingwidget.cpp | 49 +++++++++++++------------- src/plugins/core/gui/loadingwidget.h | 3 +- 3 files changed, 36 insertions(+), 25 deletions(-) diff --git a/debian/changelog b/debian/changelog index a1239cb79..24d53b378 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +deepin-unioncode (1.4.20) unstable; urgency=medium + + * chore: remove qt6-multimedia-dev build dependency + * chore: downgrade cmake minimum required version + * chore: update icon installation to follow freedesktop standards + * refactor: improve loading widget animation and structure + + -- Liu Zhangjian Tue, 10 Feb 2026 13:57:55 +0800 + deepin-unioncode (1.4.19) unstable; urgency=medium * feat: update IDE icon design and installation diff --git a/src/plugins/core/gui/loadingwidget.cpp b/src/plugins/core/gui/loadingwidget.cpp index 939703613..6513ebc94 100644 --- a/src/plugins/core/gui/loadingwidget.cpp +++ b/src/plugins/core/gui/loadingwidget.cpp @@ -8,8 +8,6 @@ DWIDGET_USE_NAMESPACE -static float opacity = 1.0; - loadingWidget::loadingWidget(QWidget *parent) : DWidget(parent) { @@ -21,33 +19,36 @@ loadingWidget::loadingWidget(QWidget *parent) loadingText->setText(tr("loading...")); loadingText->setAlignment(Qt::AlignCenter); - vlayout->addWidget(backgroundLogo); + vlayout->addWidget(logo); vlayout->addWidget(loadingText); vlayout->setAlignment(Qt::AlignCenter); } void loadingWidget::setLogo() { - backgroundLogo = new DLabel(this); - backgroundLogo->setPixmap(QIcon::fromTheme("deepin_unioncode_backgroundLogo").pixmap(128)); - - logo = new DLabel(backgroundLogo); - logo->setPixmap(QIcon::fromTheme("deepin_unioncode_logo").pixmap(128)); - - QHBoxLayout *hlayout = new QHBoxLayout; - hlayout->addWidget(logo); - backgroundLogo->setLayout(hlayout); - - opacityEffect = new QGraphicsOpacityEffect(this); - - connect(&timer, &QTimer::timeout, this, [=]() { - opacity -= 0.1; - - if (opacity < -0.9) - opacity = 1.0; - - opacityEffect->setOpacity(qAbs(opacity)); - logo->setGraphicsEffect(opacityEffect); + logo = new DLabel(this); + logo->setPixmap(QIcon::fromTheme("ide").pixmap(128)); + logo->setAlignment(Qt::AlignCenter); + + opacityEffect = new QGraphicsOpacityEffect(logo); + logo->setGraphicsEffect(opacityEffect); + + connect(&timer, &QTimer::timeout, this, [this]() { + // 透明度在 0.3 到 1.0 之间循环变化,产生呼吸效果 + if (fadeOut) { + logoOpacity -= 0.05; + if (logoOpacity <= 0.3) { + logoOpacity = 0.3; + fadeOut = false; + } + } else { + logoOpacity += 0.05; + if (logoOpacity >= 1.0) { + logoOpacity = 1.0; + fadeOut = true; + } + } + opacityEffect->setOpacity(logoOpacity); }); - timer.start(150); + timer.start(50); } diff --git a/src/plugins/core/gui/loadingwidget.h b/src/plugins/core/gui/loadingwidget.h index 4379c752b..5eab36827 100644 --- a/src/plugins/core/gui/loadingwidget.h +++ b/src/plugins/core/gui/loadingwidget.h @@ -21,10 +21,11 @@ class loadingWidget : public DTK_WIDGET_NAMESPACE::DWidget void setLogo(); DTK_WIDGET_NAMESPACE::DLabel *logo { nullptr }; - DTK_WIDGET_NAMESPACE::DLabel *backgroundLogo { nullptr }; DTK_WIDGET_NAMESPACE::DLabel *loadingText { nullptr }; QGraphicsOpacityEffect *opacityEffect { nullptr }; QTimer timer; + float logoOpacity { 1.0 }; + bool fadeOut { true }; }; #endif // LOADINGWIDGET_H