Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/package/contents/ui/PulseAudio.qml
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 49 | function findStreams(key, value) { | |||
---|---|---|---|---|---|
57 | return streams | 57 | return streams | ||
58 | } | 58 | } | ||
59 | 59 | | |||
60 | function streamsForAppName(appName) { | 60 | function streamsForAppName(appName) { | ||
61 | return findStreams("appName", appName); | 61 | return findStreams("appName", appName); | ||
62 | } | 62 | } | ||
63 | 63 | | |||
64 | function streamsForPid(pid) { | 64 | function streamsForPid(pid) { | ||
65 | return findStreams("pid", pid); | 65 | var streams = findStreams("pid", pid); | ||
66 | | ||||
67 | if (streams.length === 0) { | ||||
68 | for (var i = 0, length = instantiator.count; i < length; ++i) { | ||||
69 | var stream = instantiator.objectAt(i); | ||||
70 | | ||||
71 | if (stream.parentPid === -1) { | ||||
72 | stream.parentPid = backend.parentPid(stream.pid); | ||||
73 | } | ||||
74 | | ||||
75 | if (stream.parentPid === pid) { | ||||
76 | streams.push(stream); | ||||
77 | } | ||||
78 | } | ||||
79 | } | ||||
80 | | ||||
81 | return streams; | ||||
66 | } | 82 | } | ||
67 | 83 | | |||
68 | // QtObject has no default property, hence adding the Instantiator to one explicitly. | 84 | // QtObject has no default property, hence adding the Instantiator to one explicitly. | ||
69 | property var instantiator: Instantiator { | 85 | property var instantiator: Instantiator { | ||
70 | model: PulseObjectFilterModel { | 86 | model: PulseObjectFilterModel { | ||
71 | filters: [ { role: "VirtualStream", value: false } ] | 87 | filters: [ { role: "VirtualStream", value: false } ] | ||
72 | sourceModel: SinkInputModel {} | 88 | sourceModel: SinkInputModel {} | ||
73 | } | 89 | } | ||
74 | 90 | | |||
75 | delegate: QtObject { | 91 | delegate: QtObject { | ||
76 | readonly property int pid: Client ? Client.properties["application.process.id"] : 0 | 92 | readonly property int pid: Client ? Client.properties["application.process.id"] : 0 | ||
93 | // Determined on demand. | ||||
94 | property int parentPid: -1 | ||||
77 | readonly property string appName: Client ? Client.properties["application.name"] : "" | 95 | readonly property string appName: Client ? Client.properties["application.name"] : "" | ||
78 | readonly property bool muted: Muted | 96 | readonly property bool muted: Muted | ||
79 | // whether there is nothing actually going on on that stream | 97 | // whether there is nothing actually going on on that stream | ||
80 | readonly property bool corked: Corked | 98 | readonly property bool corked: Corked | ||
81 | 99 | | |||
82 | function mute() { | 100 | function mute() { | ||
83 | Muted = true | 101 | Muted = true | ||
84 | } | 102 | } | ||
Show All 9 Lines |