New options menu (#3323)

* Updated options UI file, new icon for language tab

Also updates the license file.

* Update the options screens to support the new layout

And add a language change screen.

* Don't overwrite the updates which happened in master.

* Add missing (new) password reset button

* Focus the list of actions binding rather than the tabbar in device options
This commit is contained in:
Alayan-stk-2 2018-06-22 01:50:16 +02:00 committed by auriamg
parent 1025bfe298
commit ebc7940985
18 changed files with 807 additions and 531 deletions

View File

@ -40,6 +40,8 @@ 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+
====
Glass Skin by Auria, under CC-BY-SA 3+

View File

@ -1,67 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row">
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<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/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<spacer height="5" width="10"/>
<!-- ******** Music ******** -->
<label width="100%" I18N="In the audio options screen" text="Music"/>
<div width="75%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="right" I18N="In the audio options screen" text="Enabled"/>
<div proportion="1" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<!-- FIXME: don't hardcode height -->
<checkbox id="music_enabled"/>
</div>
</div>
<div width="75%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="right" I18N="In the audio options screen" text="Volume"/>
<div proportion="1" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<gauge id="music_volume" proportion="1" min_value="1" max_value="10"/>
</div>
</div>
<spacer height="15" width="10"/>
<!-- ******** SFX ******** -->
<label width="100%" I18N="In the audio options screen" text="Sound Effects"/>
<div width="75%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="right" I18N="In the audio options screen" text="Enabled"/>
<div proportion="1" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<!-- FIXME: don't hardcode height -->
<checkbox id="sfx_enabled"/>
</div>
</div>
<div width="75%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="right" I18N="In the audio options screen" text="Volume"/>
<div proportion="1" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<gauge id="sfx_volume" proportion="1" min_value="1" max_value="10"/>
</div>
</div>
<spacer height="20" width="10"/>
</box>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/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_video" width="128" height="128" icon="gui/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
<icon-button id="tab_language" width="128" height="128" icon="gui/options_language.png"
I18N="Section in the settings menu" text="Language"/>
</vertical-tabs>
<spacer width="2%" height="100%"/>
<box width="80%" height="100%" layout="vertical-row">
<spacer width="5" height="1%"/>
<!-- ******** Music ******** -->
<label width="100%" I18N="In the audio options screen" text="Music"/>
<div width="75%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="right" I18N="In the audio options screen" text="Enabled"/>
<div proportion="1" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<!-- FIXME: don't hardcode height -->
<checkbox id="music_enabled"/>
</div>
</div>
<div width="75%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="right" I18N="In the audio options screen" text="Volume"/>
<div proportion="1" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<gauge id="music_volume" proportion="1" min_value="1" max_value="10"/>
</div>
</div>
<spacer width="5" height="1%"/>
<!-- ******** SFX ******** -->
<label width="100%" I18N="In the audio options screen" text="Sound Effects"/>
<div width="75%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="right" I18N="In the audio options screen" text="Enabled"/>
<div proportion="1" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<!-- FIXME: don't hardcode height -->
<checkbox id="sfx_enabled"/>
</div>
</div>
<div width="75%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="right" I18N="In the audio options screen" text="Volume"/>
<div proportion="1" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<gauge id="sfx_volume" proportion="1" min_value="1" max_value="10"/>
</div>
</div>
<spacer width="5" height="2%"/>
</box>
</div>
</div>
</stkgui>

View File

@ -1,49 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<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/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<!-- Configuration name -->
<spacer height="6" width="10"/>
<label id="title" width="100%" text_align="center" />
<spacer height="16" width="10"/>
<!-- List of key bindings -->
<box proportion="8" width="75%" align="center" layout="vertical-row" padding="8">
<list id="actions" x="0" y="0" width="100%" height="100%"/>
</box>
<!-- Bottom buttons -->
<spacer width="50" height="20" />
<div proportion="2" width="100%" layout="horizontal-row">
<spacer width="7" height="5"/>
<div height="100%" width="fit" layout="vertical-row">
<button id="delete"
I18N="In the input configuration screen" text="Delete Configuration"/>
<spacer width="50" height="10" />
<button id="back_to_device_list" I18N="In the input configuration screen" text="Back to device list"/>
<spacer width="50" height="10" />
</div>
<spacer width="20" height="10" />
<label id="conflict" proportion="1" text="" word_wrap="true" align="center"/>
</div>
</box>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/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_video" width="128" height="128" icon="gui/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
<icon-button id="tab_language" width="128" height="128" icon="gui/options_language.png"
I18N="Section in the settings menu" text="Language"/>
</vertical-tabs>
<spacer width="2%" height="100%"/>
<box width="80%" height="100%" layout="vertical-row">
<!-- Configuration name -->
<spacer height="6" width="10"/>
<label id="title" width="100%" text_align="center" />
<spacer height="16" width="10"/>
<!-- List of key bindings -->
<box proportion="8" width="75%" align="center" layout="vertical-row" padding="8">
<list id="actions" x="0" y="0" width="100%" height="100%"/>
</box>
<!-- Bottom buttons -->
<spacer width="50" height="20" />
<div proportion="2" width="100%" layout="horizontal-row">
<spacer width="7" height="5"/>
<div height="100%" width="fit" layout="vertical-row">
<button id="delete"
I18N="In the input configuration screen" text="Delete Configuration"/>
<spacer width="50" height="10" />
<button id="back_to_device_list" I18N="In the input configuration screen" text="Back to device list"/>
<spacer width="50" height="10" />
</div>
<spacer width="20" height="10" />
<label id="conflict" proportion="1" text="" word_wrap="true" align="center"/>
</div>
</box>
</div>
</div>
</stkgui>

View File

@ -1,39 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<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/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<label width="100%"
I18N="In the input configuration screen"
text="Press enter or double-click on a device to configure it"
text_align="center" />
<spacer width="5" height="20"/>
<box proportion="5" width="75%" align="center" layout="vertical-row" padding="8">
<list id="devices" x="0" y="0" width="100%" height="100%"/>
</box>
<spacer width="50" height="25" />
<button id="add_device" I18N="In the input configuration screen" text="Add a device" align="center"/>
<label I18N="In the input configuration screen" text="* Which config to use will be inferred from which 'Select' key is pressed to join the game."
proportion="2" word_wrap="true"/>
</box>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/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_video" width="128" height="128" icon="gui/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
<icon-button id="tab_language" width="128" height="128" icon="gui/options_language.png"
I18N="Section in the settings menu" text="Language"/>
</vertical-tabs>
<spacer width="2%" height="100%"/>
<box width="80%" height="100%" layout="vertical-row">
<label width="100%"
I18N="In the input configuration screen"
text="Press enter or double-click on a device to configure it"
text_align="center" />
<spacer width="5" height="20"/>
<box proportion="5" width="75%" align="center" layout="vertical-row" padding="8">
<list id="devices" x="0" y="0" width="100%" height="100%"/>
</box>
<spacer width="50" height="25" />
<button id="add_device" I18N="In the input configuration screen" text="Add a device" align="center"/>
<label I18N="In the input configuration screen" text="* Which config to use will be inferred from which 'Select' key is pressed to join the game."
proportion="2" word_wrap="true"/>
</box>
</div>
</div>
</stkgui>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/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_video" width="128" height="128" icon="gui/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
<icon-button id="tab_language" width="128" height="128" icon="gui/options_language.png"
I18N="Section in the settings menu" text="Language"/>
</vertical-tabs>
<spacer width="2%" height="100%"/>
<box width="80%" height="100%" layout="vertical-row">
<spacer width="5" height="3%"/>
<!-- ************ LANGUAGE CHOICE ************ -->
<box proportion="1" width="75%" align="center" layout="vertical-row" padding="8">
<list id="language" x="0" y="0" width="100%" height="100%"/>
</box>
<spacer width="5" height="3%"/>
</box>
</div>
</div>
</stkgui>

View File

@ -1,107 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<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/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<spacer height="5" width="10" />
<!-- ************ SKIN CHOICE ************ -->
<div layout="horizontal-row" width="100%" height="fit">
<label I18N="In the ui settings" text="Skin" align="center"/>
<spacer width="20" height="20"/>
<spinner id="skinchoice" width="30%"/>
</div>
<spacer width="20" height="18" />
<div layout="horizontal-row" width="100%" height="fit">
<div proportion="1" height="fit" layout="horizontal-row">
<checkbox id="showfps"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the ui settings" text="Display FPS"/>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="show-login"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the ui settings" text="Always show login screen"/>
</div>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="enable-hw-report"/>
<spacer width="20" height="100%" />
<label height="100%" id="label-hw-report" I18N="In the ui settings"
text="Send anonymous HW statistics"/>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="perPlayerDifficulty"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the ui settings" text="Enable per-player handicaps"/>
</div>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div proportion="1" height="fit" layout="horizontal-row" >
<checkbox id="enable-internet"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the ui settings" text="Connect to the Internet"/>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="split_screen_horizontally"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the ui settings" text="Multiplayer splits screen horizontally"/>
</div>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div proportion="1" height="fit" layout="horizontal-row" >
<checkbox id="enable-lobby-chat"/>
<spacer width="20" height="100%" />
<label height="100%" id="label-lobby-chat" I18N="In the ui settings" text="Enable chatting in networking lobby"/>
</div>
</div>
<spacer height="18" width="4"/>
<!-- ************ LANGUAGE CHOICE ************ -->
<box proportion="1" width="75%" align="center" layout="vertical-row" padding="8">
<list id="language" x="0" y="0" width="100%" height="100%"/>
</box>
<spacer height="18" width="4"/>
</box>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/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_video" width="128" height="128" icon="gui/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
<icon-button id="tab_language" width="128" height="128" icon="gui/options_language.png"
I18N="Section in the settings menu" text="Language"/>
</vertical-tabs>
<spacer width="2%" height="100%"/>
<box width="80%" height="100%" layout="vertical-row">
<spacer width="5" height="1%"/>
<!-- ************ SKIN CHOICE ************ -->
<div layout="horizontal-row" width="100%" height="fit">
<label I18N="In the ui settings" text="Skin" align="center"/>
<spacer width="2%" height="20"/>
<spinner id="skinchoice" width="30%"/>
</div>
<spacer width="5" height="3%"/>
<div layout="horizontal-row" width="100%" height="fit">
<div proportion="1" height="fit" layout="horizontal-row">
<checkbox id="showfps"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the ui settings" text="Display FPS" word_wrap="true"/>
</div>
</div>
<spacer width="5" height="3%"/>
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="split_screen_horizontally"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the ui settings" text="Multiplayer splits screen horizontally" word_wrap="true"/>
</div>
<spacer width="2%" height="5"/>
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="perPlayerDifficulty"/>
<spacer width="2%" height="100%" />
<label height="100%" I18N="In the ui settings" text="Enable per-player handicaps" word_wrap="true"/>
</div>
</div>
<spacer width="5" height="3%"/>
<div layout="horizontal-row" width="100%" height="fit">
<div proportion="1" height="fit" layout="horizontal-row" >
<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="2%" height="5"/>
<div layout="horizontal-row" proportion="1" 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>
</div>
<spacer width="5" height="3%"/>
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" proportion="1" 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="2%" height="5"/>
<div proportion="1" height="fit" layout="horizontal-row" >
<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>
</div>
<spacer width="5" height="3%"/>
</box>
</div>
</div>
</stkgui>

View File

@ -1,83 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<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/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<spacer height="15" width="10"/>
<!-- ************ GRAPHICAL EFFECTS SETTINGS ************ -->
<div width="75%" height="fit" layout="horizontal-row" id="outer_box" >
<label I18N="In the video settings" text="Graphical Effects Level" align="center"/>
<spacer width="20" height="20"/>
<div layout="vertical-row" proportion="1" height="fit" id="inner_box">
<gauge id="gfx_level" min_value="1" max_value="8" width="300" align="center" />
<spacer height="5" width="10"/>
<button id="custom" text="Custom settings..." I18N="In the video settings" align="center"/>
</div>
</div>
<spacer height="10" width="10"/>
<!-- ************ VSYNC ************ -->
<div width="75%" height="fit" layout="horizontal-row" >
<spacer width="40" height="2" />
<checkbox id="vsync"/>
<spacer width="20" height="2" />
<label height="100%" I18N="In the video settings" text="Vertical Sync (requires restart)"/>
</div>
<spacer height="10" width="10"/>
<!-- ************ RESOLUTION CHOICE ************ -->
<spacer height="10" width="10"/>
<label width="100%" I18N="In the video settings" text="Resolution"/>
<scrollable_ribbon id="resolutions" proportion="1" label_location="each"
width="100%" square_items="false"
align="center" child_width="128" child_height="128" max_height="150" />
<spacer height="10" width="10"/>
<div width="75%" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<checkbox id="fullscreen"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the video settings" text="Fullscreen"/>
</div>
<div width="75%" layout="horizontal-row" height="fit">
<spacer width="40" height="100%" />
<checkbox id="rememberWinpos"/>
<spacer width="20" height="100%" />
<label I18N="In the video settings" text="Remember window location"/>
</div>
<spacer height="10" width="10"/>
<div width="100%" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<button id="apply_resolution"
I18N="In the video settings" text="Apply new resolution" />
</div>
<spacer height="15" width="4"/>
</box>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/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_video" width="128" height="128" icon="gui/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
<icon-button id="tab_language" width="128" height="128" icon="gui/options_language.png"
I18N="Section in the settings menu" text="Language"/>
</vertical-tabs>
<spacer width="2%" height="100%"/>
<box width="80%" height="100%" layout="vertical-row">
<spacer width="5" height="1%"/>
<!-- ************ GRAPHICAL EFFECTS SETTINGS ************ -->
<div width="75%" height="fit" layout="horizontal-row" id="outer_box" >
<label I18N="In the video settings" text="Graphical Effects Level" align="center"/>
<spacer width="20" height="20"/>
<div layout="vertical-row" proportion="1" height="fit" id="inner_box">
<gauge id="gfx_level" min_value="1" max_value="8" width="300" align="center" />
<spacer height="5" width="10"/>
<button id="custom" text="Custom settings..." I18N="In the video settings" align="center"/>
</div>
</div>
<spacer width="5" height="1%"/>
<!-- ************ VSYNC ************ -->
<div width="75%" height="fit" layout="horizontal-row" >
<spacer width="40" height="2" />
<checkbox id="vsync"/>
<spacer width="20" height="2" />
<label height="100%" I18N="In the video settings" text="Vertical Sync (requires restart)"/>
</div>
<spacer width="5" height="1%"/>
<!-- ************ RESOLUTION CHOICE ************ -->
<spacer width="5" height="1%"/>
<label width="100%" I18N="In the video settings" text="Resolution"/>
<scrollable_ribbon id="resolutions" proportion="1" label_location="each"
width="100%" square_items="false"
align="center" child_width="128" child_height="128" max_height="150" />
<spacer width="5" height="1%"/>
<div width="75%" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<checkbox id="fullscreen"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the video settings" text="Fullscreen"/>
</div>
<div width="75%" layout="horizontal-row" height="fit">
<spacer width="40" height="100%" />
<checkbox id="rememberWinpos"/>
<spacer width="20" height="100%" />
<label I18N="In the video settings" text="Remember window location"/>
</div>
<spacer width="5" height="1%"/>
<div width="100%" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<button id="apply_resolution"
I18N="In the video settings" text="Apply new resolution" />
</div>
<spacer width="5" height="1%"/>
</box>
</div>
</div>
</stkgui>

View File

@ -1,90 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="SuperTuxKart Options"/>
<spacer height="15" width="10"/>
<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/options_video.png"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"/>
</tabs>
<box proportion="1" width="98%" layout="vertical-row">
<spacer height="2%" width="10"/>
<scrollable_ribbon id="players" height="18%" y="10" x="10" width="98%" align="center" label_location="each"
square_items="true" child_width="128" child_height="128" />
<spacer height="2%" width="10"/>
<div width="90%" align="center" layout="vertical-row" proportion="1">
<div width="100%" height="fit" layout="horizontal-row" >
<checkbox width="fit" id="online" I18N="In the user screen" text_align="left"/>
<spacer width="10"/>
<label proportion="1" height="100%" text_align="left" I18N="In the user screen" text="Online"/>
</div>
<div width="100%" height="fit" layout="horizontal-row" >
<checkbox width="fit" id="remember-user" I18N="In the user screen" text_align="left"/>
<spacer width="10"/>
<label proportion="1" id="label_remember" height="100%" text_align="left"
I18N="In the user screen" text="Remember password"/>
</div>
<!-- Disable guest accounts for now
<div width="100%" height="fit" layout="horizontal-row" >
<label width="40%" id="label_guest" height="100%" text_align="left"
I18N="In the user screen" text="Guest login"/>
<checkbox id="guest" I18N="In the user screen" text_align="left"/>
</div>
-->
<div width="100%" height="fit" layout="horizontal-row" >
<label width="40%" id="label_username" height="100%" text_align="left"
I18N="In the user screen" text="Username"/>
<textbox id="username" proportion="2" height="fit" I18N="In the user screen"/>
</div>
<spacer height="5%" width="20"/>
<div width="100%" height="fit" layout="horizontal-row" >
<label id="label_password" width="40%" height="100%" text_align="left"
I18N="In the user screen" text="Password"/>
<textbox id="password" proportion="2" height="fit" I18N="In the user screen"/>
</div>
<spacer height="5%" width="20"/>
<button id="password_reset" width="fit" text="Reset password"/>
<spacer height="5%" width="20"/>
<label id="message" width="100%" text_align="center"/>
</div>
<spacer width="20" height="2%"/>
<div width="90%" align="center" layout="vertical-row" height="18%">
<buttonbar id="options" width="100%" height="100%" align="center">
<icon-button id="ok" width="fit" height="fit" icon="gui/green_check.png"
I18N="In the user screen" text="OK" label_location="bottom"/>
<icon-button id="new_user" width="fit" height="fit" icon="gui/blue_plus.png"
I18N="In the user screen" text="Add user" label_location="bottom"/>
<icon-button id="delete" width="fit" height="fit" icon="gui/remove.png"
I18N="In the user screen" text="Delete" label_location="bottom"/>
<icon-button id="rename" width="fit" height="fit" icon="gui/rename.png"
I18N="In the user screen" text="Rename" label_location="bottom"/>
<icon-button id="default_kart_color" width="fit" height="fit" icon="gui/edit.png"
I18N="In the user screen" text="Default kart color" label_location="bottom"/>
<icon-button id="cancel" width="fit" height="fit" icon="gui/main_quit.png"
I18N="In the user screen" text="Cancel" label_location="bottom"/>
</buttonbar>
</div>
<spacer width="20" height="5%"/>
</box>
<spacer width="20" height="15"/>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/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_video" width="128" height="128" icon="gui/options_video.png"
I18N="Section in the settings menu" text="Graphics"/>
<icon-button id="tab_audio" width="128" height="128" icon="gui/options_audio.png"
I18N="Section in the settings menu" text="Audio"/>
<icon-button id="tab_ui" width="128" height="128" icon="gui/options_ui.png"
I18N="Section in the settings menu" text="User Interface"/>
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
<icon-button id="tab_language" width="128" height="128" icon="gui/options_language.png"
I18N="Section in the settings menu" text="Language"/>
</vertical-tabs>
<spacer width="2%" height="100%"/>
<box width="80%" height="100%" layout="vertical-row">
<spacer height="2%" width="10"/>
<scrollable_ribbon id="players" height="18%" y="10" x="10" width="98%" align="center" label_location="each"
square_items="true" child_width="128" child_height="128" />
<spacer height="2%" width="10"/>
<div width="90%" align="center" layout="vertical-row" proportion="1">
<div width="100%" height="fit" layout="horizontal-row" >
<checkbox width="fit" id="online" I18N="In the user screen" text_align="left"/>
<spacer width="10"/>
<label proportion="1" height="100%" text_align="left" I18N="In the user screen" text="Online"/>
</div>
<div width="100%" height="fit" layout="horizontal-row" >
<checkbox width="fit" id="remember-user" I18N="In the user screen" text_align="left"/>
<spacer width="10"/>
<label proportion="1" id="label_remember" height="100%" text_align="left"
I18N="In the user screen" text="Remember password"/>
</div>
<!-- Disable guest accounts for now
<div width="100%" height="fit" layout="horizontal-row" >
<label width="40%" id="label_guest" height="100%" text_align="left"
I18N="In the user screen" text="Guest login"/>
<checkbox id="guest" I18N="In the user screen" text_align="left"/>
</div>
-->
<div width="100%" height="fit" layout="horizontal-row" >
<label width="40%" id="label_username" height="100%" text_align="left"
I18N="In the user screen" text="Username"/>
<textbox id="username" proportion="2" height="fit" I18N="In the user screen"/>
</div>
<spacer height="5%" width="20"/>
<div width="100%" height="fit" layout="horizontal-row" >
<label id="label_password" width="40%" height="100%" text_align="left"
I18N="In the user screen" text="Password"/>
<textbox id="password" proportion="2" height="fit" I18N="In the user screen"/>
</div>
<spacer height="5%" width="20"/>
<button id="password_reset" width="fit" text="Reset password"/>
<spacer height="5%" width="20"/>
<label id="message" width="100%" text_align="center"/>
</div>
<spacer width="20" height="2%"/>
<div width="90%" align="center" layout="vertical-row" height="18%">
<buttonbar id="options" width="100%" height="100%" align="center">
<icon-button id="ok" width="fit" height="fit" icon="gui/green_check.png"
I18N="In the user screen" text="OK" label_location="bottom"/>
<icon-button id="new_user" width="fit" height="fit" icon="gui/blue_plus.png"
I18N="In the user screen" text="Add user" label_location="bottom"/>
<icon-button id="delete" width="fit" height="fit" icon="gui/remove.png"
I18N="In the user screen" text="Delete" label_location="bottom"/>
<icon-button id="rename" width="fit" height="fit" icon="gui/rename.png"
I18N="In the user screen" text="Rename" label_location="bottom"/>
<icon-button id="default_kart_color" width="fit" height="fit" icon="gui/edit.png"
I18N="In the user screen" text="Default kart color" label_location="bottom"/>
<icon-button id="cancel" width="fit" height="fit" icon="gui/main_quit.png"
I18N="In the user screen" text="Cancel" label_location="bottom"/>
</buttonbar>
</div>
<spacer width="20" height="5%"/>
</box>
</div>
</div>
</stkgui>

View File

@ -28,6 +28,7 @@
#include "guiengine/widget.hpp"
#include "io/file_manager.hpp"
#include "states_screens/options_screen_input.hpp"
#include "states_screens/options_screen_language.hpp"
#include "states_screens/options_screen_ui.hpp"
#include "states_screens/options_screen_video.hpp"
#include "states_screens/state_manager.hpp"
@ -58,13 +59,9 @@ void OptionsScreenAudio::init()
Screen::init();
RibbonWidget* ribbon = this->getWidget<RibbonWidget>("options_choice");
assert(ribbon != NULL);
ribbon->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
ribbon->select( "tab_audio", PLAYER_ID_GAME_MASTER );
ribbon->getRibbonChildren()[0].setTooltip( _("Graphics") );
ribbon->getRibbonChildren()[2].setTooltip( _("User Interface") );
ribbon->getRibbonChildren()[3].setTooltip( _("Players") );
ribbon->getRibbonChildren()[4].setTooltip( _("Controls") );
// ---- sfx volume
SpinnerWidget* gauge = this->getWidget<SpinnerWidget>("sfx_volume");
assert(gauge != NULL);
@ -115,6 +112,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_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}

