From 7bf0b1fc7e7aea06988586544bd36b15948c63de Mon Sep 17 00:00:00 2001 From: siliconsniffer <97843108+siliconsniffer@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:04:26 +0100 Subject: [PATCH] Add server url button to main menu (#15536) Co-authored-by: Zughy <63455151+Zughy@users.noreply.github.com> --- LICENSE.txt | 1 + builtin/mainmenu/tab_online.lua | 12 ++++++++++++ textures/base/pack/server_url.png | Bin 0 -> 356 bytes 3 files changed, 13 insertions(+) create mode 100644 textures/base/pack/server_url.png diff --git a/LICENSE.txt b/LICENSE.txt index fb055807b..f7930f528 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -63,6 +63,7 @@ Zughy: textures/base/pack/settings_btn.png textures/base/pack/settings_info.png textures/base/pack/settings_reset.png + textures/base/pack/server_url.png textures/base/pack/server_view_clients.png appgurueu: diff --git a/builtin/mainmenu/tab_online.lua b/builtin/mainmenu/tab_online.lua index b8257b90a..12192715f 100644 --- a/builtin/mainmenu/tab_online.lua +++ b/builtin/mainmenu/tab_online.lua @@ -179,6 +179,13 @@ local function get_formspec(tabview, name, tabdata) "server_view_clients.png") .. ";btn_view_clients;]" end + if selected_server.url then + retval = retval .. "tooltip[btn_server_url;" .. fgettext("Open server website") .. "]" + retval = retval .. "style[btn_server_url;padding=6]" + retval = retval .. "image_button[" .. (can_view_clients_list and "4" or "4.5") .. ",1.3;0.5,0.5;" .. + core.formspec_escape(defaulttexturedir .. "server_url.png") .. ";btn_server_url;]" + end + if is_selected_fav() then retval = retval .. "tooltip[btn_delete_favorite;" .. fgettext("Remove favorite") .. "]" retval = retval .. "style[btn_delete_favorite;padding=6]" @@ -367,6 +374,11 @@ local function main_button_handler(tabview, fields, name, tabdata) return true end + if fields.btn_server_url then + core.open_url_dialog(find_selected_server().url) + return true + end + if fields.btn_view_clients then local dlg = create_clientslist_dialog(find_selected_server()) dlg:set_parent(tabview) diff --git a/textures/base/pack/server_url.png b/textures/base/pack/server_url.png new file mode 100644 index 0000000000000000000000000000000000000000..3f04900833fe4df446a6d7eedf2d00b22afbc404 GIT binary patch literal 356 zcmeAS@N?(olHy`uVBq!ia0vp^3qY8K8Aw(>tdav#asfUet_C`Ksqr!4K>?wDem<^l zKrT?`{ z*7;}I>^5_8L-IsTe*qlcq603 zfkO}0)l{th_vTbvqyB6rmNlGaroqaa1#X_n;u6@PR