add restriction
[apps/onscreenapp.git] / app / main.qml
1 import QtQuick 2.6
2 import QtQuick.Controls 2.0
3
4 ApplicationWindow {
5     id: root
6
7     color: "#00000000"
8    
9     Label {
10         id: message
11         anchors.top: parent.top
12         anchors.left: parent.left
13         anchors.right: parent.right
14         anchors.bottom: parent.bottom
15         anchors.margins: 20
16         font.pixelSize: 75
17         wrapMode: Text.WordWrap
18         horizontalAlignment: Text.AlignHCenter
19         verticalAlignment: Text.AlignVCenter
20         color: "white"
21         text: "Only the video’s sound will be available while driving."
22     }
23
24     background : Image {
25         id: backgroundImg
26         anchors.fill: parent
27         anchors.topMargin: 0
28         anchors.bottomMargin: 0
29
30         visible: true
31         fillMode: Image.Stretch
32         source: 'images/black_normal.png'
33
34         state: "begin"
35         states: [
36             State {
37                 name: "begin"
38                 PropertyChanges { target: backgroundImg; opacity: 0.25 }
39             },
40             State {
41                 name: "end"
42                 PropertyChanges { target: backgroundImg; opacity: 0.75 }
43             }
44         ]
45
46         transitions: [
47             Transition {
48                 from: "begin"; to: "end"
49                 PropertyAnimation {target: backgroundImg; properties: "opacity"; duration: 2000}
50             }
51         ]
52     }
53
54     function showImage(area) {
55         if (area === 'normal') {
56             backgroundImg.source = 'images/black_normal.png'
57         } else {
58             backgroundImg.source = 'images/black_split.png'
59         }
60         backgroundImg.state = "end"
61     }
62
63     
64     function hideImage() {
65         backgroundImg.state = "begin"
66     }
67 }