Skip to content

fix(bluetooth): add audio-headset/audio-headphones icon mappings - #493

Merged
caixr23 merged 1 commit into
linuxdeepin:masterfrom
caixr23:agent/pms-bug-bot/fix-bt-icon-275675
Aug 14, 2026
Merged

fix(bluetooth): add audio-headset/audio-headphones icon mappings#493
caixr23 merged 1 commit into
linuxdeepin:masterfrom
caixr23:agent/pms-bug-bot/fix-bt-icon-275675

Conversation

@caixr23

@caixr23 caixr23 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

根因分析

PMS 275675:连接蓝牙音箱时,控制中心与任务栏蓝牙列表的设备图标不一致。

任务栏(dde-tray-loader)的 deviceType2Icon 缺少 audio-headsetaudio-headphones 条目。当 BlueZ 返回这些值时,QMap::operator[] 返回空字符串,bluetoothadapteritem.cpp 回退到 bluetooth_other,而控制中心显示 bluetooth_pheadset,导致不一致。

修复方案

plugins/dde-dock/bluetooth/componments/device.cppdeviceType2Icon 中补充 audio-headsetaudio-headphones 条目,映射到 pheadset(与 audio-card 一致),使任务栏与控制中心图标对齐。

改动

1 个文件,2 行新增。低风险,bluetooth_pheadset_16px.svg 资源已存在。

Summary by Sourcery

Bug Fixes:

  • Add icon mappings for audio-headset and audio-headphones Bluetooth device types so they display the correct headset icon instead of the generic Bluetooth icon in the taskbar.

@sourcery-ai

sourcery-ai Bot commented Aug 11, 2026

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

Reviewer's Guide

Adds missing Bluetooth device type to icon mappings so taskbar device icons match the control center for audio headsets/headphones.

Sequence diagram for Bluetooth device type to icon mapping fix

sequenceDiagram
    participant BlueZ
    participant BluetoothAdapterItem
    participant Device
    participant TaskbarUI

    BlueZ->>BluetoothAdapterItem: deviceType (audio-headset)
    BluetoothAdapterItem->>Device: deviceType2Icon[deviceType]
    Device-->>BluetoothAdapterItem: pheadset
    BluetoothAdapterItem->>TaskbarUI: setIcon(bluetooth_pheadset)

    BlueZ->>BluetoothAdapterItem: deviceType (audio-headphones)
    BluetoothAdapterItem->>Device: deviceType2Icon[deviceType]
    Device-->>BluetoothAdapterItem: pheadset
    BluetoothAdapterItem->>TaskbarUI: setIcon(bluetooth_pheadset)
Loading

File-Level Changes

Change Details Files
Extend Bluetooth device type-to-icon mapping to handle audio headset and headphone device types consistently.
  • Add mapping from BlueZ device type audio-headset to pheadset icon key in the deviceType2Icon map.
  • Add mapping from BlueZ device type audio-headphones to pheadset icon key in the deviceType2Icon map.
plugins/dde-dock/bluetooth/componments/device.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.

@caixr23
caixr23 force-pushed the agent/pms-bug-bot/fix-bt-icon-275675 branch 2 times, most recently from db5cbe3 to f22c83f Compare August 12, 2026 08:43
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, caixr23

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

@caixr23
caixr23 force-pushed the agent/pms-bug-bot/fix-bt-icon-275675 branch from f22c83f to 0ee57a6 Compare August 12, 2026 09:41
1. Add audio-headset and audio-headphones entries to deviceType2Icon,
   mapping both to pheadset to match audio-card, so the taskbar renders
   bluetooth_pheadset instead of falling back to bluetooth_other
2. Update SPDX copyright year to 2026

PMS: BUG-275675

fix: 任务栏蓝牙音频设备图标与控制中心对齐

1. 在 deviceType2Icon 中补充 audio-headset 和 audio-headphones 条目,
   均映射到 pheadset,与 audio-card 一致,使任务栏渲染
   bluetooth_pheadset 而非回退到 bluetooth_other
2. 更新 SPDX 版权年份至 2026

PMS: BUG-275675
@caixr23
caixr23 force-pushed the agent/pms-bug-bot/fix-bt-icon-275675 branch from 0ee57a6 to cb5ea1b Compare August 14, 2026 00:58
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:100分

■ 【总体评价】

代码补全了蓝牙音频设备类型的图标映射,修复了特定设备图标缺失问题
逻辑正确且无任何安全风险,得满分

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

新增的两行映射代码位于 plugins/dde-dock/bluetooth/componments/device.cpp 的 Device::deviceType2Icon 静态变量初始化列表中,符合 C++11 列表初始化语法,无编译错误或逻辑缺陷
潜在问题:无
建议:无需修改

  • 2.代码质量(良好)✓

新增代码缩进、命名风格与上下文完全一致,版权年份更新符合开源项目常规维护规范
潜在问题:无
建议:无需修改

  • 3.代码性能(高效)✓

仅在静态 QMap 中新增两个键值对,属于编译期常量初始化,运行时无额外性能开销
建议:无需修改

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
代码仅涉及静态只读数据结构初始化,不包含任何外部输入处理、内存分配或系统调用,无攻击面

  • 建议:无需修改

■ 【改进建议代码示例】

// 当前代码已足够优秀,无需改进,以下为确认后的最终形态
QMap<QString, QString> Device::deviceType2Icon = {
    {"input-gaming", "other"},
    {"input-tablet", "touchpad"},
    {"audio-card", "pheadset"},
    {"audio-headset", "pheadset"},
    {"audio-headphones", "pheadset"},
    {"network-wireless", "lan"},
    {"camera-video", "vidicon"},
    {"printer", "print"},
};

@caixr23
caixr23 merged commit 6ee06fb into linuxdeepin:master Aug 14, 2026
12 checks passed
@caixr23
caixr23 deleted the agent/pms-bug-bot/fix-bt-icon-275675 branch August 14, 2026 01:17
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.

3 participants