1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Implement search tab and version picker

This commit is contained in:
sapier 2013-12-11 23:07:38 +01:00
parent dfd1f87762
commit 4ccaa6d0af
8 changed files with 466 additions and 190 deletions

View file

@ -210,7 +210,7 @@ ModStoreModDetails readModStoreModDetails(Json::Value& details) {
}
if (retval.versions.size() < 1) {
errorstream << "readModStoreModDetails: not a single version specified!" << std::endl;
infostream << "readModStoreModDetails: not a single version specified!" << std::endl;
retval.valid = false;
}

View file

@ -156,7 +156,7 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
m_sound_manager = &dummySoundManager;
//create topleft header
core::rect<s32> rect(0, 0, 500, 40);
core::rect<s32> rect(0, 0, 500, 20);
rect += v2s32(4, 0);
std::string t = std::string("Minetest ") + minetest_version_hash;

View file

@ -1856,7 +1856,7 @@ void GUIFormSpecMenu::drawMenu()
v2u32 screenSize = driver->getScreenSize();
core::rect<s32> allbg(0, 0, screenSize.X , screenSize.Y);
if (m_bgfullscreen)
if (m_bgfullscreen)
driver->draw2DRectangle(m_bgcolor, allbg, &allbg);
else
driver->draw2DRectangle(m_bgcolor, AbsoluteRect, &AbsoluteClippingRect);
@ -1959,7 +1959,7 @@ void GUIFormSpecMenu::drawMenu()
IItemDefManager *idef = m_gamedef->idef();
ItemStack item;
item.deSerialize(spec.name, idef);
video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef);
video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef);
// Image size on screen
core::rect<s32> imgrect(0, 0, spec.geom.X, spec.geom.Y);
// Image rectangle on screen
@ -1998,7 +1998,7 @@ void GUIFormSpecMenu::drawMenu()
if (spec.tooltip != "")
{
core::rect<s32> rect = spec.rect;
if (rect.isPointInside(m_pointer))
if (rect.isPointInside(m_pointer))
{
m_tooltip_element->setVisible(true);
this->bringToFront(m_tooltip_element);
@ -2168,7 +2168,7 @@ void GUIFormSpecMenu::acceptInput(bool quit=false)
for(u32 i=0; i<m_fields.size(); i++)
{
const FieldSpec &s = m_fields[i];
if(s.send)
if(s.send)
{
if(s.ftype == f_Button)
{
@ -2194,8 +2194,11 @@ void GUIFormSpecMenu::acceptInput(bool quit=false)
if ((element) && (element->getType() == gui::EGUIET_COMBO_BOX)) {
e = static_cast<gui::IGUIComboBox*>(element);
}
fields[wide_to_narrow(s.fname.c_str())] =
wide_to_narrow(e->getItem(e->getSelected()));
s32 selected = e->getSelected();
if (selected >= 0) {
fields[wide_to_narrow(s.fname.c_str())] =
wide_to_narrow(e->getItem(selected));
}
}
else if (s.ftype == f_TabHeader) {
// no dynamic cast possible due to some distributions shipped
@ -2662,7 +2665,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
for(u32 i=0; i<m_fields.size(); i++)
{
FieldSpec &s = m_fields[i];
// if its a button, set the send field so
// if its a button, set the send field so
// lua knows which button was pressed
if (((s.ftype == f_Button) || (s.ftype == f_CheckBox)) &&
(s.fid == event.GUIEvent.Caller->getID()))

View file

@ -336,6 +336,26 @@ int ModApiMainMenu::l_get_modstore_details(lua_State *L)
lua_pushstring(L,current_mod.versions[0].file.c_str());
lua_settable(L, top);
lua_pushstring(L,"versions");
lua_newtable(L);
int versionstop = lua_gettop(L);
for (unsigned int i=0;i < current_mod.versions.size(); i++) {
lua_pushnumber(L,i+1);
lua_newtable(L);
int current_element = lua_gettop(L);
lua_pushstring(L,"date");
lua_pushstring(L,current_mod.versions[i].date.c_str());
lua_settable(L,current_element);
lua_pushstring(L,"download_url");
lua_pushstring(L,current_mod.versions[i].file.c_str());
lua_settable(L,current_element);
lua_settable(L,versionstop);
}
lua_settable(L, top);
lua_pushstring(L,"screenshot_url");
lua_pushstring(L,current_mod.titlepic.file.c_str());
lua_settable(L, top);
@ -782,7 +802,10 @@ int ModApiMainMenu::l_extract_zip(lua_State *L)
io::IFileSystem* fs = engine->m_device->getFileSystem();
fs->addFileArchive(zipfile,true,false,io::EFAT_ZIP);
if (!fs->addFileArchive(zipfile,true,false,io::EFAT_ZIP)) {
lua_pushboolean(L,false);
return 1;
}
assert(fs->getFileArchiveCount() > 0);