Changeset View
Changeset View
Standalone View
Standalone View
src/kcm/package/contents/ui/DeviceListItem.qml
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | 69 | RowLayout { | |||
---|---|---|---|---|---|
70 | visible: portbox.count > 1 | 70 | visible: portbox.count > 1 | ||
71 | 71 | | |||
72 | Label { | 72 | Label { | ||
73 | text: i18n("Port") | 73 | text: i18n("Port") | ||
74 | } | 74 | } | ||
75 | 75 | | |||
76 | ComboBox { | 76 | ComboBox { | ||
77 | id: portbox | 77 | id: portbox | ||
78 | readonly property var ports: Ports | | |||
79 | Layout.fillWidth: true | 78 | Layout.fillWidth: true | ||
80 | onModelChanged: currentIndex = ActivePortIndex | 79 | onModelChanged: currentIndex = model.indexOf(Ports[ActivePortIndex]) | ||
81 | currentIndex: ActivePortIndex | 80 | currentIndex: ActivePortIndex | ||
82 | onActivated: ActivePortIndex = index | 81 | onActivated: ActivePortIndex = Ports.indexOf(model[index]) | ||
82 | textRole: "description" | ||||
83 | | ||||
84 | model: Ports.filter(function (port) { | ||||
85 | // If availability is unknown show the port | ||||
86 | return port.availability !== Port.Unavailable | ||||
87 | }) | ||||
83 | 88 | | |||
84 | onPortsChanged: { | | |||
85 | var items = []; | | |||
86 | for (var i = 0; i < ports.length; ++i) { | | |||
87 | var port = ports[i]; | | |||
88 | var text = port.description; | | |||
89 | if (port.availability == Port.Unavailable) { | | |||
90 | if (port.name == "analog-output-speaker" || port.name == "analog-input-microphone-internal") { | | |||
91 | text += i18nc("Port is unavailable", " (unavailable)"); | | |||
92 | } else { | | |||
93 | text += i18nc("Port is unplugged", " (unplugged)"); | | |||
94 | } | | |||
95 | } | | |||
96 | items.push(text); | | |||
97 | } | | |||
98 | model = items; | | |||
99 | } | | |||
100 | } | 89 | } | ||
101 | } | 90 | } | ||
102 | 91 | | |||
103 | VolumeSlider {} | 92 | VolumeSlider {} | ||
104 | } | 93 | } | ||
105 | 94 | | |||
106 | ListItemSeperator { view: delegate.ListView.view } | 95 | ListItemSeperator { view: delegate.ListView.view } | ||
107 | } | 96 | } |