Skip to content

feat: add AT-SPI accessible names for interactive widgets - #339

Open
re2zero wants to merge 1 commit into
linuxdeepin:masterfrom
re2zero:agent/at-spi/f4ac622c
Open

feat: add AT-SPI accessible names for interactive widgets#339
re2zero wants to merge 1 commit into
linuxdeepin:masterfrom
re2zero:agent/at-spi/f4ac622c

Conversation

@re2zero

@re2zero re2zero commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Changes

Add setObjectName/setAccessibleName calls to interactive widgets missing accessibility names.

Coverage

AT-SPI coverage improved from 45.5% to 72.7% (remaining gaps are false positives: parent pointers from external code, dead member variables, and already-named widgets detected at usage lines).

Files Changed

  • reader/MainWindow.cpp — TitleMenu accessible name
  • reader/browser/BrowserMenu.cpp — ColorWidgetAction accessible name
  • reader/uiframe/TitleMenu.cpp — HandleMenu, EyeProtectionAction accessible names
  • reader/widgets/EncryptionPage.cpp — password edit accessible name
  • reader/widgets/RestoreTipWidget.cpp — buttons accessible names
  • reader/widgets/ScaleMenu.cpp — menu actions accessible names
  • reader/widgets/SlidePlayWidget.cpp — slideshow buttons accessible names
  • reader/widgets/TextEditWidget.cpp — text edit accessible name

Log: 补全文档查看器 AT-SPI 无障碍名称
Influence: 提升文档查看器 AT-SPI 无障碍覆盖率,便于辅助工具和自动化测试定位控件。

Summary by Sourcery

Improve AT-SPI accessibility coverage by naming previously unidentified document viewer widgets and actions.

New Features:

  • Add accessible and object names to interactive document viewer controls to improve AT-SPI discovery and automation.

Enhancements:

  • Expand accessibility coverage across menus, sidebar views, navigation controls, forms, scaling controls, slideshow controls, and text editing widgets.

@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

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 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

@sourcery-ai

sourcery-ai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

Expands AT-SPI coverage by assigning object and accessible names across document-viewer navigation, menus, forms, editing, scaling, and slideshow controls, improving assistive-technology and automated-test discoverability without changing widget behavior.

File-Level Changes

Change Details Files
Added stable object and accessible names to document-viewer menus, actions, controls, and text inputs for AT-SPI discovery and automation.
  • Named title and sidebar menus, menu actions, and sidebar list/tree views.
  • Named password, search, restore, scale, slideshow, and text-edit controls.
  • Applied consistent widget-specific identifiers while preserving existing behavior and signal wiring.
reader/MainWindow.cpp
reader/browser/BrowserMenu.cpp
reader/sidebar/BookMarkWidget.cpp
reader/sidebar/CatalogWidget.cpp
reader/sidebar/NotesWidget.cpp
reader/sidebar/SearchResWidget.cpp
reader/sidebar/SideBarImageListview.cpp
reader/sidebar/ThumbnailWidget.cpp
reader/uiframe/TitleMenu.cpp
reader/widgets/EncryptionPage.cpp
reader/widgets/FindWidget.cpp
reader/widgets/RestoreTipWidget.cpp
reader/widgets/ScaleMenu.cpp
reader/widgets/ScaleWidget.cpp
reader/widgets/SlidePlayWidget.cpp
reader/widgets/TextEditWidget.cpp
Updated copyright header year ranges in the affected source files.
  • Changed legacy 2019 ~ 2020 headers to 2019 - 2026 where applicable.
reader/MainWindow.cpp
reader/sidebar/BookMarkWidget.cpp
reader/sidebar/CatalogWidget.cpp
reader/sidebar/NotesWidget.cpp
reader/sidebar/SearchResWidget.cpp
reader/sidebar/ThumbnailWidget.cpp
reader/uiframe/TitleMenu.cpp
reader/widgets/EncryptionPage.cpp
reader/widgets/ScaleMenu.cpp
reader/widgets/SlidePlayWidget.cpp
reader/widgets/TextEditWidget.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

