Registry Mirror
Skip to content

Conversation

@wjyrich

@wjyrich wjyrich commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
  1. Change window flags from WindowStaysOnTopHint/Tool to Dialog with close button hint
  2. Add --parent-window option to set transient parent via X11 window ID
  3. Skip manual centering when a parent window is set, letting the WM position the dialog
  4. Ensure the close button is always visible and connected to close the window
  5. Exit the application after the window closes in closeEvent to avoid lingering processes with a foreign parent
  6. Dim the background opacity of disabled buttons and skip highlight text color when disabled
  7. Add spacing and titlebar margins for proper icon and close button layout
  8. Add unit tests for consent gating, disabled button rendering, dialog flags, and close behavior

Log: Fixed license dialog staying on top and added parent window support with proper close button behavior

Influence:

  1. Verify the dialog no longer stays above other applications on both X11 and Wayland
  2. Test the --parent-window option with a valid X11 window ID and confirm the dialog is transient to the parent
  3. Confirm the window manager centers the dialog relative to the parent when a parent is provided
  4. Verify manual centering still works when no parent window is specified
  5. Test the close button closes the window and exits the application in all launch modes (with/without titlebar icon, with/without hide-bottom)
  6. Verify the close button is always visible and functional
  7. Test that the accept button remains disabled until the consent checkbox is checked
  8. Verify disabled buttons have a dimmed background and no highlight text color
  9. Run the unit tests to confirm all new test cases pass

fix: 优化许可对话框窗口行为

  1. 将窗口标志从 WindowStaysOnTopHint/Tool 改为带关闭按钮提示的 Dialog
  2. 添加 --parent-window 选项,通过 X11 窗口 ID 设置临时父窗口
  3. 设置父窗口时跳过手动居中,由窗口管理器定位对话框
  4. 确保关闭按钮始终可见并连接到关闭窗口操作
  5. 在 closeEvent 中关闭窗口后退出应用,避免存在外部父窗口时进程残留
  6. 降低禁用按钮的背景透明度,禁用时跳过高亮文字颜色
  7. 添加间距和标题栏边距以正确布局图标和关闭按钮
  8. 添加针对同意勾选控制、禁用按钮渲染、对话框标志和关闭行为的单元测试

Log: 修复许可对话框置顶问题,新增父窗口支持并完善关闭按钮行为

Influence:

  1. 验证对话框在 X11 和 Wayland 下不再始终置顶于其他应用之上
  2. 使用有效的 X11 窗口 ID 测试 --parent-window 选项,确认对话框为父窗口 的临时窗口
  3. 确认提供父窗口时窗口管理器相对父窗口居中对话框
  4. 验证未指定父窗口时手动居中仍然有效
  5. 在所有启动模式下测试关闭按钮关闭窗口并退出应用(有无标题栏图标、有无 隐藏底部)
  6. 验证关闭按钮始终可见且可用
  7. 测试同意勾选框未勾选时接受按钮保持禁用
  8. 验证禁用按钮背景变暗且无高亮文字颜色
  9. 运行单元测试确认所有新增测试用例通过

PMS: BUG-380347

Summary by Sourcery

Improve license dialog window management, parent integration, close behavior, and visual states.

New Features:

  • Add support for associating the license dialog with a specified X11 parent window through a command-line option.

Bug Fixes:

  • Prevent the license dialog from staying above other applications and ensure it closes and terminates the application reliably across launch configurations.
  • Improve disabled button appearance and keep the close control visible and functional.

Enhancements:

  • Allow the window manager to position transient dialogs while retaining manual centering for standalone dialogs.
  • Improve title bar spacing, margins, and focus behavior for the license window.

Tests:

  • Add coverage for consent-dependent confirmation, disabled button rendering, window stacking flags, close-button behavior, and focus handling.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wjyrich

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

@wjyrich

wjyrich commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

@sourcery-ai

sourcery-ai Bot commented Oct 28, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR converts the license window into a standard closeable dialog with optional X11 transient-parent support, delegates parented positioning to the window manager, ensures reliable close-and-exit behavior, refines titlebar and disabled-button styling, and adds regression tests for the primary interaction and window-state changes.

Sequence diagram for license dialog startup and closing

sequenceDiagram
    participant User
    participant Application
    participant MainWindow
    participant WindowManager

    User->>Application: start with --parent-window
    Application->>Application: QWindow::fromWinId
    Application->>MainWindow: setTransientParent
    Application->>WindowManager: show transient dialog
    WindowManager-->>MainWindow: position relative to parent
    MainWindow-->>User: display closeable dialog
    User->>MainWindow: click close button
    MainWindow->>MainWindow: closeEvent
    MainWindow->>Application: qApp->exit(0)
Loading

Flow diagram for license consent gating

flowchart TD
    Start([Dialog displayed]) --> Consent{Consent checkbox checked?}
    Consent -->|No| Disabled[Accept button disabled]
    Consent -->|Yes| Enabled[Accept button enabled]
    Disabled --> Consent
    Enabled --> Accept[User accepts license]
Loading

File-Level Changes

Change Details Files
Reworked the dialog window lifecycle and positioning to behave as a normal transient dialog instead of an always-on-top utility window.
  • Replaced platform-specific always-on-top/tool flags with dialog and close-button hints.
  • Added optional hexadecimal/decimal X11 parent-window parsing and transient-parent assignment.
  • Skipped manual centering for parented dialogs while retaining it for standalone launches.
  • Added deferred focus activation and application exit handling after accepted close events.
