summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/main.lua2
-rw-r--r--lua/settings.lua29
-rw-r--r--lua/widgets.lua26
3 files changed, 52 insertions, 5 deletions
diff --git a/lua/main.lua b/lua/main.lua
index 12705c00..5be79c9a 100644
--- a/lua/main.lua
+++ b/lua/main.lua
@@ -74,7 +74,7 @@ local function init_ui()
end
end
end),
- controls.scheme:bind(function()
+ controls.wheel_scheme:bind(function()
-- Set up a shortcut for jumping straight to the 'now playing' screen.
-- Implemented as a binding so that the shortcut is still applied even if
-- the control scheme is changed at runtime.
diff --git a/lua/settings.lua b/lua/settings.lua
index 5ed93521..d60ecfda 100644
--- a/lua/settings.lua
+++ b/lua/settings.lua
@@ -471,20 +471,33 @@ settings.InputSettings = SettingsScreen:new {
controls_chooser:onevent(lvgl.EVENT.VALUE_CHANGED, function()
local option = controls_chooser:get('selected')
local scheme = option_to_scheme[option]
- control_scheme:set(scheme)
+ local prev_scheme = control_scheme:get()
+ -- Check the new scheme is valid
+ if not control_scheme:set(scheme) then
+ widgets.PopUp("Controls not valid")
+ control_scheme:set(prev_scheme)
+ end
end)
return controls_chooser
end
theme.set_subject(self.content:Label {
- text = "Control scheme",
+ text = "Wheel Controls",
}, "settings_title")
- local controls_chooser = make_scheme_control(self, controls.schemes(), controls.scheme)
+ local controls_chooser = make_scheme_control(self, controls.wheel_schemes(), controls.wheel_scheme)
local controls_chooser_desc = widgets.Description(controls_chooser, "Control scheme")
theme.set_subject(self.content:Label {
- text = "Control scheme when locked",
+ text = "Side Button Controls",
+ }, "settings_title")
+ make_scheme_control(self, controls.button_schemes(), controls.button_scheme)
+
+ theme.set_subject(self.content:Label {
+ text = "Side Button Controls When Locked",
+ w = lvgl.PCT(80),
+ h = lvgl.SIZE_CONTENT,
+ long_mode = lvgl.LABEL.LONG_WRAP,
}, "settings_title")
local controls_locked = make_scheme_control(self, controls.locked_schemes(), controls.locked_scheme)
local controls_locked_desc = widgets.Description(controls_locked, "Control scheme when locked")
@@ -510,6 +523,14 @@ settings.InputSettings = SettingsScreen:new {
controls.scroll_sensitivity:set(sensitivity:value() * slider_scale)
end)
local sensitivity_desc = widgets.Description(sensitivity, "Scroll Sensitivity")
+
+ local spacer = self.content:Object {
+ w = lvgl.PCT(90),
+ h = 10,
+ }
+ sensitivity:onevent(lvgl.EVENT.FOCUSED, function()
+ spacer:scroll_to_view(true)
+ end)
end
}
diff --git a/lua/widgets.lua b/lua/widgets.lua
index de2aa43d..5e2ed858 100644
--- a/lua/widgets.lua
+++ b/lua/widgets.lua
@@ -372,4 +372,30 @@ function widgets.InfiniteList(parent, iterator, opts)
return infinite_list
end
+function widgets.PopUp(text)
+ require("alerts").show(function()
+ local container = lvgl.Object(nil, {
+ w = lvgl.PCT(80),
+ h = lvgl.SIZE_CONTENT,
+ flex = {
+ flex_direction = "column",
+ justify_content = "center",
+ align_items = "center",
+ align_content = "center",
+ },
+ radius = 8,
+ pad_all = 5,
+ })
+ theme.set_subject(container, "pop_up")
+ container:Label {
+ text = text,
+ text_font = font.fusion_10,
+ w = lvgl.PCT(100),
+ h = lvgl.SIZE_CONTENT,
+ long_mode = lvgl.LABEL.LONG_WRAP,
+ }
+ container:center()
+ end)
+end
+
return widgets