From 61bd2e316d55cdd6e3ffc7aa26add03cbafae55c Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Wed, 14 Nov 2018 12:42:39 +0900 Subject: Add hvac for horizontal mode Add hvac for horizontal mode. Change-Id: I41bd23e30f97b0ab148424256271d74ef2247303 Signed-off-by: zheng_wenlong --- demo3/README.md | 2 + demo3/horizontal/hvac/LICENSE | 54 +++ demo3/horizontal/hvac/app/HVAC.qml | 175 ++++++++ demo3/horizontal/hvac/app/HeatDegree.qml | 55 +++ demo3/horizontal/hvac/app/SeatHeatButton.qml | 78 ++++ demo3/horizontal/hvac/app/api/Binding.qml | 93 ++++ demo3/horizontal/hvac/app/api/MessageId.js | 22 + demo3/horizontal/hvac/app/app.pri | 20 + demo3/horizontal/hvac/app/app.pro | 17 + .../config.tests/libhomescreen/libhomescreen.cpp | 8 + .../config.tests/libhomescreen/libhomescreen.pro | 5 + .../qlibwindowmanager/qlibwindowmanager.cpp | 8 + .../qlibwindowmanager/qlibwindowmanager.pro | 5 + demo3/horizontal/hvac/app/hvac.qrc | 9 + .../horizontal/hvac/app/images/HMI_HVAC_Active.svg | 35 ++ .../hvac/app/images/HMI_HVAC_AirDown_Active.svg | 66 +++ .../hvac/app/images/HMI_HVAC_AirDown_Inactive.svg | 69 +++ .../hvac/app/images/HMI_HVAC_AirRight_Active.svg | 69 +++ .../hvac/app/images/HMI_HVAC_AirRight_Inactive.svg | 72 +++ .../hvac/app/images/HMI_HVAC_AirUp_Active.svg | 74 ++++ .../hvac/app/images/HMI_HVAC_AirUp_Inactive.svg | 75 ++++ .../app/images/HMI_HVAC_ChairIndicator_OFF.svg | 76 ++++ .../app/images/HMI_HVAC_ChairIndicator_One.svg | 31 ++ .../app/images/HMI_HVAC_ChairIndicator_Two.svg | 30 ++ .../app/images/HMI_HVAC_Circulation_Active.svg | 87 ++++ .../app/images/HMI_HVAC_Circulation_Inactive.svg | 87 ++++ .../hvac/app/images/HMI_HVAC_Fan_Icon.svg | 46 ++ .../hvac/app/images/HMI_HVAC_Front_Active.svg | 75 ++++ .../hvac/app/images/HMI_HVAC_Front_Inactive.svg | 72 +++ .../hvac/app/images/HMI_HVAC_Inactive.svg | 31 ++ .../hvac/app/images/HMI_HVAC_Left_Chair_OFF.svg | 87 ++++ .../hvac/app/images/HMI_HVAC_Left_Chair_ON.svg | 59 +++ .../hvac/app/images/HMI_HVAC_Rear_Active.svg | 101 +++++ .../hvac/app/images/HMI_HVAC_Rear_Inactive.svg | 91 ++++ .../hvac/app/images/HMI_HVAC_Right_Chair_OFF.svg | 87 ++++ .../hvac/app/images/HMI_HVAC_Right_Chair_ON.svg | 60 +++ demo3/horizontal/hvac/app/images/images.qrc | 26 ++ demo3/horizontal/hvac/app/main.cpp | 115 +++++ demo3/horizontal/hvac/app/translations.pri | 16 + .../horizontal/hvac/app/translations/hvac_fr_FR.ts | 53 +++ .../horizontal/hvac/app/translations/hvac_ja_JP.ts | 53 +++ demo3/horizontal/hvac/app/translator.cpp | 52 +++ demo3/horizontal/hvac/app/translator.h | 32 ++ demo3/horizontal/hvac/hvac.json | 7 + demo3/horizontal/hvac/hvac.pro | 3 + demo3/horizontal/hvac/package/config.xml | 18 + demo3/horizontal/hvac/package/icon.svg | 489 +++++++++++++++++++++ demo3/horizontal/hvac/package/package.pro | 19 + demo3/horizontal/hvac/screenshot/hvac.png | Bin 0 -> 249641 bytes 49 files changed, 2914 insertions(+) create mode 100644 demo3/horizontal/hvac/LICENSE create mode 100644 demo3/horizontal/hvac/app/HVAC.qml create mode 100644 demo3/horizontal/hvac/app/HeatDegree.qml create mode 100644 demo3/horizontal/hvac/app/SeatHeatButton.qml create mode 100644 demo3/horizontal/hvac/app/api/Binding.qml create mode 100644 demo3/horizontal/hvac/app/api/MessageId.js create mode 100644 demo3/horizontal/hvac/app/app.pri create mode 100644 demo3/horizontal/hvac/app/app.pro create mode 100644 demo3/horizontal/hvac/app/config.tests/libhomescreen/libhomescreen.cpp create mode 100644 demo3/horizontal/hvac/app/config.tests/libhomescreen/libhomescreen.pro create mode 100644 demo3/horizontal/hvac/app/config.tests/qlibwindowmanager/qlibwindowmanager.cpp create mode 100644 demo3/horizontal/hvac/app/config.tests/qlibwindowmanager/qlibwindowmanager.pro create mode 100644 demo3/horizontal/hvac/app/hvac.qrc create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Active.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_AirDown_Active.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_AirDown_Inactive.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_AirRight_Active.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_AirRight_Inactive.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_AirUp_Active.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_AirUp_Inactive.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_OFF.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_One.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_Two.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Circulation_Active.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Circulation_Inactive.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Fan_Icon.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Front_Active.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Front_Inactive.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Inactive.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Left_Chair_OFF.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Left_Chair_ON.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Rear_Active.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Rear_Inactive.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Right_Chair_OFF.svg create mode 100644 demo3/horizontal/hvac/app/images/HMI_HVAC_Right_Chair_ON.svg create mode 100644 demo3/horizontal/hvac/app/images/images.qrc create mode 100644 demo3/horizontal/hvac/app/main.cpp create mode 100644 demo3/horizontal/hvac/app/translations.pri create mode 100644 demo3/horizontal/hvac/app/translations/hvac_fr_FR.ts create mode 100644 demo3/horizontal/hvac/app/translations/hvac_ja_JP.ts create mode 100644 demo3/horizontal/hvac/app/translator.cpp create mode 100644 demo3/horizontal/hvac/app/translator.h create mode 100644 demo3/horizontal/hvac/hvac.json create mode 100644 demo3/horizontal/hvac/hvac.pro create mode 100644 demo3/horizontal/hvac/package/config.xml create mode 100644 demo3/horizontal/hvac/package/icon.svg create mode 100644 demo3/horizontal/hvac/package/package.pro create mode 100644 demo3/horizontal/hvac/screenshot/hvac.png diff --git a/demo3/README.md b/demo3/README.md index fafaf2c..2fd8886 100644 --- a/demo3/README.md +++ b/demo3/README.md @@ -8,6 +8,8 @@
sandbox branch : [ces2019_horizontal](https://gerrit.automotivelinux.org/gerrit/gitweb?p=apps%2Flauncher.git;a=shortlog;h=refs%2Fheads%2Fsandbox%2Fzheng_wenlong%2Fces2019_horizontal) - dashboard
sandbox branch : [ces2019_horizontal](https://gerrit.automotivelinux.org/gerrit/gitweb?p=apps%2Fdashboard.git;a=shortlog;h=refs%2Fheads%2Fsandbox%2Fzheng_wenlong%2Fces2019_horizontal) +- hvac +
sandbox branch : [ces2019_horizontal](https://gerrit.automotivelinux.org/gerrit/gitweb?p=apps%2Fhvac.git;a=shortlog;h=refs%2Fheads%2Fsandbox%2Fzheng_wenlong%2Fces2019_horizontal) - ... ## vertical (IVI mode) - homescreen diff --git a/demo3/horizontal/hvac/LICENSE b/demo3/horizontal/hvac/LICENSE new file mode 100644 index 0000000..31c692a --- /dev/null +++ b/demo3/horizontal/hvac/LICENSE @@ -0,0 +1,54 @@ +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + You must give any other recipients of the Work or Derivative Works a copy of this License; and + You must cause any modified files to carry prominent notices stating that You changed the files; and + You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/demo3/horizontal/hvac/app/HVAC.qml b/demo3/horizontal/hvac/app/HVAC.qml new file mode 100644 index 0000000..317ef70 --- /dev/null +++ b/demo3/horizontal/hvac/app/HVAC.qml @@ -0,0 +1,175 @@ +/* + * 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 Translator 1.0 +import 'api' as API + +ApplicationWindow { + id: root + + width: container.width * container.scale + height: container.height * container.scale + + Translator { + id: translator + language: binding.language + } + + API.Binding { + id: binding + url: bindingAddress + onFanSpeedChanged: fanSpeedSlider.value = fanSpeed + onLanguageChanged: translator.language = language + } + + Item { + id: container +// anchors.centerIn: parent + x: 555 + y: -465 + width: 720 + height: 1920 + rotation: -90 + scale: screenInfo.scale_factor() + + ColumnLayout { + anchors.fill: parent + anchors.topMargin: width / 10 + anchors.bottomMargin: width / 10 + + RowLayout { + Layout.fillHeight: true + Layout.alignment: Qt.AlignHCenter + Image { + source: './images/HMI_HVAC_Fan_Icon.svg' + } + Item { + width: container.width * 0.8 + Slider { + id: fanSpeedSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + from: 0.0 + to: 255.0 + stepSize: 1.0 + onValueChanged: { + binding.fanSpeed = value + } + } + Label { + anchors.left: fanSpeedSlider.left + anchors.top: fanSpeedSlider.bottom + font.pixelSize: 32 + text: translator.translate(qsTr('FAN SPEED'), translator.language) + } + } + } + RowLayout { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter + rotation: 90 + spacing: 20 + ColumnLayout { + Layout.fillWidth: true + spacing: 20 + SeatHeatButton { + id: leftSeat + side: 'Left' + } + HeatDegree { + onCurrentItemChanged: { + console.log("Left Temp changed",degree) + binding.leftTemperature = degree + } + } + } + ColumnLayout { + Layout.fillWidth: true + spacing: 20 + ToggleButton { + onImage: './images/HMI_HVAC_Active.svg' + offImage: './images/HMI_HVAC_Inactive.svg' + Label { + anchors.centerIn: parent + color: parent.checked ? '#00ADDC' : '#848286' + text: translator.translate(qsTr('A/C'), translator.language) + font.pixelSize: parent.height / 3 + } + onCheckedChanged: { + console.debug('A/C', checked) + } + } + ToggleButton { + onImage: './images/HMI_HVAC_Active.svg' + offImage: './images/HMI_HVAC_Inactive.svg' + Label { + anchors.centerIn: parent + color: parent.checked ? '#00ADDC' : '#848286' + text: translator.translate(qsTr('AUTO'), translator.language) + font.pixelSize: parent.height / 3 + } + onCheckedChanged: { + console.debug('AUTO', checked) + } + } + ToggleButton { + onImage: './images/HMI_HVAC_Circulation_Active.svg' + offImage: './images/HMI_HVAC_Circulation_Inactive.svg' + onCheckedChanged: { + console.debug('Circulation', checked) + } + } + } + + ColumnLayout { + Layout.fillWidth: true + spacing: 20 + SeatHeatButton { + id: rightSeat + side: 'Right' + } + HeatDegree { + onCurrentItemChanged: { + console.log("Right Temp changed",degree) + binding.rightTemperature = degree + } + } + } + } + RowLayout { + Layout.fillHeight: true + Layout.alignment: Qt.AlignHCenter + Repeater { + model: ['AirDown', 'AirUp', 'AirRight', 'Rear', 'Front'] + ToggleButton { + onImage: './images/HMI_HVAC_%1_Active.svg'.arg(model.modelData) + offImage: './images/HMI_HVAC_%1_Inactive.svg'.arg(model.modelData) + rotation: 90 + onCheckedChanged: { + console.debug(model.modelData, checked) + } + } + } + } + } +} +} diff --git a/demo3/horizontal/hvac/app/HeatDegree.qml b/demo3/horizontal/hvac/app/HeatDegree.qml new file mode 100644 index 0000000..a9bc83c --- /dev/null +++ b/demo3/horizontal/hvac/app/HeatDegree.qml @@ -0,0 +1,55 @@ +/* + * 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.Controls 2.0 + +ListView { + id: root + clip: true + width: 318 + height: 219 * 2 + 20 + spacing: 20 + opacity: enabled ? 1 : 0.5 + + property int degree: currentIndex > -1 ? model.get(currentIndex).value : -1 + model: ListModel { + Component.onCompleted: { + append({value: 15, modelData: translator.translate(qsTr('LO'), translator.language)}) + for (var d = 16; d < 30; d++) { + append({value: d, modelData: translator.translate(qsTr('%1\u00b0'), translator.language).arg(d.toFixed(0))}) + } + append({value: 30, modelData: translator.translate(qsTr('HI'), translator.language)}) + } + } + delegate: Label { + width: ListView.view.width + height: 219 + horizontalAlignment: Label.AlignHCenter + verticalAlignment: Label.AlignVCenter + text: model.modelData + font.pixelSize: height * 0.7 + color: (ListView.view.enabled && ListView.isCurrentItem) ? '#00ADDC' : 'white' + } + + preferredHighlightBegin: 0.5 + preferredHighlightEnd: 0.5 + highlightRangeMode: ListView.StrictlyEnforceRange + highlight: Rectangle { + color: 'white' + opacity: 0.2 + } +} diff --git a/demo3/horizontal/hvac/app/SeatHeatButton.qml b/demo3/horizontal/hvac/app/SeatHeatButton.qml new file mode 100644 index 0000000..3495cf6 --- /dev/null +++ b/demo3/horizontal/hvac/app/SeatHeatButton.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 AGL.Demo.Controls 1.0 + + +Item { + id: root + implicitWidth: 318 + implicitHeight: 219 + + property string side: 'Left' + property int headLevel: 0 + + Column { + id: background + anchors.centerIn: parent + Image { + id: chair + source: './images/HMI_HVAC_%1_Chair_OFF.svg'.arg(root.side) + states: [ + State { + when: root.headLevel > 0 + PropertyChanges { + target: chair + source: './images/HMI_HVAC_%1_Chair_ON.svg'.arg(root.side) + } + } + ] + } + Image { + id: indicator + width: 178 + height: 18 + source: './images/HMI_HVAC_ChairIndicator_OFF.svg' + states: [ + State { + when: root.headLevel === 1 + PropertyChanges { + target: indicator + source: './images/HMI_HVAC_ChairIndicator_One.svg' + } + }, + State { + when: root.headLevel === 2 + PropertyChanges { + target: indicator + source: './images/HMI_HVAC_ChairIndicator_Two.svg' + } + } + ] + } + + } + + MouseArea { + anchors.fill: parent + onClicked: { + root.headLevel = (root.headLevel + 1) % 3 + } + } +} diff --git a/demo3/horizontal/hvac/app/api/Binding.qml b/demo3/horizontal/hvac/app/api/Binding.qml new file mode 100644 index 0000000..2d88087 --- /dev/null +++ b/demo3/horizontal/hvac/app/api/Binding.qml @@ -0,0 +1,93 @@ +/* + * 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 QtWebSockets 1.0 +import 'MessageId.js' as MessageId + +WebSocket { + id: root + active: true + + property string statusString: "waiting..." + + property real fanSpeed: 0.0 + property real leftTemperature: 21.0 + property real rightTemperature: 21.0 + property string language: "en_US" + + property Connections c : Connections { + target: root + onFanSpeedChanged: { + var json = [MessageId.call, '9999', 'hvac/set', {'FanSpeed': fanSpeed}] + console.debug(JSON.stringify(json)) + sendTextMessage(JSON.stringify(json)) + } + onLeftTemperatureChanged: { + var json = [MessageId.call, '9999', 'hvac/set', {'LeftTemperature': leftTemperature}] + console.debug(JSON.stringify(json)) + sendTextMessage(JSON.stringify(json)) + + var json1 = [MessageId.call, '9999', 'hvac/temp_left_zone_led', {'LeftLed': leftTemperature}] + console.debug(JSON.stringify(json1)) + sendTextMessage(JSON.stringify(json1)) + } + onRightTemperatureChanged: { + var json = [MessageId.call, '9999', 'hvac/set', {'RightTemperature': rightTemperature}] + console.debug(JSON.stringify(json)) + sendTextMessage(JSON.stringify(json)) + + var json1 = [MessageId.call, '9999', 'hvac/temp_right_zone_led', {'RightLed': rightTemperature}] + console.debug(JSON.stringify(json1)) + sendTextMessage(JSON.stringify(json1)) + } + onLanguageChanged: { + var json = [MessageId.call, '9999', 'hvac/set', {'Language': language}] + console.debug(JSON.stringify(json)) + sendTextMessage(JSON.stringify(json)) + } + } + + onTextMessageReceived: { + var json = JSON.parse(message) + var request = json[2].request + var response = json[2].response + console.log("HVAC Binding Message: ",message) + switch (json[0]) { + case MessageId.call: + break + case MessageId.retok: + root.statusString = request.status + break + case MessageId.reterr: + root.statusString = "Bad return value, binding probably not installed" + break + case MessageId.event: + if (json[1] == "hvac/language") + console.log("HVAC event received: ",json[2]) + root.language = json[2].data + root.statusString = "Language changed to "+language + break + } + } + onStatusChanged: { + switch (status) { + case WebSocket.Error: + root.statusString = "WebSocket error: " + root.errorString + break + } + } +} diff --git a/demo3/horizontal/hvac/app/api/MessageId.js b/demo3/horizontal/hvac/app/api/MessageId.js new file mode 100644 index 0000000..001ea93 --- /dev/null +++ b/demo3/horizontal/hvac/app/api/MessageId.js @@ -0,0 +1,22 @@ +/* + * 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. + */ + +.pragma library + +var call = 2 +var retok = 3 +var reterr = 4 +var event = 5 diff --git a/demo3/horizontal/hvac/app/app.pri b/demo3/horizontal/hvac/app/app.pri new file mode 100644 index 0000000..590c154 --- /dev/null +++ b/demo3/horizontal/hvac/app/app.pri @@ -0,0 +1,20 @@ +TEMPLATE = app + +load(configure) + +qtCompileTest(libhomescreen) +qtCompileTest(qlibwindowmanager) + +config_libhomescreen { + CONFIG += link_pkgconfig + PKGCONFIG += libhomescreen + DEFINES += HAVE_LIBHOMESCREEN +} + +config_qlibwindowmanager { + CONFIG += link_pkgconfig + PKGCONFIG += qlibwindowmanager + DEFINES += HAVE_QLIBWINDOWMANAGER +} + +DESTDIR = $${OUT_PWD}/../package/root/bin diff --git a/demo3/horizontal/hvac/app/app.pro b/demo3/horizontal/hvac/app/app.pro new file mode 100644 index 0000000..edd08aa --- /dev/null +++ b/demo3/horizontal/hvac/app/app.pro @@ -0,0 +1,17 @@ +TARGET = hvac +QT = quick qml + +HEADERS += \ + translator.h + +SOURCES = main.cpp \ + translator.cpp + +RESOURCES += \ + hvac.qrc \ + images/images.qrc + +include(app.pri) + +LANGUAGES = ja_JP fr_FR +include(translations.pri) diff --git a/demo3/horizontal/hvac/app/config.tests/libhomescreen/libhomescreen.cpp b/demo3/horizontal/hvac/app/config.tests/libhomescreen/libhomescreen.cpp new file mode 100644 index 0000000..d698b05 --- /dev/null +++ b/demo3/horizontal/hvac/app/config.tests/libhomescreen/libhomescreen.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc,char **argv) +{ + LibHomeScreen libHomeScreen; + return 0; +} + diff --git a/demo3/horizontal/hvac/app/config.tests/libhomescreen/libhomescreen.pro b/demo3/horizontal/hvac/app/config.tests/libhomescreen/libhomescreen.pro new file mode 100644 index 0000000..7d43112 --- /dev/null +++ b/demo3/horizontal/hvac/app/config.tests/libhomescreen/libhomescreen.pro @@ -0,0 +1,5 @@ +SOURCES = libhomescreen.cpp + +CONFIG -= qt +CONFIG += link_pkgconfig +PKGCONFIG += libhomescreen diff --git a/demo3/horizontal/hvac/app/config.tests/qlibwindowmanager/qlibwindowmanager.cpp b/demo3/horizontal/hvac/app/config.tests/qlibwindowmanager/qlibwindowmanager.cpp new file mode 100644 index 0000000..bb95c93 --- /dev/null +++ b/demo3/horizontal/hvac/app/config.tests/qlibwindowmanager/qlibwindowmanager.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc,char **argv) +{ + QLibWindowmanager qwm; + return 0; +} + diff --git a/demo3/horizontal/hvac/app/config.tests/qlibwindowmanager/qlibwindowmanager.pro b/demo3/horizontal/hvac/app/config.tests/qlibwindowmanager/qlibwindowmanager.pro new file mode 100644 index 0000000..cb51d98 --- /dev/null +++ b/demo3/horizontal/hvac/app/config.tests/qlibwindowmanager/qlibwindowmanager.pro @@ -0,0 +1,5 @@ +SOURCES = qlibwindowmanager.cpp + +CONFIG += qt +CONFIG += link_pkgconfig +PKGCONFIG += qlibwindowmanager diff --git a/demo3/horizontal/hvac/app/hvac.qrc b/demo3/horizontal/hvac/app/hvac.qrc new file mode 100644 index 0000000..6327049 --- /dev/null +++ b/demo3/horizontal/hvac/app/hvac.qrc @@ -0,0 +1,9 @@ + + + HVAC.qml + SeatHeatButton.qml + HeatDegree.qml + api/Binding.qml + api/MessageId.js + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Active.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Active.svg new file mode 100644 index 0000000..71e6aa0 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Active.svg @@ -0,0 +1,35 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_AirDown_Active.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirDown_Active.svg new file mode 100644 index 0000000..85dd533 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirDown_Active.svg @@ -0,0 +1,66 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_AirDown_Inactive.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirDown_Inactive.svg new file mode 100644 index 0000000..a013f4b --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirDown_Inactive.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_AirRight_Active.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirRight_Active.svg new file mode 100644 index 0000000..cfb9452 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirRight_Active.svg @@ -0,0 +1,69 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_AirRight_Inactive.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirRight_Inactive.svg new file mode 100644 index 0000000..991a773 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirRight_Inactive.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_AirUp_Active.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirUp_Active.svg new file mode 100644 index 0000000..f168a39 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirUp_Active.svg @@ -0,0 +1,74 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_AirUp_Inactive.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirUp_Inactive.svg new file mode 100644 index 0000000..39e1fa1 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_AirUp_Inactive.svg @@ -0,0 +1,75 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_OFF.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_OFF.svg new file mode 100644 index 0000000..1fcd17f --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_OFF.svg @@ -0,0 +1,76 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_One.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_One.svg new file mode 100644 index 0000000..d560c84 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_One.svg @@ -0,0 +1,31 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_Two.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_Two.svg new file mode 100644 index 0000000..b31cc90 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_ChairIndicator_Two.svg @@ -0,0 +1,30 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Circulation_Active.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Circulation_Active.svg new file mode 100644 index 0000000..def92bb --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Circulation_Active.svg @@ -0,0 +1,87 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Circulation_Inactive.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Circulation_Inactive.svg new file mode 100644 index 0000000..9c7d43f --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Circulation_Inactive.svg @@ -0,0 +1,87 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Fan_Icon.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Fan_Icon.svg new file mode 100644 index 0000000..ee583a0 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Fan_Icon.svg @@ -0,0 +1,46 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Front_Active.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Front_Active.svg new file mode 100644 index 0000000..146e509 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Front_Active.svg @@ -0,0 +1,75 @@ + + + + + + + + + + +]> + + + + + + + FRONT + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Front_Inactive.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Front_Inactive.svg new file mode 100644 index 0000000..c5d9166 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Front_Inactive.svg @@ -0,0 +1,72 @@ + + + +image/svg+xmlFRONT + \ No newline at end of file diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Inactive.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Inactive.svg new file mode 100644 index 0000000..2956a26 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Inactive.svg @@ -0,0 +1,31 @@ + + + + + + + + + + +]> + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Left_Chair_OFF.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Left_Chair_OFF.svg new file mode 100644 index 0000000..1412266 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Left_Chair_OFF.svg @@ -0,0 +1,87 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Left_Chair_ON.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Left_Chair_ON.svg new file mode 100644 index 0000000..b27b126 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Left_Chair_ON.svg @@ -0,0 +1,59 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Rear_Active.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Rear_Active.svg new file mode 100644 index 0000000..182ccbd --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Rear_Active.svg @@ -0,0 +1,101 @@ + + + + + + + + + + +]> + + + + + + REAR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Rear_Inactive.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Rear_Inactive.svg new file mode 100644 index 0000000..574c541 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Rear_Inactive.svg @@ -0,0 +1,91 @@ + + + +image/svg+xmlREAR + \ No newline at end of file diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Right_Chair_OFF.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Right_Chair_OFF.svg new file mode 100644 index 0000000..711a942 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Right_Chair_OFF.svg @@ -0,0 +1,87 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/demo3/horizontal/hvac/app/images/HMI_HVAC_Right_Chair_ON.svg b/demo3/horizontal/hvac/app/images/HMI_HVAC_Right_Chair_ON.svg new file mode 100644 index 0000000..74b4861 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/HMI_HVAC_Right_Chair_ON.svg @@ -0,0 +1,60 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo3/horizontal/hvac/app/images/images.qrc b/demo3/horizontal/hvac/app/images/images.qrc new file mode 100644 index 0000000..036c1f5 --- /dev/null +++ b/demo3/horizontal/hvac/app/images/images.qrc @@ -0,0 +1,26 @@ + + + HMI_HVAC_AirDown_Active.svg + HMI_HVAC_AirDown_Inactive.svg + HMI_HVAC_AirRight_Active.svg + HMI_HVAC_AirRight_Inactive.svg + HMI_HVAC_AirUp_Active.svg + HMI_HVAC_AirUp_Inactive.svg + HMI_HVAC_ChairIndicator_OFF.svg + HMI_HVAC_ChairIndicator_One.svg + HMI_HVAC_ChairIndicator_Two.svg + HMI_HVAC_Circulation_Active.svg + HMI_HVAC_Circulation_Inactive.svg + HMI_HVAC_Fan_Icon.svg + HMI_HVAC_Front_Active.svg + HMI_HVAC_Front_Inactive.svg + HMI_HVAC_Left_Chair_OFF.svg + HMI_HVAC_Left_Chair_ON.svg + HMI_HVAC_Rear_Active.svg + HMI_HVAC_Rear_Inactive.svg + HMI_HVAC_Right_Chair_OFF.svg + HMI_HVAC_Right_Chair_ON.svg + HMI_HVAC_Active.svg + HMI_HVAC_Inactive.svg + + diff --git a/demo3/horizontal/hvac/app/main.cpp b/demo3/horizontal/hvac/app/main.cpp new file mode 100644 index 0000000..162af79 --- /dev/null +++ b/demo3/horizontal/hvac/app/main.cpp @@ -0,0 +1,115 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "translator.h" + +#ifdef HAVE_LIBHOMESCREEN +#include +#endif +#ifdef HAVE_QLIBWINDOWMANAGER +#include +#endif + +int main(int argc, char *argv[]) +{ + QString myname = QString("HVAC"); + + QGuiApplication app(argc, argv); + app.setApplicationVersion(QStringLiteral("0.1.0")); + app.setOrganizationDomain(QStringLiteral("automotivelinux.org")); + app.setOrganizationName(QStringLiteral("AutomotiveGradeLinux")); + + 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(); + + qmlRegisterType("Translator", 1, 0, "Translator"); + + QQmlApplicationEngine engine; + QQmlContext *context = engine.rootContext(); + QUrl bindingAddress; + + int port; + QString secret; + if (positionalArguments.length() == 2) { + port = positionalArguments.takeFirst().toInt(); + secret = positionalArguments.takeFirst(); + bindingAddress.setScheme(QStringLiteral("ws")); + bindingAddress.setHost(QStringLiteral("localhost")); + bindingAddress.setPort(port); + bindingAddress.setPath(QStringLiteral("/api")); + QUrlQuery query; + query.addQueryItem(QStringLiteral("token"), secret); + bindingAddress.setQuery(query); + } + context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress); +#ifdef HAVE_QLIBWINDOWMANAGER + QLibWindowmanager* qwm = new QLibWindowmanager(); + + // WindowManager + if(qwm->init(port,secret) != 0){ + exit(EXIT_FAILURE); + } + AGLScreenInfo screenInfo(qwm->get_scale_factor()); + engine.rootContext()->setContextProperty(QStringLiteral("screenInfo"), &screenInfo); + // Request a surface as described in layers.json windowmanager’s file + if (qwm->requestSurface(myname) != 0) { + exit(EXIT_FAILURE); + } + // Create an event callbnewack 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); + }); +#endif + +#ifdef HAVE_LIBHOMESCREEN + LibHomeScreen* hs = new LibHomeScreen(); + + // HomeScreen + std::string token = secret.toStdString(); + 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); + }); +#endif + + engine.load(QUrl(QStringLiteral("qrc:/HVAC.qml"))); + QObject *root = engine.rootObjects().first(); + QQuickWindow *window = qobject_cast(root); +#ifdef HAVE_QLIBWINDOWMANAGER + QObject::connect(window, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateSurface())); +#else + window->resize(1920, 720); + window->setVisible(true); +#endif + + return app.exec(); +} + diff --git a/demo3/horizontal/hvac/app/translations.pri b/demo3/horizontal/hvac/app/translations.pri new file mode 100644 index 0000000..81bd94b --- /dev/null +++ b/demo3/horizontal/hvac/app/translations.pri @@ -0,0 +1,16 @@ +defineReplace(prependAll) { + for(a,$$1):result += $$2$${a}$$3 + return($$result) +} + +qtPrepareTool(QMAKE_LRELEASE, lrelease) +TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/translations/$${TARGET}_,.ts) + +qm.depends = $${TRANSLATIONS} +qm.input = TRANSLATIONS +qm.output = $$OUT_PWD/../package/root/translations/${QMAKE_FILE_BASE}.qm +qm.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT} +qm.name = LRELEASE ${QMAKE_FILE_IN} +qm.CONFIG += no_link +QMAKE_EXTRA_COMPILERS += qm +PRE_TARGETDEPS += compiler_qm_make_all diff --git a/demo3/horizontal/hvac/app/translations/hvac_fr_FR.ts b/demo3/horizontal/hvac/app/translations/hvac_fr_FR.ts new file mode 100644 index 0000000..241a6f9 --- /dev/null +++ b/demo3/horizontal/hvac/app/translations/hvac_fr_FR.ts @@ -0,0 +1,53 @@ + + + + + HVAC + + + FAN SPEED + Vitesse de ventilation + + + + A/C + + + + + AUTO + + + + + HeatDegree + + + LO + BAS + + + + %1° + + + + + HI + HAU + + + + main + + + port for binding + Port du binding + + + + secret for binding + Token de sécurité du binding + + + diff --git a/demo3/horizontal/hvac/app/translations/hvac_ja_JP.ts b/demo3/horizontal/hvac/app/translations/hvac_ja_JP.ts new file mode 100644 index 0000000..a3a78a8 --- /dev/null +++ b/demo3/horizontal/hvac/app/translations/hvac_ja_JP.ts @@ -0,0 +1,53 @@ + + + + + HVAC + + + FAN SPEED + ファンの回転数 + + + + A/C + + + + + AUTO + + + + + HeatDegree + + + LO + + + + + %1° + + + + + HI + + + + + main + + + port for binding + binding 用のポート + + + + secret for binding + binding 用の secret + + + diff --git a/demo3/horizontal/hvac/app/translator.cpp b/demo3/horizontal/hvac/app/translator.cpp new file mode 100644 index 0000000..9b67f13 --- /dev/null +++ b/demo3/horizontal/hvac/app/translator.cpp @@ -0,0 +1,52 @@ +#include "translator.h" + +#include +#include +#include +#include +#include + +Translator::Translator(QObject *parent) + : QObject(parent) + , m_language(QStringLiteral("C")) + , m_translator(nullptr) +{ +} + +QString Translator::translate(const QString &string, const QString &language) const +{ + Q_UNUSED(language) + return string; +} + +QString Translator::language() const +{ + return m_language; +} + +void Translator::setLanguage(const QString &language) +{ + if (m_language == language) return; + m_language = language; + setTranslator(language); + emit languageChanged(language); +} + +void Translator::setTranslator(const QString &language) +{ + if (m_translator) { + QCoreApplication::removeTranslator(m_translator); + } else { + m_translator = new QTranslator(this); + } + QLocale locale(language); + QString fileName = QCoreApplication::instance()->applicationName().toLower(); + qDebug() << "####" << QDir::currentPath() << QCoreApplication::applicationDirPath(); + if (m_translator->load(locale, fileName, QStringLiteral("_"), QStringLiteral("%1/../translations").arg(QCoreApplication::applicationDirPath()))) { + QCoreApplication::installTranslator(m_translator); + } else { + delete m_translator; + m_translator = nullptr; + } +} + diff --git a/demo3/horizontal/hvac/app/translator.h b/demo3/horizontal/hvac/app/translator.h new file mode 100644 index 0000000..82c5872 --- /dev/null +++ b/demo3/horizontal/hvac/app/translator.h @@ -0,0 +1,32 @@ +#ifndef TRANSLATOR_H +#define TRANSLATOR_H + +#include + +class QTranslator; + +class Translator : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged) +public: + explicit Translator(QObject *parent = nullptr); + + QString language() const; + + Q_INVOKABLE QString translate(const QString &string, const QString &language) const; +public slots: + void setLanguage(const QString &language); + +signals: + void languageChanged(const QString &language); + +private slots: + void setTranslator(const QString &language); + +private: + QString m_language; + QTranslator *m_translator; +}; + +#endif // TRANSLATOR_H diff --git a/demo3/horizontal/hvac/hvac.json b/demo3/horizontal/hvac/hvac.json new file mode 100644 index 0000000..6e7d0db --- /dev/null +++ b/demo3/horizontal/hvac/hvac.json @@ -0,0 +1,7 @@ +{ + "ledtemp": { + "red": "/sys/class/leds/blinkm-3-9-red/brightness", + "green": "/sys/class/leds/blinkm-3-9-green/brightness", + "blue": "/sys/class/leds/blinkm-3-9-blue/brightness" + } +} \ No newline at end of file diff --git a/demo3/horizontal/hvac/hvac.pro b/demo3/horizontal/hvac/hvac.pro new file mode 100644 index 0000000..579a952 --- /dev/null +++ b/demo3/horizontal/hvac/hvac.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS = app package +package.depends += app diff --git a/demo3/horizontal/hvac/package/config.xml b/demo3/horizontal/hvac/package/config.xml new file mode 100644 index 0000000..d83175d --- /dev/null +++ b/demo3/horizontal/hvac/package/config.xml @@ -0,0 +1,18 @@ + + + HVAC + + + This is a demo application used to control and dialog with HVAC system + Romain Forlot <romain.forlot@iot.bzh> + APL 2.0 + + + + + + + + + + diff --git a/demo3/horizontal/hvac/package/icon.svg b/demo3/horizontal/hvac/package/icon.svg new file mode 100644 index 0000000..411d130 --- /dev/null +++ b/demo3/horizontal/hvac/package/icon.svg @@ -0,0 +1,489 @@ + + + +image/svg+xmlHVAC + \ No newline at end of file diff --git a/demo3/horizontal/hvac/package/package.pro b/demo3/horizontal/hvac/package/package.pro new file mode 100644 index 0000000..7f2103c --- /dev/null +++ b/demo3/horizontal/hvac/package/package.pro @@ -0,0 +1,19 @@ + +DISTFILES = icon.svg config.xml + +copy_icon.target = $$OUT_PWD/root/icon.svg +copy_icon.depends = $$_PRO_FILE_PWD_/icon.svg +copy_icon.commands = $(COPY_FILE) \"$$replace(copy_icon.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_icon.target, /, $$QMAKE_DIR_SEP)\" +QMAKE_EXTRA_TARGETS += copy_icon +PRE_TARGETDEPS += $$copy_icon.target + +copy_config.target = $$OUT_PWD/root/config.xml +copy_config.depends = $$_PRO_FILE_PWD_/config.xml +copy_config.commands = $(COPY_FILE) \"$$replace(copy_config.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_config.target, /, $$QMAKE_DIR_SEP)\" +QMAKE_EXTRA_TARGETS += copy_config +PRE_TARGETDEPS += $$copy_config.target + +wgt.target = package +wgt.commands = wgtpkg-pack -f -o hvac.wgt root + +QMAKE_EXTRA_TARGETS += wgt diff --git a/demo3/horizontal/hvac/screenshot/hvac.png b/demo3/horizontal/hvac/screenshot/hvac.png new file mode 100644 index 0000000..fb9b3e5 Binary files /dev/null and b/demo3/horizontal/hvac/screenshot/hvac.png differ -- cgit 1.2.3-korg