summaryrefslogtreecommitdiffstats
path: root/imports/components
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
parentfb7d55151950ddd391e33afefb5297ad562f1b0d (diff)
add standalone BT app
Signed-off-by: srimaldia <hariasti.srimaldia-1@jp.alps.com>
Diffstat (limited to 'imports/components')
-rwxr-xr-ximports/components/AwesomeIcon.qml26
-rwxr-xr-ximports/components/Box.qml49
-rwxr-xr-ximports/components/BoxButton.qml36
-rwxr-xr-ximports/components/BoxHeading.qml37
-rwxr-xr-ximports/components/Button.qml30
-rwxr-xr-ximports/components/DateTime.qml35
-rwxr-xr-ximports/components/HexGrid.qml32
-rwxr-xr-ximports/components/HexSwitch.qml80
-rwxr-xr-ximports/components/InShadow.qml33
-rwxr-xr-ximports/components/InsetShadow.qml40
-rwxr-xr-ximports/components/Label.qml27
-rwxr-xr-ximports/components/NumberPad.qml101
-rwxr-xr-ximports/components/OutShadow.qml41
-rwxr-xr-ximports/components/Switch.qml13
-rwxr-xr-ximports/components/qmldir16
15 files changed, 596 insertions, 0 deletions
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