Skip to content

Commit 715fb4d

Browse files
committed
style: enhance OSD window visual effects
1. Extracted windowRadius to a property for better maintainability 2. Added borderColor property for DWindow based on theme type 3. Implemented StyledBehindWindowBlur for improved background blur effect with theme-aware colors 4. Added InsideBoxBorder component for consistent inner border styling 5. Removed FloatingPanel background and delegated styling to new components 6. Improved color handling with proper theme-based selections These changes enhance the visual consistency and theme responsiveness of the OSD window while making the code more maintainable by separating styling concerns into dedicated components. The new implementation provides better visual feedback and matches the system theme more accurately. style: 优化 OSD 窗口视觉效果 1. 将 windowRadius 提取为属性提高可维护性 2. 根据主题类型为 DWindow 添加 borderColor 属性 3. 实现 StyledBehindWindowBlur 提供改进的背景模糊效果,支持主题颜色 4. 添加 InsideBoxBorder 组件实现统一的内边框样式 5. 移除 FloatingPanel 背景,将样式委托给新组件 6. 改进颜色处理,支持基于主题的选择 这些变更增强了 OSD 窗口的视觉一致性和主题响应能力,同时通过将样式关注点 分离到专用组件中提高了代码可维护性。新实现提供了更好的视觉反馈,并能更准 确地匹配系统主题。 pms: BUG-294195
1 parent 307fcb2 commit 715fb4d

File tree

1 file changed

+30
-18
lines changed

1 file changed

+30
-18
lines changed

panels/notification/osd/package/main.qml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ import QtQuick.Window
88

99
import org.deepin.ds 1.0
1010
import org.deepin.dtk 1.0 as D
11+
import org.deepin.dtk.style 1.0 as DS
1112

1213
Window {
1314
id: root
1415
visible: Applet.visible
15-
D.DWindow.windowRadius: isSingleView ? 30 : D.DTK.platformTheme.windowRadius
16+
property var windowRadius: isSingleView ? 30 : D.DTK.platformTheme.windowRadius
17+
D.DWindow.windowRadius: root.windowRadius
1618
D.DWindow.enableBlurWindow: true
1719
D.DWindow.enabled: true
1820
D.DWindow.shadowOffset: Qt.point(0, 8)
1921
D.DWindow.shadowColor: D.DTK.themeType === D.ApplicationHelper.DarkType ? Qt.rgba(0, 0, 0, 0.2) : Qt.rgba(0, 0, 0, 0.1)
22+
D.DWindow.borderColor: D.DTK.themeType === D.ApplicationHelper.DarkType ? Qt.rgba(0, 0, 0, 0.7) : Qt.rgba(0, 0, 0, 0.1)
2023
color: "transparent"
2124
DLayerShellWindow.bottomMargin: 180
2225
DLayerShellWindow.layer: DLayerShellWindow.LayerOverlay
@@ -35,6 +38,32 @@ Window {
3538
property Item osdView
3639
property bool isSingleView: false
3740

41+
D.StyledBehindWindowBlur {
42+
control: parent
43+
anchors.fill: parent
44+
blendColor: {
45+
if (valid) {
46+
return DS.Style.control.selectColor(undefined,
47+
Qt.rgba(247 / 255.0, 247 / 255.0, 247 / 255.0, 0.4),
48+
Qt.rgba(20 / 255, 20 / 255, 20 / 255, 0.6))
49+
}
50+
return DS.Style.control.selectColor(undefined,
51+
DS.Style.behindWindowBlur.lightNoBlurColor,
52+
DS.Style.behindWindowBlur.darkNoBlurColor)
53+
}
54+
}
55+
56+
D.InsideBoxBorder {
57+
property D.Palette insideBorderColor: D.Palette {
58+
normal: Qt.rgba(1, 1, 1, 0.3)
59+
normalDark: Qt.rgba(1, 1, 1, 0.1)
60+
}
61+
radius: root.windowRadius
62+
anchors.fill: parent
63+
z: D.DTK.AboveOrder
64+
color: D.ColorSelector.insideBorderColor
65+
}
66+
3867
Control {
3968
property D.Palette textColor: D.Palette {
4069
normal: Qt.rgba(0, 0, 0, 1)
@@ -55,23 +84,6 @@ Window {
5584

5685
sourceComponent: Control {
5786
contentItem: model.data
58-
background: D.FloatingPanel {
59-
implicitWidth: 100
60-
implicitHeight: 40
61-
backgroundColor: D.Palette {
62-
normal: Qt.rgba(247 / 255.0, 247 / 255.0, 247 / 255.0, 0.4)
63-
normalDark: Qt.rgba(0, 0, 0, 0.6)
64-
}
65-
insideBorderColor: D.Palette {
66-
normal: Qt.rgba(1, 0, 0, 0.3)
67-
normalDark: Qt.rgba(1, 1, 1, 0.1)
68-
}
69-
outsideBorderColor: D.Palette {
70-
normal: Qt.rgba(1, 1, 0, 0.1)
71-
normalDark: Qt.rgba(0, 0, 0, 0.7)
72-
}
73-
dropShadowColor: null
74-
}
7587
}
7688
}
7789
}

0 commit comments

Comments
 (0)