Add sample qml application
[staging/HomeScreen.git] / sample-qml / apps / HVAC / HazardButton.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 import QtQuick 2.0
8
9 Rectangle {
10     id: hazardButton
11     width: 624
12     height: 122
13     color: "#aa000000"
14     border.color: "#ff53b5ce"
15
16     property bool value: false
17     property bool flash: false
18
19     Image {
20         id: image
21         source: "./images/hazard_" + (value ? (flash ? "blink" : "on") : "off") + ".png"
22     }
23
24     MouseArea {
25         anchors.fill: parent
26         onClicked: value = !value
27     }
28
29     Timer {
30         id: timer
31         interval: 500
32         repeat: true
33         running: value
34
35         onTriggered: flash = !flash
36     }
37 }