From 2f16d230025c3173cfbecc58b38d6a52b6b0f5f2 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 5 Jul 2023 20:09:03 +1000 Subject: Start on wiring up playback screen to real data --- src/ui/include/screen_playing.hpp | 7 +++++++ src/ui/include/ui_fsm.hpp | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src/ui/include') diff --git a/src/ui/include/screen_playing.hpp b/src/ui/include/screen_playing.hpp index 3eae32a7..5ccfe391 100644 --- a/src/ui/include/screen_playing.hpp +++ b/src/ui/include/screen_playing.hpp @@ -6,12 +6,15 @@ #pragma once +#include #include +#include #include "lvgl.h" #include "database.hpp" #include "screen.hpp" +#include "track.hpp" namespace ui { namespace screens { @@ -23,6 +26,9 @@ class Playing : public Screen { auto BindTrack(database::Track t) -> void; + auto UpdateTime(uint32_t) -> void; + auto UpdateNextUp(std::vector tracks) -> void; + private: database::Track track_; @@ -34,6 +40,7 @@ class Playing : public Screen { lv_obj_t* play_pause_control_; lv_obj_t* next_up_container_; + std::vector next_tracks_; }; } // namespace screens diff --git a/src/ui/include/ui_fsm.hpp b/src/ui/include/ui_fsm.hpp index 32275fab..cd1ec492 100644 --- a/src/ui/include/ui_fsm.hpp +++ b/src/ui/include/ui_fsm.hpp @@ -9,7 +9,9 @@ #include #include +#include "audio_events.hpp" #include "relative_wheel.hpp" +#include "screen_playing.hpp" #include "tinyfsm.hpp" #include "display.hpp" @@ -37,6 +39,8 @@ class UiState : public tinyfsm::Fsm { /* Fallback event handler. Does nothing. */ void react(const tinyfsm::Event& ev) {} + virtual void react(const audio::PlaybackUpdate){}; + virtual void react(const system_fsm::KeyLockChanged&){}; virtual void react(const internal::RecordSelected&){}; @@ -57,6 +61,7 @@ class UiState : public tinyfsm::Fsm { static std::stack> sScreens; static std::shared_ptr sCurrentScreen; + static std::unique_ptr sPlayingScreen; }; namespace states { @@ -68,7 +73,7 @@ class Splash : public UiState { using UiState::react; }; -class Interactive : public UiState { +class Browse : public UiState { void entry() override; void react(const internal::RecordSelected&) override; @@ -78,6 +83,12 @@ class Interactive : public UiState { void react(const system_fsm::StorageMounted&) override; }; +class Playing : public UiState { + void entry() override; + + void react(const audio::PlaybackUpdate) override; +}; + class FatalError : public UiState {}; } // namespace states -- cgit v1.2.3