Commit ae925293 authored by Kaj Grönholm's avatar Kaj Grönholm

HomeAutomation demo improvements

Some QML side cleanups.

Task-number: QT3DS-1050
parent 9ee5e319
......@@ -130,7 +130,7 @@ int main(int argc, char *argv[])
#ifndef Q_OS_ANDROID
// Hack to get self build working.
// Also needs the Qt3DStudio\bin directory in run environment path.
viewer.engine()->addImportPath(QStringLiteral("C:/Qt/Tools/Qt3DStudio/qml"));
//viewer.engine()->addImportPath(QStringLiteral("C:/Qt/Tools/Qt3DStudio/qml"));
#endif
#if defined(KNX_BACKEND)
......
......@@ -97,6 +97,14 @@ Item {
id: presentation
source: "qrc:/uip/houseStudio.uip"
function switchToRoom(slideName) {
livingRoomHeat.goToTime(slideName === "Livingroom" ? 2 : 0)
masterBedroomHeat.goToTime(slideName === "Masterbedroom" ? 2 : 0)
bedroomHeat.goToTime(slideName === "Bedroom" ? 2 : 0)
bathRoomHeat.goToTime(slideName === "Bathroom" ? 2 : 0)
entranceHeat.goToTime(slideName === "Entrance" ? 2 : 0)
}
SceneElement {
id: scene
elementPath: "Scene"
......@@ -105,60 +113,32 @@ Item {
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
} 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
} 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
} 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
} 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
}
presentation.switchToRoom(currentSlideName);
if (currentSlideName === "FloorPlan") {
if (previousSlideName === "InitialView")
mainMenu.visible = true
......@@ -222,25 +202,22 @@ Item {
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)
}
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
mouseArea.enabled = false
mouseTimer.interval = animationDuration
mouseTimer.start()
}
......@@ -251,7 +228,7 @@ Item {
running: false
repeat: false
onTriggered: mouseArea.disableMouseEvents = false
onTriggered: mouseArea.enabled = true
}
}
......@@ -339,7 +316,6 @@ Item {
home.blue = blueColor
presentation.setAttribute(currentTempAttribute, "diffuse.b", blueColor)
}
onGreenColorChanged: {
home.green = greenColor
presentation.setAttribute(currentTempAttribute, "diffuse.g", greenColor)
......
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