dde-license-dialog/src/main.cpp
dde-license-dialog/src/mainwindow.cpp
dde-license-dialog/src/mainwindow.h
Made the title bar and close control consistently visible and correctly laid out across launch configurations.
  • Connected the close button directly to window closing.
  • Enabled the close button independently of titlebar icon and bottom-content settings.
  • Added titlebar margins, content spacing, and a default titlebar icon.
  • Synchronized the native window title with the localized dialog title.
dde-license-dialog/src/mainwindow.cpp
Adjusted disabled-button styling to distinguish unavailable actions without applying active-state highlighting.
  • Reduced disabled button background opacity.
  • Applied highlight text color only while the button is enabled.
dde-license-dialog/src/content.cpp
Added regression coverage for consent gating, rendering, dialog flags, focus, and close behavior.
  • Verified acceptance remains disabled until consent is checked.
  • Compared rendered enabled and disabled button appearance.
  • Checked dialog flags, close-button visibility, and absence of always-on-top behavior.
  • Verified initial focus state and that the close button hides the window.
dde-license-dialog/tests/ut_content.cpp
dde-license-dialog/tests/ut_mainwindow.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 ✨

1. Change window flags from WindowStaysOnTopHint/Tool to Dialog with
close button hint
2. Add --parent-window option to set transient parent via X11 window ID
3. Skip manual centering when a parent window is set, letting the WM
position the dialog
4. Ensure the close button is always visible and connected to close
the window
5. Exit the application after the window closes in closeEvent to avoid
lingering processes with a foreign parent
6. Dim the background opacity of disabled buttons and skip highlight
text color when disabled
7. Add spacing and titlebar margins for proper icon and close button
layout
8. Add unit tests for consent gating, disabled button rendering, dialog
flags, and close behavior

Log: Fixed license dialog staying on top and added parent window support
with proper close button behavior

Influence:
1. Verify the dialog no longer stays above other applications on both
X11 and Wayland
2. Test the --parent-window option with a valid X11 window ID and
confirm the dialog is transient to the parent
3. Confirm the window manager centers the dialog relative to the parent
when a parent is provided
4. Verify manual centering still works when no parent window is
specified
5. Test the close button closes the window and exits the application in
all launch modes (with/without titlebar icon, with/without hide-bottom)
6. Verify the close button is always visible and functional
7. Test that the accept button remains disabled until the consent
checkbox is checked
8. Verify disabled buttons have a dimmed background and no highlight
text color
9. Run the unit tests to confirm all new test cases pass

fix: 优化许可对话框窗口行为

1. 将窗口标志从 WindowStaysOnTopHint/Tool 改为带关闭按钮提示的 Dialog
2. 添加 --parent-window 选项,通过 X11 窗口 ID 设置临时父窗口
3. 设置父窗口时跳过手动居中,由窗口管理器定位对话框
4. 确保关闭按钮始终可见并连接到关闭窗口操作
5. 在 closeEvent 中关闭窗口后退出应用,避免存在外部父窗口时进程残留
6. 降低禁用按钮的背景透明度,禁用时跳过高亮文字颜色
7. 添加间距和标题栏边距以正确布局图标和关闭按钮
8. 添加针对同意勾选控制、禁用按钮渲染、对话框标志和关闭行为的单元测试

Log: 修复许可对话框置顶问题,新增父窗口支持并完善关闭按钮行为

Influence:
1. 验证对话框在 X11 和 Wayland 下不再始终置顶于其他应用之上
2. 使用有效的 X11 窗口 ID 测试 --parent-window 选项,确认对话框为父窗口
的临时窗口
3. 确认提供父窗口时窗口管理器相对父窗口居中对话框
4. 验证未指定父窗口时手动居中仍然有效
5. 在所有启动模式下测试关闭按钮关闭窗口并退出应用(有无标题栏图标、有无
隐藏底部)
6. 验证关闭按钮始终可见且可用
7. 测试同意勾选框未勾选时接受按钮保持禁用
8. 验证禁用按钮背景变暗且无高亮文字颜色
9. 运行单元测试确认所有新增测试用例通过

PMS: BUG-380347
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交旨在改进许可证对话框的窗口行为,包括移除置顶标记、支持父窗口_transient关系、 统一关闭按钮行为、改善禁用态按钮视觉效果及新增测试用例。代码逻辑正确,消除原有的 重复信号连接问题,使用RAII管理外部窗口资源,注释清晰。仅存在少量魔法数字硬编码的轻微问题, 无安全漏洞,整体质量优秀。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

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

建议: ['无需修改,语法逻辑正确。']


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

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

建议: ['将透明度值(0.15/0.06/0.25)和布局间距(40)提取为命名常量,如kEnabledOpacity/kDisabledOpacity/kLayoutMargin,提升可维护性']


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

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

建议: ['无需修改,性能良好。']


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

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

建议: ['无需修改,安全合规。']


💡 改进建议代码示例

// 建议将魔法数字提取为命名常量(content.cpp)
class LicenseDialogButton : public DPushButton
{
    static constexpr qreal kEnabledOpacity = 0.15;
    static constexpr qreal kDisabledOpacity = 0.06;
    static constexpr qreal kSunkenOpacity = 0.25;
    // ...
protected:
    void initStyleOption(QStyleOptionButton *option) const override
    {
        DPushButton::initStyleOption(option);
        const bool enabled = option->state.testFlag(QStyle::State_Enabled);
        qreal backgroundOpacity = enabled ? kEnabledOpacity : kDisabledOpacity;
        if (enabled) {
            if (option->state.testFlag(QStyle::State_Sunken)) {
                backgroundOpacity = kSunkenOpacity;
            }
            // ...
        }
    }
};

本报告由 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