The Battle for Wesnoth  1.17.0-dev
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
gui2::dialogs::preferences_dialog Class Reference

#include <preferences_dialog.hpp>

Inheritance diagram for gui2::dialogs::preferences_dialog:

Public Types

typedef std::vector< const hotkey::hotkey_command * > visible_hotkeys_t
 The display function – see modal_dialog for more information. More...
 

Public Member Functions

 preferences_dialog (const preferences::PREFERENCE_VIEW initial_view=preferences::VIEW_DEFAULT)
 
- Public Member Functions inherited from gui2::dialogs::modal_dialog
 modal_dialog ()
 
virtual ~modal_dialog ()
 
bool show (const unsigned auto_close_time=0)
 Shows the window. More...
 
windowget_window () const
 Returns a pointer to the dialog's window. More...
 
int get_retval () const
 Returns the cached window exit code. More...
 
void set_retval (int retval)
 Convenience wrapper to set the window's exit code. More...
 
void set_always_save_fields (const bool always_save_fields)
 
void set_restore (const bool restore)
 
void set_allow_plugin_skip (const bool allow_plugin_skip)
 
void set_show_even_without_video (const bool show_even_without_video)
 

Private Member Functions

virtual const std::string & window_id () const override
 The id of the window to build. More...
 
virtual void post_build (window &window) override
 Sets up states and callbacks for each of the widgets. More...
 
virtual void pre_show (window &window) override
 Actions to be taken before showing the window. More...
 
virtual void post_show (window &) override
 Actions to be taken after the window has been shown. More...
 
void initialize_tabs (listbox &selector)
 Initializers. More...
 
void set_resolution_list (menu_button &res_list)
 
listboxsetup_hotkey_list ()
 
template<bool(*)() toggle_getter, bool(*)(bool) toggle_setter, int(*)() vol_getter, void(*)(int) vol_setter>
void initialize_sound_option_group (const std::string &id_suffix)
 
std::map< std::string, string_mapget_friends_list_row_data (const preferences::acquaintance &entry)
 
void add_friend_list_entry (const bool is_friend, text_box &textbox)
 
void remove_friend_list_entry (listbox &friends_list, text_box &textbox)
 
void on_friends_list_select (listbox &list, text_box &textbox)
 
void update_friends_list_controls (listbox &list)
 
void set_visible_page (unsigned int page, const std::string &pager_id)
 
void on_page_select ()
 Callback for selection changes. More...
 
void on_tab_select ()
 
void on_advanced_prefs_list_select (listbox &tree)
 
void handle_res_select ()
 Special callback functions. More...
 
void fullscreen_toggle_callback ()
 
void add_hotkey_callback (listbox &hotkeys)
 
void remove_hotkey_callback (listbox &hotkeys)
 
void default_hotkey_callback ()
 
void hotkey_filter_callback () const
 

Private Attributes

group< preferences::LOBBY_JOINSlobby_joins_group
 
const preferences::advanced_pref_listadv_preferences_
 
std::vector< pointresolutions_
 
int last_selected_item_
 
std::vector< double > accl_speeds_
 
visible_hotkeys_t visible_hotkeys_
 
std::map< hotkey::HOTKEY_CATEGORY, t_stringcat_names_
 
const std::pair< int, int > & initial_index_
 

Additional Inherited Members

- Protected Member Functions inherited from gui2::dialogs::modal_dialog
field_boolregister_bool (const std::string &id, const bool mandatory, const std::function< bool()> callback_load_value=nullptr, const std::function< void(bool)> callback_save_value=nullptr, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false)
 Creates a new boolean field. More...
 
field_boolregister_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false)
 Creates a new boolean field. More...
 
field_integerregister_integer (const std::string &id, const bool mandatory, const std::function< int()> callback_load_value=nullptr, const std::function< void(int)> callback_save_value=nullptr)
 Creates a new integer field. More...
 
field_integerregister_integer (const std::string &id, const bool mandatory, int &linked_variable)
 Creates a new integer field. More...
 
field_textregister_text (const std::string &id, const bool mandatory, const std::function< std::string()> callback_load_value=nullptr, const std::function< void(const std::string &)> callback_save_value=nullptr, const bool capture_focus=false)
 Creates a new text field. More...
 
field_textregister_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false)
 Creates a new text field. More...
 
field_labelregister_label (const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false)
 Registers a new styled_widget as a label. More...
 
field_labelregister_image (const std::string &id, const bool mandatory, const std::string &filename)
 Registers a new styled_widget as image. More...
 
- Protected Attributes inherited from gui2::dialogs::modal_dialog
std::unique_ptr< windowwindow_
 The window object build for this dialog. More...
 

Detailed Description

Definition at line 69 of file preferences_dialog.hpp.

Member Typedef Documentation

◆ visible_hotkeys_t

The display function – see modal_dialog for more information.

Definition at line 77 of file preferences_dialog.hpp.

Constructor & Destructor Documentation

◆ preferences_dialog()

