This shows the dialog to select and load a savegame file. More...
#include <game_load.hpp>
Public Member Functions | |
game_load (const game_config_view &cache_config, savegame::load_game_metadata &data) | |
![]() | |
modal_dialog () | |
virtual | ~modal_dialog () |
bool | show (const unsigned auto_close_time=0) |
Shows the window. More... | |
window * | get_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) |
Static Public Member Functions | |
static bool | execute (const game_config_view &cache_config, savegame::load_game_metadata &data) |
Private Member Functions | |
virtual void | pre_show (window &window) override |
Actions to be taken before showing the window. More... | |
virtual const std::string & | window_id () const override |
The id of the window to build. More... | |
void | set_save_dir_list (menu_button &dir_list) |
void | populate_game_list () |
Update (both internally and visually) the list of games. More... | |
void | filter_text_changed (const std::string &text) |
void | browse_button_callback () |
void | delete_button_callback () |
void | handle_dir_select () |
void | display_savegame_internal (const savegame::save_info &game) |
Part of display_savegame that might throw a config::error if the savegame data is corrupt. More... | |
void | display_savegame () |
void | evaluate_summary_string (std::stringstream &str, const config &cfg_summary) |
void | key_press_callback (const SDL_Keycode key) |
Private Attributes | |
std::string & | filename_ |
std::shared_ptr< savegame::save_index_class > & | save_index_manager_ |
field_bool * | change_difficulty_ |
field_bool * | show_replay_ |
field_bool * | cancel_orders_ |
config & | summary_ |
std::vector< savegame::save_info > | games_ |
const game_config_view & | cache_config_ |
std::vector< std::string > | last_words_ |
Additional Inherited Members | |
![]() | |
field_bool * | register_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_bool * | register_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_integer * | register_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_integer * | register_integer (const std::string &id, const bool mandatory, int &linked_variable) |
Creates a new integer field. More... | |
field_text * | register_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_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... | |
field_label * | register_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_label * | register_image (const std::string &id, const bool mandatory, const std::string &filename) |
Registers a new styled_widget as image. More... | |
![]() | |
std::unique_ptr< window > | window_ |
The window object build for this dialog. More... | |
This shows the dialog to select and load a savegame file.
Key | Type | Mandatory | Description |
---|---|---|---|
txtFilter | text | yes | The filter for the listbox items. |
savegame_list | listbox | yes | List of savegames. |
filename | control | yes | Name of the savegame. |
date | control | no | Date the savegame was created. |
preview_pane | widget | yes | Container widget or grid that contains the items for a preview. The visible status of this container depends on whether or not something is selected. |
minimap | minimap | yes | Minimap of the selected savegame. |
imgLeader | image | yes | The image of the leader in the selected savegame. |
lblScenario | label | yes | The name of the scenario of the selected savegame. |
lblSummary | label | yes | Summary of the selected savegame. |
Definition at line 48 of file game_load.hpp.
gui2::dialogs::game_load::game_load | ( | const game_config_view & | cache_config, |
savegame::load_game_metadata & | data | ||
) |
Definition at line 82 of file game_load.cpp.
|
private |
Definition at line 452 of file game_load.cpp.
References desktop::open_object(), and save_index_manager_.
Referenced by pre_show().
|
private |
Definition at line 457 of file game_load.cpp.
References preferences::ask_delete_saves(), display_savegame(), games_, gui2::listbox::get_selected_row(), gui2::dialogs::modal_dialog::get_window(), utf8::index(), gui2::listbox::remove_row(), and save_index_manager_.
Referenced by key_press_callback(), and pre_show().
|
private |
Definition at line 269 of file game_load.cpp.
References _(), cancel_orders_, change_difficulty_, gui2::listbox::clear(), display_savegame_internal(), e, ERR_GAMELOADDLG, games_, gui2::field_base::get_widget(), gui2::dialogs::modal_dialog::get_window(), game::error::message, save_index_manager_, gui2::toggle_button::set_active(), gui2::window::set_enter_disabled(), and show_replay_.
Referenced by delete_button_callback(), handle_dir_select(), and pre_show().
|
private |
Part of display_savegame that might throw a config::error if the savegame data is corrupt.
Definition at line 181 of file game_load.cpp.
References gui2::listbox::add_row(), cancel_orders_, change_difficulty_, config::child_range(), gui2::listbox::clear(), config::empty(), evaluate_summary_string(), image::exists(), filename_, savegame::save_info::format_time_local(), filesystem::get_independent_image_path(), gui2::field_base::get_widget(), gui2::dialogs::modal_dialog::get_window(), gui2::window::invalidate_layout(), savegame::loadgame::is_replay_save(), savegame::save_info::name(), gui2::toggle_button::set_active(), gui2::toggle_button::set_value(), show_replay_, savegame::save_info::summary(), summary_, and game_config::tile_size.
Referenced by display_savegame().
|
private |
Definition at line 353 of file game_load.cpp.
References _(), c, cache_config_, game_config::debug, game_config_view::find_child(), config::find_child(), savegame::loadgame::is_replay_save(), ng::depcheck::SCENARIO, utils::split(), string_table, font::unicode_bullet, and VGETTEXT.
Referenced by display_savegame_internal().
|
static |
Definition at line 61 of file game_load.cpp.
References _(), savegame::save_index_class::default_saves_dir(), filesystem::find_other_version_saves_dirs(), utf8::index(), gui2::dialogs::modal_dialog::show(), and gui2::show_transient_message().
Referenced by savegame::loadgame::load_game(), savegame::loadgame::load_game_ingame(), and savegame::loadgame::load_multiplayer_game().
|
private |
Definition at line 315 of file game_load.cpp.
References utils::chars_equal_insensitive(), games_, gui2::listbox::get_item_count(), gui2::dialogs::modal_dialog::get_window(), i, last_words_, gui2::listbox::set_row_shown(), and utils::split().
Referenced by pre_show().
|
private |
Definition at line 503 of file game_load.cpp.
References savegame::save_index_class::default_saves_dir(), display_savegame(), gui2::menu_button::get_value_config(), gui2::dialogs::modal_dialog::get_window(), game_config::path, populate_game_list(), and save_index_manager_.
Referenced by pre_show().
|
private |
Definition at line 483 of file game_load.cpp.
References delete_button_callback(), gui2::text_box_base::FOCUSED, and gui2::dialogs::modal_dialog::get_window().
Referenced by pre_show().
|
private |
Update (both internally and visually) the list of games.
Definition at line 155 of file game_load.cpp.
References gui2::listbox::add_row(), gui2::listbox::clear(), utils::ellipsis_truncate(), games_, gui2::dialogs::modal_dialog::get_window(), and save_index_manager_.
Referenced by handle_dir_select(), and pre_show().
|
overrideprivatevirtual |
Actions to be taken before showing the window.
At this point the registered fields are registered and initialized with their initial values.
window | The window to be shown. |
Reimplemented from gui2::dialogs::modal_dialog.
Definition at line 95 of file game_load.cpp.
References browse_button_callback(), gui2::event::connect_signal_mouse_left_click(), gui2::event::connect_signal_notify_modified(), gui2::event::connect_signal_pre_key_press(), delete_button_callback(), display_savegame(), filter_text_changed(), games_, handle_dir_select(), i, key_press_callback(), populate_game_list(), gui2::listbox::register_sorting_option(), set_save_dir_list(), gui2::text_box_base::set_text_changed_callback(), and gui2::styled_widget::set_use_markup().
|
private |
Definition at line 132 of file game_load.cpp.
References _(), filesystem::find_other_version_saves_dirs(), gui2::widget::invisible, preferences::options(), gui2::menu_button::set_values(), gui2::widget::set_visible(), and VGETTEXT.
Referenced by pre_show().
|
overrideprivatevirtual |
The id of the window to build.
Implements gui2::dialogs::modal_dialog.
|
private |
Definition at line 87 of file game_load.hpp.
Referenced by evaluate_summary_string().
|
private |
Definition at line 82 of file game_load.hpp.
Referenced by display_savegame(), and display_savegame_internal().
|
private |
Definition at line 80 of file game_load.hpp.
Referenced by display_savegame(), and display_savegame_internal().
|
private |
Definition at line 77 of file game_load.hpp.
Referenced by display_savegame_internal().
|
private |
Definition at line 86 of file game_load.hpp.
Referenced by delete_button_callback(), display_savegame(), filter_text_changed(), populate_game_list(), and pre_show().
|
private |
Definition at line 89 of file game_load.hpp.
Referenced by filter_text_changed().
|
private |
Definition at line 78 of file game_load.hpp.
Referenced by browse_button_callback(), delete_button_callback(), display_savegame(), handle_dir_select(), and populate_game_list().
|
private |
Definition at line 81 of file game_load.hpp.
Referenced by display_savegame(), and display_savegame_internal().
|
private |
Definition at line 84 of file game_load.hpp.
Referenced by display_savegame_internal().