Skip to content

feat: add FashionAlignment mode for dock panel#1657

Open
wjyrich wants to merge 1 commit into
linuxdeepin:masterfrom
wjyrich:fashionMode
Open

feat: add FashionAlignment mode for dock panel#1657
wjyrich wants to merge 1 commit into
linuxdeepin:masterfrom
wjyrich:fashionMode

Conversation

@wjyrich

@wjyrich wjyrich commented Jul 2, 2026

Copy link
Copy Markdown
Contributor
  1. Implement new FashionAlignment enum value (2) for dock item alignment
  2. Create FashionDockController QML component to manage fashion dock layout and appearance
  3. Add "Fashion Mode" menu item in dock context menu for easy mode switching
  4. Integrate fashion dock logic into main dock window: adjust width, anchors, margins, window radius, and blur effects
  5. Update showdesktop and taskmanager to be hidden or behave differently in fashion mode
  6. Ensure width animation when entering/exiting fashion mode
  7. Add appropriate DTK blur and styling for fashion dock appearance
  8. Update string conversion functions to support the new "fashion" alignment
  9. Hide left part and adjust spacing in fashion mode for a compact, floating design

Log: Added new dock fashion alignment mode with floating UI and compact layout

Influence:

  1. Test switching between Center, Left, and Fashion alignment modes via context menu
  2. Verify fashion mode only enables on Bottom/Top positions and not in column layout
  3. Check that showdesktop widget is hidden in fashion mode
  4. Verify dock width and margin adjustments in fashion mode (floating margin, vertical padding)
  5. Test taskmanager behavior in fashion mode (no remaining space calculation, no text calculator)
  6. Verify blur and color blending correctness in fashion mode for both light and dark themes
  7. Test width animation when enabling/disabling fashion mode
  8. Verify dock exclusion zone includes floating margin in fashion mode
  9. Test on different screen sizes and DPI settings
  10. Validate that left part and its items are hidden in fashion mode

feat: 新增时尚模式对齐方式

  1. 实现新的时尚模式对齐枚举值 (2),用于 dock 面板的项目对齐
  2. 创建 FashionDockController QML 组件,管理时尚模式布局和外观
  3. 在 dock 右键菜单中添加 "时尚模式" 菜单项,便于模式切换
  4. 将时尚模式逻辑集成到主 dock 窗口中:调整宽度、锚点、边距、窗口圆角和 模糊效果
  5. 更新显示桌面和任务管理器,使其在时尚模式下隐藏或改变行为
  6. 在进入/退出时尚模式时启用宽度动画
  7. 为时尚模式外观添加合适的 DTK 模糊和样式
  8. 更新字符串转换函数以支持新的 "fashion" 对齐方式
  9. 在时尚模式下隐藏左侧部分并调整间距,实现紧凑浮动设计

Log: 新增时尚模式对齐方式,浮动UI和紧凑布局

Influence:

  1. 通过右键菜单测试中心、左对齐和时尚模式之间的切换
  2. 验证时尚模式仅在底部/顶部位置且非列布局时启用
  3. 检查显示桌面小部件在时尚模式下是否隐藏
  4. 验证时尚模式下的 dock 宽度和边距调整(浮动边距、垂直内边距)
  5. 测试任务管理器在时尚模式下的行为(无剩余空间计算、无文本计算器)
  6. 验证时尚模式下浅色和深色主题的模糊和颜色混合正确性
  7. 测试启用/禁用时尚模式时的宽度动画
  8. 验证时尚模式下 dock 排除区域包含浮动边距
  9. 在不同屏幕尺寸和 DPI 设置下进行测试
  10. 验证左侧部分及其项目在时尚模式下是否隐藏

@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.

Sorry @wjyrich, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@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 force-pushed the fashionMode branch 2 times, most recently from 9410317 to 4004041 Compare July 2, 2026 12:15
1. Implement new FashionAlignment enum value (2) for dock item alignment
2. Create FashionDockController QML component to manage fashion dock
layout and appearance
3. Add "Fashion Mode" menu item in dock context menu for easy mode
switching
4. Integrate fashion dock logic into main dock window: adjust width,
anchors, margins, window radius, and blur effects
5. Update showdesktop and taskmanager to be hidden or behave differently
in fashion mode
6. Ensure width animation when entering/exiting fashion mode
7. Add appropriate DTK blur and styling for fashion dock appearance
8. Update string conversion functions to support the new "fashion"
alignment
9. Hide left part and adjust spacing in fashion mode for a compact,
floating design

Log: Added new dock fashion alignment mode with floating UI and compact
layout

Influence:
1. Test switching between Center, Left, and Fashion alignment modes via
context menu
2. Verify fashion mode only enables on Bottom/Top positions and not in
column layout
3. Check that showdesktop widget is hidden in fashion mode
4. Verify dock width and margin adjustments in fashion mode (floating
margin, vertical padding)
5. Test taskmanager behavior in fashion mode (no remaining space
calculation, no text calculator)
6. Verify blur and color blending correctness in fashion mode for both
light and dark themes
7. Test width animation when enabling/disabling fashion mode
8. Verify dock exclusion zone includes floating margin in fashion mode
9. Test on different screen sizes and DPI settings
10. Validate that left part and its items are hidden in fashion mode

