add fullscreen&notification&information function
[apps/homescreen.git] / homescreen / qml / ShortcutArea.qml
1 /*
2  * Copyright (C) 2016 The Qt Company Ltd.
3  * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
4  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 import QtQuick 2.2
20 import QtQuick.Layouts 1.1
21
22 Item {
23     id: root
24     width: 785
25     height: 218
26
27     ListModel {
28         id: applicationModel
29         ListElement {
30             appid: 'launcher'
31             name: 'launcher'
32             application: 'launcher@0.1'
33         }
34         ListElement {
35             appid: 'mediaplayer'
36             name: 'MediaPlayer'
37             application: 'mediaplayer@0.1'
38         }
39         ListElement {
40             appid: 'hvac'
41             name: 'HVAC'
42             application: 'hvac@0.1'
43         }
44         ListElement {
45             appid: 'navigation'
46             name: 'Navigation'
47             application: 'navigation@0.1'
48         }
49     }
50
51     property int pid: -1
52
53     RowLayout {
54         anchors.fill: parent
55         spacing: 2
56         Repeater {
57             model: applicationModel
58             delegate: ShortcutIcon {
59                 Layout.fillWidth: true
60                 Layout.fillHeight: true
61                 name: model.name
62                 active: model.name === launcher.current
63                 onClicked: {
64                     pid = launcher.launch(model.application)
65                     if (1 < pid) {
66                         applicationArea.visible = true
67                     }
68                     else {
69                         console.warn(model.application)
70                         console.warn("app cannot be launched!")
71                     }
72                     homescreenHandler.tapShortcut(model.appid, false)
73                 }
74             }
75         }
76     }
77 }