diff --git a/telldus-gui/Plugins/SchedulerGUISimple/ActionPoint.qml b/telldus-gui/Plugins/SchedulerGUISimple/ActionPoint.qml index 82e322fe..8f9365b0 100644 --- a/telldus-gui/Plugins/SchedulerGUISimple/ActionPoint.qml +++ b/telldus-gui/Plugins/SchedulerGUISimple/ActionPoint.qml @@ -7,6 +7,7 @@ Rectangle{ property string actionTypeColor: "blue" //TODO default value property int actionType: 1 //TODO default value property double actionTypeOpacity: 1 + property string actionTypeImage: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/devices.png" property string isPoint: "true" property variant isLoaded property int xvalue @@ -80,7 +81,7 @@ Rectangle{ //opacity: 1 id: actionImage width: 20; height: 20 - source: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/devices.png" + source: pointRect.actionTypeImage } Rectangle{ @@ -140,29 +141,29 @@ Rectangle{ State { name: "on" PropertyChanges { target: pointRect; actionTypeColor: "blue"; actionTypeOpacity: 1 } //TODO: images!! - PropertyChanges { target: actionImage; source: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/devices.png" } + PropertyChanges { target: pointRect; actionTypeImage: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/devices.png" } }, State{ name: "off" PropertyChanges { target: pointRect; actionTypeColor: "gainsboro"; actionTypeOpacity: 0 } - PropertyChanges { target: actionImage; source: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/devices-bw.png" } + PropertyChanges { target: pointRect; actionTypeImage: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/devices-bw.png" } + //PropertyChanges { target: actionImage; source: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/devices-bw.png" } }, State{ name: "dim" PropertyChanges { target: pointRect; actionTypeColor: "green"; actionTypeOpacity: 1 } - PropertyChanges { target: actionImage; source: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/TelldusCenter_128.png" } + PropertyChanges { target: pointRect; actionTypeImage: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/TelldusCenter_128.png" } //something opacity = dim for example }, State{ name: "bell" PropertyChanges { target: pointRect; actionTypeColor: getLastPointColor() } - PropertyChanges { target: actionImage; source: "icon.png" } + PropertyChanges { target: pointRect; actionTypeImage: "icon.png" } } ] function toggleType(){ //TODO other kind of selection method var index = 0; - var activeStates = Scripts.getActiveStates(); if(activeStates == undefined || activeStates.length == 0){ return; @@ -197,6 +198,11 @@ Rectangle{ */ } + function setType(name){ + print("setting state to " + name); + pointRect.state = name; + } + function toggleTrigger(){ //TODO other kind of selection method if(trigger.state == "sunrise"){ trigger.state = "sunset"; @@ -252,4 +258,44 @@ Rectangle{ function addState(state){ Scripts.addState(state); } + + function setFirstState(firstState){ + + var activeStates = Scripts.getActiveStates(); + + if(activeStates == null || activeStates.length == 0){ + //nothing to do + return; + } + + //state may already be set: + if(firstState != undefined && firstState != ""){ + pointRect.state = firstState; + return; + } + + //check that device has the "off" state: + var exists = false; + for(var i=1;i prevPoint.x) && pointList[i].state != "bell"){ //TODO when more than "bell", make dynamic + prevPoint = pointList[i]; + } + } + } + + if(prevPoint == null){ + return ""; + } + + return prevPoint.state; } function isMidnightDark(){ @@ -49,3 +57,13 @@ function isMidnightDark(){ } return true; } + +function pad(number, length) { + + var str = '' + number; + while (str.length < length) { + str = '0' + str; + } + + return str; +}