From 0a271d786be4cc1a1691fa38f184a091721a5251 Mon Sep 17 00:00:00 2001 From: ailurux Date: Tue, 16 Jul 2024 01:23:43 +0000 Subject: daniel/playlist-queue (#83) Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/83 Reviewed-by: cooljqln Co-authored-by: ailurux Co-committed-by: ailurux --- src/tangara/ui/ui_fsm.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/tangara/ui/ui_fsm.cpp') diff --git a/src/tangara/ui/ui_fsm.cpp b/src/tangara/ui/ui_fsm.cpp index c5ede83c..476732db 100644 --- a/src/tangara/ui/ui_fsm.cpp +++ b/src/tangara/ui/ui_fsm.cpp @@ -398,10 +398,12 @@ void UiState::react(const system_fsm::BatteryStateChanged& ev) { void UiState::react(const audio::QueueUpdate&) { auto& queue = sServices->track_queue(); - sQueueSize.setDirect(static_cast(queue.totalSize())); + auto queue_size = queue.totalSize(); + sQueueSize.setDirect(static_cast(queue_size)); int current_pos = queue.currentPosition(); - if (queue.current()) { + // If there is nothing in the queue, the position should be 0, otherwise, add one because lua + if (queue_size > 0) { current_pos++; } sQueuePosition.setDirect(current_pos); -- cgit v1.2.3