diff --git a/src/state.rs b/src/state.rs index be7dfbe..5ee66d7 100644 --- a/src/state.rs +++ b/src/state.rs @@ -12,7 +12,7 @@ pub const LIGHTS: [(&str, &str); 8] = [ ("light.living_room", "Living Room"), ("light.shower_light", "Shower"), ("light.utilities", "Utilities"), - ("light.light.wc_light", "WC"), + ("light.wc_light", "WC"), ]; #[derive(Clone, Debug, PartialEq)] diff --git a/ui/main.slint b/ui/main.slint index b9e57b6..1be1c63 100644 --- a/ui/main.slint +++ b/ui/main.slint @@ -75,7 +75,11 @@ component ThermostatRow inherits Rectangle { in property room; in property row-index; in property selected: false; + in property selected-mode: "--"; + callback row-activated(int); + callback change-target(int); + callback set-mode(string); background: root.selected ? Settings.dark-mode ? #777777 : black : Settings.dark-mode ? black : white; @@ -140,6 +144,12 @@ component ThermostatRow inherits Rectangle { horizontal-alignment: center; vertical-alignment: center; } + + ControlButton { x: 666px - 30px; y: 0px; width: 78px; height: 78px; label: "−"; activated => { root.change-target(-1); } } + ControlButton { x: 744px - 30px; y: 0px; width: 78px; height: 78px; label: "+"; activated => { root.change-target(1); } } + + ControlButton { x: 822px - 30px; y: 0px; width: 78px; height: 78px; active: root.selected-mode == "HEAT" || root.selected-mode == "HEATING"; label: "HEAT"; activated => { root.set-mode("heat"); } } + ControlButton { x: 900px - 30px; y: 0px; width: 78px; height: 78px; active: root.selected-mode == "OFF"; label: "OFF"; activated => { root.set-mode("off"); } } } component LightTile inherits Rectangle { @@ -473,31 +483,13 @@ export component AppWindow inherits Window { room: room; row-index: index; selected: root.selected-index == index; + selected-mode <=> root.selected-mode; row-activated(index) => { root.user-activity(); root.select-room(index); } + change-target(value) => { root.user-activity(); root.select-room(self.row-index); root.change-target(value); } + set-mode(value) => { root.user-activity(); root.select-room(self.row-index); root.set-mode(value); } } - Rectangle { x: 38px; y: 627px; width: parent.width - 76px; height: 4px; background: Settings.dark-mode ? #777777 : black; } - Text { x: 38px; y: 642px; width: 280px; height: 22px; text: root.selected-name + " / " + root.selected-mode; color: Settings.dark-mode ? #777777 : black; font-size: 15px; font-weight: 700; overflow: elide; } - Text { x: 34px; y: 661px; width: 190px; height: 78px; text: root.selected-target; color: Settings.dark-mode ? #777777 : black; font-size: 62px; font-weight: 700; vertical-alignment: center; } - - ControlButton { x: 236px; y: 662px; width: 78px; height: 78px; label: "−"; activated => { root.user-activity(); root.change-target(-1); } } - ControlButton { x: 324px; y: 662px; width: 78px; height: 78px; label: "+"; activated => { root.user-activity(); root.change-target(1); } } - ControlButton { x: 412px; y: 662px; width: 92px; height: 78px; label: "HEAT"; enabled: root.selected-supports-heat; active: root.selected-mode == "HEAT" || root.selected-mode == "HEATING"; activated => { root.user-activity(); root.set-mode("heat"); } } - ControlButton { x: 514px; y: 662px; width: 92px; height: 78px; label: "COOL"; enabled: root.selected-supports-cool; active: root.selected-mode == "COOL" || root.selected-mode == "COOLING"; activated => { root.user-activity(); root.set-mode("cool"); } } - ControlButton { x: 616px; y: 662px; width: 104px; height: 78px; label: "OFF"; active: root.selected-mode == "OFF"; activated => { root.user-activity(); root.set-mode("off"); } } - - Text { x: 38px; y: 754px; width: 92px; height: 54px; text: "FAN\nSPEED"; color: Settings.dark-mode ? #777777 : black; font-size: 14px; font-weight: 700; vertical-alignment: center; } - ControlButton { x: 138px; y: 752px; width: 76px; height: 58px; label: "AUTO"; enabled: root.selected-supports-fan; active: root.selected-fan-mode == "AUTO"; activated => { root.user-activity(); root.set-fan-mode("Auto"); } } - ControlButton { x: 222px; y: 752px; width: 76px; height: 58px; label: "LOW"; enabled: root.selected-supports-fan; active: root.selected-fan-mode == "LOW"; activated => { root.user-activity(); root.set-fan-mode("Low"); } } - ControlButton { x: 306px; y: 752px; width: 76px; height: 58px; label: "MED"; enabled: root.selected-supports-fan; active: root.selected-fan-mode == "MED"; activated => { root.user-activity(); root.set-fan-mode("Med"); } } - ControlButton { x: 390px; y: 752px; width: 76px; height: 58px; label: "HIGH"; enabled: root.selected-supports-fan; active: root.selected-fan-mode == "HIGH"; activated => { root.user-activity(); root.set-fan-mode("High"); } } - - Text { x: 38px; y: 822px; width: 540px; height: 24px; text: root.action-status; color: Settings.dark-mode ? #777777 : black; font-size: 15px; font-weight: 700; overflow: elide; } - Rectangle { - x: parent.width - 152px; y: 814px; width: 114px; height: 40px; border-width: 2px; border-color: Settings.dark-mode ? #777777 : black; background: refresh-touch.pressed ? Settings.dark-mode ? #777777 : black : Settings.dark-mode ? black : white; - refresh-touch := TouchArea { clicked => { root.user-activity(); root.refresh(); } } - Text { text: "REFRESH"; color: refresh-touch.pressed ? Settings.dark-mode ? black : white : Settings.dark-mode ? #777777 : black; font-size: 14px; font-weight: 700; horizontal-alignment: center; vertical-alignment: center; } - } + Text { x: root.width - 400px; y: root.height - 24px; width: 400px; vertical-alignment: bottom; horizontal-alignment: right; height: 24px; text: root.action-status; color: Settings.dark-mode ? #777777 : black; font-size: 15px; font-weight: 700; overflow: elide; } } if root.current-page == 1: Rectangle {