Add beta version to sandbox
[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: 1079
11     height: 400
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    ToggleButton {
48        id: answerButton
49        x: 53
50        y: 147
51        width: 228
52        height: 230
53        onImage: 'images/disable.png'
54        offImage: 'images/answer.png'
55        property bool active: true
56
57        onCheckedChanged: {
58            if(!checked && !active) {
59                checked = true;
60            }
61            if(active && checked)
62            {
63                messageText = "Call Answer"
64                eventHandler.onScreenReply("call answer");
65                active = false;
66            }
67        }
68    }
69
70    ImageButton {
71        id: rejectButton
72        x: 804
73        y: 142
74        width: 228
75        height: 230
76        offImage: 'images/reject.png'
77
78        onClicked: {
79            messageText = "Call Reject"
80            eventHandler.onScreenReply("call reject");
81        }
82    }
83
84     Label {
85         x: 400
86         y: 115
87         width: 280
88         height: 100
89         color: "#000000"
90         text: messageText
91         textFormat: Text.AutoText
92         wrapMode: Text.WordWrap
93         verticalAlignment: Text.AlignVCenter
94         horizontalAlignment: Text.AlignHCenter
95         font.pixelSize: 50
96         font.weight: Font.ExtraBold
97     }
98
99     Label {
100         x: 395
101         y: 112
102         width: 280
103         height: 100
104         color: "#6BFBFF"
105         text: messageText
106         textFormat: Text.AutoText
107         wrapMode: Text.WordWrap
108         verticalAlignment: Text.AlignVCenter
109         horizontalAlignment: Text.AlignHCenter
110         font.pixelSize: 50
111         font.weight: Font.DemiBold
112     }
113
114 }