Split UI options into general options (new default tab) and UI options

This commit is contained in:
Alayan 2018-11-16 03:20:39 +01:00
parent d59f2fdca6
commit d8c9fd7fb6
23 changed files with 444 additions and 150 deletions

View File

@ -41,6 +41,7 @@ crown.png by glitch, from https://openclipart.org/detail/210257/misc-game-crown,
ghost_plus.png by Alayan, based on https://openclipart.org/detail/17847/cartoon-ghost by lemmling, released under CC-O
options_language.png by Alayan, based on http://www.languageicon.org/, released under CC-BY-SA 3+
options_general.png by Alayan, released under CC-BY-SA 4
blue_flag.png, heart.png and red_flag.png by Benau, released under CC-BY-SA 4

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/icons/back.png"/>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header width="80%" height="7%" align="center" text="SuperTuxKart Options" text_align="center"/>
<spacer width="100%" height="1%"/>
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/icons/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/icons/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/icons/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
<icon-button id="tab_language" width="128" height="128" icon="gui/icons/options_language.png"
I18N="Section in the settings menu" text="Language"/>
</vertical-tabs>
<spacer width="2%" height="100%"/>
<div width="100%" height="100%" layout="vertical-row" >
<box width="80%" height="49%" layout="vertical-row">
<spacer width="5" height="2%"/>
<label width="80%" height="fit" align="center" I18N="In the general settings" text="Internet options" text_align="center"/>
<spacer width="5" height="4%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-internet"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the general settings" text="Connect to the Internet" word_wrap="true"/>
</div>
<spacer width="5" height="4%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-hw-report"/>
<spacer width="1%" height="100%" />
<label height="100%" id="label-hw-report" I18N="In the general settings"
text="Send anonymous hardware statistics" word_wrap="true"/>
</div>
<spacer width="5" height="4%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="show-login"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the general settings" text="Always show login screen" word_wrap="true"/>
</div>
<spacer width="5" height="4%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-lobby-chat"/>
<spacer width="1%" height="100%" />
<label height="100%" id="label-lobby-chat" I18N="In the general settings" text="Enable chatting in networking lobby" word_wrap="true"/>
</div>
<spacer width="5" height="4%"/>
</box>
<spacer width="5" height="2%"/>
<box width="80%" height="49%" layout="vertical-row">
<spacer width="5" height="2%"/>
<label width="80%" height="fit" align="center" I18N="In the general settings" text="Miscellaneous options" text_align="center"/>
<spacer width="5" height="4%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="perPlayerDifficulty"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the general settings" text="Enable per-player handicaps" word_wrap="true"/>
</div>
<spacer width="5" height="4%"/>
</box>
</div>
</div>
</div>
</stkgui>

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -1,18 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/icons/back.png"/>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header width="80%" height="7%" align="center" text="SuperTuxKart Options" text_align="center"/>
<spacer width="100%" height="1%"/>
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<div width="100%" height="92%" layout="horizontal-row" >
<tabs id="options_choice" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/icons/options_ui.png"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/icons/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/icons/options_input.png"/>
</tabs>
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/icons/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/icons/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/icons/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
<icon-button id="tab_language" width="128" height="128" icon="gui/icons/options_language.png"
I18N="Section in the settings menu" text="Language"/>
</vertical-tabs>
<box proportion="1" width="100%" layout="vertical-row">
@ -46,6 +56,4 @@
<spacer width="20" height="15"/>
</box>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/icons/back.png"/>
</stkgui>

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"
@ -64,47 +66,6 @@
</div>
<spacer width="5" height="2%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="perPlayerDifficulty"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the ui settings" text="Enable per-player handicaps" word_wrap="true"/>
</div>
<spacer width="5" height="2%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-internet"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the ui settings" text="Connect to the Internet" word_wrap="true"/>
</div>
<spacer width="5" height="2%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-hw-report"/>
<spacer width="1%" height="100%" />
<label height="100%" id="label-hw-report" I18N="In the ui settings"
text="Send anonymous hardware statistics" word_wrap="true"/>
</div>
<spacer width="5" height="2%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="show-login"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the ui settings" text="Always show login screen" word_wrap="true"/>
</div>
<spacer width="5" height="2%"/>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="enable-lobby-chat"/>
<spacer width="1%" height="100%" />
<label height="100%" id="label-lobby-chat" I18N="In the ui settings" text="Enable chatting in networking lobby" word_wrap="true"/>
</div>
<spacer width="5" height="2%"/>
</box>
</div>
</div>

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -8,6 +8,8 @@
<div width="100%" height="92%" layout="horizontal-row" >
<vertical-tabs id="options_choice" height="100%" width="18%">
<icon-button id="tab_general" width="128" height="128" icon="gui/icons/options_general.png"
I18N="Section in the settings menu" text="General"/>
<icon-button id="tab_video" width="128" height="128" icon="gui/icons/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/icons/options_audio.png"

