#include <preferences_dialog.hpp>
Public Types | |
typedef std::vector< const hotkey::hotkey_command * > | t_visible_hotkeys |
Public Member Functions | |
tpreferences (CVideo &video, const config &game_cfg) | |
Constructor. More... | |
void | set_selected_index (std::pair< int, int > index) |
Public Member Functions inherited from gui2::tdialog | |
tdialog () | |
virtual | ~tdialog () |
bool | show (CVideo &video, const unsigned auto_close_time=0) |
Shows the window. More... | |
int | get_retval () const |
void | set_always_save_fields (const bool always_save_fields) |
void | set_restore (const bool restore) |
Static Public Member Functions | |
static bool | display (CVideo &video, const config &game_cfg) |
The display function – see tdialog for more information. More... | |
Private Types | |
typedef std::pair< std::vector < std::string >, std::vector < std::string > > | combo_data |
Private Member Functions | |
virtual const std::string & | window_id () const |
Inherited from tdialog, implemented by REGISTER_DIALOG. More... | |
void | pre_show (twindow &window) |
Inherited from tdialog. More... | |
void | post_show (twindow &) |
Actions to be taken after the window has been shown. More... | |
void | initialize_members (twindow &window) |
Initializers. More... | |
void | initialize_tabs (twindow &window, tlistbox &selector, const int index) |
void | setup_friends_list (twindow &window) |
void | setup_hotkey_list (twindow &window) |
void | add_friend_list_entry (const bool is_friend, ttext_box &textbox, twindow &window) |
void | edit_friend_list_entry (tlistbox &friends, ttext_box &textbox) |
void | remove_friend_list_entry (tlistbox &friends_list, ttext_box &textbox, twindow &window) |
void | add_tab (tlistbox &tab_bar, const std::string &label) |
void | add_pager_row (tlistbox &selector, const std::string &icon, const std::string &label) |
void | set_visible_page (twindow &window, unsigned int page, const std::string &pager_id) |
void | on_page_select (twindow &window) |
Callback for selection changes. More... | |
void | on_tab_select (twindow &window) |
void | on_advanced_prefs_list_select (tlistbox &tree, twindow &window) |
void | handle_res_select (twindow &window) |
Special callback functions. More... | |
void | fullscreen_toggle_callback (twindow &window) |
void | accl_speed_slider_callback (tslider &slider) |
void | max_autosaves_slider_callback (tslider &slider, tcontrol &status_label) |
void | font_scaling_slider_callback (tslider &slider) |
void | animate_map_toggle_callback (ttoggle_button &toggle, ttoggle_button &toggle_water) |
void | add_hotkey_callback (tlistbox &hotkeys) |
void | remove_hotkey_callback (tlistbox &hotkeys) |
void | default_hotkey_callback (twindow &window) |
void | setup_single_toggle (const std::string &widget_id, const bool start_value, std::function< void(bool)> callback, twidget &find_in, const bool inverted=false) |
Sets the initial state and callback for a simple bool-state toggle button In the callback, the bool value of the widget is passeed to the setter. More... | |
void | single_toggle_callback (const ttoggle_button &widget, std::function< void(bool)> setter, const bool inverted) |
void | setup_toggle_slider_pair (const std::string &toggle_widget, const std::string &slider_widget, const bool toggle_start_value, const int slider_state_value, std::function< void(bool)> toggle_callback, std::function< void(int)> slider_callback, twidget &find_in) |
Sets the initial state and callback for a bool-state toggle button/slider pair. More... | |
void | toggle_slider_pair_callback (const ttoggle_button &toggle_widget, tslider &slider_widget, std::function< void(bool)> setter) |
void | setup_single_slider (const std::string &widget_id, const int start_value, std::function< void(int)> slider_callback, twidget &find_in) |
Sets the initial state and callback for a standalone slider In the callback, int value of the widget is passeed to the setter. More... | |
void | single_slider_callback (const tslider &widget, std::function< void(int)> setter) |
void | setup_combobox (const std::string &widget_id, const combo_data &options, const unsigned start_value, std::function< void(std::string)> callback, twidget &find_in) |
Sets the initial state and callback for a combobox. More... | |
void | simple_combobox_callback (const tcombobox &widget, std::function< void(std::string)> setter, std::vector< std::string > &vec) |
template<typename T > | |
void | setup_radio_toggle (const std::string &toggle_id, const T &enum_value, const int start_value, tgroup< T > &group, std::function< void(int)> callback, twindow &window) |
template<typename T > | |
void | toggle_radio_callback (tgroup< T > &group, std::function< void(int)> setter) |
template<typename T > | |
void | bind_status_label (T &parent, const std::string &label_id, twidget &find_in) |
Sets up a label that always displays the value of another widget. More... | |
void | bind_status_label (tslider &parent, const std::string &label_id, twidget &find_in, const std::string &suffix="") |
template<typename T > | |
void | status_label_callback (T &parent_widget, tcontrol &label_widget, const std::string &suffix="") |
Private Attributes | |
tgroup< preferences::LOBBY_JOINS > | lobby_joins_group |
Sets the a radio button group Since (so far) there is only one group of these, the code is speciliazed. More... | |
MAKE_ENUM(ADVANCED_PREF_TYPE,(TOGGLE,"boolean")(SLIDER,"int")(COMBO,"combo")(SPECIAL,"custom")) std std::vector< config > | adv_preferences_cfg_ |
std::vector< std::string > | friend_names_ |
int | last_selected_item_ |
std::vector< t_string > | accl_speeds_ |
t_visible_hotkeys | visible_hotkeys_ |
int | font_scaling_ |
std::pair< int, int > | index_ |
Additional Inherited Members | |
Protected Member Functions inherited from gui2::tdialog | |
tfield_bool * | register_bool (const std::string &id, const bool mandatory, const std::function< bool()> &callback_load_value=std::function< bool()>(), const std::function< void(const bool)> &callback_save_value=std::function< void(const bool)>(), const std::function< void(twidget &)> &callback_change=std::function< void(twidget &)>()) |
Creates a new boolean field. More... | |
tfield_bool * | register_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(twidget &)> &callback_change=std::function< void(twidget &)>()) |
Creates a new boolean field. More... | |
tfield_integer * | register_integer (const std::string &id, const bool mandatory, const std::function< int()> &callback_load_value=std::function< int()>(), const std::function< void(const int)> &callback_save_value=std::function< void(const int)>()) |
Creates a new integer field. More... | |
tfield_integer * | register_integer (const std::string &id, const bool mandatory, int &linked_variable) |
Creates a new integer field. More... | |
tfield_text * | register_text (const std::string &id, const bool mandatory, const std::function< std::string()> &callback_load_value=std::function< std::string()>(), const std::function< void(const std::string &)> &callback_save_value=std::function< void(const std::string &)>(), const bool capture_focus=false) |
Creates a new text field. More... | |
tfield_text * | register_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false) |
Creates a new text field. More... | |
tfield_label * | register_label (const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false) |
Registers a new control as a label. More... | |
tfield_label * | register_image (const std::string &id, const bool mandatory, const std::string &filename) |
Registers a new control as image. More... | |
Definition at line 41 of file preferences_dialog.hpp.
|
private |
Definition at line 150 of file preferences_dialog.hpp.
typedef std::vector<const hotkey::hotkey_command*> gui2::tpreferences::t_visible_hotkeys |
Definition at line 56 of file preferences_dialog.hpp.
Definition at line 1241 of file preferences_dialog.cpp.
References gui2::tslider::get_value(), and preferences::set_turbo_speed().
Referenced by initialize_members().
|
private |
Definition at line 365 of file preferences_dialog.cpp.
References _(), preferences::add_friend(), preferences::add_ignore(), gui2::ttext_box::clear(), pos, gui2::show_transient_message(), gui2::ttext_::text(), and gui2::twindow::video().
Referenced by initialize_members().
Definition at line 966 of file preferences_dialog.cpp.
References _(), hotkey::add_hotkey(), hotkey::hotkey_command::command, hotkey::get_description(), hotkey::get_hotkeys(), gui2::tlistbox::get_item_count(), hotkey::get_names(), gui2::tlistbox::get_row_grid(), gui2::tlistbox::get_selected_row(), gui2::twidget::get_window(), i, gui2::twindow::OK, hotkey::hotkey_command::scope, hotkey::set_active_scopes(), gui2::set_label(), hotkey::show_binding_dialog(), gui2::show_message(), vgettext(), gui2::twindow::video(), and gui2::tmessage::yes_no_buttons.
Referenced by initialize_members().
|
private |
Definition at line 1069 of file preferences_dialog.cpp.
References gui2::tlistbox::add_row().
|
private |
Definition at line 1077 of file preferences_dialog.cpp.
References gui2::tlistbox::add_row().
|
private |
Definition at line 1259 of file preferences_dialog.cpp.
References gui2::tselectable_::get_value_bool(), gui2::ttoggle_button::set_active(), and preferences::set_animate_map().
Referenced by initialize_members().
|
private |
Sets up a label that always displays the value of another widget.
Definition at line 294 of file preferences_dialog.cpp.
References gui2::disambiguate_widget_value(), and gui2::tcontrol::set_label().
|
private |
Definition at line 305 of file preferences_dialog.cpp.
References gui2::event::connect_signal_notify_modified(), gui2::tslider::get_value_label(), and gui2::tcontrol::set_label().
Definition at line 1015 of file preferences_dialog.cpp.
References _(), hotkey::clear_hotkeys(), gui2::twindow::invalidate_layout(), gui2::show_transient_message(), and gui2::twindow::video().
Referenced by initialize_members().
The display function – see tdialog for more information.
Definition at line 50 of file preferences_dialog.hpp.
References tpreferences().
Definition at line 391 of file preferences_dialog.cpp.
References preferences::get_acquaintances(), gui2::tlistbox::get_selected_row(), and gui2::ttext_::set_value().
Referenced by initialize_members().
Definition at line 1254 of file preferences_dialog.cpp.
References gui2::tslider::get_value().
Referenced by initialize_members().
Definition at line 1215 of file preferences_dialog.cpp.
References gui2::tcombobox::set_active(), and gui2::set_resolution_list().
Referenced by initialize_members().
Special callback functions.
Definition at line 1226 of file preferences_dialog.cpp.
References gui2::tcombobox::get_value(), events::raise_resize_event(), and gui2::set_resolution_list().
Referenced by initialize_members().
Initializers.
Sets up states and callbacks for each of the widgets.
Definition at line 434 of file preferences_dialog.cpp.
References preferences::_set_iconize_list(), preferences::_set_lobby_joins(), preferences::_set_sort_list(), accl_speed_slider_callback(), add_friend_list_entry(), add_hotkey_callback(), preferences::animate_map(), animate_map_toggle_callback(), preferences::animate_water(), preferences::autosavemax(), preferences::bell_volume(), bind_void(), preferences::chat_lines(), preferences::chat_timestamping(), config::child_range(), gui2::tcombobox::connect_click_handler(), gui2::event::connect_signal_mouse_left_click(), gui2::event::connect_signal_notify_modified(), default_hotkey_callback(), preferences::delete_saves(), preferences::disable_auto_moves(), gui2::tmp_alerts_options::display(), gui2::tgame_cache_options::display(), edit_friend_list_entry(), preferences::enable_whiteboard_mode_on_start(), gui2::event::find(), preferences::font_scaling(), font_scaling_slider_callback(), gui2::fullscreen(), fullscreen_toggle_callback(), gui2::get_advanced_row_grid(), gui2::get_max_autosaves_status_label(), gui2::tselectable_::get_value_bool(), preferences::grid(), handle_res_select(), gui2::twidget::tvisible::hidden, preferences::hide_whiteboard(), preferences::iconize_list(), preferences::idle_anim(), preferences::idle_anim_rate(), int(), preferences::interrupt_when_ally_sighted(), gui2::twidget::tvisible::invisible, lexical_cast(), preferences::lobby_joins(), gui2::make_dialog_callback(), max_autosaves_slider_callback(), preferences::music_on(), preferences::music_volume(), on_advanced_prefs_list_select(), preferences::remember_password(), remove_friend_list_entry(), remove_hotkey_callback(), preferences::save_replays(), preferences::scroll_speed(), game_config::images::selected, preferences::set(), gui2::tcombobox::set_active(), preferences::set_animate_water(), preferences::set_bell_volume(), preferences::set_chat_lines(), preferences::set_chat_timestamping(), gui2::tlistbox::set_column_order(), gui2::tcontrol::set_definition(), preferences::set_delete_saves(), preferences::set_disable_auto_moves(), preferences::set_enable_whiteboard_mode_on_start(), preferences::set_grid(), preferences::set_hide_whiteboard(), gui2::twidget::set_id(), preferences::set_idle_anim(), preferences::set_idle_anim_rate(), preferences::set_interrupt_when_ally_sighted(), gui2::set_label(), gui2::tslider::set_maximum_value(), gui2::tslider::set_minimum_value(), preferences::set_music(), preferences::set_music_volume(), preferences::set_remember_password(), gui2::set_resolution_list(), preferences::set_save_replays(), preferences::set_scroll_speed(), preferences::set_show_ai_moves(), preferences::set_show_floating_labels(), preferences::set_show_haloes(), preferences::set_show_side_colors(), preferences::set_show_standing_animations(), preferences::set_sound(), preferences::set_sound_volume(), gui2::tscrollbar_::set_step_size(), preferences::set_turbo(), preferences::set_turn_bell(), preferences::set_turn_dialog(), preferences::set_UI_sound(), preferences::set_UI_volume(), gui2::tcontrol::set_use_markup(), gui2::tslider::set_value(), gui2::ttoggle_button::set_value(), gui2::twidget::set_visible(), preferences::set_whisper_friends_only(), preferences::show_ai_moves(), preferences::SHOW_ALL, preferences::show_floating_labels(), preferences::SHOW_FRIENDS, preferences::show_haloes(), preferences::SHOW_NONE, preferences::show_side_colors(), preferences::show_standing_animations(), preferences::show_theme_dialog(), preferences::show_wesnothd_server_search(), preferences::sort_list(), preferences::sound_on(), preferences::sound_volume(), gui2::tgrid::swap_child(), toggle_slider_pair_callback(), preferences::turbo(), preferences::turbo_speed(), game_config::sounds::turn_bell, preferences::turn_dialog(), preferences::UI_sound_on(), preferences::UI_volume(), gui2::twidget::tvisible::visible, and preferences::whisper_friends_only().
|
private |
Definition at line 1084 of file preferences_dialog.cpp.
References _(), gui2::event::connect_signal_notify_modified(), gui2::dialog_callback(), on_tab_select(), and gui2::tlistbox::set_callback_value_change().
|
private |
Definition at line 1248 of file preferences_dialog.cpp.
References gui2::get_max_autosaves_status_label(), gui2::tslider::get_value(), preferences::set_autosavemax(), and gui2::tcontrol::set_label().
Referenced by initialize_members().
|
private |
Definition at line 1031 of file preferences_dialog.cpp.
References gui2::tselect_orb_colors::display(), gui2::tlogging::display(), gui2::tadvanced_graphics_options::display(), gui2::get_advanced_row_grid(), gui2::tlistbox::get_selected_row(), gui2::twidget::tvisible::invisible, gui2::twindow::video(), gui2::twidget::tvisible::visible, and WRN_GUI_L.
Referenced by initialize_members().
Callback for selection changes.
Definition at line 1275 of file preferences_dialog.cpp.
Referenced by pre_show().
Definition at line 1282 of file preferences_dialog.cpp.
Referenced by initialize_tabs().
Actions to be taken after the window has been shown.
At this point the registered fields already stored their values (if the OK has been pressed).
window | The window which has been shown. |
Reimplemented from gui2::tdialog.
Definition at line 1289 of file preferences_dialog.cpp.
References hotkey::save_hotkeys(), and preferences::set_font_scaling().
Inherited from tdialog.
Reimplemented from gui2::tdialog.
Definition at line 1113 of file preferences_dialog.cpp.
References _(), gui2::event::connect_signal_notify_modified(), gui2::dialog_callback(), gui2::tlistbox::get_item_count(), i, gui2::index_in_pager_range(), on_page_select(), gui2::tlistbox::select_row(), and gui2::tlistbox::set_callback_value_change().
|
private |
Definition at line 404 of file preferences_dialog.cpp.
References _(), gui2::ttext_box::clear(), gui2::tlistbox::get_selected_row(), preferences::remove_acquaintance(), gui2::show_transient_error_message(), gui2::ttext_::text(), and gui2::twindow::video().
Referenced by initialize_members().
Definition at line 1023 of file preferences_dialog.cpp.
References hotkey::clear_hotkeys(), hotkey::hotkey_command::command, hotkey::get_names(), gui2::tlistbox::get_row_grid(), gui2::tlistbox::get_selected_row(), and gui2::set_label().
Referenced by initialize_members().
Definition at line 58 of file preferences_dialog.hpp.
References index_.
Referenced by preferences::show_preferences_dialog().
|
private |
Definition at line 1173 of file preferences_dialog.cpp.
|
private |
Sets the initial state and callback for a combobox.
Definition at line 254 of file preferences_dialog.cpp.
References gui2::event::connect_signal_mouse_left_click(), gui2::tcontrol::set_use_markup(), gui2::tcombobox::set_values(), and simple_combobox_callback().
Definition at line 316 of file preferences_dialog.cpp.
References _(), gui2::tlistbox::add_row(), gui2::tlistbox::clear(), and preferences::get_acquaintances().
Definition at line 915 of file preferences_dialog.cpp.
References _(), gui2::tlistbox::add_row(), gui2::tlistbox::clear(), filesystem::file_exists(), hotkey::get_hotkey_commands(), hotkey::get_names(), game_config::path, hotkey::SCOPE_EDITOR, hotkey::SCOPE_GAME, and hotkey::SCOPE_MAIN_MENU.
|
private |
Definition at line 274 of file preferences_dialog.cpp.
References gui2::tgroup< T >::add_member(), gui2::event::connect_signal_mouse_left_click(), and gui2::ttoggle_button::set_value().
|
private |
Sets the initial state and callback for a standalone slider In the callback, int value of the widget is passeed to the setter.
Definition at line 239 of file preferences_dialog.cpp.
References gui2::event::connect_signal_notify_modified(), gui2::tslider::set_value(), and single_slider_callback().
|
private |
Sets the initial state and callback for a simple bool-state toggle button In the callback, the bool value of the widget is passeed to the setter.
Definition at line 193 of file preferences_dialog.cpp.
References gui2::event::connect_signal_mouse_left_click(), gui2::ttoggle_button::set_value(), and single_toggle_callback().
|
private |
Sets the initial state and callback for a bool-state toggle button/slider pair.
In the callback, the slider is set to active/inactive based on the button's value, which is also passed to the setter.
Definition at line 210 of file preferences_dialog.cpp.
References gui2::event::connect_signal_mouse_left_click(), gui2::event::connect_signal_notify_modified(), gui2::ttoggle_button::set_value(), single_slider_callback(), and toggle_slider_pair_callback().
|
private |
Definition at line 1200 of file preferences_dialog.cpp.
References gui2::tcombobox::get_value().
Referenced by setup_combobox().
|
private |
Definition at line 1194 of file preferences_dialog.cpp.
References gui2::tslider::get_value().
Referenced by setup_single_slider(), and setup_toggle_slider_pair().
|
private |
Definition at line 1178 of file preferences_dialog.cpp.
References gui2::tselectable_::get_value_bool().
Referenced by setup_single_toggle().
|
private |
Definition at line 1208 of file preferences_dialog.cpp.
References gui2::disambiguate_widget_value(), and gui2::tcontrol::set_label().
|
private |
Definition at line 1268 of file preferences_dialog.cpp.
References gui2::tgroup< T >::get_active_member_value().
|
private |
Definition at line 1185 of file preferences_dialog.cpp.
References gui2::tselectable_::get_value_bool(), and gui2::tscrollbar_::set_active().
Referenced by initialize_members(), and setup_toggle_slider_pair().
|
privatevirtual |
Inherited from tdialog, implemented by REGISTER_DIALOG.
Implements gui2::tdialog.
|
private |
Definition at line 219 of file preferences_dialog.hpp.
|
private |
Definition at line 206 of file preferences_dialog.hpp.
|
private |
Definition at line 224 of file preferences_dialog.hpp.
|
private |
Definition at line 215 of file preferences_dialog.hpp.
Definition at line 227 of file preferences_dialog.hpp.
Referenced by set_selected_index().
|
private |
Definition at line 217 of file preferences_dialog.hpp.
|
private |
Sets the a radio button group Since (so far) there is only one group of these, the code is speciliazed.
If (at a later date) more groups need to be added, this will have to be generalized.
Definition at line 171 of file preferences_dialog.hpp.
|
private |
Definition at line 220 of file preferences_dialog.hpp.