Title menu revisions

This commit is contained in:
Functioning Member of Society 2022-10-09 14:58:24 -04:00
parent 5744acae16
commit 81e67359f0
3 changed files with 26 additions and 17 deletions

View File

@ -39,7 +39,7 @@ local screenshot_downloaded = {}
local search_string = "" local search_string = ""
local cur_page = 1 local cur_page = 1
local num_per_page = 5 local num_per_page = 5
local filter_type = 1 local filter_type = -1
local filter_types_titles = { local filter_types_titles = {
fgettext("All packages"), fgettext("All packages"),
fgettext("Games"), fgettext("Games"),
@ -434,6 +434,8 @@ function install_dialog.get_formspec()
end end
function install_dialog.handle_submit(this, fields) function install_dialog.handle_submit(this, fields)
store.filter_packages(search_string)
if fields.cancel then if fields.cancel then
this:delete() this:delete()
return true return true
@ -713,12 +715,13 @@ function store.filter_packages(query)
for k = 1, #keywords do for k = 1, #keywords do
local keyword = keywords[k] local keyword = keywords[k]
if string.find(package.name:lower(), keyword, 1, true) or if string.find(package.author:lower(), keyword, 1, true) then
string.find(package.title:lower(), keyword, 1, true) or
string.find(package.author:lower(), keyword, 1, true) or
string.find(package.short_description:lower(), keyword, 1, true) then
return true return true
end end
--if string.find(package.name:lower(), keyword, 1, true) or string.find(package.title:lower(), keyword, 1, true) or string.find(package.author:lower(), keyword, 1, true) or string.find(package.short_description:lower(), keyword, 1, true) then
-- return true
--end
end end
return false return false
@ -736,6 +739,8 @@ end
function store.get_formspec(dlgdata) function store.get_formspec(dlgdata)
store.update_paths() store.update_paths()
dlgdata.pagemax = math.max(math.ceil(#store.packages / num_per_page), 1) dlgdata.pagemax = math.max(math.ceil(#store.packages / num_per_page), 1)
if cur_page > dlgdata.pagemax then if cur_page > dlgdata.pagemax then
cur_page = 1 cur_page = 1
@ -899,10 +904,15 @@ function store.get_formspec(dlgdata)
formspec[#formspec + 1] = "container_end[]" formspec[#formspec + 1] = "container_end[]"
end end
return table.concat(formspec, "") return table.concat(formspec, "")
end end
function store.handle_submit(this, fields) function store.handle_submit(this, fields)
if fields.search or fields.key_enter_field == "search_string" then if fields.search or fields.key_enter_field == "search_string" then
search_string = fields.search_string:trim() search_string = fields.search_string:trim()
cur_page = 1 cur_page = 1
@ -913,7 +923,7 @@ function store.handle_submit(this, fields)
if fields.clear then if fields.clear then
search_string = "" search_string = ""
cur_page = 1 cur_page = 1
store.filter_packages("") store.filter_packages(search_string)
return true return true
end end

View File

@ -15,13 +15,13 @@
--with this program; if not, write to the Free Software Foundation, Inc., --with this program; if not, write to the Free Software Foundation, Inc.,
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
mt_color_grey = "#AAAAAA" mt_color_grey = "#AAAAFF"
mt_color_blue = "#6389FF" mt_color_blue = "#6389FF"
mt_color_lightblue = "#99CCFF" mt_color_lightblue = "#99CCFF"
mt_color_green = "#72FF63" mt_color_green = "#7264F3"
mt_color_dark_green = "#25C191" mt_color_dark_green = "#25C1F1"
mt_color_orange = "#FF8800" mt_color_orange = "#FF6600"
mt_color_red = "#FF3300" mt_color_red = "#FF0000"
local menupath = core.get_mainmenu_path() local menupath = core.get_mainmenu_path()
local basepath = core.get_builtin_path() local basepath = core.get_builtin_path()
@ -95,7 +95,7 @@ local function init_globals()
mm_game_theme.init() mm_game_theme.init()
-- Create main tabview -- Create main tabview
local tv_main = tabview_create("maintab", {x = 12, y = 5.4}, {x = 0, y = 0}) --[[local tv_main = tabview_create("maintab", {x = 12, y = 5.4}, {x = 0, y = 0})
-- note: size would be 15.5,7.1 in real coordinates mode -- note: size would be 15.5,7.1 in real coordinates mode
tv_main:set_autosave_tab(true) tv_main:set_autosave_tab(true)
@ -123,11 +123,11 @@ local function init_globals()
if game == nil then if game == nil then
mm_game_theme.reset() mm_game_theme.reset()
end end
end end]]
ui.set_default("maintab") --ui.set_default("maintab")
check_new_version() check_new_version()
tv_main:show() --tv_main:show()
ui.update() ui.update()
end end

View File

@ -20,7 +20,6 @@
local xtreemtest_developers = { local xtreemtest_developers = {
"Migdyn (a.k.a. Mike) <xtreemsex@testing.cubesoftware.xyz> [XtreemTest founder]", "Migdyn (a.k.a. Mike) <xtreemsex@testing.cubesoftware.xyz> [XtreemTest founder]",
"Looki2000", "Looki2000",
"Kacper Kostka <kacperks@cubesoftware.xyz>",
} }
local core_developers = { local core_developers = {
@ -165,7 +164,7 @@ return {
"style[label_button;border=false]" .. "style[label_button;border=false]" ..
"button[0.1,3.4;5.3,0.5;label_button;" .. "button[0.1,3.4;5.3,0.5;label_button;" ..
core.formspec_escape(version.project .. " " .. version.string) .. "]" .. core.formspec_escape(version.project .. " " .. version.string) .. "]" ..
"button[1.5,4.1;2.5,0.8;homepage;mcl.sovnat.info]" .. "button[0.5,4.1;4.5,0.8;homepage;mcl.sovnat.info]" ..
"scroll_container[5.5,0.1;9.5,6.9;scroll_credits;vertical;" .. "scroll_container[5.5,0.1;9.5,6.9;scroll_credits;vertical;" ..
tostring(scroll_height / 1000) .. "]" .. credit_fs .. tostring(scroll_height / 1000) .. "]" .. credit_fs ..
"scroll_container_end[]".. "scroll_container_end[]"..