Skip to content

Conversation

@qxp930712
Copy link

@qxp930712 qxp930712 commented Feb 9, 2026

  1. Replaced D.BoxShadow and D.BoxInsetShadow components with D.InsideBoxBorder and D.OutsideBoxBorder in display mode and window effect panels
  2. Added new color palette properties for inside and outside borders with checked and normal states
  3. Adjusted background color darkness in dark mode from 0.6 to 0.5 for better contrast
  4. Added D.OutsideBoxBorder component to main OSD window
  5. Removed obsolete dropShadowColor and innerShadowColor palette properties

This change transitions from shadow-based visual effects to border-based effects for clearer definition of UI elements while maintaining visual hierarchy. Border effects provide better visibility across different themes and improve rendering performance.

Log: Updated OSD notification visual style with borders replacing shadows for better clarity and theme consistency

Influence:

  1. Test OSD notifications in both light and dark modes to verify border visibility
  2. Verify selected and unselected states show proper border colors
  3. Check display mode switching and ensure visual consistency
  4. Test window effects and notification popups for proper border rendering
  5. Verify that the changes don't affect touch interactions or responsiveness
  6. Confirm that the visual hierarchy remains clear with the new border effects

PMS: BUG-311255

Summary by Sourcery

Update OSD notification UI to use border-based styling instead of shadow effects for clearer, more consistent visuals across themes.

Enhancements:

  • Replace box shadow and inset shadow visuals with inside and outside border components in display mode and window effect OSD panels.
  • Introduce dedicated palettes for inside and outside borders in normal and checked states for both light and dark themes.
  • Tweak dark-mode checked background opacity to improve contrast and remove obsolete shadow-related palette properties.

1. Replaced D.BoxShadow and D.BoxInsetShadow components with
D.InsideBoxBorder and D.OutsideBoxBorder in display mode and window
effect panels
2. Added new color palette properties for inside and outside borders
with checked and normal states
3. Adjusted background color darkness in dark mode from 0.6 to 0.5 for
better contrast
4. Added D.OutsideBoxBorder component to main OSD window
5. Removed obsolete dropShadowColor and innerShadowColor palette
properties

This change transitions from shadow-based visual effects to border-based
effects for clearer definition of UI elements while maintaining visual
hierarchy. Border effects provide better visibility across different
themes and improve rendering performance.

Log: Updated OSD notification visual style with borders replacing
shadows for better clarity and theme consistency

Influence:
1. Test OSD notifications in both light and dark modes to verify border
visibility
2. Verify selected and unselected states show proper border colors
3. Check display mode switching and ensure visual consistency
4. Test window effects and notification popups for proper border
rendering
5. Verify that the changes don't affect touch interactions or
responsiveness
6. Confirm that the visual hierarchy remains clear with the new border
effects

PMS: BUG-311255
@sourcery-ai
Copy link

sourcery-ai bot commented Feb 9, 2026

Reviewer's Guide

This PR updates the OSD notification display mode and window effect panels to replace shadow-based styling with border-based components, introduces new border color palettes (including checked/normal and light/dark variants), slightly lightens the checked background in dark mode, and removes obsolete shadow-related palette properties.

Class diagram for updated OSD notification styling components and palettes

classDiagram
  class AppletItem {
  }

  class ColorSelectorPalettes {
    +D.Palette backgroundColor
    +D.Palette checkedBackgroundColor
    +D.Palette insideBorderColor
    +D.Palette checkedInsideBorderColor
    +D.Palette outsideBorderColor
    +D.Palette checkedOutsideBorderColor
    -D.Palette dropShadowColor
    -D.Palette innerShadowColor
  }

  class DPalette {
    +color normal
    +color normalDark
  }

  class InsideBoxBorder {
    +DPalette color
    +int radius
    +anchors anchors
  }

  class OutsideBoxBorder {
    +DPalette color
    +int radius
    +anchors anchors
  }

  class BoxShadow {
    +color shadowColor
    +int shadowOffsetX
    +int shadowOffsetY
    +int shadowBlur
    +int cornerRadius
    +int spread
    +bool hollow
  }

  class BoxInsetShadow {
    +color shadowColor
    +int shadowOffsetX
    +int shadowOffsetY
    +int shadowBlur
    +int cornerRadius
    +int spread
  }

  AppletItem --> ColorSelectorPalettes
  AppletItem --> InsideBoxBorder
  AppletItem --> OutsideBoxBorder

  ColorSelectorPalettes o-- DPalette
  InsideBoxBorder o-- DPalette
  OutsideBoxBorder o-- DPalette

  %% Previously used shadow components no longer referenced in updated OSD panels
  AppletItem ..> BoxShadow
  AppletItem ..> BoxInsetShadow
