New title screen now handles language changes.

After changing the language the title screen now directly shows the text
in the new language.
This commit is contained in:
Mark de Wever 2010-04-02 09:07:02 +00:00
parent b680fbc95f
commit 17f8eaa475
4 changed files with 20 additions and 6 deletions

View file

@ -15,6 +15,8 @@ Version 1.9.0-svn:
--new-widgets title screen
* Added gui2 progress bar widget
* Added "animated" logo to the --new-widgets title screen
* Fixed the language is refreshed after the language is changed in the
--new-widgets title screen
* WML Engine:
* Deprecated [set_variable]'s random key, use rand instead
* Renamed [unit][status] healable to unhealable so it can default to 'no'

View file

@ -1312,8 +1312,6 @@ bool game_controller::change_language()
wm_title_string += " - " + game_config::revision;
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
}
t_string::reset_translations();
}
return true;

View file

@ -73,6 +73,8 @@ void tlanguage_selection::post_show(twindow& window)
const std::vector<language_def>& languages = get_languages();
::set_language(languages[res]);
preferences::set_language(languages[res].localename);
t_string::reset_translations();
}
}

View file

@ -47,6 +47,19 @@ void show_dialog(CVideo& video)
dlg.show(video);
}
void show_language_dialog(CVideo& video, twindow& window)
{
tlanguage_selection dlg;
dlg.show(video);
if(dlg.get_retval() == twindow::OK) {
/*
* This call both reloads all texts in the new translation for the
* widgets and then finds the new best layout in the new language.
*/
window.invalidate_layout();
}
}
} // namespace
/*WIKI
@ -105,7 +118,6 @@ static void animate_logo(
}
}
void ttitle_screen::pre_show(CVideo& video, twindow& window)
{
assert(!video_);
@ -124,11 +136,11 @@ void ttitle_screen::pre_show(CVideo& video, twindow& window)
show_dialog<gui2::taddon_connect>
, boost::ref(video)));
// Note changing the language doesn't upate the title screen...
find_widget<tbutton>(&window, "language", false).
connect_signal_mouse_left_click(boost::bind(
show_dialog<gui2::tlanguage_selection>
, boost::ref(video)));
show_language_dialog
, boost::ref(video)
, boost::ref(window)));
/**** Set the tip of the day ****/
/*