From 3c299579ce714726b268f8f345bd5981426942d5 Mon Sep 17 00:00:00 2001 From: srimaldia Date: Fri, 9 Dec 2016 19:58:35 +0900 Subject: add standalone BT app Signed-off-by: srimaldia --- imports/components/AwesomeIcon.qml | 26 +++++++++ imports/components/Box.qml | 49 +++++++++++++++++ imports/components/BoxButton.qml | 36 +++++++++++++ imports/components/BoxHeading.qml | 37 +++++++++++++ imports/components/Button.qml | 30 +++++++++++ imports/components/DateTime.qml | 35 ++++++++++++ imports/components/HexGrid.qml | 32 +++++++++++ imports/components/HexSwitch.qml | 80 +++++++++++++++++++++++++++ imports/components/InShadow.qml | 33 ++++++++++++ imports/components/InsetShadow.qml | 40 ++++++++++++++ imports/components/Label.qml | 27 ++++++++++ imports/components/NumberPad.qml | 101 +++++++++++++++++++++++++++++++++++ imports/components/OutShadow.qml | 41 ++++++++++++++ imports/components/Switch.qml | 13 +++++ imports/components/qmldir | 16 ++++++ imports/radio/Radio.qml | 6 +++ imports/radio/qmldir | 2 + imports/system/App.qml | 29 ++++++++++ imports/system/System.qml | 15 ++++++ imports/system/qmldir | 8 +++ imports/utils/Marker.qml | 60 +++++++++++++++++++++ imports/utils/Style.qml | 37 +++++++++++++ imports/utils/qmldir | 8 +++ imports/vehicle/ClimateModel.qml | 44 +++++++++++++++ imports/vehicle/FuelModel.qml | 46 ++++++++++++++++ imports/vehicle/PositionModel.qml | 33 ++++++++++++ imports/vehicle/SpeedModel.qml | 38 +++++++++++++ imports/vehicle/TemperatureModel.qml | 26 +++++++++ imports/vehicle/qmldir | 11 ++++ 29 files changed, 959 insertions(+) create mode 100755 imports/components/AwesomeIcon.qml create mode 100755 imports/components/Box.qml create mode 100755 imports/components/BoxButton.qml create mode 100755 imports/components/BoxHeading.qml create mode 100755 imports/components/Button.qml create mode 100755 imports/components/DateTime.qml create mode 100755 imports/components/HexGrid.qml create mode 100755 imports/components/HexSwitch.qml create mode 100755 imports/components/InShadow.qml create mode 100755 imports/components/InsetShadow.qml create mode 100755 imports/components/Label.qml create mode 100755 imports/components/NumberPad.qml create mode 100755 imports/components/OutShadow.qml create mode 100755 imports/components/Switch.qml create mode 100755 imports/components/qmldir create mode 100755 imports/radio/Radio.qml create mode 100755 imports/radio/qmldir create mode 100755 imports/system/App.qml create mode 100755 imports/system/System.qml create mode 100755 imports/system/qmldir create mode 100755 imports/utils/Marker.qml create mode 100755 imports/utils/Style.qml create mode 100755 imports/utils/qmldir create mode 100755 imports/vehicle/ClimateModel.qml create mode 100755 imports/vehicle/FuelModel.qml create mode 100755 imports/vehicle/PositionModel.qml create mode 100755 imports/vehicle/SpeedModel.qml create mode 100755 imports/vehicle/TemperatureModel.qml create mode 100755 imports/vehicle/qmldir (limited to 'imports') diff --git a/imports/components/AwesomeIcon.qml b/imports/components/AwesomeIcon.qml new file mode 100755 index 0000000..542fb0f --- /dev/null +++ b/imports/components/AwesomeIcon.qml @@ -0,0 +1,26 @@ +/* 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 system 1.0 +import components 1.0 +import utils 1.0 + +Item { + height: icon.height + width: icon.height + + property alias iconSize: icon.font.pixelSize + property alias ucKey: icon.text + property alias iconColor: icon.color + + Text { + id: icon + font.family: "FontAwesome" + color: "white" + } +} + diff --git a/imports/components/Box.qml b/imports/components/Box.qml new file mode 100755 index 0000000..a2f2ae0 --- /dev/null +++ b/imports/components/Box.qml @@ -0,0 +1,49 @@ +/* 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 utils 1.0 + +Item { + id: root + + opacity: 0.8 + property color color: Style.grey + property color border: color + property string shadow: "" + + OutShadow { + color: root.color + visible: root.shadow === "out" + } + + Rectangle { + id: rect + anchors.fill: parent + color: Style.black + border.width: 1 + border.color: root.border + } + + InsetShadow { + color: root.color + visible: root.shadow === "fill" + } + + InShadow { + color: root.color + visible: root.shadow === "in" + } + + Rectangle { + visible: root.shadow === "fill" + anchors.fill: parent + color: "transparent" + border.width: 1 + border.color: root.border + } + +} diff --git a/imports/components/BoxButton.qml b/imports/components/BoxButton.qml new file mode 100755 index 0000000..0969f46 --- /dev/null +++ b/imports/components/BoxButton.qml @@ -0,0 +1,36 @@ +/* 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 components 1.0 + +Item { + id: root + + property alias shadow: box.shadow + property alias color: box.color + property alias text: textItem.text + + signal clicked() + + Box { + id: box + anchors.fill: parent + + Text { + id: textItem + anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 28 + color: "white" + } + + MouseArea { + anchors.fill: parent + onClicked: root.clicked() + } + } +} diff --git a/imports/components/BoxHeading.qml b/imports/components/BoxHeading.qml new file mode 100755 index 0000000..bb2c62a --- /dev/null +++ b/imports/components/BoxHeading.qml @@ -0,0 +1,37 @@ +/* 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 utils 1.0 + +Row { + id: root + + property color color: Style.blueViv + property alias fontSize: headingText.font.pixelSize + property alias text: headingText.text + property alias boxWidth: box.width + property alias boxHeight: box.height + + spacing: 10 + + Rectangle { + id: box + anchors.bottom: headingText.baseline + anchors.bottomMargin: 0 + width: 100 + height: 16 + color: root.color + } + + Text { + id: headingText + font.family: "Source Sans Pro" + font.pixelSize: 22 + font.weight: Font.Bold + color: root.color + } +} diff --git a/imports/components/Button.qml b/imports/components/Button.qml new file mode 100755 index 0000000..9d5c495 --- /dev/null +++ b/imports/components/Button.qml @@ -0,0 +1,30 @@ +/* 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 + +Rectangle { + id: root + border.color: "#cccccc" + color:"#222" + border.width: 2 + height: pairText.height + 20 + width: pairText.width + 20 + + property string buttonText + + + Text { + id: pairText + anchors.centerIn: parent + font.family: "Source Sans Pro" + font.pixelSize: 48 + font.weight: Font.Bold + color: "white" + font.capitalization: Font.AllUppercase + text: buttonText + } +} diff --git a/imports/components/DateTime.qml b/imports/components/DateTime.qml new file mode 100755 index 0000000..6203712 --- /dev/null +++ b/imports/components/DateTime.qml @@ -0,0 +1,35 @@ +/* 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 utils 1.0 + +Item { + id: dateTime + anchors.left: parent.left + anchors.right: parent.right + height: 120 + property var timeStamp: new Date() + + Timer { + interval: 1000 + running: true + repeat: true + onTriggered: timeStamp = new Date() + } + + Label { + fontColor: Style.grey + text: Qt.formatDate(timeStamp, "ddd MMM d") + } + + Label { + anchors.right: parent.right + fontColor: Style.grey + text: Qt.formatTime(timeStamp, "h:mm AP") + } +} + diff --git a/imports/components/HexGrid.qml b/imports/components/HexGrid.qml new file mode 100755 index 0000000..b81a09a --- /dev/null +++ b/imports/components/HexGrid.qml @@ -0,0 +1,32 @@ +/* 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 + +Item { + property real spacing: 0 + property int columns: 3 + + width: childrenRect.width + height: childrenRect.height + + Component.onCompleted: { + var sizeX = childrenRect.height + var sizeY = childrenRect.width + var column = 0 + var row = 0 + + for (var n = 0; n < children.length; n++) { + children[n].x = column * (sizeX + spacing) + children[n].y = row * (0.5 * sizeY + spacing) + column += 2 + if (column >= columns) { + row++ + column = row % 2 + } + } + } +} 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 + } +} diff --git a/imports/components/InShadow.qml b/imports/components/InShadow.qml new file mode 100755 index 0000000..2d64c2a --- /dev/null +++ b/imports/components/InShadow.qml @@ -0,0 +1,33 @@ +/* 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 + +ShaderEffect { + anchors.fill: parent + property color color + property real radius: 16 + + fragmentShader: " +uniform lowp float radius; +uniform lowp float height; +uniform lowp float width; +uniform lowp float qt_Opacity; +uniform lowp vec4 color; +varying highp vec2 qt_TexCoord0; + +void main(void) { + lowp vec2 dist = min(qt_TexCoord0, vec2(1.0) - qt_TexCoord0); + // Border shadow + lowp float xval = smoothstep(0.0, radius, dist.x * width); + lowp float yval = smoothstep(0.0, radius, dist.y * height); + lowp float borderVal = sqrt(yval * xval) * 0.5 + 0.5; + + lowp vec4 borderColor = mix(color, vec4(0.0, 0.0, 0.0, 1.0), borderVal); + gl_FragColor = borderColor * qt_Opacity; +} + " +} diff --git a/imports/components/InsetShadow.qml b/imports/components/InsetShadow.qml new file mode 100755 index 0000000..6ad17cd --- /dev/null +++ b/imports/components/InsetShadow.qml @@ -0,0 +1,40 @@ +/* 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 + +ShaderEffect { + anchors.fill: parent + property color color + property real radius: 100 + property real border: 20 + + fragmentShader: " +uniform lowp float radius; +uniform lowp float border; +uniform lowp float height; +uniform lowp float width; +uniform lowp float qt_Opacity; +uniform lowp vec4 color; +varying highp vec2 qt_TexCoord0; + +void main(void) { + lowp vec2 dist = min(qt_TexCoord0, vec2(1.0) - qt_TexCoord0); + // Border shadow + lowp float xval = smoothstep(0.0, border, dist.x * width); + lowp float yval = smoothstep(0.0, border, dist.y * height); + lowp float borderVal = sqrt(yval * xval) * 0.5 + 0.5; + // Inner shadow + xval = smoothstep(0.0, radius, dist.x * width); + yval = smoothstep(0.0, radius, dist.y * width); + lowp float innerVal = sqrt(yval * xval) * 0.5 + 0.5; + + lowp vec4 innerColor = mix(vec4(0.0, 0.0, 0.0, 0.5), color, innerVal); + lowp vec4 borderColor = mix(vec4(0.0, 0.0, 0.0, 1.0), innerColor, borderVal); + gl_FragColor = borderColor * qt_Opacity; +} + " +} diff --git a/imports/components/Label.qml b/imports/components/Label.qml new file mode 100755 index 0000000..e1e0b30 --- /dev/null +++ b/imports/components/Label.qml @@ -0,0 +1,27 @@ +/* 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 utils 1.0 + +Item { + // Tracer {} + width: childrenRect.width + height: childrenRect.height + property alias text: text.text + property alias label: text + property alias fontSize: text.font.pixelSize + property alias fontColor: text.color + + Text { + id: text + color: "#ddd" + font.family: "Source Sans Pro" + font.pixelSize: 40 + font.capitalization: Font.AllUppercase + font.weight: Font.Bold + } +} diff --git a/imports/components/NumberPad.qml b/imports/components/NumberPad.qml new file mode 100755 index 0000000..b7763ca --- /dev/null +++ b/imports/components/NumberPad.qml @@ -0,0 +1,101 @@ +/* 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 utils 1.0 + +Item { + id: root + height: childrenRect.height + property var letters: ["","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"] + property var bottomRow: ["*","0","#"] + + signal number(string number) + + Grid { + id: numberGrid + columns: 3 + spacing: 20 + + Repeater { + model: 9 + delegate: Item { + id: numberKey + width: (root.width - ( numberGrid.spacing*(numberGrid.columns-1)))/numberGrid.columns + height: numberKey.width * 0.8 + anchors.margins: 10 + + Rectangle { + id: shadowTarget + anchors.fill: parent + border.width: 1 + border.color: "white" + color: "#6653b5ce" + } + + Item { + height: childrenRect.height + width: parent.width + anchors.centerIn: parent + + Label { + anchors.horizontalCenter: parent.horizontalCenter + id: keypadNumber + text: index + 1 + } + + Label { + anchors.horizontalCenter: parent.horizontalCenter + id: keypadLetters + anchors.top: keypadNumber.bottom + fontSize: 30 + fontColor: "#53b5ce" + text: letters[index] + } + } + + MouseArea { + anchors.fill: parent + onClicked: root.number(keypadNumber.text) + } + } + } + + Repeater { + model: 3 + delegate: Item { + width: (root.width - ( numberGrid.spacing*(numberGrid.columns-1)))/numberGrid.columns + height: width * 0.8 + anchors.margins: 10 + + Rectangle { + id: shadowTarget + anchors.fill: parent + border.width: 1 + border.color: "white" + color: "#6653b5ce" + } + + Item { + height: childrenRect.height + width: parent.width + anchors.centerIn: parent + + Label { + anchors.horizontalCenter: parent.horizontalCenter + id: keypadNumber + text: bottomRow[index] + } + } + + MouseArea { + anchors.fill: parent + onClicked: root.number(keypadNumber.text) + } + } + } + } +} diff --git a/imports/components/OutShadow.qml b/imports/components/OutShadow.qml new file mode 100755 index 0000000..f4d8407 --- /dev/null +++ b/imports/components/OutShadow.qml @@ -0,0 +1,41 @@ +/* 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 { + id: root + + anchors.fill: parent + property alias color: shadow.color + property alias radius: shadow.radius + + Item { + id: shadowTarget + x: -radius + y: -radius + width: parent.width + 2 * radius + height: parent.height + 2 * radius + + Rectangle { + anchors.centerIn: parent + width: root.width + height: root.height + color: "black" + } + } + + DropShadow { + id: shadow + anchors.fill: shadowTarget + horizontalOffset: 0 + verticalOffset: 0 + radius: 16 + samples: 32 + source: shadowTarget + } +} diff --git a/imports/components/Switch.qml b/imports/components/Switch.qml new file mode 100755 index 0000000..6cd50c7 --- /dev/null +++ b/imports/components/Switch.qml @@ -0,0 +1,13 @@ +/* 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 + +Switch { + width: 100 + height: 62 +} + diff --git a/imports/components/qmldir b/imports/components/qmldir new file mode 100755 index 0000000..57e4d2d --- /dev/null +++ b/imports/components/qmldir @@ -0,0 +1,16 @@ +#/* 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/. */ + +AwesomeIcon 1.0 AwesomeIcon.qml +Box 1.0 Box.qml +BoxButton 1.0 BoxButton.qml +BoxHeading 1.0 BoxHeading.qml +DateTime 1.0 DateTime.qml +HexGrid 1.0 HexGrid.qml +HexSwitch 1.0 HexSwitch.qml +Label 1.0 Label.qml +NumberPad 1.0 NumberPad.qml +Button 1.0 Button.qml diff --git a/imports/radio/Radio.qml b/imports/radio/Radio.qml new file mode 100755 index 0000000..cea2e1a --- /dev/null +++ b/imports/radio/Radio.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +Item { + signal stopped + signal playing +} diff --git a/imports/radio/qmldir b/imports/radio/qmldir new file mode 100755 index 0000000..e334188 --- /dev/null +++ b/imports/radio/qmldir @@ -0,0 +1,2 @@ +Radio 1.0 Radio.qml +RadioPropertyItem 1.0 Radio.qml diff --git a/imports/system/App.qml b/imports/system/App.qml new file mode 100755 index 0000000..d7da73c --- /dev/null +++ b/imports/system/App.qml @@ -0,0 +1,29 @@ +/* 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 system 1.0 + +FocusScope { + id: root + property string appId + anchors.fill: parent + visible: System.activeApp === appId + property bool hasKeyFocus: false + focus: visible + onFocusChanged: if (focus) hasKeyFocus = true + + Keys.onPressed: { + switch (event.key) { + case Qt.Key_Left: + case Qt.Key_Right: + root.hasKeyFocus = false + break + default: + break + } + } +} diff --git a/imports/system/System.qml b/imports/system/System.qml new file mode 100755 index 0000000..8e155fd --- /dev/null +++ b/imports/system/System.qml @@ -0,0 +1,15 @@ +/* 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/. */ + +pragma Singleton +import QtQuick 2.0 + +Item { + property string activeApp: "home" + property string activeSetting: "settings" + property bool showKeyboard: false + property bool showSettings: false +} diff --git a/imports/system/qmldir b/imports/system/qmldir new file mode 100755 index 0000000..afa0f56 --- /dev/null +++ b/imports/system/qmldir @@ -0,0 +1,8 @@ +#/* 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/. */ + +singleton System 1.0 System.qml +App 1.0 App.qml diff --git a/imports/utils/Marker.qml b/imports/utils/Marker.qml new file mode 100755 index 0000000..c7a377e --- /dev/null +++ b/imports/utils/Marker.qml @@ -0,0 +1,60 @@ +/* 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 utils 1.0 + +Item { + id: root + width: 120 + height: 120 + property string text + signal clicked() + property alias pressed: area.pressed + property alias color: background.color + property alias fontSize: label.font.pixelSize + property bool fill: false + + Rectangle { + id: background + anchors.fill: parent + color: Style.backgroundColor + opacity: root.fill ? 1.0: 0.2 + } + + Rectangle { + id: frame + anchors.fill: parent + color: 'transparent' + border.color: Qt.darker(background.color, 1.4) + border.width: 2 + opacity: 1.0 + } + + + Rectangle { + anchors.fill: label + anchors.margins: -2 + color: Style.backgroundColor + opacity: root.text ? 1.0 : 0.0 + } + + Text { + id: label + anchors.centerIn: parent + font.pixelSize: 14 + color: Style.greyDarkColor + opacity: 0.75 + text: root.text + } + MouseArea { + id: area + anchors.fill: parent + onClicked: root.clicked() + onPressed: background.color = Qt.darker(background.color, 1.5) + onReleased: background.color = Qt.lighter(background.color, 1.5) + } +} diff --git a/imports/utils/Style.qml b/imports/utils/Style.qml new file mode 100755 index 0000000..ef544a6 --- /dev/null +++ b/imports/utils/Style.qml @@ -0,0 +1,37 @@ +/* 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/. */ + +pragma Singleton +import QtQuick 2.2 + +QtObject { + property bool debugMode: false + property bool debugFill: false + + // Primary colors + property color orangeLt: "#ffd38c" + property color orangeViv: "#fe9c00" + property color blueLt: "#b2f0ff" + property color blueViv: "#53b5ce" + // Secondary colors + property color yellowLt: "#ffffb2" + property color yellowViv: "#ffff00" + property color greenLt: "#cdffb2" + property color greenViv: "#59ff00" + // Neutral colors + property color white: "#ffffff" + property color grey: "#c4c4c4" + property color black: "#000000" + property color overlay: Qt.rgba(0, 0, 0, 0.8) + + function getGfxPath() { + return Qt.resolvedUrl("../assets/") + } + + function gfx(name) { + return Qt.resolvedUrl("../../doc/images/" + name ) + } +} diff --git a/imports/utils/qmldir b/imports/utils/qmldir new file mode 100755 index 0000000..c2df9de --- /dev/null +++ b/imports/utils/qmldir @@ -0,0 +1,8 @@ +#/* 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/. */ + +singleton Style 1.0 Style.qml +Marker 1.0 Marker.qml diff --git a/imports/vehicle/ClimateModel.qml b/imports/vehicle/ClimateModel.qml new file mode 100755 index 0000000..9633f16 --- /dev/null +++ b/imports/vehicle/ClimateModel.qml @@ -0,0 +1,44 @@ +/* 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/. */ + +pragma Singleton + +import QtQuick 2.0 +import Automotive.ClimateControl 1.0 + +Item { + property real fanStepSize:1/255 //Represents the stepSize for a given Climate control. + property alias fanSpeed: fanControl.fanSpeedLevel + + property real temperatureStepSize:1/15 //0== 15c, 15 == 30c + + property alias leftTemp: leftFront.targetTemperature + property alias rightTemp: rightFront.targetTemperature + + ClimateControlItem { + id:fanControl + } + + ClimateControlItem { + id: leftFront + zone: 9 + } + + ClimateControlItem { + id: rightFront + zone: 5 + } + + function getRangeValue(inputVal,stepSize){ + if(inputVal > 0){ + return Math.ceil(inputVal/stepSize); + }else{ + return 0; + } + } + +} + diff --git a/imports/vehicle/FuelModel.qml b/imports/vehicle/FuelModel.qml new file mode 100755 index 0000000..fa064e2 --- /dev/null +++ b/imports/vehicle/FuelModel.qml @@ -0,0 +1,46 @@ +/* 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/. */ + +pragma Singleton + +import QtQuick 2.0 + +Item { + property bool metric: false + + function galToL(value) { + return (metric ? 3.78541 : 1) * value + } + + function mpgToLp100(value) { + return metric ? 235.214583571 / value : value + } + + property real baseTank: 25 + property real tankSize: galToL(baseTank) + property real level: tankSize * percentage * 0.01 + property real percentage: 100 + property real range: metric ? 100 * level / average : level * average + property real baseAverage: 20.7 + property real average: mpgToLp100(baseAverage + mpgDiff) + property real mpgDiff: 0 + + NumberAnimation on percentage { + from: 100 + to: 0 + duration: 5000 + loops: Animation.Infinite + easing.type: Easing.CosineCurve + } + + NumberAnimation on mpgDiff { + from: -2 + to: 2 + duration: 11200 + loops: Animation.Infinite + easing.type: Easing.CosineCurve + } +} diff --git a/imports/vehicle/PositionModel.qml b/imports/vehicle/PositionModel.qml new file mode 100755 index 0000000..00956aa --- /dev/null +++ b/imports/vehicle/PositionModel.qml @@ -0,0 +1,33 @@ +/* Copyright (C) 2015, Jaguar Land Rover, IoT.bzh. 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/. */ + +pragma Singleton + +import QtQuick 2.0 +import amb 0.1 + +Item { + property string nmeaString: nmea.value + property real satellites: satsUsed.value + + AutomotivePropertyItem { + id: nmea + + objectName: "GpsNmea" + propertyName: "Nmea" + + Component.onCompleted: nmea.connect(); + } + + AutomotivePropertyItem { + id: satsUsed + + objectName: "GpsSatsUsed" + propertyName: "SatsUsed" + + Component.onCompleted: satsUsed.connect(); + } +} diff --git a/imports/vehicle/SpeedModel.qml b/imports/vehicle/SpeedModel.qml new file mode 100755 index 0000000..03422b0 --- /dev/null +++ b/imports/vehicle/SpeedModel.qml @@ -0,0 +1,38 @@ +/* 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/. */ + +pragma Singleton + +import QtQuick 2.0 +import amb 0.1 + +Item { + property bool metric: false + + function mphToKph(value) { + return (metric ? 1.60934 : 1 ) * value + } + + property real max:Math.ceil(mphToKph(baseMaxSpeed)/30)*30 + property real baseMaxSpeed: 255 + property real textSpeed: prop.value + property real percentage: textSpeed / max * 100 + + AutomotivePropertyItem { + id: prop + + objectName: "VehicleSpeed" + propertyName: "Speed" + + Component.onCompleted: prop.connect(); + } + + Behavior on percentage { + SmoothedAnimation { + velocity: 100 + } + } +} diff --git a/imports/vehicle/TemperatureModel.qml b/imports/vehicle/TemperatureModel.qml new file mode 100755 index 0000000..2bfbbf4 --- /dev/null +++ b/imports/vehicle/TemperatureModel.qml @@ -0,0 +1,26 @@ +/* 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/. */ + +pragma Singleton + +import QtQuick 2.0 + +Item { + property bool metric: true + + function unit(value) { + return celsiusToFahrenheit(value).toFixed(1) + "\u00b0" + (metric ? "C" : "F") + } + + function celsiusToFahrenheit(value) { + return (metric ? value : 1.8 * value + 32) + } + + property real indoor: 20.4 + property string indoorString: unit(indoor) + property real outdoor: 28.9 + property string outdoorString: unit(outdoor) +} diff --git a/imports/vehicle/qmldir b/imports/vehicle/qmldir new file mode 100755 index 0000000..6538e95 --- /dev/null +++ b/imports/vehicle/qmldir @@ -0,0 +1,11 @@ +#/* 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/. */ + +singleton FuelModel 1.0 FuelModel.qml +singleton SpeedModel 1.0 SpeedModel.qml +singleton TemperatureModel 1.0 TemperatureModel.qml +singleton PositionModel 1.0 PositionModel.qml +singleton ClimateModel 1.0 ClimateModel.qml -- cgit 1.2.3-korg