The Battle for Wesnoth  1.15.12+dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
gui2::dialogs::mp_join_game Class Reference

#include <mp_join_game.hpp>

Inheritance diagram for gui2::dialogs::mp_join_game:

Public Member Functions

 mp_join_game (saved_game &state, wesnothd_connection &connection, const bool first_scenario=true, const bool observe_game=false)
 
 ~mp_join_game ()
 
bool fetch_game_config ()
 
bool started () const
 
- 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...
 
bool show_flg_select (int side_num, bool first_time=false)
 
void generate_side_list ()
 
void close_faction_select_dialog_if_open ()
 Will close the Faction Select dialog if it's open. More...
 
void network_handler ()
 
configget_scenario ()
 
- Private Member Functions inherited from gui2::dialogs::plugin_executor
 plugin_executor ()
 
 ~plugin_executor ()
 

Private Attributes

config level_
 
saved_gamestate_
 
wesnothd_connectionnetwork_connection_
 
std::size_t update_timer_
 
const bool first_scenario_
 
bool observe_game_
 
bool stop_updates_
 
std::map< std::string, tree_view_node * > team_tree_map_
 
std::unique_ptr< player_list_helperplayer_list_
 
faction_selectflg_dialog_
 
- 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 32 of file mp_join_game.hpp.

Constructor & Destructor Documentation

◆ mp_join_game()

gui2::dialogs::mp_join_game::mp_join_game ( saved_game state,
wesnothd_connection connection,
const bool  first_scenario = true,
const bool  observe_game = false 
)

Definition at line 60 of file mp_join_game.cpp.

◆ ~mp_join_game()

gui2::dialogs::mp_join_game::~mp_join_game ( )

Definition at line 74 of file mp_join_game.cpp.

References gui2::remove_timer(), and update_timer_.

Member Function Documentation

◆ close_faction_select_dialog_if_open()

void gui2::dialogs::mp_join_game::close_faction_select_dialog_if_open ( )
private

Will close the Faction Select dialog if it's open.

This is used in network_handler to dismiss the dialog if certain actions occur, such as the game starting.

Todo:
maybe move this to a general-purpose close() function in modal_dialog and modeless_dialog? It could be useful.

Definition at line 474 of file mp_join_game.cpp.

References gui2::CANCEL, flg_dialog_, gui2::dialogs::modal_dialog::get_window(), and w.

Referenced by network_handler(), and started().

◆ fetch_game_config()

bool gui2::dialogs::mp_join_game::fetch_game_config ( )

◆ generate_side_list()

void gui2::dialogs::mp_join_game::generate_side_list ( )
private

◆ get_scenario()

config & gui2::dialogs::mp_join_game::get_scenario ( )
private

◆ network_handler()

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

◆ post_show()

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

References config::child(), statistics::fresh_stats(), mp_ui_alerts::game_has_begun(), gui2::window::get_retval(), level_, mp::level_to_gamestate(), preferences::login(), network_connection_, observe_game_, gui2::OK, statistics::read_stats(), gui2::remove_timer(), wesnothd_connection::send_data(), state_, and update_timer_.

Referenced by started().

◆ pre_show()

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

◆ show_flg_select()

bool gui2::dialogs::mp_join_game::show_flg_select ( int  side_num,
bool  first_time = false 
)
private

◆ started()

bool gui2::dialogs::mp_join_game::started ( ) const
inline

◆ window_id()

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

The id of the window to build.

Implements gui2::dialogs::modal_dialog.

Referenced by started().

Member Data Documentation

◆ first_scenario_

const bool gui2::dialogs::mp_join_game::first_scenario_
private

Definition at line 77 of file mp_join_game.hpp.

Referenced by fetch_game_config(), and network_handler().

◆ flg_dialog_

faction_select* gui2::dialogs::mp_join_game::flg_dialog_
private

◆ level_

config gui2::dialogs::mp_join_game::level_
private

◆ network_connection_

wesnothd_connection& gui2::dialogs::mp_join_game::network_connection_
private

◆ observe_game_

bool gui2::dialogs::mp_join_game::observe_game_
private

Definition at line 79 of file mp_join_game.hpp.

Referenced by fetch_game_config(), and post_show().

◆ player_list_

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

Definition at line 84 of file mp_join_game.hpp.

Referenced by network_handler(), and pre_show().

◆ state_

saved_game& gui2::dialogs::mp_join_game::state_
private

Definition at line 71 of file mp_join_game.hpp.

Referenced by fetch_game_config(), post_show(), and show_flg_select().

◆ stop_updates_

bool gui2::dialogs::mp_join_game::stop_updates_
private

Definition at line 80 of file mp_join_game.hpp.

Referenced by generate_side_list(), and network_handler().

◆ team_tree_map_

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

Definition at line 82 of file mp_join_game.hpp.

Referenced by generate_side_list().

◆ update_timer_

std::size_t gui2::dialogs::mp_join_game::update_timer_
private

Definition at line 75 of file mp_join_game.hpp.

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


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