Minor prefs cleanup

This commit is contained in:
Celtic Minstrel 2016-02-16 23:39:59 -05:00
parent 33da7920cf
commit eef5db9327
2 changed files with 3 additions and 56 deletions

View file

@ -80,7 +80,6 @@ const std::string bool_to_display_string(bool value)
namespace gui2 { namespace gui2 {
// TODO: probably should use a namespace alias instead
using namespace preferences; using namespace preferences;
REGISTER_DIALOG(preferences) REGISTER_DIALOG(preferences)
@ -835,10 +834,10 @@ void tpreferences::on_advanced_prefs_list_select(tlistbox& list, twindow& window
if(selected_type == ADVANCED_PREF_TYPE::SPECIAL) { if(selected_type == ADVANCED_PREF_TYPE::SPECIAL) {
if (selected_field == "advanced_graphic_options") { if (selected_field == "advanced_graphic_options") {
gui2::tadvanced_graphics_options::display(window.video()); gui2::tadvanced_graphics_options::display(window.video());
} } else if (selected_field == "orb_color") {
if (selected_field == "orb_color") {
gui2::tselect_orb_colors::display(window.video()); gui2::tselect_orb_colors::display(window.video());
} else {
WRN_GUI_L << "Invalid or unimplemented custom advanced prefs option: " << selected_field << "\n";
} }
// Add more options here as needed // Add more options here as needed

View file

@ -115,57 +115,5 @@ void set_idle_anim_rate(int rate) {
} }
} }
bool show_video_mode_dialog(CVideo& video)
{
const resize_lock prevent_resizing;
// For some reason, this line prevents the dialog from being opened from GUI2...
//const events::event_context dialog_events_context;
std::vector<std::pair<int,int> > resolutions
= video.get_available_resolutions();
if(resolutions.empty()) {
gui2::show_transient_message(
video
, ""
, _("There are no alternative video modes available"));
return false;
}
std::vector<std::string> options;
unsigned current_choice = 0;
for(size_t k = 0; k < resolutions.size(); ++k) {
std::pair<int, int> const& res = resolutions[k];
if (res == video.current_resolution())
current_choice = static_cast<unsigned>(k);
std::ostringstream option;
option << res.first << utils::unicode_multiplication_sign << res.second;
const int div = boost::math::gcd(res.first, res.second);
const int ratio[2] = {res.first/div, res.second/div};
if (ratio[0] <= 10 || ratio[1] <= 10)
option << " (" << ratio[0] << ':' << ratio[1] << ')';
options.push_back(option.str());
}
gui2::tsimple_item_selector dlg(_("Choose Resolution"), "", options);
dlg.set_selected_index(current_choice);
dlg.show(video);
int choice = dlg.selected_index();
if(choice == -1 || resolutions[static_cast<size_t>(choice)] == video.current_resolution()) {
return false;
}
video.set_resolution(resolutions[static_cast<size_t>(choice)]);
return true;
}
} // end namespace preferences } // end namespace preferences