Skip to content

fix(accessibility): 补全设备管理器 AT-SPI 无障碍名称 - #737

Merged
deepin-bot[bot] merged 2 commits into
linuxdeepin:masterfrom
re2zero:fix/at-spi-completion-20260828
Aug 31, 2026
Merged

fix(accessibility): 补全设备管理器 AT-SPI 无障碍名称#737
deepin-bot[bot] merged 2 commits into
linuxdeepin:masterfrom
re2zero:fix/at-spi-completion-20260828

Conversation

@re2zero

@re2zero re2zero commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

概述

deepin-devicemanager(设备管理器)中的交互控件补全 AT-SPI 无障碍名称(setObjectName/setAccessibleName),使无障碍工具和 YouQu AT 测试能正确定位控件。

补全内容

对 15 个源文件中的 43 个交互控件添加了 setObjectName/setAccessibleName:

文件 补全控件数
MainWindow.cpp 1
PageDriverRestoreInfo.cpp 1
PageListView.cpp 2
PageOverview.cpp 3
PageSingleInfo.cpp 8
CmdButtonWidget.cpp 1
DetailTreeView.cpp 1
DetectedStatusWidget.cpp 5
DriverScanWidget.cpp 2
GetDriverPathWidget.cpp 1
TableWidget.cpp 7
TextBrowser.cpp 3
UrlChooserEdit.cpp 2
driveritem.cpp 2
logtreeview.cpp 1

覆盖率对比

指标 补全前 补全后
交互控件总数 43 44
已命名控件 0 44
缺失名称 43 0
覆盖率 0.0% 100.0%

验证

  • 使用 coverage_stats.py 重新扫描,覆盖率从 0% 提升至 100%
  • 阈值 80% → PASS

Summary by Sourcery

Complete AT-SPI accessibility naming across the device manager's interactive controls.

Bug Fixes:

  • Add AT-SPI object and accessible names to interactive device-manager controls so accessibility tools and automated tests can reliably locate them.

Tests:

  • Verify that all identified interactive controls have accessibility names and that coverage reaches 100%, exceeding the required threshold.

Chores:

  • Update copyright years in the modified source files.

@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@sourcery-ai

sourcery-ai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Reviewer's Guide

Completes AT-SPI object and accessible naming for the device manager’s interactive controls across 15 UI source files, including dynamically shown menus, and validates 100% naming coverage against the required threshold.

File-Level Changes

Change Details Files
Add stable AT-SPI identifiers to interactive controls and contextual menus throughout the device manager.
  • Assign matching object and accessible names to buttons, actions, menus, inputs, views, checkboxes, scrollbars, and headers.
  • Apply naming during widget initialization or immediately after dynamic control creation, including context-menu construction paths.
deepin-devicemanager/src/Page/MainWindow.cpp
deepin-devicemanager/src/Page/PageDriverRestoreInfo.cpp
deepin-devicemanager/src/Page/PageListView.cpp
deepin-devicemanager/src/Page/PageOverview.cpp
deepin-devicemanager/src/Page/PageSingleInfo.cpp
deepin-devicemanager/src/Widget/CmdButtonWidget.cpp
deepin-devicemanager/src/Widget/DetailTreeView.cpp
deepin-devicemanager/src/Widget/DetectedStatusWidget.cpp
deepin-devicemanager/src/Widget/DriverScanWidget.cpp
deepin-devicemanager/src/Widget/GetDriverPathWidget.cpp
deepin-devicemanager/src/Widget/TableWidget.cpp
deepin-devicemanager/src/Widget/TextBrowser.cpp
deepin-devicemanager/src/Widget/UrlChooserEdit.cpp
deepin-devicemanager/src/Widget/driveritem.cpp
deepin-devicemanager/src/Widget/logtreeview.cpp
Validate complete accessibility-name coverage for the identified interactive controls.
  • Rescan the source with coverage_stats.py and confirm all 44 controls are named.
  • Confirm coverage reaches 100% and exceeds the 80% threshold.
