Skip to content

fix(ui): simplify titlebar responsive logic and make about dialog modal#666

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
add-uos:master
Mar 10, 2026
Merged

fix(ui): simplify titlebar responsive logic and make about dialog modal#666
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
add-uos:master

Conversation

@add-uos
Copy link
Contributor

@add-uos add-uos commented Mar 10, 2026

Remove responsive visibility controls based on window width, simplify search box and button visibility logic. Add WindowModal property to AboutDialog.

移除基于窗口宽度的响应式显示控制,简化搜索框和按钮的可见性逻辑。
为关于对话框添加模态属性。

Log: 简化标题栏响应式逻辑,关于对话框改为模态显示
Influence: 标题栏UI逻辑更简洁,不再根据窗口宽度动态隐藏控件,关于对话框显示时阻塞父窗口交互。

Summary by Sourcery

Enhancements:

  • Make the About dialog window-modal so it blocks interaction with the main window when open.

Remove responsive visibility controls based on window width, simplify search
box and button visibility logic. Add WindowModal property to AboutDialog.

移除基于窗口宽度的响应式显示控制,简化搜索框和按钮的可见性逻辑。
为关于对话框添加模态属性。

Log: 简化标题栏响应式逻辑,关于对话框改为模态显示
Influence: 标题栏UI逻辑更简洁,不再根据窗口宽度动态隐藏控件,关于对话框显示时阻塞父窗口交互。
@sourcery-ai
Copy link

sourcery-ai bot commented Mar 10, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Makes the About dialog window-modal and simplifies titlebar responsive UI logic so controls are no longer conditionally hidden based on window width.

Sequence diagram for opening the window-modal About dialog

sequenceDiagram
  actor User
  participant WindowTitlebar
  participant HelpAction
  participant AboutAction
  participant AboutDialog

  User->>WindowTitlebar: click About in titlebar menu
  WindowTitlebar->>HelpAction: trigger help menu
  HelpAction->>AboutAction: trigger About action
  AboutAction->>AboutDialog: create with modality Qt.WindowModal
  AboutAction->>AboutDialog: open dialog
  AboutDialog-->>WindowTitlebar: block interaction while open
  User->>AboutDialog: close dialog
  AboutDialog-->>WindowTitlebar: release interaction after close
Loading

Class diagram for AboutDialog with WindowModal property

classDiagram
  class AboutDialog {
    +string productName
    +string productIcon
    +string description
    +QtWindowModality modality
    +open()
    +close()
  }

  class AboutAction {
    +AboutDialog aboutDialog
    +trigger()
  }

  AboutAction --> AboutDialog : creates_and_opens
Loading

File-Level Changes

Change Details Files
Make the About dialog block interaction with the parent window while open.
  • Set the AboutDialog modality to Qt.WindowModal so the main window cannot be interacted with while the dialog is visible
src/music-player/mainwindow/WindowTitlebar.qml

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

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

deepin pr auto review

这段代码的修改主要是为 AboutDialog 添加了 modality: Qt.WindowModal 属性。以下是对该代码变更的详细审查意见:

1. 语法逻辑

  • 审查结果正确
  • 解释:在 QML 中,modalityWindow 类型(或其派生类型如 Dialog)的一个属性。Qt.WindowModal 是一个有效的枚举值,表示该对话框会阻塞其父窗口(即所属层级树中的父窗口)的输入,但不阻塞应用程序中的其他窗口。语法完全符合 QML 规范。

2. 代码质量

  • 审查结果良好
  • 解释
    • 用户体验:将关于对话框设置为模态对话框是一个很好的设计选择。通常情况下,关于对话框是辅助性的信息展示,用户在查看时不应操作主窗口,以免造成状态混淆。
    • 默认行为:许多 QML 对话框组件如果不显式指定 modality,默认行为可能是非模态(Non-modal)或者是应用级模态(ApplicationModal)。显式指定 Qt.WindowModal 使得意图更加清晰,代码可读性更好。

3. 代码性能

  • 审查结果影响极小
  • 解释:设置模态属性主要影响事件循环和窗口管理器的处理逻辑,不会带来显著的 CPU 或内存开销。这是一个轻量级的属性设置,对性能无负面影响。

4. 代码安全

  • 审查结果无安全风险
  • 解释:此修改仅涉及 UI 交互逻辑,不涉及数据处理、权限控制或外部输入,因此不会引入安全漏洞。

改进建议

虽然当前的修改是正确的,但为了代码的健壮性和可维护性,可以考虑以下几点:

  1. 显式关闭策略
    如果 AboutDialog 继承自 DialogWindow,建议确认是否需要显式设置 closePolicy。例如,是否允许点击背景关闭(Popup.CloseOnPressOutside)或按 ESC 键关闭。

    • 示例:如果希望用户必须点击关闭按钮才能关闭,可以确保没有 Popup.CloseOnPressOutside 标志。
  2. 父窗口关联
    虽然代码结构上 AboutDialogAboutAction 的子对象,但在 QML 中,为了确保窗口层级关系正确,通常建议显式设置 transient parent(临时父窗口)。

    • 示例parent: Window.window(如果组件内部支持)。
  3. 国际化字符串
    代码中使用了 qsTr(),这是一个很好的做法。请确保在 .ts 翻译文件中有对应的翻译,以支持多语言环境。

总结

这是一个低风险、高价值的修改。它通过添加一行代码改善了用户交互体验,防止了用户在打开关于对话框时误操作主窗口。代码逻辑清晰,符合 QML 开发规范。建议采纳。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

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

@add-uos
Copy link
Contributor Author

add-uos commented Mar 10, 2026

/merge

@deepin-bot deepin-bot bot merged commit 7c7e228 into linuxdeepin:master Mar 10, 2026
19 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.

3 participants