summaryrefslogtreecommitdiff
path: root/src/tangara/ui/ui_fsm.cpp
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2024-07-16 01:23:43 +0000
committercooljqln <cooljqln@noreply.codeberg.org>2024-07-16 01:23:43 +0000
commit0a271d786be4cc1a1691fa38f184a091721a5251 (patch)
tree9239449971dc9b9c8a261f1fd8076f0b03f57da8 /src/tangara/ui/ui_fsm.cpp
parent24fde7af0cc411e897e28ba4612105c4aa9bee18 (diff)
downloadtangara-fw-0a271d786be4cc1a1691fa38f184a091721a5251.tar.gz
daniel/playlist-queue (#83)
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/83 Reviewed-by: cooljqln <cooljqln@noreply.codeberg.org> Co-authored-by: ailurux <ailuruxx@gmail.com> Co-committed-by: ailurux <ailuruxx@gmail.com>
Diffstat (limited to 'src/tangara/ui/ui_fsm.cpp')
-rw-r--r--src/tangara/ui/ui_fsm.cpp6
1 files changed, 4 insertions, 2 deletions
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<int>(queue.totalSize()));
+ auto queue_size = queue.totalSize();
+ sQueueSize.setDirect(static_cast<int>(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);