Skip to content

fix: enable real-time volume adjustment in sound applet - #500

Merged
xionglinlin merged 1 commit into
linuxdeepin:masterfrom
xionglinlin:master
Sep 1, 2026
Merged

fix: enable real-time volume adjustment in sound applet#500
xionglinlin merged 1 commit into
linuxdeepin:masterfrom
xionglinlin:master

Conversation

@xionglinlin

@xionglinlin xionglinlin commented Aug 28, 2026

Copy link
Copy Markdown
Contributor
  1. Remove setTracking(false) calls from both SoundApplet and SoundQuickPanel
  2. This restores the default tracking behavior that emits value changes during slider drag
  3. Previously the tracking disabled prevented the volume from updating smoothly as the user dragged the slider
  4. The volume now adjusts in real-time as the slider moves, providing immediate audio feedback

Log: Fixed volume slider not responding in real-time during adjustment

Influence:

  1. Test volume adjustment by dragging the slider in the dock sound applet
  2. Verify audio volume changes smoothly while dragging instead of only on release
  3. Test the quick panel volume slider for the same real-time behavior
  4. Ensure volume updates correctly when using keyboard shortcuts or slider steps
  5. Verify no regression in volume slider functionality across different audio devices

fix: 修复声音调节不能实时变化的问题

  1. 移除 SoundApplet 和 SoundQuickPanel 中的 setTracking(false) 调用
  2. 恢复默认的跟踪行为,使滑块在拖动过程中持续发出值变化事件
  3. 此前禁用跟踪导致音量在拖动过程中无法实时更新
  4. 音量现在随滑块移动实时调整,提供即时音频反馈

Log: 修复音量滑块在调节时不能实时响应的问题

Influence:

  1. 测试在任务栏声音组件中拖拽音量滑块
  2. 验证音量在拖动过程中平滑变化,而不是仅在松开时更新
  3. 测试快捷面板音量滑块的实时响应行为
  4. 验证使用键盘快捷键或步进调节时音量更新正常
  5. 确认在不同音频设备上音量滑块功能无回归

PMS: BUG-375031
Change-Id: I3382aecb30658755616c3c5c470fa759c37ae32d

Summary by Sourcery

Enable immediate audio volume adjustment across dock and quick-panel sliders.

Bug Fixes:

  • Restore real-time volume updates while dragging sliders in the dock sound applet and quick panel.

Chores:

  • Update copyright years in the affected sound components.

1. Remove `setTracking(false)` calls from both SoundApplet and
SoundQuickPanel
2. This restores the default tracking behavior that emits value changes
during slider drag
3. Previously the tracking disabled prevented the volume from updating
smoothly as the user dragged the slider
4. The volume now adjusts in real-time as the slider moves, providing
immediate audio feedback

Log: Fixed volume slider not responding in real-time during adjustment

Influence:
1. Test volume adjustment by dragging the slider in the dock sound
applet
2. Verify audio volume changes smoothly while dragging instead of only
on release
3. Test the quick panel volume slider for the same real-time behavior
4. Ensure volume updates correctly when using keyboard shortcuts or
slider steps
5. Verify no regression in volume slider functionality across different
audio devices

fix: 修复声音调节不能实时变化的问题

1. 移除 SoundApplet 和 SoundQuickPanel 中的 `setTracking(false)` 调用
2. 恢复默认的跟踪行为,使滑块在拖动过程中持续发出值变化事件
3. 此前禁用跟踪导致音量在拖动过程中无法实时更新
4. 音量现在随滑块移动实时调整,提供即时音频反馈

Log: 修复音量滑块在调节时不能实时响应的问题

Influence:
1. 测试在任务栏声音组件中拖拽音量滑块
2. 验证音量在拖动过程中平滑变化,而不是仅在松开时更新
3. 测试快捷面板音量滑块的实时响应行为
4. 验证使用键盘快捷键或步进调节时音量更新正常
5. 确认在不同音频设备上音量滑块功能无回归

