preferences: Add description and name_short attributes to combo options

name_short is used for the value labels entered into the main advanced
preferences listbox, which ideally shouldn't be stretched too much
sideways because GUI1 sucks. (Optional, used instead of name.)

description is entered as a second column value in the combo box items
list when available, and should be used as a short description of the
entry. (Optional, used in addition to name in the combo box popup view
only.)
This commit is contained in:
Ignacio R. Morelle 2013-12-20 23:09:11 -03:00
parent ec7516f366
commit f1b4d2dc45

View file

@ -1052,7 +1052,18 @@ void preferences_dialog::process_event()
int adv_combo_choice = 0;
BOOST_FOREACH(const config& adv_combo_option, pref.child_range("option"))
{
adv_combo_items.push_back(adv_combo_option["name"]);
if(adv_combo_option.has_attribute("description")) {
// The longer description is supposed to be used in the combo
// box only as a workaround for the main listbox's layout
// limitations.
std::ostringstream ss;
ss << adv_combo_option["name"] << '='
<< adv_combo_option["description"];
adv_combo_items.push_back(ss.str());
} else {
adv_combo_items.push_back(adv_combo_option["name"]);
}
if(value == adv_combo_option["id"]) {
adv_combo_choice = adv_combo_items.size() - 1;
}
@ -1147,7 +1158,11 @@ void preferences_dialog::set_advanced_menu()
BOOST_FOREACH(const config& optdef, adv.child_range("option"))
{
if(field == optdef["id"]) {
field = optdef["name"].str();
if(optdef.has_attribute("name_short")) {
field = optdef["name_short"].str();
} else {
field = optdef["name"].str();
}
break;
}
}