Changeset View
Changeset View
Standalone View
Standalone View
src/kcm/package/contents/ui/DeviceListItem.qml
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 38 | RowLayout { | |||
---|---|---|---|---|---|
46 | ColumnLayout { | 46 | ColumnLayout { | ||
47 | id: delegateColumn | 47 | id: delegateColumn | ||
48 | Layout.fillWidth: true | 48 | Layout.fillWidth: true | ||
49 | 49 | | |||
50 | RowLayout { | 50 | RowLayout { | ||
51 | Label { | 51 | Label { | ||
52 | id: inputText | 52 | id: inputText | ||
53 | Layout.fillWidth: true | 53 | Layout.fillWidth: true | ||
54 | visible: !portbox.visible | ||||
54 | elide: Text.ElideRight | 55 | elide: Text.ElideRight | ||
55 | text: !currentPort ? Description : i18ndc("kcm_pulseaudio", "label of device items", "%1 (%2)", currentPort.description, Description) | 56 | text: !currentPort ? Description : i18ndc("kcm_pulseaudio", "label of device items", "%1 (%2)", currentPort.description, Description) | ||
56 | } | 57 | } | ||
57 | 58 | | |||
58 | Label { | | |||
59 | visible: portbox.count > 1 | | |||
60 | text: i18nd("kcm_pulseaudio", "Port:") | | |||
61 | } | | |||
62 | | ||||
63 | ComboBox { | 59 | ComboBox { | ||
64 | id: portbox | 60 | id: portbox | ||
65 | visible: portbox.count > 1 | 61 | visible: portbox.count > 1 | ||
66 | readonly property var ports: Ports | 62 | model: { | ||
67 | onModelChanged: currentIndex = ActivePortIndex | | |||
68 | currentIndex: ActivePortIndex | | |||
69 | onActivated: ActivePortIndex = index | | |||
70 | | ||||
71 | onPortsChanged: { | | |||
72 | var items = []; | 63 | var items = []; | ||
73 | for (var i = 0; i < ports.length; ++i) { | 64 | for (var i = 0; i < Ports.length; ++i) { | ||
74 | var port = ports[i]; | 65 | var port = Ports[i]; | ||
75 | var text = port.description; | 66 | if (port.availability != Port.Unavailable) { | ||
76 | if (port.availability == Port.Unavailable) { | 67 | items.push(port.description); | ||
77 | if (port.name == "analog-output-speaker" || port.name == "analog-input-microphone-internal") { | | |||
78 | text += i18ndc("kcm_pulseaudio", "Port is unavailable", " (unavailable)"); | | |||
79 | } else { | | |||
80 | text += i18ndc("kcm_pulseaudio", "Port is unplugged", " (unplugged)"); | | |||
81 | } | | |||
82 | } | 68 | } | ||
83 | items.push(text); | | |||
84 | } | 69 | } | ||
85 | model = items; | 70 | return items | ||
86 | } | 71 | } | ||
72 | currentIndex: ActivePortIndex | ||||
73 | onActivated: ActivePortIndex = index | ||||
87 | } | 74 | } | ||
88 | 75 | | |||
89 | Button { | 76 | Button { | ||
90 | text: i18n("Default Device") | 77 | text: i18n("Default Device") | ||
91 | icon.name: "favorite" | 78 | icon.name: "favorite" | ||
92 | visible: delegate.ListView.view.count > 1 | 79 | visible: delegate.ListView.view.count > 1 | ||
93 | checkable: true | 80 | checkable: true | ||
94 | checked: Default | 81 | checked: Default | ||
Show All 18 Lines |