gui2::dialogs::preferences_dialog::preferences_dialog ( const preferences::PREFERENCE_VIEW  initial_view = preferences::VIEW_DEFAULT)

Member Function Documentation

◆ add_friend_list_entry()

void gui2::dialogs::preferences_dialog::add_friend_list_entry ( const bool  is_friend,
text_box textbox 
)
private

◆ add_hotkey_callback()

void gui2::dialogs::preferences_dialog::add_hotkey_callback ( listbox hotkeys)
private

◆ default_hotkey_callback()

void gui2::dialogs::preferences_dialog::default_hotkey_callback ( )
private

◆ fullscreen_toggle_callback()

void gui2::dialogs::preferences_dialog::fullscreen_toggle_callback ( )
private

◆ get_friends_list_row_data()

std::map< std::string, string_map > gui2::dialogs::preferences_dialog::get_friends_list_row_data ( const preferences::acquaintance entry)
private

◆ handle_res_select()

void gui2::dialogs::preferences_dialog::handle_res_select ( )
private

Special callback functions.

Definition at line 1066 of file preferences_dialog.cpp.

References CVideo::get_singleton(), gui2::menu_button::get_value(), and CVideo::set_resolution().

Referenced by post_build().

◆ hotkey_filter_callback()

void gui2::dialogs::preferences_dialog::hotkey_filter_callback ( ) const
private

◆ initialize_sound_option_group()

template<bool(*)() toggle_getter, bool(*)(bool) toggle_setter, int(*)() vol_getter, void(*)(int) vol_setter>
void gui2::dialogs::preferences_dialog::initialize_sound_option_group ( const std::string &  id_suffix)
private

◆ initialize_tabs()

void gui2::dialogs::preferences_dialog::initialize_tabs ( listbox selector)
private

Initializers.

Definition at line 978 of file preferences_dialog.cpp.

References gui2::event::connect_signal_notify_modified(), and on_tab_select().

◆ on_advanced_prefs_list_select()

void gui2::dialogs::preferences_dialog::on_advanced_prefs_list_select ( listbox tree)
private

◆ on_friends_list_select()

void gui2::dialogs::preferences_dialog::on_friends_list_select ( listbox list,
text_box textbox 
)
private

◆ on_page_select()

void gui2::dialogs::preferences_dialog::on_page_select ( )
private

Callback for selection changes.

Definition at line 1075 of file preferences_dialog.cpp.

Referenced by pre_show().

◆ on_tab_select()

void gui2::dialogs::preferences_dialog::on_tab_select ( )
private

Definition at line 1082 of file preferences_dialog.cpp.

Referenced by initialize_tabs().

◆ post_build()

void gui2::dialogs::preferences_dialog::post_build ( window window)
overrideprivatevirtual

Sets up states and callbacks for each of the widgets.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 324 of file preferences_dialog.cpp.

References preferences::_set_lobby_joins(), add_friend_list_entry(), add_hotkey_callback(), gui2::listbox::add_row(), preferences::animate_map(), preferences::animate_water(), preferences::autosavemax(), preferences::chat_lines(), preferences::chat_timestamping(), config::child_range(), gui2::listbox::clear(), preferences::advanced_manager::option::COMBO, gui2::event::connect_signal_mouse_left_click(), gui2::event::connect_signal_notify_modified(), default_hotkey_callback(), preferences::delete_saves(), preferences::disable_auto_moves(), preferences::draw_delay(), preferences::enable_whiteboard_mode_on_start(), preferences::fullscreen(), fullscreen_toggle_callback(), preferences::get_acquaintances(), gui2::listbox::get_item_count(), hotkey::get_names(), CVideo::get_singleton(), gui2::slider::get_value(), gui2::selectable_item::get_value_bool(), preferences::grid(), handle_res_select(), gui2::widget::hidden, preferences::hide_whiteboard(), hotkey_filter_callback(), i, preferences::idle_anim(), preferences::idle_anim_rate(), preferences::interrupt_when_ally_sighted(), gui2::widget::invisible, lexical_cast(), preferences::lobby_joins(), on_advanced_prefs_list_select(), on_friends_list_select(), gui2::listbox::register_sorting_option(), gui2::listbox::register_translatable_sorting_option(), preferences::remember_password(), remove_friend_list_entry(), remove_hotkey_callback(), preferences::save_replays(), hotkey::SCOPE_EDITOR, hotkey::SCOPE_GAME, hotkey::SCOPE_MAIN_MENU, preferences::scroll_speed(), game_config::images::selected, gui2::menu_button::set_active(), gui2::listbox::set_active_sorting_option(), preferences::set_animate_map(), preferences::set_animate_water(), preferences::set_autosavemax(), preferences::set_chat_lines(), preferences::set_chat_timestamping(), preferences::set_delete_saves(), preferences::set_disable_auto_moves(), preferences::set_draw_delay(), preferences::set_enable_whiteboard_mode_on_start(), preferences::set_grid(), preferences::set_hide_whiteboard(), gui2::widget::set_id(), preferences::set_idle_anim(), preferences::set_idle_anim_rate(), preferences::set_interrupt_when_ally_sighted(), gui2::styled_widget::set_label(), preferences::set_remember_password(), preferences::set_save_replays(), preferences::set_scroll_speed(), preferences::set_show_floating_labels(), preferences::set_show_side_colors(), preferences::set_show_standing_animations(), preferences::set_skip_ai_moves(), gui2::slider::set_step_size(), preferences::set_stop_music_in_background(), gui2::text_box_base::set_text_changed_callback(), preferences::set_turbo(), preferences::set_turbo_speed(), preferences::set_turn_dialog(), gui2::styled_widget::set_use_markup(), gui2::slider::set_value(), gui2::toggle_button::set_value(), gui2::slider::set_value_range(), gui2::menu_button::set_values(), gui2::multimenu_button::set_values(), gui2::widget::set_visible(), preferences::set_vsync(), preferences::set_whisper_friends_only(), preferences::SHOW_ALL, preferences::show_floating_labels(), preferences::SHOW_FRIENDS, preferences::SHOW_NONE, preferences::show_side_colors(), preferences::show_standing_animations(), preferences::show_theme_dialog(), preferences::show_wesnothd_server_search(), preferences::skip_ai_moves(), preferences::advanced_manager::option::SLIDER, preferences::advanced_manager::option::SPECIAL, preferences::stop_music_in_background(), gui2::grid::swap_child(), preferences::advanced_manager::option::TOGGLE, preferences::turbo(), preferences::turbo_speed(), preferences::turn_dialog(), gui2::widget::visible, preferences::vsync(), w, and preferences::whisper_friends_only().

