add source for ces2019 horizontal
[apps/onscreenapp.git] / app / phone.qml
1 import QtQuick 2.6
2 import QtQuick.Window 2.2
3 import QtQuick.Layouts 1.1
4 import QtQuick.Controls 2.0
5 import AGL.Demo.Controls 1.0
6
7 Item {
8     id: onScreenPhone
9     visible: true
10     width: 640
11     height: 720
12     property string messageText: "Incoming Call"
13
14     function qmlOnScreenMessage(text) {
15         console.log(qsTr('OnScreenApp:QML:Phone >>> qmlOnScreenMessage.'));
16         if(text === "incoming call")
17         {
18             messageText = "Incoming Call";
19             answerButton.active = true;
20             answerButton.checked = false;
21         }
22         else if(text === "call answered")
23         {
24             messageText = "Call Answered";
25             answerButton.active = false;
26             answerButton.checked = true;
27         }
28         else if(text === "call rejected")
29         {
30             messageText = "Call Rejected";
31             answerButton.active = false;
32             answerButton.checked = true;
33         }
34         else {
35             messageText = text;
36         }
37     }
38
39     // Image {
40     //     id : background_image
41     //     anchors.fill: parent
42     //     anchors.topMargin: 0
43     //     anchors.bottomMargin: 0
44     //     source: "images/heart_1079x400.png"
45     // }
46
47     Item {
48         width: 640
49         height: 360
50         Label {
51             x: 3
52             y: 3
53             width: 640
54             height: 360
55             color: "#000000"
56             text: messageText
57             font.bold: false
58             textFormat: Text.AutoText
59             wrapMode: Text.WordWrap
60             verticalAlignment: Text.AlignVCenter
61             horizontalAlignment: Text.AlignHCenter
62             font.pixelSize: 50
63             font.weight: Font.DemiBold
64         }
65
66         Label {
67             x: 0
68             y: 0
69             width: 640
70             height: 360
71             color: "#6BFBFF"
72             text: messageText
73             textFormat: Text.AutoText
74             wrapMode: Text.WordWrap
75             verticalAlignment: Text.AlignVCenter
76             horizontalAlignment: Text.AlignHCenter
77             font.pixelSize: 50
78             font.weight: Font.DemiBold
79         }
80     }
81
82     ImageButton {
83         id: rejectButton
84         x: 366
85         y: 360
86         width: 228
87         height: 230
88         offImage: 'images/reject.png'
89
90         onClicked: {
91             messageText = "Call Reject"
92             eventHandler.onScreenReply("call reject");
93         }
94     }
95
96     ToggleButton {
97         id: answerButton
98         width: 228
99         height: 230
100         font.family: "Courier"
101         focusPolicy: Qt.WheelFocus
102         onImage: 'images/disable.png'
103         offImage: 'images/answer.png'
104         property bool active: true
105         x: 46
106         y: 360
107
108         onCheckedChanged: {
109             if(!checked && !active) {
110                 checked = true;
111             }
112             if(active && checked)
113             {
114                 messageText = "Call Answer"
115                 eventHandler.onScreenReply("call answer");
116                 active = false;
117             }
118         }
119     }
120
121
122 }