Add permission to use display
[apps/hvac.git] / app / SeatHeatButton.qml
1 /*
2  * Copyright (C) 2016 The Qt Company Ltd.
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.Layouts 1.1
19 import QtQuick.Controls 2.0
20 import AGL.Demo.Controls 1.0
21
22
23 Item {
24     id: root
25     implicitWidth: 318
26     implicitHeight: 219
27
28     property string side: 'Left'
29     property int headLevel: 0
30
31     Column {
32         id: background
33         anchors.centerIn: parent
34         Image {
35             id: chair
36             source: './images/HMI_HVAC_%1_Chair_OFF.svg'.arg(root.side)
37             states: [
38                 State {
39                     when: root.headLevel > 0
40                     PropertyChanges {
41                         target: chair
42                         source: './images/HMI_HVAC_%1_Chair_ON.svg'.arg(root.side)
43                     }
44                 }
45             ]
46         }
47         Image {
48             id: indicator
49             width: 178
50             height: 18
51             source: './images/HMI_HVAC_ChairIndicator_OFF.svg'
52             states: [
53                 State {
54                     when: root.headLevel === 1
55                     PropertyChanges {
56                         target: indicator
57                         source: './images/HMI_HVAC_ChairIndicator_One.svg'
58                     }
59                 },
60                 State {
61                     when: root.headLevel === 2
62                     PropertyChanges {
63                         target: indicator
64                         source: './images/HMI_HVAC_ChairIndicator_Two.svg'
65                     }
66                 }
67             ]
68         }
69
70     }
71
72     MouseArea {
73         anchors.fill: parent
74         onClicked: {
75             root.headLevel = (root.headLevel + 1) % 3
76         }
77     }
78 }