The Battle for Wesnoth  1.15.1+dev
Public Types | Public Member Functions | Static 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:
Inheritance graph

Public Types

typedef std::vector< const hotkey::hotkey_command * > visible_hotkeys_t
 

Public Member Functions

 preferences_dialog (const config &game_cfg, const preferences::PREFERENCE_VIEW &initial_view)
 
- 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
 
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)
 

Static Public Member Functions

static void display (const config &game_cfg, const preferences::PREFERENCE_VIEW initial_view=preferences::VIEW_DEFAULT)
 The display function – see modal_dialog for more information. More...
 

Private Member Functions

virtual const std::string & window_id () const override
 Inherited from modal_dialog, implemented by REGISTER_DIALOG. More...
 
virtual void post_build (window &window) override
 Inherited from modal_dialog. 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 (window &window, listbox &selector)
 Initializers. More...
 
void set_resolution_list (menu_button &res_list, CVideo &video)
 
listboxsetup_hotkey_list (window &window)
 
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, window &window)
 
void remove_friend_list_entry (listbox &friends_list, text_box &textbox, window &window)
 
void on_friends_list_select (listbox &list, text_box &textbox)
 
void update_friends_list_controls (window &window, listbox &list)
 
void set_visible_page (window &window, unsigned int page, const std::string &pager_id)
 
void on_page_select (window &window)
 Callback for selection changes. More...
 
void on_tab_select (window &window)
 
void on_advanced_prefs_list_select (listbox &tree)
 
void on_filtertext_changed (text_box_base *textbox)
 
void handle_res_select (window &window)
 Special callback functions. More...
 
void fullscreen_toggle_callback (window &window)
 
void add_hotkey_callback (listbox &hotkeys)
 
void remove_hotkey_callback (listbox &hotkeys)
 
void default_hotkey_callback (window &window)
 
void hotkey_filter_callback (window &window) const
 

Private Attributes

group< preferences::LOBBY_JOINSlobby_joins_group
 
MAKE_ENUM(ADVANCED_PREF_TYPE,(TOGGLE, "boolean")(SLIDER, "int")(COMBO, "combo")(SPECIAL, "custom")) std std::vector< configadv_preferences_cfg_
 
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 71 of file preferences_dialog.hpp.

Member Typedef Documentation

◆ visible_hotkeys_t

Definition at line 82 of file preferences_dialog.hpp.

Constructor & Destructor Documentation

◆ preferences_dialog()

gui2::dialogs::preferences_dialog::preferences_dialog ( const config game_cfg,
const preferences::PREFERENCE_VIEW initial_view 
)

Member Function Documentation

◆ add_friend_list_entry()

void gui2::dialogs::preferences_dialog::add_friend_list_entry ( const bool  is_friend,
text_box textbox,
window window 
)
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 ( window window)
private

◆ display()

static void gui2::dialogs::preferences_dialog::display ( const config game_cfg,
const preferences::PREFERENCE_VIEW  initial_view = preferences::VIEW_DEFAULT 
)
inlinestatic

◆ fullscreen_toggle_callback()

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

Definition at line 1101 of file preferences_dialog.cpp.

References gui2::menu_button::set_active().

Referenced by post_build().

◆ 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 ( window window)
private

Special callback functions.

Definition at line 1112 of file preferences_dialog.cpp.

References gui2::menu_button::get_value().

Referenced by post_build().

◆ hotkey_filter_callback()

void gui2::dialogs::preferences_dialog::hotkey_filter_callback ( window window) 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 ( window window,
listbox selector 
)
private

Initializers.

Definition at line 1021 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_filtertext_changed()

void gui2::dialogs::preferences_dialog::on_filtertext_changed ( text_box_base textbox)
private

Definition at line 144 of file preferences_dialog.cpp.

References gui2::widget::get_window().

Referenced by post_build().

◆ 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 ( window window)
private

Callback for selection changes.

Definition at line 1121 of file preferences_dialog.cpp.

Referenced by pre_show().

◆ on_tab_select()

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

Definition at line 1128 of file preferences_dialog.cpp.

Referenced by initialize_tabs().

◆ post_build()

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

Inherited from modal_dialog.

Sets up states and callbacks for each of the widgets.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 352 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(), 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(), gui2::event::find(), preferences::font_scaling(), preferences::fullscreen(), fullscreen_toggle_callback(), preferences::get_acquaintances(), gui2::listbox::get_item_count(), hotkey::get_names(), 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(), name(), on_advanced_prefs_list_select(), on_filtertext_changed(), 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_font_scaling(), 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_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(), gui2::listbox::SORT_ASCENDING, preferences::stop_music_in_background(), gui2::grid::swap_child(), preferences::turbo(), preferences::turbo_speed(), preferences::turn_dialog(), gui2::widget::visible, 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 1135 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 1030 of file preferences_dialog.cpp.

References _(), gui2::event::connect_signal_mouse_left_click(), gui2::event::connect_signal_notify_modified(), i, preferences::INFINITE_AUTO_SAVES, on_page_select(), s, 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,
window window 
)
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,
CVideo video 
)
private

◆ set_visible_page()

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

Definition at line 1095 of file preferences_dialog.cpp.

◆ setup_hotkey_list()

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

◆ update_friends_list_controls()

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

◆ window_id()

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

Inherited from modal_dialog, implemented by REGISTER_DIALOG.

Implements gui2::dialogs::modal_dialog.

Member Data Documentation

◆ accl_speeds_

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

Definition at line 139 of file preferences_dialog.hpp.

◆ adv_preferences_cfg_

MAKE_ENUM (ADVANCED_PREF_TYPE, (TOGGLE, "boolean") (SLIDER, "int") (COMBO, "combo") (SPECIAL, "custom") ) std std::vector<config> gui2::dialogs::preferences_dialog::adv_preferences_cfg_
private

Definition at line 127 of file preferences_dialog.hpp.

◆ cat_names_

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

Definition at line 142 of file preferences_dialog.hpp.

◆ initial_index_

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

Definition at line 145 of file preferences_dialog.hpp.

◆ last_selected_item_

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

Definition at line 137 of file preferences_dialog.hpp.

◆ lobby_joins_group

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

Definition at line 125 of file preferences_dialog.hpp.

◆ visible_hotkeys_

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

Definition at line 140 of file preferences_dialog.hpp.


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