GUI2/Modal Dialog: removed set_restore interface

This was used to set the restore argument of gui2:🪟:show. It's not needed anymore
since the window class no longer uses surface restoring.
This commit is contained in:
Charles Dang 2018-03-08 18:40:03 +11:00
parent ec2913ab3c
commit 7632004979
27 changed files with 7 additions and 61 deletions

View file

@ -217,7 +217,7 @@ bool uninstall_local_addons()
gui2::show_transient_message(
dlg_title,
dlg_msg + list_lead + utils::bullet_list(succeeded_names), "", false, false, true);
dlg_msg + list_lead + utils::bullet_list(succeeded_names), "", false, false);
return true;
}

View file

@ -59,7 +59,6 @@ addon_connect::addon_connect(std::string& host_name,
const bool allow_remove)
: allow_remove_(allow_remove)
{
set_restore(true);
register_text("host_name", false, host_name, true);
}

View file

@ -58,8 +58,6 @@ REGISTER_DIALOG(addon_uninstall_list)
void addon_uninstall_list::pre_show(window& window)
{
set_restore(true);
listbox& list = find_widget<listbox>(&window, "addons_list", false);
window.keyboard_capture(&list);

View file

@ -117,7 +117,6 @@ campaign_difficulty::campaign_difficulty(const config& campaign)
, campaign_id_(campaign["id"])
, selected_difficulty_("CANCEL")
{
set_restore(true);
}
void campaign_difficulty::pre_show(window& window)

View file

@ -38,7 +38,6 @@ public:
, current_sorting_(RANK)
, currently_sorted_asc_(true)
{
set_restore(true);
}
/***** ***** ***** setters / getters for members ***** ****** *****/

View file

@ -39,7 +39,6 @@ public:
, keep_open_(keep_open)
, callback_toggle_state_change_(callback_toggle_state_change)
{
set_restore(true);
}
int selected_item() const

View file

@ -120,7 +120,6 @@ file_dialog::file_dialog()
, current_bookmark_()
, user_bookmarks_begin_()
{
set_restore(true);
}
std::string file_dialog::path() const

View file

@ -62,8 +62,6 @@ static void set_dont_ask_again(const bool ask_again)
game_delete::game_delete()
{
set_restore(true);
register_bool(
"dont_ask_again", true, &get_dont_ask_again, &set_dont_ask_again);
}

View file

@ -50,8 +50,6 @@ REGISTER_DIALOG(game_save)
game_save::game_save(std::string& filename, const std::string& title)
{
set_restore(true);
register_text("txtFilename", false, filename, true);
register_label("lblTitle", true, title);
}
@ -62,8 +60,6 @@ game_save_message::game_save_message(std::string& filename,
const std::string& title,
const std::string& message)
{
set_restore(true);
register_label("lblTitle", true, title);
register_text("txtFilename", false, filename, true);
register_label("lblMessage", true, message);

View file

@ -31,7 +31,6 @@ hotkey_bind::hotkey_bind(const std::string& hotkey_id)
: hotkey_id_(hotkey_id)
, new_binding_()
{
set_restore(true);
}
void hotkey_bind::pre_show(window& window)

View file

@ -54,8 +54,6 @@ log_settings::log_settings()
void log_settings::pre_show(window& window)
{
set_restore(true); //why is this done manually?
listbox& logger_box = find_widget<listbox>(&window, "logger_listbox", false);
for(unsigned int i = 0; i < domain_list_.size(); i++){

View file

@ -66,8 +66,6 @@ struct message_implementation
void message::pre_show(window& window)
{
set_restore(true);
// ***** Validate the required buttons ***** ***** ***** *****
message_implementation::init_button(window, buttons_[left_1], "left_side");
message_implementation::init_button(window, buttons_[cancel], "cancel");

View file

@ -32,7 +32,6 @@ modal_dialog::modal_dialog()
, always_save_fields_(false)
, fields_()
, focus_()
, restore_(false)
, allow_plugin_skip_(true)
, show_even_without_video_(false)
{

View file

@ -189,11 +189,6 @@ public:
always_save_fields_ = always_save_fields;
}
void set_restore(const bool restore)
{
restore_ = restore;
}
void set_allow_plugin_skip(const bool allow_plugin_skip)
{
allow_plugin_skip_ = allow_plugin_skip;
@ -357,15 +352,6 @@ private:
*/
std::string focus_;
/**
* Restore the screen after showing?
*
* Most windows should restore the display after showing so this value
* defaults to true. Toplevel windows (like the titlescreen don't want this
* behavior so they can change it in pre_show().
*/
bool restore_;
/**
* Allow plugins to skip through the dialog?
* Most dialogs install a plugins context to allow plugins to accept whatever the dialog is offering

View file

@ -88,8 +88,6 @@ REGISTER_DIALOG(mp_server_list)
void mp_server_list::pre_show(window& window)
{
set_restore(true);
listbox& list = find_widget<listbox>(&window, "server_list", false);
window.keyboard_capture(&list);
@ -170,7 +168,6 @@ mp_connect::mp_connect()
preferences::set_network_host,
true))
{
set_restore(true);
}
void mp_connect::pre_show(window& win)

View file

@ -59,8 +59,6 @@ static void set_do_not_show_again(const bool do_not_show_again)
mp_host_game_prompt::mp_host_game_prompt()
{
set_restore(true);
register_bool("do_not_show_again",
true,
&get_do_not_show_again,

View file

@ -69,7 +69,6 @@ network_transmission::network_transmission(
, subtitle_(subtitle)
{
register_label("title", true, title, false);
set_restore(true);
}
void network_transmission::pre_show(window& window)

View file

@ -246,7 +246,7 @@ void preferences_dialog::add_friend_list_entry(const bool is_friend, text_box& t
{
std::string username = textbox.text();
if(username.empty()) {
gui2::show_transient_message("", _("No username specified"), "", false, false, true);
gui2::show_transient_message("", _("No username specified"), "", false, false);
return;
}
@ -264,7 +264,7 @@ void preferences_dialog::add_friend_list_entry(const bool is_friend, text_box& t
std::tie(entry, added_new) = add_acquaintance(username, (is_friend ? "friend": "ignore"), reason);
if(!entry) {
gui2::show_transient_message(_("Error"), _("Invalid username"), "", false, false, true);
gui2::show_transient_message(_("Error"), _("Invalid username"), "", false, false);
return;
}
@ -306,7 +306,7 @@ void preferences_dialog::remove_friend_list_entry(listbox& friends_list, text_bo
const std::string to_remove = !textbox.text().empty() ? textbox.text() : who->second.get_nick();
if(to_remove.empty()) {
gui2::show_transient_message("", _("No username specified"), "", false, false, true);
gui2::show_transient_message("", _("No username specified"), "", false, false);
return;
}
@ -895,7 +895,7 @@ void preferences_dialog::add_hotkey_callback(listbox& hotkeys)
void preferences_dialog::default_hotkey_callback(window& window)
{
gui2::show_transient_message(_("Hotkeys Reset"), _("All hotkeys have been reset to their default values."),
std::string(), false, false, true);
std::string(), false, false);
clear_hotkeys();

View file

@ -29,7 +29,6 @@ sp_options_configure::sp_options_configure(ng::create_engine& create_engine, ng:
, config_engine_(config_engine)
, options_manager_()
{
set_restore(true);
}
void sp_options_configure::pre_show(window& window)

View file

@ -50,7 +50,6 @@ statistics_dialog::statistics_dialog(const team& current_team)
, scenario_index_(scenarios_.size() - 1)
, main_stat_table_()
{
set_restore(true);
}
void statistics_dialog::pre_show(window& window)

View file

@ -36,7 +36,6 @@ REGISTER_DIALOG(surrender_quit)
surrender_quit::surrender_quit()
{
set_restore(true);
}
} // namespace dialogs

View file

@ -137,8 +137,6 @@ title_screen::title_screen(game_launcher& game)
: debug_clock_()
, game_(game)
{
set_restore(false);
// Need to set this in the constructor, pre_show() / post_build() is too late
set_allow_plugin_skip(false);
}

View file

@ -60,13 +60,11 @@ void show_transient_message(const std::string& title,
const std::string& message,
const std::string& image,
const bool message_use_markup,
const bool title_use_markup,
const bool restore_background)
const bool title_use_markup)
{
dialogs::transient_message dlg(
title, title_use_markup, message, message_use_markup, image);
dlg.set_restore(restore_background);
dlg.show();
}

View file

@ -57,15 +57,12 @@ private:
* @param image An image to show in the dialog.
* @param message_use_markup Use markup for the message?
* @param title_use_markup Use markup for the title?
* @param restore_background Restore the background to the state it was before
* the message appeared
*/
void show_transient_message(const std::string& title,
const std::string& message,
const std::string& image = std::string(),
const bool message_use_markup = false,
const bool title_use_markup = false,
const bool restore_background = false);
const bool title_use_markup = false);
/**
* Shows a transient error message to the user.

View file

@ -84,7 +84,6 @@ unit_create::unit_create()
, choice_(last_chosen_type_id)
, last_words_()
{
set_restore(true);
}
void unit_create::pre_show(window& window)

View file

@ -179,8 +179,6 @@ wml_error::wml_error(const std::string& summary,
, have_post_summary_(!post_summary.empty())
, report_()
{
set_restore(true);
const std::string& file_list_text = format_file_list(files);
report_ = summary;

View file

@ -63,8 +63,6 @@ void wml_message_base::set_option_list(const std::vector<wml_message_option>& op
*/
void wml_message_base::pre_show(window& window)
{
set_restore(true);
window.get_canvas(1).set_variable("portrait_image", wfl::variant(portrait_));
window.get_canvas(1).set_variable("portrait_mirror", wfl::variant(mirror_));