From 240abb939fee45e0d678368d4514b07003630e33 Mon Sep 17 00:00:00 2001 From: GHOST11111100 Date: Fri, 26 Sep 2025 21:39:12 +0300 Subject: [PATCH] Links (#615) * add URL support to Label element and XML parsing * refactor Label URL handling to use getter method in setURL * implement URL opening confirmation dialog and platform-specific URL handling * fix: fixed build errors * remove: delete test link label from worlds.xml * refactor: remove URL handling from Label class and XML parsing * refactor: clean up Label class by removing unnecessary whitespace and improving code readability * refactor: remove unused URL member from Label class * refactor: remove unused URL attribute from XML UI documentation and related code * refactor: improve code readability by adding whitespace and formatting adjustments in Label class * refactor: improve whitespace consistency in Label class and add URL opening functionality in libcore --- res/layouts/pages/worlds.xml | 1 - res/texts/be_BY.txt | 1 + res/texts/de_DE.txt | 1 + res/texts/fi_FI.txt | 1 + res/texts/pl_PL.txt | 1 + res/texts/ru_RU.txt | 1 + res/texts/uk_UA.txt | 1 + res/texts/uz_UZ.txt | 1 + src/graphics/ui/gui_util.cpp | 9 ++++-- src/logic/scripting/lua/libs/libcore.cpp | 24 +++++++++++++++ src/util/platform.cpp | 37 +++++++++++++++++++++++- src/util/platform.hpp | 1 + 12 files changed, 75 insertions(+), 4 deletions(-) diff --git a/res/layouts/pages/worlds.xml b/res/layouts/pages/worlds.xml index 13765930..a8a536a2 100644 --- a/res/layouts/pages/worlds.xml +++ b/res/layouts/pages/worlds.xml @@ -1,5 +1,4 @@ - diff --git a/res/texts/be_BY.txt b/res/texts/be_BY.txt index 879e5a35..1fb2a993 100644 --- a/res/texts/be_BY.txt +++ b/res/texts/be_BY.txt @@ -25,6 +25,7 @@ Grant %{0} pack modification permission?=Выдаць дазвол на мады Error at line %{0}=Памылка ў радку %{0} Run=Запусціць Filter=Фільтр +Are you sure you want to open the link: =Ці вы ўпэўненыя, што хочаце адкрыць спасылку: editor.info.tooltip=CTRL+S - Захаваць\nCTRL+R - Запусціць\nCTRL+Z - Скасаваць\nCTRL+Y - Паўтарыць devtools.traceback=Стэк выклікаў (ад апошняга) diff --git a/res/texts/de_DE.txt b/res/texts/de_DE.txt index 8e125159..81c39571 100644 --- a/res/texts/de_DE.txt +++ b/res/texts/de_DE.txt @@ -7,6 +7,7 @@ Back=Zurück Continue=Weitermachen Add=Hinzufügen Converting world...=Weltkonvertierung im Gange... +Are you sure you want to open the link: =Sind Sie sicher, dass Sie den Link öffnen möchten: error.pack-not-found=Paket konnte nicht gefunden werden error.dependency-not-found=Die verwendete Abhängigkeit wurde nicht gefunden diff --git a/res/texts/fi_FI.txt b/res/texts/fi_FI.txt index 52f4b3e0..6a21f73f 100644 --- a/res/texts/fi_FI.txt +++ b/res/texts/fi_FI.txt @@ -19,6 +19,7 @@ Problems=Ongelmia Monitor=Valvonta Debug=Virheenkorjaus File=Tiedosto +Are you sure you want to open the link: =Haluatko varmasti avata linkin: devtools.traceback=Puhelupino (viimeisestä) error.pack-not-found=Pakettia ei löytynyt! diff --git a/res/texts/pl_PL.txt b/res/texts/pl_PL.txt index caae775b..3e039824 100644 --- a/res/texts/pl_PL.txt +++ b/res/texts/pl_PL.txt @@ -7,6 +7,7 @@ Back=Powrót Continue=Kontynuacja Add=Dodać Converting world...=Konwersja świata w toku... +Are you sure you want to open the link: =Czy na pewno chcesz otworzyć link: error.pack-not-found=Nie udało się znaleźć pakietu diff --git a/res/texts/ru_RU.txt b/res/texts/ru_RU.txt index 084e11b3..1c650560 100644 --- a/res/texts/ru_RU.txt +++ b/res/texts/ru_RU.txt @@ -25,6 +25,7 @@ Grant %{0} pack modification permission?=Выдать разрешение на Error at line %{0}=Ошибка на строке %{0} Run=Запустить Filter=Фильтр +Are you sure you want to open the link: =Вы уверены, что хотите открыть ссылку: editor.info.tooltip=CTRL+S - Сохранить\nCTRL+R - Запустить\nCTRL+Z - Отменить\nCTRL+Y - Повторить devtools.traceback=Стек вызовов (от последнего) diff --git a/res/texts/uk_UA.txt b/res/texts/uk_UA.txt index 7ce046ea..a288f516 100644 --- a/res/texts/uk_UA.txt +++ b/res/texts/uk_UA.txt @@ -23,6 +23,7 @@ devtools.traceback=Стек викликів (від останнього) error.pack-not-found=Не вдалося знайти пакет error.dependency-not-found=Використовувана залежність не знайдена pack.remove-confirm=Видалити весь контент, що постачається паком/паками зі світу (безповоротно)? +Are you sure you want to open the link: =Ви впевнені, що хочете відкрити посилання: # Меню menu.Apply=Застосувати diff --git a/res/texts/uz_UZ.txt b/res/texts/uz_UZ.txt index 845c0cf5..edae1c02 100644 --- a/res/texts/uz_UZ.txt +++ b/res/texts/uz_UZ.txt @@ -24,6 +24,7 @@ Save=Saqlash Grant %{0} pack modification permission?=%{0} to‘plamini o‘zgartirish ruxsatini berilsinmi? Error at line %{0}=%{0}-qatorida xatolik Run=Ishga tushirish +Are you sure you want to open the link: =Haqiqatan ham havolani ochmoqchimisiz: editor.info.tooltip=CTRL+S - Saqlash\nCTRL+R - Ishga tushirish\nCTRL+Z - Bekor qilish\nCTRL+Y - Qayta bajarish devtools.traceback=Chaqiruvlar steki (so`nggisidan boshlab) diff --git a/src/graphics/ui/gui_util.cpp b/src/graphics/ui/gui_util.cpp index 6d28b990..4e521715 100644 --- a/src/graphics/ui/gui_util.cpp +++ b/src/graphics/ui/gui_util.cpp @@ -103,9 +103,14 @@ void guiutil::confirm( panel->setGravity(Gravity::center_center); container->add(panel); - panel->setColor(glm::vec4(0.0f, 0.0f, 0.0f, 0.5f)); - panel->add(std::make_shared