Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/ListItemBase.qml
Show All 31 Lines | |||||
32 | import org.kde.plasma.private.volume 0.1 | 32 | import org.kde.plasma.private.volume 0.1 | ||
33 | 33 | | |||
34 | import "../code/icon.js" as Icon | 34 | import "../code/icon.js" as Icon | ||
35 | 35 | | |||
36 | PlasmaComponents.ListItem { | 36 | PlasmaComponents.ListItem { | ||
37 | id: item | 37 | id: item | ||
38 | 38 | | |||
39 | property alias label: textLabel.text | 39 | property alias label: textLabel.text | ||
40 | property alias labelOpacity: textLabel.opacity | | |||
41 | property alias draggable: dragArea.enabled | 40 | property alias draggable: dragArea.enabled | ||
42 | property alias icon: clientIcon.source | 41 | property alias icon: clientIcon.source | ||
43 | property alias iconUsesPlasmaTheme: clientIcon.usesPlasmaTheme | 42 | property alias iconUsesPlasmaTheme: clientIcon.usesPlasmaTheme | ||
44 | property string type | 43 | property string type | ||
45 | 44 | | |||
46 | checked: dropArea.containsDrag | 45 | checked: dropArea.containsDrag | ||
47 | opacity: (draggedStream && draggedStream.deviceIndex == Index) ? 0.3 : 1.0 | 46 | opacity: (draggedStream && draggedStream.deviceIndex == Index) ? 0.3 : 1.0 | ||
48 | 47 | | |||
Show All 12 Lines | 54 | RowLayout { | |||
61 | spacing: units.smallSpacing | 60 | spacing: units.smallSpacing | ||
62 | 61 | | |||
63 | PlasmaCore.IconItem { | 62 | PlasmaCore.IconItem { | ||
64 | id: clientIcon | 63 | id: clientIcon | ||
65 | Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter | 64 | Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter | ||
66 | Layout.preferredHeight: column.height * 0.75 | 65 | Layout.preferredHeight: column.height * 0.75 | ||
67 | Layout.preferredWidth: Layout.preferredHeight | 66 | Layout.preferredWidth: Layout.preferredHeight | ||
68 | source: "unknown" | 67 | source: "unknown" | ||
68 | visible: type === "sink-input" || type === "source-input" | ||||
69 | 69 | | |||
70 | onSourceChanged: { | 70 | onSourceChanged: { | ||
71 | if (!valid && source != "unknown") { | 71 | if (!valid && source != "unknown") { | ||
72 | source = "unknown"; | 72 | source = "unknown"; | ||
73 | } | 73 | } | ||
74 | } | 74 | } | ||
75 | 75 | | |||
76 | DragAndDrop.DragArea { | 76 | DragAndDrop.DragArea { | ||
Show All 28 Lines | |||||
105 | } | 105 | } | ||
106 | } | 106 | } | ||
107 | 107 | | |||
108 | ColumnLayout { | 108 | ColumnLayout { | ||
109 | id: column | 109 | id: column | ||
110 | spacing: 1 | 110 | spacing: 1 | ||
111 | 111 | | |||
112 | RowLayout { | 112 | RowLayout { | ||
113 | Layout.fillWidth: true | 113 | Layout.fillWidth: true | ||
davidedmundson: That's asking for a binding loop.
An implicit size should never be based on a current size. | |||||
114 | 114 | | |||
115 | PlasmaComponents3.RadioButton { | ||||
Give the radio button a text: property and remove the heading item; that way the text will be clickable ngraham: Give the radio button a `text:` property and remove the heading item; that way the text will be… | |||||
116 | id: defaultButton | ||||
117 | checked: PulseObject.default | ||||
Margins should but don't get mirrored when using a RTL layout. I haven't tested anything, but I think you need to add a rightMargin when layout mirroring is enabled. filipf: Margins should but don't get mirrored when using a RTL layout. I haven't tested anything, but I… | |||||
118 | visible: (type == "sink" && sinkView.model.count > 1) || (type == "source" && sourceView.model.count > 1) | ||||
119 | onClicked: PulseObject.default = true; | ||||
120 | } | ||||
121 | | ||||
115 | PlasmaExtras.Heading { | 122 | PlasmaExtras.Heading { | ||
116 | id: textLabel | 123 | id: textLabel | ||
117 | Layout.fillWidth: true | 124 | Layout.fillWidth: true | ||
118 | height: undefined | 125 | height: undefined | ||
119 | level: 5 | 126 | level: 5 | ||
120 | opacity: 0.6 | | |||
121 | wrapMode: Text.NoWrap | 127 | wrapMode: Text.NoWrap | ||
122 | elide: Text.ElideRight | 128 | elide: Text.ElideRight | ||
123 | visible: !portbox.visible | 129 | visible: !portbox.visible | ||
124 | } | 130 | } | ||
125 | 131 | | |||
Don't multiply by 0.75; this could result in a fractional value and the spacing doesn't doesn't need to be literally pixel-identical with the mockup ngraham: Don't multiply by 0.75; this could result in a fractional value and the spacing doesn't doesn't… | |||||
126 | PlasmaComponents3.ComboBox { | 132 | PlasmaComponents3.ComboBox { | ||
Don't override this here. If it looks bad, let's fix it in the RadioButton control itself ngraham: Don't override this here. If it looks bad, let's fix it in the RadioButton control itself | |||||
127 | id: portbox | 133 | id: portbox | ||
128 | visible: portbox.count > 1 | 134 | visible: portbox.count > 1 | ||
129 | Layout.minimumWidth: units.gridUnit * 10 | 135 | Layout.minimumWidth: units.gridUnit * 10 | ||
130 | model: { | 136 | model: { | ||
131 | var items = []; | 137 | var items = []; | ||
132 | for (var i = 0; i < PulseObject.ports.length; ++i) { | 138 | for (var i = 0; i < PulseObject.ports.length; ++i) { | ||
133 | var port = PulseObject.ports[i]; | 139 | var port = PulseObject.ports[i]; | ||
134 | if (port.availability != Port.Unavailable) { | 140 | if (port.availability != Port.Unavailable) { | ||
135 | items.push(port.description); | 141 | items.push(port.description); | ||
136 | } | 142 | } | ||
137 | } | 143 | } | ||
138 | return items | 144 | return items | ||
139 | } | 145 | } | ||
140 | currentIndex: ActivePortIndex | 146 | currentIndex: ActivePortIndex | ||
141 | onActivated: ActivePortIndex = index | 147 | onActivated: ActivePortIndex = index | ||
142 | } | 148 | } | ||
143 | 149 | | |||
144 | Item { | 150 | Item { | ||
145 | visible: portbox.visible | 151 | visible: portbox.visible | ||
ngraham: This is the default wrap value; no need to explicitly set it | |||||
146 | Layout.fillWidth: true | 152 | Layout.fillWidth: true | ||
147 | } | 153 | } | ||
148 | 154 | | |||
149 | PlasmaComponents3.ToolButton { | | |||
150 | id: defaultButton | | |||
151 | text: i18n("Default Device") | | |||
152 | icon.name: PulseObject.default ? "starred-symbolic" : "non-starred-symbolic" | | |||
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; | | |||
157 | } | | |||
158 | | ||||
159 | SmallToolButton { | 155 | SmallToolButton { | ||
160 | id: contextMenuButton | 156 | id: contextMenuButton | ||
161 | icon: "application-menu" | 157 | icon: "application-menu" | ||
162 | checkable: true | 158 | checkable: true | ||
163 | onClicked: contextMenu.show() | 159 | onClicked: contextMenu.show() | ||
164 | tooltip: i18n("Show additional options for %1", textLabel.text) | 160 | tooltip: i18n("Show additional options for %1", textLabel.text) | ||
165 | } | 161 | } | ||
166 | } | 162 | } | ||
▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Line(s) | 327 | } else if (type == "sink") { | |||
334 | menuItem.icon = "audio-on" // or "audio-ready" // or "audio-speakers-symbolic" | 330 | menuItem.icon = "audio-on" // or "audio-ready" // or "audio-speakers-symbolic" | ||
335 | menuItem.clicked.connect(function() { | 331 | menuItem.clicked.connect(function() { | ||
336 | PulseObject.switchStreams(); | 332 | PulseObject.switchStreams(); | ||
337 | }); | 333 | }); | ||
338 | contextMenu.addMenuItem(menuItem); | 334 | contextMenu.addMenuItem(menuItem); | ||
339 | } | 335 | } | ||
340 | 336 | | |||
341 | // Choose output / input device | 337 | // Choose output / input device | ||
342 | // By choice only shown when there are at least two options | 338 | // By choice only shown when there are at least two options | ||
ngraham: By choice -> Intentionally | |||||
343 | if ((type == "sink-input" && sinkView.model.count > 1) || (type == "source-input" && sourceView.model.count > 1)) { | 339 | if ((type == "sink-input" && sinkView.model.count > 1) || (type == "source-input" && sourceView.model.count > 1)) { | ||
344 | contextMenu.addMenuItem(newSeperator()); | 340 | contextMenu.addMenuItem(newSeperator()); | ||
345 | var menuItem = newMenuItem(); | 341 | var menuItem = newMenuItem(); | ||
346 | if (type == "sink-input") { | 342 | if (type == "sink-input") { | ||
347 | menuItem.text = i18nc("Heading for a list of possible output devices (speakers, headphones, ...) to choose", "Play audio using"); | 343 | menuItem.text = i18nc("Heading for a list of possible output devices (speakers, headphones, ...) to choose", "Play audio using"); | ||
348 | } else { | 344 | } else { | ||
349 | menuItem.text = i18nc("Heading for a list of possible input devices (built-in microphone, headset, ...) to choose", "Record audio using"); | 345 | menuItem.text = i18nc("Heading for a list of possible input devices (built-in microphone, headset, ...) to choose", "Record audio using"); | ||
350 | } | 346 | } | ||
Show All 28 Lines |
That's asking for a binding loop.
An implicit size should never be based on a current size.
This could be:
Layout.minimumHeight: contextMenuButton.implicitHeight
Though I'm surprised you need this line at all.