Loading

File-Level Changes

Change Details Files
Replace shadow-based effects with inside/outside border components in OSD display mode items.
  • Remove D.BoxShadow and D.BoxInsetShadow usage around display mode item background rectangles.
  • Add D.InsideBoxBorder and D.OutsideBoxBorder anchored to the item background, using the same corner radius.
  • Drive border visibility and styling via isCurrent, using checked vs normal border palettes instead of toggling visibility.
panels/notification/osd/displaymode/package/main.qml
Introduce palette definitions for inside/outside borders and adjust checked background darkness in OSD display mode and window effect panels.
  • Remove dropShadowColor and innerShadowColor palette properties and replace them with insideBorderColor/outsideBorderColor and checkedInsideBorderColor/checkedOutsideBorderColor palettes.
  • Adjust checkedBackgroundColor.normalDark alpha from 0.6 to 0.5 to reduce darkness in dark mode.
  • Ensure both display mode and window effect items share consistent palette structure for borders across normal and checked states.
panels/notification/osd/displaymode/package/main.qml
panels/notification/osd/windoweffect/package/main.qml
Apply border-based styling to OSD window effect items matching the display mode panel behavior.
  • Replace D.BoxShadow and D.BoxInsetShadow with D.InsideBoxBorder and D.OutsideBoxBorder around window effect item backgrounds.
  • Use new checked/normal inside and outside border color palettes to reflect selection state.
  • Keep layout and anchoring intact while changing only the visual decoration layer.
panels/notification/osd/windoweffect/package/main.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

@deepin-ci-robot
Copy link

deepin pr auto review

这段代码diff展示了两个QML文件(displaymode/package/main.qmlwindoweffect/package/main.qml)中关于UI视觉效果的修改。主要改动是将原本基于阴影(D.BoxShadowD.BoxInsetShadow)的视觉反馈,替换为了基于边框(D.InsideBoxBorderD.OutsideBoxBorder)的视觉反馈。

以下是对这段代码的审查意见,分为语法逻辑、代码质量、代码性能和代码安全四个方面:

1. 语法逻辑

  • 逻辑一致性:修改逻辑清晰且一致。在两个文件中,都移除了未选状态下显示的阴影效果,转而使用始终显示(但颜色不同)的内外边框来区分 isCurrent(选中)和 !isCurrent(未选中)状态。这种状态切换逻辑是正确的。
  • 属性绑定:新的边框组件(D.InsideBoxBorderD.OutsideBoxBorder)正确地使用了三元运算符 itemView.isCurrent ? ... : ... 来绑定 color 属性,确保了状态变化时颜色的动态切换。
  • 布局锚点anchors.fill: parentradius: backgroundRect.radius 的使用确保了边框与背景矩形的大小和圆角完全对齐,逻辑正确。

2. 代码质量

  • 可维护性与可读性
    • 优点:将原本分散在 D.Palette 定义区域(dropShadowColorinnerShadowColor)的样式定义,移到了使用它们的组件内部(作为 property D.Palette)。这种局部化定义使得代码更加内聚,阅读时更容易理解该组件的具体样式,而不必在文件中上下翻找。
    • 缺点:在 D.InsideBoxBorderD.OutsideBoxBorder 内部重复定义了 normalnormalDark 两种主题色。虽然这增加了局部清晰度,但如果多个组件需要复用这些颜色值,可能会导致代码冗余。建议确认这些颜色值是否为该组件独有,如果是,则当前写法很好;如果是通用的,可以考虑提取到上层。
  • 代码冗余displaymode/package/main.qmlwindoweffect/package/main.qml 中的修改几乎完全一致。虽然这是两个不同的功能模块,但这种高度相似性提示我们,如果未来还有类似的UI改动,可能需要考虑抽取公共组件(例如一个通用的 SelectableBackground 组件)来减少重复代码。

