summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorRobin Howard <robin@rhoward.id.au>2024-01-21 18:13:49 +1100
committerRobin Howard <buzzyrobin@noreply.codeberg.org>2024-01-23 02:30:18 +0000
commit3f1fadbeef571a6653f5648c2b78073ddd37d169 (patch)
tree823237ccbea7dedf5dd9cbb4a317d38b502631a3 /src/ui
parent9b63f14cb8d2978fa1293997b541fb2a935cb89e (diff)
downloadtangara-fw-3f1fadbeef571a6653f5648c2b78073ddd37d169.tar.gz
Plumb queue next+previous through to Lua, incl. with stubs and docs.
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/include/ui_fsm.hpp3
-rw-r--r--src/ui/ui_fsm.cpp26
2 files changed, 23 insertions, 6 deletions
diff --git a/src/ui/include/ui_fsm.hpp b/src/ui/include/ui_fsm.hpp
index 9de1169b..3ddef738 100644
--- a/src/ui/include/ui_fsm.hpp
+++ b/src/ui/include/ui_fsm.hpp
@@ -164,6 +164,9 @@ class Lua : public UiState {
auto SetPlaying(const lua::LuaValue&) -> bool;
auto SetRandom(const lua::LuaValue&) -> bool;
auto SetRepeat(const lua::LuaValue&) -> bool;
+
+ auto QueueNext(lua_State*) -> int;
+ auto QueuePrevious(lua_State*) -> int;
};
} // namespace states
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());