View File

@ -33,6 +33,7 @@
#include "states_screens/dialogs/press_a_key_dialog.hpp"
#include "states_screens/options_screen_audio.hpp"
#include "states_screens/options_screen_input.hpp"
#include "states_screens/options_screen_language.hpp"
#include "states_screens/options_screen_video.hpp"
#include "states_screens/options_screen_ui.hpp"
#include "states_screens/state_manager.hpp"
@ -62,8 +63,7 @@ void OptionsScreenDevice::loadedFromFile()
void OptionsScreenDevice::beforeAddingWidget()
{
GUIEngine::ListWidget* w_list =
getWidget<GUIEngine::ListWidget>("actions");
ListWidget* w_list = getWidget<GUIEngine::ListWidget>("actions");
assert(w_list != NULL);
w_list->clearColumns();
w_list->addColumn(_("Action"), 1);
@ -78,14 +78,9 @@ void OptionsScreenDevice::init()
Screen::init();
RibbonWidget* tabBar = getWidget<RibbonWidget>("options_choice");
assert(tabBar != NULL);
// Focus is set to the actions list later in the init
tabBar->select( "tab_controls", PLAYER_ID_GAME_MASTER );
tabBar->getRibbonChildren()[0].setTooltip( _("Graphics") );
tabBar->getRibbonChildren()[1].setTooltip( _("Audio") );
tabBar->getRibbonChildren()[2].setTooltip( _("User Interface") );
tabBar->getRibbonChildren()[3].setTooltip( _("Players") );
ButtonWidget* delete_button = getWidget<ButtonWidget>("delete");
if (!m_config->isKeyboard())
{
@ -129,13 +124,12 @@ void OptionsScreenDevice::init()
LabelWidget* label = getWidget<LabelWidget>("title");
label->setText( m_config->getName().c_str(), false );
GUIEngine::ListWidget* actions =
getWidget<GUIEngine::ListWidget>("actions");
assert( actions != NULL );
// ---- create list skeleton (right number of items, right internal names)
// their actualy contents will be adapted as needed after
ListWidget* actions = getWidget<GUIEngine::ListWidget>("actions");
assert( actions != NULL );
//I18N: Key binding section
addListItemSubheader(actions, "game_keys_section", _("Game Keys"));
addListItem(actions, PA_STEER_LEFT);
@ -161,6 +155,10 @@ void OptionsScreenDevice::init()
updateInputButtons();
// Focus the list and select its first item
actions->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
actions->setSelectionID(0);
// Disable deletion keyboard configurations
bool in_game = StateManager::get()->getGameState() == GUIEngine::INGAME_MENU;
@ -506,14 +504,16 @@ void OptionsScreenDevice::eventCallback(Widget* widget,
Screen *screen = NULL;
if (selection == "tab_audio")
screen = OptionsScreenAudio::getInstance();
//else if (selection == "tab_video")
// screen = OptionsScreenVideo::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_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}

View File

@ -30,6 +30,7 @@
#include "io/file_manager.hpp"
#include "states_screens/options_screen_device.hpp"
#include "states_screens/options_screen_audio.hpp"
#include "states_screens/options_screen_language.hpp"
#include "states_screens/options_screen_video.hpp"
#include "states_screens/options_screen_ui.hpp"
#include "states_screens/dialogs/add_device_dialog.hpp"
@ -154,13 +155,8 @@ void OptionsScreenInput::init()
Screen::init();
RibbonWidget* tabBar = this->getWidget<RibbonWidget>("options_choice");
assert(tabBar != NULL);
tabBar->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
tabBar->select( "tab_controls", PLAYER_ID_GAME_MASTER );
tabBar->getRibbonChildren()[0].setTooltip( _("Graphics") );
tabBar->getRibbonChildren()[1].setTooltip( _("Audio") );
tabBar->getRibbonChildren()[2].setTooltip( _("User Interface") );
tabBar->getRibbonChildren()[3].setTooltip( _("Players") );
/*
DynamicRibbonWidget* devices = this->getWidget<DynamicRibbonWidget>("devices");
assert( devices != NULL );
@ -222,6 +218,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_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}

View File

@ -0,0 +1,213 @@
// 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_screen_language.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_screen_audio.hpp"
#include "states_screens/options_screen_input.hpp"
#include "states_screens/options_screen_ui.hpp"
#include "states_screens/options_screen_video.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/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;
// -----------------------------------------------------------------------------
OptionsScreenLanguage::OptionsScreenLanguage() : Screen("options_language.stkgui")
{
m_inited = false;
} // OptionsScreenLanguage
// -----------------------------------------------------------------------------
void OptionsScreenLanguage::loadedFromFile()
{
m_inited = false;
} // loadedFromFile
// -----------------------------------------------------------------------------
void OptionsScreenLanguage::init()
{
Screen::init();
RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
assert(ribbon != NULL);
ribbon->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
ribbon->select( "tab_language", PLAYER_ID_GAME_MASTER );
// --- language
ListWidget* list_widget = getWidget<ListWidget>("language");
// I18N: in the language choice, to select the same language as the OS
list_widget->addItem("system", _("System Language"));
const std::vector<std::string>* lang_list = translations->getLanguageList();
const int amount = (int)lang_list->size();
// The names need to be sorted alphabetically. Store the 2-letter
// language names in a mapping, to be able to get them from the
// user visible full name.
std::vector<core::stringw> nice_lang_list;
std::map<core::stringw, std::string> nice_name_2_id;
for (int n=0; n<amount; n++)
{
std::string code_name = (*lang_list)[n];
std::string s_name = translations->getLocalizedName(code_name) +
" (" + tinygettext::Language::from_name(code_name).get_language() + ")";
core::stringw nice_name = translations->fribidize(StringUtils::utf8ToWide(s_name));
nice_lang_list.push_back(nice_name);
nice_name_2_id[nice_name] = code_name;
}
std::sort(nice_lang_list.begin(), nice_lang_list.end());
for(unsigned int i=0; i<nice_lang_list.size(); i++)
{
list_widget->addItem(nice_name_2_id[nice_lang_list[i]],
nice_lang_list[i]);
}
list_widget->setSelectionID( list_widget->getItemID(UserConfigParams::m_language) );
// Forbid changing language while in-game, since this crashes (changing the language involves
// tearing down and rebuilding the menu stack. not good when in-game)
list_widget->setActive(StateManager::get()->getGameState() != GUIEngine::INGAME_MENU);
} // init
// -----------------------------------------------------------------------------
void OptionsScreenLanguage::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_language")
// screen = OptionsScreenLanguage::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if(name == "back")
{
StateManager::get()->escapePressed();
}
else if (name == "language")
{
ListWidget* list_widget = getWidget<ListWidget>("language");
std::string selection = list_widget->getSelectionInternalName();
delete translations;
if (selection == "system")
{
#ifdef WIN32
_putenv("LANGUAGE=");
#else
unsetenv("LANGUAGE");
#endif
}
else
{
#ifdef WIN32
std::string s=std::string("LANGUAGE=")+selection.c_str();
_putenv(s.c_str());
#else
setenv("LANGUAGE", selection.c_str(), 1);
#endif
}
translations = new Translations();
// Reload fonts for new translation
GUIEngine::getStateManager()->hardResetAndGoToScreen<MainMenuScreen>();
font_manager->getFont<BoldFace>()->reset();
font_manager->getFont<RegularFace>()->reset();
GUIEngine::getFont()->updateRTL();
GUIEngine::getTitleFont()->updateRTL();
GUIEngine::getSmallFont()->updateRTL();
GUIEngine::getLargeFont()->updateRTL();
GUIEngine::getOutlineFont()->updateRTL();
UserConfigParams::m_language = selection.c_str();
user_config->saveConfig();
OptionsScreenLanguage::getInstance()->push();
}
#endif
} // eventCallback
// -----------------------------------------------------------------------------
void OptionsScreenLanguage::tearDown()
{
Screen::tearDown();
// save changes when leaving screen
user_config->saveConfig();
} // tearDown
// -----------------------------------------------------------------------------
void OptionsScreenLanguage::unloaded()
{
m_inited = false;
} // unloaded
// -----------------------------------------------------------------------------

View File

@ -0,0 +1,59 @@
// 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_LANGUAGE_HPP__
#define __HEADER_OPTIONS_SCREEN_LANGUAGE_HPP__
#include <string>
#include "guiengine/screen.hpp"
namespace GUIEngine { class Widget; }
struct Input;
/**
* \brief Graphics options screen
* \ingroup states_screens
*/
class OptionsScreenLanguage : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OptionsScreenLanguage>
{
OptionsScreenLanguage();
bool m_inited;
public:
friend class GUIEngine::ScreenSingleton<OptionsScreenLanguage>;
/** \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

@ -41,6 +41,7 @@
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/options_screen_audio.hpp"
#include "states_screens/options_screen_input.hpp"
#include "states_screens/options_screen_language.hpp"
#include "states_screens/options_screen_video.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/user_screen.hpp"
@ -116,13 +117,9 @@ void OptionsScreenUI::init()
Screen::init();
RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
assert(ribbon != NULL);
ribbon->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
ribbon->select( "tab_ui", PLAYER_ID_GAME_MASTER );
ribbon->getRibbonChildren()[0].setTooltip( _("Graphics") );
ribbon->getRibbonChildren()[1].setTooltip( _("Audio") );
ribbon->getRibbonChildren()[3].setTooltip( _("Players") );
ribbon->getRibbonChildren()[4].setTooltip( _("Controls") );
GUIEngine::SpinnerWidget* skinSelector = getWidget<GUIEngine::SpinnerWidget>("skinchoice");
assert( skinSelector != NULL );
@ -195,44 +192,6 @@ void OptionsScreenUI::init()
GUIEngine::reloadSkin();
irr_driver->setMaxTextureSize();
}
// --- language
ListWidget* list_widget = getWidget<ListWidget>("language");
// I18N: in the language choice, to select the same language as the OS
list_widget->addItem("system", _("System Language"));
const std::vector<std::string>* lang_list = translations->getLanguageList();
const int amount = (int)lang_list->size();
// The names need to be sorted alphabetically. Store the 2-letter
// language names in a mapping, to be able to get them from the
// user visible full name.
std::vector<core::stringw> nice_lang_list;
std::map<core::stringw, std::string> nice_name_2_id;
for (int n=0; n<amount; n++)
{
std::string code_name = (*lang_list)[n];
std::string s_name = translations->getLocalizedName(code_name) +
" (" + tinygettext::Language::from_name(code_name).get_language() + ")";
core::stringw nice_name = translations->fribidize(StringUtils::utf8ToWide(s_name));
nice_lang_list.push_back(nice_name);
nice_name_2_id[nice_name] = code_name;
}
std::sort(nice_lang_list.begin(), nice_lang_list.end());
for(unsigned int i=0; i<nice_lang_list.size(); i++)
{
list_widget->addItem(nice_name_2_id[nice_lang_list[i]],
nice_lang_list[i]);
}
list_widget->setSelectionID( list_widget->getItemID(UserConfigParams::m_language) );
// Forbid changing language while in-game, since this crashes (changing the language involves
// tearing down and rebuilding the menu stack. not good when in-game)
list_widget->setActive(StateManager::get()->getGameState() != GUIEngine::INGAME_MENU);
} // init
// -----------------------------------------------------------------------------
@ -255,6 +214,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_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
@ -345,49 +306,6 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
assert( difficulty != NULL );
UserConfigParams::m_per_player_difficulty = difficulty->getState();
}
else if (name == "language")
{
ListWidget* list_widget = getWidget<ListWidget>("language");
std::string selection = list_widget->getSelectionInternalName();
delete translations;
if (selection == "system")
{
#ifdef WIN32
_putenv("LANGUAGE=");
#else
unsetenv("LANGUAGE");
#endif
}
else
{
#ifdef WIN32
std::string s=std::string("LANGUAGE=")+selection.c_str();
_putenv(s.c_str());
#else
setenv("LANGUAGE", selection.c_str(), 1);
#endif
}
translations = new Translations();
// Reload fonts for new translation
GUIEngine::getStateManager()->hardResetAndGoToScreen<MainMenuScreen>();
font_manager->getFont<BoldFace>()->reset();
font_manager->getFont<RegularFace>()->reset();
GUIEngine::getFont()->updateRTL();
GUIEngine::getTitleFont()->updateRTL();
GUIEngine::getSmallFont()->updateRTL();
GUIEngine::getLargeFont()->updateRTL();
GUIEngine::getOutlineFont()->updateRTL();
UserConfigParams::m_language = selection.c_str();
user_config->saveConfig();
OptionsScreenUI::getInstance()->push();
}
#endif
} // eventCallback

View File

@ -32,6 +32,7 @@
#include "states_screens/dialogs/custom_video_settings.hpp"
#include "states_screens/options_screen_audio.hpp"
#include "states_screens/options_screen_input.hpp"
#include "states_screens/options_screen_language.hpp"
#include "states_screens/options_screen_ui.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/user_screen.hpp"
@ -200,13 +201,9 @@ void OptionsScreenVideo::init()
m_prev_img_quality = getImageQuality();
RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
assert(ribbon != NULL);
ribbon->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
ribbon->select( "tab_video", PLAYER_ID_GAME_MASTER );
ribbon->getRibbonChildren()[1].setTooltip( _("Audio") );
ribbon->getRibbonChildren()[2].setTooltip( _("User Interface") );
ribbon->getRibbonChildren()[3].setTooltip( _("Players") );
ribbon->getRibbonChildren()[4].setTooltip( _("Controls") );
GUIEngine::ButtonWidget* applyBtn =
getWidget<GUIEngine::ButtonWidget>("apply_resolution");
assert( applyBtn != NULL );
@ -500,6 +497,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_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}

View File

@ -35,6 +35,7 @@
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/options_screen_audio.hpp"
#include "states_screens/options_screen_input.hpp"
#include "states_screens/options_screen_language.hpp"
#include "states_screens/options_screen_ui.hpp"
#include "states_screens/options_screen_video.hpp"
#include "states_screens/register_screen.hpp"
@ -707,11 +708,8 @@ void TabbedUserScreen::init()
{
RibbonWidget* tab_bar = getWidget<RibbonWidget>("options_choice");
assert(tab_bar != NULL);
tab_bar->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
tab_bar->select("tab_players", PLAYER_ID_GAME_MASTER);
tab_bar->getRibbonChildren()[0].setTooltip( _("Graphics") );
tab_bar->getRibbonChildren()[1].setTooltip( _("Audio") );
tab_bar->getRibbonChildren()[2].setTooltip( _("User Interface") );
tab_bar->getRibbonChildren()[4].setTooltip( _("Controls") );
BaseUserScreen::init();
} // init
@ -737,6 +735,8 @@ void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget,
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
else if (selection == "tab_language")
screen = OptionsScreenLanguage::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}

View File

@ -149,6 +149,7 @@ class TabbedUserScreen : public BaseUserScreen,
public GUIEngine::ScreenSingleton<TabbedUserScreen>
{
private:
//FIXME : options_players.stkgui exists but is unused
TabbedUserScreen() : BaseUserScreen("user_screen_tab.stkgui")
{}