gui2/tpreferences: Restore combobox adv. preferences option descriptions

These were lost with the original port and somehow they never got fixed
despite my repeated insistence.
This commit is contained in:
Ignacio R. Morelle 2016-09-20 07:11:43 -03:00
parent 4ffd212c91
commit f2efa155c9
2 changed files with 9 additions and 1 deletions

View file

@ -44,6 +44,8 @@ Version 1.13.5+dev:
* New categories bar in hotkey preferences allows you to filter hotkeys
* Fix issue with the title screen not redrawing when the window size or
fullscreen setting changes with a dialog open over it.
* Restored descriptions for choices in combobox-based Advanced Preferences
entries (lost in 1.13.3).
* WML Engine:
* Added ignore_special_locations=yes|no, default no, to [terrain_mask] to
ignore the special locations given in the mask, leaving all those on the

View file

@ -610,7 +610,12 @@ void tpreferences::post_build(twindow& window)
std::vector<std::string> option_ids;
for(const config& choice : option.child_range("option")) {
menu_data.push_back(config_of("label", choice["name"]));
config option;
option["label"] = choice["name"];
if(choice.has_attribute("description")) {
option["details"] = std::string("<span color='#777'>") + choice["description"] + "</span>";
}
menu_data.push_back(option);
option_ids.push_back(choice["id"]);
}
@ -625,6 +630,7 @@ void tpreferences::post_build(twindow& window)
tmenu_button& menu = find_widget<tmenu_button>(&details_grid, "setter", false);
menu.set_use_markup(true);
menu.set_values(menu_data, selected);
menu.set_callback_state_change([=](twidget& w) {
set(pref_name, option_ids[dynamic_cast<tmenu_button&>(w).get_value()]);