Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/DeviceListItem.qml
Show All 14 Lines | 1 | /* | |||
---|---|---|---|---|---|
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.0 | 21 | import QtQuick 2.0 | ||
22 | 22 | | |||
23 | import "../code/icon.js" as Icon | ||||
24 | | ||||
23 | ListItemBase { | 25 | ListItemBase { | ||
24 | readonly property var currentPort: Ports[ActivePortIndex] | 26 | readonly property var currentPort: Ports[ActivePortIndex] | ||
25 | property bool onlyOne: false | 27 | property bool onlyOne: false | ||
26 | 28 | | |||
27 | draggable: false | 29 | draggable: false | ||
28 | label: { | 30 | label: { | ||
29 | if (!currentPort) { | 31 | if (!currentPort) { | ||
30 | return Description | 32 | return Description | ||
31 | } else { | 33 | } else { | ||
32 | if (onlyOne) { | 34 | if (onlyOne) { | ||
33 | return currentPort.description | 35 | return currentPort.description | ||
34 | } else { | 36 | } else { | ||
35 | return i18nc("label of device items", "%1 (%2)", currentPort.description, Description) | 37 | return i18nc("label of device items", "%1 (%2)", currentPort.description, Description) | ||
36 | } | 38 | } | ||
37 | } | 39 | } | ||
38 | } | 40 | } | ||
39 | labelOpacity: onlyOne ? 1 : 0.6 | 41 | labelOpacity: onlyOne ? 1 : 0.6 | ||
40 | icon: { | 42 | icon: Icon.formFactorIcon(FormFactor) || IconName | ||
41 | switch(FormFactor) { | | |||
42 | case "internal": | | |||
43 | return "audio-card"; | | |||
44 | case "speaker": | | |||
45 | return "audio-speakers-symbolic"; | | |||
46 | case "phone": | | |||
47 | return "phone"; | | |||
48 | case "handset": | | |||
49 | return "phone"; | | |||
50 | case "tv": | | |||
51 | return "video-television"; | | |||
52 | case "webcam": | | |||
53 | return "camera-web"; | | |||
54 | case "microphone": | | |||
55 | return "audio-input-microphone"; | | |||
56 | case "headset": | | |||
57 | return "audio-headset"; | | |||
58 | case "headphone": | | |||
59 | return "audio-headphones"; | | |||
60 | case "hands-free": | | |||
61 | return "hands-free"; break; | | |||
62 | case "car": | | |||
63 | return "car"; break; | | |||
64 | case "hifi": | | |||
65 | return "hifi"; break; | | |||
66 | case "computer": | | |||
67 | return "computer"; break; | | |||
68 | case "portable": | | |||
69 | return "portable"; break; | | |||
70 | } | | |||
71 | return IconName; | | |||
72 | } | | |||
73 | } | 43 | } |