Disabled online menu by default (use --online to get access to it).

This commit is contained in:
hiker 2014-01-22 08:52:22 +11:00
parent 5918f43ce6
commit 0d51477f5b
3 changed files with 19 additions and 6 deletions

View File

@ -191,6 +191,7 @@
#include "replay/replay_play.hpp" #include "replay/replay_play.hpp"
#include "replay/replay_recorder.hpp" #include "replay/replay_recorder.hpp"
#include "states_screens/story_mode_lobby.hpp" #include "states_screens/story_mode_lobby.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/state_manager.hpp" #include "states_screens/state_manager.hpp"
#include "states_screens/dialogs/message_dialog.hpp" #include "states_screens/dialogs/message_dialog.hpp"
#include "tracks/track.hpp" #include "tracks/track.hpp"
@ -484,6 +485,8 @@ int handleCmdLinePreliminary()
UserConfigParams::m_log_errors_to_console=true; UserConfigParams::m_log_errors_to_console=true;
if(CommandLine::has("--no-console")) if(CommandLine::has("--no-console"))
UserConfigParams::m_log_errors_to_console=false; UserConfigParams::m_log_errors_to_console=false;
if(CommandLine::has("--online"))
MainMenuScreen::m_enable_online=true;
if(CommandLine::has("--log=nocolor")) if(CommandLine::has("--log=nocolor"))
{ {
Log::disableColor(); Log::disableColor();

View File

@ -64,6 +64,8 @@ using namespace Online;
DEFINE_SCREEN_SINGLETON( MainMenuScreen ); DEFINE_SCREEN_SINGLETON( MainMenuScreen );
bool MainMenuScreen::m_enable_online = false;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
MainMenuScreen::MainMenuScreen() : Screen("main.stkgui") MainMenuScreen::MainMenuScreen() : Screen("main.stkgui")
@ -111,11 +113,10 @@ void MainMenuScreen::init()
w->setBadge(LOADING_BADGE); w->setBadge(LOADING_BADGE);
} }
IconButtonWidget* online = getWidget<IconButtonWidget>("online"); m_online = getWidget<IconButtonWidget>("online");
if(CurrentUser::get()->getID())
online->setLabel(_("Online")); if(!m_enable_online)
else m_online->setDeactivated();
online->setLabel(_("Login"));
LabelWidget* w = getWidget<LabelWidget>("info_addons"); LabelWidget* w = getWidget<LabelWidget>("info_addons");
const core::stringw &news_text = NewsManager::get()->getNextNewsMessage(); const core::stringw &news_text = NewsManager::get()->getNextNewsMessage();
@ -141,7 +142,10 @@ void MainMenuScreen::init()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void MainMenuScreen::onUpdate(float delta) void MainMenuScreen::onUpdate(float delta)
{ {
m_online->setLabel(CurrentUser::get()->getID() ? _("Online")
: _("Login" ) );
IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons"); IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons");
if (addons_icon != NULL) if (addons_icon != NULL)
{ {

View File

@ -20,7 +20,8 @@
#include "guiengine/screen.hpp" #include "guiengine/screen.hpp"
namespace GUIEngine { class Widget; class ListWidget; } namespace GUIEngine { class Widget; class ListWidget;
class IconButtonWidget; }
/** /**
* \brief Handles the main menu * \brief Handles the main menu
@ -31,9 +32,14 @@ class MainMenuScreen : public GUIEngine::Screen, public GUIEngine::ScreenSinglet
private: private:
friend class GUIEngine::ScreenSingleton<MainMenuScreen>; friend class GUIEngine::ScreenSingleton<MainMenuScreen>;
/** Keep the widget to avoid looking it up every frame. */
GUIEngine::IconButtonWidget* m_online;
MainMenuScreen(); MainMenuScreen();
public: public:
/** Temporary disable the online menu while it is being worked at. */
static bool m_enable_online;
virtual void onUpdate(float delta) OVERRIDE; virtual void onUpdate(float delta) OVERRIDE;