GUI_ID_SERVERLIST,
GUI_ID_SERVERLIST_TOGGLE,
GUI_ID_SERVERLIST_DELETE,
+ GUI_ID_SERVERLIST_TITLE,
};
enum
changeCtype("");
// Server List
{
- core::rect<s32> rect(0, 0, 390, 160);
- rect += m_topleft_client + v2s32(50, 10);
+ core::rect<s32> rect(0, 0, 390, 140);
+ rect += m_topleft_client + v2s32(50, 30);
gui::IGUIListBox *e = Environment->addListBox(rect, this,
GUI_ID_SERVERLIST);
e->setDrawBackground(true);
- if (m_data->serverlist_show_available == false)
- m_data->servers = ServerList::getLocal();
#if USE_CURL
- else
+ if(m_data->selected_serverlist == SERVERLIST_FAVORITES) {
+ m_data->servers = ServerList::getLocal();
+ {
+ core::rect<s32> rect(0, 0, 110, 20);
+ rect += m_topleft_client + v2s32(50, 10);
+ Environment->addStaticText(wgettext("Favorites:"),
+ rect, false, true, this, GUI_ID_SERVERLIST_TITLE);
+ }
+ } else {
m_data->servers = ServerList::getOnline();
+ {
+ core::rect<s32> rect(0, 0, 110, 20);
+ rect += m_topleft_client + v2s32(50, 10);
+ Environment->addStaticText(wgettext("Public Server List:"),
+ rect, false, true, this, GUI_ID_SERVERLIST_TITLE);
+ }
+ }
+#else
+ m_data->servers = ServerList::getLocal();
+ {
+ core::rect<s32> rect(0, 0, 110, 20);
+ rect += m_topleft_client + v2s32(50, 10);
+ Environment->addStaticText(wgettext("Favorites:"),
+ rect, false, true, this, GUI_ID_SERVERLIST_TITLE);
+ }
#endif
updateGuiServerList();
e->setSelected(0);
gui::IGUIButton *e = Environment->addButton(rect, this, GUI_ID_SERVERLIST_TOGGLE,
wgettext("Show Public"));
e->setIsPushButton(true);
- if (m_data->serverlist_show_available)
+ if (m_data->selected_serverlist == SERVERLIST_PUBLIC)
{
e->setText(wgettext("Show Favorites"));
e->setPressed();
rect += m_topleft_client + v2s32(50+260+10, 180);
gui::IGUIButton *e = Environment->addButton(rect, this, GUI_ID_SERVERLIST_DELETE,
wgettext("Delete"));
- if (m_data->serverlist_show_available) // Hidden on Show-Online mode
+ if (m_data->selected_serverlist == SERVERLIST_PUBLIC) // Hidden when on public list
e->setVisible(false);
}
// Start game button
gui::IGUIElement *togglebutton = getElementFromId(GUI_ID_SERVERLIST_TOGGLE);
gui::IGUIElement *deletebutton = getElementFromId(GUI_ID_SERVERLIST_DELETE);
gui::IGUIListBox *serverlist = (gui::IGUIListBox*)getElementFromId(GUI_ID_SERVERLIST);
- if (m_data->serverlist_show_available) // switch to favorite list
+ gui::IGUIElement *title = getElementFromId(GUI_ID_SERVERLIST_TITLE);
+ if (m_data->selected_serverlist == SERVERLIST_PUBLIC) // switch to favorite list
{
m_data->servers = ServerList::getLocal();
togglebutton->setText(wgettext("Show Public"));
+ title->setText(wgettext("Favorites:"));
deletebutton->setVisible(true);
updateGuiServerList();
serverlist->setSelected(0);
+ m_data->selected_serverlist = SERVERLIST_FAVORITES;
}
else // switch to online list
{
m_data->servers = ServerList::getOnline();
togglebutton->setText(wgettext("Show Favorites"));
+ title->setText(wgettext("Public Server List:"));
deletebutton->setVisible(false);
updateGuiServerList();
serverlist->setSelected(0);
+ m_data->selected_serverlist = SERVERLIST_PUBLIC;
}
serverListOnSelected();
-
- m_data->serverlist_show_available = !m_data->serverlist_show_available;
}
#endif
}
MainMenuData menudata;
if(g_settings->exists("selected_mainmenu_tab"))
menudata.selected_tab = g_settings->getS32("selected_mainmenu_tab");
+ if(g_settings->exists("selected_serverlist"))
+ menudata.selected_serverlist = g_settings->getS32("selected_serverlist");
menudata.address = narrow_to_wide(address);
menudata.name = narrow_to_wide(playername);
menudata.port = narrow_to_wide(itos(port));
simple_singleplayer_mode = menudata.simple_singleplayer_mode;
// Save settings
g_settings->setS32("selected_mainmenu_tab", menudata.selected_tab);
+ g_settings->setS32("selected_serverlist", menudata.selected_serverlist);
g_settings->set("new_style_leaves", itos(menudata.fancy_trees));
g_settings->set("smooth_lighting", itos(menudata.smooth_lighting));
g_settings->set("enable_3d_clouds", itos(menudata.clouds_3d));