Skip to content

feat: add card-type plugin support to dock panel #1659

Open
wjyrich wants to merge 2 commits into
linuxdeepin:masterfrom
wjyrich:CardPlugin
Open

feat: add card-type plugin support to dock panel #1659
wjyrich wants to merge 2 commits into
linuxdeepin:masterfrom
wjyrich:CardPlugin

Conversation

@wjyrich

@wjyrich wjyrich commented Jul 6, 2026

Copy link
Copy Markdown
Contributor
  1. Add Card plugin type to TrayPluginType enum in constants.h
  2. Create CardLeftDockArea QML component for displaying card-type
    plugins in a carousel
  3. Integrate card plugin surfaces into DockCompositor lifecycle (add/
    remove/find)
  4. Implement card area with left-side dock placement, using current/
    index navigation
  5. Support hover effects, page indicators, and wheel navigation for
    card area
  6. Replace legacy left plugin area with CardLeftDockArea when card
    plugins exist

Log: Added card-type plugin display area with carousel navigation in
dock

Influence:

  1. Test card plugin registration and display in dock left area
  2. Verify card plugin area visibility only when card plugins exist
  3. Test mouse wheel navigation through card plugin pages
  4. Verify hover effects and page indicator behavior
  5. Test card plugin surface geometry updates on resize
  6. Verify compatibility with existing tray/quick/fixed plugin types
  7. Test card area behavior in both horizontal and vertical dock modes
  8. Verify area width adapts to dock size and card content

feat: 为任务栏添加卡片类型插件支持

  1. 在 constants.h 中添加 Card 插件类型到 TrayPluginType 枚举
  2. 创建 CardLeftDockArea QML 组件,用于以轮播方式显示卡片类型插件
  3. 将卡片插件表面集成到 DockCompositor 的生命周期(添加/移除/查找)
  4. 实现左侧任务栏卡片区域,支持当前索引/导航
  5. 支持悬停效果、页面指示器和鼠标滚轮导航
  6. 当存在卡片插件时,用 CardLeftDockArea 替换传统的左侧插件区域

Log: 新增卡片类型插件显示区域,支持轮播导航

Influence:

  1. 测试卡片插件的注册和在任务栏左侧区域的显示
  2. 验证卡片插件区域仅在存在卡片插件时可见
  3. 测试通过鼠标滚轮在卡片插件页面间导航
  4. 验证悬停效果和页面指示器的行为
  5. 测试卡片插件表面在窗口大小调整时的几何更新
  6. 验证与现有托盘/快捷/固定插件类型的兼容性
  7. 测试卡片区域在任务栏水平和垂直模式下的表现
  8. 验证区域宽度根据任务栏尺寸和卡片内容自适应
    PMS: TASK-392671

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

@18202781743 18202781743 self-requested a review July 6, 2026 06:56
Comment thread panels/dock/package/main.qml Outdated