coverage_stats.py

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

Comment thread deepin-devicemanager/src/Widget/UrlChooserEdit.cpp Outdated
@re2zero
re2zero force-pushed the fix/at-spi-completion-20260828 branch from 0168f7c to 58501ba Compare August 28, 2026 06:29
为设备管理器中的交互控件补全 setObjectName/setAccessibleName,
覆盖按钮、树视图、表头、操作菜单等 43 个控件,使无障碍工具和
YouQu AT 测试能正确定位控件。

Log: 补全设备管理器AT-SPI无障碍名称
Influence: AT-SPI覆盖率从0%提升至100%,无障碍工具可正确定位控件
@re2zero
re2zero force-pushed the fix/at-spi-completion-20260828 branch from 58501ba to 5065c01 Compare August 28, 2026 08:56
@re2zero
re2zero marked this pull request as ready for review August 28, 2026 09:13

@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

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, re2zero

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

@re2zero

re2zero commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot

deepin-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This pr cannot be merged! (status: unstable)

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

AI 代码审查报告


总体评价

总体评分:99分 | 风险等级:无

代码审查通过。本次提交为无障碍(AT-SPI)改进,为设备管理器中43个交互控件补全 setObjectName/setAccessibleName 调用,代码实现正确、安全、无性能影响,符合 commit 目的。


变更概述


详细分析

1. 语法逻辑 [25/25] ✓ 语法正确,逻辑清晰

所有新增的 setObjectName()setAccessibleName() 调用均为 Qt 标准API,语法正确。方法调用顺序合理:均在控件创建之后(构造函数初始化列表或 initWindow()/initUI()/initWidgets() 调用之后)执行,不存在空指针解引用风险。版权年份更新(如 20222022 - 2026)格式规范。

潜在问题:
✅ 未发现语法逻辑问题


2. 代码质量 [24/25] ✓ 代码结构清晰,注释完整

代码结构合理,setObjectNamesetAccessibleName 调用放置在控件创建后的合适位置。命名采用 "Mp" 前缀 + 控件变量名的格式(如 "MpButtonBox""MpRefresh"),保持一致性。QAction 类控件(如 mp_Refreshmp_Export)仅设置 setObjectName 而不设置 setAccessibleName,这是正确的做法,因为 QAction 的无障碍名称从其文本属性获取。

潜在问题:
1.多个文件的 slotShowMenu() 方法中每次显示菜单时重复设置 setObjectName/setAccessibleName(PageListView.cpp:143、PageOverview.cpp:209、PageSingleInfo.cpp:261、TextBrowser.cpp:227、TableWidget.cpp:273)。虽然 Qt 的 setObjectName 是幂等操作不会产生错误,但将菜单的 objectName/accessibleName 设置移到构造函数中一次性初始化更为规范,避免每次右键操作时执行冗余调用。


3. 代码性能 [20/20] ✓ 性能良好,资源使用合理

setObjectName()setAccessibleName() 均为轻量级字符串赋值操作,不涉及内存分配、系统调用或复杂计算。新增代码对运行时性能无可观测影响。

潜在问题:
✅ 未发现性能问题


4. 代码安全 [30/30] ✓ 存在0个安全漏洞

所有新增代码仅使用硬编码字符串常量作为控件标识符,不涉及用户输入、命令执行、文件操作或网络请求。无注入风险、无敏感信息泄露。

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个

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


评分明细

维度 得分 满分 状态 评价
语法逻辑 25 25 语法正确,逻辑清晰
代码质量 24 25 代码结构清晰,注释完整
代码性能 20 20 性能良好,资源使用合理
代码安全 30 30 存在0个安全漏洞
总分 99 100 代码审查通过

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

@re2zero

re2zero commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit ca73af6 into linuxdeepin:master Aug 31, 2026
17 checks passed
@re2zero
re2zero deleted the fix/at-spi-completion-20260828 branch August 31, 2026 03:06
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