From 8a0a167adbf3d9b6f8b6f16aaf20ca39ad5549de Mon Sep 17 00:00:00 2001 From: jacqueline Date: Sun, 12 Nov 2023 19:14:09 +1100 Subject: Convert the main menu screen to lua lol --- src/ui/include/ui_fsm.hpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/ui/include/ui_fsm.hpp') diff --git a/src/ui/include/ui_fsm.hpp b/src/ui/include/ui_fsm.hpp index da63b77f..7d1d62d6 100644 --- a/src/ui/include/ui_fsm.hpp +++ b/src/ui/include/ui_fsm.hpp @@ -16,6 +16,7 @@ #include "bindey/property.h" #include "db_events.hpp" #include "gpios.hpp" +#include "lua_thread.hpp" #include "lvgl_task.hpp" #include "model_playback.hpp" #include "model_top_bar.hpp" @@ -89,7 +90,7 @@ class UiState : public tinyfsm::Fsm { protected: void PushScreen(std::shared_ptr); - void PopScreen(); + int PopScreen(); static std::unique_ptr sTask; static std::shared_ptr sServices; @@ -99,6 +100,9 @@ class UiState : public tinyfsm::Fsm { static std::stack> sScreens; static std::shared_ptr sCurrentScreen; static std::shared_ptr sCurrentModal; + static std::shared_ptr sLua; + + static std::weak_ptr bluetooth_screen_; static models::Playback sPlaybackModel; static models::TopBar sTopBarModel; @@ -110,6 +114,19 @@ class Splash : public UiState { public: void exit() override; void react(const system_fsm::BootComplete&) override; + void react(const system_fsm::StorageMounted&) override; + using UiState::react; +}; + +class Lua : public UiState { + public: + void entry() override; + void exit() override; + + void react(const internal::IndexSelected&) override; + void react(const internal::ShowNowPlaying&) override; + void react(const internal::ShowSettingsPage&) override; + using UiState::react; }; @@ -131,20 +148,15 @@ class Browse : public UiState { void entry() override; void react(const internal::RecordSelected&) override; - void react(const internal::IndexSelected&) override; void react(const internal::BackPressed&) override; void react(const internal::ShowNowPlaying&) override; void react(const internal::ShowSettingsPage&) override; void react(const internal::ReindexDatabase&) override; - void react(const system_fsm::StorageMounted&) override; void react(const system_fsm::BluetoothDevicesChanged&) override; using UiState::react; - - private: - std::weak_ptr bluetooth_screen_; }; class Playing : public UiState { -- cgit v1.2.3