forked from len0rd/rockbox
lua add a way to filter settings on read
rather than dumping all the settings allow a filter function to choose desired settings in menucoresettings you can see an how to do exact text matches or wilcard matches you can even use luas version of regex Change-Id: I4c7f7592498ea194e06e9a556b77ffd57f5d4223
This commit is contained in:
parent
dcff9b85a3
commit
e910f63bba
2 changed files with 17 additions and 8 deletions
|
@ -39,21 +39,27 @@ local function get_core_settings()
|
|||
|
||||
tmploader("rbsettings")
|
||||
tmploader("settings")
|
||||
-- these are exact matches color and talk are wildcard matches
|
||||
local list_settings = "cursor_style|show_icons|statusbar|scrollbar|scrollbar_width|list_separator_height|backdrop_file|"
|
||||
local function filterfn(struct, k)
|
||||
k = k or ""
|
||||
--rbold.splash(100, struct .. " " .. k)
|
||||
return (k:find("color") or k:find("talk") or list_settings:find(k))
|
||||
end
|
||||
local rb_settings = rb.settings.dump('global_settings', "system", nil, nil, filterfn)
|
||||
|
||||
local rb_settings = rb.settings.dump('global_settings', "system")
|
||||
local color_table = {}
|
||||
local talk_table = {}
|
||||
local list_settings_table = {}
|
||||
local list_settings = "cursor_style|show_icons|statusbar|scrollbar|scrollbar_width|list_separator_height|backdrop_file|"
|
||||
|
||||
for key, value in pairs(rb_settings) do
|
||||
key = key or ""
|
||||
if (key:find("color")) then
|
||||
color_table[key]=value
|
||||
color_table[key]=value
|
||||
elseif (key:find("talk")) then
|
||||
talk_table[key]=value
|
||||
elseif (list_settings:find(key)) then
|
||||
list_settings_table[key]=value
|
||||
talk_table[key]=value
|
||||
else --if (list_settings:find(key)) then
|
||||
list_settings_table[key]=value
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue