#include <loading_screen.hpp>
Public Member Functions | |
loading_screen (std::function< void()> f) | |
~loading_screen () | |
![]() | |
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) |
![]() | |
pump_monitor () | |
virtual | ~pump_monitor () |
Static Public Member Functions | |
static void | display (std::function< void()> f) |
static bool | displaying () |
static void | progress (loading_stage stage=loading_stage::none) |
Private Types | |
using | stage_map = std::map< loading_stage, t_string > |
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... | |
virtual void | process (events::pump_info &) override |
Inherited from events::pump_monitor. More... | |
void | draw_callback () |
Callback to handle drawing the progress animation. More... | |
Private Attributes | |
std::function< void()> | load_func_ |
std::future< void > | worker_result_ |
std::unique_ptr< cursor::setter > | cursor_setter_ |
label * | progress_stage_label_ |
drawing * | animation_ |
std::optional< decltype(std::chrono::steady_clock::now())> | animation_start_ |
std::atomic< loading_stage > | current_stage_ |
stage_map | visible_stages_ |
stage_map::const_iterator | current_visible_stage_ |
Static Private Attributes | |
static loading_screen * | singleton_ = nullptr |
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... | |
Definition at line 74 of file loading_screen.hpp.
|
private |
Definition at line 112 of file loading_screen.hpp.
gui2::dialogs::loading_screen::loading_screen | ( | std::function< void()> | f | ) |
Definition at line 74 of file loading_screen.cpp.
References current_visible_stage_, none, singleton_, stage_names, and visible_stages_.
Referenced by display().
gui2::dialogs::loading_screen::~loading_screen | ( | ) |
Definition at line 172 of file loading_screen.cpp.
References singleton_, and worker_result_.
|
static |
Definition at line 191 of file loading_screen.cpp.
References f, CVideo::get_singleton(), loading_screen(), and singleton_.
Referenced by do_gameloop(), gui2::dialogs::mp_join_game::fetch_game_config(), play_controller::init(), game_launcher::launch_game(), game_config_manager::load_game_config_with_loadscreen(), and playmp_controller::wait_for_upload().
|
inlinestatic |
Definition at line 82 of file loading_screen.hpp.
References none, and tooltips::process().
Referenced by display::handle_event().
|
private |
Callback to handle drawing the progress animation.
Definition at line 145 of file loading_screen.cpp.
References animation_, animation_start_, current_stage_, current_visible_stage_, gui2::drawing::get_drawing_canvas(), none, progress_stage_label_, gui2::widget::set_is_dirty(), gui2::styled_widget::set_label(), gui2::canvas::set_variable(), visible_stages_, and WRN_LS.
Referenced by pre_show().
|
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).
window | The window which has been shown. |
Reimplemented from gui2::dialogs::modal_dialog.
Definition at line 118 of file loading_screen.cpp.
References cursor_setter_.
|
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 93 of file loading_screen.cpp.
References animation_, gui2::event::dispatcher::connect_signal(), cursor_setter_, gui2::event::DRAW, draw_callback(), e, ERR_LS, gui2::event::dispatcher::front_child, load_func_, progress_stage_label_, gui2::window::set_enter_disabled(), gui2::window::set_escape_disabled(), cursor::WAIT, and worker_result_.
|
overrideprivatevirtual |
Inherited from events::pump_monitor.
Implements events::pump_monitor.
Definition at line 130 of file loading_screen.cpp.
References gui2::window::close(), gui2::dialogs::modal_dialog::get_window(), load_func_, and worker_result_.
|
static |
Definition at line 123 of file loading_screen.cpp.
References current_stage_, none, and singleton_.
Referenced by unit_type_data::build_all(), do_gameloop(), gui2::dialogs::mp_join_game::fetch_game_config(), unit_type::fill_variations_and_gender(), game_state::init(), play_controller::init(), game_launcher::launch_game(), game_config_manager::load_game_config(), terrain_builder::parse_config(), unit_type_data::set_config(), game_config_manager::set_unit_data(), and playmp_controller::wait_for_upload().
|
overrideprivatevirtual |
The id of the window to build.
Implements gui2::dialogs::modal_dialog.
|
private |
Definition at line 106 of file loading_screen.hpp.
Referenced by draw_callback(), and pre_show().
|
private |
Definition at line 108 of file loading_screen.hpp.
Referenced by draw_callback().
|
private |
Definition at line 110 of file loading_screen.hpp.
Referenced by draw_callback(), and progress().
|
private |
Definition at line 114 of file loading_screen.hpp.
Referenced by draw_callback(), and loading_screen().
|
private |
Definition at line 103 of file loading_screen.hpp.
Referenced by post_show(), and pre_show().
|
private |
Definition at line 101 of file loading_screen.hpp.
Referenced by pre_show(), and process().
|
private |
Definition at line 105 of file loading_screen.hpp.
Referenced by draw_callback(), and pre_show().
|
staticprivate |
Definition at line 99 of file loading_screen.hpp.
Referenced by display(), loading_screen(), progress(), and ~loading_screen().
|
private |
Definition at line 113 of file loading_screen.hpp.
Referenced by draw_callback(), and loading_screen().
|
private |
Definition at line 102 of file loading_screen.hpp.
Referenced by pre_show(), process(), and ~loading_screen().