From 3f1fadbeef571a6653f5648c2b78073ddd37d169 Mon Sep 17 00:00:00 2001 From: Robin Howard Date: Sun, 21 Jan 2024 18:13:49 +1100 Subject: Plumb queue next+previous through to Lua, incl. with stubs and docs. --- src/ui/ui_fsm.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/ui/ui_fsm.cpp') diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp index e532e693..fe790816 100644 --- a/src/ui/ui_fsm.cpp +++ b/src/ui/ui_fsm.cpp @@ -396,12 +396,16 @@ void Lua::entry() { {"track", &sPlaybackTrack}, {"position", &sPlaybackPosition}, }); - sLua->bridge().AddPropertyModule("queue", { - {"position", &sQueuePosition}, - {"size", &sQueueSize}, - {"replay", &sQueueRepeat}, - {"random", &sQueueRandom}, - }); + sLua->bridge().AddPropertyModule( + "queue", + { + {"next", [&](lua_State* s) { return QueueNext(s); }}, + {"previous", [&](lua_State* s) { return QueuePrevious(s); }}, + {"position", &sQueuePosition}, + {"size", &sQueueSize}, + {"replay", &sQueueRepeat}, + {"random", &sQueueRandom}, + }); sLua->bridge().AddPropertyModule("volume", { {"current_pct", &sVolumeCurrentPct}, @@ -476,6 +480,16 @@ auto Lua::PushLuaScreen(lua_State* s) -> int { return 0; } +auto Lua::QueueNext(lua_State*) -> int { + sServices->track_queue().next(); + return 0; +} + +auto Lua::QueuePrevious(lua_State*) -> int { + sServices->track_queue().previous(); + return 0; +} + auto Lua::PopLuaScreen(lua_State* s) -> int { PopScreen(); luavgl_set_root(s, sCurrentScreen->content()); -- cgit v1.2.3