Skip to content

Commit

Permalink
GUI2/Preferences Dialog: use standard status label value getters inst…
Browse files Browse the repository at this point in the history
…ead of lambdas where possible

Only reason I was using lambdas was since I needed to specify the fourth argument. I didn't realize I
could just bind the default value getters, especially since the functionality was equivalent.

Menu buttons can't use them yet.
  • Loading branch information
Vultraz committed Aug 25, 2017
1 parent c27aa6e commit 04bfecf
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/gui/dialogs/preferences_dialog.cpp
Expand Up @@ -596,9 +596,8 @@ void preferences_dialog::post_build(window& window)
[&, pref_name]() { set(pref_name, toggle_box.get_value_bool()); }
));

gui2::bind_status_label<toggle_button>(main_grid, "value_toggle", [](toggle_button& t)->std::string {
return t.get_value_bool() ? _("yes") : _("no");
}, "value");
gui2::bind_status_label<toggle_button>(
main_grid, "value_toggle", default_status_value_getter<toggle_button>, "value");

break;
}
Expand All @@ -622,9 +621,7 @@ void preferences_dialog::post_build(window& window)
[&, pref_name]() { set(pref_name, slide.get_value()); }
));

gui2::bind_status_label<slider>(main_grid, "setter", [](slider& s)->std::string {
return std::to_string(s.get_value());
}, "value");
gui2::bind_status_label<slider>(main_grid, "setter", default_status_value_getter<slider>, "value");

break;
}
Expand Down Expand Up @@ -973,9 +970,7 @@ void preferences_dialog::pre_show(window& window)
return s.get_value() == INFINITE_AUTO_SAVES ? _("") : s.get_value_label().str();
});

gui2::bind_status_label<slider>(&window, "turbo_slider", [](slider& s)->std::string {
return s.get_value_label();
});
gui2::bind_status_label<slider>(&window, "turbo_slider");

gui2::bind_status_label<slider>(&window, "scaling_slider", [](slider& s)->std::string {
return s.get_value_label() + "%";
Expand Down

0 comments on commit 04bfecf

Please sign in to comment.