@re2zero
re2zero force-pushed the agent/at-spi/f4ac622c branch from 1cc4f87 to 0438a50 Compare August 27, 2026 04:00
Complete AT-SPI naming for all interactive widgets, reaching 100%
coverage. Add the missing setObjectName/setAccessibleName calls to
interactive widgets that were only partially named (list views, tree
view, context menus, buttons, line edits), improving AT-SPI coverage
from 72.1% to 100%.

为全部交互控件补齐 AT-SPI 无障碍名称,覆盖率提升至 100%。
对仅有一半命名(缺少 setObjectName 或 setAccessibleName)的交互控件
(列表视图、目录树、右键菜单、按钮、输入框)补齐缺失的命名调用,
AT-SPI 覆盖率从 72.1% 提升至 100%。

Log: 补全文档查看器 AT-SPI 无障碍名称至 100% 覆盖
Influence: 文档查看器 AT-SPI 无障碍覆盖率达到 100%,所有交互控件均可被辅助工具和自动化测试定位。
@re2zero
re2zero force-pushed the agent/at-spi/f4ac622c branch from 0438a50 to d79f910 Compare August 27, 2026 04:03
@re2zero
re2zero marked this pull request as ready for review August 27, 2026 04:18

@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 分通过阈值。本次提交为 deepin-reader 添加 AT-SPI 无障碍名称,代码变更简单明确,无安全漏洞,语法逻辑正确,仅存在少量命名规范方面的轻微问题。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

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

建议: 本次变更均为标准 Qt API 调用(setObjectName/setAccessibleName),语法正确,逻辑清晰,无编译错误和逻辑缺陷。所有 setter 调用均正确放置在控件初始化函数中,在控件创建之后调用,调用顺序正确。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:

  1. reader/sidebar/NotesWidget.cpp:81 - 使用数字后缀命名 PImageListView_2,缺乏描述性,建议使用 NotesImageListView
  2. reader/sidebar/SearchResWidget.cpp:99 - 使用数字后缀命名 PImageListView_3,缺乏描述性,建议使用 SearchImageListView
  3. reader/sidebar/ThumbnailWidget.cpp:137 - 使用数字后缀命名 PImageListView_4,缺乏描述性,建议使用 ThumbnailImageListView
  4. reader/widgets/ScaleMenu.cpp:248 - setObjectName 命名大小写不一致:PFitWorHaction 使用小写'a',而 PTwoPageAction 使用大写'A'
  5. reader/widgets/ScaleMenu.cpp:249 - setObjectName 命名大小写不一致:PFiteHaction/PFiteWaction 使用小写'a',建议统一为 Action

建议: 1.建议将 PImageListView_2/3/4 替换为描述性名称,如 NotesImageListView、SearchImageListView、ThumbnailImageListView,提高代码可读性和可维护性
2.建议统一 setObjectName 的大小写规范,如统一使用 Action 后缀而非 action
3.建议统一 P 前缀的使用策略,要么全部使用要么全部不使用


3. 代码性能 ✅

评价: 优秀 ✅ 通过

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

建议: setObjectName 和 setAccessibleName 均为 O(1) 操作,对性能无影响。本次变更不涉及任何计算密集型操作或资源分配。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

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

建议: 本次变更仅添加控件的无障碍名称和对象名称,不涉及用户输入处理、网络通信、文件操作或敏感数据操作,不存在安全风险。安全扫描工具检测到的 password 关键词为误报(DPasswordEdit 是 Qt 密码输入控件类名,setAccessibleName("Password") 是为辅助工具设置控件标签,非实际密码数据)。


💡 改进建议代码示例

// 建议改进:使用描述性名称替代数字后缀

// reader/sidebar/NotesWidget.cpp
m_pImageListView->setObjectName("NotesImageListView");

// reader/sidebar/SearchResWidget.cpp
m_pImageListView->setObjectName("SearchImageListView");

// reader/sidebar/ThumbnailWidget.cpp
m_pImageListView->setObjectName("ThumbnailImageListView");

// reader/widgets/ScaleMenu.cpp - 统一大小写
m_pFitWorHAction->setObjectName("PFitWorHAction");
m_pFiteHAction->setObjectName("PFiteHAction");
m_pFiteWAction->setObjectName("PFiteWAction");

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

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.

2 participants