Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/package/contents/ui/AudioStream.qml
Show All 30 Lines | 30 | State { | |||
---|---|---|---|---|---|
31 | name: "playing" | 31 | name: "playing" | ||
32 | when: task.playingAudio && !task.muted | 32 | when: task.playingAudio && !task.muted | ||
33 | PropertyChanges { | 33 | PropertyChanges { | ||
34 | target: audioStreamIconBox | 34 | target: audioStreamIconBox | ||
35 | opacity: 1 | 35 | opacity: 1 | ||
36 | } | 36 | } | ||
37 | PropertyChanges { | 37 | PropertyChanges { | ||
38 | target: audioStreamIcon | 38 | target: audioStreamIcon | ||
39 | source: "audio-volume-high" | 39 | elementId: "audio-volume-high" | ||
40 | } | 40 | } | ||
41 | }, | 41 | }, | ||
42 | State { | 42 | State { | ||
43 | name: "muted" | 43 | name: "muted" | ||
44 | when: task.muted | 44 | when: task.muted | ||
45 | PropertyChanges { | 45 | PropertyChanges { | ||
46 | target: audioStreamIconBox | 46 | target: audioStreamIconBox | ||
47 | opacity: 1 | 47 | opacity: 1 | ||
48 | } | 48 | } | ||
49 | PropertyChanges { | 49 | PropertyChanges { | ||
50 | target: audioStreamIcon | 50 | target: audioStreamIcon | ||
51 | source: "audio-volume-muted" | 51 | elementId: "audio-volume-muted" | ||
52 | } | 52 | } | ||
53 | } | 53 | } | ||
54 | ] | 54 | ] | ||
55 | 55 | | |||
56 | transitions: [ | 56 | transitions: [ | ||
57 | Transition { | 57 | Transition { | ||
58 | from: "" | 58 | from: "" | ||
59 | to: "playing" | 59 | to: "playing" | ||
Show All 23 Lines | 81 | Transition { | |||
83 | NumberAnimation { | 83 | NumberAnimation { | ||
84 | property: "opacity" | 84 | property: "opacity" | ||
85 | duration: units.longDuration | 85 | duration: units.longDuration | ||
86 | } | 86 | } | ||
87 | } | 87 | } | ||
88 | ] | 88 | ] | ||
89 | 89 | | |||
90 | opacity: 0 | 90 | opacity: 0 | ||
91 | // The indicator should still shown even if the label is hidden, | 91 | // Do not display the indicator if the icons are too small. | ||
92 | // but only if there's enough room for it. | 92 | visible: opacity > 0 && Math.min(iconBox.width, iconBox.height) >= units.iconSizes.small | ||
broulik: This breaks displaying the icon on small panels like mine. | |||||
93 | visible: opacity > 0 && (task.width > icon.paintedWidth + audioStreamIconBox.width) | | |||
94 | 93 | | |||
hein: What's with the magic number 14? | |||||
95 | PlasmaCore.IconItem { | 94 | PlasmaCore.Svg { | ||
95 | id: audioSvg | ||||
Introducing a glow is a pretty big design change, and it's also very expensive rendering-wise. This isn't covered by the merge request description, what's the motivation here? hein: Introducing a glow is a pretty big design change, and it's also very expensive rendering-wise. | |||||
I requested this to improve the display with an IOTM. Until this patch, display of the audio indicator was so buggy that I never saw it and never noticed the visual issues with having it overlap an icon like an emblem. I think it's a logical enough part of making the display work properly, but we could easily do this in a follow-up patch if you prefer. ngraham: I requested this to improve the display with an IOTM. Until this patch, display of the audio… | |||||
96 | imagePath: "icons/audio" | ||||
97 | } | ||||
98 | | ||||
99 | PlasmaCore.SvgItem { | ||||
96 | id: audioStreamIcon | 100 | id: audioStreamIcon | ||
97 | anchors.fill: parent | 101 | svg: audioSvg | ||
102 | smooth: false | ||||
103 | | ||||
104 | height: Math.round(Math.min(parent.height * 1.4, units.iconSizes.smallMedium) / 2) * 2 | ||||
105 | width: height | ||||
106 | | ||||
107 | anchors { | ||||
108 | verticalCenter: parent.verticalCenter | ||||
109 | right: parent.right | ||||
110 | // Avoid overlap to the right. | ||||
111 | rightMargin: (parent.width - width) / 2 + units.smallSpacing / 4 | ||||
112 | } | ||||
113 | | ||||
114 | states: [ | ||||
115 | State { | ||||
116 | name: "horizontal" | ||||
117 | // When there is enough space for the audio icon, to fit right of the centered task icon. | ||||
118 | when: (frame.width > Math.min(iconBox.width, iconBox.height) + | ||||
119 | Math.min(Math.min(iconBox.width, iconBox.height), units.iconSizes.smallMedium) * 2) | ||||
120 | | ||||
121 | AnchorChanges { | ||||
122 | target: audioStreamIconLoader | ||||
123 | | ||||
124 | anchors.top: undefined | ||||
125 | anchors.verticalCenter: frame.verticalCenter | ||||
126 | } | ||||
127 | | ||||
128 | PropertyChanges { | ||||
129 | target: audioStreamIconLoader | ||||
130 | | ||||
131 | anchors.rightMargin: iconBox.adjustMargin(true, parent.width, taskFrame.margins.right) | ||||
132 | width: units.roundToIconSize(Math.min(Math.min(iconBox.width, iconBox.height), units.iconSizes.smallMedium)) | ||||
133 | } | ||||
134 | | ||||
135 | PropertyChanges { | ||||
136 | target: audioStreamIcon | ||||
137 | | ||||
138 | height: parent.height | ||||
139 | width: parent.width | ||||
140 | } | ||||
141 | }, | ||||
142 | | ||||
143 | State { | ||||
144 | name: "vertical" | ||||
145 | // When audio icon can fit above the centered task icon. | ||||
146 | when: (frame.height > Math.min(iconBox.width, iconBox.height) + | ||||
147 | Math.min(Math.min(iconBox.width, iconBox.height), units.iconSizes.smallMedium) * 2) | ||||
148 | | ||||
149 | AnchorChanges { | ||||
150 | target: audioStreamIconLoader | ||||
151 | | ||||
152 | anchors.right: undefined | ||||
153 | anchors.horizontalCenter: frame.horizontalCenter | ||||
154 | } | ||||
155 | | ||||
156 | PropertyChanges { | ||||
157 | target: audioStreamIconLoader | ||||
158 | | ||||
159 | anchors.topMargin: iconBox.adjustMargin(false, frame.height, taskFrame.margins.top) | ||||
160 | width: units.roundToIconSize(Math.min(Math.min(iconBox.width, iconBox.height), units.iconSizes.smallMedium)) | ||||
161 | } | ||||
162 | | ||||
163 | PropertyChanges { | ||||
164 | target: audioStreamIcon | ||||
165 | | ||||
166 | height: parent.height | ||||
167 | width: parent.width | ||||
168 | } | ||||
169 | } | ||||
170 | ] | ||||
98 | } | 171 | } | ||
99 | 172 | | |||
100 | MouseArea { | 173 | MouseArea { | ||
101 | anchors.fill: parent | 174 | anchors.fill: parent | ||
102 | hoverEnabled: true | 175 | hoverEnabled: true | ||
103 | onClicked: toggleMuted() | 176 | onClicked: toggleMuted() | ||
104 | 177 | | |||
105 | PlasmaCore.FrameSvgItem { | 178 | PlasmaCore.FrameSvgItem { | ||
106 | anchors.fill: parent | 179 | anchors.fill: parent | ||
107 | visible: parent.containsMouse | 180 | visible: parent.containsMouse | ||
108 | imagePath: "widgets/viewitem" | 181 | imagePath: "widgets/viewitem" | ||
109 | prefix: "hover" | 182 | prefix: "hover" | ||
110 | } | 183 | } | ||
111 | } | 184 | } | ||
112 | } | 185 | } |
This breaks displaying the icon on small panels like mine.