Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings GUI: Hide advanced settings by default #13730

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions builtin/mainmenu/settings/dlg_settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ local function get_formspec(dialogdata)

local technical_names_w = TOUCHSCREEN_GUI and 6 or 5
local show_technical_names = core.settings:get_bool("show_technical_names")
local show_advanced = core.settings:get_bool("show_advanced")

formspec_show_hack = not formspec_show_hack

Expand All @@ -407,6 +408,12 @@ local function get_formspec(dialogdata)
tabsize.width - technical_names_w + 0.25, tabsize.height + 0.6,
fgettext("Show technical names"), tostring(show_technical_names)),

("box[%f,%f;%f,0.8;#0000008C]"):format(
tabsize.width - technical_names_w*2 - 0.25, tabsize.height + 0.2, technical_names_w),
("checkbox[%f,%f;show_advanced;%s;%s]"):format(
tabsize.width - technical_names_w*2, tabsize.height + 0.6,
fgettext("Show advanced settings"), tostring(show_advanced)),

"field[0.25,0.25;", tostring(search_width), ",0.75;search_query;;",
core.formspec_escape(dialogdata.query or ""), "]",
"container[", tostring(search_width + 0.25), ", 0.25]",
Expand Down Expand Up @@ -540,6 +547,17 @@ local function buttonhandler(this, fields)
return true
end

if fields.show_advanced ~= nil then
local value = core.is_yes(fields.show_advanced)
core.settings:set_bool("show_advanced", value)

dialogdata.components = nil
dialogdata.leftscroll = 0
dialogdata.rightscroll = 0
dialogdata.page_id = update_filtered_pages(dialogdata.query)
return true
end

if fields.search or fields.key_enter_field == "search_query" then
dialogdata.components = nil
dialogdata.leftscroll = 0
Expand Down