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

#include <mp_staging.hpp>

Inheritance diagram for gui2::dialogs::mp_staging:

Public Member Functions

 mp_staging (ng::connect_engine &connect_engine, wesnothd_connection *connection=nullptr)
 
 ~mp_staging ()
 
- 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 pre_show (window &window) override
 Actions to be taken before showing the window. More...
 
virtual void post_show (window &window) override
 Actions to be taken after the window has been shown. More...
 
template<typename... T>
tree_view_nodeadd_side_to_team_node (ng::side_engine_ptr side, T &&... params)
 
void add_side_node (ng::side_engine_ptr side)
 
int get_side_node_position (ng::side_engine_ptr side) const
 Find an appropriate position to insert a side node. More...
 
void on_controller_select (ng::side_engine_ptr side, grid &row_grid)
 
void on_ai_select (ng::side_engine_ptr side, menu_button &ai_menu, const bool saved_game)
 
void on_color_select (ng::side_engine_ptr side, grid &row_grid)
 
void on_team_select (ng::side_engine_ptr side, menu_button &team_menu)
 
template<void(ng::side_engine::*)(int) fptr>
void on_side_slider_change (ng::side_engine_ptr side, slider &slider)
 
void select_leader_callback (ng::side_engine_ptr side, grid &row_grid)
 
void update_leader_display (ng::side_engine_ptr side, grid &row_grid)
 
void update_status_label_and_buttons ()
 
void network_handler ()
 
void set_state_changed ()
 
- Private Member Functions inherited from gui2::dialogs::plugin_executor
 plugin_executor ()
 
 ~plugin_executor ()
 

Private Attributes

ng::connect_engineconnect_engine_
 
std::vector< ai::description * > ai_algorithms_
 
wesnothd_connectionnetwork_connection_
 
std::size_t update_timer_
 
bool state_changed_
 
std::map< std::string, tree_view_node * > team_tree_map_
 
std::map< ng::side_engine_ptr, tree_view_node * > side_tree_map_
 
std::unique_ptr< player_list_helperplayer_list_
 
- Private Attributes inherited from gui2::dialogs::plugin_executor
std::unique_ptr< plugins_contextplugins_context_
 

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 39 of file mp_staging.hpp.

Constructor & Destructor Documentation

◆ mp_staging()

gui2::dialogs::mp_staging::mp_staging ( ng::connect_engine connect_engine,
wesnothd_connection connection = nullptr 
)

Definition at line 50 of file mp_staging.cpp.

◆ ~mp_staging()

gui2::dialogs::mp_staging::~mp_staging ( )

Definition at line 65 of file mp_staging.cpp.

References gui2::remove_timer(), and update_timer_.

Member Function Documentation

◆ add_side_node()

void gui2::dialogs::mp_staging::add_side_node ( ng::side_engine_ptr  side)
private

◆ add_side_to_team_node()

template<typename... T>
tree_view_node & gui2::dialogs::mp_staging::add_side_to_team_node ( ng::side_engine_ptr  side,
T &&...  params 
)
private

◆ get_side_node_position()

int gui2::dialogs::mp_staging::get_side_node_position ( ng::side_engine_ptr  side) const
private

Find an appropriate position to insert a side node.

This ensures the side nodes are always arranged by descending index order in each team group.

Definition at line 124 of file mp_staging.cpp.

References connect_engine_, and ng::connect_engine::side_engines().

Referenced by add_side_node(), and on_team_select().

◆ network_handler()

void gui2::dialogs::mp_staging::network_handler ( )
private

◆ on_ai_select()

void gui2::dialogs::mp_staging::on_ai_select ( ng::side_engine_ptr  side,
menu_button ai_menu,
const bool  saved_game 
)
private

Definition at line 373 of file mp_staging.cpp.

References ai_algorithms_, gui2::menu_button::get_value(), i, and set_state_changed().

Referenced by add_side_node().

◆ on_color_select()

void gui2::dialogs::mp_staging::on_color_select ( ng::side_engine_ptr  side,
grid row_grid 
)
private

Definition at line 391 of file mp_staging.cpp.

References set_state_changed(), and update_leader_display().

Referenced by add_side_node().

◆ on_controller_select()

void gui2::dialogs::mp_staging::on_controller_select ( ng::side_engine_ptr  side,
grid row_grid 
)
private

◆ on_side_slider_change()

template<void(ng::side_engine::*)(int) fptr>
void gui2::dialogs::mp_staging::on_side_slider_change ( ng::side_engine_ptr  side,
slider slider 
)
private

Definition at line 451 of file mp_staging.cpp.

References gui2::slider::get_value(), and set_state_changed().

◆ on_team_select()

void gui2::dialogs::mp_staging::on_team_select ( ng::side_engine_ptr  side,
menu_button team_menu 
)
private

◆ post_show()

void gui2::dialogs::mp_staging::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 573 of file mp_staging.cpp.

References connect_engine_, gui2::window::get_retval(), ng::connect_engine::leave_game(), gui2::OK, gui2::remove_timer(), ng::connect_engine::start_game(), and update_timer_.

◆ pre_show()

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

◆ select_leader_callback()

void gui2::dialogs::mp_staging::select_leader_callback ( ng::side_engine_ptr  side,
grid row_grid 
)
private

Definition at line 441 of file mp_staging.cpp.

References set_state_changed(), and update_leader_display().

Referenced by add_side_node().

◆ set_state_changed()

void gui2::dialogs::mp_staging::set_state_changed ( )
inlineprivate

◆ update_leader_display()

void gui2::dialogs::mp_staging::update_leader_display ( ng::side_engine_ptr  side,
grid row_grid 
)
private

◆ update_status_label_and_buttons()

void gui2::dialogs::mp_staging::update_status_label_and_buttons ( )
private

◆ window_id()

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

The id of the window to build.

Implements gui2::dialogs::modal_dialog.

Member Data Documentation

◆ ai_algorithms_

std::vector<ai::description*> gui2::dialogs::mp_staging::ai_algorithms_
private

Definition at line 90 of file mp_staging.hpp.

Referenced by add_side_node(), and on_ai_select().

◆ connect_engine_

ng::connect_engine& gui2::dialogs::mp_staging::connect_engine_
private

◆ network_connection_

wesnothd_connection* gui2::dialogs::mp_staging::network_connection_
private

Definition at line 92 of file mp_staging.hpp.

Referenced by network_handler().

◆ player_list_

std::unique_ptr<player_list_helper> gui2::dialogs::mp_staging::player_list_
private

Definition at line 101 of file mp_staging.hpp.

Referenced by network_handler(), and pre_show().

◆ side_tree_map_

std::map<ng::side_engine_ptr, tree_view_node*> gui2::dialogs::mp_staging::side_tree_map_
private

Definition at line 99 of file mp_staging.hpp.

Referenced by add_side_node(), network_handler(), and on_team_select().

◆ state_changed_

bool gui2::dialogs::mp_staging::state_changed_
private

Definition at line 96 of file mp_staging.hpp.

Referenced by network_handler().

◆ team_tree_map_

std::map<std::string, tree_view_node*> gui2::dialogs::mp_staging::team_tree_map_
private

Definition at line 98 of file mp_staging.hpp.

Referenced by add_side_to_team_node(), and on_team_select().

◆ update_timer_

std::size_t gui2::dialogs::mp_staging::update_timer_
private

Definition at line 94 of file mp_staging.hpp.

Referenced by post_show(), pre_show(), and ~mp_staging().


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