1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

ContentDB redesign: Add package dialog

Co-authored-by: Gregor Parzefall <gregor.parzefall@posteo.de>
This commit is contained in:
rubenwardy 2024-03-31 19:24:27 +01:00
parent 05cbd84ae0
commit 78aab8c95d
12 changed files with 529 additions and 130 deletions

View file

@ -41,6 +41,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "content/mod_configuration.h"
#include "threading/mutex_auto_lock.h"
#include "common/c_converter.h"
#include "gui/guiOpenURL.h"
/******************************************************************************/
std::string ModApiMainMenu::getTextData(lua_State *L, const std::string &name)
@ -1038,6 +1039,13 @@ int ModApiMainMenu::l_get_max_supp_proto(lua_State *L)
return 1;
}
/******************************************************************************/
int ModApiMainMenu::l_get_formspec_version(lua_State *L)
{
lua_pushinteger(L, FORMSPEC_API_VERSION);
return 1;
}
/******************************************************************************/
int ModApiMainMenu::l_open_url(lua_State *L)
{
@ -1046,6 +1054,22 @@ int ModApiMainMenu::l_open_url(lua_State *L)
return 1;
}
/******************************************************************************/
int ModApiMainMenu::l_open_url_dialog(lua_State *L)
{
GUIEngine* engine = getGuiEngine(L);
sanity_check(engine != NULL);
std::string url = luaL_checkstring(L, 1);
GUIOpenURLMenu* openURLMenu =
new GUIOpenURLMenu(engine->m_rendering_engine->get_gui_env(),
engine->m_parent, -1, engine->m_menumanager,
engine->m_texture_source.get(), url);
openURLMenu->drop();
return 1;
}
/******************************************************************************/
int ModApiMainMenu::l_open_dir(lua_State *L)
{
@ -1136,7 +1160,9 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
API_FCT(get_active_irrlicht_device);
API_FCT(get_min_supp_proto);
API_FCT(get_max_supp_proto);
API_FCT(get_formspec_version);
API_FCT(open_url);
API_FCT(open_url_dialog);
API_FCT(open_dir);
API_FCT(share_file);
API_FCT(do_async_callback);
@ -1166,6 +1192,7 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
API_FCT(download_file);
API_FCT(get_min_supp_proto);
API_FCT(get_max_supp_proto);
API_FCT(get_formspec_version);
API_FCT(get_language);
API_FCT(gettext);
}

View file

@ -159,9 +159,13 @@ private:
static int l_get_max_supp_proto(lua_State *L);
static int l_get_formspec_version(lua_State *L);
// other
static int l_open_url(lua_State *L);
static int l_open_url_dialog(lua_State *L);
static int l_open_dir(lua_State *L);
static int l_share_file(lua_State *L);