Add sample qml application
[staging/HomeScreen.git] / sample-qml / imports / vehicle / TemperatureModel.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
11 Item {
12     property bool metric: true
13
14     function unit(value) {
15         return celsiusToFahrenheit(value).toFixed(1) + "\u00b0" + (metric ? "C" : "F")
16     }
17
18     function celsiusToFahrenheit(value) {
19         return (metric ? value : 1.8 * value + 32)
20     }
21
22     property real indoor: 20.4
23     property string indoorString: unit(indoor)
24     property real outdoor: 28.9
25     property string outdoorString: unit(outdoor)
26 }