Changeset View
Changeset View
Standalone View
Standalone View
applets/mediacontroller/contents/ui/main.qml
Show First 20 Lines • Show All 144 Lines • ▼ Show 20 Line(s) | 28 | Item { | |||
---|---|---|---|---|---|
145 | Plasmoid.fullRepresentation: ExpandedRepresentation {} | 145 | Plasmoid.fullRepresentation: ExpandedRepresentation {} | ||
146 | 146 | | |||
147 | Plasmoid.compactRepresentation: PlasmaCore.IconItem { | 147 | Plasmoid.compactRepresentation: PlasmaCore.IconItem { | ||
148 | source: root.state === "playing" ? "media-playback-playing" : | 148 | source: root.state === "playing" ? "media-playback-playing" : | ||
149 | root.state === "paused" ? "media-playback-paused" : | 149 | root.state === "paused" ? "media-playback-paused" : | ||
150 | "media-playback-stopped" | 150 | "media-playback-stopped" | ||
151 | active: compactMouse.containsMouse | 151 | active: compactMouse.containsMouse | ||
152 | 152 | | |||
153 | MouseArea { | 153 | MouseArea { | ||
broulik: Did you check this works fine with touchpads? Here Qt sends a gazillion of tiny wheel events. | |||||
154 | id: compactMouse | 154 | id: compactMouse | ||
broulik: ```
volume = Math.max(0, volume);
``` | |||||
155 | anchors.fill: parent | 155 | anchors.fill: parent | ||
156 | hoverEnabled: true | 156 | hoverEnabled: true | ||
157 | acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.BackButton | Qt.ForwardButton | 157 | acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.BackButton | Qt.ForwardButton | ||
158 | | ||||
159 | onWheel: { | ||||
160 | var service = mpris2Source.serviceForSource(mpris2Source.current) | ||||
161 | var operation = service.operationDescription("ChangeVolume") | ||||
162 | operation.delta = (wheel.angleDelta.y / 120) * 0.03 | ||||
163 | operation.showOSD = true | ||||
164 | service.startOperationCall(operation) | ||||
165 | } | ||||
166 | | ||||
158 | onClicked: { | 167 | onClicked: { | ||
159 | switch (mouse.button) { | 168 | switch (mouse.button) { | ||
160 | case Qt.MiddleButton: | 169 | case Qt.MiddleButton: | ||
161 | root.togglePlaying() | 170 | root.togglePlaying() | ||
162 | break | 171 | break | ||
163 | case Qt.BackButton: | 172 | case Qt.BackButton: | ||
164 | root.action_previous() | 173 | root.action_previous() | ||
165 | break | 174 | break | ||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |
Did you check this works fine with touchpads? Here Qt sends a gazillion of tiny wheel events.
Please enforce a limit of e.g. 100%, I almost deafened myself last time I messed with volume on Mpris