diff options
| author | ailurux <ailuruxx@gmail.com> | 2023-07-08 12:58:07 +1000 |
|---|---|---|
| committer | ailurux <ailuruxx@gmail.com> | 2023-07-08 12:58:07 +1000 |
| commit | 3de310f6e4c170c4c4bfb789cb07ca10e5ab17b8 (patch) | |
| tree | 0d13d6efa758b8c029a35c73405529dcadde3788 /src/ui/include/screen_playing.hpp | |
| parent | daa3013836d619d920db3a9dc1f9cc988047a4b4 (diff) | |
| parent | 8f8bc1f088b389a683735d626cbce9adb1f6dc17 (diff) | |
| download | tangara-fw-3de310f6e4c170c4c4bfb789cb07ca10e5ab17b8.tar.gz | |
Merge branch 'main' of git.sr.ht:~jacqueline/tangara-fw
Diffstat (limited to 'src/ui/include/screen_playing.hpp')
| -rw-r--r-- | src/ui/include/screen_playing.hpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/src/ui/include/screen_playing.hpp b/src/ui/include/screen_playing.hpp index 3eae32a7..148f2774 100644 --- a/src/ui/include/screen_playing.hpp +++ b/src/ui/include/screen_playing.hpp @@ -6,25 +6,55 @@ #pragma once +#include <stdint.h> +#include <sys/_stdint.h> #include <memory> +#include <vector> #include "lvgl.h" #include "database.hpp" +#include "future_fetcher.hpp" #include "screen.hpp" +#include "track.hpp" +#include "track_queue.hpp" namespace ui { namespace screens { +/* + * The 'Now Playing' / 'Currently Playing' screen that contains information + * about the current track, as well as playback controls. + */ class Playing : public Screen { public: - explicit Playing(database::Track t); + explicit Playing(std::weak_ptr<database::Database> db, + audio::TrackQueue* queue); ~Playing(); - auto BindTrack(database::Track t) -> void; + auto Tick() -> void override; + + // Callbacks invoked by the UI state machine in response to audio events. + + auto OnTrackUpdate() -> void; + auto OnPlaybackUpdate(uint32_t, uint32_t) -> void; + auto OnQueueUpdate() -> void; private: - database::Track track_; + auto BindTrack(const database::Track& track) -> void; + auto ApplyNextUp(const std::vector<database::Track>& tracks) -> void; + + std::weak_ptr<database::Database> db_; + audio::TrackQueue* queue_; + + std::optional<database::Track> track_; + std::vector<database::Track> next_tracks_; + + std::unique_ptr<database::FutureFetcher<std::optional<database::Track>>> + new_track_; + std::unique_ptr< + database::FutureFetcher<std::vector<std::optional<database::Track>>>> + new_next_tracks_; lv_obj_t* artist_label_; lv_obj_t* album_label_; |