3. 代码性能

  • 渲染性能优化(显著提升)
    • 阴影 vs 边框:原代码使用了 D.BoxShadowD.BoxInsetShadow。阴影效果通常涉及复杂的图像模糊算法,对GPU渲染资源消耗较大,尤其是在动态变化或大量显示时。
    • 新方案:新代码使用 D.InsideBoxBorderD.OutsideBoxBorder。绘制简单的边框(尤其是纯色边框)比渲染模糊阴影要轻量得多。这显著降低了GPU的负载,有助于提升UI的流畅度,特别是在低性能设备上。
  • 对象实例化
    • 原代码中 visible: !itemView.isCurrent 意味着阴影对象虽然被创建,但在选中状态下不可见。
    • 新代码中的边框组件似乎始终存在(通过颜色变化来体现状态)。虽然这避免了 visible 属性切换带来的潜在开销(尽管通常很小),但主要收益还是来自于渲染算法本身的简化。

4. 代码安全

  • 类型安全:代码中使用的 Qt.rgba() 函数参数明确,类型安全。D.Palette 的使用也符合框架规范。
  • 属性覆盖:新代码在组件内部定义了同名的 property D.Palette(如 insideBorderColor),这覆盖了可能存在的外部同名属性。这种写法在QML中是合法的,但需要确保这是预期行为,即明确希望这些样式仅在此处生效,而不受外部干扰。目前的写法看起来是故意为之,用于隔离样式,因此是安全的。

改进建议

  1. 常量提取(可选):如果 Qt.rgba(...) 中的这些颜色值在项目其他地方也有使用,建议将其定义为全局常量或主题色,避免硬编码。例如:

    readonly property color borderNormal: Qt.rgba(0, 0, 0, 0.05)

    但如果这些颜色仅用于此特定效果,当前的写法(定义在组件内部)是可以接受的,因为它保持了上下文的完整性。

  2. 组件封装:鉴于 displaymodewindoweffect 中使用了完全相同的背景+边框逻辑,可以考虑将这部分代码抽取为一个独立的 QML 组件,例如 SelectableItemBackground.qml

    • 这样可以消除两个文件间的重复代码。
    • 以后如果需要调整选中/未选中的视觉样式,只需修改这一个组件即可。
  3. 注释说明:虽然代码逻辑清晰,但添加简短的注释说明为什么用边框替代阴影(例如:"Use borders instead of shadows for better performance and cleaner look")可以帮助其他开发者理解这次重构的意图。

总结
这是一次高质量的UI重构。代码逻辑正确,通过将渲染昂贵的阴影效果替换为轻量级的边框效果,显著提升了代码的渲染性能。同时,代码结构保持了良好的可读性。主要的改进空间在于消除两个文件间的代码重复,但这属于架构层面的优化,当前的改动本身是非常扎实的。

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 found 2 issues, and left some high level feedback:

  • The new insideBorderColor/checkedInsideBorderColor and outsideBorderColor/checkedOutsideBorderColor palettes are defined as properties on the D.InsideBoxBorder/D.OutsideBoxBorder instances, but the color bindings reference D.ColorSelector.* instead of the local properties, which will resolve to undefined unless you also add these palettes to ColorSelector or change the bindings to use the local properties.
  • The border palette definitions and border component setups are duplicated between displaymode and windoweffect; consider extracting the common border configuration into a shared component or central palette to keep the visual style consistent and easier to adjust later.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `insideBorderColor`/`checkedInsideBorderColor` and `outsideBorderColor`/`checkedOutsideBorderColor` palettes are defined as properties on the `D.InsideBoxBorder`/`D.OutsideBoxBorder` instances, but the `color` bindings reference `D.ColorSelector.*` instead of the local properties, which will resolve to undefined unless you also add these palettes to `ColorSelector` or change the bindings to use the local properties.
