Implements a quit confirmation dialog. More...
#include <quit_confirmation.hpp>
Public Member Functions | |
quit_confirmation (const std::function< bool()> &prompt=&quit_confirmation::default_prompt) | |
~quit_confirmation () | |
Static Public Member Functions | |
static bool | quit () |
Shows the quit confirmation if needed. More... | |
static void | quit_to_title () |
static void | quit_to_desktop () |
static bool | show_prompt (const std::string &message) |
static bool | default_prompt () |
Private Member Functions | |
quit_confirmation (const quit_confirmation &)=delete | |
const quit_confirmation & | operator= (const quit_confirmation &)=delete |
Private Attributes | |
std::function< bool()> | prompt_ |
Static Private Attributes | |
static std::vector< quit_confirmation * > | blockers_ {} |
static bool | open_ = false |
Implements a quit confirmation dialog.
Any object of this type will prevent the game from quitting immediately. Instead, a confirmation dialog will pop up when attempting to close.
Definition at line 28 of file quit_confirmation.hpp.
|
inlineexplicit |
Definition at line 31 of file quit_confirmation.hpp.
References blockers_.
|
inline |
Definition at line 34 of file quit_confirmation.hpp.
References blockers_.
|
privatedelete |
|
static |
Definition at line 59 of file quit_confirmation.cpp.
References _(), resources::controller, gui2::dialogs::modal_dialog::get_retval(), display::get_singleton(), play_controller::get_teams(), play_controller::is_observer(), gui2::dialogs::modal_dialog::show(), show_prompt(), playmp_controller::surrender(), t, and display::viewing_team_index().
|
privatedelete |
|
static |
Shows the quit confirmation if needed.
video::quit | If the user chooses to quit or no prompt was displayed. |
Definition at line 26 of file quit_confirmation.cpp.
References blockers_, open_, and utils::reversed_view().
Referenced by editor::editor_controller::do_execute_command(), gui2::dialogs::mp_lobby::exit_hook(), quit_to_desktop(), and quit_to_title().
|
static |
Definition at line 48 of file quit_confirmation.cpp.
References quit().
Referenced by hotkey::command_executor::do_execute_command(), editor::editor_controller::do_execute_command(), and events::pump().
|
static |
Definition at line 43 of file quit_confirmation.cpp.
References quit(), and throw_quit_game_exception().
Referenced by hotkey::command_executor::do_execute_command(), and gui2::dialogs::synched_choice_wait::pre_show().
|
static |
Definition at line 53 of file quit_confirmation.cpp.
References _(), gui2::CANCEL, gui2::show_message(), and gui2::dialogs::message::yes_no_buttons.
Referenced by default_prompt(), and editor::editor_controller::quit_confirm().
|
inlinestaticprivate |
Definition at line 54 of file quit_confirmation.hpp.
Referenced by quit(), quit_confirmation(), and ~quit_confirmation().
|
inlinestaticprivate |
Definition at line 55 of file quit_confirmation.hpp.
Referenced by quit().
|
private |
Definition at line 57 of file quit_confirmation.hpp.