Fix RegisterScreen

This commit is contained in:
Flakebi 2014-06-04 16:45:54 +02:00
parent af6c121a22
commit d7b3e0f46a
2 changed files with 27 additions and 4 deletions

View File

@ -18,6 +18,7 @@
#include "states_screens/register_screen.hpp"
#include "config/player_manager.hpp"
#include "config/user_config.hpp"
#include "audio/sfx_manager.hpp"
#include "guiengine/widgets/check_box_widget.hpp"
#include "guiengine/widgets/label_widget.hpp"
@ -78,12 +79,27 @@ void RegisterScreen::init()
m_info_widget = getWidget<LabelWidget>("info");
assert(m_info_widget);
m_info_widget->setDefaultColor();
m_info_widget->setText("", false);
m_options_widget = getWidget<RibbonWidget>("options");
assert(m_options_widget);
m_signup_request = NULL;
m_info_message_shown = false;
getWidget<CheckBoxWidget>("online")->setVisible(true);
getWidget<LabelWidget>("label_online")->setVisible(true);
// Check if online is allowed
if (UserConfigParams::m_internet_status != Online::RequestManager::IPERM_NOT_ALLOWED)
{
getWidget<CheckBoxWidget>("online")->setState(true);
makeEntryFieldsVisible(true);
}
else
{
getWidget<CheckBoxWidget>("online")->setState(false);
makeEntryFieldsVisible(false);
}
} // init
// -----------------------------------------------------------------------------
@ -303,6 +319,13 @@ void RegisterScreen::eventCallback(Widget* widget, const std::string& name,
{
if (name == "online")
{
if (UserConfigParams::m_internet_status == Online::RequestManager::IPERM_NOT_ALLOWED)
{
m_info_widget->setErrorColor();
m_info_widget->setText(_("Internet access is disabled, please enable it in the options"), false);
getWidget<CheckBoxWidget>("online")->setState(false);
}
else
makeEntryFieldsVisible(getWidget<CheckBoxWidget>("online")->getState());
}
else if (name=="options")

View File

@ -247,7 +247,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
Online::RequestManager::IPERM_NOT_ALLOWED)
{
m_info_widget->setText(
"Internet access is disabled, please enable it in the options",
_("Internet access is disabled, please enable it in the options"),
true);
sfx_manager->quickSound( "anvil" );
m_online_cb->setState(false);