View File

@ -1,5 +1,5 @@
# Modify this file to change the last-modified date when you add/remove a file.
# This will then trigger a new cmake run automatically.
# This will then trigger a new cmake run automatically.
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")

View File

@ -35,7 +35,7 @@
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/race_gui_base.hpp"
#include "states_screens/race_setup_screen.hpp"
#include "states_screens/options/options_screen_video.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
@ -174,7 +174,7 @@ GUIEngine::EventPropagation
else if (selection == "options")
{
dismiss();
OptionsScreenVideo::getInstance()->push();
OptionsScreenGeneral::getInstance()->push();
return GUIEngine::EVENT_BLOCK;
}
else if (selection == "restart")

View File

@ -47,7 +47,7 @@
#include "states_screens/online/online_profile_achievements.hpp"
#include "states_screens/online/online_profile_servers.hpp"
#include "states_screens/online/online_screen.hpp"
#include "states_screens/options/options_screen_video.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/options/user_screen.hpp"
#if DEBUG_MENU_ITEM
@ -401,7 +401,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
}
else if (selection == "options")
{
OptionsScreenVideo::getInstance()->push();
OptionsScreenGeneral::getInstance()->push();
}
else if (selection == "quit")
{

View File

@ -27,6 +27,7 @@
#include "guiengine/widgets/spinner_widget.hpp"
#include "guiengine/widget.hpp"
#include "io/file_manager.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_ui.hpp"
@ -112,6 +113,8 @@ void OptionsScreenAudio::eventCallback(Widget* widget, const std::string& name,
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)

View File

@ -32,6 +32,7 @@
#include "io/file_manager.hpp"
#include "states_screens/dialogs/press_a_key_dialog.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_video.hpp"
@ -550,6 +551,8 @@ void OptionsScreenDevice::eventCallback(Widget* widget,
// screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)

View File

@ -0,0 +1,229 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2009-2015 Marianne Gagnon
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "states_screens/options/options_screen_general.hpp"
#include "addons/news_manager.hpp"
#include "audio/sfx_manager.hpp"
#include "audio/sfx_base.hpp"
#include "config/hardware_stats.hpp"
#include "config/player_manager.hpp"
#include "config/user_config.hpp"
#include "font/bold_face.hpp"
#include "font/font_manager.hpp"
#include "font/regular_face.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "guiengine/widgets/button_widget.hpp"
#include "guiengine/widgets/check_box_widget.hpp"
#include "guiengine/widgets/dynamic_ribbon_widget.hpp"
#include "guiengine/widgets/label_widget.hpp"
#include "guiengine/widgets/list_widget.hpp"
#include "guiengine/widgets/spinner_widget.hpp"
#include "guiengine/widget.hpp"
#include "io/file_manager.hpp"
#include "online/request_manager.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_ui.hpp"
#include "states_screens/options/options_screen_video.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/options/user_screen.hpp"
#include "utils/log.hpp"
#include "utils/string_utils.hpp"
#include "utils/translation.hpp"
#include <algorithm>
#include <iostream>
#include <sstream>
using namespace GUIEngine;
using namespace Online;
// -----------------------------------------------------------------------------
OptionsScreenGeneral::OptionsScreenGeneral() : Screen("options_general.stkgui")
{
m_inited = false;
} // OptionsScreenVideo
// -----------------------------------------------------------------------------
void OptionsScreenGeneral::loadedFromFile()
{
m_inited = false;
} // loadedFromFile
// -----------------------------------------------------------------------------
void OptionsScreenGeneral::init()
{
Screen::init();
RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
assert(ribbon != NULL);
ribbon->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
ribbon->select( "tab_general", PLAYER_ID_GAME_MASTER );
CheckBoxWidget* news = getWidget<CheckBoxWidget>("enable-internet");
assert( news != NULL );
news->setState( UserConfigParams::m_internet_status
==RequestManager::IPERM_ALLOWED );
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
assert( stats != NULL );
LabelWidget *stats_label = getWidget<LabelWidget>("label-hw-report");
assert( stats_label );
stats->setState(UserConfigParams::m_hw_report_enable);
getWidget<CheckBoxWidget>("enable-lobby-chat")
->setState(UserConfigParams::m_lobby_chat);
if(news->getState())
{
stats_label->setVisible(true);
stats->setVisible(true);
stats->setState(UserConfigParams::m_hw_report_enable);
}
else
{
stats_label->setVisible(false);
stats->setVisible(false);
}
CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
assert( difficulty != NULL );
difficulty->setState( UserConfigParams::m_per_player_difficulty );
// I18N: Tooltip in the UI menu. Use enough linebreaks to make sure the text fits the screen in low resolutions.
difficulty->setTooltip(_("In multiplayer mode, players can select handicapped\n(more difficult) profiles on the kart selection screen"));
CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
assert( show_login!= NULL );
show_login->setState( UserConfigParams::m_always_show_login_screen);
} // init
// -----------------------------------------------------------------------------
void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
#ifndef SERVER_ONLY
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
Screen *screen = NULL;
if (selection == "tab_audio")
screen = OptionsScreenAudio::getInstance();
else if (selection == "tab_video")
screen = OptionsScreenVideo::getInstance();
else if (selection == "tab_players")
screen = TabbedUserScreen::getInstance();
else if (selection == "tab_controls")
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
//else if (selection == "tab_general")
// screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if(name == "back")
{
StateManager::get()->escapePressed();
}
else if (name=="enable-internet")
{
CheckBoxWidget* internet = getWidget<CheckBoxWidget>("enable-internet");
assert( internet != NULL );
UserConfigParams::m_internet_status =
internet->getState() ? RequestManager::IPERM_ALLOWED
: RequestManager::IPERM_NOT_ALLOWED;
// If internet gets enabled, re-initialise the addon manager (which
// happens in a separate thread) so that news.xml etc can be
// downloaded if necessary.
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
LabelWidget* stats_label = getWidget<LabelWidget>("label-hw-report");
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
LabelWidget* chat_label = getWidget<LabelWidget>("label-lobby-chat");
if(internet->getState())
{
NewsManager::get()->init(false);
stats->setVisible(true);
stats_label->setVisible(true);
stats->setState(UserConfigParams::m_hw_report_enable);
chat->setVisible(true);
stats->setState(UserConfigParams::m_lobby_chat);
chat_label->setVisible(true);
}
else
{
chat->setVisible(false);
chat_label->setVisible(false);
stats->setVisible(false);
stats_label->setVisible(false);
PlayerProfile* profile = PlayerManager::getCurrentPlayer();
if (profile != NULL && profile->isLoggedIn())
profile->requestSignOut();
}
}
else if (name=="enable-hw-report")
{
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
UserConfigParams::m_hw_report_enable = stats->getState();
if(stats->getState())
HardwareStats::reportHardwareStats();
}
else if (name=="enable-lobby-chat")
{
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
UserConfigParams::m_lobby_chat = chat->getState();
}
else if (name=="show-login")
{
CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
assert( show_login != NULL );
UserConfigParams::m_always_show_login_screen = show_login->getState();
}
else if (name=="perPlayerDifficulty")
{
CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
assert( difficulty != NULL );
UserConfigParams::m_per_player_difficulty = difficulty->getState();
}
#endif
} // eventCallback
// -----------------------------------------------------------------------------
void OptionsScreenGeneral::tearDown()
{
Screen::tearDown();
// save changes when leaving screen
user_config->saveConfig();
} // tearDown
// -----------------------------------------------------------------------------
void OptionsScreenGeneral::unloaded()
{
m_inited = false;
} // unloaded
// -----------------------------------------------------------------------------

View File

@ -0,0 +1,61 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2009-2015 Marianne Gagnon
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __HEADER_OPTIONS_SCREEN_GENERAL_HPP__
#define __HEADER_OPTIONS_SCREEN_GENERAL_HPP__
#include <string>
#include "guiengine/screen.hpp"
namespace GUIEngine { class Widget; }
struct Input;
/**
* \brief Graphics options screen
* \ingroup states_screens
*/
class OptionsScreenGeneral : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OptionsScreenGeneral>
{
OptionsScreenGeneral();
bool m_inited;
std::vector<std::string> m_skins;
public:
friend class GUIEngine::ScreenSingleton<OptionsScreenGeneral>;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void loadedFromFile() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
const int playerID) OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void init() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void tearDown() OVERRIDE;
/** \brief implement optional callback from parent class GUIEngine::Screen */
virtual void unloaded() OVERRIDE;
};
#endif

