move hvac app and hvac plugin to new repository
[apps/hvac.git] / app / HVAC.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 ApplicationWindow {
23     id: root
24
25     ColumnLayout {
26         anchors.fill: parent
27         anchors.topMargin: width / 10
28         anchors.bottomMargin: width / 10
29         RowLayout {
30             Layout.fillHeight: true
31             Layout.alignment: Qt.AlignHCenter
32             Image {
33                 source: './images/HMI_HVAC_Fan_Icon.svg'
34             }
35             Item {
36                 width: root.width * 0.8
37                 Slider {
38                     id: fanSpeed
39                     anchors.left: parent.left
40                     anchors.right: parent.right
41                     anchors.verticalCenter: parent.verticalCenter
42                     onValueChanged: {
43                         console.debug('Fan', value)
44                     }
45                 }
46                 Label {
47                     anchors.left: fanSpeed.left
48                     anchors.top: fanSpeed.bottom
49                     font.pixelSize: 32
50                     text: 'FAN SPEED'
51                 }
52             }
53         }
54         RowLayout {
55             Layout.fillHeight: true
56             Layout.fillWidth: true
57             Layout.alignment: Layout.Center
58             spacing: 20
59             ColumnLayout {
60                 Layout.fillWidth: true
61                 spacing: 20
62                 SeatHeatButton {
63                     id: leftSeat
64                     side: 'Left'
65                 }
66                 HeatDegree {
67                     enabled: leftSeat.headLevel > 0
68                 }
69             }
70             ColumnLayout {
71                 Layout.fillWidth: true
72                 spacing: 20
73                 ToggleButton {
74                     onImage: './images/HMI_HVAC_Active.svg'
75                     offImage: './images/HMI_HVAC_Inactive.svg'
76                     Label {
77                         anchors.centerIn: parent
78                         color: parent.checked ? '#66FF99' : '#848286'
79                         text: 'A/C'
80                         font.pixelSize: parent.height / 3
81                     }
82                     onCheckedChanged: {
83                         console.debug('A/C', checked)
84                     }
85                 }
86                 ToggleButton {
87                     onImage: './images/HMI_HVAC_Active.svg'
88                     offImage: './images/HMI_HVAC_Inactive.svg'
89                     Label {
90                         anchors.centerIn: parent
91                         color: parent.checked ? '#66FF99' : '#848286'
92                         text: 'AUTO'
93                         font.pixelSize: parent.height / 3
94                     }
95                     onCheckedChanged: {
96                         console.debug('AUTO', checked)
97                     }
98                 }
99                 ToggleButton {
100                     onImage: './images/HMI_HVAC_Circulation_Active.svg'
101                     offImage: './images/HMI_HVAC_Circulation_Inactive.svg'
102                     onCheckedChanged: {
103                         console.debug('Circulation', checked)
104                     }
105                 }
106             }
107
108             ColumnLayout {
109                 Layout.fillWidth: true
110                 spacing: 20
111                 SeatHeatButton {
112                     id: rightSeat
113                     side: 'Right'
114                 }
115                 HeatDegree {
116                     enabled: rightSeat.headLevel > 0
117                 }
118             }
119         }
120
121         RowLayout {
122             Layout.fillHeight: true
123             Layout.alignment: Qt.AlignHCenter
124             spacing: root.width / 20
125             Repeater {
126                 model: ['AirDown', 'AirUp', 'AirRight', 'Rear', 'Front']
127                 ToggleButton {
128                     onImage: './images/HMI_HVAC_%1_Active.svg'.arg(model.modelData)
129                     offImage: './images/HMI_HVAC_%1_Inactive.svg'.arg(model.modelData)
130                     onCheckedChanged: {
131                         console.debug(model.modelData, checked)
132                     }
133                 }
134             }
135         }
136     }
137 }