add source for ces2019 horizontal
[apps/onscreenapp.git] / app / main.qml
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
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.6
18 import QtQuick.Window 2.2
19 import QtQuick.Layouts 1.1
20 import QtQuick.Controls 2.0
21 import AGL.Demo.Controls 1.0
22
23 ApplicationWindow {
24     id: root
25     visible: true
26     width: 1080
27     height: 1488
28     color: "#00000000"
29
30 //    function qmlOnScreenMessage(text) {
31 //        console.log(qsTr('OnScreenApp >>> qmlOnScreenMessage.'));
32 //        if(text == "incoming call")
33 //        {
34 //            label.text = "incoming call";
35 //            answerButton.active = true;
36 //            answerButton.checked = false;
37 //        }
38 //        else if(text == "call answered")
39 //        {
40 //            label.text = "call answered";
41 //            answerButton.active = false;
42 //            answerButton.checked = true;
43 //        }
44 //        else if(text == "call rejected")
45 //        {
46 //            label.text = "call rejected";
47 //            answerButton.active = false;
48 //            answerButton.checked = true;
49 //        }
50 //    }
51
52     function qmlOnScreenMessage(text) {
53         console.log(qsTr('OnScreenApp >>> qmlOnScreenMessage.'));
54         if (osLoader.status == Loader.Ready) {
55             if (osLoader.item && osLoader.item.qmlOnScreenMessage) {
56                 osLoader.item.qmlOnScreenMessage(text);
57             }
58         }
59     }
60
61     function qmlLoader(url) {
62         console.log(qsTr('OnScreenApp >>> qmlLoader load ' + url));
63         osLoader.source = url;
64     }
65
66     function qmlSetClearBackgroud() {
67         console.log(qsTr('OnScreenApp >>> qmlSetClearBackgroud.'));
68         background_image.source = "";
69         default_label.text = "";
70     }
71
72     function qmlSetDefaultBackground(message) {
73         console.log(qsTr('OnScreenApp >>> qmlSetDefaultBackground.'));
74         background_image.source = "qrc:/images/HMI_Phone_Back.svg";
75         default_label.text = message;
76     }
77
78     background : Image {
79         id: background_image
80         anchors.fill: parent
81         anchors.topMargin: 0
82         anchors.bottomMargin: 0
83 //        source: "qrc:/images/HMI_Phone_Back.svg"
84     }
85
86     Label {
87         id: default_label
88         x: 40
89         y: 140
90         width: 1000
91         height: 100
92         color: "#eeeeec"
93         text: "default message"
94         textFormat: Text.AutoText
95         font.wordSpacing: 0
96         verticalAlignment: Text.AlignVCenter
97         horizontalAlignment: Text.AlignHCenter
98         font.pixelSize: 50
99     }
100
101     Loader {
102         objectName: "loaderObject"
103         id: osLoader
104         x: 0
105         y: 0
106         width: 640
107         height: 720
108     }
109 }