Commit 1b03765b authored by Kaj Grönholm's avatar Kaj Grönholm

Update HomeAutomation towards Studio API 1.1

Take DataInput API partly into use.

Task-number: QT3DS-1050
parent ae925293
......@@ -50,5 +50,6 @@
<file>uip/maps/HouseTexture.jpg</file>
<file>qml/imports/Style/qmldir</file>
<file>qml/imports/Style/Style.qml</file>
<file>uip/houseStudio.uia</file>
</qresource>
</RCC>
......@@ -69,7 +69,7 @@ Item {
running: false
repeat: false
onTriggered: presentation.goToSlide("Scene", "BackToInitialView")
onTriggered: slideInput.setValue("BackToInitialView")
}
Timer {
......@@ -95,7 +95,7 @@ Item {
Presentation {
id: presentation
source: "qrc:/uip/houseStudio.uip"
source: "qrc:/uip/houseStudio.uia"
function switchToRoom(slideName) {
livingRoomHeat.goToTime(slideName === "Livingroom" ? 2 : 0)
......@@ -105,29 +105,36 @@ Item {
entranceHeat.goToTime(slideName === "Entrance" ? 2 : 0)
}
// This DataInput item is used to control current slide. The presentation has
// a corresponding data input of "String" type linked to main Scene slides.
DataInput {
id: slideInput
name: "slideInput"
}
SceneElement {
id: scene
elementPath: "Scene"
onCurrentSlideNameChanged: {
var startTimer = false;
if (currentSlideName === "Livingroom") {
currentTempAttribute = "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_LivingRoom.HeatAreas_Heat_LivingRoom.Heat_LivingRoomSG"
currentTempAttribute = livingRoomHeat.elementPath + ".HeatAreas_Heat_LivingRoom.Heat_LivingRoomSG"
currentLightAttribute = "Scene.3D.RoomLights.LivingroomLightMap.House"
sliderToolbar.visible = true
} else if (currentSlideName === "Masterbedroom") {
currentTempAttribute = "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_MasterBedroom.HeatAreas_Heat_MasterBedroom.Heat_MasterBedroomSG"
currentTempAttribute = masterBedroomHeat.elementPath + ".HeatAreas_Heat_MasterBedroom.Heat_MasterBedroomSG"
currentLightAttribute = "Scene.3D.RoomLights.MasterbedroomLightmap.House"
sliderToolbar.visible = true
} else if (currentSlideName === "Bedroom") {
currentTempAttribute = "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_BedRoom.HeatAreas_Heat_BedRoom.Heat_BedRoomSG"
currentTempAttribute = bedroomHeat.elementPath + ".HeatAreas_Heat_BedRoom.Heat_BedRoomSG"
currentLightAttribute = "Scene.3D.RoomLights.BedroomLightmap.House"
sliderToolbar.visible = true
} else if (currentSlideName === "Bathroom") {
currentTempAttribute = "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_BathRoom.HeatAreas_Heat_BathRoom.Heat_BathRoomSG"
currentTempAttribute = bathRoomHeat.elementPath + ".HeatAreas_Heat_BathRoom.Heat_BathRoomSG"
currentLightAttribute = "Scene.3D.RoomLights.BathroomLightmap.House"
sliderToolbar.visible = true
} else if (currentSlideName === "Entrance") {
currentTempAttribute = "Scene.3D.HeatAreas.Group_HeatAreas.HeatAreas_Heat_Entrance.Heat_Entrance_HeatAreas.Heat_EntranceSG"
currentTempAttribute = entranceHeat.elementPath + ".Heat_Entrance_HeatAreas.Heat_EntranceSG"
currentLightAttribute = "Scene.3D.RoomLights.EntranceLightmap.House"
sliderToolbar.visible = true
} else if (currentSlideName === "FloorPlan") {
......@@ -205,13 +212,13 @@ Item {
anchors.fill: parent
onClicked: {
if (scene.currentSlideName === "BackToInitialView") {
presentation.goToSlide("Scene", "InitialView")
slideInput.setValue("InitialView")
disableMouse(2200)
} else if (scene.currentSlideName === "FloorPlan") {
presentation.goToSlide("Scene", "BackToInitialView")
slideInput.setValue("BackToInitialView")
disableMouse(2100)
} else if (scene.currentSlideName !== "InitialView") {
presentation.goToSlide("Scene", "FloorPlan")
slideInput.setValue("FloorPlan")
disableMouse(1000)
}
}
......@@ -244,7 +251,7 @@ Item {
anchors.fill: parent
onCurrentMenuItemChanged: {
presentation.goToSlide("Scene", currentItem)
slideInput.setValue(currentItem)
// Store temperature and light to model before changing the slider value
if (currentIndex != -1) {
......
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://qt.io/qt3dstudio/uia">
<assets initial="houseStudio">
<presentation id="houseStudio" src="houseStudio.uip"/>
<dataInput name="slideInput" type="String"/>
</assets>
<statemachine ref="#logic">
<visual-states>
<state ref="Initial">
<enter>
<goto-slide element="main:Scene" rel="next"/>
</enter>
</state>
</visual-states>
</statemachine>
</application>
......@@ -15,7 +15,7 @@
<ImageBuffer sourcepath="maps/Roof.png" hasTransparency="True" />
</BufferData>
<Graph >
<Scene id="Scene" backgroundcolor="0.819608 0.870588 0.913725" >
<Scene id="Scene" backgroundcolor="0.819608 0.870588 0.913725" controlledproperty="slideInput @slide">
<Layer id="2D" >
<Camera id="Camera_001" />
<Model id="Rectangle" >
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment