Skip to content

Commit 050dd61

Browse files
mhduiydeepin-bot[bot]
authored andcommitted
feat(osd): add windoweffect osd
as title pms: BUG-286919, BUG-286903, BUG-286797
1 parent 7b40b65 commit 050dd61

28 files changed

+949
-0
lines changed

panels/notification/osd/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ add_subdirectory(audio)
2222
add_subdirectory(displaymode)
2323
add_subdirectory(kblayout)
2424
add_subdirectory(brightness)
25+
add_subdirectory(windoweffect)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2+
#
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
5+
add_library(osd-windowEffect SHARED
6+
windoweffectapplet.cpp
7+
windoweffectapplet.h
8+
)
9+
10+
target_link_libraries(osd-windowEffect PRIVATE
11+
dde-shell-frame
12+
)
13+
14+
ds_install_package(PACKAGE org.deepin.ds.osd.windoweffect TARGET osd-windowEffect)
15+
ds_handle_package_translation(PACKAGE org.deepin.ds.osd.windoweffect)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
2+
//
3+
// SPDX-License-Identifier: LGPL-3.0-or-later
4+
5+
import QtQuick 2.15
6+
import QtQuick.Controls 2.15
7+
import QtQuick.Layouts 1.15
8+
import QtQuick.Window 2.15
9+
10+
import org.deepin.ds 1.0
11+
import org.deepin.dtk 1.0 as D
12+
13+
AppletItem {
14+
id: control
15+
implicitWidth: childrenRect.width
16+
implicitHeight: childrenRect.height
17+
property int selectIndex: indexByValue(Applet.effectType)
18+
property int checkedIndex: indexByValue(Applet.effectType)
19+
20+
enum WindowEffectType {
21+
Default = 0,
22+
Best,
23+
Better,
24+
Good,
25+
Normal,
26+
Compatible
27+
}
28+
29+
Connections {
30+
target: control.Panel
31+
function onVisibleChanged() {
32+
if (!control.Panel.visible) {
33+
Applet.effectType = effectModel.get(selectIndex).value
34+
}
35+
}
36+
}
37+
38+
function indexByValue(value) {
39+
for (var i = 0; i < effectModel.count; i++) {
40+
if (effectModel.get(i).value === value) {
41+
return i
42+
}
43+
}
44+
return -1
45+
}
46+
47+
function update(osdType)
48+
{
49+
if (selectIndex === effectModel.count - 1) {
50+
selectIndex = 0
51+
} else {
52+
selectIndex++
53+
}
54+
55+
if (match(osdType)) {
56+
return true
57+
}
58+
return false
59+
}
60+
61+
function match(osdType)
62+
{
63+
return osdType === "SwitchWM"
64+
}
65+
66+
ListView {
67+
id: listview
68+
model: effectModel
69+
height: contentHeight
70+
width: 500
71+
spacing: 5
72+
delegate: D.ItemDelegate {
73+
checkable: true
74+
checked: control.selectIndex === index
75+
icon.name: model.icon
76+
icon.width: 64
77+
icon.height: 64
78+
width: listview.width
79+
rightPadding: 10
80+
contentFlow: true
81+
content: RowLayout {
82+
spacing: 10
83+
ColumnLayout {
84+
D.Label {
85+
text: model.title
86+
font {
87+
family: D.DTK.fontManager.t5.family
88+
pointSize: D.DTK.fontManager.t5.pointSize
89+
bold: true
90+
}
91+
Layout.fillWidth: true
92+
horizontalAlignment: Text.AlignLeft
93+
}
94+
95+
D.Label {
96+
text: model.description
97+
font: D.DTK.fontManager.t8
98+
Layout.fillWidth: true
99+
horizontalAlignment: Text.AlignLeft
100+
wrapMode: Text.WordWrap
101+
}
102+
}
103+
D.DciIcon {
104+
visible: control.checkedIndex === index
105+
sourceSize: Qt.size(24, 24)
106+
name: "item_checked"
107+
}
108+
}
109+
}
110+
}
111+
112+
ListModel {
113+
id: effectModel
114+
ListElement {
115+
value: main.WindowEffectType.Normal
116+
icon: "osd_optimal_performance"
117+
title: qsTr("Optimal performance")
118+
description: qsTr("Optimal performance: Close all interface and window effects to ensure efficient system operation")
119+
}
120+
ListElement {
121+
value: main.WindowEffectType.Better
122+
icon: "osd_balance_effect"
123+
title: qsTr("Balance")
124+
description: qsTr("Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation")
125+
}
126+
ListElement {
127+
value: main.WindowEffectType.Best
128+
icon: "osd_best_visuals"
129+
title: qsTr("Best Visuals")
130+
description: qsTr("Best Visual: Enable all interface and window effects to experience the best visual effects")
131+
}
132+
}
133+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Plugin": {
3+
"Version": "1.0",
4+
"Id": "org.deepin.ds.osd.windoweffect",
5+
"Url": "main.qml",
6+
"Parent": "org.deepin.ds.osd"
7+
}
8+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE TS>
3+
<TS version="2.1">
4+
<context>
5+
<name>main</name>
6+
<message>
7+
<location filename="../package/main.qml" line="106"/>
8+
<source>Optimal performance</source>
9+
<translation type="unfinished"></translation>
10+
</message>
11+
<message>
12+
<location filename="../package/main.qml" line="107"/>
13+
<source>Optimal performance: Close all interface and window effects to ensure efficient system operation</source>
14+
<translation type="unfinished"></translation>
15+
</message>
16+
<message>
17+
<location filename="../package/main.qml" line="112"/>
18+
<source>Balance</source>
19+
<translation type="unfinished"></translation>
20+
</message>
21+
<message>
22+
<location filename="../package/main.qml" line="113"/>
23+
<source>Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation</source>
24+
<translation type="unfinished"></translation>
25+
</message>
26+
<message>
27+
<location filename="../package/main.qml" line="118"/>
28+
<source>Best Visuals</source>
29+
<translation type="unfinished"></translation>
30+
</message>
31+
<message>
32+
<location filename="../package/main.qml" line="119"/>
33+
<source>Best Visual: Enable all interface and window effects to experience the best visual effects</source>
34+
<translation type="unfinished"></translation>
35+
</message>
36+
</context>
37+
</TS>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE TS>
3+
<TS version="2.1">
4+
<context>
5+
<name>main</name>
6+
<message>
7+
<location filename="../package/main.qml" line="106"/>
8+
<source>Optimal performance</source>
9+
<translation type="unfinished"></translation>
10+
</message>
11+
<message>
12+
<location filename="../package/main.qml" line="107"/>
13+
<source>Optimal performance: Close all interface and window effects to ensure efficient system operation</source>
14+
<translation type="unfinished"></translation>
15+
</message>
16+
<message>
17+
<location filename="../package/main.qml" line="112"/>
18+
<source>Balance</source>
19+
<translation type="unfinished"></translation>
20+
</message>
21+
<message>
22+
<location filename="../package/main.qml" line="113"/>
23+
<source>Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation</source>
24+
<translation type="unfinished"></translation>
25+
</message>
26+
<message>
27+
<location filename="../package/main.qml" line="118"/>
28+
<source>Best Visuals</source>
29+
<translation type="unfinished"></translation>
30+
</message>
31+
<message>
32+
<location filename="../package/main.qml" line="119"/>
33+
<source>Best Visual: Enable all interface and window effects to experience the best visual effects</source>
34+
<translation type="unfinished"></translation>
35+
</message>
36+
</context>
37+
</TS>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE TS>
3+
<TS version="2.1">
4+
<context>
5+
<name>main</name>
6+
<message>
7+
<location filename="../package/main.qml" line="106"/>
8+
<source>Optimal performance</source>
9+
<translation type="unfinished"></translation>
10+
</message>
11+
<message>
12+
<location filename="../package/main.qml" line="107"/>
13+
<source>Optimal performance: Close all interface and window effects to ensure efficient system operation</source>
14+
<translation type="unfinished"></translation>
15+
</message>
16+
<message>
17+
<location filename="../package/main.qml" line="112"/>
18+
<source>Balance</source>
19+
<translation type="unfinished"></translation>
20+
</message>
21+
<message>
22+
<location filename="../package/main.qml" line="113"/>
23+
<source>Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation</source>
24+
<translation type="unfinished"></translation>
25+
</message>
26+
<message>
27+
<location filename="../package/main.qml" line="118"/>
28+
<source>Best Visuals</source>
29+
<translation type="unfinished"></translation>
30+
</message>
31+
<message>
32+
<location filename="../package/main.qml" line="119"/>
33+
<source>Best Visual: Enable all interface and window effects to experience the best visual effects</source>
34+
<translation type="unfinished"></translation>
35+
</message>
36+
</context>
37+
</TS>

0 commit comments

Comments
 (0)