◆ post_show()

void gui2::dialogs::preferences_dialog::post_show ( window window)
overrideprivatevirtual

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).

Parameters
windowThe window which has been shown.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 1089 of file preferences_dialog.cpp.

References hotkey::save_hotkeys(), and preferences::write_preferences().

◆ pre_show()

void gui2::dialogs::preferences_dialog::pre_show ( window window)
overrideprivatevirtual

Actions to be taken before showing the window.

At this point the registered fields are registered and initialized with their initial values.

Parameters
windowThe window to be shown.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 987 of file preferences_dialog.cpp.

References gui2::event::connect_signal_mouse_left_click(), gui2::event::connect_signal_notify_modified(), i, on_page_select(), gui2::listbox::select_row(), gui2::stacked_widget::set_find_in_all_layers(), and VALIDATE.

◆ remove_friend_list_entry()

void gui2::dialogs::preferences_dialog::remove_friend_list_entry ( listbox friends_list,
text_box textbox 
)
private

◆ remove_hotkey_callback()

void gui2::dialogs::preferences_dialog::remove_hotkey_callback ( listbox hotkeys)
private

◆ set_resolution_list()

void gui2::dialogs::preferences_dialog::set_resolution_list ( menu_button res_list)
private

◆ set_visible_page()

void gui2::dialogs::preferences_dialog::set_visible_page ( unsigned int  page,
const std::string &  pager_id 
)
private

Definition at line 1049 of file preferences_dialog.cpp.

◆ setup_hotkey_list()

listbox & gui2::dialogs::preferences_dialog::setup_hotkey_list ( )
private

◆ update_friends_list_controls()

void gui2::dialogs::preferences_dialog::update_friends_list_controls ( listbox list)
private

◆ window_id()

virtual const std::string& gui2::dialogs::preferences_dialog::window_id ( ) const
overrideprivatevirtual

The id of the window to build.

Implements gui2::dialogs::modal_dialog.

Member Data Documentation

◆ accl_speeds_

std::vector<double> gui2::dialogs::preferences_dialog::accl_speeds_
private

Definition at line 125 of file preferences_dialog.hpp.

◆ adv_preferences_

const preferences::advanced_pref_list& gui2::dialogs::preferences_dialog::adv_preferences_
private

Definition at line 119 of file preferences_dialog.hpp.

◆ cat_names_

std::map<hotkey::HOTKEY_CATEGORY, t_string> gui2::dialogs::preferences_dialog::cat_names_
private

Definition at line 128 of file preferences_dialog.hpp.

◆ initial_index_

const std::pair<int, int>& gui2::dialogs::preferences_dialog::initial_index_
private

Definition at line 131 of file preferences_dialog.hpp.

◆ last_selected_item_

int gui2::dialogs::preferences_dialog::last_selected_item_
private

Definition at line 123 of file preferences_dialog.hpp.

◆ lobby_joins_group

group<preferences::LOBBY_JOINS> gui2::dialogs::preferences_dialog::lobby_joins_group
private

Definition at line 117 of file preferences_dialog.hpp.

◆ resolutions_

std::vector<point> gui2::dialogs::preferences_dialog::resolutions_
private

Definition at line 121 of file preferences_dialog.hpp.

◆ visible_hotkeys_

visible_hotkeys_t gui2::dialogs::preferences_dialog::visible_hotkeys_
private

Definition at line 126 of file preferences_dialog.hpp.


The documentation for this class was generated from the following files: