From 92aac69b36d37ace8d2e06721cfa5e488427dcdf Mon Sep 17 00:00:00 2001 From: Zughy <63455151+Zughy@users.noreply.github.com> Date: Sat, 2 Jan 2021 15:13:02 +0100 Subject: [PATCH] "Browse online content" formspec improvement (#10756) --- LICENSE.txt | 11 ++++ builtin/mainmenu/dlg_contentstore.lua | 68 +++++++++++++------------ textures/base/pack/cdb_add.png | Bin 0 -> 147 bytes textures/base/pack/cdb_clear.png | Bin 0 -> 182 bytes textures/base/pack/cdb_downloading.png | Bin 0 -> 201 bytes textures/base/pack/cdb_queued.png | Bin 0 -> 210 bytes textures/base/pack/cdb_update.png | Bin 0 -> 173 bytes textures/base/pack/cdb_viewonline.png | Bin 0 -> 191 bytes 8 files changed, 47 insertions(+), 32 deletions(-) create mode 100644 textures/base/pack/cdb_add.png create mode 100644 textures/base/pack/cdb_clear.png create mode 100644 textures/base/pack/cdb_downloading.png create mode 100644 textures/base/pack/cdb_queued.png create mode 100644 textures/base/pack/cdb_update.png create mode 100644 textures/base/pack/cdb_viewonline.png diff --git a/LICENSE.txt b/LICENSE.txt index 9fbd23723..9b8ee851a 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -11,6 +11,9 @@ http://creativecommons.org/licenses/by-sa/3.0/ textures/base/pack/refresh.png is under the Apache 2 license https://www.apache.org/licenses/LICENSE-2.0.html +Textures by Zughy are under CC BY-SA 4.0 +https://creativecommons.org/licenses/by-sa/4.0/ + Authors of media files ----------------------- Everything not listed in here: @@ -47,6 +50,14 @@ srifqi textures/base/pack/joystick_off.png textures/base/pack/minimap_btn.png +Zughy: + textures/base/pack/cdb_add.png + textures/base/pack/cdb_clear.png + textures/base/pack/cdb_downloading.png + textures/base/pack/cdb_queued.png + textures/base/pack/cdb_update.png + textures/base/pack/cdb_viewonline.png + License of Minetest source code ------------------------------- diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index 548bae67e..7f6b4b7e4 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -631,7 +631,7 @@ function store.get_formspec(dlgdata) "size[15.75,9.5]", "position[0.5,0.55]", - "style[status;border=false]", + "style[status,downloading,queued;border=false]", "container[0.375,0.375]", "field[0,0;7.225,0.8;search_string;;", core.formspec_escape(search_string), "]", @@ -658,7 +658,7 @@ function store.get_formspec(dlgdata) } if number_downloading > 0 then - formspec[#formspec + 1] = "button[12.75,0.375;2.625,0.8;status;" + formspec[#formspec + 1] = "button[12.75,0.375;2.625,0.8;downloading;" if #download_queue > 0 then formspec[#formspec + 1] = fgettext("$1 downloading,\n$2 queued", number_downloading, #download_queue) else @@ -702,11 +702,17 @@ function store.get_formspec(dlgdata) } end + -- download/queued tooltips always have the same message + local tooltip_colors = ";#dff6f5;#302c2e]" + formspec[#formspec + 1] = "tooltip[downloading;" .. fgettext("Downloading...") .. tooltip_colors + formspec[#formspec + 1] = "tooltip[queued;" .. fgettext("Queued") .. tooltip_colors + local start_idx = (cur_page - 1) * num_per_page + 1 for i=start_idx, math.min(#store.packages, start_idx+num_per_page-1) do local package = store.packages[i] + local container_y = (i - start_idx) * 1.375 + (2*0.375 + 0.8) formspec[#formspec + 1] = "container[0.375," - formspec[#formspec + 1] = (i - start_idx) * 1.375 + (2*0.375 + 0.8) + formspec[#formspec + 1] = container_y formspec[#formspec + 1] = "]" -- image @@ -722,52 +728,50 @@ function store.get_formspec(dlgdata) formspec[#formspec + 1] = "]" -- buttons - local description_width = W - 0.375*5 - 1 - 2*1.5 + local left_base = "image_button[-1.55,0;0.7,0.7;" .. core.formspec_escape(defaulttexturedir) formspec[#formspec + 1] = "container[" formspec[#formspec + 1] = W - 0.375*2 formspec[#formspec + 1] = ",0.1]" if package.downloading then - formspec[#formspec + 1] = "button[-3.5,0;2,0.8;status;" - formspec[#formspec + 1] = fgettext("Downloading...") - formspec[#formspec + 1] = "]" + formspec[#formspec + 1] = "animated_image[-1.7,-0.15;1,1;downloading;" + formspec[#formspec + 1] = core.formspec_escape(defaulttexturedir) + formspec[#formspec + 1] = "cdb_downloading.png;3;400;]" elseif package.queued then - formspec[#formspec + 1] = "button[-3.5,0;2,0.8;status;" - formspec[#formspec + 1] = fgettext("Queued") - formspec[#formspec + 1] = "]" + formspec[#formspec + 1] = left_base + formspec[#formspec + 1] = core.formspec_escape(defaulttexturedir) + formspec[#formspec + 1] = "cdb_queued.png;queued]" elseif not package.path then - formspec[#formspec + 1] = "button[-3,0;1.5,0.8;install_" - formspec[#formspec + 1] = tostring(i) - formspec[#formspec + 1] = ";" - formspec[#formspec + 1] = fgettext("Install") - formspec[#formspec + 1] = "]" + local elem_name = "install_" .. i .. ";" + formspec[#formspec + 1] = "style[" .. elem_name .. "bgcolor=#71aa34]" + formspec[#formspec + 1] = left_base .. "cdb_add.png;" .. elem_name .. "]" + formspec[#formspec + 1] = "tooltip[" .. elem_name .. fgettext("Install") .. tooltip_colors else if package.installed_release < package.release then - description_width = description_width - 1.5 -- The install_ action also handles updating - formspec[#formspec + 1] = "button[-4.5,0;1.5,0.8;install_" - formspec[#formspec + 1] = tostring(i) - formspec[#formspec + 1] = ";" - formspec[#formspec + 1] = fgettext("Update") - formspec[#formspec + 1] = "]" - end + local elem_name = "install_" .. i .. ";" + formspec[#formspec + 1] = "style[" .. elem_name .. "bgcolor=#28ccdf]" + formspec[#formspec + 1] = left_base .. "cdb_update.png;" .. elem_name .. "]" + formspec[#formspec + 1] = "tooltip[" .. elem_name .. fgettext("Update") .. tooltip_colors + else - formspec[#formspec + 1] = "button[-3,0;1.5,0.8;uninstall_" - formspec[#formspec + 1] = tostring(i) - formspec[#formspec + 1] = ";" - formspec[#formspec + 1] = fgettext("Uninstall") - formspec[#formspec + 1] = "]" + local elem_name = "uninstall_" .. i .. ";" + formspec[#formspec + 1] = "style[" .. elem_name .. "bgcolor=#a93b3b]" + formspec[#formspec + 1] = left_base .. "cdb_clear.png;" .. elem_name .. "]" + formspec[#formspec + 1] = "tooltip[" .. elem_name .. fgettext("Uninstall") .. tooltip_colors + end end - formspec[#formspec + 1] = "button[-1.5,0;1.5,0.8;view_" - formspec[#formspec + 1] = tostring(i) - formspec[#formspec + 1] = ";" - formspec[#formspec + 1] = fgettext("View") - formspec[#formspec + 1] = "]" + local web_elem_name = "view_" .. i .. ";" + formspec[#formspec + 1] = "image_button[-0.7,0;0.7,0.7;" .. + core.formspec_escape(defaulttexturedir) .. "cdb_viewonline.png;" .. web_elem_name .. "]" + formspec[#formspec + 1] = "tooltip[" .. web_elem_name .. + fgettext("View more information in a web browser") .. tooltip_colors formspec[#formspec + 1] = "container_end[]" -- description + local description_width = W - 0.375*5 - 0.85 - 2*0.7 formspec[#formspec + 1] = "textarea[1.855,0.3;" formspec[#formspec + 1] = tostring(description_width) formspec[#formspec + 1] = ",0.8;;;" diff --git a/textures/base/pack/cdb_add.png b/textures/base/pack/cdb_add.png new file mode 100644 index 0000000000000000000000000000000000000000..3e3d067e33b98a39c1e07e17a611fa88eeb23281 GIT binary patch literal 147 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnH3?%tPCZz)@o&cW^S0KIZs!ic46U%BBo0DHI z0{M(3L4Lsu4$p3+0Xe3gE{-7;w~`YU$UTT^IQPJ(!6<^cz%Z<>Ev-?~+u3<>fMmhS q|M8FiKQ>~|V_o+4kG#frVTP$m0*-x0uSx?AVDNPHb6Mw<&;$S-YA!PX literal 0 HcmV?d00001 diff --git a/textures/base/pack/cdb_clear.png b/textures/base/pack/cdb_clear.png new file mode 100644 index 0000000000000000000000000000000000000000..4490d41cbc082cc9f2271daf2a3a52ca46dba680 GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnH3?%tPCZz)@o&cW^S0Me&LvN+Eb)1>=HJOB2 zKt5whkY6x^!?PP{Ku(0Gi(^Q|t>lCSb`O#gA{f##ObymH7%)XB@|+g9C}YrUZnA~p zOadRTEyKk!Q<+uqCM>5ocv~;@EL_MZFnRHOC*QbaR?|vm`If}ehDzQU2hSh)&{$Q+ Z$PoNa@QjJ(e~`-lg(ETw3ETp)z4*}Q$iB}B>zE{ literal 0 HcmV?d00001 diff --git a/textures/base/pack/cdb_queued.png b/textures/base/pack/cdb_queued.png new file mode 100644 index 0000000000000000000000000000000000000000..6972f7fb8328503589abfdb65cec902640e5f816 GIT binary patch literal 210 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnH3?%tPCZz)@o&cW^S0Mf6%)`lH5~`<4|e%426_ z0Qrn1L4Lsu4$p3+0XhDjE{-7;w~`YUNEjTF@ RIDtkpc)I$ztaD0e0sxzGGnoJY literal 0 HcmV?d00001 diff --git a/textures/base/pack/cdb_viewonline.png b/textures/base/pack/cdb_viewonline.png new file mode 100644 index 0000000000000000000000000000000000000000..ae2a146b855715506dcaacd5ec0fb55713762df2 GIT binary patch literal 191 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfv{s5m4S0Eh~9NbheWx?dW>-Vm$ z-@z#j6k;q1@(X5gcy=QV$cgiGaSW-rm7E|E(%|Xo$v9PiNr%#+6&g7jDlJPKJOXY6 z1Ozf}ZgpxuS3das?*KDHmN@U5yct51fi^LCy85}Sb4q9e08d;#XaE2J literal 0 HcmV?d00001