diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-07-05 20:09:03 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-07-05 20:09:03 +1000 |
| commit | 2f16d230025c3173cfbecc58b38d6a52b6b0f5f2 (patch) | |
| tree | 28cd9943eacc34c7b6701f0509a4eea471bada2d /src/ui/ui_fsm.cpp | |
| parent | 7eec2cc5b6e8fb1b3a11c09a2e324f83a8192860 (diff) | |
| download | tangara-fw-2f16d230025c3173cfbecc58b38d6a52b6b0f5f2.tar.gz | |
Start on wiring up playback screen to real data
Diffstat (limited to 'src/ui/ui_fsm.cpp')
| -rw-r--r-- | src/ui/ui_fsm.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp index 58b1f641..13658c37 100644 --- a/src/ui/ui_fsm.cpp +++ b/src/ui/ui_fsm.cpp @@ -34,6 +34,7 @@ std::weak_ptr<database::Database> UiState::sDb; std::stack<std::shared_ptr<Screen>> UiState::sScreens; std::shared_ptr<Screen> UiState::sCurrentScreen; +std::unique_ptr<screens::Playing> UiState::sPlayingScreen; auto UiState::Init(drivers::IGpios* gpio_expander) -> bool { sIGpios = gpio_expander; @@ -78,16 +79,16 @@ void Splash::exit() { } void Splash::react(const system_fsm::BootComplete& ev) { - transit<Interactive>(); + transit<Browse>(); } -void Interactive::entry() {} +void Browse::entry() {} -void Interactive::react(const system_fsm::KeyLockChanged& ev) { +void Browse::react(const system_fsm::KeyLockChanged& ev) { sDisplay->SetDisplayOn(ev.falling); } -void Interactive::react(const system_fsm::StorageMounted& ev) { +void Browse::react(const system_fsm::StorageMounted& ev) { sDb = ev.db; auto db = ev.db.lock(); if (!db) { @@ -97,7 +98,7 @@ void Interactive::react(const system_fsm::StorageMounted& ev) { PushScreen(std::make_shared<screens::Menu>(db->GetIndexes())); } -void Interactive::react(const internal::RecordSelected& ev) { +void Browse::react(const internal::RecordSelected& ev) { auto db = sDb.lock(); if (!db) { return; @@ -125,7 +126,7 @@ void Interactive::react(const internal::RecordSelected& ev) { } } -void Interactive::react(const internal::IndexSelected& ev) { +void Browse::react(const internal::IndexSelected& ev) { auto db = sDb.lock(); if (!db) { return; @@ -137,6 +138,10 @@ void Interactive::react(const internal::IndexSelected& ev) { std::move(query))); } +void Playing::react(const audio::PlaybackUpdate ev) { + sPlayingScreen->UpdateTime(ev.seconds_elapsed); +} + } // namespace states } // namespace ui |
