From ef72b25660912ff247997089abfb93e9f0b52809 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 7 Mar 2024 10:59:03 +1100 Subject: use prototype inheritance for lua screens, rather than functions this gives us a way to give each screen nice little hooks, like 'onShown' and 'onHidden'. later we can use these hooks to disable bindings for screens that aren't in-use. --- src/ui/include/screen.hpp | 3 +++ src/ui/include/screen_lua.hpp | 3 +++ 2 files changed, 6 insertions(+) (limited to 'src/ui/include') diff --git a/src/ui/include/screen.hpp b/src/ui/include/screen.hpp index 60939660..4241c712 100644 --- a/src/ui/include/screen.hpp +++ b/src/ui/include/screen.hpp @@ -27,6 +27,9 @@ class Screen { Screen(); virtual ~Screen(); + virtual auto onShown() -> void {} + virtual auto onHidden() -> void {} + auto root() -> lv_obj_t* { return root_; } auto content() -> lv_obj_t* { return content_; } auto alert() -> lv_obj_t* { return alert_; } diff --git a/src/ui/include/screen_lua.hpp b/src/ui/include/screen_lua.hpp index ee9f6813..0ed3a508 100644 --- a/src/ui/include/screen_lua.hpp +++ b/src/ui/include/screen_lua.hpp @@ -18,6 +18,9 @@ class Lua : public Screen { Lua(); ~Lua(); + auto onShown() -> void override; + auto onHidden() -> void override; + auto SetObjRef(lua_State*) -> void; private: -- cgit v1.2.3 From eba5adeb8cc606b4d685132248c6481c0aca53f6 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 7 Mar 2024 11:16:56 +1100 Subject: Show the now playing screen after being locked for a while --- src/ui/include/ui_fsm.hpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/include') diff --git a/src/ui/include/ui_fsm.hpp b/src/ui/include/ui_fsm.hpp index 6cf2ba4c..07937559 100644 --- a/src/ui/include/ui_fsm.hpp +++ b/src/ui/include/ui_fsm.hpp @@ -129,6 +129,7 @@ class UiState : public tinyfsm::Fsm { static lua::Property sControlsScheme; static lua::Property sScrollSensitivity; + static lua::Property sLockSwitch; static lua::Property sDatabaseUpdating; }; -- cgit v1.2.3