modify homescreen seq
[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: 700
25     height: 110
26
27     Timer {
28         id:informationTimer
29         interval: 3000
30         running: false
31         repeat: true
32         onTriggered: {
33             bottomInformation.visible = false
34         }
35     }
36
37
38     ListModel {
39         id: applicationModel
40         ListElement {
41             name: 'launcher'
42             application: 'launcher@0.1'
43         }
44         ListElement {
45             name: 'MediaPlayer'
46             application: 'mediaplayer@0.1'
47         }
48         ListElement {
49             name: 'navigation'
50             application: 'navigation@0.1'
51         }
52         ListElement {
53             name: 'Phone'
54             application: 'phone@0.1'
55         }
56         ListElement {
57             name: 'settings'
58             application: 'settings@0.1'
59         }
60     }
61
62     property int pid: -1
63
64     RowLayout {
65         anchors.fill: parent
66         spacing: 75
67         Repeater {
68             model: applicationModel
69             delegate: ShortcutIcon {
70 //                Layout.fillWidth: true
71 //                Layout.fillHeight: true
72                 width: 60
73                 height: 60
74                 name: model.name
75                 active: model.name === launcher.current
76                 onClicked: {
77 //                    if(model.application === 'navigation@0.1') {
78 //                        pid = launcher.launch('browser@5.0')
79 //                    } else {
80 //                        pid = launcher.launch(model.application.toLowerCase())
81 //                    }
82
83 //                    if (1 < pid) {
84                         applicationArea.visible = true
85 //                    }
86 //                    else {
87 //                        console.warn(model.application)
88 //                        console.warn("app cannot be launched!")
89 //                    }
90                     if(model.name === 'Navigation') {
91                         homescreenHandler.tapShortcut('browser')
92                     } else {
93                         homescreenHandler.tapShortcut(model.name)
94                     }
95                 }
96             }
97         }
98     }
99     Rectangle {
100         id: bottomInformation
101         width: parent.width
102         height: parent.height-20
103         anchors.bottom: parent.bottom
104         color: "gray"
105         z: 1
106         opacity: 0.8
107         visible: false
108
109         Text {
110             id: informationText
111             anchors.centerIn: parent
112             font.pixelSize: 25
113             font.letterSpacing: 5
114             horizontalAlignment: Text.AlignHCenter
115             color: "white"
116             text: ""
117         }
118     }
119
120     Connections {
121         target: homescreenHandler
122         onInformation: {
123             informationText.text = text
124             bottomInformation.visible = true
125             informationTimer.restart()
126         }
127     }
128 }