PMS: BUG-375031
Change-Id: I3382aecb30658755616c3c5c470fa759c37ae32d
@sourcery-ai

sourcery-ai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The pull request removes setTracking(false) from the dock and quick panel volume sliders, allowing value-change events and audio volume updates to occur continuously during dragging while leaving slider configuration otherwise unchanged.

Sequence diagram for real-time volume slider adjustment

sequenceDiagram
    actor User
    participant Slider as VolumeSlider
    participant SoundModel
    participant AudioDevice

    User->>Slider: drag slider
    Slider-->>SoundModel: valueChanged(value)
    SoundModel->>AudioDevice: set volume
    AudioDevice-->>User: immediate audio feedback
Loading

File-Level Changes

Change Details Files
Re-enable continuous volume updates while sliders are dragged by restoring the controls’ default tracking behavior.
  • Remove explicit tracking disablement from the dock sound applet slider.
  • Remove explicit tracking disablement from the quick panel slider.
  • Preserve existing ranges, page-step configuration, and slider initialization.
plugins/dde-dock/sound/soundapplet.cpp
plugins/dde-dock/sound/soundquickpanel.cpp
Update SPDX copyright ranges for the modified implementation files.
  • Extend the copyright year ranges through 2026.
plugins/dde-dock/sound/soundapplet.cpp
plugins/dde-dock/sound/soundquickpanel.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 98 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 98 分,大于 70 分通过阈值。本次变更移除了音量滑块的 setTracking(false) 调用,恢复了实时跟踪行为,修复了音量滑块拖动时不能实时响应的问题。变更简洁、目的明确,无安全漏洞,无语法或逻辑错误。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 语法正确,逻辑清晰。移除 setTracking(false) 调用后,QSlider 恢复默认的 tracking 行为,即在拖动过程中持续发出 valueChanged 信号,符合修复音量实时响应的意图。两个文件的修改均完整、无语法错误。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:

  1. plugins/dde-dock/sound/soundquickpanel.cpp:1 - 文件第一行版权信息 Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd. 的年份未同步更新,与 SPDX 行的 2026 年不一致

建议: 建议同步更新 soundquickpanel.cpp 第一行版权信息中的年份,保持与 SPDX 行一致。可在移除 setTracking(false) 的位置添加简短注释说明恢复 tracking 的原因,便于后续维护。


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:

  1. plugins/dde-dock/sound/soundapplet.cpp:71 - 移除 setTracking(false) 后 valueChanged 信号在拖动时频繁触发,可能导致频繁的音频 API 调用

建议: 当前实现可接受,音频后端(PulseAudio/PipeWire)通常能处理频繁的音量变更请求。若后续出现性能问题,可考虑在 valueChanged 信号处理中加入 debounce 机制(如 50ms 延迟),平衡实时性与性能。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: 本次变更不涉及安全相关代码,无安全风险。


💡 改进建议代码示例

// SoundApplet::initUi() - 移除 setTracking(false) 后的推荐写法
// 恢复默认 tracking 行为,实现实时音量调整
void SoundApplet::initUi()
{
    m_volumeSlider->setFixedHeight(36);
    m_volumeSlider->setMinimum(0);
    m_volumeSlider->setMaximum(SoundModel::ref().maxVolumeUI());
    // 恢复默认 tracking,使滑块拖动时实时更新音量
    m_volumeSlider->setPageStep(2);
    m_sliderContainer->setSlider(m_volumeSlider);
    m_sliderContainer->addBackground();
}

// SoundQuickPanel::initUi() - 同样移除 setTracking(false)
void SoundQuickPanel::initUi()
{
    // 恢复默认 tracking,使滑块拖动时实时更新音量
    m_sliderContainer->updateSliderValue(soundVolume());
    m_sliderContainer->setRange(0, SoundModel::ref().maxVolumeUI());
    m_sliderContainer->setPageStep(2);
}

本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fly602, mhduiy, xionglinlin

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@xionglinlin
xionglinlin merged commit 656b7e6 into linuxdeepin:master Sep 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants