The Battle for Wesnoth  1.15.1+dev
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
gui2::dialogs::loading_screen Class Reference

#include <loading_screen.hpp>

Inheritance diagram for gui2::dialogs::loading_screen:
Inheritance graph

Public Member Functions

 loading_screen (std::function< void()> f)
 
 ~loading_screen ()
 
- 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)
 
- Public Member Functions inherited from events::pump_monitor
 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
 Inherited from modal_dialog, implemented by REGISTER_DIALOG. More...
 
virtual void pre_show (window &window) override
 Inherited from modal_dialog. More...
 
virtual void post_show (window &window) override
 Inherited from modal_dialog. More...
 
virtual void process (events::pump_info &) override
 Inherited from events::pump_monitor. More...
 
bool loading_complete () const
 Checks whether the worker thread has returned and loading is complete. More...
 
void draw_callback ()
 Callback to handle drawing the progress animation. More...
 

Private Attributes

int animation_counter_
 
std::function< void()> load_func_
 
std::future< void > worker_result_
 
std::unique_ptr< cursor::settercursor_setter_
 
std::exception_ptr exception_
 
labelprogress_stage_label_
 
labelanimation_label_
 
std::atomic< loading_stagecurrent_stage_
 
stage_map visible_stages_
 
std::vector< t_stringanimation_stages_
 
stage_map::const_iterator current_visible_stage_
 

Static Private Attributes

static loading_screensingleton_ = nullptr
 

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 loading_screen.hpp.

Member Typedef Documentation

◆ stage_map

Definition at line 116 of file loading_screen.hpp.

Constructor & Destructor Documentation

◆ loading_screen()

gui2::dialogs::loading_screen::loading_screen ( std::function< void()>  f)

Definition at line 76 of file loading_screen.cpp.

References animation_stages_, current_visible_stage_, i, none, s, singleton_, stage_names, and visible_stages_.

Referenced by display().

◆ ~loading_screen()

gui2::dialogs::loading_screen::~loading_screen ( )

Definition at line 180 of file loading_screen.cpp.

References loading_complete(), and singleton_.

Member Function Documentation

◆ display()

void gui2::dialogs::loading_screen::display ( std::function< void()>  f)
static

◆ displaying()

static bool gui2::dialogs::loading_screen::displaying ( )
inlinestatic

Definition at line 79 of file loading_screen.hpp.

References none, and tooltips::process().

Referenced by display::handle_event().

◆ draw_callback()

void gui2::dialogs::loading_screen::draw_callback ( )
private

Callback to handle drawing the progress animation.

Definition at line 159 of file loading_screen.cpp.

References animation_counter_, animation_label_, animation_stages_, current_stage_, current_visible_stage_, none, progress_stage_label_, gui2::styled_widget::set_label(), visible_stages_, and WRN_LS.

Referenced by pre_show().

◆ loading_complete()

bool gui2::dialogs::loading_screen::loading_complete ( ) const
private

Checks whether the worker thread has returned and loading is complete.

Definition at line 217 of file loading_screen.cpp.

References worker_result_.

Referenced by process(), and ~loading_screen().

◆ post_show()

void gui2::dialogs::loading_screen::post_show ( window window)
overrideprivatevirtual

Inherited from modal_dialog.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 136 of file loading_screen.cpp.

References cursor_setter_.

◆ pre_show()

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

◆ process()

void gui2::dialogs::loading_screen::process ( events::pump_info )
overrideprivatevirtual

◆ progress()

void gui2::dialogs::loading_screen::progress ( loading_stage  stage = loading_stage::none)
static

◆ window_id()

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

Inherited from modal_dialog, implemented by REGISTER_DIALOG.

Implements gui2::dialogs::modal_dialog.

Member Data Documentation

◆ animation_counter_

int gui2::dialogs::loading_screen::animation_counter_
private

Definition at line 104 of file loading_screen.hpp.

Referenced by draw_callback().

◆ animation_label_

label* gui2::dialogs::loading_screen::animation_label_
private

Definition at line 112 of file loading_screen.hpp.

Referenced by draw_callback(), and pre_show().

◆ animation_stages_

std::vector<t_string> gui2::dialogs::loading_screen::animation_stages_
private

Definition at line 119 of file loading_screen.hpp.

Referenced by draw_callback(), and loading_screen().

◆ current_stage_

std::atomic<loading_stage> gui2::dialogs::loading_screen::current_stage_
private

Definition at line 114 of file loading_screen.hpp.

Referenced by draw_callback(), and progress().

◆ current_visible_stage_

stage_map::const_iterator gui2::dialogs::loading_screen::current_visible_stage_
private

Definition at line 120 of file loading_screen.hpp.

Referenced by draw_callback(), and loading_screen().

◆ cursor_setter_

std::unique_ptr<cursor::setter> gui2::dialogs::loading_screen::cursor_setter_
private

Definition at line 107 of file loading_screen.hpp.

Referenced by post_show(), and pre_show().

◆ exception_

std::exception_ptr gui2::dialogs::loading_screen::exception_
private

Definition at line 109 of file loading_screen.hpp.

Referenced by pre_show(), and process().

◆ load_func_

std::function<void()> gui2::dialogs::loading_screen::load_func_
private

Definition at line 105 of file loading_screen.hpp.

Referenced by pre_show(), and process().

◆ progress_stage_label_

label* gui2::dialogs::loading_screen::progress_stage_label_
private

Definition at line 111 of file loading_screen.hpp.

Referenced by draw_callback(), and pre_show().

◆ singleton_

loading_screen * gui2::dialogs::loading_screen::singleton_ = nullptr
staticprivate

Definition at line 102 of file loading_screen.hpp.

Referenced by display(), loading_screen(), progress(), and ~loading_screen().

◆ visible_stages_

stage_map gui2::dialogs::loading_screen::visible_stages_
private

Definition at line 117 of file loading_screen.hpp.

Referenced by draw_callback(), and loading_screen().

◆ worker_result_

std::future<void> gui2::dialogs::loading_screen::worker_result_
private

Definition at line 106 of file loading_screen.hpp.

Referenced by loading_complete(), and pre_show().


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