Add 2017 to copyright
[staging/HomeScreen.git] / HomeScreen / qml / Home.qml
1 /*
2  * Copyright (C) 2016 The Qt Company Ltd.
3  * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 import QtQuick 2.2
19 import Home 1.0
20
21 Item {
22     id: root
23
24     Image {
25         anchors.fill: parent
26         anchors.topMargin: -218
27         anchors.bottomMargin: -215
28         source: './images/AGL_HMI_Background_Car-01.png'
29     }
30
31     property int pid: -1
32
33     GridView {
34         anchors.centerIn: parent
35         width: cellHeight * 3
36         height: cellHeight * 3
37         cellWidth: 320
38         cellHeight: 320
39         interactive: false
40
41         model: ApplicationModel {}
42         delegate: MouseArea {
43             width: 320
44             height: 320
45             Image {
46                 anchors.fill: parent
47                 source: './images/HMI_AppLauncher_%1_%2-01.png'.arg(model.icon).arg(pressed ? 'Active' : 'Inactive')
48             }
49             onClicked: {
50                 console.log("app is ", model.id)
51                 pid = launcher.launch(model.id)
52                 if (1 < pid) {
53                     layoutHandler.makeMeVisible(pid)
54
55                     applicationArea.visible = true
56                     appLauncherAreaLauncher.visible = false
57                     layoutHandler.showAppLayer(pid)
58                 }
59                 else {
60                     console.warn("app cannot be launched!")
61                 }
62             }
63         }
64     }
65 }