From 238076ffff13356c620a7834e25537d4a41e97a6 Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Mon, 8 Apr 2019 18:43:05 +0900 Subject: Add demo3 settings source code for cluster mode. Add demo3 settings source code for cluster mode. [Patch Set 2] Update LICENSE file. Change-Id: I586a211bb55e5017de62e36edd0bbba6968de1b8 BUG-AGL: SPEC-2261 Signed-off-by: zheng_wenlong --- app/SettingPage.qml | 65 +++ app/Settings.qml | 78 ++++ app/SettingsLauncher.qml | 83 ++++ app/app.pri | 12 + app/app.pro | 19 + app/bluetooth/Bluetooth.qml | 435 +++++++++++++++++++++ app/bluetooth/bluetooth.qrc | 8 + app/bluetooth/images/HMI_Pair_Button.svg | 43 ++ app/bluetooth/images/HMI_Paired_Button.svg | 43 ++ .../images/HMI_Settings_BluetoothIcon.svg | 55 +++ app/datetime/DateEdit.qml | 122 ++++++ app/datetime/DateTime.qml | 50 +++ app/datetime/EditSeparator.qml | 40 ++ app/datetime/TimeEdit.qml | 86 ++++ app/datetime/datetime.qrc | 14 + .../HMI_Settings_TimeDate_Arrow_DividingLine.svg | 24 ++ .../images/HMI_Settings_TimeDate_Arrow_Down.svg | 29 ++ .../images/HMI_Settings_TimeDate_Arrow_Up.svg | 29 ++ .../images/HMI_Settings_TimeDate_Button_Cancel.svg | 39 ++ .../images/HMI_Settings_TimeDate_Button_Set.svg | 39 ++ app/datetime/images/HMI_Settings_TimeIcon.svg | 59 +++ app/example/Example.qml | 114 ++++++ app/example/example.qrc | 6 + app/example/images/HMI_Settings_Example.svg | 72 ++++ app/images/HMI_Settings_DividingLine.svg | 58 +++ app/images/HMI_Settings_X.svg | 72 ++++ app/images/images.qrc | 6 + app/main.cpp | 147 +++++++ app/settings.qrc | 7 + app/version/Version.qml | 78 ++++ app/version/images/agl_slide_0.png | Bin 0 -> 1759918 bytes app/version/images/icon.svg | 182 +++++++++ app/version/version.qrc | 7 + app/wifi/Wifi.qml | 175 +++++++++ app/wifi/images/HMI_Settings_WifiIcon.svg | 61 +++ app/wifi/images/HMI_Settings_Wifi_1Bar.svg | 71 ++++ app/wifi/images/HMI_Settings_Wifi_2Bars.svg | 71 ++++ app/wifi/images/HMI_Settings_Wifi_3Bars.svg | 71 ++++ app/wifi/images/HMI_Settings_Wifi_Full.svg | 70 ++++ app/wifi/images/HMI_Settings_Wifi_Locked_1Bar.svg | 78 ++++ app/wifi/images/HMI_Settings_Wifi_Locked_2Bars.svg | 78 ++++ app/wifi/images/HMI_Settings_Wifi_Locked_3Bars.svg | 78 ++++ app/wifi/images/HMI_Settings_Wifi_Locked_Full.svg | 77 ++++ .../images/HMI_Settings_Wifi_Locked_NoBars.svg | 79 ++++ app/wifi/images/HMI_Settings_Wifi_NoBars.svg | 70 ++++ app/wifi/wifi.qrc | 16 + 46 files changed, 3116 insertions(+) create mode 100644 app/SettingPage.qml create mode 100644 app/Settings.qml create mode 100644 app/SettingsLauncher.qml create mode 100644 app/app.pri create mode 100644 app/app.pro create mode 100644 app/bluetooth/Bluetooth.qml create mode 100644 app/bluetooth/bluetooth.qrc create mode 100644 app/bluetooth/images/HMI_Pair_Button.svg create mode 100644 app/bluetooth/images/HMI_Paired_Button.svg create mode 100644 app/bluetooth/images/HMI_Settings_BluetoothIcon.svg create mode 100644 app/datetime/DateEdit.qml create mode 100644 app/datetime/DateTime.qml create mode 100644 app/datetime/EditSeparator.qml create mode 100644 app/datetime/TimeEdit.qml create mode 100644 app/datetime/datetime.qrc create mode 100644 app/datetime/images/HMI_Settings_TimeDate_Arrow_DividingLine.svg create mode 100644 app/datetime/images/HMI_Settings_TimeDate_Arrow_Down.svg create mode 100644 app/datetime/images/HMI_Settings_TimeDate_Arrow_Up.svg create mode 100644 app/datetime/images/HMI_Settings_TimeDate_Button_Cancel.svg create mode 100644 app/datetime/images/HMI_Settings_TimeDate_Button_Set.svg create mode 100644 app/datetime/images/HMI_Settings_TimeIcon.svg create mode 100644 app/example/Example.qml create mode 100644 app/example/example.qrc create mode 100644 app/example/images/HMI_Settings_Example.svg create mode 100644 app/images/HMI_Settings_DividingLine.svg create mode 100644 app/images/HMI_Settings_X.svg create mode 100644 app/images/images.qrc create mode 100644 app/main.cpp create mode 100644 app/settings.qrc create mode 100644 app/version/Version.qml create mode 100644 app/version/images/agl_slide_0.png create mode 100644 app/version/images/icon.svg create mode 100644 app/version/version.qrc create mode 100644 app/wifi/Wifi.qml create mode 100644 app/wifi/images/HMI_Settings_WifiIcon.svg create mode 100644 app/wifi/images/HMI_Settings_Wifi_1Bar.svg create mode 100644 app/wifi/images/HMI_Settings_Wifi_2Bars.svg create mode 100644 app/wifi/images/HMI_Settings_Wifi_3Bars.svg create mode 100644 app/wifi/images/HMI_Settings_Wifi_Full.svg create mode 100644 app/wifi/images/HMI_Settings_Wifi_Locked_1Bar.svg create mode 100644 app/wifi/images/HMI_Settings_Wifi_Locked_2Bars.svg create mode 100644 app/wifi/images/HMI_Settings_Wifi_Locked_3Bars.svg create mode 100644 app/wifi/images/HMI_Settings_Wifi_Locked_Full.svg create mode 100644 app/wifi/images/HMI_Settings_Wifi_Locked_NoBars.svg create mode 100644 app/wifi/images/HMI_Settings_Wifi_NoBars.svg create mode 100644 app/wifi/wifi.qrc (limited to 'app') diff --git a/app/SettingPage.qml b/app/SettingPage.qml new file mode 100644 index 0000000..c8072de --- /dev/null +++ b/app/SettingPage.qml @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 +import AGL.Demo.Controls 1.0 + +Page { + id: root + readonly property bool isSetting: true + property string icon + property bool checkable: false + property bool checked: false + function done() { + parent.pop() + } + + function setStatusIcon(index, icon) { + dbus.setStatusIcon(index, icon) + } + + Connections { + target: root + onCheckedChanged: { + checkedSwitch.checked = checked + } + } + + Row { + anchors.right: parent.right + anchors.rightMargin: 100 + anchors.bottom: parent.top + anchors.bottomMargin: 10 + spacing: 20 + + Switch { + id: checkedSwitch + visible: root.checkable + onCheckedChanged: root.checked = checked + } + + ImageButton { + id: back + anchors.bottom: parent.bottom + offImage: '../images/HMI_Settings_X.svg' + onClicked: root.done() + } + } + +} diff --git a/app/Settings.qml b/app/Settings.qml new file mode 100644 index 0000000..9369066 --- /dev/null +++ b/app/Settings.qml @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 + +import 'datetime' +import 'bluetooth' +import 'wifi' +import 'example' +import 'version' + +ApplicationWindow { + id: root + width: container.width * container.scale + height: container.height * container.scale + + onVisibleChanged: { + if (!visible) + stack.pop(settings) + } + + Item { + id: container + anchors.centerIn: parent + width: 1920 + height: 720 + scale: screenInfo.scale_factor() + + StackView { + id: stack + anchors.fill: parent + initialItem: settings + + SettingsLauncher { + id: settings + onLaunch: { + stack.push(app) + } + + Component.onCompleted: { + for (var a in stack.children) { + var app = stack.children[a] + if (!app.isSetting) continue + settingsModel.append({'icon': app.icon, 'title': app.title, 'checkable': app.checkable, 'app': app}) + app.visible = false + } + } + + model: ListModel { id: settingsModel } + } + + DateTime {} + + Bluetooth {} + + Wifi {} + +// Example {} + + Version {} + } +} +} diff --git a/app/SettingsLauncher.qml b/app/SettingsLauncher.qml new file mode 100644 index 0000000..c62627a --- /dev/null +++ b/app/SettingsLauncher.qml @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 + +Page { + id: root + title: 'Settings' + property alias model: view.model + signal launch(var app) + signal toggled(var app, bool on) + + ListView { + id: view + anchors.fill: parent + anchors.margins: root.width * 0.075 + clip: true + + delegate: MouseArea { + id: delegate + width: ListView.view.width + height: width / 15 + RowLayout { + anchors.fill: parent + Item { + Layout.preferredWidth: 100 + Layout.preferredHeight: 100 + Image { + anchors.fill: parent + source: model.icon + } + } + Label { + Layout.fillWidth: true + text: model.title.toUpperCase() + color: '#00ADDC' + } + Switch { + id: checkedSwitch + visible: model.checkable + onCheckedChanged: model.app.checked = checked + } + Connections { + target: model.app + onCheckableChanged: { + checkedSwitch.visible = model.app.checkable + } + onCheckedChanged: { + checkedSwitch.checked = model.app.checked + } + } + + Component.onCompleted: { + checkedSwitch.checked = model.app.checked + } + } + Image { + source: '../images/HMI_Settings_DividingLine.svg' + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + visible: model.index > 0 + } + + onClicked: launch(model.app) + } + } +} diff --git a/app/app.pri b/app/app.pri new file mode 100644 index 0000000..014646f --- /dev/null +++ b/app/app.pri @@ -0,0 +1,12 @@ +TEMPLATE = app + +load(configure) +qtCompileTest(libhomescreen) + +config_libhomescreen { + CONFIG += link_pkgconfig + PKGCONFIG += homescreen + DEFINES += HAVE_LIBHOMESCREEN +} + +DESTDIR = $${OUT_PWD}/../package/root/bin diff --git a/app/app.pro b/app/app.pro new file mode 100644 index 0000000..df45be1 --- /dev/null +++ b/app/app.pro @@ -0,0 +1,19 @@ +TARGET = settings +QT = quickcontrols2 websockets dbus + +SOURCES = main.cpp + +CONFIG += link_pkgconfig +PKGCONFIG += libhomescreen qlibwindowmanager qtappfw + +RESOURCES += \ + settings.qrc \ + images/images.qrc \ + datetime/datetime.qrc \ + wifi/wifi.qrc \ + bluetooth/bluetooth.qrc \ + example/example.qrc \ + version/version.qrc + + +include(app.pri) diff --git a/app/bluetooth/Bluetooth.qml b/app/bluetooth/Bluetooth.qml new file mode 100644 index 0000000..7a63e84 --- /dev/null +++ b/app/bluetooth/Bluetooth.qml @@ -0,0 +1,435 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 +import QtWebSockets 1.0 +import '..' + +SettingPage { + id: root + icon: '/bluetooth/images/HMI_Settings_BluetoothIcon.svg' + title: 'Bluetooth' + checkable: true + readonly property bool isBluetooth: true + property int pairedDeviceCount: 0 + + Connections { + target: bluetooth + onRequestConfirmationEvent: { + bluetooth.send_confirmation() + } + + onDeviceAddedEvent: { + if (data.Paired === "True") { + pairedDeviceList.append({ + deviceAddress: data.Address, + deviceName: data.Name, + devicePairable: data.Paired, + deviceConnect: data.Connected, + connectAVP: data.AVPConnected, + connectHFP: data.HFPConnected, + textToShow: "" + }) + pairedDeviceCount = pairedDeviceCount + 1 + } else { + btDeviceList.append({ + deviceAddress: data.Address, + deviceName: data.Name, + devicePairable: data.Paired, + deviceConnect: data.Connected, + connectAVP: data.AVPConnected, + connectHFP: data.HFPConnected, + textToShow: "" + }) + } + } + + onDeviceRemovedEvent: { + if (findDevice(data.Address) >= 0) { + btDeviceList.remove(findDevice(data.Address)) + } else if(findPairDevice(data.Address) >= 0) { + pairedDeviceList.remove(findPairDevice(data.Address)) + pairedDeviceCount = pairedDeviceCount - 1 + } + } + + onDeviceUpdatedEvent: { + updateDeviceAttribute(data) + } + + onDeviceListEvent: { + for (var i = 0; i < data.list.length; i++) { + var value = data.list[i] + if (value.Paired==="True") { + if(findPairDevice(value.Address) == -1) { + pairedDeviceList.append({ + deviceAddress: value.Address, + deviceName: value.Name, + devicePairable:value.Paired, + deviceConnect: value.Connected, + connectAVP: value.AVPConnected, + connectHFP: value.HFPConnected, + textToShow: "" + }) + pairedDeviceCount = pairedDeviceCount + 1 + } + } + else + if (findDevice(value.Address) == -1) { + btDeviceList.append({ + deviceAddress: value.Address, + deviceName: value.Name, + devicePairable:value.Paired, + deviceConnect: value.Connected, + connectAVP: value.AVPConnected, + connectHFP: value.HFPConnected, + textToShow: "" + }) + } + } + } + + onPowerChanged: { + root.checked = bluetooth.power + } + } + + Text { + id: log + anchors.fill: parent + anchors.margins: 10 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + + onCheckedChanged: { + console.log("Bluetooth set to", checked) + + pairedDeviceCount = 0 + bluetooth.power = checked; + bluetooth.discoverable = checked; + + if (checked == true) { + bluetooth.start_discovery() + } else { + btDeviceList.clear() + pairedDeviceList.clear() + bluetooth.stop_discovery() + } + } + + ListModel { + id: pairedDeviceList + } + ListModel { + id: btDeviceList + } + + + Rectangle { + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.margins: 80 + width: buttonScan.width + 10 + height: buttonScan.height + 10 + color: "#222" + border.color: "white" + + Button { + id: buttonScan + anchors.centerIn: parent + width: 100 + text: bluetooth.discoverable ? "STOP" :"SEARCH" + + MouseArea { + //id: mouseArea + anchors.fill: parent + + onClicked: { + if (bluetooth.discoverable === false && bluetooth.power === true) { + bluetooth.start_discovery() + bluetooth.discoverable = true; + } else { + bluetooth.stop_discovery() + bluetooth.discoverable = false; + } + } + } + } + } + + Component { + id:blueToothDevice + Rectangle { + height: 120 + width: parent.width + color: "transparent" + MouseArea { + anchors.fill: parent + Column { + anchors.left: parent.left + anchors.leftMargin: 80 + TextMetrics { + id: textMetrics + font.family: "Arial" + elide: Text.ElideRight + elideWidth: 140 + text: deviceName + } + Text { + id: btName + text: textMetrics.elidedText + color: '#66FF99' + font.pixelSize: 48 + } + Text { + id: btStatus + property string connectionState:"" + text: { + if ((devicePairable === "True") + && (deviceConnect === "True") + && (connectAVP === "True") + && (connectHFP === "False")) + text = " AV Connection, " + else if ((devicePairable === "True") + && (deviceConnect === "True") + && (connectHFP === "True") + && (connectAVP === "False")) + text = " Handsfree Connection, " + else if ((devicePairable === "True") + && (deviceConnect === "True") + && (connectHFP === "True") + && (connectAVP === "True")) + text = " Handsfree & AV Connection, " + else + text = connectionState + + text = deviceAddress + text + } + font.pixelSize: 18 + color: "#ffffff" + font.italic: true + } + Text { + id: btPairable + text: devicePairable + visible: false + } + Text { + id: btConnectstatus + text: deviceConnect + visible: false + } + } + Button { + id: removeButton + anchors.top:parent.top + anchors.topMargin: 15 + //anchors.horizontalCenter: btName.horizontalCenter + anchors.right: parent.right + anchors.rightMargin: 100 + + text: "Remove" + MouseArea { + anchors.fill: parent + onClicked: { + bluetooth.remove_device(deviceAddress); + if (findDevice(deviceAddress) != -1) { + btDeviceList.remove(findDevice(deviceAddress)) + } else if (findPairDevice(deviceAddress) != -1) { + pairedDeviceList.remove(findPairDevice(deviceAddress)) + pairedDeviceCount = pairedDeviceCount - 1 + } + } + } + } + + Button { + id: connectButton + anchors.top:parent.top + anchors.topMargin: 15 + anchors.right: removeButton.left + anchors.rightMargin: 10 + + text: (deviceConnect == "True") ? "Disconnect" : ((btPairable.text == "True") ? "Connect" : "Pair") + // only when HFP or AVP is connected, button will be shown as Disconnect + MouseArea { + anchors.fill: parent + onClicked: { + if (connectButton.text == "Pair"){ + connectButton.text = "Connect" + bluetooth.pair(deviceAddress) + btPairable.text = "True" + } + else if (connectButton.text == "Connect"){ + connectButton.text = "Disconnect" + bluetooth.connect(deviceAddress) + } + else if (connectButton.text == "Disconnect"){ + bluetooth.disconnect(deviceAddress) + connectButton.text = "Connect" + } + } + } + } + } + } + } + Text { + id: pairedlabel + width: parent.width + anchors.top: parent.top + anchors.topMargin: 50 + anchors.left: parent.left + anchors.leftMargin: 80 + height: 80 + color:'grey' + font.pixelSize: 30 + text:{ + if (bluetooth.power == true && pairedDeviceCount != 0) + "LIST OF PAIRED DEVICES" + else + "" + } + } + ListView{ + id: pairedListView + width: parent.width + anchors.top: pairedlabel.bottom + anchors.bottom: pairedlabel.bottom + anchors.bottomMargin: (-120*pairedDeviceCount) + model: pairedDeviceList + delegate: blueToothDevice + clip: true + } + Image { + anchors.bottom: pairedListView.bottom + anchors.left: parent.left + anchors.leftMargin: 80 + height: 5 + source: (bluetooth.power === true && pairedDeviceCount != 0) ? '../images/HMI_Settings_DividingLine.svg':'' + } + Text { + id: detectedlabel + width: parent.width + anchors.top: pairedListView.bottom + anchors.topMargin: (pairedDeviceCount != 0) ? 80:-80 + anchors.left: parent.left + anchors.leftMargin: 80 + height: 80 + color:'grey' + font.pixelSize: 30 + text: { + if (bluetooth.power === true) + "LIST OF DETECTED DEVICES" + else + "" + } + } + ListView { + id:listView2 + width: parent.width + anchors.top: detectedlabel.bottom + anchors.bottom: parent.bottom + anchors.bottomMargin: 150 + model: btDeviceList + delegate: blueToothDevice + clip: true + } + + function findDevice(address) { + for (var i = 0; i < btDeviceList.count; i++) { + if (address === btDeviceList.get(i).deviceAddress) + return i + } + return -1 + } + function findPairDevice(address){ + for (var i = 0; i < pairedDeviceList.count; i++) { + if (address === pairedDeviceList.get(i).deviceAddress) + return i + } + return -1 + } + + function updateDeviceAttribute(data){ + var text = "" + for (var i = 0; i < btDeviceList.count; i++) { + if (data.Address === btDeviceList.get(i).deviceAddress){ + btDeviceList.get(i).devicePairable = data.Paired + if (data.Paired === "True") + { + pairedDeviceList.append({ + deviceAddress: btDeviceList.get(i).deviceAddress, + deviceName: btDeviceList.get(i).deviceName, + devicePairable:btDeviceList.get(i).devicePairable, + deviceConnect: btDeviceList.get(i).deviceConnect, + connectAVP: btDeviceList.get(i).connectAVP, + connectHFP: btDeviceList.get(i).connectHFP, + textToShow: "" + }) + pairedDeviceCount = pairedDeviceCount + 1 + btDeviceList.remove(i, 1) + } + else{ + text=deviceConnectionAttribute(data) + btDeviceList.set(i, { + textToShow: " " + text + }) + + btDeviceList.get(i).deviceConnect = data.Connected + console.log(data.Connected) + } + + } + } + for (var i = 0; i < pairedDeviceList.count; i++) { + if(data.Address === pairedDeviceList.get(i).deviceAddress){ + pairedDeviceList.get(i).devicePairable = data.Paired + + text=deviceConnectionAttribute(data) + pairedDeviceList.set(i, { textToShow: " " + text }) + + pairedDeviceList.get(i).deviceConnect = data.Connected + } + } + } + + function deviceConnectionAttribute(data){ + var text = "" + if ((data.Paired === "True") + && (data.Connected === "True") + && (data.AVPConnected === "True") + && (data.HFPConnected === "False")) + text = "AV Connection, " + else if ((data.Paired === "True") + && (data.Connected === "True") + && (data.HFPConnected === "True") + && (data.AVPConnected === "False")) + text = "Handsfree Connection, " + else if ((data.Paired === "True") + && (data.Connected === "True") + && (data.HFPConnected === "True") + && (data.AVPConnected === "True")) { + console.log("all connected!!") + text = ", Handsfree & AV Connection"} + else + text = "" + return text + } +} diff --git a/app/bluetooth/bluetooth.qrc b/app/bluetooth/bluetooth.qrc new file mode 100644 index 0000000..bc8b70a --- /dev/null +++ b/app/bluetooth/bluetooth.qrc @@ -0,0 +1,8 @@ + + + Bluetooth.qml + images/HMI_Pair_Button.svg + images/HMI_Paired_Button.svg + images/HMI_Settings_BluetoothIcon.svg + + diff --git a/app/bluetooth/images/HMI_Pair_Button.svg b/app/bluetooth/images/HMI_Pair_Button.svg new file mode 100644 index 0000000..9d3f626 --- /dev/null +++ b/app/bluetooth/images/HMI_Pair_Button.svg @@ -0,0 +1,43 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + Pair + + + + + diff --git a/app/bluetooth/images/HMI_Paired_Button.svg b/app/bluetooth/images/HMI_Paired_Button.svg new file mode 100644 index 0000000..6e1f57a --- /dev/null +++ b/app/bluetooth/images/HMI_Paired_Button.svg @@ -0,0 +1,43 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + PairED + + + + + diff --git a/app/bluetooth/images/HMI_Settings_BluetoothIcon.svg b/app/bluetooth/images/HMI_Settings_BluetoothIcon.svg new file mode 100644 index 0000000..d41de2a --- /dev/null +++ b/app/bluetooth/images/HMI_Settings_BluetoothIcon.svg @@ -0,0 +1,55 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/datetime/DateEdit.qml b/app/datetime/DateEdit.qml new file mode 100644 index 0000000..f9f75fd --- /dev/null +++ b/app/datetime/DateEdit.qml @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 +import AGL.Demo.Controls 1.0 + +GridLayout { + id: root + flow: GridLayout.TopToBottom + rows: 3 + + property int year: yearControl.model[yearControl.currentIndex] + property int month: monthControl.currentIndex + 1 + property int day: dayControl.currentIndex + 1 + + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Up.svg' + onClicked: monthControl.currentIndex++ + } + Tumbler { + id: monthControl + implicitWidth: 200 + model: ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] + onCurrentIndexChanged: dayControl.regenerateModel() + + EditSeparator { anchors.fill: parent } + } + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Down.svg' + onClicked: monthControl.currentIndex-- + } + + Item { width: 10; height: 10 } + Label { text: ':' } + Item { width: 10; height: 10 } + + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Up.svg' + onClicked: dayControl.currentIndex++ + } + + Tumbler { + id: dayControl + model: ListModel{ + id: monthModel + } + Component.onCompleted: regenerateModel() + function regenerateModel() { + var eom = 0 + var y = yearControl.model[yearControl.currentIndex] + var m = monthControl.currentIndex + 1 + switch (m) { + case 2: + eom = 28 + parseInt(1 / (y % 4 + 1)) - parseInt(1 - 1 / (y % 100 + 1)) + parseInt(1 / (y % 400 + 1)) + break + case 4: + case 6: + case 9: + case 11: + eom = 30 + break + default: + eom = 31 + break + } + while (monthModel.count < eom) + monthModel.append({modelData: monthModel.count + 1}) + while (monthModel.count > eom) + monthModel.remove(monthModel.count - 1, 1) + } + EditSeparator { anchors.fill: parent } + } + + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Down.svg' + onClicked: dayControl.currentIndex-- + } + + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Up.svg' + onClicked: yearControl.currentIndex++ + } + + Tumbler { + id: yearControl + Component.onCompleted: { + var arr = new Array + for (var i = 2010; i < 2050; i++) { + arr.push(i) + } + yearControl.model = arr + } + onCurrentIndexChanged: dayControl.regenerateModel() + EditSeparator { anchors.fill: parent } + } + + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Down.svg' + onClicked: yearControl.currentIndex-- + } +} diff --git a/app/datetime/DateTime.qml b/app/datetime/DateTime.qml new file mode 100644 index 0000000..5030b1e --- /dev/null +++ b/app/datetime/DateTime.qml @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 +import AGL.Demo.Controls 1.0 +import '..' + +SettingPage { + id: root + icon: '/datetime/images/HMI_Settings_TimeIcon.svg' + title: 'Date & Time' + + ColumnLayout { + anchors.fill: parent + anchors.margins: 100 + Label { text: 'Date'} + DateEdit {} + Image { + source: '../images/HMI_Settings_DividingLine.svg' + } + Label { text: 'Time'} + TimeEdit {} + RowLayout { + anchors.right: parent.right + Button { + text: 'OK' + highlighted: true + onClicked: root.done() + } + } + Item { + Layout.fillHeight: true + } + } +} diff --git a/app/datetime/EditSeparator.qml b/app/datetime/EditSeparator.qml new file mode 100644 index 0000000..e833b52 --- /dev/null +++ b/app/datetime/EditSeparator.qml @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 + +ColumnLayout { + anchors.fill: parent + z: -1 + Item { + Layout.fillHeight: true + Layout.preferredHeight: 1 + } + Repeater { + model: 2 + Image { + Layout.fillHeight: true + Layout.preferredHeight: 2 + Layout.alignment: Layout.Center + source: './images/HMI_Settings_TimeDate_Arrow_DividingLine.svg' + } + } + Item { + Layout.fillHeight: true + Layout.preferredHeight: 1 + } +} diff --git a/app/datetime/TimeEdit.qml b/app/datetime/TimeEdit.qml new file mode 100644 index 0000000..69a049b --- /dev/null +++ b/app/datetime/TimeEdit.qml @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 +import AGL.Demo.Controls 1.0 + +GridLayout { + id: root + flow: GridLayout.TopToBottom + rows: 3 + + property int hour: hourControl.currentIndex + property int minutes: minutesControl.currentIndex + property string ampm: ampmControl.model[ampmControl.currentIndex] + + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Up.svg' + onClicked: hourControl.currentIndex++ + } + Tumbler { + id: hourControl + model: 12 + EditSeparator { anchors.fill: parent } + } + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Down.svg' + onClicked: hourControl.currentIndex-- + } + + Item { width: 10; height: 10 } + Label { text: ':' } + Item { width: 10; height: 10 } + + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Up.svg' + onClicked: minutesControl.currentIndex++ + } + + Tumbler { + id: minutesControl + model: 60 + EditSeparator { anchors.fill: parent } + } + + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Down.svg' + onClicked: minutesControl.currentIndex-- + } + + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Up.svg' + onClicked: ampmControl.currentIndex++ + } + + Tumbler { + id: ampmControl + model: ['AM', 'PM', 'AM', 'PM'] + EditSeparator { anchors.fill: parent } + } + + ImageButton { + Layout.alignment: Layout.Center + offImage: './images/HMI_Settings_TimeDate_Arrow_Down.svg' + onClicked: ampmControl.currentIndex-- + } +} diff --git a/app/datetime/datetime.qrc b/app/datetime/datetime.qrc new file mode 100644 index 0000000..c60c626 --- /dev/null +++ b/app/datetime/datetime.qrc @@ -0,0 +1,14 @@ + + + DateEdit.qml + DateTime.qml + TimeEdit.qml + EditSeparator.qml + images/HMI_Settings_TimeDate_Arrow_DividingLine.svg + images/HMI_Settings_TimeDate_Arrow_Down.svg + images/HMI_Settings_TimeDate_Arrow_Up.svg + images/HMI_Settings_TimeDate_Button_Cancel.svg + images/HMI_Settings_TimeDate_Button_Set.svg + images/HMI_Settings_TimeIcon.svg + + diff --git a/app/datetime/images/HMI_Settings_TimeDate_Arrow_DividingLine.svg b/app/datetime/images/HMI_Settings_TimeDate_Arrow_DividingLine.svg new file mode 100644 index 0000000..f311d6a --- /dev/null +++ b/app/datetime/images/HMI_Settings_TimeDate_Arrow_DividingLine.svg @@ -0,0 +1,24 @@ + + + + + + + + + + +]> + + + + + + + + diff --git a/app/datetime/images/HMI_Settings_TimeDate_Arrow_Down.svg b/app/datetime/images/HMI_Settings_TimeDate_Arrow_Down.svg new file mode 100644 index 0000000..18ae1f5 --- /dev/null +++ b/app/datetime/images/HMI_Settings_TimeDate_Arrow_Down.svg @@ -0,0 +1,29 @@ + + + + + + + + + + +]> + + + + + + + + + + + + diff --git a/app/datetime/images/HMI_Settings_TimeDate_Arrow_Up.svg b/app/datetime/images/HMI_Settings_TimeDate_Arrow_Up.svg new file mode 100644 index 0000000..7eba43d --- /dev/null +++ b/app/datetime/images/HMI_Settings_TimeDate_Arrow_Up.svg @@ -0,0 +1,29 @@ + + + + + + + + + + +]> + + + + + + + + + + + + diff --git a/app/datetime/images/HMI_Settings_TimeDate_Button_Cancel.svg b/app/datetime/images/HMI_Settings_TimeDate_Button_Cancel.svg new file mode 100644 index 0000000..14a7edc --- /dev/null +++ b/app/datetime/images/HMI_Settings_TimeDate_Button_Cancel.svg @@ -0,0 +1,39 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + CANCEL + + + + + diff --git a/app/datetime/images/HMI_Settings_TimeDate_Button_Set.svg b/app/datetime/images/HMI_Settings_TimeDate_Button_Set.svg new file mode 100644 index 0000000..e258e1e --- /dev/null +++ b/app/datetime/images/HMI_Settings_TimeDate_Button_Set.svg @@ -0,0 +1,39 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + SET + + + + + diff --git a/app/datetime/images/HMI_Settings_TimeIcon.svg b/app/datetime/images/HMI_Settings_TimeIcon.svg new file mode 100644 index 0000000..d4b2ef6 --- /dev/null +++ b/app/datetime/images/HMI_Settings_TimeIcon.svg @@ -0,0 +1,59 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/example/Example.qml b/app/example/Example.qml new file mode 100644 index 0000000..283b76b --- /dev/null +++ b/app/example/Example.qml @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 +import AGL.Demo.Controls 1.0 +import '..' + +SettingPage { + id: root + icon: '/example/images/HMI_Settings_Example.svg' + title: 'Example' + checkable: true + + ColumnLayout { + anchors.fill: parent + anchors.margins: 100 + RowLayout { + spacing: 20 + Button { + text: 'Wifi' + highlighted: true + property int index: 0 + property var icons: ['HMI_Status_Wifi_NoBars-01', 'HMI_Status_Wifi_1Bar-01', 'HMI_Status_Wifi_2Bars-01', 'HMI_Status_Wifi_3Bars-01', 'HMI_Status_Wifi_Full-01'] + onClicked: { + index = (index + 1) % icons.length + setStatusIcon(0, 'qrc:/images/Status/%1.png'.arg(icons[index])) + } + } + Button { + text: 'Bluetooth' + property int index: 0 + property var icons: ['HMI_Status_Bluetooth_Inactive-01', 'HMI_Status_Bluetooth_On-01'] + onClicked: { + index = (index + 1) % icons.length + setStatusIcon(1, 'qrc:/images/Status/%1.png'.arg(icons[index])) + } + } + Button { + text: 'Signal' + property int index: 0 + property var icons: ['HMI_Status_Signal_NoBars-01', 'HMI_Status_Signal_1Bars-01', 'HMI_Status_Signal_2Bars-01', 'HMI_Status_Signal_3Bars-01', 'HMI_Status_Signal_4Bars-01', 'HMI_Status_Signal_Full-01'] + onClicked: { + index = (index + 1) % icons.length + setStatusIcon(2, 'qrc:/images/Status/%1.png'.arg(icons[index])) + } + } + } + + Image { + source: '../images/HMI_Settings_DividingLine.svg' + } + + ListView { + Layout.fillWidth: true + Layout.fillHeight: true + clip: true + model: 10 + delegate: MouseArea { + width: ListView.view.width + height: 110 + RowLayout { + anchors.fill: parent + anchors.margins: 5 + spacing: 30 + Image { + source: './images/HMI_Settings_Example.svg' + } + + ColumnLayout { + Label { + id: title + Layout.fillWidth: true + text: 'Title' + font.pixelSize: 48 + } + Label { + id: subtitle + Layout.fillWidth: true + text: 'Subtitle' + color: '#66FF99' + font.pixelSize: 24 + } + } + + Button { + text: 'Go' + } + } + + Image { + source: '../images/HMI_Settings_DividingLine.svg' + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + visible: model.index > 0 + } + } + } + } +} diff --git a/app/example/example.qrc b/app/example/example.qrc new file mode 100644 index 0000000..5739f8e --- /dev/null +++ b/app/example/example.qrc @@ -0,0 +1,6 @@ + + + Example.qml + images/HMI_Settings_Example.svg + + diff --git a/app/example/images/HMI_Settings_Example.svg b/app/example/images/HMI_Settings_Example.svg new file mode 100644 index 0000000..5ad9479 --- /dev/null +++ b/app/example/images/HMI_Settings_Example.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/images/HMI_Settings_DividingLine.svg b/app/images/HMI_Settings_DividingLine.svg new file mode 100644 index 0000000..d63589c --- /dev/null +++ b/app/images/HMI_Settings_DividingLine.svg @@ -0,0 +1,58 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/images/HMI_Settings_X.svg b/app/images/HMI_Settings_X.svg new file mode 100644 index 0000000..5ad9479 --- /dev/null +++ b/app/images/HMI_Settings_X.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/images/images.qrc b/app/images/images.qrc new file mode 100644 index 0000000..0bb2c0d --- /dev/null +++ b/app/images/images.qrc @@ -0,0 +1,6 @@ + + + HMI_Settings_DividingLine.svg + HMI_Settings_X.svg + + diff --git a/app/main.cpp b/app/main.cpp new file mode 100644 index 0000000..026f932 --- /dev/null +++ b/app/main.cpp @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * Copyright (C) 2017 Konsulko Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class DBus : public QObject +{ + Q_OBJECT +public: + DBus(QObject *parent = nullptr) + : QObject(parent) + , interface("org.agl.homescreen", "/StatusBar", "org.agl.statusbar", QDBusConnection::sessionBus()) + {} + + Q_INVOKABLE void setStatusIcon(int index, const QString &url) { + interface.call("setStatusIcon", index, url); + } + +private: + QDBusInterface interface; +}; + +int main(int argc, char *argv[]) +{ + QString myname = QString("Settings"); + + QGuiApplication app(argc, argv); + app.setApplicationName(myname); + app.setApplicationVersion(QStringLiteral("0.1.0")); + app.setOrganizationDomain(QStringLiteral("automotivelinux.org")); + app.setOrganizationName(QStringLiteral("AutomotiveGradeLinux")); + + QQuickStyle::setStyle("AGL"); + + QCommandLineParser parser; + parser.addPositionalArgument("port", app.translate("main", "port for binding")); + parser.addPositionalArgument("secret", app.translate("main", "secret for binding")); + parser.addHelpOption(); + parser.addVersionOption(); + parser.process(app); + QStringList positionalArguments = parser.positionalArguments(); + + QQmlApplicationEngine engine; + if (positionalArguments.length() != 2) { + exit(EXIT_FAILURE); + } + int port = positionalArguments.takeFirst().toInt(); + QString secret = positionalArguments.takeFirst(); + QUrlQuery query; + query.addQueryItem(QStringLiteral("token"), secret); + + QUrl bindingAddressWS; + bindingAddressWS.setScheme(QStringLiteral("ws")); + bindingAddressWS.setHost(QStringLiteral("localhost")); + bindingAddressWS.setPort(port); + bindingAddressWS.setPath(QStringLiteral("/api")); + bindingAddressWS.setQuery(query); + QQmlContext *context = engine.rootContext(); + context->setContextProperty(QStringLiteral("bindingAddressWS"), bindingAddressWS); + context->setContextProperty("network", new Network(bindingAddressWS, context)); + + std::string token = secret.toStdString(); + LibHomeScreen* hs = new LibHomeScreen(); + QLibWindowmanager* qwm = new QLibWindowmanager(); + + // WindowManager + if(qwm->init(port,secret) != 0) { + exit(EXIT_FAILURE); + } + AGLScreenInfo screenInfo(qwm->get_scale_factor()); + // Request a surface as described in layers.json windowmanager’s file + if(qwm->requestSurface(myname) != 0) { + exit(EXIT_FAILURE); + } + // Create an event callback against an event type. Here a lambda is called when SyncDraw event occurs + qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, [qwm, myname](json_object *object) { + fprintf(stderr, "Surface got syncDraw!\n"); + qwm->endDraw(myname); + }); + + // HomeScreen + hs->init(port, token.c_str()); + // Set the event handler for Event_TapShortcut which will activate the surface for windowmanager + hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [qwm, myname](json_object *object){ + qwm->activateSurface(myname); + }); + + QFile version("/proc/version"); + if (version.open(QFile::ReadOnly)) { + QStringList data = QString::fromLocal8Bit(version.readAll()).split(QLatin1Char(' ')); + engine.rootContext()->setContextProperty("kernel", data.at(2)); + version.close(); + } else { + qWarning() << version.errorString(); + } + + QFile aglversion("/etc/os-release"); + if (aglversion.open(QFile::ReadOnly)) { + QStringList data = QString::fromLocal8Bit(aglversion.readAll()).split(QLatin1Char('\n')); + QStringList data2 = data.at(2).split(QLatin1Char('"')); + engine.rootContext()->setContextProperty("ucb", data2.at(1)); + aglversion.close(); + } else { + qWarning() << aglversion.errorString(); + } + + DBus dbus; + engine.rootContext()->setContextProperty("dbus", &dbus); + engine.rootContext()->setContextProperty("bluetooth", new Bluetooth(bindingAddressWS)); + engine.rootContext()->setContextProperty(QStringLiteral("screenInfo"), &screenInfo); + engine.load(QUrl(QStringLiteral("qrc:/Settings.qml"))); + QObject *root = engine.rootObjects().first(); + QQuickWindow *window = qobject_cast(root); + QObject::connect(window, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateSurface())); + + return app.exec(); +} + +#include "main.moc" diff --git a/app/settings.qrc b/app/settings.qrc new file mode 100644 index 0000000..189f441 --- /dev/null +++ b/app/settings.qrc @@ -0,0 +1,7 @@ + + + Settings.qml + SettingsLauncher.qml + SettingPage.qml + + diff --git a/app/version/Version.qml b/app/version/Version.qml new file mode 100644 index 0000000..8d47ad5 --- /dev/null +++ b/app/version/Version.qml @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 +import QtQuick.Window 2.2 +import AGL.Demo.Controls 1.0 +import '..' + +SettingPage { + id: root + icon: '/version/images/icon.svg' + title: 'Version Info' + + ColumnLayout { + id: container + anchors.fill: parent + anchors.margins: 100 + Label { + Layout.fillWidth: true + Layout.preferredHeight: 500 + text: 'Automotive\nGrade Linux' + font.pixelSize: 128 + horizontalAlignment: Label.AlignHCenter + verticalAlignment: Label.AlignVCenter + clip: true + Image { + anchors.centerIn: parent + source: './images/agl_slide_0.png' + z: -1 + opacity: 0.5 + } + } + + GridLayout { + columns: 2 + rowSpacing: 20 + columnSpacing: 20 + Label { + text: 'AGL:' + font.pixelSize: 48 + } + Label { + text: ucb + font.pixelSize: 48 + Layout.fillWidth: true + } + Label { + text: 'Kernel:' + font.pixelSize: 48 + } + Label { + text: kernel + font.pixelSize: 48 + Layout.fillWidth: true + } + } + + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + } +} diff --git a/app/version/images/agl_slide_0.png b/app/version/images/agl_slide_0.png new file mode 100644 index 0000000..6fd062d Binary files /dev/null and b/app/version/images/agl_slide_0.png differ diff --git a/app/version/images/icon.svg b/app/version/images/icon.svg new file mode 100644 index 0000000..97758e9 --- /dev/null +++ b/app/version/images/icon.svg @@ -0,0 +1,182 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/version/version.qrc b/app/version/version.qrc new file mode 100644 index 0000000..0453cc0 --- /dev/null +++ b/app/version/version.qrc @@ -0,0 +1,7 @@ + + + Version.qml + images/icon.svg + images/agl_slide_0.png + + diff --git a/app/wifi/Wifi.qml b/app/wifi/Wifi.qml new file mode 100644 index 0000000..85e8b60 --- /dev/null +++ b/app/wifi/Wifi.qml @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * Copyright (C) 2018 Konsulko Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 +import AGL.Demo.Controls 1.0 +import ".." + +SettingPage { + id: root + icon: '/wifi/images/HMI_Settings_WifiIcon.svg' + title: 'Wifi' + checkable: true + checked: network.wifiEnabled + readonly property bool isWifi: true + + onCheckedChanged: { + network.power(checked) + } + + Component { + id: wifiDevice + MouseArea { + height: 120 + width: ListView.view.width + Image { + anchors.left: parent.left + id: icon + source: { + var svg + if (strength < 30) + svg = "1Bar" + else if (strength < 50) + svg = "2Bars" + else if (strength < 70) + svg = "3Bars" + else + svg = "Full" + if (security === "Open") { + return 'images/HMI_Settings_Wifi_%1.svg'.arg(svg) + } else { + return 'images/HMI_Settings_Wifi_Locked_%1.svg'.arg(svg) + } + } + } + Column { + anchors.left: icon.right + anchors.leftMargin: 5 + Label { + id: networkNameText + text: ssid + color: '#66FF99' + font.pixelSize: 48 + font.bold: sstate === "ready" + || sstate === "online" + } + Label { + visible: sstate === "ready" + || sstate === "online" + text: "connected, " + address + font.pixelSize: 18 + color: "white" + } + } + + onClicked: { + if ((sstate === "ready") || sstate === "online") { + console.log("Disconnecting from ", ssid, " (", service, ")") + networkNameText.font.italic = 1 + network.disconnect(service) + } else { + console.log("Connecting to ", ssid, " (", service, ")") + networkNameText.font.italic = 1 + network.connect(service) + } + } + + Image { + source: '../images/HMI_Settings_DividingLine.svg' + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: -15 + visible: model.index > 0 + } + } + } + + ListView { + id: view + anchors.fill: parent + anchors.margins: 100 + model: WifiNetworkModel + delegate: wifiDevice + clip: true + } + + MouseArea { + id: dialog + anchors.fill: parent + visible: false + z: 1 + onVisibleChanged: { + if (visible) { + password.forceActiveFocus() + } else { + password.text = '' + } + } + + ColumnLayout { + anchors.fill: parent + Item { + Layout.fillWidth: true + Layout.fillHeight: true + Layout.preferredHeight: 1 + Rectangle { + anchors.fill: parent + color: 'black' + opacity: 0.5 + } + RowLayout { + anchors.centerIn: parent + TextField { + id: password + property int reqid: 0 + placeholderText: 'Password' + } + Button { + text: 'Connect' + highlighted: true + onClicked: { + network.input(password.reqid, password.text) + dialog.visible = false + } + } + Button { + text: 'Cancel' + onClicked: dialog.visible = false + } + } + } + + Keyboard { + id: keyboard + Layout.fillWidth: true + Layout.fillHeight: true + Layout.preferredHeight: 1 + target: activeFocusControl + } + } + } + + Connections { + target: network + onInputRequest: { + password.reqid = id + dialog.visible = true + } + } +} diff --git a/app/wifi/images/HMI_Settings_WifiIcon.svg b/app/wifi/images/HMI_Settings_WifiIcon.svg new file mode 100644 index 0000000..4314729 --- /dev/null +++ b/app/wifi/images/HMI_Settings_WifiIcon.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/wifi/images/HMI_Settings_Wifi_1Bar.svg b/app/wifi/images/HMI_Settings_Wifi_1Bar.svg new file mode 100644 index 0000000..e692c69 --- /dev/null +++ b/app/wifi/images/HMI_Settings_Wifi_1Bar.svg @@ -0,0 +1,71 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/wifi/images/HMI_Settings_Wifi_2Bars.svg b/app/wifi/images/HMI_Settings_Wifi_2Bars.svg new file mode 100644 index 0000000..f7cf642 --- /dev/null +++ b/app/wifi/images/HMI_Settings_Wifi_2Bars.svg @@ -0,0 +1,71 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/wifi/images/HMI_Settings_Wifi_3Bars.svg b/app/wifi/images/HMI_Settings_Wifi_3Bars.svg new file mode 100644 index 0000000..8a26f3f --- /dev/null +++ b/app/wifi/images/HMI_Settings_Wifi_3Bars.svg @@ -0,0 +1,71 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/wifi/images/HMI_Settings_Wifi_Full.svg b/app/wifi/images/HMI_Settings_Wifi_Full.svg new file mode 100644 index 0000000..9ad1869 --- /dev/null +++ b/app/wifi/images/HMI_Settings_Wifi_Full.svg @@ -0,0 +1,70 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/wifi/images/HMI_Settings_Wifi_Locked_1Bar.svg b/app/wifi/images/HMI_Settings_Wifi_Locked_1Bar.svg new file mode 100644 index 0000000..5da957f --- /dev/null +++ b/app/wifi/images/HMI_Settings_Wifi_Locked_1Bar.svg @@ -0,0 +1,78 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/wifi/images/HMI_Settings_Wifi_Locked_2Bars.svg b/app/wifi/images/HMI_Settings_Wifi_Locked_2Bars.svg new file mode 100644 index 0000000..7f180aa --- /dev/null +++ b/app/wifi/images/HMI_Settings_Wifi_Locked_2Bars.svg @@ -0,0 +1,78 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/wifi/images/HMI_Settings_Wifi_Locked_3Bars.svg b/app/wifi/images/HMI_Settings_Wifi_Locked_3Bars.svg new file mode 100644 index 0000000..276c758 --- /dev/null +++ b/app/wifi/images/HMI_Settings_Wifi_Locked_3Bars.svg @@ -0,0 +1,78 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/wifi/images/HMI_Settings_Wifi_Locked_Full.svg b/app/wifi/images/HMI_Settings_Wifi_Locked_Full.svg new file mode 100644 index 0000000..9058511 --- /dev/null +++ b/app/wifi/images/HMI_Settings_Wifi_Locked_Full.svg @@ -0,0 +1,77 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/wifi/images/HMI_Settings_Wifi_Locked_NoBars.svg b/app/wifi/images/HMI_Settings_Wifi_Locked_NoBars.svg new file mode 100644 index 0000000..6f389c6 --- /dev/null +++ b/app/wifi/images/HMI_Settings_Wifi_Locked_NoBars.svg @@ -0,0 +1,79 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/wifi/images/HMI_Settings_Wifi_NoBars.svg b/app/wifi/images/HMI_Settings_Wifi_NoBars.svg new file mode 100644 index 0000000..e23fc1d --- /dev/null +++ b/app/wifi/images/HMI_Settings_Wifi_NoBars.svg @@ -0,0 +1,70 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/app/wifi/wifi.qrc b/app/wifi/wifi.qrc new file mode 100644 index 0000000..063088a --- /dev/null +++ b/app/wifi/wifi.qrc @@ -0,0 +1,16 @@ + + + Wifi.qml + images/HMI_Settings_Wifi_1Bar.svg + images/HMI_Settings_Wifi_2Bars.svg + images/HMI_Settings_Wifi_3Bars.svg + images/HMI_Settings_Wifi_Full.svg + images/HMI_Settings_Wifi_Locked_1Bar.svg + images/HMI_Settings_Wifi_Locked_2Bars.svg + images/HMI_Settings_Wifi_Locked_3Bars.svg + images/HMI_Settings_Wifi_Locked_Full.svg + images/HMI_Settings_Wifi_Locked_NoBars.svg + images/HMI_Settings_Wifi_NoBars.svg + images/HMI_Settings_WifiIcon.svg + + -- cgit 1.2.3-korg