Component {
id: cardLeftPart
CardLeftDockArea {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不是可以做成一个applet,去给dock加载,

id: showdesktop
readonly property int showDesktopWidth: 10
property bool useColumnLayout: Panel.position % 2
readonly property bool fashionMode: Panel.rootObject && Panel.rootObject.fashionDock && Panel.rootObject.fashionDock.enabled

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

判断fashionMode不用这么复杂,dock的模式是否是fashioMode即可,Panel.rootObject也不会为空,

@deepin-bot

deepin-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 2.0.50
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1661

@wjyrich wjyrich force-pushed the CardPlugin branch 5 times, most recently from 21b22ce to c581cde Compare July 13, 2026 09:24
Comment thread panels/dock/cardleft/package/CardLeftDockArea.qml Outdated
Comment thread panels/dock/cardleft/package/CardLeftDockArea.qml Outdated
Comment thread panels/dock/cardleft/package/CardLeftDockArea.qml Outdated
Comment thread panels/dock/showdesktop/package/showdesktop.qml Outdated
Comment thread panels/dock/package/main.qml Outdated
@wjyrich wjyrich force-pushed the CardPlugin branch 2 times, most recently from 37c665b to eafdb84 Compare July 14, 2026 07:01
height: parent.height
visible: !!plugin && (index === root.currentIndex || (root.pageTransitioning && index === root.previousIndex))

ShellSurfaceItem {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要不要把ShellSurfaceItemProxy提到dock插件里,这样就能跟tray共用了,

property bool useColumnLayout: Panel.rootObject.useColumnLayout
property int dockOrder: 16
readonly property bool fashionMode: Panel.fashionMode
readonly property bool horizontalFashionMode: fashionMode && !useColumnLayout

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fashionMode 已经包含了!useColumnLayout的语义吧,

Comment thread panels/dock/cardleft/package/metadata.json
1. Add Card plugin type to TrayPluginType enum in constants.h
2. Create CardLeftDockArea QML component for displaying card-type
plugins in a carousel
3. Integrate card plugin surfaces into DockCompositor lifecycle (add/
remove/find)
4. Implement card area with left-side dock placement, using current/
index navigation
5. Support hover effects, page indicators, and wheel navigation for
card area
6. Replace legacy left plugin area with CardLeftDockArea when card
plugins exist

Log: Added card-type plugin display area with carousel navigation in
dock

Influence:
1. Test card plugin registration and display in dock left area
2. Verify card plugin area visibility only when card plugins exist
3. Test mouse wheel navigation through card plugin pages
4. Verify hover effects and page indicator behavior
5. Test card plugin surface geometry updates on resize
6. Verify compatibility with existing tray/quick/fixed plugin types
7. Test card area behavior in both horizontal and vertical dock modes
8. Verify area width adapts to dock size and card content

feat: 为任务栏添加卡片类型插件支持

1. 在 constants.h 中添加 Card 插件类型到 TrayPluginType 枚举
2. 创建 CardLeftDockArea QML 组件,用于以轮播方式显示卡片类型插件
3. 将卡片插件表面集成到 DockCompositor 的生命周期(添加/移除/查找)
4. 实现左侧任务栏卡片区域,支持当前索引/导航
5. 支持悬停效果、页面指示器和鼠标滚轮导航
6. 当存在卡片插件时,用 CardLeftDockArea 替换传统的左侧插件区域

Log: 新增卡片类型插件显示区域,支持轮播导航

Influence:
1. 测试卡片插件的注册和在任务栏左侧区域的显示
2. 验证卡片插件区域仅在存在卡片插件时可见
3. 测试通过鼠标滚轮在卡片插件页面间导航
4. 验证悬停效果和页面指示器的行为
5. 测试卡片插件表面在窗口大小调整时的几何更新
6. 验证与现有托盘/快捷/固定插件类型的兼容性
7. 测试卡片区域在任务栏水平和垂直模式下的表现
8. 验证区域宽度根据任务栏尺寸和卡片内容自适应

PMS: TASK-392671
@wjyrich

wjyrich commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:95分

■ 【总体评价】

代码实现了DDE Shell任务栏的时尚模式及cardleft插件功能,逻辑清晰且无安全漏洞
代码结构合理,QML与C++交互规范,但因部分布局计算逻辑略显复杂扣5分

■ 【详细分析】

  • 1.语法逻辑(基本正确)✓

代码在dockpanel.cpp中新增的fashionMode()函数逻辑正确,仅在顶部或底部且对齐方式为FashionAlignment时返回true。DockCompositor.qml中对Dock.Card类型的处理与现有逻辑保持一致。main.qml中时尚模式的布局调整和尺寸计算逻辑正确,属性绑定合理。
潜在问题:CardLeftDockArea.qml中的updateSurfaceGeometry函数依赖于surfaceHost.Window.window,若在组件销毁过程中调用可能存在空指针风险,但已有if (!plugin || !SwipeView.isCurrentItem || !surfaceHost.Window.window)的判断进行保护。
建议:保持现有的空指针保护逻辑,确保在组件生命周期结束时正确断开信号连接。

  • 2.代码质量(良好)✓

代码命名规范,注释清晰,如main.qml中对时尚模式下空间计算的注释解释了扣除间距的原因。CardLeftDockArea.qml的代码结构清晰,功能模块化。
潜在问题:CardLeftDockArea.qml中存在较多硬编码的数值,如81500.16等,虽然部分有注释或属性名说明,但维护时可能需要统一管理。
建议:考虑将部分硬编码数值提取为更具语义的常量属性,提高可维护性。

  • 3.代码性能(无性能问题)✓

代码在CardLeftDockArea.qml中使用了Timer来防抖处理几何位置更新,避免了频繁的布局计算。main.qml中的属性绑定计算量较小,不会造成性能瓶颈。
潜在问题:无
建议:无

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

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次代码变更主要为UI布局和功能扩展,不涉及网络请求、文件操作或用户输入处理,不存在安全风险。

  • 建议:无

■ 【改进建议代码示例】

// panels/dock/cardleft/package/CardLeftDockArea.qml
// 建议将部分硬编码数值提取为常量属性,提高可维护性
AppletDockItem {
    id: root

    readonly property bool fashionMode: Panel.fashionMode
    readonly property int dockSize: Panel.rootObject.dockSize
    readonly property int hoverInset: 3
    readonly property real taskbarRadius: Panel.rootObject.fashionDock.backgroundRadius
    readonly property real hoverBackgroundRadius: taskbarRadius - hoverInset
    
    // 提取硬编码数值为常量
    readonly property int baseCardLeftWidth: 150
    readonly property real cardLeftWidthScale: 0.25
    readonly property int minRightContentPadding: 10
    readonly property real rightContentPaddingScale: 0.07
    readonly property int minVerticalInset: 5
    readonly property real verticalInsetScale: 0.16
    readonly property int minPageContentHeight: 24
    
    readonly property int adaptiveCardLeftWidth: baseCardLeftWidth + Math.max(0, dockSize * cardLeftWidthScale)
    readonly property int rightContentPadding: Math.max(minRightContentPadding, Math.round(adaptiveCardLeftWidth * rightContentPaddingScale))
    readonly property int verticalInset: Math.max(minVerticalInset, Math.round(dockSize * verticalInsetScale))
    readonly property int pageContentHeight: Math.max(minPageContentHeight, dockSize - verticalInset * 2)

    // ... 其余代码保持不变 ...
}

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