Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/DeviceListItem.qml
Show All 19 Lines | |||||
20 | 20 | | |||
21 | import QtQuick 2.0 | 21 | import QtQuick 2.0 | ||
22 | 22 | | |||
23 | ListItemBase { | 23 | ListItemBase { | ||
24 | readonly property var currentPort: Ports[ActivePortIndex] | 24 | readonly property var currentPort: Ports[ActivePortIndex] | ||
25 | 25 | | |||
26 | draggable: false | 26 | draggable: false | ||
27 | label: currentPort ? i18nc("label of device items", "%1 (%2)", currentPort.description, Description) : Description | 27 | label: currentPort ? i18nc("label of device items", "%1 (%2)", currentPort.description, Description) : Description | ||
28 | icon: { | 28 | icon: { | ||
29 | if (currentPort) { | 29 | switch(FormFactor) { | ||
30 | if (currentPort.name.indexOf("speaker") != -1) { | 30 | case "internal": | ||
31 | return "audio-card"; | ||||
32 | case "speaker": | ||||
31 | return "audio-speakers-symbolic"; | 33 | return "audio-speakers-symbolic"; | ||
32 | } else if (currentPort.name.indexOf("headphones") != -1) { | 34 | case "handset": | ||
33 | return "audio-headphones"; | 35 | return "phone"; | ||
34 | } else if (currentPort.name.indexOf("hdmi") != -1) { | 36 | case "tv": | ||
35 | return "video-television"; | 37 | return "video-television"; | ||
36 | } else if (currentPort.name.indexOf("mic") != -1) { | 38 | case "webcam": | ||
39 | return "camera-web"; | ||||
40 | case "microphone": | ||||
37 | return "audio-input-microphone"; | 41 | return "audio-input-microphone"; | ||
38 | } else if (currentPort.name.indexOf("phone") != -1) { | 42 | case "headset": | ||
drosca: Form factor will be the same for all ports, so just use `switch (FormFactor)` | |||||
drosca: This check is no longer needed. | |||||
39 | return "phone"; | 43 | return "audio-headset"; | ||
40 | } | 44 | case "headphone": | ||
45 | return "audio-headphones"; | ||||
46 | /* There are some form factors which we don't have any icon for, so we ignore them for now */ | ||||
47 | // case "hands-free": break; | ||||
48 | // case "car": break; | ||||
49 | // case "hifi": break; | ||||
50 | case "computer": | ||||
51 | return "computer"; break; | ||||
52 | // case "portable": break; | ||||
41 | } | 53 | } | ||
42 | return IconName; | 54 | return IconName; | ||
43 | } | 55 | } | ||
44 | } | 56 | } |
Form factor will be the same for all ports, so just use switch (FormFactor)