summaryrefslogtreecommitdiff
path: root/src/ui/ui_fsm.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-07-17 16:54:35 +1000
committerjacqueline <me@jacqueline.id.au>2023-07-17 16:54:35 +1000
commit7197da21f6bcc1aaa5d1905228e0e2ec1caf3fa8 (patch)
treef24f81cba08160d45d7e994dc31f48506e823e49 /src/ui/ui_fsm.cpp
parentb6bc6b9e47605ede9bffe50445d1afe3acf0ab49 (diff)
downloadtangara-fw-7197da21f6bcc1aaa5d1905228e0e2ec1caf3fa8.tar.gz
Basic playlists for upcoming
Beware under-testing and bugs. Just getting something barebones in so that I can do rN+1 bringup
Diffstat (limited to 'src/ui/ui_fsm.cpp')
-rw-r--r--src/ui/ui_fsm.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp
index 96949cd0..a9c3b61c 100644
--- a/src/ui/ui_fsm.cpp
+++ b/src/ui/ui_fsm.cpp
@@ -17,6 +17,7 @@
#include "screen_playing.hpp"
#include "screen_splash.hpp"
#include "screen_track_browser.hpp"
+#include "source.hpp"
#include "system_events.hpp"
#include "touchwheel.hpp"
#include "track_queue.hpp"
@@ -117,20 +118,21 @@ void Browse::react(const internal::RecordSelected& ev) {
return;
}
- if (ev.record.track()) {
- ESP_LOGI(kTag, "selected track '%s'", ev.record.text()->c_str());
- // TODO(jacqueline): We should also send some kind of playlist info here.
+ auto record = ev.page->values().at(ev.record);
+ if (record.track()) {
+ ESP_LOGI(kTag, "selected track '%s'", record.text()->c_str());
sQueue->Clear();
- sQueue->AddLast(*ev.record.track());
+ sQueue->IncludeLast(std::make_shared<playlist::IndexRecordSource>(
+ sDb, ev.initial_page, 0, ev.page, ev.record));
transit<Playing>();
} else {
- ESP_LOGI(kTag, "selected record '%s'", ev.record.text()->c_str());
- auto cont = ev.record.Expand(kRecordsPerPage);
+ ESP_LOGI(kTag, "selected record '%s'", record.text()->c_str());
+ auto cont = record.Expand(kRecordsPerPage);
if (!cont) {
return;
}
auto query = db->GetPage(&cont.value());
- std::string title = ev.record.text().value_or("TODO");
+ std::string title = record.text().value_or("TODO");
PushScreen(
std::make_shared<screens::TrackBrowser>(sDb, title, std::move(query)));
}