Added a 'bad badge' indicator if there is a problem downloading news.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8859 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
50234db02f
commit
425dbd8f2e
@ -190,16 +190,6 @@ void AddonsManager::downloadIcons()
|
||||
return;
|
||||
} // downloadIcons
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Returns true if the list of online addons has been downloaded. This is
|
||||
* used to grey out the 'addons' entry till a network connections could be
|
||||
* established.
|
||||
*/
|
||||
bool AddonsManager::onlineReady()
|
||||
{
|
||||
return m_state.getAtomic()==STATE_READY;
|
||||
} // onlineReady
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Loads the installed addons from .../addons/addons_installed.xml.
|
||||
*/
|
||||
|
@ -57,22 +57,29 @@ private:
|
||||
public:
|
||||
AddonsManager();
|
||||
void initOnline(const XMLNode *xml);
|
||||
bool onlineReady();
|
||||
/** Marks addon as not being available. */
|
||||
void setErrorState() { m_state.setAtomic(STATE_ERROR); }
|
||||
const Addon* getAddon(const std::string &id) const;
|
||||
int getAddonIndex(const std::string &id) const;
|
||||
bool install(const Addon &addon);
|
||||
bool uninstall(const Addon &addon);
|
||||
void reInit();
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if the list of online addons has been downloaded. This is
|
||||
* used to grey out the 'addons' entry till a network connections could be
|
||||
* established. */
|
||||
bool onlineReady() const {return m_state.getAtomic()==STATE_READY;}
|
||||
// ------------------------------------------------------------------------
|
||||
bool wasError() const { return m_state.getAtomic()==STATE_ERROR;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Marks addon as not being available. */
|
||||
void setErrorState() { m_state.setAtomic(STATE_ERROR); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the list of addons (installed and uninstalled). */
|
||||
unsigned int getNumAddons() const { return m_addons_list.getData().size();}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the i-th addons. */
|
||||
const Addon& getAddon(unsigned int i) { return m_addons_list.getData()[i];}
|
||||
|
||||
};
|
||||
}; // class AddonsManager
|
||||
|
||||
extern AddonsManager *addons_manager;
|
||||
#endif
|
||||
|
@ -131,17 +131,24 @@ void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver)
|
||||
addons_icon->resetAllBadges();
|
||||
addons_icon->setBadge(BAD_BADGE);
|
||||
}
|
||||
else if (!addons_manager->onlineReady())
|
||||
else if (addons_manager->wasError())
|
||||
{
|
||||
addons_icon->setDeactivated();
|
||||
addons_icon->resetAllBadges();
|
||||
addons_icon->setBadge(LOADING_BADGE);
|
||||
addons_icon->setBadge(BAD_BADGE);
|
||||
}
|
||||
else
|
||||
else if (addons_manager->onlineReady())
|
||||
{
|
||||
addons_icon->setActivated();
|
||||
addons_icon->resetAllBadges();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Addons manager is still initialising/downloading.
|
||||
addons_icon->setDeactivated();
|
||||
addons_icon->resetAllBadges();
|
||||
addons_icon->setBadge(LOADING_BADGE);
|
||||
}
|
||||
}
|
||||
|
||||
LabelWidget* w = this->getWidget<LabelWidget>("info_addons");
|
||||
|
Loading…
Reference in New Issue
Block a user