This shows the dialog to select a previous version of Wesnoth to migrate preferences from and redownload add-ons. More...
#include <migrate_version_selection.hpp>
Public Member Functions | |
migrate_version_selection () | |
![]() | |
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 void | execute () |
Private Member Functions | |
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 const std::string & | window_id () const override |
The id of the window to build. More... | |
Private Attributes | |
std::vector< std::string > | versions_ |
Additional Inherited Members | |
![]() | |
template<typename T , typename... Args> | |
T * | register_field (Args &&... args) |
Creates a new field of given type with given arguments. More... | |
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 a previous version of Wesnoth to migrate preferences from and redownload add-ons.
Definition at line 26 of file migrate_version_selection.hpp.
gui2::dialogs::migrate_version_selection::migrate_version_selection | ( | ) |
Definition at line 50 of file migrate_version_selection.cpp.
References filesystem::file_exists(), filesystem::get_addons_dir(), filesystem::get_version_path_suffix(), i, version_info::major_version(), version_info::minor_version(), versions_, and game_config::wesnoth_version.
|
static |
Definition at line 42 of file migrate_version_selection.cpp.
References gui2::dialogs::modal_dialog::show(), and versions_.
Referenced by do_gameloop().
|
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 82 of file migrate_version_selection.cpp.
References ad_hoc_addon_fetch_session(), filesystem::copy_file(), filesystem::file_exists(), filesystem::get_addons_dir(), filesystem::get_credentials_file(), filesystem::get_files_in_dir(), filesystem::get_prefs_file(), gui2::dialogs::modal_dialog::get_retval(), gui2::listbox::get_selected_row(), filesystem::get_version_path_suffix(), preferences::load_base_prefs(), preferences::load_credentials(), preferences::load_game_prefs(), gui2::OK, game_config::images::selected, and versions_.
|
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 67 of file migrate_version_selection.cpp.
References gui2::listbox::add_row(), and versions_.
|
overrideprivatevirtual |
The id of the window to build.
Implements gui2::dialogs::modal_dialog.
|
private |
Definition at line 37 of file migrate_version_selection.hpp.
Referenced by execute(), migrate_version_selection(), post_show(), and pre_show().