Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/ListItemBase.qml
Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | 112 | RowLayout { | |||
---|---|---|---|---|---|
115 | PlasmaExtras.Heading { | 115 | PlasmaExtras.Heading { | ||
116 | id: textLabel | 116 | id: textLabel | ||
117 | Layout.fillWidth: true | 117 | Layout.fillWidth: true | ||
118 | height: undefined | 118 | height: undefined | ||
119 | level: 5 | 119 | level: 5 | ||
120 | opacity: 0.6 | 120 | opacity: 0.6 | ||
121 | wrapMode: Text.NoWrap | 121 | wrapMode: Text.NoWrap | ||
122 | elide: Text.ElideRight | 122 | elide: Text.ElideRight | ||
123 | visible: !portbox.visible | ||||
124 | } | ||||
125 | | ||||
126 | PlasmaComponents3.ComboBox { | ||||
127 | id: portbox | ||||
128 | visible: portbox.count > 1 | ||||
129 | Layout.minimumWidth: units.gridUnit * 12 | ||||
130 | model: { | ||||
131 | var items = []; | ||||
132 | for (var i = 0; i < PulseObject.ports.length; ++i) { | ||||
133 | var port = PulseObject.ports[i]; | ||||
134 | if (port.availability != Port.Unavailable) { | ||||
135 | items.push(port.description); | ||||
136 | } | ||||
137 | } | ||||
138 | return items | ||||
139 | } | ||||
140 | currentIndex: ActivePortIndex | ||||
141 | onActivated: ActivePortIndex = index | ||||
142 | } | ||||
143 | | ||||
144 | Item { | ||||
145 | visible: portbox.visible | ||||
146 | Layout.fillWidth: true | ||||
147 | } | ||||
148 | | ||||
149 | PlasmaComponents3.ToolButton { | ||||
150 | id: defaultButton | ||||
151 | text: i18n("Default Device") | ||||
152 | icon.name: "favorite" | ||||
153 | checkable: true | ||||
154 | checked: PulseObject.default | ||||
155 | visible: (type == "sink" && sinkView.model.count > 1) || (type == "source" && sourceView.model.count > 1) | ||||
156 | onClicked: PulseObject.default = true; | ||||
123 | } | 157 | } | ||
124 | 158 | | |||
125 | SmallToolButton { | 159 | SmallToolButton { | ||
126 | id: contextMenuButton | 160 | id: contextMenuButton | ||
127 | icon: "application-menu" | 161 | icon: "application-menu" | ||
128 | checkable: true | 162 | checkable: true | ||
129 | onClicked: contextMenu.show() | 163 | onClicked: contextMenu.show() | ||
130 | tooltip: i18n("Show additional options for %1", textLabel.text) | 164 | tooltip: i18n("Show additional options for %1", textLabel.text) | ||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | 168 | RowLayout { | |||
216 | } | 250 | } | ||
217 | 251 | | |||
218 | TextMetrics { | 252 | TextMetrics { | ||
219 | id: percentMetrics | 253 | id: percentMetrics | ||
220 | font: percentText.font | 254 | font: percentText.font | ||
221 | text: i18nc("only used for sizing, should be widest possible string", "100%") | 255 | text: i18nc("only used for sizing, should be widest possible string", "100%") | ||
222 | } | 256 | } | ||
223 | } | 257 | } | ||
224 | | ||||
225 | RowLayout { | | |||
226 | Layout.fillWidth: true | | |||
227 | | ||||
228 | Item { | | |||
229 | Layout.fillWidth: true | | |||
230 | } | | |||
231 | | ||||
232 | PlasmaComponents3.Button { | | |||
233 | id: defaultButton | | |||
234 | text: i18n("Default Device") | | |||
235 | icon.name: "favorite" | | |||
236 | checkable: true | | |||
237 | checked: PulseObject.default | | |||
238 | visible: (type == "sink" && sinkView.model.count > 1) || (type == "source" && sourceView.model.count > 1) | | |||
239 | onClicked: PulseObject.default = true; | | |||
240 | } | | |||
241 | } | | |||
242 | } | 258 | } | ||
243 | } | 259 | } | ||
244 | 260 | | |||
245 | DragAndDrop.DropArea { | 261 | DragAndDrop.DropArea { | ||
246 | id: dropArea | 262 | id: dropArea | ||
247 | anchors.fill: parent | 263 | anchors.fill: parent | ||
248 | enabled: draggedStream | 264 | enabled: draggedStream | ||
249 | 265 | | |||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 331 | } else if (type == "sink") { | |||
317 | menuItem.text = i18n("Play all audio via this device"); | 333 | menuItem.text = i18n("Play all audio via this device"); | ||
318 | menuItem.icon = "audio-on" // or "audio-ready" // or "audio-speakers-symbolic" | 334 | menuItem.icon = "audio-on" // or "audio-ready" // or "audio-speakers-symbolic" | ||
319 | menuItem.clicked.connect(function() { | 335 | menuItem.clicked.connect(function() { | ||
320 | PulseObject.switchStreams(); | 336 | PulseObject.switchStreams(); | ||
321 | }); | 337 | }); | ||
322 | contextMenu.addMenuItem(menuItem); | 338 | contextMenu.addMenuItem(menuItem); | ||
323 | } | 339 | } | ||
324 | 340 | | |||
325 | // Ports | | |||
326 | if (PulseObject.ports && PulseObject.ports.length > 0) { | | |||
327 | contextMenu.addMenuItem(newSeperator()); | | |||
328 | | ||||
329 | var isMultiplePorts = (1 < PulseObject.ports.length); | | |||
330 | var menuItem = newMenuItem(); | | |||
331 | menuItem.text = i18nc("Heading for a list of ports of a device (for example built-in laptop speakers or a plug for headphones)", "Ports"); | | |||
332 | menuItem.section = true; | | |||
333 | contextMenu.addMenuItem(menuItem); | | |||
334 | | ||||
335 | for (var i = 0; i < PulseObject.ports.length; i++) { | | |||
336 | var port = PulseObject.ports[i]; | | |||
337 | var menuItem = newMenuItem(); | | |||
338 | menuItem.text = port.description; | | |||
339 | if (port.availability == Port.Unavailable) { | | |||
340 | if (port.name == "analog-output-speaker" || port.name == "analog-input-microphone-internal") { | | |||
341 | menuItem.text += i18nc("Port is unavailable", " (unavailable)"); | | |||
342 | } else { | | |||
343 | menuItem.text += i18nc("Port is unplugged", " (unplugged)"); | | |||
344 | } | | |||
345 | } | | |||
346 | menuItem.enabled = isMultiplePorts; | | |||
347 | menuItem.checkable = true; | | |||
348 | menuItem.checked = i === PulseObject.activePortIndex; | | |||
349 | var setActivePort = function(portIndex) { | | |||
350 | return function() { | | |||
351 | PulseObject.activePortIndex = portIndex; | | |||
352 | }; | | |||
353 | }; | | |||
354 | menuItem.clicked.connect(setActivePort(i)); | | |||
355 | contextMenu.addMenuItem(menuItem); | | |||
356 | } | | |||
357 | } | | |||
358 | | ||||
359 | // Choose output / input device | 341 | // Choose output / input device | ||
360 | // By choice only shown when there are at least two options | 342 | // By choice only shown when there are at least two options | ||
361 | if ((type == "sink-input" && sinkView.model.count > 1) || (type == "source-input" && sourceView.model.count > 1)) { | 343 | if ((type == "sink-input" && sinkView.model.count > 1) || (type == "source-input" && sourceView.model.count > 1)) { | ||
362 | contextMenu.addMenuItem(newSeperator()); | 344 | contextMenu.addMenuItem(newSeperator()); | ||
363 | var menuItem = newMenuItem(); | 345 | var menuItem = newMenuItem(); | ||
364 | if (type == "sink-input") { | 346 | if (type == "sink-input") { | ||
365 | menuItem.text = i18nc("Heading for a list of possible output devices (speakers, headphones, ...) to choose", "Play audio using"); | 347 | menuItem.text = i18nc("Heading for a list of possible output devices (speakers, headphones, ...) to choose", "Play audio using"); | ||
366 | } else { | 348 | } else { | ||
Show All 30 Lines |