diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-11-12 19:14:09 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-11-12 19:14:09 +1100 |
| commit | 8a0a167adbf3d9b6f8b6f16aaf20ca39ad5549de (patch) | |
| tree | 02b6cf23f591915747ec2994381854a79979c4a0 /src/ui/include/ui_fsm.hpp | |
| parent | 8471046a95ab9e00f7d42b56dbbc9ce3e5b424b9 (diff) | |
| download | tangara-fw-8a0a167adbf3d9b6f8b6f16aaf20ca39ad5549de.tar.gz | |
Convert the main menu screen to lua lol
Diffstat (limited to 'src/ui/include/ui_fsm.hpp')
| -rw-r--r-- | src/ui/include/ui_fsm.hpp | 24 |
1 files changed, 18 insertions, 6 deletions
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<UiState> { protected: void PushScreen(std::shared_ptr<Screen>); - void PopScreen(); + int PopScreen(); static std::unique_ptr<UiTask> sTask; static std::shared_ptr<system_fsm::ServiceLocator> sServices; @@ -99,6 +100,9 @@ class UiState : public tinyfsm::Fsm<UiState> { static std::stack<std::shared_ptr<Screen>> sScreens; static std::shared_ptr<Screen> sCurrentScreen; static std::shared_ptr<Modal> sCurrentModal; + static std::shared_ptr<lua::LuaThread> sLua; + + static std::weak_ptr<screens::Bluetooth> 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<screens::Bluetooth> bluetooth_screen_; }; class Playing : public UiState { |
