Massive cleanup of GUI2 display/show and execute functions implementations and related CVideo arguments
This a two part commit. First:
----------------------------------------------------------------------------------------------------
Added and deployed two new helper macros for the standard implementations of the static execute
and display functions. I also made use of a variadic template in order greatly simplify code
maintenance. Now, even if the dialog's ctor parameters change, no one has to worry about updating
the associated execute/display functions (though of course, this only applies if the helper macros
are used). \o/
I did not deploy the macro in cases where there were multiple overloads or the functions did more
than just show their dialogs. I might add an additional __VA_ARGS_ parameter to the macros later.
Do note for the end_credits dialog I moved the default empty-string parameter from the display
function to the ctor.
Second:
----------------------------------------------------------------------------------------------------
Another change is that modal_dialog::show and modeless_dialog::show no longer take CVideo arguments.
Since the video argument couldn't be included in the parameter pack (maintaining the argument would
have meant making it the first one, which would be just as much work), and using CVideo::get_singleton
in the macros would require adding video.hpp includes in a whole bunch of files, I simply removed the
argument. I had been intending to do this for a while anyway.
This therefor also removes the CVideo argument from:
* All dialog display/execute functions.
* modal_dialog::show
* modal_dialog::build_window
* modeless_dialog::show
* modeless_dialog::build_window
* wml_exception::show
* gui2::show_message
* gui2::show_error_message
* gui2::show_transient_message
* gui2::show_transient_error_message
* gui2::show_wml_message
* gui2::build
* gui2:🪟:window
* gui2::dialogs::tip::show
* Various GUI2-related Lua functions. The video_dispatch helper was also removed.
* Any functions that took a CVideo argument for the sole purpose of passing it to one of the above.
Ya know, all these damn CVideo arguments didn't actually do anything, besides an occasional check to
CVideo::faked. At the end of the pipeline, they just got assigned to the video_ member of gui2::window.
Huge code bloat for nothing.
This commit is contained in:
parent
321c350d76
commit
f2b31ba082
121 changed files with 556 additions and 744 deletions
|
@ -77,7 +77,7 @@ namespace
|
|||
if (previews.size() > 1 || always_display) {
|
||||
gui2::dialogs::unit_advance dlg(previews, num_real_advances);
|
||||
|
||||
dlg.show(CVideo::get_singleton());
|
||||
dlg.show();
|
||||
|
||||
if (dlg.get_retval() == gui2::window::OK) {
|
||||
return dlg.get_selected_index();
|
||||
|
|
|
@ -252,13 +252,13 @@ bool addons_client::install_addon(config& archive_cfg, const addon_info& info)
|
|||
i18n_symbols["addon_title"] = font::escape_text(info.title);
|
||||
|
||||
if(!check_names_legal(archive_cfg)) {
|
||||
gui2::show_error_message(v_,
|
||||
gui2::show_error_message(
|
||||
vgettext("The add-on <i>$addon_title</i> has an invalid file or directory "
|
||||
"name and cannot be installed.", i18n_symbols));
|
||||
return false;
|
||||
}
|
||||
if(!check_case_insensitive_duplicates(archive_cfg)){
|
||||
gui2::show_error_message(v_,
|
||||
gui2::show_error_message(
|
||||
vgettext("The add-on <i>$addon_title</i> has file or directory names "
|
||||
"with case conflicts. This may cause problems.", i18n_symbols));
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ bool addons_client::try_fetch_addon(const addon_info & addon)
|
|||
)) {
|
||||
const std::string& server_error = get_last_server_error();
|
||||
if(!server_error.empty()) {
|
||||
gui2::show_error_message(v_,
|
||||
gui2::show_error_message(
|
||||
_("The server responded with an error:") + "\n" + server_error);
|
||||
}
|
||||
return false;
|
||||
|
@ -365,7 +365,7 @@ addons_client::install_result addons_client::do_resolve_addon_dependencies(const
|
|||
broken_deps_report += "\n " + font::unicode_bullet + " " + make_addon_title(broken_dep_id);
|
||||
}
|
||||
|
||||
if(gui2::show_message(v_, _("Broken Dependencies"), broken_deps_report, gui2::dialogs::message::yes_no_buttons) != gui2::window::OK) {
|
||||
if(gui2::show_message(_("Broken Dependencies"), broken_deps_report, gui2::dialogs::message::yes_no_buttons) != gui2::window::OK) {
|
||||
result.outcome = install_outcome::abort;
|
||||
return result; // canceled by user
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ addons_client::install_result addons_client::do_resolve_addon_dependencies(const
|
|||
}
|
||||
|
||||
gui2::dialogs::install_dependencies dlg(options);
|
||||
bool cont = dlg.show(v_);
|
||||
bool cont = dlg.show();
|
||||
if(!cont) {
|
||||
return result; // the user has chosen to continue without installing anything.
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ addons_client::install_result addons_client::do_resolve_addon_dependencies(const
|
|||
"The following dependencies could not be installed. Do you still wish to continue?",
|
||||
failed_titles.size()) + std::string("\n\n") + utils::bullet_list(failed_titles);
|
||||
|
||||
result.outcome = gui2::show_message(v_, _("Dependencies Installation Failed"), failed_deps_report, gui2::dialogs::message::yes_no_buttons) == gui2::window::OK ? install_outcome::success : install_outcome::abort; // If the user cancels, return abort. Otherwise, return success, since the user chose to ignore the failure.
|
||||
result.outcome = gui2::show_message(_("Dependencies Installation Failed"), failed_deps_report, gui2::dialogs::message::yes_no_buttons) == gui2::window::OK ? install_outcome::success : install_outcome::abort; // If the user cancels, return abort. Otherwise, return success, since the user chose to ignore the failure.
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -449,7 +449,7 @@ bool addons_client::do_check_before_overwriting_addon(const addon_info& addon)
|
|||
text += utils::bullet_list(extra_items) + "\n\n";
|
||||
text += _("Do you really wish to continue?");
|
||||
|
||||
return gui2::show_message(v_, _("Confirm"), text, gui2::dialogs::message::yes_no_buttons) == gui2::window::OK;
|
||||
return gui2::show_message(_("Confirm"), text, gui2::dialogs::message::yes_no_buttons) == gui2::window::OK;
|
||||
}
|
||||
|
||||
addons_client::install_result addons_client::install_addon_with_checks(const addons_list& addons, const addon_info& addon)
|
||||
|
@ -550,7 +550,7 @@ void addons_client::wait_for_transfer_done(const std::string& status_message, bo
|
|||
stat_->set_connection_data(*cd);
|
||||
}
|
||||
|
||||
if(!stat_->show(v_)) {
|
||||
if(!stat_->show()) {
|
||||
// Notify the caller chain that the user aborted the operation.
|
||||
throw user_exit();
|
||||
}
|
||||
|
|
|
@ -74,18 +74,18 @@ bool addons_manager_ui(CVideo& v, const std::string& remote_address)
|
|||
client.connect();
|
||||
|
||||
gui2::dialogs::addon_manager dlg(client);
|
||||
dlg.show(v);
|
||||
dlg.show();
|
||||
|
||||
need_wml_cache_refresh = dlg.get_need_wml_cache_refresh();
|
||||
} catch(const config::error& e) {
|
||||
ERR_CFG << "config::error thrown during transaction with add-on server; \""<< e.message << "\"" << std::endl;
|
||||
gui2::show_error_message(v, _("Network communication error."));
|
||||
gui2::show_error_message(_("Network communication error."));
|
||||
} catch(const network_asio::error& e) {
|
||||
ERR_NET << "network_asio::error thrown during transaction with add-on server; \""<< e.what() << "\"" << std::endl;
|
||||
gui2::show_error_message(v, _("Remote host disconnected."));
|
||||
gui2::show_error_message(_("Remote host disconnected."));
|
||||
} catch(const filesystem::io_exception& e) {
|
||||
ERR_FS << "filesystem::io_exception thrown while installing an addon; \"" << e.what() << "\"" << std::endl;
|
||||
gui2::show_error_message(v, _("A problem occurred when trying to create the files necessary to install this add-on."));
|
||||
gui2::show_error_message(_("A problem occurred when trying to create the files necessary to install this add-on."));
|
||||
} catch(const invalid_pbl_exception& e) {
|
||||
ERR_CFG << "could not read .pbl file " << e.path << ": " << e.message << std::endl;
|
||||
|
||||
|
@ -93,28 +93,27 @@ bool addons_manager_ui(CVideo& v, const std::string& remote_address)
|
|||
symbols["path"] = e.path;
|
||||
symbols["msg"] = e.message;
|
||||
|
||||
gui2::show_error_message(v,
|
||||
gui2::show_error_message(
|
||||
vgettext("A local file with add-on publishing information could not be read.\n\nFile: $path\nError message: $msg", symbols));
|
||||
} catch(wml_exception& e) {
|
||||
e.show(v);
|
||||
e.show();
|
||||
} catch(const addons_client::user_exit&) {
|
||||
LOG_AC << "initial connection canceled by user\n";
|
||||
} catch(const addons_client::invalid_server_address&) {
|
||||
gui2::show_error_message(v, _("The add-ons server address specified is not valid."));
|
||||
gui2::show_error_message(_("The add-ons server address specified is not valid."));
|
||||
}
|
||||
|
||||
return need_wml_cache_refresh;
|
||||
}
|
||||
|
||||
bool uninstall_local_addons(CVideo& v)
|
||||
bool uninstall_local_addons()
|
||||
{
|
||||
const std::string list_lead = "\n\n";
|
||||
|
||||
const std::vector<std::string>& addons = installed_addons();
|
||||
|
||||
if(addons.empty()) {
|
||||
gui2::show_error_message(v,
|
||||
_("You have no add-ons installed."));
|
||||
gui2::show_error_message(_("You have no add-ons installed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -151,7 +150,7 @@ bool uninstall_local_addons(CVideo& v)
|
|||
|
||||
do {
|
||||
gui2::dialogs::addon_uninstall_list dlg(addon_titles_map);
|
||||
dlg.show(v);
|
||||
dlg.show();
|
||||
|
||||
remove_ids = dlg.selected_addons();
|
||||
if(remove_ids.empty()) {
|
||||
|
@ -169,8 +168,8 @@ bool uninstall_local_addons(CVideo& v)
|
|||
"Are you sure you want to remove the following installed add-ons?",
|
||||
remove_ids.size()) + list_lead + utils::bullet_list(remove_names);
|
||||
|
||||
res = gui2::show_message(v
|
||||
, _("Confirm")
|
||||
res = gui2::show_message(
|
||||
_("Confirm")
|
||||
, confirm_message
|
||||
, gui2::dialogs::message::yes_no_buttons);
|
||||
} while (res != gui2::window::OK);
|
||||
|
@ -196,11 +195,11 @@ bool uninstall_local_addons(CVideo& v)
|
|||
skipped_names.size());
|
||||
|
||||
gui2::show_error_message(
|
||||
v, dlg_msg + list_lead + utils::bullet_list(skipped_names));
|
||||
dlg_msg + list_lead + utils::bullet_list(skipped_names));
|
||||
}
|
||||
|
||||
if(!failed_names.empty()) {
|
||||
gui2::show_error_message(v, _n(
|
||||
gui2::show_error_message(_n(
|
||||
"The following add-on could not be deleted properly:",
|
||||
"The following add-ons could not be deleted properly:",
|
||||
failed_names.size()) + list_lead + utils::bullet_list(failed_names));
|
||||
|
@ -215,7 +214,7 @@ bool uninstall_local_addons(CVideo& v)
|
|||
succeeded_names.size());
|
||||
|
||||
gui2::show_transient_message(
|
||||
v, dlg_title,
|
||||
dlg_title,
|
||||
dlg_msg + list_lead + utils::bullet_list(succeeded_names), "", false, false, true);
|
||||
|
||||
return true;
|
||||
|
@ -236,7 +235,7 @@ bool manage_addons(CVideo& v)
|
|||
const bool have_addons = !installed_addons().empty();
|
||||
|
||||
gui2::dialogs::addon_connect addon_dlg(host_name, have_addons);
|
||||
addon_dlg.show(v);
|
||||
addon_dlg.show();
|
||||
int res = addon_dlg.get_retval();
|
||||
|
||||
if(res == gui2::window::OK) {
|
||||
|
@ -247,7 +246,7 @@ bool manage_addons(CVideo& v)
|
|||
case addon_download:
|
||||
return addons_manager_ui(v, host_name);
|
||||
case addon_uninstall:
|
||||
return uninstall_local_addons(v);
|
||||
return uninstall_local_addons();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -266,7 +265,7 @@ bool ad_hoc_addon_fetch_session(CVideo& v, const std::vector<std::string>& addon
|
|||
addons_list addons;
|
||||
|
||||
if(!get_addons_list(client, addons)) {
|
||||
gui2::show_error_message(v, _("An error occurred while downloading the add-ons list from the server."));
|
||||
gui2::show_error_message(_("An error occurred while downloading the add-ons list from the server."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -280,7 +279,7 @@ bool ad_hoc_addon_fetch_session(CVideo& v, const std::vector<std::string>& addon
|
|||
} else {
|
||||
utils::string_map symbols;
|
||||
symbols["addon_id"] = addon_id;
|
||||
gui2::show_error_message(v, vgettext("Could not find an add-on matching id $addon_id on the add-on server.", symbols));
|
||||
gui2::show_error_message(vgettext("Could not find an add-on matching id $addon_id on the add-on server.", symbols));
|
||||
return_value = false;
|
||||
}
|
||||
}
|
||||
|
@ -289,13 +288,13 @@ bool ad_hoc_addon_fetch_session(CVideo& v, const std::vector<std::string>& addon
|
|||
|
||||
} catch(const config::error& e) {
|
||||
ERR_CFG << "config::error thrown during transaction with add-on server; \""<< e.message << "\"" << std::endl;
|
||||
gui2::show_error_message(v, _("Network communication error."));
|
||||
gui2::show_error_message(_("Network communication error."));
|
||||
} catch(const network_asio::error& e) {
|
||||
ERR_NET << "network_asio::error thrown during transaction with add-on server; \""<< e.what() << "\"" << std::endl;
|
||||
gui2::show_error_message(v, _("Remote host disconnected."));
|
||||
gui2::show_error_message(_("Remote host disconnected."));
|
||||
} catch(const filesystem::io_exception& e) {
|
||||
ERR_FS << "io_exception thrown while installing an addon; \"" << e.what() << "\"" << std::endl;
|
||||
gui2::show_error_message(v, _("A problem occurred when trying to create the files necessary to install this add-on."));
|
||||
gui2::show_error_message(_("A problem occurred when trying to create the files necessary to install this add-on."));
|
||||
} catch(const invalid_pbl_exception& e) {
|
||||
ERR_CFG << "could not read .pbl file " << e.path << ": " << e.message << std::endl;
|
||||
|
||||
|
@ -303,14 +302,14 @@ bool ad_hoc_addon_fetch_session(CVideo& v, const std::vector<std::string>& addon
|
|||
symbols["path"] = e.path;
|
||||
symbols["msg"] = e.message;
|
||||
|
||||
gui2::show_error_message(v,
|
||||
gui2::show_error_message(
|
||||
vgettext("A local file with add-on publishing information could not be read.\n\nFile: $path\nError message: $msg", symbols));
|
||||
} catch(wml_exception& e) {
|
||||
e.show(v);
|
||||
e.show();
|
||||
} catch(const addons_client::user_exit&) {
|
||||
LOG_AC << "initial connection canceled by user\n";
|
||||
} catch(const addons_client::invalid_server_address&) {
|
||||
gui2::show_error_message(v, _("The add-ons server address specified is not valid."));
|
||||
gui2::show_error_message(_("The add-ons server address specified is not valid."));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -83,7 +83,7 @@ editor_action* mouse_action_map_label::up_left(editor_display& disp, int x, int
|
|||
gui2::dialogs::editor_edit_label d(label, immutable, visible_fog, visible_shroud, color, category);
|
||||
|
||||
editor_action* a = nullptr;
|
||||
if(d.show(disp.video())) {
|
||||
if(d.show()) {
|
||||
a = new editor_action_label(hex, label, team_name, color
|
||||
, visible_fog, visible_shroud, immutable, category);
|
||||
update_brush_highlights(disp, hex);
|
||||
|
|
|
@ -174,10 +174,10 @@ EXIT_STATUS editor_controller::main_loop()
|
|||
play_slice();
|
||||
}
|
||||
} catch (editor_exception& e) {
|
||||
gui2::show_transient_message(gui().video(), _("Fatal error"), e.what());
|
||||
gui2::show_transient_message(_("Fatal error"), e.what());
|
||||
return EXIT_ERROR;
|
||||
} catch (wml_exception& e) {
|
||||
e.show(gui().video());
|
||||
e.show();
|
||||
}
|
||||
return quit_mode_;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ void editor_controller::do_screenshot(const std::string& screenshot_filename /*
|
|||
ERR_ED << "Screenshot creation failed!\n";
|
||||
}
|
||||
} catch (wml_exception& e) {
|
||||
e.show(gui().video());
|
||||
e.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,14 +216,13 @@ bool editor_controller::quit_confirm()
|
|||
void editor_controller::custom_tods_dialog()
|
||||
{
|
||||
if (tods_.empty()) {
|
||||
gui2::show_error_message(gui().video(),
|
||||
_("No editor time-of-day found."));
|
||||
gui2::show_error_message(_("No editor time-of-day found."));
|
||||
return;
|
||||
}
|
||||
|
||||
tod_manager& manager = *get_current_map_context().get_time_manager();
|
||||
|
||||
if(gui2::dialogs::custom_tod::execute(manager.times(), manager.get_current_time(), gui().video())) {
|
||||
if(gui2::dialogs::custom_tod::execute(manager.times(), manager.get_current_time())) {
|
||||
// TODO save the new tod here
|
||||
}
|
||||
|
||||
|
@ -1143,7 +1142,7 @@ void editor_controller::change_unit_id()
|
|||
|
||||
if(un != units.end()) {
|
||||
std::string id = un->id();
|
||||
if (gui2::dialogs::edit_text::execute(title, label, id, gui_->video())) {
|
||||
if (gui2::dialogs::edit_text::execute(title, label, id)) {
|
||||
un->set_id(id);
|
||||
}
|
||||
}
|
||||
|
@ -1160,7 +1159,7 @@ void editor_controller::rename_unit()
|
|||
|
||||
if(un != units.end()) {
|
||||
std::string name = un->name();
|
||||
if(gui2::dialogs::edit_text::execute(title, label, name, gui_->video())) {
|
||||
if(gui2::dialogs::edit_text::execute(title, label, name)) {
|
||||
//TODO we may not want a translated name here.
|
||||
un->set_name(name);
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ void context_manager::load_map_dialog(bool force_same_context /* = false */)
|
|||
dlg.set_title(_("Load Map"))
|
||||
.set_path(fn);
|
||||
|
||||
if(dlg.show(gui_.video())) {
|
||||
if(dlg.show()) {
|
||||
load_map(dlg.path(), !force_same_context);
|
||||
}
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ void context_manager::edit_side_dialog(int side_index)
|
|||
|
||||
editor_team_info team_info(t);
|
||||
|
||||
if(gui2::dialogs::editor_edit_side::execute(team_info, gui_.video())) {
|
||||
if(gui2::dialogs::editor_edit_side::execute(team_info)) {
|
||||
get_map_context().set_side_setup(team_info);
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ void context_manager::edit_scenario_dialog()
|
|||
bool random = context.random_start_time();
|
||||
|
||||
const bool ok = gui2::dialogs::editor_edit_scenario::execute(
|
||||
id, name, description, turns, xp_mod, victory, random, gui_.video()
|
||||
id, name, description, turns, xp_mod, victory, random
|
||||
);
|
||||
|
||||
if(!ok) {
|
||||
|
@ -277,7 +277,7 @@ void context_manager::new_map_dialog()
|
|||
int w = get_map().w();
|
||||
int h = get_map().h();
|
||||
|
||||
if(gui2::dialogs::editor_new_map::execute(_("New Map"), w, h, gui_.video())) {
|
||||
if(gui2::dialogs::editor_new_map::execute(_("New Map"), w, h)) {
|
||||
const t_translation::terrain_code& fill = get_selected_bg_terrain();
|
||||
new_map(w, h, fill, true);
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ void context_manager::new_scenario_dialog()
|
|||
int w = get_map().w();
|
||||
int h = get_map().h();
|
||||
|
||||
if(gui2::dialogs::editor_new_map::execute(_("New Scenario"), w, h, gui_.video())) {
|
||||
if(gui2::dialogs::editor_new_map::execute(_("New Scenario"), w, h)) {
|
||||
const t_translation::terrain_code& fill = get_selected_bg_terrain();
|
||||
new_scenario(w, h, fill, true);
|
||||
}
|
||||
|
@ -472,16 +472,16 @@ void context_manager::apply_mask_dialog()
|
|||
dlg.set_title(_("Apply Mask"))
|
||||
.set_path(fn);
|
||||
|
||||
if(dlg.show(gui_.video())) {
|
||||
if(dlg.show()) {
|
||||
try {
|
||||
map_context mask(game_config_, dlg.path());
|
||||
editor_action_apply_mask a(mask.get_map());
|
||||
perform_refresh(a);
|
||||
} catch (editor_map_load_exception& e) {
|
||||
gui2::show_transient_message(gui_.video(), _("Error loading mask"), e.what());
|
||||
gui2::show_transient_message(_("Error loading mask"), e.what());
|
||||
return;
|
||||
} catch (editor_action_exception& e) {
|
||||
gui2::show_error_message(gui_.video(), e.what());
|
||||
gui2::show_error_message(e.what());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ void context_manager::rename_area_dialog()
|
|||
int active_area = get_map_context().get_active_area();
|
||||
std::string name = get_map_context().get_time_manager()->get_area_ids()[active_area];
|
||||
|
||||
if(gui2::dialogs::edit_text::execute(N_("Rename Area"), N_("Identifier:"), name, gui_.video())) {
|
||||
if(gui2::dialogs::edit_text::execute(N_("Rename Area"), N_("Identifier:"), name)) {
|
||||
get_map_context().get_time_manager()->set_area_id(active_area, name);
|
||||
}
|
||||
}
|
||||
|
@ -515,16 +515,16 @@ void context_manager::create_mask_to_dialog()
|
|||
dlg.set_title(_("Choose Target Map"))
|
||||
.set_path(fn);
|
||||
|
||||
if(dlg.show(gui_.video())) {
|
||||
if(dlg.show()) {
|
||||
try {
|
||||
map_context map(game_config_, dlg.path());
|
||||
editor_action_create_mask a(map.get_map());
|
||||
perform_refresh(a);
|
||||
} catch (editor_map_load_exception& e) {
|
||||
gui2::show_transient_message(gui_.video(), _("Error loading map"), e.what());
|
||||
gui2::show_transient_message(_("Error loading map"), e.what());
|
||||
return;
|
||||
} catch (editor_action_exception& e) {
|
||||
gui2::show_error_message(gui_.video(), e.what());
|
||||
gui2::show_error_message(e.what());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ void context_manager::resize_map_dialog()
|
|||
gui2::dialogs::editor_resize_map::EXPAND_DIRECTION dir = gui2::dialogs::editor_resize_map::EXPAND_DIRECTION();
|
||||
bool copy = false;
|
||||
|
||||
if(!gui2::dialogs::editor_resize_map::execute(w, h, dir, copy, gui_.video())) {
|
||||
if(!gui2::dialogs::editor_resize_map::execute(w, h, dir, copy)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -650,7 +650,7 @@ void context_manager::save_map_as_dialog()
|
|||
.set_path(input_name)
|
||||
.set_extension(".map");
|
||||
|
||||
if(!dlg.show(gui_.video())) {
|
||||
if(!dlg.show()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -671,7 +671,7 @@ void context_manager::save_scenario_as_dialog()
|
|||
.set_path(input_name)
|
||||
.set_extension(".cfg");
|
||||
|
||||
if(!dlg.show(gui_.video())) {
|
||||
if(!dlg.show()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -698,13 +698,13 @@ void context_manager::init_map_generators(const config& game_config)
|
|||
void context_manager::generate_map_dialog()
|
||||
{
|
||||
if(map_generators_.empty()) {
|
||||
gui2::show_error_message(gui_.video(), _("No random map generators found."));
|
||||
gui2::show_error_message(_("No random map generators found."));
|
||||
return;
|
||||
}
|
||||
|
||||
gui2::dialogs::editor_generate_map dialog(map_generators_);
|
||||
dialog.select_map_generator(last_map_generator_);
|
||||
dialog.show(gui_.video());
|
||||
dialog.show();
|
||||
|
||||
if(dialog.get_retval() == gui2::window::OK) {
|
||||
std::string map_string;
|
||||
|
@ -712,12 +712,12 @@ void context_manager::generate_map_dialog()
|
|||
try {
|
||||
map_string = map_generator->create_map(dialog.get_seed());
|
||||
} catch (mapgen_exception& e) {
|
||||
gui2::show_transient_message(gui_.video(), _("Map creation failed."), e.what());
|
||||
gui2::show_transient_message(_("Map creation failed."), e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
if(map_string.empty()) {
|
||||
gui2::show_transient_message(gui_.video(), "", _("Map creation failed."));
|
||||
gui2::show_transient_message("", _("Map creation failed."));
|
||||
} else {
|
||||
editor_map new_map(game_config_, map_string);
|
||||
editor_action_whole_map a(new_map);
|
||||
|
@ -732,7 +732,7 @@ void context_manager::generate_map_dialog()
|
|||
bool context_manager::confirm_discard()
|
||||
{
|
||||
if(get_map_context().modified()) {
|
||||
const int res = gui2::show_message(gui_.video(), _("Unsaved Changes"),
|
||||
const int res = gui2::show_message(_("Unsaved Changes"),
|
||||
_("Do you want to discard all changes made to the map since the last save?"), gui2::dialogs::message::yes_no_buttons);
|
||||
return gui2::window::CANCEL != res;
|
||||
}
|
||||
|
@ -789,7 +789,7 @@ bool context_manager::save_scenario_as(const std::string& filename)
|
|||
{
|
||||
size_t is_open = check_open_map(filename);
|
||||
if(is_open < map_contexts_.size() && is_open != static_cast<unsigned>(current_context_index_)) {
|
||||
gui2::show_transient_message(gui_.video(), _("This scenario is already open."), filename);
|
||||
gui2::show_transient_message(_("This scenario is already open."), filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -812,7 +812,7 @@ bool context_manager::save_map_as(const std::string& filename)
|
|||
{
|
||||
size_t is_open = check_open_map(filename);
|
||||
if(is_open < map_contexts_.size() && is_open != static_cast<unsigned>(current_context_index_)) {
|
||||
gui2::show_transient_message(gui_.video(), _("This map is already open."), filename);
|
||||
gui2::show_transient_message(_("This map is already open."), filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -836,10 +836,10 @@ bool context_manager::write_scenario(bool display_confirmation)
|
|||
try {
|
||||
get_map_context().save_scenario();
|
||||
if(display_confirmation) {
|
||||
gui2::show_transient_message(gui_.video(), "", _("Scenario saved."));
|
||||
gui2::show_transient_message("", _("Scenario saved."));
|
||||
}
|
||||
} catch (editor_map_save_exception& e) {
|
||||
gui2::show_transient_message(gui_.video(), "", e.what());
|
||||
gui2::show_transient_message("", e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -851,10 +851,10 @@ bool context_manager::write_map(bool display_confirmation)
|
|||
try {
|
||||
get_map_context().save_map();
|
||||
if(display_confirmation) {
|
||||
gui2::show_transient_message(gui_.video(), "", _("Map saved."));
|
||||
gui2::show_transient_message("", _("Map saved."));
|
||||
}
|
||||
} catch (editor_map_save_exception& e) {
|
||||
gui2::show_transient_message(gui_.video(), "", e.what());
|
||||
gui2::show_transient_message("", e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -875,7 +875,7 @@ bool context_manager::check_switch_open_map(const std::string& fn)
|
|||
{
|
||||
size_t i = check_open_map(fn);
|
||||
if(i < map_contexts_.size()) {
|
||||
gui2::show_transient_message(gui_.video(), _("This map is already open."), fn);
|
||||
gui2::show_transient_message(_("This map is already open."), fn);
|
||||
switch_context(i);
|
||||
return true;
|
||||
}
|
||||
|
@ -909,7 +909,7 @@ void context_manager::load_map(const std::string& filename, bool new_context)
|
|||
|
||||
if(get_map_context().is_embedded()) {
|
||||
const std::string& msg = _("Loaded embedded map data");
|
||||
gui2::show_transient_message(gui_.video(), _("Map loaded from scenario"), msg);
|
||||
gui2::show_transient_message(_("Map loaded from scenario"), msg);
|
||||
} else {
|
||||
if(get_map_context().get_filename() != filename) {
|
||||
if(get_map_context().get_map_data_key().empty()) {
|
||||
|
@ -922,14 +922,14 @@ void context_manager::load_map(const std::string& filename, bool new_context)
|
|||
const std::string& msg = _("Loaded referenced map file:\n$new");
|
||||
symbols["new"] = get_map_context().get_filename();
|
||||
symbols["map_data"] = get_map_context().get_map_data_key();
|
||||
gui2::show_transient_message(gui_.video(), _("Map loaded from scenario"),
|
||||
gui2::show_transient_message(_("Map loaded from scenario"),
|
||||
//TODO: msg is already translated does vgettext make sense?
|
||||
vgettext(msg.c_str(), symbols));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (editor_map_load_exception& e) {
|
||||
gui2::show_transient_message(gui_.video(), _("Error loading map"), e.what());
|
||||
gui2::show_transient_message(_("Error loading map"), e.what());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ void location_palette::adjust_size(const SDL_Rect& target)
|
|||
}));
|
||||
button_add_.reset(new location_palette_button(video(), SDL_Rect{ target.x , bottom -= button_y, target.w - 10, button_height }, _("Add"), [this]() {
|
||||
std::string newid;
|
||||
if (gui2::dialogs::edit_text::execute(_("New Location Identifer"), "", newid, video())) {
|
||||
if (gui2::dialogs::edit_text::execute(_("New Location Identifer"), "", newid)) {
|
||||
add_item(newid);
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -159,7 +159,7 @@ void formula_debugger::show_gui()
|
|||
}
|
||||
if (game_config::debug) {
|
||||
gui2::dialogs::formula_debugger debug_dialog(*this);
|
||||
debug_dialog.show(resources::screen->video());
|
||||
debug_dialog.show();
|
||||
} else {
|
||||
WRN_FDB << "do not showing debug window due to disabled --new-widgets"<< std::endl;
|
||||
}
|
||||
|
|
|
@ -196,8 +196,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
gui2::dialogs::wml_error::display(
|
||||
_("Error validating data core."),
|
||||
_("Found a core without id attribute.")
|
||||
+ '\n' + _("Skipping the core."),
|
||||
video_);
|
||||
+ '\n' + _("Skipping the core."));
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
@ -207,8 +206,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
_("Error validating data core."),
|
||||
_("Core ID: ") + id
|
||||
+ '\n' + _("The ID is already in use.")
|
||||
+ '\n' + _("Skipping the core."),
|
||||
video_);
|
||||
+ '\n' + _("Skipping the core."));
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
@ -221,8 +219,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
_("Core ID: ") + id
|
||||
+ '\n' + _("Core Path: ") + path
|
||||
+ '\n' + _("File not found.")
|
||||
+ '\n' + _("Skipping the core."),
|
||||
video_);
|
||||
+ '\n' + _("Skipping the core."));
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
@ -244,8 +241,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
_("Error loading core data."),
|
||||
_("Core ID: ") + preferences::core_id()
|
||||
+ '\n' + _("Error loading the core with named id.")
|
||||
+ '\n' + _("Falling back to the default core."),
|
||||
video_);
|
||||
+ '\n' + _("Falling back to the default core."));
|
||||
});
|
||||
preferences::set_core_id("default");
|
||||
}
|
||||
|
@ -256,8 +252,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
gui2::dialogs::wml_error::display(
|
||||
_("Error loading core data."),
|
||||
_("Can't locate the default core.")
|
||||
+ '\n' + _("The game will now exit."),
|
||||
video_);
|
||||
+ '\n' + _("The game will now exit."));
|
||||
});
|
||||
throw;
|
||||
}
|
||||
|
@ -318,14 +313,14 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
events::call_in_main_thread([&]() {
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error loading custom game configuration files. The game will try without loading add-ons."),
|
||||
e.message, video_);
|
||||
e.message);
|
||||
});
|
||||
load_game_config(force_reload, classification);
|
||||
} else if (preferences::core_id() != "default") {
|
||||
events::call_in_main_thread([&]() {
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error loading custom game configuration files. The game will fallback to the default core files."),
|
||||
e.message, video_);
|
||||
e.message);
|
||||
});
|
||||
preferences::set_core_id("default");
|
||||
game_config::no_addons = false;
|
||||
|
@ -334,7 +329,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
events::call_in_main_thread([&]() {
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error loading default core game configuration files. The game will now exit."),
|
||||
e.message, video_);
|
||||
e.message);
|
||||
});
|
||||
throw;
|
||||
}
|
||||
|
@ -470,7 +465,7 @@ void game_config_manager::load_addons_cfg()
|
|||
|
||||
const std::string& report = utils::join(error_log, "\n\n");
|
||||
events::call_in_main_thread([&]() {
|
||||
gui2::dialogs::wml_error::display(msg1, msg2, error_addons, report, video_);
|
||||
gui2::dialogs::wml_error::display(msg1, msg2, error_addons, report);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -608,7 +608,7 @@ WML_HANDLER_FUNCTION(replace_map,, cfg)
|
|||
lg::wml_error() << "replace_map: Unable to load map " << log_map_name << std::endl;
|
||||
return;
|
||||
} catch(wml_exception& e) {
|
||||
e.show(resources::screen->video());
|
||||
e.show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -873,7 +873,7 @@ WML_HANDLER_FUNCTION(terrain_mask,, cfg)
|
|||
ERR_NG << "terrain mask is in the incorrect format, and couldn't be applied" << std::endl;
|
||||
return;
|
||||
} catch(wml_exception& e) {
|
||||
e.show(resources::screen->video());
|
||||
e.show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -467,7 +467,7 @@ std::string create_engine::select_campaign_difficulty(int set_value)
|
|||
// We don't pass the difficulties vector here because additional data is required
|
||||
// to constrict the dialog
|
||||
gui2::dialogs::campaign_difficulty dlg(current_level().data());
|
||||
dlg.show(video_);
|
||||
dlg.show();
|
||||
|
||||
selected_campaign_difficulty_ = dlg.selected_difficulty();
|
||||
|
||||
|
|
|
@ -442,7 +442,7 @@ bool manager::enable_mods_dialog(const std::vector<std::string>& mods, const std
|
|||
}
|
||||
|
||||
gui2::dialogs::depcheck_confirm_change dialog(true, items, requester);
|
||||
return dialog.show(video_);
|
||||
return dialog.show();
|
||||
}
|
||||
|
||||
bool manager::disable_mods_dialog(const std::vector<std::string>& mods, const std::string& requester)
|
||||
|
@ -453,7 +453,7 @@ bool manager::disable_mods_dialog(const std::vector<std::string>& mods, const st
|
|||
}
|
||||
|
||||
gui2::dialogs::depcheck_confirm_change dialog(false, items, requester);
|
||||
return dialog.show(video_);
|
||||
return dialog.show();
|
||||
}
|
||||
|
||||
std::string manager::change_era_dialog(const std::vector<std::string>& eras)
|
||||
|
@ -465,7 +465,7 @@ std::string manager::change_era_dialog(const std::vector<std::string>& eras)
|
|||
|
||||
gui2::dialogs::depcheck_select_new dialog(ERA, items);
|
||||
|
||||
if(dialog.show(video_)) {
|
||||
if(dialog.show()) {
|
||||
return eras[dialog.result()];
|
||||
}
|
||||
|
||||
|
@ -480,7 +480,7 @@ std::string manager::change_scenario_dialog(const std::vector<std::string>& scen
|
|||
}
|
||||
|
||||
gui2::dialogs::depcheck_select_new dialog(SCENARIO, items);
|
||||
if(dialog.show(video_)) {
|
||||
if(dialog.show()) {
|
||||
return scenarios[dialog.result()];
|
||||
}
|
||||
|
||||
|
@ -489,7 +489,7 @@ std::string manager::change_scenario_dialog(const std::vector<std::string>& scen
|
|||
|
||||
void manager::failure_dialog(const std::string& msg)
|
||||
{
|
||||
gui2::show_message(video_, _("Failed to resolve dependencies"), msg, _("OK"));
|
||||
gui2::show_message(_("Failed to resolve dependencies"), msg, _("OK"));
|
||||
}
|
||||
|
||||
void manager::insert_element(component_type type, const config& data, int index)
|
||||
|
|
|
@ -209,7 +209,7 @@ std::pair<wesnothd_connection_ptr, config> open_connection(CVideo& video, std::s
|
|||
warning_msg += "\n\n";
|
||||
warning_msg += _("Do you want to continue?");
|
||||
|
||||
if(gui2::show_message(video, _("Warning"), warning_msg, gui2::dialogs::message::yes_no_buttons) != gui2::window::OK) {
|
||||
if(gui2::show_message(_("Warning"), warning_msg, gui2::dialogs::message::yes_no_buttons) != gui2::window::OK) {
|
||||
return std::make_pair(wesnothd_connection_ptr(), config());
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ std::pair<wesnothd_connection_ptr, config> open_connection(CVideo& video, std::s
|
|||
std::string password = preferences::password(host, login);
|
||||
|
||||
bool fall_through = (*error)["force_confirmation"].to_bool() ?
|
||||
(gui2::show_message(video, _("Confirm"), (*error)["message"], gui2::dialogs::message::ok_cancel_buttons) == gui2::window::CANCEL) :
|
||||
(gui2::show_message(_("Confirm"), (*error)["message"], gui2::dialogs::message::ok_cancel_buttons) == gui2::window::CANCEL) :
|
||||
false;
|
||||
|
||||
const bool is_pw_request = !((*error)["password_request"].empty()) && !(password.empty());
|
||||
|
@ -323,7 +323,7 @@ std::pair<wesnothd_connection_ptr, config> open_connection(CVideo& video, std::s
|
|||
gui2::dialogs::mp_login dlg(host, error_message, !((*error)["password_request"].empty()));
|
||||
|
||||
// Need to show the dialog from the main thread or it won't appear.
|
||||
events::call_in_main_thread([&dlg, &video]() { dlg.show(video); });
|
||||
events::call_in_main_thread([&dlg, &video]() { dlg.show(); });
|
||||
|
||||
switch(dlg.get_retval()) {
|
||||
//Log in with password
|
||||
|
@ -414,11 +414,11 @@ void enter_wait_mode(mp_workflow_helper_ptr helper, int game_id, bool observe)
|
|||
{
|
||||
gui2::dialogs::mp_join_game dlg(helper->state, *helper->lobby_info, *helper->connection, true, observe);
|
||||
|
||||
if(!dlg.fetch_game_config(helper->video)) {
|
||||
if(!dlg.fetch_game_config()) {
|
||||
return;
|
||||
}
|
||||
|
||||
dlg.show(helper->video);
|
||||
dlg.show();
|
||||
dlg_ok = dlg.get_retval() == gui2::window::OK;
|
||||
}
|
||||
|
||||
|
@ -449,7 +449,7 @@ void enter_staging_mode(mp_workflow_helper_ptr helper)
|
|||
ng::connect_engine_ptr connect_engine(new ng::connect_engine(helper->state, true, campaign_info.get()));
|
||||
|
||||
gui2::dialogs::mp_staging dlg(*connect_engine, *helper->lobby_info, helper->connection);
|
||||
dlg.show(helper->video);
|
||||
dlg.show();
|
||||
dlg_ok = dlg.get_retval() == gui2::window::OK;
|
||||
} // end connect_engine_ptr, dlg scope
|
||||
|
||||
|
@ -474,7 +474,7 @@ void enter_create_mode(mp_workflow_helper_ptr helper)
|
|||
mp::user_info* host_info = helper->lobby_info->get_user(preferences::login());
|
||||
|
||||
gui2::dialogs::mp_create_game dlg(helper->game_config, helper->state, local_mode, host_info);
|
||||
dlg_cancel = !dlg.show(helper->video);
|
||||
dlg_cancel = !dlg.show();
|
||||
}
|
||||
|
||||
if(!dlg_cancel) {
|
||||
|
@ -516,7 +516,7 @@ bool enter_lobby_mode(mp_workflow_helper_ptr helper, const std::vector<std::stri
|
|||
{
|
||||
|
||||
gui2::dialogs::mp_lobby dlg(helper->game_config, li, *helper->connection);
|
||||
dlg.show(helper->video);
|
||||
dlg.show();
|
||||
dlg_retval = dlg.get_retval();
|
||||
dlg_joined_game_id = dlg.get_joined_game_id();
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ bool enter_lobby_mode(mp_workflow_helper_ptr helper, const std::vector<std::stri
|
|||
enter_create_mode(helper);
|
||||
} catch(config::error& error) {
|
||||
if(!error.message.empty()) {
|
||||
gui2::show_error_message(helper->video, error.message);
|
||||
gui2::show_error_message(error.message);
|
||||
}
|
||||
|
||||
// Update lobby content
|
||||
|
@ -544,7 +544,7 @@ bool enter_lobby_mode(mp_workflow_helper_ptr helper, const std::vector<std::stri
|
|||
);
|
||||
} catch(config::error& error) {
|
||||
if(!error.message.empty()) {
|
||||
gui2::show_error_message(helper->video, error.message);
|
||||
gui2::show_error_message(error.message);
|
||||
}
|
||||
|
||||
// Update lobby content
|
||||
|
@ -616,21 +616,21 @@ void start_client(CVideo& video, const config& game_config, saved_game& state, c
|
|||
} while(re_enter);
|
||||
}
|
||||
|
||||
bool goto_mp_connect(CVideo& video, ng::connect_engine& engine, const config& game_config, wesnothd_connection* connection)
|
||||
bool goto_mp_connect(ng::connect_engine& engine, const config& game_config, wesnothd_connection* connection)
|
||||
{
|
||||
lobby_info li(game_config, {});
|
||||
|
||||
gui2::dialogs::mp_staging dlg(engine, li, connection);
|
||||
return dlg.show(video);
|
||||
return dlg.show();
|
||||
}
|
||||
|
||||
bool goto_mp_wait(CVideo& video, saved_game& state, const config& game_config, wesnothd_connection* connection, bool observe)
|
||||
bool goto_mp_wait(saved_game& state, const config& game_config, wesnothd_connection* connection, bool observe)
|
||||
{
|
||||
lobby_info li(game_config, std::vector<std::string>());
|
||||
|
||||
gui2::dialogs::mp_join_game dlg(state, li, *connection, false, observe);
|
||||
|
||||
if(!dlg.fetch_game_config(video)) {
|
||||
if(!dlg.fetch_game_config()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -638,7 +638,7 @@ bool goto_mp_wait(CVideo& video, saved_game& state, const config& game_config, w
|
|||
return true;
|
||||
}
|
||||
|
||||
return dlg.show(video);
|
||||
return dlg.show();
|
||||
}
|
||||
|
||||
void start_local_game(CVideo& video, const config& game_config, saved_game& state)
|
||||
|
|
|
@ -60,13 +60,13 @@ void start_client(CVideo& video, const config& game_config,
|
|||
* Opens mp::connect screen and sets game state according to the
|
||||
* changes made.
|
||||
*/
|
||||
bool goto_mp_connect(CVideo& video, ng::connect_engine& engine,
|
||||
bool goto_mp_connect(ng::connect_engine& engine,
|
||||
const config& game_config, wesnothd_connection* connection);
|
||||
|
||||
/**
|
||||
* Opens mp::wait screen and sets game state according to the
|
||||
* changes made.
|
||||
*/
|
||||
bool goto_mp_wait(CVideo& video, saved_game& state, const config& game_config, wesnothd_connection* connection, bool observe);
|
||||
bool goto_mp_wait(saved_game& state, const config& game_config, wesnothd_connection* connection, bool observe);
|
||||
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ void campaign_controller::show_carryover_message(playsingle_controller& playcont
|
|||
}
|
||||
|
||||
if (end_level.transient.carryover_report) {
|
||||
gui2::show_transient_message(video_, title, report.str(), "", true);
|
||||
gui2::show_transient_message(title, report.str(), "", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,24 +288,24 @@ LEVEL_RESULT campaign_controller::play_game()
|
|||
res = playmp_scenario(end_level);
|
||||
}
|
||||
} catch(game::load_game_failed& e) {
|
||||
gui2::show_error_message(video_, _("The game could not be loaded: ") + e.message);
|
||||
gui2::show_error_message(_("The game could not be loaded: ") + e.message);
|
||||
return LEVEL_RESULT::QUIT;
|
||||
} catch(quit_game_exception&) {
|
||||
LOG_NG << "The game was aborted\n";
|
||||
return LEVEL_RESULT::QUIT;
|
||||
} catch(game::game_error& e) {
|
||||
gui2::show_error_message(video_, _("Error while playing the game: ") + e.message);
|
||||
gui2::show_error_message(_("Error while playing the game: ") + e.message);
|
||||
return LEVEL_RESULT::QUIT;
|
||||
} catch(incorrect_map_format_error& e) {
|
||||
gui2::show_error_message(video_, _("The game map could not be loaded: ") + e.message);
|
||||
gui2::show_error_message(_("The game map could not be loaded: ") + e.message);
|
||||
return LEVEL_RESULT::QUIT;
|
||||
} catch (mapgen_exception& e) {
|
||||
gui2::show_error_message(video_, _("Map generator error: ") + e.message);
|
||||
gui2::show_error_message(_("Map generator error: ") + e.message);
|
||||
} catch(config::error& e) {
|
||||
gui2::show_error_message(video_, _("Error while reading the WML: ") + e.message);
|
||||
gui2::show_error_message(_("Error while reading the WML: ") + e.message);
|
||||
return LEVEL_RESULT::QUIT;
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video_);
|
||||
e.show();
|
||||
return LEVEL_RESULT::QUIT;
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,7 @@ LEVEL_RESULT campaign_controller::play_game()
|
|||
}
|
||||
else if(res == LEVEL_RESULT::OBSERVER_END && mp_info_ && !mp_info_->is_host)
|
||||
{
|
||||
const int dlg_res = gui2::show_message(video_, _("Game Over"),
|
||||
const int dlg_res = gui2::show_message(_("Game Over"),
|
||||
_("This scenario has ended. Do you want to continue the campaign?"),
|
||||
gui2::dialogs::message::yes_no_buttons);
|
||||
|
||||
|
@ -350,7 +350,7 @@ LEVEL_RESULT campaign_controller::play_game()
|
|||
|
||||
if (mp_info_ && !mp_info_->is_host) {
|
||||
// Opens join game dialog to get a new gamestate.
|
||||
if(!mp::goto_mp_wait(video_, state_, game_config_, &mp_info_->connection, res == LEVEL_RESULT::OBSERVER_END)) {
|
||||
if(!mp::goto_mp_wait(state_, game_config_, &mp_info_->connection, res == LEVEL_RESULT::OBSERVER_END)) {
|
||||
return LEVEL_RESULT::QUIT;
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ LEVEL_RESULT campaign_controller::play_game()
|
|||
|
||||
if (!connect_engine->can_start_game() || (game_config::debug && game_type == game_classification::CAMPAIGN_TYPE::MULTIPLAYER)) {
|
||||
// Opens staging dialog to allow users to make an adjustments for scenario.
|
||||
if(!mp::goto_mp_connect(video_, *connect_engine, game_config_, mp_info_ ? &mp_info_->connection : nullptr)) {
|
||||
if(!mp::goto_mp_connect(*connect_engine, game_config_, mp_info_ ? &mp_info_->connection : nullptr)) {
|
||||
return LEVEL_RESULT::QUIT;
|
||||
}
|
||||
} else {
|
||||
|
@ -409,7 +409,7 @@ LEVEL_RESULT campaign_controller::play_game()
|
|||
utils::string_map symbols;
|
||||
symbols["scenario"] = state_.get_scenario_id();
|
||||
message = utils::interpolate_variables_into_string(message, &symbols);
|
||||
gui2::show_error_message(video_, message);
|
||||
gui2::show_error_message(message);
|
||||
return LEVEL_RESULT::QUIT;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ static lg::log_domain log_engine("engine");
|
|||
|
||||
namespace sp {
|
||||
|
||||
bool enter_create_mode(CVideo& video, const config& game_config, saved_game& state, jump_to_campaign_info jump_to_campaign)
|
||||
bool enter_create_mode(const config& game_config, saved_game& state, jump_to_campaign_info jump_to_campaign)
|
||||
{
|
||||
bool configure_canceled = false;
|
||||
|
||||
|
@ -39,7 +39,7 @@ bool enter_create_mode(CVideo& video, const config& game_config, saved_game& sta
|
|||
create_eng.get_levels_by_type_unfiltered(ng::level::TYPE::SP_CAMPAIGN);
|
||||
|
||||
if(campaigns.empty()) {
|
||||
gui2::show_error_message(video, _("No campaigns are available."));
|
||||
gui2::show_error_message(_("No campaigns are available."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -50,9 +50,9 @@ bool enter_create_mode(CVideo& video, const config& game_config, saved_game& sta
|
|||
gui2::dialogs::campaign_selection dlg(create_eng);
|
||||
|
||||
try {
|
||||
dlg.show(video);
|
||||
dlg.show();
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video);
|
||||
e.show();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ bool enter_create_mode(CVideo& video, const config& game_config, saved_game& sta
|
|||
}
|
||||
|
||||
// Canceled difficulty dialog, relaunch the campaign selection dialog
|
||||
return enter_create_mode(video, game_config, state, jump_to_campaign);
|
||||
return enter_create_mode(game_config, state, jump_to_campaign);
|
||||
}
|
||||
|
||||
create_eng.prepare_for_era_and_mods();
|
||||
|
@ -109,14 +109,14 @@ bool enter_create_mode(CVideo& video, const config& game_config, saved_game& sta
|
|||
return false;
|
||||
}
|
||||
|
||||
configure_canceled = !enter_configure_mode(video, game_config_manager::get()->game_config(), state, create_eng);
|
||||
configure_canceled = !enter_configure_mode(game_config_manager::get()->game_config(), state, create_eng);
|
||||
|
||||
} while (configure_canceled);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool enter_configure_mode(CVideo& video, const config& game_config, saved_game& state, ng::create_engine& create_eng)
|
||||
bool enter_configure_mode(const config& game_config, saved_game& state, ng::create_engine& create_eng)
|
||||
{
|
||||
// We create the config engine here in order to ensure values like use_map_settings are set correctly
|
||||
// TODO: should this be passed to this function instead of created here?
|
||||
|
@ -125,19 +125,19 @@ bool enter_configure_mode(CVideo& video, const config& game_config, saved_game&
|
|||
// TODO: needed?
|
||||
config_eng.update_initial_cfg(create_eng.current_level().data());
|
||||
|
||||
if(!gui2::dialogs::sp_options_configure::execute(create_eng, config_eng, video)) {
|
||||
if(!gui2::dialogs::sp_options_configure::execute(create_eng, config_eng)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
create_eng.get_parameters();
|
||||
create_eng.prepare_for_new_level();
|
||||
|
||||
enter_connect_mode(video, game_config, state);
|
||||
enter_connect_mode(game_config, state);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool enter_connect_mode(CVideo& /*video*/, const config& /*game_config*/, saved_game& state)
|
||||
bool enter_connect_mode(const config& /*game_config*/, saved_game& state)
|
||||
{
|
||||
ng::connect_engine connect_eng(state, true, nullptr);
|
||||
|
||||
|
@ -147,11 +147,11 @@ bool enter_connect_mode(CVideo& /*video*/, const config& /*game_config*/, saved_
|
|||
lobby_info li(game_config, std::vector<std::string>());
|
||||
|
||||
gui2::dialogs::mp_staging dlg(connect_eng, li);
|
||||
dlg.show(video);
|
||||
dlg.show();
|
||||
|
||||
if(dlg.get_retval() != gui2::window::OK) {
|
||||
// TODO: enable the workflow loops from GUI1
|
||||
//return enter_create_mode(video, game_config, state, jump_to_campaign_info(false, -1, "", ""));
|
||||
//return enter_create_mode(game_config, state, jump_to_campaign_info(false, -1, "", ""));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
namespace sp {
|
||||
|
||||
bool enter_create_mode(CVideo& video, const config& game_config,
|
||||
bool enter_create_mode(const config& game_config,
|
||||
saved_game& state, jump_to_campaign_info jump_to);
|
||||
|
||||
bool enter_configure_mode(CVideo& video, const config& game_config,
|
||||
bool enter_configure_mode(const config& game_config,
|
||||
saved_game& state, ng::create_engine& create_eng);
|
||||
|
||||
bool enter_connect_mode(CVideo& video, const config& game_config,
|
||||
bool enter_connect_mode(const config& game_config,
|
||||
saved_game& state);
|
||||
|
||||
} // end namespace sp
|
||||
|
|
|
@ -442,7 +442,7 @@ bool game_launcher::init_lua_script()
|
|||
|
||||
return true;
|
||||
} catch (std::exception & e) {
|
||||
gui2::show_error_message(video(), std::string("When loading a plugin, error:\n") + e.what());
|
||||
gui2::show_error_message(std::string("When loading a plugin, error:\n") + e.what());
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
@ -641,28 +641,28 @@ bool game_launcher::load_game()
|
|||
|
||||
} catch(config::error& e) {
|
||||
if(e.message.empty()) {
|
||||
gui2::show_error_message(video(), _("The file you have tried to load is corrupt"));
|
||||
gui2::show_error_message(_("The file you have tried to load is corrupt"));
|
||||
}
|
||||
else {
|
||||
gui2::show_error_message(video(), _("The file you have tried to load is corrupt: '") + e.message + '\'');
|
||||
gui2::show_error_message(_("The file you have tried to load is corrupt: '") + e.message + '\'');
|
||||
}
|
||||
return false;
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video());
|
||||
e.show();
|
||||
return false;
|
||||
} catch(filesystem::io_exception& e) {
|
||||
if(e.message.empty()) {
|
||||
gui2::show_error_message(video(), _("File I/O Error while reading the game"));
|
||||
gui2::show_error_message(_("File I/O Error while reading the game"));
|
||||
} else {
|
||||
gui2::show_error_message(video(), _("File I/O Error while reading the game: '") + e.message + '\'');
|
||||
gui2::show_error_message(_("File I/O Error while reading the game: '") + e.message + '\'');
|
||||
}
|
||||
return false;
|
||||
} catch(game::error& e) {
|
||||
if(e.message.empty()) {
|
||||
gui2::show_error_message(video(), _("The file you have tried to load is corrupt"));
|
||||
gui2::show_error_message(_("The file you have tried to load is corrupt"));
|
||||
}
|
||||
else {
|
||||
gui2::show_error_message(video(), _("The file you have tried to load is corrupt: '") + e.message + '\'');
|
||||
gui2::show_error_message(_("The file you have tried to load is corrupt: '") + e.message + '\'');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ bool game_launcher::new_campaign()
|
|||
state_.mp_settings().show_connect = false;
|
||||
play_replay_ = false;
|
||||
|
||||
return sp::enter_create_mode(video(), game_config_manager::get()->game_config(),
|
||||
return sp::enter_create_mode(game_config_manager::get()->game_config(),
|
||||
state_, jump_to_campaign_);
|
||||
}
|
||||
|
||||
|
@ -815,7 +815,7 @@ bool game_launcher::play_multiplayer(mp_selection res)
|
|||
start_wesnothd();
|
||||
} catch(game::mp_server_error&)
|
||||
{
|
||||
preferences::show_wesnothd_server_search(video());
|
||||
preferences::show_wesnothd_server_search();
|
||||
|
||||
try {
|
||||
start_wesnothd();
|
||||
|
@ -830,7 +830,7 @@ bool game_launcher::play_multiplayer(mp_selection res)
|
|||
|
||||
// If a server address wasn't specified, prompt for it now.
|
||||
if(res != MP_LOCAL && multiplayer_server_.empty()) {
|
||||
if(!gui2::dialogs::mp_connect::execute(CVideo::get_singleton())) {
|
||||
if(!gui2::dialogs::mp_connect::execute()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -858,39 +858,37 @@ bool game_launcher::play_multiplayer(mp_selection res)
|
|||
}
|
||||
|
||||
} catch(game::mp_server_error& e) {
|
||||
gui2::show_error_message(video(), _("Error while starting server: ") + e.message);
|
||||
gui2::show_error_message(_("Error while starting server: ") + e.message);
|
||||
} catch(game::load_game_failed& e) {
|
||||
gui2::show_error_message(video(), _("The game could not be loaded: ") + e.message);
|
||||
gui2::show_error_message(_("The game could not be loaded: ") + e.message);
|
||||
} catch(game::game_error& e) {
|
||||
gui2::show_error_message(video(), _("Error while playing the game: ") + e.message);
|
||||
gui2::show_error_message(_("Error while playing the game: ") + e.message);
|
||||
} catch (mapgen_exception& e) {
|
||||
gui2::show_error_message(video(), _("Map generator error: ") + e.message);
|
||||
gui2::show_error_message(_("Map generator error: ") + e.message);
|
||||
} catch(wesnothd_error& e) {
|
||||
if(!e.message.empty()) {
|
||||
ERR_NET << "caught network error: " << e.message << std::endl;
|
||||
gui2::show_transient_message(video()
|
||||
, ""
|
||||
, translation::gettext(e.message.c_str()));
|
||||
gui2::show_transient_message("", translation::gettext(e.message.c_str()));
|
||||
} else {
|
||||
ERR_NET << "caught network error" << std::endl;
|
||||
}
|
||||
} catch(config::error& e) {
|
||||
if(!e.message.empty()) {
|
||||
ERR_CONFIG << "caught config::error: " << e.message << std::endl;
|
||||
gui2::show_transient_message(video(), "", e.message);
|
||||
gui2::show_transient_message("", e.message);
|
||||
} else {
|
||||
ERR_CONFIG << "caught config::error" << std::endl;
|
||||
}
|
||||
} catch(incorrect_map_format_error& e) {
|
||||
gui2::show_error_message(video(), _("The game map could not be loaded: ") + e.message);
|
||||
gui2::show_error_message(_("The game map could not be loaded: ") + e.message);
|
||||
} catch (savegame::load_game_exception & e) {
|
||||
load_data_.reset(new savegame::load_game_metadata(std::move(e.data_)));
|
||||
//this will make it so next time through the title screen loop, this game is loaded
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video());
|
||||
e.show();
|
||||
} catch (game::error & e) {
|
||||
std::cerr << "caught game::error...\n";
|
||||
gui2::show_error_message(video(), _("Error: ") + e.message);
|
||||
gui2::show_error_message(_("Error: ") + e.message);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -923,7 +921,7 @@ bool game_launcher::play_multiplayer_commandline()
|
|||
bool game_launcher::change_language()
|
||||
{
|
||||
gui2::dialogs::language_selection dlg;
|
||||
dlg.show(video());
|
||||
dlg.show();
|
||||
if (dlg.get_retval() != gui2::window::OK) return false;
|
||||
|
||||
if (!(cmdline_opts_.nogui || cmdline_opts_.headless_unit_test)) {
|
||||
|
@ -968,19 +966,19 @@ void game_launcher::launch_game(RELOAD_GAME_DATA reload)
|
|||
if(result == LEVEL_RESULT::VICTORY && !state_.classification().is_normal_mp_game()) {
|
||||
preferences::add_completed_campaign(state_.classification().campaign, state_.classification().difficulty);
|
||||
|
||||
gui2::dialogs::outro::display(state_.classification().end_text, state_.classification().end_text_duration, video());
|
||||
gui2::dialogs::outro::display(state_.classification().end_text, state_.classification().end_text_duration);
|
||||
|
||||
if(state_.classification().end_credits) {
|
||||
gui2::dialogs::end_credits::display(video(), state_.classification().campaign);
|
||||
gui2::dialogs::end_credits::display(state_.classification().campaign);
|
||||
}
|
||||
}
|
||||
} catch (savegame::load_game_exception &e) {
|
||||
load_data_.reset(new savegame::load_game_metadata(std::move(e.data_)));
|
||||
//this will make it so next time through the title screen loop, this game is loaded
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video());
|
||||
e.show();
|
||||
} catch(mapgen_exception& e) {
|
||||
gui2::show_error_message(video(), _("Map generator error: ") + e.message);
|
||||
gui2::show_error_message(_("Map generator error: ") + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -994,7 +992,7 @@ void game_launcher::play_replay()
|
|||
load_data_.reset(new savegame::load_game_metadata(std::move(e.data_)));
|
||||
//this will make it so next time through the title screen loop, this game is loaded
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video());
|
||||
e.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ bool default_map_generator::allow_user_config() const { return true; }
|
|||
|
||||
void default_map_generator::user_config()
|
||||
{
|
||||
gui2::dialogs::generator_settings::execute(data_, CVideo::get_singleton());
|
||||
gui2::dialogs::generator_settings::execute(data_);
|
||||
}
|
||||
|
||||
std::string default_map_generator::name() const { return "default"; }
|
||||
|
|
|
@ -68,11 +68,11 @@ static std::map<std::string, widget_builder_func_t>& builder_widget_lookup()
|
|||
* be tuned. This page will describe what can be tuned.
|
||||
*
|
||||
*/
|
||||
window* build(CVideo& video, const builder_window::window_resolution* definition)
|
||||
window* build(const builder_window::window_resolution* definition)
|
||||
{
|
||||
// We set the values from the definition since we can only determine the
|
||||
// best size (if needed) after all widgets have been placed.
|
||||
window* win = new window(video, definition);
|
||||
window* win = new window(definition);
|
||||
assert(win);
|
||||
|
||||
for(const auto& lg : definition->linked_groups) {
|
||||
|
@ -102,10 +102,10 @@ window* build(CVideo& video, const builder_window::window_resolution* definition
|
|||
return win;
|
||||
}
|
||||
|
||||
window* build(CVideo& video, const std::string& type)
|
||||
window* build(const std::string& type)
|
||||
{
|
||||
const builder_window::window_resolution& definition = get_window_builder(type);
|
||||
window* window = build(video, &definition);
|
||||
window* window = build(&definition);
|
||||
window->set_id(type);
|
||||
return window;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class window;
|
|||
* @param type The type id string of the window, this window
|
||||
* must be registered at startup.
|
||||
*/
|
||||
window* build(CVideo& video, const std::string& type);
|
||||
window* build(const std::string& type);
|
||||
|
||||
/** Contains the info needed to instantiate a widget. */
|
||||
struct builder_widget
|
||||
|
@ -231,6 +231,6 @@ private:
|
|||
/**
|
||||
* Builds a window.
|
||||
*/
|
||||
window* build(CVideo& video, const builder_window::window_resolution* res);
|
||||
window* build(const builder_window::window_resolution* res);
|
||||
|
||||
} // namespace gui2
|
||||
|
|
|
@ -437,7 +437,7 @@ void addon_manager::fetch_addons_list(window& window)
|
|||
{
|
||||
client_.request_addons_list(cfg_);
|
||||
if(!cfg_) {
|
||||
show_error_message(window.video(), _("An error occurred while downloading the add-ons list from the server."));
|
||||
gui2::show_error_message(_("An error occurred while downloading the add-ons list from the server."));
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ void addon_manager::load_addon_list(window& window)
|
|||
}
|
||||
|
||||
if(addons_.empty()) {
|
||||
show_transient_message(window.video(), _("No Add-ons Available"), _("There are no add-ons available for download from this server."));
|
||||
show_transient_message(_("No Add-ons Available"), _("There are no add-ons available for download from this server."));
|
||||
window.close();
|
||||
}
|
||||
|
||||
|
@ -616,7 +616,7 @@ void addon_manager::install_addon(const addon_info& addon, window& window)
|
|||
void addon_manager::uninstall_addon(const addon_info& addon, window& window)
|
||||
{
|
||||
if(have_addon_pbl_info(addon.id) || have_addon_in_vcs_tree(addon.id)) {
|
||||
show_error_message(window.video(),
|
||||
show_error_message(
|
||||
_("The following add-on appears to have publishing or version control information stored locally, and will not be removed:") + " " +
|
||||
addon.display_title());
|
||||
return;
|
||||
|
@ -625,7 +625,7 @@ void addon_manager::uninstall_addon(const addon_info& addon, window& window)
|
|||
bool success = remove_local_addon(addon.id);
|
||||
|
||||
if(!success) {
|
||||
show_error_message(window.video(), _("The following add-on could not be deleted properly:") + " " + addon.display_title());
|
||||
gui2::show_error_message(_("The following add-on could not be deleted properly:") + " " + addon.display_title());
|
||||
} else {
|
||||
need_wml_cache_refresh_ = true;
|
||||
|
||||
|
@ -671,7 +671,7 @@ void addon_manager::publish_addon(const addon_info& addon, window& window)
|
|||
const version_info& version_to_publish = cfg["version"].str();
|
||||
|
||||
if(version_to_publish <= tracking_info_[addon_id].remote_version) {
|
||||
const int res = gui2::show_message(window.video(), _("Warning"),
|
||||
const int res = gui2::show_message(_("Warning"),
|
||||
_("The remote version of this add-on is greater or equal to the version being uploaded. Do you really wish to continue?"),
|
||||
gui2::dialogs::message::yes_no_buttons);
|
||||
|
||||
|
@ -681,11 +681,11 @@ void addon_manager::publish_addon(const addon_info& addon, window& window)
|
|||
}
|
||||
|
||||
if(!::image::exists(cfg["icon"].str())) {
|
||||
gui2::show_error_message(window.video(), _("Invalid icon path. Make sure the path points to a valid image."));
|
||||
gui2::show_error_message(_("Invalid icon path. Make sure the path points to a valid image."));
|
||||
} else if(!client_.request_distribution_terms(server_msg)) {
|
||||
gui2::show_error_message(window.video(),
|
||||
gui2::show_error_message(
|
||||
_("The server responded with an error:") + "\n" + client_.get_last_server_error());
|
||||
} else if(gui2::show_message(window.video(), _("Terms"), server_msg, gui2::dialogs::message::ok_cancel_buttons, true) == gui2::window::OK) {
|
||||
} else if(gui2::show_message(_("Terms"), server_msg, gui2::dialogs::message::ok_cancel_buttons, true) == gui2::window::OK) {
|
||||
if(!client_.upload_addon(addon_id, server_msg, cfg)) {
|
||||
const std::string& msg = _("The server responded with an error:") +
|
||||
"\n\n" + client_.get_last_server_error();
|
||||
|
@ -697,12 +697,12 @@ void addon_manager::publish_addon(const addon_info& addon, window& window)
|
|||
// stuff (having a scroll container is especially
|
||||
// important since a long list can cause the dialog to
|
||||
// overflow).
|
||||
gui2::show_error_message(window.video(), msg + "\n\n" + extra_data, true);
|
||||
gui2::show_error_message(msg + "\n\n" + extra_data, true);
|
||||
} else {
|
||||
gui2::show_error_message(window.video(), msg, true);
|
||||
gui2::show_error_message(msg, true);
|
||||
}
|
||||
} else {
|
||||
gui2::show_transient_message(window.video(), _("Response"), server_msg);
|
||||
gui2::show_transient_message(_("Response"), server_msg);
|
||||
fetch_addons_list(window);
|
||||
reload_list_and_reselect_item(addon_id, window);
|
||||
}
|
||||
|
@ -718,8 +718,7 @@ void addon_manager::delete_addon(const addon_info& addon, window& window)
|
|||
{{"addon", make_addon_title(addon_id)}} // FIXME: need the real title!
|
||||
);
|
||||
|
||||
const int res = gui2::show_message(
|
||||
window.video(), _("Confirm"), text, gui2::dialogs::message::yes_no_buttons);
|
||||
const int res = gui2::show_message(_("Confirm"), text, gui2::dialogs::message::yes_no_buttons);
|
||||
|
||||
if(res != gui2::window::OK) {
|
||||
return;
|
||||
|
@ -727,10 +726,10 @@ void addon_manager::delete_addon(const addon_info& addon, window& window)
|
|||
|
||||
std::string server_msg;
|
||||
if(!client_.delete_remote_addon(addon_id, server_msg)) {
|
||||
gui2::show_error_message(window.video(), _("The server responded with an error:") + "\n" + client_.get_last_server_error());
|
||||
gui2::show_error_message(_("The server responded with an error:") + "\n" + client_.get_last_server_error());
|
||||
} else {
|
||||
// FIXME: translation needed!
|
||||
gui2::show_transient_message(window.video(), _("Response"), server_msg);
|
||||
gui2::show_transient_message(_("Response"), server_msg);
|
||||
fetch_addons_list(window);
|
||||
reload_list_and_reselect_item(addon_id, window);
|
||||
}
|
||||
|
@ -746,7 +745,7 @@ void addon_manager::execute_default_action(const addon_info& addon, window& wind
|
|||
case ADDON_INSTALLED:
|
||||
if(!tracking_info_[addon.id].can_publish) {
|
||||
utils::string_map symbols{ { "addon", addon.display_title() } };
|
||||
int res = gui2::show_message(window.video(), _("Uninstall add-on"),
|
||||
int res = gui2::show_message(_("Uninstall add-on"),
|
||||
vgettext("Do you want to uninstall '$addon|'?", symbols),
|
||||
gui2::dialogs::message::ok_cancel_buttons);
|
||||
if(res == gui2::window::OK) {
|
||||
|
|
|
@ -34,10 +34,7 @@ public:
|
|||
*
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static void display(CVideo& video)
|
||||
{
|
||||
advanced_graphics_options().show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(advanced_graphics_options)
|
||||
|
||||
// These names must match the infixes of the widget ids in advanced_graphics_options.cfg
|
||||
static const std::vector<std::string> scale_cases;
|
||||
|
|
|
@ -40,10 +40,7 @@ class attack_predictions : public modal_dialog
|
|||
public:
|
||||
attack_predictions(battle_context& bc, const unit& attacker, const unit& defender);
|
||||
|
||||
static void display(battle_context& bc, const unit& attacker, const unit& defender, CVideo& video)
|
||||
{
|
||||
attack_predictions(bc, attacker, defender).show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(attack_predictions)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -41,11 +41,8 @@ public:
|
|||
*/
|
||||
edit_label(std::string& label, bool& team_only);
|
||||
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(std::string& label, bool& team_only, CVideo& video)
|
||||
{
|
||||
return edit_label(label, team_only).show(video);
|
||||
}
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(edit_label)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -49,13 +49,7 @@ public:
|
|||
* if this method returns @a true, undefined
|
||||
* otherwise.
|
||||
*/
|
||||
static bool execute(const std::string& title,
|
||||
const std::string& label,
|
||||
std::string& text,
|
||||
CVideo& video)
|
||||
{
|
||||
return edit_text(title, label, text).show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(edit_text)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -205,7 +205,7 @@ void custom_tod::select_file(window& window, const std::string& default_dir)
|
|||
.set_path(dn)
|
||||
.set_read_only(true);
|
||||
|
||||
if(dlg.show(window.video())) {
|
||||
if(dlg.show()) {
|
||||
dn = dlg.path();
|
||||
|
||||
if(data.first == "image") {
|
||||
|
|
|
@ -35,10 +35,8 @@ class custom_tod : public modal_dialog
|
|||
public:
|
||||
custom_tod(const std::vector<time_of_day>& times, int current_time);
|
||||
|
||||
static bool execute(const std::vector<time_of_day>& times, int current_time, CVideo& video)
|
||||
{
|
||||
return custom_tod(times, current_time).show(video);
|
||||
}
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(custom_tod)
|
||||
|
||||
using string_pair = std::pair<std::string, std::string>;
|
||||
using tod_attribute_getter = std::function<string_pair(const time_of_day&)>;
|
||||
|
|
|
@ -41,18 +41,8 @@ public:
|
|||
color_t& color,
|
||||
std::string& category);
|
||||
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(std::string& text,
|
||||
bool& immutable,
|
||||
bool& visible_fog,
|
||||
bool& visible_shroud,
|
||||
color_t& color,
|
||||
std::string& category,
|
||||
CVideo& video)
|
||||
{
|
||||
return editor_edit_label(text, immutable, visible_fog, visible_shroud, color, category)
|
||||
.show(video);
|
||||
}
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(editor_edit_label)
|
||||
|
||||
private:
|
||||
color_t& color_store;
|
||||
|
|
|
@ -32,24 +32,8 @@ public:
|
|||
bool& victory_when_enemies_defeated,
|
||||
bool& random_start_time);
|
||||
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(std::string& id,
|
||||
std::string& name,
|
||||
std::string& description,
|
||||
int& turns,
|
||||
int& experience_modifier,
|
||||
bool& victory_when_enemies_defeated,
|
||||
bool& random_start_time,
|
||||
CVideo& video)
|
||||
{
|
||||
return editor_edit_scenario(id,
|
||||
name,
|
||||
description,
|
||||
turns,
|
||||
experience_modifier,
|
||||
victory_when_enemies_defeated,
|
||||
random_start_time).show(video);
|
||||
}
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(editor_edit_scenario)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -32,11 +32,8 @@ class editor_edit_side : public modal_dialog
|
|||
public:
|
||||
explicit editor_edit_side(editor::editor_team_info& info);
|
||||
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(editor::editor_team_info& info, CVideo& video)
|
||||
{
|
||||
return editor_edit_side(info).show(video);
|
||||
}
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(editor_edit_side)
|
||||
|
||||
private:
|
||||
virtual void pre_show(window& window) override;
|
||||
|
|
|
@ -30,11 +30,8 @@ class generator_settings : public modal_dialog
|
|||
public:
|
||||
explicit generator_settings(generator_data& data);
|
||||
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(generator_data& data, CVideo& video)
|
||||
{
|
||||
return generator_settings(data).show(video);
|
||||
}
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(generator_settings)
|
||||
|
||||
private:
|
||||
virtual void pre_show(window& window) override;
|
||||
|
|
|
@ -43,11 +43,8 @@ public:
|
|||
*/
|
||||
editor_new_map(const t_string& title, int& width, int& height);
|
||||
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(const t_string& title, int& width, int& height, CVideo& video)
|
||||
{
|
||||
return editor_new_map(title, width, height).show(video);
|
||||
}
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(editor_new_map)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -72,17 +72,8 @@ public:
|
|||
EXPAND_DIRECTION& expand_direction,
|
||||
bool& copy_edge_terrain);
|
||||
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(int& width,
|
||||
int& height,
|
||||
EXPAND_DIRECTION& expand_direction,
|
||||
bool& copy_edge_terrain,
|
||||
CVideo& video)
|
||||
{
|
||||
return editor_resize_map(
|
||||
width, height, expand_direction, copy_edge_terrain)
|
||||
.show(video);
|
||||
}
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(editor_resize_map)
|
||||
|
||||
private:
|
||||
/** The currently selected width. */
|
||||
|
|
|
@ -32,12 +32,9 @@ namespace dialogs
|
|||
class end_credits : public modal_dialog
|
||||
{
|
||||
public:
|
||||
explicit end_credits(const std::string& campaign);
|
||||
explicit end_credits(const std::string& campaign = "");
|
||||
|
||||
static void display(CVideo& video, const std::string& campaign = "")
|
||||
{
|
||||
end_credits(campaign).show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(end_credits)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -296,7 +296,7 @@ bool file_dialog::is_selection_type_acceptable(file_dialog::SELECTION_TYPE stype
|
|||
: stype == SELECTION_IS_FILE;
|
||||
}
|
||||
|
||||
bool file_dialog::confirm_overwrite(window& window, file_dialog::SELECTION_TYPE stype)
|
||||
bool file_dialog::confirm_overwrite(window& /*window*/, file_dialog::SELECTION_TYPE stype)
|
||||
{
|
||||
// TODO: Adapt for implementing directory selection mode.
|
||||
if(stype != SELECTION_IS_FILE) {
|
||||
|
@ -305,7 +305,7 @@ bool file_dialog::confirm_overwrite(window& window, file_dialog::SELECTION_TYPE
|
|||
|
||||
const std::string& message
|
||||
= _("The file already exists. Do you wish to overwrite it?");
|
||||
return gui2::show_message(window.video(), _("Confirm"), message, message::yes_no_buttons) != gui2::window::CANCEL;
|
||||
return gui2::show_message(_("Confirm"), message, message::yes_no_buttons) != gui2::window::CANCEL;
|
||||
}
|
||||
|
||||
bool file_dialog::process_submit_common(window& window, const std::string& name)
|
||||
|
@ -328,13 +328,13 @@ bool file_dialog::process_submit_common(window& window, const std::string& name)
|
|||
// We get here in save mode or not. Use the file creation language only in
|
||||
// save mode.
|
||||
if(save_mode_) {
|
||||
show_transient_error_message(window.video(), vgettext("The file or folder $path cannot be created.", {{"path", name}}));
|
||||
show_transient_error_message(vgettext("The file or folder $path cannot be created.", {{"path", name}}));
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case SELECTION_NOT_FOUND:
|
||||
// We only get here if we aren't in save mode.
|
||||
show_transient_error_message(window.video(), vgettext("The file or folder $path does not exist.", {{"path", name}}));
|
||||
show_transient_error_message(vgettext("The file or folder $path does not exist.", {{"path", name}}));
|
||||
break;
|
||||
case SELECTION_IS_FILE:
|
||||
// TODO: Adapt for implementing directory selection mode.
|
||||
|
@ -656,7 +656,7 @@ void file_dialog::on_bookmark_add_cmd(window& window)
|
|||
|
||||
std::string label = default_label;
|
||||
|
||||
const bool confirm = bookmark_create::execute(label, window.video());
|
||||
const bool confirm = bookmark_create::execute(label);
|
||||
if(!confirm) {
|
||||
return;
|
||||
}
|
||||
|
@ -705,11 +705,11 @@ void file_dialog::on_dir_create_cmd(window& window)
|
|||
{
|
||||
std::string new_dir_name;
|
||||
|
||||
if(folder_create::execute(new_dir_name, window.video())) {
|
||||
if(folder_create::execute(new_dir_name)) {
|
||||
const std::string& new_path = concat_path(current_dir_, new_dir_name);
|
||||
|
||||
if(!fs::make_directory(new_path)) {
|
||||
show_transient_error_message(window.video(),
|
||||
show_transient_error_message(
|
||||
vgettext("Could not create a new folder at $path|. Make sure you have the appropriate permissions to write to this location.",
|
||||
{{"path", new_path}}));
|
||||
} else {
|
||||
|
@ -732,7 +732,7 @@ void file_dialog::on_file_delete_cmd(window& window)
|
|||
: _("The following file will be permanently deleted:"))
|
||||
+ "\n\n" + selection + "\n\n" + _("Do you wish to continue?");
|
||||
|
||||
if(gui2::show_message(window.video(), _("Confirm"), message, message::yes_no_buttons) == gui2::window::CANCEL) {
|
||||
if(gui2::show_message(_("Confirm"), message, message::yes_no_buttons) == gui2::window::CANCEL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -741,7 +741,7 @@ void file_dialog::on_file_delete_cmd(window& window)
|
|||
: fs::delete_file(selection);
|
||||
|
||||
if(!result) {
|
||||
show_transient_error_message(window.video(),
|
||||
show_transient_error_message(
|
||||
vgettext("Could not delete $path|. Make sure you have the appropriate permissions to write to this location.",
|
||||
{{"path", selection}}));
|
||||
} else {
|
||||
|
|
|
@ -37,10 +37,7 @@ public:
|
|||
folder_create(std::string& folder_name);
|
||||
|
||||
/** The execute function; see @ref modal_dialog for more information. */
|
||||
static bool execute(std::string& folder_name, CVideo& video)
|
||||
{
|
||||
return folder_create(folder_name).show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(folder_create)
|
||||
|
||||
private:
|
||||
friend class bookmark_create;
|
||||
|
@ -65,9 +62,9 @@ class bookmark_create
|
|||
{
|
||||
public:
|
||||
/** The execute function; see @ref modal_dialog for more information. */
|
||||
static bool execute(std::string& bookmark_name, CVideo& video)
|
||||
static bool execute(std::string& bookmark_name)
|
||||
{
|
||||
return folder_create(bookmark_name).enable_bookmark_mode().show(video);
|
||||
return folder_create(bookmark_name).enable_bookmark_mode().show();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -113,13 +113,11 @@ void game_cache_options::pre_show(window& window)
|
|||
|
||||
connect_signal_mouse_left_click(*clean_button_,
|
||||
std::bind(&game_cache_options::clean_cache_callback,
|
||||
this,
|
||||
std::ref(window.video())));
|
||||
this));
|
||||
|
||||
connect_signal_mouse_left_click(*purge_button_,
|
||||
std::bind(&game_cache_options::purge_cache_callback,
|
||||
this,
|
||||
std::ref(window.video())));
|
||||
this));
|
||||
}
|
||||
|
||||
void game_cache_options::post_show(window& /*window*/)
|
||||
|
@ -158,15 +156,14 @@ void game_cache_options::browse_cache_callback()
|
|||
desktop::open_object(cache_path_);
|
||||
}
|
||||
|
||||
void game_cache_options::clean_cache_callback(CVideo& video)
|
||||
void game_cache_options::clean_cache_callback()
|
||||
{
|
||||
if(clean_cache()) {
|
||||
show_message(video,
|
||||
show_message(
|
||||
_("Cache Cleaned"),
|
||||
_("The game data cache has been cleaned."));
|
||||
} else {
|
||||
show_error_message(video,
|
||||
_("The game data cache could not be completely cleaned."));
|
||||
show_error_message(_("The game data cache could not be completely cleaned."));
|
||||
}
|
||||
|
||||
update_cache_size_display();
|
||||
|
@ -178,15 +175,14 @@ bool game_cache_options::clean_cache()
|
|||
return game_config::config_cache::instance().clean_cache();
|
||||
}
|
||||
|
||||
void game_cache_options::purge_cache_callback(CVideo& video)
|
||||
void game_cache_options::purge_cache_callback()
|
||||
{
|
||||
if(purge_cache()) {
|
||||
show_message(video,
|
||||
show_message(
|
||||
_("Cache Purged"),
|
||||
_("The game data cache has been purged."));
|
||||
} else {
|
||||
show_error_message(video,
|
||||
_("The game data cache could not be purged."));
|
||||
show_error_message(_("The game data cache could not be purged."));
|
||||
}
|
||||
|
||||
update_cache_size_display();
|
||||
|
|
|
@ -34,10 +34,7 @@ public:
|
|||
*
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static void display(CVideo& video)
|
||||
{
|
||||
game_cache_options().show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(game_cache_options)
|
||||
|
||||
private:
|
||||
std::string cache_path_;
|
||||
|
@ -46,10 +43,10 @@ private:
|
|||
button* purge_button_;
|
||||
label* size_label_;
|
||||
|
||||
void clean_cache_callback(CVideo& video);
|
||||
void clean_cache_callback();
|
||||
bool clean_cache();
|
||||
|
||||
void purge_cache_callback(CVideo& video);
|
||||
void purge_cache_callback();
|
||||
bool purge_cache();
|
||||
|
||||
void copy_to_clipboard_callback();
|
||||
|
|
|
@ -26,11 +26,8 @@ class game_delete : public modal_dialog
|
|||
public:
|
||||
game_delete();
|
||||
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(CVideo& video)
|
||||
{
|
||||
return game_delete().show(video);
|
||||
}
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(game_delete)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -364,7 +364,7 @@ void game_load::delete_button_callback(window& window)
|
|||
|
||||
// See if we should ask the user for deletion confirmation
|
||||
if(preferences::ask_delete_saves()) {
|
||||
if(!gui2::dialogs::game_delete::execute(window.video())) {
|
||||
if(!gui2::dialogs::game_delete::execute()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,14 +37,14 @@ class game_load : public modal_dialog
|
|||
public:
|
||||
game_load(const config& cache_config, savegame::load_game_metadata& data);
|
||||
|
||||
static bool execute(const config& cache_config, savegame::load_game_metadata& data, CVideo& video)
|
||||
static bool execute(const config& cache_config, savegame::load_game_metadata& data)
|
||||
{
|
||||
if(savegame::get_saves_list().empty()) {
|
||||
gui2::show_transient_message(video, _("No Saved Games"), _("There are no save files to load"));
|
||||
gui2::show_transient_message(_("No Saved Games"), _("There are no save files to load"));
|
||||
return false;
|
||||
}
|
||||
|
||||
return game_load(cache_config, data).show(video);
|
||||
return game_load(cache_config, data).show();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -27,9 +27,9 @@ public:
|
|||
game_save(std::string& filename, const std::string& title);
|
||||
|
||||
static bool
|
||||
execute(std::string& filename, const std::string& title, CVideo& video)
|
||||
execute(std::string& filename, const std::string& title)
|
||||
{
|
||||
return game_save(filename, title).show(video);
|
||||
return game_save(filename, title).show();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -44,13 +44,7 @@ public:
|
|||
const std::string& title,
|
||||
const std::string& message);
|
||||
|
||||
static bool execute(std::string& filename,
|
||||
const std::string& title,
|
||||
const std::string& message,
|
||||
CVideo& video)
|
||||
{
|
||||
return game_save_message(filename, title, message).show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(game_save_message)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
@ -65,14 +59,7 @@ public:
|
|||
const std::string& title,
|
||||
const std::string& message);
|
||||
|
||||
static bool execute(bool& ignore_all,
|
||||
std::string& filename,
|
||||
const std::string& title,
|
||||
const std::string& message,
|
||||
CVideo& video)
|
||||
{
|
||||
return game_save_oos(ignore_all, filename, title, message).show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(game_save_oos)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -37,14 +37,14 @@ class game_stats : public modal_dialog
|
|||
public:
|
||||
game_stats(const display_context& board, const int viewing_team, int& selected_index);
|
||||
|
||||
static bool execute(game_board& board, const int viewing_team, int& selected_index, CVideo& video)
|
||||
static bool execute(game_board& board, const int viewing_team, int& selected_index)
|
||||
{
|
||||
if(std::all_of(board.teams().begin(), board.teams().end(), [](team& team) { return team.hidden(); })) {
|
||||
show_transient_message(video, "", _("No visible sides found."));
|
||||
show_transient_message("", _("No visible sides found."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return game_stats(board, viewing_team, selected_index).show(video);
|
||||
return game_stats(board, viewing_team, selected_index).show();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -48,10 +48,7 @@ public:
|
|||
*
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static void display(CVideo& video)
|
||||
{
|
||||
game_version().show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(game_version)
|
||||
|
||||
private:
|
||||
const std::string path_wid_stem_;
|
||||
|
|
|
@ -348,7 +348,7 @@ public:
|
|||
|
||||
void handle_lua_button_clicked(window& window)
|
||||
{
|
||||
lua_interpreter::display(window.video(), lua_interpreter::GAME);
|
||||
lua_interpreter::display(lua_interpreter::GAME);
|
||||
// The game state could've changed, so reset the dialog
|
||||
callbacks.clear();
|
||||
controllers.clear();
|
||||
|
|
|
@ -30,10 +30,7 @@ class help_browser : public modal_dialog
|
|||
public:
|
||||
help_browser();
|
||||
|
||||
static void display(CVideo& video)
|
||||
{
|
||||
help_browser().show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(help_browser)
|
||||
|
||||
private:
|
||||
std::string initial_topic_;
|
||||
|
|
|
@ -113,9 +113,9 @@ void label_settings::pre_show(window& window) {
|
|||
}
|
||||
}
|
||||
|
||||
bool label_settings::execute(display_context& dc, CVideo& video) {
|
||||
bool label_settings::execute(display_context& dc) {
|
||||
label_settings window(dc);
|
||||
if(!window.show(video)) return false;
|
||||
if(!window.show()) return false;
|
||||
std::vector<std::string> hidden_categories;
|
||||
for(auto lbl : window.all_labels) {
|
||||
if(lbl.second == false) {
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
*
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static bool execute(display_context& dc, CVideo& video);
|
||||
static bool execute(display_context& dc);
|
||||
private:
|
||||
std::map<std::string, bool> all_labels;
|
||||
std::map<std::string, t_string> labels_display;
|
||||
|
|
|
@ -220,9 +220,9 @@ void loading_screen::display(CVideo& video, std::function<void()> f)
|
|||
if(current_load || video.faked()) {
|
||||
f();
|
||||
} else if(use_loadingscreen_animation) {
|
||||
loading_screen(f).show(video);
|
||||
loading_screen(f).show();
|
||||
} else {
|
||||
loading_screen(std::function<void()>()).show(video);
|
||||
loading_screen(std::function<void()>()).show();
|
||||
f();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,11 +35,7 @@ public:
|
|||
*
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static void display(CVideo& video)
|
||||
{
|
||||
log_settings().show(video);
|
||||
}
|
||||
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(log_settings)
|
||||
|
||||
private:
|
||||
void set_logger(const std::basic_string<char> log_domain);
|
||||
|
|
|
@ -675,7 +675,7 @@ void lua_interpreter::controller::search(int direction)
|
|||
// Dialog implementation
|
||||
|
||||
/** Display a new console, using given video and lua kernel */
|
||||
void lua_interpreter::display(CVideo& video, lua_kernel_base * lk) {
|
||||
void lua_interpreter::display(lua_kernel_base * lk) {
|
||||
#ifndef ALWAYS_HAVE_LUA_CONSOLE
|
||||
if(!game_config::debug) {
|
||||
return;
|
||||
|
@ -686,15 +686,15 @@ void lua_interpreter::display(CVideo& video, lua_kernel_base * lk) {
|
|||
return;
|
||||
}
|
||||
|
||||
lua_interpreter(*lk).show(video);
|
||||
lua_interpreter(*lk).show();
|
||||
}
|
||||
|
||||
/** Helper function to assist those callers which don't want to include resources.hpp */
|
||||
void lua_interpreter::display(CVideo& video, lua_interpreter::WHICH_KERNEL which) {
|
||||
void lua_interpreter::display(lua_interpreter::WHICH_KERNEL which) {
|
||||
if (which == lua_interpreter::APP) {
|
||||
display(video, plugins_manager::get()->get_kernel_base());
|
||||
display(plugins_manager::get()->get_kernel_base());
|
||||
} else if (which == lua_interpreter::GAME) {
|
||||
display(video, resources::lua_kernel);
|
||||
display(resources::lua_kernel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ public:
|
|||
virtual void pre_show(window& window) override;
|
||||
|
||||
enum WHICH_KERNEL { APP, GAME };
|
||||
static void display(CVideo& video, lua_kernel_base * lk);
|
||||
static void display(CVideo& video, WHICH_KERNEL which);
|
||||
static void display(lua_kernel_base * lk);
|
||||
static void display(WHICH_KERNEL which);
|
||||
private:
|
||||
const std::unique_ptr<controller> controller_;
|
||||
|
||||
|
|
|
@ -149,8 +149,7 @@ message::button_status::button_status()
|
|||
|
||||
using namespace dialogs;
|
||||
|
||||
void show_message(CVideo& video,
|
||||
const std::string& title,
|
||||
void show_message(const std::string& title,
|
||||
const std::string& msg,
|
||||
const std::string& button_caption,
|
||||
const bool auto_close,
|
||||
|
@ -159,11 +158,10 @@ void show_message(CVideo& video,
|
|||
{
|
||||
message dlg(title, msg, auto_close, message_use_markup, title_use_markup);
|
||||
dlg.set_button_caption(message::ok, button_caption);
|
||||
dlg.show(video);
|
||||
dlg.show();
|
||||
}
|
||||
|
||||
int show_message(CVideo& video,
|
||||
const std::string& title,
|
||||
int show_message(const std::string& title,
|
||||
const std::string& msg,
|
||||
const message::button_style button_style,
|
||||
bool message_use_markup,
|
||||
|
@ -200,16 +198,15 @@ int show_message(CVideo& video,
|
|||
break;
|
||||
}
|
||||
|
||||
dlg.show(video);
|
||||
dlg.show();
|
||||
return dlg.get_retval();
|
||||
}
|
||||
|
||||
void show_error_message(CVideo& video,
|
||||
const std::string& msg,
|
||||
void show_error_message(const std::string& msg,
|
||||
bool message_use_markup)
|
||||
{
|
||||
LOG_STREAM(err, lg::general()) << msg << '\n';
|
||||
(void) show_message(video,
|
||||
(void) show_message(
|
||||
_("Error"),
|
||||
msg,
|
||||
message::ok_button,
|
||||
|
|
|
@ -166,7 +166,6 @@ private:
|
|||
* Normally the dialog won't have a button only when the text doesn't fit in
|
||||
* the dialog and a scrollbar is used the button will be shown.
|
||||
*
|
||||
* @param video The video which contains the surface to draw upon.
|
||||
* @param title The title of the dialog.
|
||||
* @param message The message to show in the dialog.
|
||||
* @param button_caption The caption of the close button.
|
||||
|
@ -176,8 +175,7 @@ private:
|
|||
* @param message_use_markup Use markup for the message?
|
||||
* @param title_use_markup Use markup for the title?
|
||||
*/
|
||||
void show_message(CVideo& video,
|
||||
const std::string& title,
|
||||
void show_message(const std::string& title,
|
||||
const std::string& message,
|
||||
const std::string& button_caption = "",
|
||||
const bool auto_close = true,
|
||||
|
@ -190,8 +188,6 @@ void show_message(CVideo& video,
|
|||
* @note this function is rather untested, and the API might change in the
|
||||
* near future.
|
||||
*
|
||||
* @param video The video which contains the surface to draw
|
||||
* upon.
|
||||
* @param title The title of the dialog.
|
||||
* @param message The message to show in the dialog.
|
||||
* @param button_style The style of the button(s) shown.
|
||||
|
@ -200,8 +196,7 @@ void show_message(CVideo& video,
|
|||
*
|
||||
* @returns The retval of the dialog shown.
|
||||
*/
|
||||
int show_message(CVideo& video,
|
||||
const std::string& title,
|
||||
int show_message(const std::string& title,
|
||||
const std::string& message,
|
||||
const dialogs::message::button_style button_style,
|
||||
bool message_use_markup = false,
|
||||
|
@ -210,13 +205,10 @@ int show_message(CVideo& video,
|
|||
/**
|
||||
* Shows an error message to the user.
|
||||
*
|
||||
* @param video The video which contains the surface to draw
|
||||
* upon.
|
||||
* @param message The message to show in the dialog.
|
||||
* @param message_use_markup Use markup for the message?
|
||||
*/
|
||||
void show_error_message(CVideo& video,
|
||||
const std::string& message,
|
||||
void show_error_message(const std::string& message,
|
||||
bool message_use_markup = false);
|
||||
|
||||
} // namespace gui2
|
||||
|
|
|
@ -54,9 +54,9 @@ namespace {
|
|||
};
|
||||
}
|
||||
|
||||
bool modal_dialog::show(CVideo& video, const unsigned auto_close_time)
|
||||
bool modal_dialog::show(const unsigned auto_close_time)
|
||||
{
|
||||
if(video.faked() && !show_even_without_video_) {
|
||||
if(CVideo::get_singleton().faked() && !show_even_without_video_) {
|
||||
if(!allow_plugin_skip_) {
|
||||
return false;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ bool modal_dialog::show(CVideo& video, const unsigned auto_close_time)
|
|||
return false;
|
||||
}
|
||||
|
||||
window_.reset(build_window(video));
|
||||
window_.reset(build_window());
|
||||
assert(window_.get());
|
||||
|
||||
post_build(*window_);
|
||||
|
@ -216,9 +216,9 @@ field_label* modal_dialog::register_label(const std::string& id,
|
|||
return field;
|
||||
}
|
||||
|
||||
window* modal_dialog::build_window(CVideo& video) const
|
||||
window* modal_dialog::build_window() const
|
||||
{
|
||||
return build(video, window_id());
|
||||
return build(window_id());
|
||||
}
|
||||
|
||||
void modal_dialog::post_build(window& /*window*/)
|
||||
|
|
|
@ -27,7 +27,6 @@ namespace gui2
|
|||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/**
|
||||
* Registers a window.
|
||||
*
|
||||
|
@ -41,23 +40,21 @@ namespace dialogs
|
|||
* the same window so the id doesn't need to be
|
||||
* unique.
|
||||
*/
|
||||
#define REGISTER_WINDOW(id) \
|
||||
namespace \
|
||||
{ \
|
||||
\
|
||||
namespace ns_##id \
|
||||
{ \
|
||||
\
|
||||
struct register_helper \
|
||||
{ \
|
||||
register_helper() \
|
||||
{ \
|
||||
register_window(#id); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
struct register_helper register_helper; \
|
||||
} \
|
||||
#define REGISTER_WINDOW(id) \
|
||||
namespace \
|
||||
{ \
|
||||
namespace ns_##id \
|
||||
{ \
|
||||
struct register_helper \
|
||||
{ \
|
||||
register_helper() \
|
||||
{ \
|
||||
register_window(#id); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
struct register_helper register_helper; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,11 +76,11 @@ namespace dialogs
|
|||
* the same window so the id doesn't need to be
|
||||
* unique.
|
||||
*/
|
||||
#define REGISTER_DIALOG2(type, id) \
|
||||
REGISTER_WINDOW(id) const std::string& type::window_id() const \
|
||||
{ \
|
||||
static const std::string result(#id); \
|
||||
return result; \
|
||||
#define REGISTER_DIALOG2(type, id) \
|
||||
REGISTER_WINDOW(id) const std::string& type::window_id() const \
|
||||
{ \
|
||||
static const std::string result(#id); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,6 +90,34 @@ namespace dialogs
|
|||
*/
|
||||
#define REGISTER_DIALOG(window_id) REGISTER_DIALOG2(window_id, window_id)
|
||||
|
||||
/**
|
||||
* Adds a bare-bones static `display` function to a dialog class that immediately
|
||||
* invokes the dialogs's @ref modal_dialog::show function. If more complex behavior
|
||||
* is desired, the function should be defined manually.
|
||||
*
|
||||
* See the @ref modal_dialog documentation (below) for more info.
|
||||
*/
|
||||
#define DEFINE_SIMPLE_DISPLAY_WRAPPER(dialog) \
|
||||
template<typename... T> \
|
||||
static void display(T&&... args) \
|
||||
{ \
|
||||
dialog(std::forward<T>(args)...).show(); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a bare-bonesstatic `execute` function to a dialog class that immediately
|
||||
* invokes and return the result of the dialogs's @ref modal_dialog::show function.
|
||||
* If more complex behavior is desired, the function should be defined manually.
|
||||
*
|
||||
* See the @ref modal_dialog documentation (below) for more info.
|
||||
*/
|
||||
#define DEFINE_SIMPLE_EXECUTE_WRAPPER(dialog) \
|
||||
template<typename... T> \
|
||||
static bool execute(T&&... args) \
|
||||
{ \
|
||||
return dialog(std::forward<T>(args)...).show(); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract base class for all modal dialogs.
|
||||
*
|
||||
|
@ -147,7 +172,7 @@ public:
|
|||
*
|
||||
* @returns Whether the final retval_ == window::OK
|
||||
*/
|
||||
bool show(CVideo& video, const unsigned auto_close_time = 0);
|
||||
bool show(const unsigned auto_close_time = 0);
|
||||
|
||||
|
||||
/***** ***** ***** setters / getters for members ***** ****** *****/
|
||||
|
@ -372,7 +397,7 @@ private:
|
|||
* upon.
|
||||
* @returns The window to show.
|
||||
*/
|
||||
window* build_window(CVideo& video) const;
|
||||
window* build_window() const;
|
||||
|
||||
/**
|
||||
* Actions to be taken directly after the window is build.
|
||||
|
|
|
@ -33,17 +33,15 @@ modeless_dialog::~modeless_dialog()
|
|||
hide();
|
||||
}
|
||||
|
||||
void modeless_dialog::show(CVideo& video,
|
||||
const bool allow_interaction,
|
||||
const unsigned /*auto_close_time*/)
|
||||
void modeless_dialog::show(const bool allow_interaction, const unsigned /*auto_close_time*/)
|
||||
{
|
||||
if(video.faked()) {
|
||||
if(CVideo::get_singleton().faked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
hide();
|
||||
|
||||
window_.reset(build_window(video));
|
||||
window_.reset(build_window());
|
||||
|
||||
post_build(*window_);
|
||||
|
||||
|
@ -69,9 +67,9 @@ void modeless_dialog::hide()
|
|||
window_.reset(nullptr); }
|
||||
}
|
||||
|
||||
window* modeless_dialog::build_window(CVideo& video) const
|
||||
window* modeless_dialog::build_window() const
|
||||
{
|
||||
return build(video, window_id());
|
||||
return build(window_id());
|
||||
}
|
||||
|
||||
void modeless_dialog::post_build(window& /*window*/)
|
||||
|
|
|
@ -59,8 +59,6 @@ public:
|
|||
/**
|
||||
* Shows the window.
|
||||
*
|
||||
* @param video The video which contains the surface to draw
|
||||
* upon.
|
||||
* @param allow_interaction Does the dialog allow interaction?
|
||||
* * true a non modal window is shown
|
||||
* * false a tooltip window is shown
|
||||
|
@ -70,8 +68,7 @@ public:
|
|||
* there's no guarantee about how fast it closes
|
||||
* after the minimum.
|
||||
*/
|
||||
void show(CVideo& video,
|
||||
const bool allow_interaction = false,
|
||||
void show(const bool allow_interaction = false,
|
||||
const unsigned auto_close_time = 0);
|
||||
|
||||
|
||||
|
@ -102,11 +99,9 @@ private:
|
|||
* Every dialog shows it's own kind of window, this function should return
|
||||
* the window to show.
|
||||
*
|
||||
* @param video The video which contains the surface to draw
|
||||
* upon.
|
||||
* @returns The window to show.
|
||||
*/
|
||||
window* build_window(CVideo& video) const;
|
||||
window* build_window() const;
|
||||
|
||||
/**
|
||||
* Actions to be taken directly after the window is build.
|
||||
|
|
|
@ -245,7 +245,7 @@ bool handle_addon_requirements_gui(CVideo& v, const std::vector<mp::game_info::r
|
|||
err_msg += font::unicode_bullet + " " + a.message + "\n";
|
||||
}
|
||||
}
|
||||
gui2::show_message(v, e_title, err_msg, message::auto_close);
|
||||
gui2::show_message(e_title, err_msg, message::auto_close);
|
||||
|
||||
return false;
|
||||
} else if(addon_outcome == mp::game_info::NEED_DOWNLOAD) {
|
||||
|
@ -267,7 +267,7 @@ bool handle_addon_requirements_gui(CVideo& v, const std::vector<mp::game_info::r
|
|||
|
||||
assert(needs_download.size() > 0);
|
||||
|
||||
if(gui2::show_message(v, e_title, err_msg, message::yes_no_buttons, true) == gui2::window::OK) {
|
||||
if(gui2::show_message(e_title, err_msg, message::yes_no_buttons, true) == gui2::window::OK) {
|
||||
// Begin download session
|
||||
ad_hoc_addon_fetch_session(v, needs_download);
|
||||
|
||||
|
@ -950,7 +950,7 @@ void mp_lobby::enter_game(const mp::game_info& game, JOIN_MODE mode)
|
|||
// Prompt user to download this game's required addons if its requirements have not been met
|
||||
if(game.addons_outcome != mp::game_info::SATISFIED) {
|
||||
if(game.required_addons.empty()) {
|
||||
gui2::show_error_message(window.video(), _("Something is wrong with the addon version check database supporting the multiplayer lobby. Please report this at http://bugs.wesnoth.org."));
|
||||
gui2::show_error_message(_("Something is wrong with the addon version check database supporting the multiplayer lobby. Please report this at http://bugs.wesnoth.org."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -973,7 +973,7 @@ void mp_lobby::enter_game(const mp::game_info& game, JOIN_MODE mode)
|
|||
if(!join_data.empty() && try_join && game.password_required) {
|
||||
std::string password;
|
||||
|
||||
if(!gui2::dialogs::mp_join_game_password_prompt::execute(password, window.video())) {
|
||||
if(!gui2::dialogs::mp_join_game_password_prompt::execute(password)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ void mp_lobby::user_dialog_callback(mp::user_info* info)
|
|||
|
||||
lobby_delay_gamelist_update_guard g(*this);
|
||||
|
||||
dlg.show(get_window()->video());
|
||||
dlg.show();
|
||||
|
||||
delay_playerlist_update_ = true;
|
||||
|
||||
|
|
|
@ -33,10 +33,7 @@ public:
|
|||
*
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static void display(CVideo& video)
|
||||
{
|
||||
mp_alerts_options().show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(mp_alerts_options)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -152,12 +152,12 @@ void mp_server_list::post_show(window& window)
|
|||
REGISTER_DIALOG(mp_connect)
|
||||
|
||||
static void
|
||||
show_server_list(CVideo& video, window& window, field_text* host_name)
|
||||
show_server_list(window& window, field_text* host_name)
|
||||
{
|
||||
assert(host_name);
|
||||
|
||||
mp_server_list dlg;
|
||||
dlg.show(video);
|
||||
dlg.show();
|
||||
|
||||
if(dlg.get_retval() == window::OK) {
|
||||
host_name->set_widget_value(window, dlg.host_name());
|
||||
|
@ -182,10 +182,7 @@ void mp_connect::pre_show(window& win)
|
|||
if(button* btn = find_widget<button>(&win, "list", false, false)) {
|
||||
|
||||
connect_signal_mouse_left_click(*btn,
|
||||
std::bind(show_server_list,
|
||||
std::ref(win.video()),
|
||||
std::ref(win),
|
||||
host_name_));
|
||||
std::bind(show_server_list, std::ref(win), host_name_));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,7 @@ public:
|
|||
mp_connect();
|
||||
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
static bool execute(CVideo& video)
|
||||
{
|
||||
return mp_connect().show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(mp_connect)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -185,7 +185,7 @@ void mp_create_game::pre_show(window& win)
|
|||
}
|
||||
|
||||
if(game_types.empty()) {
|
||||
gui2::show_transient_message(win.video(), "", _("No games found."));
|
||||
gui2::show_transient_message("", _("No games found."));
|
||||
throw game::error(_("No games found."));
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ void mp_create_game::pre_show(window& win)
|
|||
}
|
||||
|
||||
if(era_names.empty()) {
|
||||
gui2::show_transient_message(win.video(), "", _("No eras found."));
|
||||
gui2::show_transient_message("", _("No eras found."));
|
||||
throw config::error(_("No eras found"));
|
||||
}
|
||||
|
||||
|
@ -819,10 +819,10 @@ void mp_create_game::set_active_mods(const std::vector<std::string>& val)
|
|||
}
|
||||
}
|
||||
|
||||
bool mp_create_game::dialog_exit_hook(window& window)
|
||||
bool mp_create_game::dialog_exit_hook(window& /*window*/)
|
||||
{
|
||||
if(!create_engine_.current_level_has_side_data()) {
|
||||
gui2::show_transient_error_message(window.video(), _("The selected game has no sides!"));
|
||||
gui2::show_transient_error_message(_("The selected game has no sides!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -893,7 +893,7 @@ void mp_create_game::post_show(window& window)
|
|||
gui2::dialogs::simple_item_selector dlg(_("Choose Starting Scenario"), _("Select at which point to begin this campaign."), entry_point_titles);
|
||||
|
||||
dlg.set_single_button(true);
|
||||
dlg.show(window.video());
|
||||
dlg.show();
|
||||
|
||||
const config& scenario = *entry_points[dlg.selected_index()];
|
||||
|
||||
|
|
|
@ -27,11 +27,8 @@ class mp_host_game_prompt : public modal_dialog
|
|||
public:
|
||||
mp_host_game_prompt();
|
||||
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(CVideo& video)
|
||||
{
|
||||
return mp_host_game_prompt().show(video);
|
||||
}
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(mp_host_game_prompt)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -87,7 +87,7 @@ mp_join_game::~mp_join_game()
|
|||
/*
|
||||
* Fetch the selected game's config from the server and prompts an initial faction selection.
|
||||
*/
|
||||
bool mp_join_game::fetch_game_config(CVideo& video)
|
||||
bool mp_join_game::fetch_game_config()
|
||||
{
|
||||
// Ask for the next scenario data, if applicable
|
||||
if(!first_scenario_) {
|
||||
|
@ -215,7 +215,7 @@ bool mp_join_game::fetch_game_config(CVideo& video)
|
|||
ng::flg_manager flg(era_factions, *side_choice, lock_settings, use_map_settings, saved_game);
|
||||
|
||||
gui2::dialogs::faction_select dlg(flg, color, side_num);
|
||||
dlg.show(video);
|
||||
dlg.show();
|
||||
|
||||
if(dlg.get_retval() != gui2::window::OK) {
|
||||
return false;
|
||||
|
@ -450,7 +450,7 @@ void mp_join_game::network_handler(window& window)
|
|||
find_widget<chatbox>(&window, "chat", false).process_network_data(data);
|
||||
|
||||
if(!data["message"].empty()) {
|
||||
gui2::show_transient_message(window.video(), _("Response") , data["message"]);
|
||||
gui2::show_transient_message(_("Response") , data["message"]);
|
||||
}
|
||||
|
||||
if(data["failed"].to_bool()) {
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "mp_game_settings.hpp"
|
||||
|
||||
class config;
|
||||
class CVideo;
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
@ -41,12 +40,7 @@ public:
|
|||
|
||||
~mp_join_game();
|
||||
|
||||
/**
|
||||
* FIXME: We shouldn't need to pass a CVideo argument here. Optimally, this would be done in
|
||||
* post_build or pre_show, but there's a bug where the Faction Select dialog does not display
|
||||
* there. This should be changed to either of those functions once that's fixed.
|
||||
*/
|
||||
bool fetch_game_config(CVideo& video);
|
||||
bool fetch_game_config();
|
||||
bool started() const { return level_["started"].to_bool(); }
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -35,11 +35,8 @@ public:
|
|||
*/
|
||||
explicit mp_join_game_password_prompt(std::string& password);
|
||||
|
||||
/** The execute function -- see @ref modal_dialog for more information. */
|
||||
static bool execute(std::string& password, CVideo& video)
|
||||
{
|
||||
return mp_join_game_password_prompt(password).show(video);
|
||||
}
|
||||
/** The execute function. See @ref modal_dialog for more information. */
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(mp_join_game_password_prompt)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -238,7 +238,7 @@ void mp_staging::add_side_node(window& window, ng::side_engine_ptr side)
|
|||
leader_select.set_active(!saved_game);
|
||||
|
||||
connect_signal_mouse_left_click(leader_select,
|
||||
std::bind(&mp_staging::select_leader_callback, this, std::ref(window), side, std::ref(row_grid)));
|
||||
std::bind(&mp_staging::select_leader_callback, this, side, std::ref(row_grid)));
|
||||
|
||||
//
|
||||
// Team
|
||||
|
@ -374,10 +374,10 @@ void mp_staging::on_team_select(window& window, ng::side_engine_ptr side, menu_b
|
|||
halt = true;
|
||||
}
|
||||
|
||||
void mp_staging::select_leader_callback(window& window, ng::side_engine_ptr side, grid& row_grid)
|
||||
void mp_staging::select_leader_callback(ng::side_engine_ptr side, grid& row_grid)
|
||||
{
|
||||
gui2::dialogs::faction_select dlg(side->flg(), side->color_id(), side->index() + 1);
|
||||
dlg.show(window.video());
|
||||
dlg.show();
|
||||
|
||||
if(dlg.get_retval() == window::OK) {
|
||||
update_leader_display(side, row_grid);
|
||||
|
|
|
@ -61,7 +61,7 @@ private:
|
|||
template<void(ng::side_engine::*fptr)(int)>
|
||||
void on_side_slider_change(ng::side_engine_ptr side, slider& slider);
|
||||
|
||||
void select_leader_callback(window& window, ng::side_engine_ptr side, grid& row_grid);
|
||||
void select_leader_callback(ng::side_engine_ptr side, grid& row_grid);
|
||||
|
||||
void update_player_list(window& window);
|
||||
void update_leader_display(ng::side_engine_ptr side, grid& row_grid);
|
||||
|
|
|
@ -38,10 +38,7 @@ public:
|
|||
* @param duration In milliseconds, for how much time the text will
|
||||
* be displayed on screen.
|
||||
*/
|
||||
static void display(const std::string& text, unsigned int duration, CVideo& video)
|
||||
{
|
||||
outro(text, duration).show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(outro)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -204,7 +204,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(window.video(), "", _("No username specified"), "", false, false, true);
|
||||
gui2::show_transient_message("", _("No username specified"), "", false, false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,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(window.video(), _("Error"), _("Invalid username"), "", false, false, true);
|
||||
gui2::show_transient_message(_("Error"), _("Invalid username"), "", false, false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -264,12 +264,12 @@ 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(window.video(), "", _("No username specified"), "", false, false, true);
|
||||
gui2::show_transient_message("", _("No username specified"), "", false, false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!remove_acquaintance(to_remove)) {
|
||||
gui2::show_transient_error_message(window.video(), _("Not on friends or ignore lists"));
|
||||
gui2::show_transient_error_message(_("Not on friends or ignore lists"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -365,8 +365,7 @@ void preferences_dialog::post_build(window& window)
|
|||
|
||||
/* CACHE MANAGE */
|
||||
connect_signal_mouse_left_click(find_widget<button>(&window, "cachemg", false),
|
||||
std::bind(&gui2::dialogs::game_cache_options::display,
|
||||
std::ref(window.video())));
|
||||
std::bind(&gui2::dialogs::game_cache_options::display<>));
|
||||
|
||||
//
|
||||
// DISPLAY PANEL
|
||||
|
@ -433,8 +432,7 @@ void preferences_dialog::post_build(window& window)
|
|||
/* SELECT THEME */
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "choose_theme", false),
|
||||
bind_void(&show_theme_dialog,
|
||||
std::ref(window.video())));
|
||||
bind_void(&show_theme_dialog));
|
||||
|
||||
|
||||
//
|
||||
|
@ -548,14 +546,12 @@ void preferences_dialog::post_build(window& window)
|
|||
/* ALERTS */
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "mp_alerts", false),
|
||||
std::bind(&gui2::dialogs::mp_alerts_options::display,
|
||||
std::ref(window.video())));
|
||||
std::bind(&gui2::dialogs::mp_alerts_options::display<>));
|
||||
|
||||
/* SET WESNOTHD PATH */
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "mp_wesnothd", false), std::bind(
|
||||
&show_wesnothd_server_search,
|
||||
std::ref(window.video())));
|
||||
&show_wesnothd_server_search));
|
||||
|
||||
|
||||
//
|
||||
|
@ -695,10 +691,9 @@ void preferences_dialog::post_build(window& window)
|
|||
connect_signal_notify_modified(advanced, std::bind(
|
||||
&preferences_dialog::on_advanced_prefs_list_select,
|
||||
this,
|
||||
std::ref(advanced),
|
||||
std::ref(window)));
|
||||
std::ref(advanced)));
|
||||
|
||||
on_advanced_prefs_list_select(advanced, window);
|
||||
on_advanced_prefs_list_select(advanced);
|
||||
|
||||
//
|
||||
// HOTKEYS PANEL
|
||||
|
@ -804,12 +799,11 @@ listbox& preferences_dialog::setup_hotkey_list(window& window)
|
|||
|
||||
void preferences_dialog::add_hotkey_callback(listbox& hotkeys)
|
||||
{
|
||||
CVideo& video = hotkeys.get_window()->video();
|
||||
int row_number = hotkeys.get_selected_row();
|
||||
const hotkey::hotkey_command& hotkey_item = *visible_hotkeys_[row_number];
|
||||
|
||||
gui2::dialogs::hotkey_bind bind_dlg(hotkey_item.command);
|
||||
bind_dlg.show(video);
|
||||
bind_dlg.show();
|
||||
|
||||
hotkey::hotkey_ptr newhk = bind_dlg.get_new_binding();
|
||||
hotkey::hotkey_ptr oldhk;
|
||||
|
@ -839,7 +833,7 @@ void preferences_dialog::add_hotkey_callback(listbox& hotkeys)
|
|||
{"new_hotkey_action", hotkey::get_description(newhk->get_command())}
|
||||
});
|
||||
|
||||
const int res = gui2::show_message(video, _("Reassign Hotkey"), text, gui2::dialogs::message::yes_no_buttons, true);
|
||||
const int res = gui2::show_message(_("Reassign Hotkey"), text, gui2::dialogs::message::yes_no_buttons, true);
|
||||
if(res != gui2::window::OK) {
|
||||
return;
|
||||
}
|
||||
|
@ -856,7 +850,7 @@ void preferences_dialog::add_hotkey_callback(listbox& hotkeys)
|
|||
|
||||
void preferences_dialog::default_hotkey_callback(window& window)
|
||||
{
|
||||
gui2::show_transient_message(window.video(), _("Hotkeys Reset"), _("All hotkeys have been reset to their default values."),
|
||||
gui2::show_transient_message(_("Hotkeys Reset"), _("All hotkeys have been reset to their default values."),
|
||||
std::string(), false, false, true);
|
||||
|
||||
clear_hotkeys();
|
||||
|
@ -906,7 +900,7 @@ void preferences_dialog::hotkey_type_filter_callback(window& window) const
|
|||
find_widget<listbox>(&window, "list_hotkeys", false).set_row_shown(res);
|
||||
}
|
||||
|
||||
void preferences_dialog::on_advanced_prefs_list_select(listbox& list, window& window)
|
||||
void preferences_dialog::on_advanced_prefs_list_select(listbox& list)
|
||||
{
|
||||
const int selected_row = list.get_selected_row();
|
||||
|
||||
|
@ -917,11 +911,11 @@ void preferences_dialog::on_advanced_prefs_list_select(listbox& list, window& wi
|
|||
|
||||
if(selected_type == ADVANCED_PREF_TYPE::SPECIAL) {
|
||||
if(selected_field == "advanced_graphic_options") {
|
||||
gui2::dialogs::advanced_graphics_options::display(window.video());
|
||||
gui2::dialogs::advanced_graphics_options::display();
|
||||
} else if(selected_field == "logging") {
|
||||
gui2::dialogs::log_settings::display(window.video());
|
||||
gui2::dialogs::log_settings::display();
|
||||
} else if(selected_field == "orb_color") {
|
||||
gui2::dialogs::select_orb_colors::display(window.video());
|
||||
gui2::dialogs::select_orb_colors::display();
|
||||
} else {
|
||||
WRN_GUI_L << "Invalid or unimplemented custom advanced prefs option: " << selected_field << "\n";
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
/** The display function -- see @ref modal_dialog for more information. */
|
||||
static void display(CVideo& video, const config& game_cfg, const preferences::PREFERENCE_VIEW initial_view = preferences::VIEW_DEFAULT)
|
||||
{
|
||||
preferences_dialog(video, game_cfg, initial_view).show(video);
|
||||
preferences_dialog(video, game_cfg, initial_view).show();
|
||||
}
|
||||
|
||||
typedef std::vector<const hotkey::hotkey_command*> t_visible_hotkeys;
|
||||
|
@ -106,7 +106,7 @@ private:
|
|||
/** Callback for selection changes */
|
||||
void on_page_select(window& window);
|
||||
void on_tab_select(window& window);
|
||||
void on_advanced_prefs_list_select(listbox& tree, window& window);
|
||||
void on_advanced_prefs_list_select(listbox& tree);
|
||||
|
||||
/** Special callback functions */
|
||||
void handle_res_select(window& window);
|
||||
|
|
|
@ -38,10 +38,7 @@ public:
|
|||
*
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static void display(const std::string& path, CVideo& video)
|
||||
{
|
||||
screenshot_notification(path).show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(screenshot_notification)
|
||||
|
||||
private:
|
||||
const std::string path_;
|
||||
|
|
|
@ -34,9 +34,8 @@ public:
|
|||
*
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static void display(CVideo& video) {
|
||||
select_orb_colors().show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(select_orb_colors)
|
||||
|
||||
private:
|
||||
void setup_orb_group(const std::string& base_id, bool& shown, const std::string& initial, window& window, bool connect = true);
|
||||
void handle_toggle_click(bool& storage);
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
* Execute function. We only want to show the dialog if the campaign has options or if
|
||||
* there are active mods and at least one of those mods has custom options.
|
||||
*/
|
||||
static bool execute(ng::create_engine& create_engine, ng::configure_engine& config_engine, CVideo& video)
|
||||
static bool execute(ng::create_engine& create_engine, ng::configure_engine& config_engine)
|
||||
{
|
||||
// Check campaign options.
|
||||
const auto& campaign_mods = create_engine.current_level().data().child_range("options");
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
return sp_options_configure(create_engine, config_engine).show(video);
|
||||
return sp_options_configure(create_engine, config_engine).show();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -32,10 +32,7 @@ class statistics_dialog : public modal_dialog
|
|||
public:
|
||||
statistics_dialog(const team& current_team);
|
||||
|
||||
static void display(const team& current_team, CVideo& video)
|
||||
{
|
||||
statistics_dialog(current_team).show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(statistics_dialog)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -35,12 +35,12 @@ public:
|
|||
|
||||
~story_viewer();
|
||||
|
||||
static void display(const std::string& scenario_name, const config& story, CVideo& video)
|
||||
static void display(const std::string& scenario_name, const config& story)
|
||||
{
|
||||
try {
|
||||
story_viewer viewer(scenario_name, story);
|
||||
if(viewer.controller_.max_parts() > 0) {
|
||||
viewer.show(video);
|
||||
viewer.show();
|
||||
}
|
||||
} catch(std::out_of_range&) {}
|
||||
}
|
||||
|
|
|
@ -33,10 +33,7 @@ class terrain_layers : public modal_dialog
|
|||
public:
|
||||
terrain_layers(display_t& disp, const map_location& loc);
|
||||
|
||||
static void display(display_t& disp, const map_location& loc, CVideo& video)
|
||||
{
|
||||
terrain_layers(disp, loc).show(video);
|
||||
}
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(terrain_layers)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -173,7 +173,7 @@ static bool fullscreen(CVideo& video)
|
|||
|
||||
static bool launch_lua_console(window& window)
|
||||
{
|
||||
gui2::dialogs::lua_interpreter::display(window.video(), gui2::dialogs::lua_interpreter::APP);
|
||||
gui2::dialogs::lua_interpreter::display(gui2::dialogs::lua_interpreter::APP);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ static bool launch_lua_console(window& window)
|
|||
* - 150 to test with a borderline to insanely huge tooltip placement.
|
||||
* - 180 to test with an insanely huge tooltip placement.
|
||||
*/
|
||||
static void debug_tooltip(window& window, bool& handled, const point& coordinate)
|
||||
static void debug_tooltip(window& /*window*/, bool& handled, const point& coordinate)
|
||||
{
|
||||
std::string message = "Hello world.";
|
||||
|
||||
|
@ -199,7 +199,7 @@ static void debug_tooltip(window& window, bool& handled, const point& coordinate
|
|||
}
|
||||
|
||||
gui2::tip::remove();
|
||||
gui2::tip::show(window.video(), "tooltip", message, coordinate);
|
||||
gui2::tip::show("tooltip", message, coordinate);
|
||||
|
||||
handled = true;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ void title_screen::pre_show(window& win)
|
|||
}
|
||||
std::sort(options.begin(), options.end());
|
||||
gui2::dialogs::simple_item_selector dlg(_("Choose Test"), "", options);
|
||||
dlg.show(game_.video());
|
||||
dlg.show();
|
||||
int choice = dlg.selected_index();
|
||||
if(choice >= 0) {
|
||||
game_.set_test(options[choice]);
|
||||
|
@ -315,7 +315,7 @@ void title_screen::pre_show(window& win)
|
|||
//
|
||||
register_button(win, "help", hotkey::HOTKEY_HELP, [](window& w) {
|
||||
if(gui2::new_widgets) {
|
||||
gui2::dialogs::help_browser::display(w.video());
|
||||
gui2::dialogs::help_browser::display();
|
||||
}
|
||||
|
||||
help::help_manager help_manager(&game_config_manager::get()->game_config());
|
||||
|
@ -325,7 +325,7 @@ void title_screen::pre_show(window& win)
|
|||
//
|
||||
// About
|
||||
//
|
||||
register_button(win, "about", hotkey::HOTKEY_NULL, std::bind(&game_version::display, std::ref(win.video())));
|
||||
register_button(win, "about", hotkey::HOTKEY_NULL, std::bind(&game_version::display<>));
|
||||
|
||||
//
|
||||
// Tutorial
|
||||
|
@ -344,7 +344,7 @@ void title_screen::pre_show(window& win)
|
|||
w.set_retval(LAUNCH_GAME);
|
||||
}
|
||||
} catch (const config::error& e) {
|
||||
gui2::show_error_message(w.video(), e.what());
|
||||
gui2::show_error_message(e.what());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -354,7 +354,7 @@ void title_screen::pre_show(window& win)
|
|||
register_button(win, "multiplayer", hotkey::TITLE_SCREEN__MULTIPLAYER, [this](window& w) {
|
||||
while(true) {
|
||||
gui2::dialogs::mp_method_selection dlg;
|
||||
dlg.show(w.video());
|
||||
dlg.show();
|
||||
|
||||
if(dlg.get_retval() != gui2::window::OK) {
|
||||
return;
|
||||
|
@ -363,7 +363,7 @@ void title_screen::pre_show(window& win)
|
|||
const int res = dlg.get_choice();
|
||||
|
||||
if(res == 2 && preferences::mp_server_warning_disabled() < 2) {
|
||||
if(!gui2::dialogs::mp_host_game_prompt::execute(w.video())) {
|
||||
if(!gui2::dialogs::mp_host_game_prompt::execute()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ void title_screen::pre_show(window& win)
|
|||
}
|
||||
|
||||
gui2::dialogs::core_selection core_dlg(cores, current);
|
||||
if(core_dlg.show(w.video())) {
|
||||
if(core_dlg.show()) {
|
||||
const std::string& core_id = cores[core_dlg.get_choice()]["id"];
|
||||
|
||||
preferences::set_core_id(core_id);
|
||||
|
@ -456,7 +456,7 @@ void title_screen::pre_show(window& win)
|
|||
on_resize(w);
|
||||
}
|
||||
} catch(std::runtime_error& e) {
|
||||
gui2::show_error_message(w.video(), e.what());
|
||||
gui2::show_error_message(e.what());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -479,7 +479,7 @@ void title_screen::pre_show(window& win)
|
|||
// Debug clock
|
||||
//
|
||||
register_button(win, "clock", hotkey::HOTKEY_NULL,
|
||||
std::bind(&title_screen::show_debug_clock_window, this, std::ref(win.video())));
|
||||
std::bind(&title_screen::show_debug_clock_window, this));
|
||||
|
||||
find_widget<button>(&win, "clock", false).set_visible(show_debug_clock_button
|
||||
? widget::visibility::visible
|
||||
|
@ -523,7 +523,7 @@ void title_screen::update_tip(window& win, const bool previous)
|
|||
win.set_is_dirty(true);
|
||||
}
|
||||
|
||||
void title_screen::show_debug_clock_window(CVideo& video)
|
||||
void title_screen::show_debug_clock_window()
|
||||
{
|
||||
assert(show_debug_clock_button);
|
||||
|
||||
|
@ -531,7 +531,7 @@ void title_screen::show_debug_clock_window(CVideo& video)
|
|||
debug_clock_.reset(nullptr);
|
||||
} else {
|
||||
debug_clock_.reset(new debug_clock());
|
||||
debug_clock_->show(video, true);
|
||||
debug_clock_->show(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ private:
|
|||
void update_tip(window& window, const bool previous);
|
||||
|
||||
/** Shows the debug clock. */
|
||||
void show_debug_clock_window(CVideo& video);
|
||||
void show_debug_clock_window();
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
|
|
|
@ -150,8 +150,7 @@ static tooltip& tip()
|
|||
return *t;
|
||||
}
|
||||
|
||||
void show(CVideo& video,
|
||||
const std::string& window_id,
|
||||
void show(const std::string& window_id,
|
||||
const t_string& message,
|
||||
const point& mouse,
|
||||
const SDL_Rect& source_rect)
|
||||
|
@ -167,7 +166,7 @@ void show(CVideo& video,
|
|||
t.set_source_rect(source_rect);
|
||||
try
|
||||
{
|
||||
t.show(video);
|
||||
t.show();
|
||||
}
|
||||
catch(window_builder_invalid_id&)
|
||||
{
|
||||
|
@ -176,7 +175,7 @@ void show(CVideo& video,
|
|||
t.set_window_id("tooltip_large");
|
||||
try
|
||||
{
|
||||
t.show(video);
|
||||
t.show();
|
||||
}
|
||||
catch(window_builder_invalid_id&)
|
||||
{
|
||||
|
|
|
@ -36,14 +36,11 @@ namespace tip
|
|||
* The tip is a tooltip or a helptip. One type of tip is shown at the same
|
||||
* time, opening a second tip closes the first.
|
||||
*
|
||||
* @param video The video which contains the surface to draw
|
||||
* upon.
|
||||
* @param window_id The id of the window used to show the tip.
|
||||
* @param message The message to show in the tip.
|
||||
* @param mouse The position of the mouse.
|
||||
*/
|
||||
void show(CVideo& video,
|
||||
const std::string& window_id,
|
||||
void show(const std::string& window_id,
|
||||
const t_string& message,
|
||||
const point& mouse,
|
||||
const SDL_Rect& source_rect);
|
||||
|
|
|
@ -56,8 +56,7 @@ void transient_message::pre_show(window& window)
|
|||
}
|
||||
} // namespace dialogs
|
||||
|
||||
void show_transient_message(CVideo& video,
|
||||
const std::string& title,
|
||||
void show_transient_message(const std::string& title,
|
||||
const std::string& message,
|
||||
const std::string& image,
|
||||
const bool message_use_markup,
|
||||
|
@ -68,17 +67,15 @@ void show_transient_message(CVideo& video,
|
|||
title, title_use_markup, message, message_use_markup, image);
|
||||
|
||||
dlg.set_restore(restore_background);
|
||||
dlg.show(video);
|
||||
dlg.show();
|
||||
}
|
||||
|
||||
void show_transient_error_message(CVideo& video,
|
||||
const std::string& message,
|
||||
void show_transient_error_message(const std::string& message,
|
||||
const std::string& image,
|
||||
const bool message_use_markup)
|
||||
{
|
||||
LOG_STREAM(err, lg::general()) << message << '\n';
|
||||
show_transient_message(
|
||||
video, _("Error"), message, image, message_use_markup);
|
||||
show_transient_message(_("Error"), message, image, message_use_markup);
|
||||
}
|
||||
|
||||
} // namespace gui2
|
||||
|
|
|
@ -52,8 +52,6 @@ private:
|
|||
* @note The message _should_ be small enough to fit on the window, the text
|
||||
* can contain newlines and will wrap when needed.
|
||||
*
|
||||
* @param video The video which contains the surface to draw
|
||||
* upon.
|
||||
* @param title The title of the dialog.
|
||||
* @param message The message to show in the dialog.
|
||||
* @param image An image to show in the dialog.
|
||||
|
@ -62,8 +60,7 @@ private:
|
|||
* @param restore_background Restore the background to the state it was before
|
||||
* the message appeared
|
||||
*/
|
||||
void show_transient_message(CVideo& video,
|
||||
const std::string& title,
|
||||
void show_transient_message(const std::string& title,
|
||||
const std::string& message,
|
||||
const std::string& image = std::string(),
|
||||
const bool message_use_markup = false,
|
||||
|
@ -82,8 +79,7 @@ void show_transient_message(CVideo& video,
|
|||
* @param image An image to show in the dialog.
|
||||
* @param message_use_markup Use markup for the message?
|
||||
*/
|
||||
void show_transient_error_message(CVideo& video,
|
||||
const std::string& message,
|
||||
void show_transient_error_message(const std::string& message,
|
||||
const std::string& image = std::string(),
|
||||
const bool message_use_markup = false);
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ unit_attack::unit_attack(const unit_map::iterator& attacker_itor,
|
|||
void unit_attack::damage_calc_callback(window& window)
|
||||
{
|
||||
const size_t index = find_widget<listbox>(&window, "weapon_list", false).get_selected_row();
|
||||
attack_predictions::display(weapons_[index], *attacker_itor_, *defender_itor_, window.video());
|
||||
attack_predictions::display(weapons_[index], *attacker_itor_, *defender_itor_);
|
||||
}
|
||||
|
||||
void unit_attack::pre_show(window& window)
|
||||
|
|
|
@ -209,7 +209,7 @@ void show_unit_list(display& gui)
|
|||
unit_list.push_back(i.get_shared_ptr());
|
||||
}
|
||||
|
||||
if(unit_list::execute(unit_list, scroll_to, gui.video())) {
|
||||
if(unit_list::execute(unit_list, scroll_to)) {
|
||||
gui.scroll_to_tile(scroll_to, display::WARP);
|
||||
gui.select_hex(scroll_to);
|
||||
}
|
||||
|
|
|
@ -39,14 +39,14 @@ class unit_list : public modal_dialog
|
|||
public:
|
||||
explicit unit_list(unit_ptr_vector& unit_list, map_location& scroll_to);
|
||||
|
||||
static bool execute(unit_ptr_vector& units, map_location& scroll_to, CVideo& video)
|
||||
static bool execute(unit_ptr_vector& units, map_location& scroll_to)
|
||||
{
|
||||
if(units.empty()) {
|
||||
show_transient_message(video, "", _("No units found."));
|
||||
show_transient_message("", _("No units found."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return unit_list(units, scroll_to).show(video);
|
||||
return unit_list(units, scroll_to).show();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -280,7 +280,7 @@ void unit_recall::dismiss_unit(window& window)
|
|||
}
|
||||
|
||||
if(!message.str().empty()) {
|
||||
const int res = gui2::show_message(window.video(), _("Dismiss Unit"), message.str(), message::yes_no_buttons);
|
||||
const int res = gui2::show_message(_("Dismiss Unit"), message.str(), message::yes_no_buttons);
|
||||
|
||||
if(res != gui2::window::OK) {
|
||||
return;
|
||||
|
|
|
@ -43,18 +43,16 @@ public:
|
|||
static void display(const std::string& summary,
|
||||
const std::string& post_summary,
|
||||
const std::vector<std::string>& files,
|
||||
const std::string& details,
|
||||
CVideo& video)
|
||||
const std::string& details)
|
||||
{
|
||||
wml_error(summary, post_summary, files, details).show(video);
|
||||
wml_error(summary, post_summary, files, details).show();
|
||||
}
|
||||
|
||||
/** The display function; see @ref modal_dialog for more information. */
|
||||
static void display(const std::string& summary,
|
||||
const std::string& details,
|
||||
CVideo& video)
|
||||
const std::string& details)
|
||||
{
|
||||
display(summary, "", std::vector<std::string>(), details, video);
|
||||
display(summary, "", std::vector<std::string>(), details);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -160,8 +160,7 @@ REGISTER_DIALOG(wml_message_right)
|
|||
|
||||
REGISTER_DIALOG(wml_message_double)
|
||||
|
||||
int show_wml_message(CVideo& video,
|
||||
const std::string& title,
|
||||
int show_wml_message(const std::string& title,
|
||||
const std::string& message,
|
||||
const wml_message_portrait* left,
|
||||
const wml_message_portrait* right,
|
||||
|
@ -186,7 +185,7 @@ int show_wml_message(CVideo& video,
|
|||
dlg->set_option_list(options.option_list, &options.chosen_option);
|
||||
}
|
||||
|
||||
dlg->show(video);
|
||||
dlg->show();
|
||||
return dlg->get_retval();
|
||||
}
|
||||
|
||||
|
|
|
@ -245,8 +245,7 @@ struct wml_message_portrait
|
|||
* @param options Options to offer.
|
||||
* @param input Info on text input.
|
||||
*/
|
||||
int show_wml_message(CVideo& video,
|
||||
const std::string& title,
|
||||
int show_wml_message(const std::string& title,
|
||||
const std::string& message,
|
||||
const wml_message_portrait* left,
|
||||
const wml_message_portrait* right,
|
||||
|
|
|
@ -150,7 +150,7 @@ void label::signal_handler_left_button_click(const event::ui_event /* event */,
|
|||
}
|
||||
|
||||
if (!desktop::open_object_is_supported()) {
|
||||
show_message(get_window()->video(), "", _("Opening links is not supported, contact your packager"), dialogs::message::auto_close);
|
||||
show_message("", _("Opening links is not supported, contact your packager"), dialogs::message::auto_close);
|
||||
handled = true;
|
||||
return;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ void label::signal_handler_left_button_click(const event::ui_event /* event */,
|
|||
|
||||
DBG_GUI_E << "Clicked Link:\"" << link << "\"\n";
|
||||
|
||||
const int res = show_message(get_window()->video(), _("Confirm"), _("Do you want to open this link?") + std::string("\n\n") + link, dialogs::message::yes_no_buttons);
|
||||
const int res = show_message(_("Confirm"), _("Do you want to open this link?") + std::string("\n\n") + link, dialogs::message::yes_no_buttons);
|
||||
if(res == gui2::window::OK) {
|
||||
desktop::open_object(link);
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ void label::signal_handler_right_button_click(const event::ui_event /* event */,
|
|||
|
||||
desktop::clipboard::copy_to_clipboard(link, false);
|
||||
|
||||
(void) show_message(get_window()->video(), "", _("Copied link!"), dialogs::message::auto_close);
|
||||
(void) show_message("", _("Copied link!"), dialogs::message::auto_close);
|
||||
|
||||
handled = true;
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ void menu_button::signal_handler_left_button_click(const event::ui_event event,
|
|||
dialogs::drop_down_menu droplist(this->get_rectangle(), this->values_, this->selected_, this->get_use_markup(), this->keep_open_,
|
||||
nullptr);
|
||||
|
||||
if(droplist.show(get_window()->video())) {
|
||||
if(droplist.show()) {
|
||||
const int selected = droplist.selected_item();
|
||||
|
||||
// Safety check. If the user clicks a selection in the dropdown and moves their mouse away too
|
||||
|
|
|
@ -137,7 +137,7 @@ void multimenu_button::signal_handler_left_button_click(const event::ui_event ev
|
|||
std::bind(&multimenu_button::toggle_state_changed, this));
|
||||
|
||||
droplist_ = &droplist;
|
||||
droplist.show(get_window()->video());
|
||||
droplist.show();
|
||||
droplist_ = nullptr;
|
||||
|
||||
if(retval_ != 0) {
|
||||
|
|
|
@ -284,10 +284,10 @@ window* manager::get_window(const unsigned id)
|
|||
|
||||
} // namespace
|
||||
|
||||
window::window(CVideo& video, const builder_window::window_resolution* definition)
|
||||
window::window(const builder_window::window_resolution* definition)
|
||||
: panel(implementation::builder_window(::config {"definition", definition->definition}), get_control_type())
|
||||
, cursor::setter(cursor::NORMAL)
|
||||
, video_(video)
|
||||
, video_(CVideo::get_singleton())
|
||||
, status_(NEW)
|
||||
, show_mode_(none)
|
||||
, retval_(NONE)
|
||||
|
@ -329,7 +329,7 @@ window::window(CVideo& video, const builder_window::window_resolution* definitio
|
|||
|
||||
connect();
|
||||
|
||||
if (!video.faked())
|
||||
if (!video_.faked())
|
||||
{
|
||||
connect_signal<event::DRAW>(std::bind(&window::draw, this));
|
||||
}
|
||||
|
@ -1461,7 +1461,7 @@ void window::signal_handler_message_show_tooltip(const event::ui_event event,
|
|||
event::message_show_tooltip& request
|
||||
= dynamic_cast<event::message_show_tooltip&>(message);
|
||||
|
||||
dialogs::tip::show(video_, tooltip_.id, request.message, request.location, request.source_rect);
|
||||
dialogs::tip::show(tooltip_.id, request.message, request.location, request.source_rect);
|
||||
|
||||
handled = true;
|
||||
}
|
||||
|
@ -1475,7 +1475,7 @@ void window::signal_handler_message_show_helptip(const event::ui_event event,
|
|||
event::message_show_helptip& request
|
||||
= dynamic_cast<event::message_show_helptip&>(message);
|
||||
|
||||
dialogs::tip::show(video_, helptip_.id, request.message, request.location, request.source_rect);
|
||||
dialogs::tip::show(helptip_.id, request.message, request.location, request.source_rect);
|
||||
|
||||
handled = true;
|
||||
}
|
||||
|
|
|
@ -62,13 +62,13 @@ class distributor;
|
|||
class window : public panel, public cursor::setter
|
||||
{
|
||||
friend class debug_layout_graph;
|
||||
friend window* build(CVideo&, const builder_window::window_resolution*);
|
||||
friend window* build(const builder_window::window_resolution*);
|
||||
friend struct window_implementation;
|
||||
friend class invalidate_layout_blocker;
|
||||
friend class pane;
|
||||
|
||||
public:
|
||||
window(CVideo& video, const builder_window::window_resolution* definition);
|
||||
explicit window(const builder_window::window_resolution* definition);
|
||||
|
||||
~window();
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ void show_help(CVideo& video, const section &toplevel_sec,
|
|||
catch (parse_error& e) {
|
||||
std::stringstream msg;
|
||||
msg << _("Parse error when parsing help text: ") << "'" << e.message << "'";
|
||||
gui2::show_transient_message(video, "", msg.str());
|
||||
gui2::show_transient_message("", msg.str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ void help_browser::handle_event(const SDL_Event &event)
|
|||
if (t == nullptr) {
|
||||
std::stringstream msg;
|
||||
msg << _("Reference to unknown topic: ") << "'" << ref << "'.";
|
||||
gui2::show_transient_message(video(), "", msg.str());
|
||||
gui2::show_transient_message("", msg.str());
|
||||
update_cursor();
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -60,9 +60,9 @@ void make_screenshot(const std::string& name, CVideo& video, const TFunc& func)
|
|||
filename = filesystem::get_next_filename(filename, ext);
|
||||
const bool res = func(filename, video);
|
||||
if (res) {
|
||||
gui2::dialogs::screenshot_notification::display(filename, video);
|
||||
gui2::dialogs::screenshot_notification::display(filename);
|
||||
} else {
|
||||
gui2::show_error_message(video,
|
||||
gui2::show_error_message(
|
||||
_("Screenshot creation failed.\n\n"
|
||||
"Make sure there is enough space on the drive holding Wesnoth’s player resource files and that file permissions are set up correctly."));
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ void command_executor::show_menu(const std::vector<config>& items_arg, int xloc,
|
|||
{
|
||||
SDL_Rect pos {xloc, yloc, 1, 1};
|
||||
gui2::dialogs::drop_down_menu mmenu(pos, items, -1, true, false); // TODO: last value should be variable
|
||||
mmenu.show(gui.video());
|
||||
mmenu.show();
|
||||
if(mmenu.get_retval() == gui2::window::OK) {
|
||||
res = mmenu.selected_item();
|
||||
}
|
||||
|
@ -677,7 +677,7 @@ CVideo& command_executor_default::get_video()
|
|||
void command_executor_default::lua_console()
|
||||
{
|
||||
if (get_display().in_game()) {
|
||||
gui2::dialogs::lua_interpreter::display(get_video(), gui2::dialogs::lua_interpreter::GAME);
|
||||
gui2::dialogs::lua_interpreter::display(gui2::dialogs::lua_interpreter::GAME);
|
||||
} else {
|
||||
command_executor::lua_console();
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ void command_executor_default::lua_console()
|
|||
|
||||
void command_executor::lua_console()
|
||||
{
|
||||
gui2::dialogs::lua_interpreter::display(get_video(), gui2::dialogs::lua_interpreter::APP);
|
||||
gui2::dialogs::lua_interpreter::display(gui2::dialogs::lua_interpreter::APP);
|
||||
}
|
||||
|
||||
void command_executor_default::zoom_in()
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue