add source for ces2019 horizontal
[apps/onscreenapp.git] / app / phone.qml
diff --git a/app/phone.qml b/app/phone.qml
new file mode 100644 (file)
index 0000000..9a2385b
--- /dev/null
@@ -0,0 +1,122 @@
+import QtQuick 2.6
+import QtQuick.Window 2.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 2.0
+import AGL.Demo.Controls 1.0
+
+Item {
+    id: onScreenPhone
+    visible: true
+    width: 640
+    height: 720
+    property string messageText: "Incoming Call"
+
+    function qmlOnScreenMessage(text) {
+        console.log(qsTr('OnScreenApp:QML:Phone >>> qmlOnScreenMessage.'));
+        if(text === "incoming call")
+        {
+            messageText = "Incoming Call";
+            answerButton.active = true;
+            answerButton.checked = false;
+        }
+        else if(text === "call answered")
+        {
+            messageText = "Call Answered";
+            answerButton.active = false;
+            answerButton.checked = true;
+        }
+        else if(text === "call rejected")
+        {
+            messageText = "Call Rejected";
+            answerButton.active = false;
+            answerButton.checked = true;
+        }
+        else {
+            messageText = text;
+        }
+    }
+
+    // Image {
+    //     id : background_image
+    //     anchors.fill: parent
+    //     anchors.topMargin: 0
+    //     anchors.bottomMargin: 0
+    //     source: "images/heart_1079x400.png"
+    // }
+
+    Item {
+        width: 640
+        height: 360
+        Label {
+            x: 3
+            y: 3
+            width: 640
+            height: 360
+            color: "#000000"
+            text: messageText
+            font.bold: false
+            textFormat: Text.AutoText
+            wrapMode: Text.WordWrap
+            verticalAlignment: Text.AlignVCenter
+            horizontalAlignment: Text.AlignHCenter
+            font.pixelSize: 50
+            font.weight: Font.DemiBold
+        }
+
+        Label {
+            x: 0
+            y: 0
+            width: 640
+            height: 360
+            color: "#6BFBFF"
+            text: messageText
+            textFormat: Text.AutoText
+            wrapMode: Text.WordWrap
+            verticalAlignment: Text.AlignVCenter
+            horizontalAlignment: Text.AlignHCenter
+            font.pixelSize: 50
+            font.weight: Font.DemiBold
+        }
+    }
+
+    ImageButton {
+        id: rejectButton
+        x: 366
+        y: 360
+        width: 228
+        height: 230
+        offImage: 'images/reject.png'
+
+        onClicked: {
+            messageText = "Call Reject"
+            eventHandler.onScreenReply("call reject");
+        }
+    }
+
+    ToggleButton {
+        id: answerButton
+        width: 228
+        height: 230
+        font.family: "Courier"
+        focusPolicy: Qt.WheelFocus
+        onImage: 'images/disable.png'
+        offImage: 'images/answer.png'
+        property bool active: true
+        x: 46
+        y: 360
+
+        onCheckedChanged: {
+            if(!checked && !active) {
+                checked = true;
+            }
+            if(active && checked)
+            {
+                messageText = "Call Answer"
+                eventHandler.onScreenReply("call answer");
+                active = false;
+            }
+        }
+    }
+
+
+}