add visa, start websocket implementation
[staging/HomeScreen.git] / HomeScreen / qml / Home.qml
1 /*
2  * Copyright (C) 2016 The Qt Company Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 import QtQuick 2.2
18 import QtQuick.Layouts 1.1
19 import QtQuick.Controls 1.0
20 import Home 1.0
21
22 Item {
23     id: root
24     property int pid: -1
25     signal languageChanged
26
27     Image {
28         anchors.fill: parent
29         anchors.topMargin: -218
30         anchors.bottomMargin: -215
31         source: './images/AGL_HMI_Background_Car-01.png'
32     }
33     Image {
34         id: sign90
35         width: 200
36         height: 200
37         anchors.horizontalCenter: parent.horizontalCenter
38         anchors.top: parent.top
39         anchors.topMargin: 20
40         source: './images/B14-90.png'
41         visible: false
42     }
43     Image {
44         id: visa
45         width: 200
46         height: 124
47         anchors.right: parent.right
48         anchors.rightMargin: 20
49         anchors.top: parent.top
50         anchors.topMargin: 20
51         source: './images/visa.png'
52         visible: false
53     }
54     Item {
55         id: hello
56         anchors.horizontalCenter: parent.horizontalCenter
57         anchors.bottom: parent.bottom
58         anchors.bottomMargin: 40
59         visible: false
60         Text {
61             id: helloText
62             anchors.centerIn: parent
63             color: "white"
64             text: "Hello José!"
65             font.pixelSize: 40
66             font.family: "Roboto"
67             SequentialAnimation on font.letterSpacing {
68                 id: animation1
69                 loops: 1;
70                 NumberAnimation { from: 0; to: 50; easing.type: Easing.InQuad; duration: 3000 }
71                 onRunningChanged: {
72                     if(running)
73                         hello.visible = true
74                     else
75                         hello.visible = false
76                 }
77             }
78
79             SequentialAnimation on opacity {
80                 id: animation2
81                 loops: 1;
82                 NumberAnimation { from: 1; to: 0; duration: 2600 }
83                 PauseAnimation { duration: 400 }
84             }
85         }
86     }
87     function showHello(helloString) {
88         helloText.text = helloString
89         animation1.running = true;
90         animation2.running = true;
91     }
92
93     function showSign90(show) {
94         sign90.visible = show
95     }
96
97     function showVisa(show) {
98         visa.visible = show
99     }
100     GridView {
101         anchors.centerIn: parent
102         width: cellHeight * 3
103         height: cellHeight * 3
104         cellWidth: 320
105         cellHeight: 320
106
107         model: ApplicationModel {}
108         delegate: MouseArea {
109             width: 320
110             height: 320
111             Image {
112                 anchors.fill: parent
113                 source: './images/HMI_AppLauncher_%1_%2-01.png'.arg(model.icon).arg(pressed ? 'Active' : 'Inactive')
114                 Label {
115                     id: labelName
116                     anchors.horizontalCenter: parent.horizontalCenter
117                     horizontalAlignment: Text.AlignHCenter
118                     y: 257
119                     font.pixelSize: 32
120                     font.family: "Roboto"
121                     color: "white"
122                     text: '%1'.arg(model.name)
123                     function myChangeLanguage() {
124                         text = '%1'.arg(model.name)
125                     }
126                     Component.onCompleted: {
127                         root.languageChanged.connect(myChangeLanguage)
128                     }
129                 }
130             }
131             onClicked: {
132                 console.log("app is ", model.id)
133                 pid = launcher.launch(model.id)
134                 layoutHandler.makeMeVisible(pid)
135
136                 applicationArea.visible = true
137                 appLauncherAreaLauncher.visible = false
138                 layoutHandler.showAppLayer()
139             }
140         }
141     }
142 }