From 22cdfdd27aaa885ac5b7b450c8fb82b87853250d Mon Sep 17 00:00:00 2001 From: Andrew O'Doherty Date: Fri, 27 Apr 2018 12:37:48 +0200 Subject: add 3d alexa knx demo The knx-demo directory needs to be divided into two sub-directories containing the alexa 3D demo and the 2d demo. Very large files used by the 3d demo are stored in https://git-lfs.qt.io/Gerrit/boot2qt-demos.git Change-Id: I55e4210e93fc9e017d85e163f13c0b04de96cff0 Reviewed-by: Karsten Heimrich --- .../3d-Alexa-knx-demo/qml/HomeAutom/HomeView.qml | 401 +++++++++++++++++++++ .../qml/HomeAutom/LightSlider.qml | 73 ++++ .../qml/HomeAutom/LightSwitch.qml | 122 +++++++ .../3d-Alexa-knx-demo/qml/HomeAutom/MainMenu.qml | 80 ++++ .../3d-Alexa-knx-demo/qml/HomeAutom/RoomLabel.qml | 88 +++++ .../qml/HomeAutom/SliderControl.qml | 150 ++++++++ .../qml/HomeAutom/SplashScreen.qml | 62 ++++ .../3d-Alexa-knx-demo/qml/HomeAutom/TempSlider.qml | 113 ++++++ .../3d-Alexa-knx-demo/qml/HomeAutom/main.qml | 106 ++++++ .../3d-Alexa-knx-demo/qml/images/QtSymbol.png | 3 + .../3d-Alexa-knx-demo/qml/images/icon_light.png | 3 + .../3d-Alexa-knx-demo/qml/images/icon_temp.png | 3 + .../3d-Alexa-knx-demo/qml/imports/Style/Style.qml | 68 ++++ .../3d-Alexa-knx-demo/qml/imports/Style/qmldir | 2 + 14 files changed, 1274 insertions(+) create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/HomeView.qml create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/LightSlider.qml create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/LightSwitch.qml create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/MainMenu.qml create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/RoomLabel.qml create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/SliderControl.qml create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/SplashScreen.qml create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/TempSlider.qml create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/main.qml create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/QtSymbol.png create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/icon_light.png create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/icon_temp.png create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/imports/Style/Style.qml create mode 100644 tradeshow/knx-demo/3d-Alexa-knx-demo/qml/imports/Style/qmldir (limited to 'tradeshow/knx-demo/3d-Alexa-knx-demo/qml') diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/HomeView.qml b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/HomeView.qml new file mode 100644 index 0000000..2dd9dd7 --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/HomeView.qml @@ -0,0 +1,401 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio Demos. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 +import QtQuick.Controls 2.3 +import QtStudio3D 1.0 + +Item { + id: home + + property real red: 0 + property real blue: 255 + property real green: 0 + property real light: 0 + + property string currentTempAttribute: "" + property string currentLightAttribute: "" + + Timer { + id: goToHomeTimer + interval: 30000 + running: false + repeat: false + + onTriggered: presentation.goToSlide("Scene", "BackToInitialView") + } + + Timer { + id: showMenuTimer + interval: 1000 + running: false + repeat: false + + onTriggered: mainMenu.visible = true + } + + signal studio3DPresentationReady() + + function getRoomName(index) { + var name; + if (index === 0) + name = "BackToInitialView" + else if (index === 1) + name = "Livingroom" + else if (index === 2) + name = "Masterbedroom" + else if (index === 3) + name = "Bedroom" + else if (index === 4) + name = "Bathroom" + return name + } + + // + // Qt 3D Studio presentation + // + Studio3D { + anchors.fill: parent + + ViewerSettings { + scaleMode: ViewerSettings.ScaleModeFill + } + + Presentation { + id: presentation + source: "qrc:/uip/houseStudio.uip" + + SceneElement { + id: scene + elementPath: "Scene" + onCurrentSlideNameChanged: { + var lightNum = 0 + var startTimer = false; + if (currentSlideName === "Livingroom") { + currentTempAttribute = "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_LivingRoom.HeatAreas_Heat_LivingRoom.Heat_LivingRoomSG" + currentLightAttribute = "Scene.3D.RoomLights.LivingroomLightMap.House" + livingRoomHeat.goToTime(2) + masterBedroomHeat.goToTime(0) + bedroomHeat.goToTime(0) + bathRoomHeat.goToTime(0) + entranceHeat.goToTime(0) + sliderToolbar.visible = true + lightNum = 1 + } else if (currentSlideName === "Masterbedroom") { + currentTempAttribute = "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_MasterBedroom.HeatAreas_Heat_MasterBedroom.Heat_MasterBedroomSG" + currentLightAttribute = "Scene.3D.RoomLights.MasterbedroomLightmap.House" + livingRoomHeat.goToTime(0) + masterBedroomHeat.goToTime(2) + bedroomHeat.goToTime(0) + bathRoomHeat.goToTime(0) + entranceHeat.goToTime(0) + sliderToolbar.visible = true + lightNum = 2 + } else if (currentSlideName === "Bedroom") { + currentTempAttribute = "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_BedRoom.HeatAreas_Heat_BedRoom.Heat_BedRoomSG" + currentLightAttribute = "Scene.3D.RoomLights.BedroomLightmap.House" + livingRoomHeat.goToTime(0) + masterBedroomHeat.goToTime(0) + bedroomHeat.goToTime(2) + bathRoomHeat.goToTime(0) + entranceHeat.goToTime(0) + sliderToolbar.visible = true + lightNum = 3 + } else if (currentSlideName === "Bathroom") { + currentTempAttribute = "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_BathRoom.HeatAreas_Heat_BathRoom.Heat_BathRoomSG" + currentLightAttribute = "Scene.3D.RoomLights.BathroomLightmap.House" + livingRoomHeat.goToTime(0) + masterBedroomHeat.goToTime(0) + bedroomHeat.goToTime(0) + bathRoomHeat.goToTime(2) + entranceHeat.goToTime(0) + sliderToolbar.visible = true + lightNum = 4 + } else if (currentSlideName === "Entrance") { + currentTempAttribute = "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_Entrance.Heat_Entrance_HeatAreas.Heat_EntranceSG" + currentLightAttribute = "Scene.3D.RoomLights.EntranceLightmap.House" + livingRoomHeat.goToTime(0) + masterBedroomHeat.goToTime(0) + bedroomHeat.goToTime(0) + bathRoomHeat.goToTime(0) + entranceHeat.goToTime(2) + sliderToolbar.visible = true + } else if (currentSlideName === "FloorPlan") { + livingRoomHeat.goToTime(0) + masterBedroomHeat.goToTime(0) + bedroomHeat.goToTime(0) + bathRoomHeat.goToTime(0) + entranceHeat.goToTime(0) + startTimer = true; + sliderToolbar.visible = false + } else { + sliderToolbar.visible = false + } + + if (currentSlideName === "FloorPlan") { + if (previousSlideName === "InitialView") + mainMenu.visible = true + else + showMenuTimer.start() + } else { + if (showMenuTimer.running) + showMenuTimer.stop() + mainMenu.visible = false + } + + if (startTimer) + goToHomeTimer.start() + else if (goToHomeTimer.running) + goToHomeTimer.stop() + + presentation.setAttribute(currentTempAttribute, "diffuse.r", red) + presentation.setAttribute(currentTempAttribute, "diffuse.g", green) + presentation.setAttribute(currentTempAttribute, "diffuse.b", blue) + presentation.setAttribute(currentLightAttribute, "opacity", light) + + if (knxBackend) { + lightControlLoader.item.lightNum = lightNum + lightControlLoader.item.updateLight(knxBackend.getLightState(lightNum)) + tempSlider.setPositionByColor(knxBackend.getColor()) + console.log("<<<<<<<<<<<<<<<<<<<1") + } + } + } + + SceneElement { + id: livingRoomHeat + elementPath: "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_LivingRoom" + } + SceneElement { + id: masterBedroomHeat + elementPath: "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_MasterBedroom" + } + SceneElement { + id: bedroomHeat + elementPath: "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_BedRoom" + } + SceneElement { + id: bathRoomHeat + elementPath: "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_BathRoom" + } + SceneElement { + id: entranceHeat + elementPath: "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_Entrance" + } + } + + // Once https://bugreports.qt.io/browse/QT3DS-414 is solved uncomment the following lines. +// onPresentationReady: { +// if (presentationReady) +// home.studio3DPresentationReady() +// } + + } + + Connections { + target: knxBackend + onRoomChanged: presentation.goToSlide("Scene", getRoomName(roomId)) + onBoardUpdate: { + console.log("signal onBoardUpdate lightNum: " + lightNum) + if (lightNum > 0 + && lightNum < 5 + && lightControlLoader.item.lightNum == lightNum + && knxBackend.getLightState(lightNum) != lightControlLoader.item.checked) { + var oldValue = houseModel.data(houseModel.index(lightNum - 1, 0), 3) + houseModel.setData(houseModel.index(lightNum - 1, 0), !oldValue, 3) + lightControlLoader.item.value = houseModel.data(houseModel.index(lightNum - 1, 0), 3) + lightControlLoader.item.updateLight(knxBackend.getLightState(lightNum)) + console.log("lightControlLoader: " + lightControlLoader.item.value) + } + } + onColorLedChange: { + var sliderColor = Qt.rgba(tempSlider.redColor, tempSlider.greenColor, tempSlider.blueColor, 1) + if (!Qt.colorEqual(sliderColor, color)) + tempSlider.setPositionByColor(color) + } +// knxBoard.changeColorLeftLed(color) +// onRockerChange: { +// logo.rotation = (position - 1000) * 360 / 1000; +// } + } + + MouseArea { + id: mouseArea + property bool disableMouseEvents: false + anchors.fill: parent + onClicked: { + if (!disableMouseEvents) { + if (scene.currentSlideName === "BackToInitialView") { + presentation.goToSlide("Scene", "InitialView") + disableMouse(2200) + } else if (scene.currentSlideName === "FloorPlan") { + presentation.goToSlide("Scene", "BackToInitialView") + disableMouse(2100) + } else if (scene.currentSlideName !== "InitialView") { + presentation.goToSlide("Scene", "FloorPlan") + disableMouse(1000) + } + } + } + + function disableMouse(animationDuration) { + disableMouseEvents = true + mouseTimer.interval = animationDuration + mouseTimer.start() + } + + Timer { + id: mouseTimer + interval: 1000 + running: false + repeat: false + + onTriggered: mouseArea.disableMouseEvents = false + } + } + + // + // Room label items + // + MainMenu { + id: mainMenu + + property int currentIndex: -1 + + visible: false + anchors.fill: parent + + onCurrentMenuItemChanged: { + presentation.goToSlide("Scene", currentItem) + + // Store temperature and light to model before changing the slider value + if (currentIndex != -1) { + houseModel.setData(houseModel.index(currentIndex, 0), tempSlider.currentValue, 2) + houseModel.setData(houseModel.index(currentIndex, 0), lightControlLoader.item.currentValue, 3) + } + currentIndex = index + var temp = houseModel.data(houseModel.index(index, 0), 2) + tempSlider.value = (temp - 15) / 15 + lightControlLoader.item.value = houseModel.data(houseModel.index(index, 0), 3) + } + } + + // + // Toolbar for Sliders + // + Item { + id: sliderToolbar + anchors.bottom: parent.bottom + height: tempSlider.height + anchors.horizontalCenter: parent.horizontalCenter + width: lightControlLoader.width + sizesMap.controlMargin + tempSlider.width + + visible: false + + Loader { + id: lightControlLoader + source: knxBackend ? "LightSwitch.qml" : "LightSlider.qml" + asynchronous: true + anchors.bottom: parent.bottom + anchors.bottomMargin: sizesMap.controlMargin + anchors.left: parent.left + width: knxBackend ? (sizesMap.controlHeight * 2) : (mainMenu.width / 3) + } + + Connections { + target: lightControlLoader.item + onLightValueChanged: { + var newLightValue = lightControlLoader.item.lightValue * 100 + home.light = newLightValue + presentation.setAttribute(currentLightAttribute, "opacity", newLightValue) + + } + } + + TempSlider { + id: tempSlider + anchors.bottom: parent.bottom + anchors.bottomMargin: sizesMap.controlMargin + anchors.right: parent.right + width: mainMenu.width / 3 + + onRedColorChanged: { + home.red = redColor + presentation.setAttribute(currentTempAttribute, "diffuse.r", redColor) + } + onBlueColorChanged: { + home.blue = blueColor + presentation.setAttribute(currentTempAttribute, "diffuse.b", blueColor) + } + + onGreenColorChanged: { + home.green = greenColor + presentation.setAttribute(currentTempAttribute, "diffuse.g", greenColor) + } + + onEconomyChanged: { + if (knxBackend) { + // Toggle red light based on temperature changes + // The initial state of red lights on the board needs to be based on the default temperatures + var lightNum = 0 + if (scene.currentSlideName === "Livingroom") + lightNum = 9 + else if (scene.currentSlideName === "Masterbedroom") + lightNum = 10 + else if (scene.currentSlideName === "Bedroom") + lightNum = 11 + else if (scene.currentSlideName === "Bathroom") + lightNum = 12 + //knxBackend.toggleLight(lightNum) + } + } + } + } +} diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/LightSlider.qml b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/LightSlider.qml new file mode 100644 index 0000000..8f00abd --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/LightSlider.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio Demos. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 + +SliderControl { + id: lightSlider + + property real lightValue: lightSlider.position + + sliderColor: "black" + currentValue: lightValue.toFixed(1) + + text: currentValue * 100 + "%" + iconSource: "qml/images/icon_light.png" + + onPositionChanged: { + setNewLightColor() + } + + function setNewLightColor() { + // From black to white + var newColorValue = lightSlider.position * 255 + sliderColor = rgbToHex(newColorValue, newColorValue, newColorValue) + } +} diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/LightSwitch.qml b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/LightSwitch.qml new file mode 100644 index 0000000..86fe602 --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/LightSwitch.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio Demos. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 +import QtQuick.Controls 2.3 +import Style 1.0 + +Item { + id: lightSwitch + property real value: control.checked ? 1.0 : 0.0 + property real lightValue: control.position + property real currentValue: lightValue.toFixed(1) + property real lightNum: 0 + + width: sizesMap.controlHeight * 2 + height: sizesMap.controlHeight + sliderText.height + function updateLight(state) { + control.checked = state + } + + Text { + id: sliderText + anchors.bottom: control.top + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + font.pixelSize: sizesMap.fontSize + color: Style.textColor + font.bold: true + style: Text.Outline + styleColor: Style.sliderBackgroundColor + } + + Switch { + id: control + width: lightSwitch.width + height: sizesMap.controlHeight + + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.margins: sizesMap.controlMargin / 2 + onClicked: { + console.log('Clicked on ligth!'+ lightNum) + knxBackend.toggleLight(lightNum) + } + indicator: Rectangle { + implicitWidth: sizesMap.controlHeight * 2 + implicitHeight: sizesMap.controlHeight + x: control.leftPadding + y: control.topPadding + control.availableHeight / 2 - height / 2 + radius: height / 2 + color: control.checked ? Style.sliderSelectionColor : Style.sliderBackgroundColor + border.color: Style.backgroundColor + border.width: sizesMap.controlBorderWidth + opacity: control.enabled ? 1 : 0.3 + + Rectangle { + x: control.checked ? parent.width - width : 0 + width: sizesMap.controlHeight + height: sizesMap.controlHeight + radius: height / 2 + antialiasing: true + color: Style.backgroundColor + opacity: control.enabled ? 1 : 0.3 + Image { + id: handleItemIcon + anchors.fill: parent + fillMode: Image.PreserveAspectFit + anchors.margins: sizesMap.controlMargin / 2 + anchors.centerIn: parent + source: "qml/images/icon_light.png" + } + } + } + } +} diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/MainMenu.qml b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/MainMenu.qml new file mode 100644 index 0000000..dcbb281 --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/MainMenu.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio Demos. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 +import Style 1.0 + +Item { + id: menuItem + property int horizontalScreenCenter: main.width / 2 + property int verticalScreenCenter: main.height / 2 + + signal currentMenuItemChanged(int index, string currentItem) + + Repeater { + id: mainListView + model: houseModel + delegate: listElement + } + + // Delegate for items in list view + Component { + id: listElement + + RoomLabel { + // Position is defined in the model relative to the center of the screen. + // Scale the label position here. + x: menuItem.horizontalScreenCenter + (heightRatio * xPos) - sizesMap.labelMouseMargin + y: menuItem.verticalScreenCenter + (heightRatio * yPos) - sizesMap.labelMouseMargin + text: name + onRoomLabelClicked: currentMenuItemChanged(index, item) + } + } +} diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/RoomLabel.qml b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/RoomLabel.qml new file mode 100644 index 0000000..f948917 --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/RoomLabel.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio Demos. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 +import Style 1.0 + +Item { + id: roomLabel + + // Provide bigger mouse area for label than the visual label is + + property alias text: roomText.text + + signal roomLabelClicked + + height: sizesMap.controlHeight + width: labelRect.width + sizesMap.labelMouseMargin * 2 + + Rectangle { + id: labelRect + width: roomText.width + sizesMap.controlMargin * 2 + height: roomText.height + sizesMap.controlMargin + anchors.centerIn: parent + color: Style.sliderBackgroundColor + radius: width / 2 + border.color: Style.backgroundColor + border.width: sizesMap.controlBorderWidth + + Text { + id: roomText + anchors.centerIn: parent + font.pixelSize: sizesMap.fontSize + color: Style.textColor + } + } + + MouseArea { + anchors.fill: parent + onClicked: roomLabelClicked() + } +} diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/SliderControl.qml b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/SliderControl.qml new file mode 100644 index 0000000..14c6f5d --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/SliderControl.qml @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio Demos. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import Style 1.0 + +Item { + id: sliderControl + signal moved(real position) + + property alias position: control.position + property alias value: control.value + property alias text: sliderText.text + property alias iconSource: handleItemIcon.source + + property color sliderColor + property real currentValue: 0 + + width: sizesMap.sliderMaxWidth + height: sizesMap.controlHeight + sliderText.height + + Text { + id: sliderText + anchors.bottom: control.top + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + font.pixelSize: sizesMap.fontSize + color: Style.textColor + font.bold: true + style: Text.Outline + styleColor: Style.sliderBackgroundColor + } + + Slider { + id: control + + width: sliderControl.width + height: sizesMap.controlHeight + + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.margins: sizesMap.controlMargin / 2 + + onMoved: parent.moved(position) + + background: Rectangle { + x: control.leftPadding + y: control.topPadding + control.availableHeight / 2 - height / 2 + implicitWidth: sizesMap.sliderMaxWidth + implicitHeight: sizesMap.controlHeight + width: control.availableWidth + height: implicitHeight + color: Style.sliderBackgroundColor + radius: height / 2 + border.color: Style.backgroundColor + border.width: sizesMap.controlBorderWidth + opacity: control.enabled ? 1 : 0.3 + + Rectangle { + width: handleItem.x + handleItem.width - 5 + height: parent.height + color: Style.sliderSelectionColor + border.color: Style.backgroundColor + border.width: sizesMap.controlBorderWidth + radius: height / 2 + } + } + + handle: Rectangle { + id: handleItem + x: control.leftPadding + control.visualPosition * (control.availableWidth - width) + y: control.topPadding + control.availableHeight / 2 - height / 2 + implicitWidth: sizesMap.controlHeight + implicitHeight: sizesMap.controlHeight + radius: height / 2 + antialiasing: true + color: Style.backgroundColor + opacity: control.enabled ? 1 : 0.3 + Image { + id: handleItemIcon + anchors.fill: parent + fillMode: Image.PreserveAspectFit + anchors.margins: sizesMap.controlMargin / 2 + anchors.centerIn: parent + + } + } + } + + function rgbToHex(red, green, blue) { + // Based on http://www.javascripter.net/faq/rgbtohex.htm + return "#" + toHex(red) + toHex(green) + toHex(blue) + } + + function toHex(n) { + if (isNaN(n)) + return "00" + n = Math.max(0, Math.min(n, 255)) + return "0123456789ABCDEF".charAt((n - n % 16) / 16) + + "0123456789ABCDEF".charAt(n % 16) + } +} diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/SplashScreen.qml b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/SplashScreen.qml new file mode 100644 index 0000000..94df270 --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/SplashScreen.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio Demos. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 +import Style 1.0 + +Rectangle { + anchors.fill: parent + color: Style.backgroundColor + + Image { + anchors.centerIn: parent + source: "qrc:/qml/images/QtSymbol.png" + } +} diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/TempSlider.qml b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/TempSlider.qml new file mode 100644 index 0000000..8220669 --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/TempSlider.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio Demos. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 + +SliderControl { + id: tempSlider + property real redColor + property real blueColor + property real greenColor + property bool economy: currentValue < 22 ? true : false + + currentValue: 15 + sliderColor: "#0000ff" + + text: currentValue + "°" + iconSource: "qml/images/icon_temp.png" + + onPositionChanged: { + updateCurrentTemp() + setNewTempColor() + } + + onMoved: { + var position = 0.6; + if (currentValue > 17 && currentValue < 26) + position = 0.45; + else if (currentValue >= 26) + position = 0.30; + knxBackend.colorSwitch(position) + console.log('moved color slider!'+ position) + } + + function setPositionByColor(color) + { + if (Qt.colorEqual(color, "magenta")) { + value = 0.5 + } + else if (Qt.colorEqual(color, "red")) { + value = 1 + } + else if (Qt.colorEqual(color, "blue")) { + value = 0 + } + } + + function updateCurrentTemp() { + // Temperature range from 15 to 30 + // Slider range form 0 to 1 + var newTempValue = 15 + 15 * tempSlider.position + tempSlider.currentValue = newTempValue.toFixed(0) + } + + function setNewTempColor() { + var position = tempSlider.position * 100 + // From blue to red + var r = Math.floor((255 * Math.sqrt(Math.sin(position * Math.PI / 200)))) + var b = Math.floor((255 * Math.sqrt(Math.cos(position * Math.PI / 200)))) + var g = 0 + redColor = r / 255 + blueColor = b / 255 + greenColor = 0 + sliderColor = rgbToHex(r, g, b) + + } +} diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/main.qml b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/main.qml new file mode 100644 index 0000000..ca42332 --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/HomeAutom/main.qml @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio Demos. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 +import Style 1.0 + +// Main Item +Item { + id: main + width: sizesMap.screenWidth + height: sizesMap.screenHeight + + // onPresentationReady() signal should be restored to 3D studio code so that we can hide + // the splashscreen without a timer, https://bugreports.qt.io/browse/QT3DS-414 + Timer { + id: showSplashScreenTimer + interval: 1000 + running: false + repeat: false + + onTriggered: hideSplashScreen() + } + + Loader { + id: appLoader + anchors.fill: parent + visible: false +// asynchronous: true // https://bugreports.qt.io/browse/QTBUG-50992 + } + + Connections { + target: appLoader.item + onStudio3DPresentationReady: hideSplashScreen() + } + + Timer { + interval: 5000 + running: true + repeat: true + onTriggered: knxBackend.reconnect() + } + + SplashScreen { + id: splashScreenLoader + visible: true + anchors.fill: parent + Component.onCompleted: { + appLoader.setSource("HomeView.qml") + showSplashScreenTimer.start() + } + } + + function hideSplashScreen() { + if (appLoader.status === Loader.Ready) { + splashScreenLoader.visible = false + appLoader.visible = true + } + } +} diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/QtSymbol.png b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/QtSymbol.png new file mode 100644 index 0000000..3c867cd --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/QtSymbol.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc885612c701d0b610bebe156dcb4b9d819a1ad6681465a53392705fed2b9d90 +size 4541 diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/icon_light.png b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/icon_light.png new file mode 100644 index 0000000..2b35771 --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/icon_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00eec2e449fdc77fb81df23a8959bb83804ebd366f313014a36eb0bb81e5a740 +size 1210 diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/icon_temp.png b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/icon_temp.png new file mode 100644 index 0000000..a82320b --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/images/icon_temp.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32584803b4e6fdfb4000954d88056b81f25ae849afdc64f112124ddd95243252 +size 1207 diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/imports/Style/Style.qml b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/imports/Style/Style.qml new file mode 100644 index 0000000..451d231 --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/imports/Style/Style.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio Demos. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +pragma Singleton + +import QtQuick 2.8 + +QtObject { + + // Theme colors to be used through out whole system + readonly property color backgroundColor: "white" + readonly property color textColor: "white" + readonly property color sliderToolbarTextColor: "white" + readonly property color sliderToolbarRaisedTextColor: "black" + readonly property color menuBackgroundColor: "gray" + readonly property color menuSelectedItemColor: "#80bfff" + readonly property color sliderBackgroundColor: "#595959" + readonly property color sliderSelectionColor: "#a6a6a6" + + readonly property int visibilityAnimatorDuration: 500 +} diff --git a/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/imports/Style/qmldir b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/imports/Style/qmldir new file mode 100644 index 0000000..858dcaf --- /dev/null +++ b/tradeshow/knx-demo/3d-Alexa-knx-demo/qml/imports/Style/qmldir @@ -0,0 +1,2 @@ +module Style +singleton Style 1.0 Style.qml -- cgit v1.2.3