Change the name of the addons screen (from options to addons)
Use a single pointer for addons, it is now initialized in main() Working on the update screen, we can now see which addons can be updated git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5925 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
5602c1663e
commit
96abb55c7d
@ -2,7 +2,7 @@
|
||||
|
||||
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
|
||||
|
||||
<header text_align="center" width="100%" text="SuperTuxKart Options"/>
|
||||
<header text_align="center" width="100%" text="SuperTuxKart Addons"/>
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<tabs id="category" height="10%" max_height="110" width="100%" align="center">
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
|
||||
|
||||
<header text_align="center" width="100%" text="SuperTuxKart Options"/>
|
||||
<header text_align="center" width="100%" text="SuperTuxKart Addons"/>
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<tabs id="category" height="10%" max_height="110" width="100%" align="center">
|
||||
|
@ -38,7 +38,7 @@
|
||||
using namespace irr; /* irrXML which is used to read (not write) xml file,
|
||||
is located in the namespace irr::io.*/
|
||||
using namespace io;
|
||||
|
||||
Addons* addons_manager = 0;
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Addons::Addons()
|
||||
|
@ -110,5 +110,6 @@ class Addons
|
||||
std::string getDownloadStateAsStr();
|
||||
|
||||
};
|
||||
extern Addons * addons_manager;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -71,6 +71,7 @@
|
||||
|
||||
#ifdef ADDONS_MANAGER
|
||||
#include "addons/network.hpp"
|
||||
#include "addons/addons.hpp"
|
||||
#endif
|
||||
|
||||
void cmdLineHelp (char* invocation)
|
||||
@ -543,6 +544,7 @@ void initRest()
|
||||
network_manager = new NetworkManager ();
|
||||
#ifdef ADDONS_MANAGER
|
||||
network_http = new NetworkHttp ();
|
||||
addons_manager = new Addons ();
|
||||
#endif
|
||||
|
||||
stk_config->load(file_manager->getConfigFile("stk_config.xml"));
|
||||
|
@ -63,18 +63,18 @@ void AddonsScreen::loadList()
|
||||
std::cout << "load list" << std::endl;
|
||||
GUIEngine::ListWidget* w_list = this->getWidget<GUIEngine::ListWidget>("list_addons");
|
||||
w_list->clear();
|
||||
this->addons->resetIndex();
|
||||
addons_manager->resetIndex();
|
||||
//w_list->addItem("kart", _("Karts:"), -1 /* no icon */);
|
||||
while(this->addons->NextType(this->type))
|
||||
while(addons_manager->NextType(this->type))
|
||||
{
|
||||
std::cout << this->addons->GetName() << std::endl;
|
||||
if(this->addons->IsInstalledAsBool())
|
||||
w_list->addItem(this->addons->GetIdAsStr().c_str(),
|
||||
this->addons->GetName().c_str(), 0 /* icon installed */);
|
||||
std::cout << addons_manager->GetName() << std::endl;
|
||||
if(addons_manager->IsInstalledAsBool())
|
||||
w_list->addItem(addons_manager->GetIdAsStr().c_str(),
|
||||
addons_manager->GetName().c_str(), 0 /* icon installed */);
|
||||
|
||||
else
|
||||
w_list->addItem(this->addons->GetIdAsStr().c_str(),
|
||||
this->addons->GetName().c_str(), 1 /* icon unsinstalled*/);
|
||||
w_list->addItem(addons_manager->GetIdAsStr().c_str(),
|
||||
addons_manager->GetName().c_str(), 1 /* icon unsinstalled*/);
|
||||
}
|
||||
|
||||
this->can_load_list = false;
|
||||
@ -101,8 +101,8 @@ void AddonsScreen::eventCallback(GUIEngine::Widget* widget, const std::string& n
|
||||
|
||||
if(addons != "track" && addons != "kart")
|
||||
{
|
||||
this->addons->SelectId(addons);
|
||||
this->load = new AddonsLoading(this->addons, 0.8f, 0.8f);
|
||||
addons_manager->SelectId(addons);
|
||||
this->load = new AddonsLoading(addons_manager, 0.8f, 0.8f);
|
||||
}
|
||||
}
|
||||
if (name == "category")
|
||||
@ -156,9 +156,6 @@ void AddonsScreen::init()
|
||||
void * AddonsScreen::downloadList( void * pthis)
|
||||
{
|
||||
AddonsScreen * pt = (AddonsScreen*)pthis;
|
||||
//load all karts...
|
||||
pt->addons = new Addons();
|
||||
|
||||
pthread_mutex_lock(&(pt->mutex));
|
||||
pt->can_load_list = true;
|
||||
pthread_mutex_unlock(&(pt->mutex));
|
||||
|
@ -81,6 +81,20 @@ void AddonsUpdateScreen::init()
|
||||
{
|
||||
Screen::init();
|
||||
getWidget<GUIEngine::RibbonWidget>("category")->select("tab_update", PLAYER_ID_GAME_MASTER);
|
||||
|
||||
GUIEngine::ListWidget* w_list = this->getWidget<GUIEngine::ListWidget>("list_addons");
|
||||
w_list->clear();
|
||||
addons_manager->resetIndex();
|
||||
//w_list->addItem("kart", _("Karts:"), -1 /* no icon */);
|
||||
while(addons_manager->Next())
|
||||
{
|
||||
if(addons_manager->IsInstalledAsBool() && addons_manager->GetInstalledVersion() < addons_manager->GetVersion() )
|
||||
{
|
||||
std::cout << addons_manager->GetName() << std::endl;
|
||||
w_list->addItem(addons_manager->GetIdAsStr().c_str(),
|
||||
addons_manager->GetName().c_str(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user