Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/ListItemBase.qml
Show All 18 Lines | |||||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.4 | 21 | import QtQuick 2.4 | ||
22 | import QtQuick.Controls 1.0 | 22 | import QtQuick.Controls 1.0 | ||
23 | import QtQuick.Layouts 1.0 | 23 | import QtQuick.Layouts 1.0 | ||
24 | 24 | | |||
25 | import org.kde.kquickcontrolsaddons 2.0 | 25 | import org.kde.kquickcontrolsaddons 2.0 | ||
26 | import org.kde.plasma.components 2.0 as PlasmaComponents | 26 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
27 | import org.kde.plasma.components 3.0 as PlasmaComponents3 | ||||
27 | import org.kde.plasma.core 2.0 as PlasmaCore | 28 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
28 | import org.kde.plasma.extras 2.0 as PlasmaExtras | 29 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||
29 | import org.kde.draganddrop 2.0 as DragAndDrop | 30 | import org.kde.draganddrop 2.0 as DragAndDrop | ||
30 | import org.kde.plasma.private.volume 0.1 | 31 | import org.kde.plasma.private.volume 0.1 | ||
31 | 32 | | |||
32 | import "../code/icon.js" as Icon | 33 | import "../code/icon.js" as Icon | ||
33 | 34 | | |||
34 | PlasmaComponents.ListItem { | 35 | PlasmaComponents.ListItem { | ||
Show All 12 Lines | |||||
47 | ListView.delayRemove: dragArea.dragActive | 48 | ListView.delayRemove: dragArea.dragActive | ||
48 | 49 | | |||
49 | Item { | 50 | Item { | ||
50 | width: parent.width | 51 | width: parent.width | ||
51 | height: rowLayout.height | 52 | height: rowLayout.height | ||
52 | 53 | | |||
53 | RowLayout { | 54 | RowLayout { | ||
54 | id: rowLayout | 55 | id: rowLayout | ||
55 | width: parent.width | 56 | anchors.left: parent.left | ||
57 | anchors.right: parent.right | ||||
58 | anchors.rightMargin: LayoutMirroring.enabled ? 0 : units.smallSpacing | ||||
59 | anchors.leftMargin: LayoutMirroring.enabled ? units.smallSpacing : 0 | ||||
56 | spacing: units.smallSpacing | 60 | spacing: units.smallSpacing | ||
57 | 61 | | |||
58 | PlasmaCore.IconItem { | 62 | PlasmaCore.IconItem { | ||
59 | id: clientIcon | 63 | id: clientIcon | ||
60 | Layout.alignment: Qt.AlignHCenter | 64 | Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter | ||
61 | Layout.preferredHeight: column.height * 0.75 | 65 | Layout.preferredHeight: column.height * 0.75 | ||
62 | Layout.preferredWidth: Layout.preferredHeight | 66 | Layout.preferredWidth: Layout.preferredHeight | ||
63 | source: "unknown" | 67 | source: "unknown" | ||
64 | 68 | | |||
65 | onSourceChanged: { | 69 | onSourceChanged: { | ||
66 | if (!valid && source != "unknown") { | 70 | if (!valid && source != "unknown") { | ||
67 | source = "unknown"; | 71 | source = "unknown"; | ||
68 | } | 72 | } | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 114 | PlasmaExtras.Heading { | |||
111 | id: textLabel | 115 | id: textLabel | ||
112 | Layout.fillWidth: true | 116 | Layout.fillWidth: true | ||
113 | height: undefined | 117 | height: undefined | ||
114 | level: 5 | 118 | level: 5 | ||
115 | opacity: 0.6 | 119 | opacity: 0.6 | ||
116 | wrapMode: Text.NoWrap | 120 | wrapMode: Text.NoWrap | ||
117 | elide: Text.ElideRight | 121 | elide: Text.ElideRight | ||
118 | } | 122 | } | ||
123 | | ||||
119 | SmallToolButton { | 124 | SmallToolButton { | ||
120 | id: contextMenuButton | 125 | id: contextMenuButton | ||
ndavis: According to the HIG, this should have title style capitalization.
https://hig.kde. | |||||
121 | icon: "application-menu" | 126 | icon: "application-menu" | ||
122 | checkable: true | 127 | checkable: true | ||
123 | onClicked: contextMenu.show() | 128 | onClicked: contextMenu.show() | ||
124 | tooltip: i18n("Show additional options for %1", textLabel.text) | 129 | tooltip: i18n("Show additional options for %1", textLabel.text) | ||
125 | } | 130 | } | ||
126 | } | 131 | } | ||
127 | 132 | | |||
128 | RowLayout { | 133 | RowLayout { | ||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | |||||
209 | } | 214 | } | ||
210 | 215 | | |||
211 | TextMetrics { | 216 | TextMetrics { | ||
212 | id: percentMetrics | 217 | id: percentMetrics | ||
213 | font: percentText.font | 218 | font: percentText.font | ||
214 | text: i18nc("only used for sizing, should be widest possible string", "100%") | 219 | text: i18nc("only used for sizing, should be widest possible string", "100%") | ||
215 | } | 220 | } | ||
216 | } | 221 | } | ||
222 | | ||||
223 | RowLayout { | ||||
224 | Layout.fillWidth: true | ||||
225 | | ||||
226 | Item { | ||||
227 | Layout.fillWidth: true | ||||
228 | } | ||||
229 | | ||||
230 | PlasmaComponents3.Button { | ||||
231 | id: defaultButton | ||||
GB_2: "Default Device" | |||||
232 | text: i18n("Default Device") | ||||
GB_2: What about always showing the icon? | |||||
I tried that, but it looked sort of weird. I kind of like how the presence of the icon helps to show what's the default device. ngraham: I tried that, but it looked sort of weird. I kind of like how the presence of the icon helps to… | |||||
GB_2: Maybe you can also use `star-shape` | |||||
233 | icon.name: "favorite" | ||||
234 | checkable: true | ||||
235 | checked: PulseObject.default | ||||
236 | visible: (type == "sink" && sinkView.model.count > 1) || (type == "source" && sourceView.model.count > 1) | ||||
237 | onClicked: PulseObject.default = true; | ||||
238 | } | ||||
239 | } | ||||
217 | } | 240 | } | ||
218 | } | 241 | } | ||
219 | 242 | | |||
220 | DragAndDrop.DropArea { | 243 | DragAndDrop.DropArea { | ||
221 | id: dropArea | 244 | id: dropArea | ||
222 | anchors.fill: parent | 245 | anchors.fill: parent | ||
223 | enabled: draggedStream | 246 | enabled: draggedStream | ||
224 | 247 | | |||
Show All 35 Lines | 269 | PlasmaComponents.ContextMenu { | |||
260 | } | 283 | } | ||
261 | function newMenuItem() { | 284 | function newMenuItem() { | ||
262 | return Qt.createQmlObject("import org.kde.plasma.components 2.0 as PlasmaComponents; PlasmaComponents.MenuItem {}", contextMenu); | 285 | return Qt.createQmlObject("import org.kde.plasma.components 2.0 as PlasmaComponents; PlasmaComponents.MenuItem {}", contextMenu); | ||
263 | } | 286 | } | ||
264 | 287 | | |||
265 | function loadDynamicActions() { | 288 | function loadDynamicActions() { | ||
266 | contextMenu.clearMenuItems(); | 289 | contextMenu.clearMenuItems(); | ||
267 | 290 | | |||
268 | // Mute | | |||
269 | var menuItem = newMenuItem(); | | |||
270 | menuItem.text = i18nc("Checkable switch for (un-)muting sound output.", "Mute"); | | |||
271 | menuItem.checkable = true; | | |||
272 | menuItem.checked = Muted; | | |||
273 | menuItem.clicked.connect(function() { | | |||
274 | Muted = !Muted | | |||
275 | }); | | |||
276 | contextMenu.addMenuItem(menuItem); | | |||
277 | | ||||
278 | // Default | | |||
279 | if (typeof PulseObject.default === "boolean") { | | |||
280 | var menuItem = newMenuItem(); | | |||
281 | menuItem.text = i18nc("Checkable switch to change the current default output.", "Default"); | | |||
282 | menuItem.checkable = true; | | |||
283 | menuItem.checked = PulseObject.default | | |||
284 | menuItem.clicked.connect(function() { | | |||
285 | PulseObject.default = true | | |||
286 | }); | | |||
287 | contextMenu.addMenuItem(menuItem); | | |||
288 | } | | |||
289 | | ||||
290 | // Raise max volume | 291 | // Raise max volume | ||
291 | menuItem = newMenuItem(); | 292 | menuItem = newMenuItem(); | ||
292 | menuItem.text = i18n("Raise maximum volume"); | 293 | menuItem.text = i18n("Raise maximum volume"); | ||
293 | menuItem.checkable = true; | 294 | menuItem.checkable = true; | ||
294 | menuItem.checked = slider.forceRaiseMaxVolume; | 295 | menuItem.checked = slider.forceRaiseMaxVolume; | ||
295 | menuItem.clicked.connect(function() { | 296 | menuItem.clicked.connect(function() { | ||
296 | slider.forceRaiseMaxVolume = !slider.forceRaiseMaxVolume; | 297 | slider.forceRaiseMaxVolume = !slider.forceRaiseMaxVolume; | ||
297 | if (!slider.forceRaiseMaxVolume && Volume > PulseAudio.NormalVolume) { | 298 | if (!slider.forceRaiseMaxVolume && Volume > PulseAudio.NormalVolume) { | ||
▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines |
According to the HIG, this should have title style capitalization.
https://hig.kde.org/style/writing/capitalization.html