Adding a package-update.png image

Show 'update' instead of uninstall or install for addons which can be updated (maybe we need a third button)
Add a special icon in the addons lists if the addon can be updated

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5926 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
xapantu 2010-09-08 18:19:05 +00:00
parent 96abb55c7d
commit ec063ef163
4 changed files with 22 additions and 3 deletions

BIN
data/gui/package-update.png Normal file

Binary file not shown.

After

(image error) Size: 2.8 KiB

@ -52,10 +52,13 @@ void AddonsScreen::loadedFromFile()
+ "/package.png" );
video::ITexture* icon2 = irr_driver->getTexture( file_manager->getGUIDir()
+ "/no-package.png" );
video::ITexture* icon3 = irr_driver->getTexture( file_manager->getGUIDir()
+ "/package-update.png" );
m_icon_bank = new irr::gui::STKModifiedSpriteBank( GUIEngine::getGUIEnv() );
m_icon_bank->addTextureAsSprite(icon1);
m_icon_bank->addTextureAsSprite(icon2);
m_icon_bank->addTextureAsSprite(icon3);
}
// ------------------------------------------------------------------------------------------------------
void AddonsScreen::loadList()
@ -68,7 +71,10 @@ void AddonsScreen::loadList()
while(addons_manager->NextType(this->type))
{
std::cout << addons_manager->GetName() << std::endl;
if(addons_manager->IsInstalledAsBool())
if(addons_manager->IsInstalledAsBool() && addons_manager->GetInstalledVersion() < addons_manager->GetVersion())
w_list->addItem(addons_manager->GetIdAsStr().c_str(),
addons_manager->GetName().c_str(), 2 /* icon installed */);
else if(addons_manager->IsInstalledAsBool())
w_list->addItem(addons_manager->GetIdAsStr().c_str(),
addons_manager->GetName().c_str(), 0 /* icon installed */);

@ -56,6 +56,14 @@ void AddonsUpdateScreen::eventCallback(GUIEngine::Widget* widget, const std::str
{
StateManager::get()->escapePressed();
}
else if (name == "list_addons")
{
GUIEngine::ListWidget* list = this->getWidget<GUIEngine::ListWidget>("list_addons");
std::string addons = list->getSelectionInternalName();
addons_manager->SelectId(addons);
this->load = new AddonsLoading(addons_manager, 0.8f, 0.8f);
}
else if (name == "category")
{
std::string selection = ((GUIEngine::RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
@ -88,7 +96,7 @@ void AddonsUpdateScreen::init()
//w_list->addItem("kart", _("Karts:"), -1 /* no icon */);
while(addons_manager->Next())
{
if(addons_manager->IsInstalledAsBool() && addons_manager->GetInstalledVersion() < addons_manager->GetVersion() )
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(),

@ -56,7 +56,12 @@ AddonsLoading::AddonsLoading(Addons * id, const float w, const float h) :
version = this->getWidget<LabelWidget>("version");
if(this->addons->IsInstalledAsBool())
this->getWidget<ButtonWidget>("install")->setLabel(_("Uninstall"));
{
if(addons_manager->GetInstalledVersion() < addons_manager->GetVersion())
this->getWidget<ButtonWidget>("install")->setLabel(_("Update"));
else
this->getWidget<ButtonWidget>("install")->setLabel(_("Uninstall"));
}
this->loadInfo();
}