Add sample qml application
[staging/HomeScreen.git] / sample-qml / apps / HVAC / models / HVACModel.qml
1 /* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
2  *
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 pragma Singleton
8
9 import QtQuick 2.0
10 import vehicle 1.0
11
12 Item {
13     property bool fanUp: false
14     property bool fanRight: false
15     property bool fanDown: false
16
17     property bool fanAC: false
18     property bool fanAuto: false
19     property bool fanRecirc: false
20
21     property real fanSpeed: 0
22
23     property bool defrostMax: false
24     property bool defrostFront: false
25     property bool defrostRear: false
26
27     property real leftTemperature: 0
28     property real rightTemperature: 0
29
30     property int leftSeatHeat: 0
31     property int rightSeatHeat: 0
32
33     onFanSpeedChanged: {
34         var currentFan = ClimateModel.getRangeValue(fanSpeed,ClimateModel.fanStepSize);
35         ClimateModel.fanSpeed = currentFan;
36     }
37
38     onLeftTemperatureChanged: {
39         var temperature = ClimateModel.getRangeValue(leftTemperature,ClimateModel.temperatureStepSize);
40         ClimateModel.leftTemp = temperature;
41     }
42
43     onRightTemperatureChanged: {
44         var temperature = ClimateModel.getRangeValue(rightTemperature,ClimateModel.temperatureStepSize);
45         ClimateModel.rightTemp = temperature;
46     }
47 }