WIP: add Qt Quick HomeScreen UI
[staging/HomeScreen.git] / HomeScreenNG / qml / ShortcutArea.qml
1 import QtQuick 2.7
2 import QtQuick.Layouts 1.1
3 import HomeScreen 1.0
4
5 Item {
6     id: root
7     width: 785
8     height: 218
9
10     ApplicationLauncher {
11         id: launcher
12     }
13
14     ListModel {
15         id: applicationModel
16         ListElement {
17             name: 'Home'
18             application: 'launcher'
19         }
20         ListElement {
21             name: 'Multimedia'
22             application: 'musicplayer'
23         }
24         ListElement {
25             name: 'HVAC'
26             application: 'hvac'
27         }
28         ListElement {
29             name: 'Navigation'
30             application: 'navigation'
31         }
32     }
33
34     property int currentIndex: -1 // TODO: to be moved to whereever right
35
36     RowLayout {
37         anchors.fill: parent
38         spacing: 2
39         Repeater {
40             model: applicationModel
41             delegate: ShortcutIcon {
42                 Layout.fillWidth: true
43                 Layout.fillHeight: true
44                 name: model.name
45                 active: model.index === root.currentIndex
46                 onClicked: {
47                     root.currentIndex = active ? -1 : model.index
48                     launcher.launch(model.application)
49                 }
50             }
51         }
52     }
53 }