feat: 新增时尚模式对齐方式

1. 实现新的时尚模式对齐枚举值 (2),用于 dock 面板的项目对齐
2. 创建 FashionDockController QML 组件,管理时尚模式布局和外观
3. 在 dock 右键菜单中添加 "时尚模式" 菜单项,便于模式切换
4. 将时尚模式逻辑集成到主 dock 窗口中:调整宽度、锚点、边距、窗口圆角和
模糊效果
5. 更新显示桌面和任务管理器,使其在时尚模式下隐藏或改变行为
6. 在进入/退出时尚模式时启用宽度动画
7. 为时尚模式外观添加合适的 DTK 模糊和样式
8. 更新字符串转换函数以支持新的 "fashion" 对齐方式
9. 在时尚模式下隐藏左侧部分并调整间距,实现紧凑浮动设计

Log: 新增时尚模式对齐方式,浮动UI和紧凑布局

Influence:
1. 通过右键菜单测试中心、左对齐和时尚模式之间的切换
2. 验证时尚模式仅在底部/顶部位置且非列布局时启用
3. 检查显示桌面小部件在时尚模式下是否隐藏
4. 验证时尚模式下的 dock 宽度和边距调整(浮动边距、垂直内边距)
5. 测试任务管理器在时尚模式下的行为(无剩余空间计算、无文本计算器)
6. 验证时尚模式下浅色和深色主题的模糊和颜色混合正确性
7. 测试启用/禁用时尚模式时的宽度动画
8. 验证时尚模式下 dock 排除区域包含浮动边距
9. 在不同屏幕尺寸和 DPI 设置下进行测试
10. 验证左侧部分及其项目在时尚模式下是否隐藏
@wjyrich

wjyrich commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:95分

■ 【总体评价】

代码实现了任务栏时尚模式的布局与样式控制,逻辑清晰且无安全风险
逻辑正确、结构良好、性能高效,仅在极少数边界条件处理上可进一步加固

■ 【详细分析】

  • 1.语法逻辑 正确 ✓

代码在枚举扩展、字符串映射转换以及QML属性绑定链路上保持了高度一致性。FashionDockController.qml 中通过 enabled 属性作为总开关,精准控制了 contentWidtheffectiveShellWidth() 的计算分支。main.qml 中对窗口宽度的计算使用了 Math.max(1, fashionDock.effectiveShellWidth()),有效防止了窗口尺寸为0导致的渲染异常。TaskManager.qml 中针对 horizontalFashionMode 和垂直时尚模式的尺寸计算进行了提前返回,避免了后续复杂逻辑的干扰。
潜在问题:main.qml 中计算 dockRawCenterSpace 时,直接调用了 Math.ceil(gridLayout.columnSpacing),若 gridLayout.columnSpacing 意外为 undefined,会导致 Math.ceil(undefined) 返回 NaN,从而使 space 污染为 NaN,破坏后续的布局计算。
建议:对 gridLayout.columnSpacing 进行空值合并处理,如 Math.ceil(gridLayout.columnSpacing || 0),确保数值运算的绝对安全。

  • 2.代码质量 良好 ✓

新增功能遵循了单一职责原则,将时尚模式的核心计算逻辑独立抽离至 FashionDockController.qml,降低了 main.qml 的复杂度。属性命名如 topModebottomModefloatingMargin 语义清晰。在 main.qml 中对扣除间距的逻辑增加了明确的中文注释,提升了可维护性。各子模块(如 showdesktop.qmlTaskManager.qml)通过读取 fashionDock.enabled 状态自行调整行为,解耦合理。
潜在问题:无
建议:无

  • 3.代码性能 高效 ✓

FashionDockController.qml 中的属性均声明为 readonly property,依赖于基础的数值属性变化,没有引入任何循环依赖或高频重算的监听器。effectiveShellWidth() 函数仅包含一次简单的 Math.min 比较,contentWidth 也只包含基础的加法与条件判断,计算开销可忽略不计。禁用 TextCalculator 在时尚模式下的运行,也合理减少了不必要的文本测量开销。
潜在问题:无
建议:无

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

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次提交完全聚焦于前端UI布局调整与样式计算,不涉及任何系统命令执行、文件路径拼接、网络请求或敏感权限申请,不存在命令注入、路径遍历等攻击面,代码安全可靠。

  • 建议:继续保持在UI层避免引入后端交互与特权调用的设计原则。

■ 【改进建议代码示例】

// main.qml 中的 dockRawCenterSpace 计算逻辑优化
readonly property int dockRawCenterSpace: {
    if (useColumnLayout) {
        return Screen.height - dockLeftPart.implicitHeight - dockRightPart.implicitHeight;
    } else {
        let space = Screen.width - dockLeftPart.implicitWidth - dockRightPart.implicitWidth;
        if (fashionDock.enabled && gridLayout) {
            // 时尚模式下,dockRightPart 在 gridLayout 右侧,之间需要扣除 dockSpacing
            // 这是为了确保 gridLayout 的宽度 + dockSpacing + rightPart 宽度 <= screenWidth
            // 增加 || 0 防止 columnSpacing 未定义导致 NaN 污染计算结果
            space -= Math.ceil(gridLayout.columnSpacing || 0);
        }
        return Math.max(0, space);
    }
}

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