Display a message when clicking on the add-ons icon and it is not enabled
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9394 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
4d2b57321b
commit
a031bd5731
src
addons
guiengine
states_screens
@ -66,9 +66,11 @@ public:
|
||||
/** 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 onlineReady() const {return m_state.getAtomic()==STATE_READY; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool wasError() const { return m_state.getAtomic()==STATE_ERROR;}
|
||||
bool wasError() const { return m_state.getAtomic()==STATE_ERROR;}
|
||||
// ------------------------------------------------------------------------
|
||||
bool isLoading() const { return m_state.getAtomic()==STATE_INIT; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Marks addon as not being available. */
|
||||
void setErrorState() { m_state.setAtomic(STATE_ERROR); }
|
||||
|
@ -648,8 +648,12 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event)
|
||||
{
|
||||
Widget* w = GUIEngine::getWidget(id);
|
||||
if (w == NULL) break;
|
||||
|
||||
if (w->m_deactivated) return EVENT_BLOCK;
|
||||
|
||||
if (w->m_deactivated)
|
||||
{
|
||||
GUIEngine::getCurrentScreen()->onDisabledItemClicked(w->m_properties[PROP_ID].c_str());
|
||||
return EVENT_BLOCK;
|
||||
}
|
||||
|
||||
// These events are only triggered by mouse (or so I hope)
|
||||
// The player that owns the mouser receives "game master" priviledges
|
||||
|
@ -272,6 +272,11 @@ namespace GUIEngine
|
||||
virtual EventPropagation filterActions(PlayerAction action, int deviceID, const unsigned int value,
|
||||
Input::InputType type, int playerId) { return EVENT_LET; }
|
||||
|
||||
/** Callback you can use if you want to know when the user pressed on a disabled ribbon item
|
||||
* (the main I see for this is to give feedback)
|
||||
*/
|
||||
virtual void onDisabledItemClicked(const std::string& item) {}
|
||||
|
||||
/**
|
||||
* \brief override this if you need to be notified of raw input in subclasses
|
||||
*/
|
||||
|
@ -569,7 +569,7 @@ void RibbonWidget::updateSelection()
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
EventPropagation RibbonWidget::transmitEvent(Widget* w, std::string& originator, const int playerID)
|
||||
{
|
||||
{
|
||||
if (!m_deactivated)
|
||||
{
|
||||
const int subbuttons_amount = m_children.size();
|
||||
@ -591,7 +591,12 @@ EventPropagation RibbonWidget::transmitEvent(Widget* w, std::string& originator,
|
||||
|
||||
if (m_selection[playerID] != -1)
|
||||
{
|
||||
if (m_children[m_selection[playerID]].m_deactivated) return EVENT_BLOCK;
|
||||
if (m_children[m_selection[playerID]].m_deactivated)
|
||||
{
|
||||
GUIEngine::getCurrentScreen()->onDisabledItemClicked(m_children[m_selection[playerID]].m_properties[PROP_ID]);
|
||||
|
||||
return EVENT_BLOCK;
|
||||
}
|
||||
}
|
||||
|
||||
return EVENT_LET;
|
||||
|
@ -47,6 +47,8 @@
|
||||
#include "states_screens/grand_prix_win.hpp"
|
||||
#endif
|
||||
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
|
||||
#include "addons/news_manager.hpp"
|
||||
#include "tracks/track_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -455,3 +457,24 @@ void MainMenuScreen::closeLangPopup()
|
||||
delete m_lang_popup;
|
||||
m_lang_popup = NULL;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
void MainMenuScreen::onDisabledItemClicked(const std::string& item)
|
||||
{
|
||||
if (item == "addons")
|
||||
{
|
||||
if (UserConfigParams::m_internet_status != NetworkHttp::IPERM_ALLOWED)
|
||||
{
|
||||
new MessageDialog( _("The add-ons module is currently disabled in the Options screen") );
|
||||
}
|
||||
else if (addons_manager->wasError())
|
||||
{
|
||||
new MessageDialog( _("Sorry, an error occurred while contacting the add-ons website. Make sure you are connected to the Internet and that SuperTuxKart is not blocked by a firewall") );
|
||||
}
|
||||
else if (addons_manager->isLoading())
|
||||
{
|
||||
new MessageDialog( _("Please wait while the add-ons are loading") );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,9 @@ public:
|
||||
* \return true if the screen should be closed, false if you handled the press another way
|
||||
*/
|
||||
virtual bool onEscapePressed();
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void onDisabledItemClicked(const std::string& item);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user