summaryrefslogtreecommitdiffstats
path: root/imports/components/HexSwitch.qml
diff options
context:
space:
mode:
authorsrimaldia <hariasti.srimaldia-1@jp.alps.com>2016-12-09 19:58:35 +0900
committersrimaldia <hariasti.srimaldia-1@jp.alps.com>2016-12-09 19:58:35 +0900
commit3c299579ce714726b268f8f345bd5981426942d5 (patch)
tree5a137a6b3a1b41a3b809e27dfbe40da091e0ea26 /imports/components/HexSwitch.qml
parentfb7d55151950ddd391e33afefb5297ad562f1b0d (diff)
add standalone BT app
Signed-off-by: srimaldia <hariasti.srimaldia-1@jp.alps.com>
Diffstat (limited to 'imports/components/HexSwitch.qml')
-rwxr-xr-ximports/components/HexSwitch.qml80
1 files changed, 80 insertions, 0 deletions
diff --git a/imports/components/HexSwitch.qml b/imports/components/HexSwitch.qml
new file mode 100755
index 0000000..cce82b3
--- /dev/null
+++ b/imports/components/HexSwitch.qml
@@ -0,0 +1,80 @@
+/* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+import QtQuick 2.0
+import QtGraphicalEffects 1.0
+
+Item {
+ width: 170 * height / 80
+ height: 80
+
+ property bool value
+ property bool showLabels: false
+
+ Image {
+ anchors.fill: parent
+ source: "../../doc/images/switchplate_" + (value ? "on" : "off") + ".png"
+ }
+
+ Item {
+ id: shadowTarget
+ x: value ? parent.width * 0.375 : -11
+ width: parent.width * 0.7
+ height: parent.height
+
+ Image {
+ id: control
+ anchors.centerIn: parent
+ width: parent.height * 0.9
+ fillMode: Image.PreserveAspectFit
+ source: "../../doc/images/switchcontrol.png"
+ }
+ }
+
+ DropShadow {
+ anchors.fill: shadowTarget
+ cached: true
+ horizontalOffset: parent.height * 0.05
+ verticalOffset: parent.height * 0.05
+ radius: 16
+ samples: 32
+ color: Qt.rgba(0, 0, 0, 0.35)
+ smooth: true
+ source: shadowTarget
+ }
+
+ Text {
+ text: qsTr("OFF")
+ font.family: "Source Sans Pro"
+ anchors.right: parent.left
+ anchors.rightMargin: 30
+ anchors.verticalCenter: parent.verticalCenter
+ font.pointSize: 25
+ font.letterSpacing: -0.5
+ font.weight: value ? Font.Normal : Font.Bold
+ color: value ? "#C4C4C4" : "#FE9C00"
+ visible: showLabels
+ }
+
+ Text {
+ id: onText
+ text: qsTr("ON")
+ font.family: "Source Sans Pro"
+ anchors.left: parent.right
+ anchors.leftMargin: 30
+ font.pointSize: 25
+ anchors.verticalCenter: parent.verticalCenter
+ font.letterSpacing: -0.5
+ font.weight: value ? Font.Bold : Font.Normal
+ color: value ? "#59FF00" : "#C4C4C4"
+ visible: showLabels
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: value = !value
+ }
+}