View File

@ -30,6 +30,7 @@
#include "io/file_manager.hpp"
#include "states_screens/options/options_screen_device.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_video.hpp"
#include "states_screens/options/options_screen_ui.hpp"
@ -222,6 +223,8 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
// screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)

View File

@ -40,6 +40,7 @@
#include "online/request_manager.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_ui.hpp"
#include "states_screens/options/options_screen_video.hpp"
@ -139,6 +140,8 @@ void OptionsScreenLanguage::eventCallback(Widget* widget, const std::string& nam
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
//else if (selection == "tab_language")
// screen = OptionsScreenLanguage::getInstance();
if(screen)

View File

@ -40,6 +40,7 @@
#include "online/request_manager.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_video.hpp"
@ -163,39 +164,6 @@ void OptionsScreenUI::init()
CheckBoxWidget* fps = getWidget<CheckBoxWidget>("showfps");
assert( fps != NULL );
fps->setState( UserConfigParams::m_display_fps );
CheckBoxWidget* news = getWidget<CheckBoxWidget>("enable-internet");
assert( news != NULL );
news->setState( UserConfigParams::m_internet_status
==RequestManager::IPERM_ALLOWED );
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
assert( stats != NULL );
LabelWidget *stats_label = getWidget<LabelWidget>("label-hw-report");
assert( stats_label );
stats->setState(UserConfigParams::m_hw_report_enable);
getWidget<CheckBoxWidget>("enable-lobby-chat")
->setState(UserConfigParams::m_lobby_chat);
if(news->getState())
{
stats_label->setVisible(true);
stats->setVisible(true);
stats->setState(UserConfigParams::m_hw_report_enable);
}
else
{
stats_label->setVisible(false);
stats->setVisible(false);
}
CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
assert( difficulty != NULL );
difficulty->setState( UserConfigParams::m_per_player_difficulty );
// I18N: Tooltip in the UI menu. Use enough linebreaks to make sure the text fits the screen in low resolutions.
difficulty->setTooltip(_("In multiplayer mode, players can select handicapped\n(more difficult) profiles on the kart selection screen"));
CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
assert( show_login!= NULL );
show_login->setState( UserConfigParams::m_always_show_login_screen);
// --- select the right skin in the spinner
bool currSkinFound = false;
@ -243,6 +211,8 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
screen = OptionsScreenInput::getInstance();
//else if (selection == "tab_ui")
// screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)
@ -282,65 +252,6 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
assert( fps != NULL );
UserConfigParams::m_display_fps = fps->getState();
}
else if (name=="enable-internet")
{
CheckBoxWidget* internet = getWidget<CheckBoxWidget>("enable-internet");
assert( internet != NULL );
UserConfigParams::m_internet_status =
internet->getState() ? RequestManager::IPERM_ALLOWED
: RequestManager::IPERM_NOT_ALLOWED;
// If internet gets enabled, re-initialise the addon manager (which
// happens in a separate thread) so that news.xml etc can be
// downloaded if necessary.
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
LabelWidget* stats_label = getWidget<LabelWidget>("label-hw-report");
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
LabelWidget* chat_label = getWidget<LabelWidget>("label-lobby-chat");
if(internet->getState())
{
NewsManager::get()->init(false);
stats->setVisible(true);
stats_label->setVisible(true);
stats->setState(UserConfigParams::m_hw_report_enable);
chat->setVisible(true);
stats->setState(UserConfigParams::m_lobby_chat);
chat_label->setVisible(true);
}
else
{
chat->setVisible(false);
chat_label->setVisible(false);
stats->setVisible(false);
stats_label->setVisible(false);
PlayerProfile* profile = PlayerManager::getCurrentPlayer();
if (profile != NULL && profile->isLoggedIn())
profile->requestSignOut();
}
}
else if (name=="enable-hw-report")
{
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
UserConfigParams::m_hw_report_enable = stats->getState();
if(stats->getState())
HardwareStats::reportHardwareStats();
}
else if (name=="enable-lobby-chat")
{
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
UserConfigParams::m_lobby_chat = chat->getState();
}
else if (name=="show-login")
{
CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
assert( show_login != NULL );
UserConfigParams::m_always_show_login_screen = show_login->getState();
}
else if (name=="perPlayerDifficulty")
{
CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
assert( difficulty != NULL );
UserConfigParams::m_per_player_difficulty = difficulty->getState();
}
#endif
} // eventCallback

View File

@ -31,6 +31,7 @@
#include "io/file_manager.hpp"
#include "states_screens/dialogs/custom_video_settings.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_ui.hpp"
@ -513,6 +514,8 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)

View File

@ -36,6 +36,7 @@
#include "states_screens/dialogs/recovery_dialog.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/options/options_screen_audio.hpp"
#include "states_screens/options/options_screen_general.hpp"
#include "states_screens/options/options_screen_input.hpp"
#include "states_screens/options/options_screen_language.hpp"
#include "states_screens/options/options_screen_ui.hpp"
@ -748,6 +749,8 @@ void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget,
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_general")
screen = OptionsScreenGeneral::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)