Changeset View
Changeset View
Standalone View
Standalone View
desktoppackage/contents/views/Panel.qml
Show All 14 Lines | |||||
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | import QtQuick 2.0 | 19 | import QtQuick 2.0 | ||
20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 | ||
21 | 21 | | |||
22 | import org.kde.plasma.core 2.0 as PlasmaCore | 22 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
23 | import org.kde.taskmanager 0.1 as TaskManager | ||||
23 | 24 | | |||
24 | PlasmaCore.FrameSvgItem { | 25 | Item { | ||
25 | id: root | 26 | id: root | ||
26 | 27 | | |||
28 | property Item containment | ||||
29 | | ||||
30 | property alias panelMask: privateSwapper.mask | ||||
31 | | ||||
32 | QtObject { | ||||
33 | id: privateSwapper | ||||
34 | // Work around the fact that we can't use a ternary if in an alias | ||||
35 | readonly property var mask: { | ||||
36 | if (root.state == "opaque") { | ||||
37 | return opaqueItem.mask | ||||
38 | } else { | ||||
39 | return translucentItem.mask | ||||
40 | } | ||||
41 | } | ||||
42 | } | ||||
43 | | ||||
44 | readonly property bool verticalPanel: containment && containment.formFactor === PlasmaCore.Types.Vertical | ||||
45 | | ||||
46 | TaskManager.VirtualDesktopInfo { | ||||
47 | id: virtualDesktopInfo | ||||
48 | } | ||||
49 | | ||||
50 | TaskManager.ActivityInfo { | ||||
51 | id: activityInfo | ||||
52 | } | ||||
53 | | ||||
54 | PlasmaCore.SortFilterModel { | ||||
55 | id: visibleWindowsModel | ||||
56 | filterRole: 'IsMinimized' | ||||
57 | filterRegExp: 'false' | ||||
58 | sourceModel: TaskManager.TasksModel { | ||||
59 | filterByVirtualDesktop: true | ||||
60 | filterByActivity: true | ||||
61 | filterNotMaximized: true | ||||
62 | filterByScreen: true | ||||
63 | | ||||
64 | screenGeometry: panel.screenGeometry | ||||
65 | virtualDesktop: virtualDesktopInfo.currentDesktop | ||||
66 | activity: activityInfo.currentActivity | ||||
67 | | ||||
davidedmundson: why | |||||
68 | id: tasksModel | ||||
69 | groupMode: TaskManager.TasksModel.GroupDisabled | ||||
70 | } | ||||
71 | } | ||||
72 | | ||||
73 | PlasmaCore.FrameSvgItem { | ||||
74 | id: translucentItem | ||||
75 | enabledBorders: panel.enabledBorders | ||||
76 | anchors.fill: parent | ||||
77 | | ||||
27 | imagePath: containment && containment.backgroundHints === PlasmaCore.Types.NoBackground ? "" : "widgets/panel-background" | 78 | imagePath: containment && containment.backgroundHints === PlasmaCore.Types.NoBackground ? "" : "widgets/panel-background" | ||
79 | } | ||||
28 | 80 | | |||
81 | PlasmaCore.FrameSvgItem { | ||||
82 | id: opaqueItem | ||||
29 | enabledBorders: panel.enabledBorders | 83 | enabledBorders: panel.enabledBorders | ||
84 | anchors.fill: parent | ||||
30 | 85 | | |||
31 | property Item containment | 86 | imagePath: containment && containment.backgroundHints === PlasmaCore.Types.NoBackground ? "" : "opaque/widgets/panel-background" | ||
87 | } | ||||
32 | 88 | | |||
33 | property alias panelMask: root.mask | 89 | transitions: [ | ||
90 | Transition { | ||||
91 | from: "opaque" | ||||
92 | to: "transparent" | ||||
93 | SequentialAnimation { | ||||
94 | ScriptAction { | ||||
95 | script: { | ||||
96 | translucentItem.visible = true | ||||
97 | } | ||||
98 | } | ||||
99 | NumberAnimation { | ||||
100 | target: opaqueItem | ||||
101 | properties: "opacity" | ||||
102 | from: 1 | ||||
103 | to: 0 | ||||
104 | duration: units.veryLongDuration | ||||
105 | easing.type: Easing.InOutQuad | ||||
106 | } | ||||
107 | ScriptAction { | ||||
108 | script: { | ||||
109 | opaqueItem.visible = false | ||||
110 | root.panelMaskChanged() | ||||
111 | } | ||||
112 | } | ||||
113 | } | ||||
114 | }, | ||||
115 | Transition { | ||||
116 | from: "transparent" | ||||
117 | to: "opaque" | ||||
118 | SequentialAnimation { | ||||
119 | ScriptAction { | ||||
120 | script: { | ||||
121 | opaqueItem.visible = true | ||||
122 | } | ||||
123 | } | ||||
124 | NumberAnimation { | ||||
125 | target: opaqueItem | ||||
126 | properties: "opacity" | ||||
127 | from: 0 | ||||
128 | to: 1 | ||||
129 | duration: units.veryLongDuration | ||||
130 | easing.type: Easing.InOutQuad | ||||
131 | } | ||||
132 | ScriptAction { | ||||
133 | script: { | ||||
134 | translucentItem.visible = false | ||||
135 | root.panelMaskChanged() | ||||
136 | } | ||||
137 | } | ||||
138 | } | ||||
139 | } | ||||
140 | ] | ||||
34 | 141 | | |||
35 | readonly property bool verticalPanel: containment && containment.formFactor === PlasmaCore.Types.Vertical | 142 | state: visibleWindowsModel.count > 0 ? "opaque" : "transparent" | ||
143 | states: [ | ||||
144 | State { name: "opaque" }, | ||||
145 | State { name: "transparent" } | ||||
146 | ] | ||||
36 | 147 | | |||
37 | function adjustPrefix() { | 148 | function adjustPrefix() { | ||
38 | if (!containment) { | 149 | if (!containment) { | ||
39 | return ""; | 150 | return ""; | ||
40 | } | 151 | } | ||
41 | var pre; | 152 | var pre; | ||
42 | switch (containment.location) { | 153 | switch (containment.location) { | ||
43 | case PlasmaCore.Types.LeftEdge: | 154 | case PlasmaCore.Types.LeftEdge: | ||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |
why