- The border palette definitions and border component setups are duplicated between `displaymode` and `windoweffect`; consider extracting the common border configuration into a shared component or central palette to keep the visual style consistent and easier to adjust later.

## Individual Comments

### Comment 1
<location> `panels/notification/osd/displaymode/package/main.qml:132-141` </location>
<code_context>
+                    color: itemView.isCurrent ? D.ColorSelector.checkedInsideBorderColor
</code_context>

<issue_to_address>
**issue (bug_risk):** The color bindings likely need to reference the item-specific ColorSelector (itemView.D.ColorSelector) rather than the global D.ColorSelector.

Elsewhere in this file, ColorSelector is accessed as `itemView.D.ColorSelector.*`, implying it’s scoped to `itemView`. Using `D.ColorSelector.*` here may either not resolve or use a different/global instance. Please update these bindings to `itemView.D.ColorSelector.checkedInsideBorderColor` / `itemView.D.ColorSelector.insideBorderColor` (and the outside border equivalents) to match the background color binding and ensure consistent behavior.
</issue_to_address>

### Comment 2
<location> `panels/notification/osd/windoweffect/package/main.qml:181-190` </location>
<code_context>
+                    color: itemView.isCurrent ? D.ColorSelector.checkedInsideBorderColor
</code_context>

<issue_to_address>
**issue (bug_risk):** Color bindings should probably reference the attached ColorSelector on itemView, not a global D.ColorSelector.

The existing background color bindings use `itemView.D.ColorSelector.*`, implying the ColorSelector is attached to `itemView`. These new bindings switch to `D.ColorSelector.*`, which may reference a different (or no) palette and could cause theming issues or runtime failures. Please update these to `itemView.D.ColorSelector.checkedInsideBorderColor` / `itemView.D.ColorSelector.insideBorderColor` (and the outside variants) to stay consistent with the current pattern.
</issue_to_address>

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.

Comment on lines +132 to +141
color: itemView.isCurrent ? D.ColorSelector.checkedInsideBorderColor
: D.ColorSelector.insideBorderColor
}
D.BoxInsetShadow {
visible: !itemView.isCurrent
D.OutsideBoxBorder {
property D.Palette outsideBorderColor: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.05)
normalDark: Qt.rgba(0, 0, 0, 0.4)
}
property D.Palette checkedOutsideBorderColor: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.1)
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): The color bindings likely need to reference the item-specific ColorSelector (itemView.D.ColorSelector) rather than the global D.ColorSelector.

Elsewhere in this file, ColorSelector is accessed as itemView.D.ColorSelector.*, implying it’s scoped to itemView. Using D.ColorSelector.* here may either not resolve or use a different/global instance. Please update these bindings to itemView.D.ColorSelector.checkedInsideBorderColor / itemView.D.ColorSelector.insideBorderColor (and the outside border equivalents) to match the background color binding and ensure consistent behavior.

Comment on lines +181 to +190
color: itemView.isCurrent ? D.ColorSelector.checkedInsideBorderColor
: D.ColorSelector.insideBorderColor
}
D.BoxInsetShadow {
visible: !itemView.isCurrent
D.OutsideBoxBorder {
property D.Palette outsideBorderColor: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.05)
normalDark: Qt.rgba(0, 0, 0, 0.4)
}
property D.Palette checkedOutsideBorderColor: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.1)
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Color bindings should probably reference the attached ColorSelector on itemView, not a global D.ColorSelector.

The existing background color bindings use itemView.D.ColorSelector.*, implying the ColorSelector is attached to itemView. These new bindings switch to D.ColorSelector.*, which may reference a different (or no) palette and could cause theming issues or runtime failures. Please update these to itemView.D.ColorSelector.checkedInsideBorderColor / itemView.D.ColorSelector.insideBorderColor (and the outside variants) to stay consistent with the current pattern.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, qxp930712

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
Copy link
Contributor

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Feb 9, 2026

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 0eb4d22 into linuxdeepin:master Feb 9, 2026
12 of 17 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.

4 participants