GUI2: added display and execute wrappers for a bunch more dialogs
Made use of them where applicable. There are a whole bunch of cases where the dialog object only exists to check its return value, but I'll update those separately.
This commit is contained in:
parent
5145b009a5
commit
112ada179c
18 changed files with 33 additions and 31 deletions
|
@ -394,9 +394,7 @@ addons_client::install_result addons_client::do_resolve_addon_dependencies(const
|
|||
options[dep] = addons.at(dep);
|
||||
}
|
||||
|
||||
gui2::dialogs::install_dependencies dlg(options);
|
||||
bool cont = dlg.show();
|
||||
if(!cont) {
|
||||
if(!gui2::dialogs::install_dependencies::execute(options)) {
|
||||
return result; // the user has chosen to continue without installing anything.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,8 +157,7 @@ void formula_debugger::show_gui()
|
|||
return;
|
||||
}
|
||||
if (game_config::debug) {
|
||||
gui2::dialogs::formula_debugger debug_dialog(*this);
|
||||
debug_dialog.show();
|
||||
gui2::dialogs::formula_debugger::display(*this);
|
||||
} else {
|
||||
WRN_FDB << "do not showing debug window due to disabled --new-widgets"<< std::endl;
|
||||
}
|
||||
|
|
|
@ -440,8 +440,7 @@ bool manager::enable_mods_dialog(const std::vector<std::string>& mods, const std
|
|||
items.push_back(depinfo_.find_child("modification", "id", mod)["name"]);
|
||||
}
|
||||
|
||||
gui2::dialogs::depcheck_confirm_change dialog(true, items, requester);
|
||||
return dialog.show();
|
||||
return gui2::dialogs::depcheck_confirm_change::execute(true, items, requester);
|
||||
}
|
||||
|
||||
bool manager::disable_mods_dialog(const std::vector<std::string>& mods, const std::string& requester)
|
||||
|
@ -451,8 +450,7 @@ bool manager::disable_mods_dialog(const std::vector<std::string>& mods, const st
|
|||
items.push_back(depinfo_.find_child("modification", "id", mod)["name"]);
|
||||
}
|
||||
|
||||
gui2::dialogs::depcheck_confirm_change dialog(false, items, requester);
|
||||
return dialog.show();
|
||||
return gui2::dialogs::depcheck_confirm_change::execute(false, items, requester);
|
||||
}
|
||||
|
||||
std::string manager::change_era_dialog(const std::vector<std::string>& eras)
|
||||
|
|
|
@ -654,8 +654,7 @@ bool goto_mp_connect(ng::connect_engine& engine, const config& game_config, wesn
|
|||
{
|
||||
lobby_info li(game_config, {});
|
||||
|
||||
gui2::dialogs::mp_staging dlg(engine, li, connection);
|
||||
return dlg.show();
|
||||
return gui2::dialogs::mp_staging::execute(engine, li, connection);
|
||||
}
|
||||
|
||||
bool goto_mp_wait(saved_game& state, const config& game_config, wesnothd_connection* connection, bool observe)
|
||||
|
|
|
@ -30,6 +30,8 @@ public:
|
|||
: addons_(addons)
|
||||
{}
|
||||
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(install_dependencies)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const override;
|
||||
|
|
|
@ -32,6 +32,8 @@ public:
|
|||
class controller;
|
||||
chat_log(const vconfig& cfg, const replay& replay);
|
||||
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(chat_log)
|
||||
|
||||
/** Inherited from modal_dialog. */
|
||||
virtual void pre_show(window& window) override;
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ public:
|
|||
const std::vector<std::string>& mods,
|
||||
const std::string& requester);
|
||||
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(depcheck_confirm_change)
|
||||
|
||||
protected:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const override;
|
||||
|
|
|
@ -33,6 +33,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(formula_debugger)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog. */
|
||||
virtual void pre_show(window& window) override;
|
||||
|
|
|
@ -26,11 +26,7 @@ class game_save : public modal_dialog
|
|||
public:
|
||||
game_save(std::string& filename, const std::string& title);
|
||||
|
||||
static bool
|
||||
execute(std::string& filename, const std::string& title)
|
||||
{
|
||||
return game_save(filename, title).show();
|
||||
}
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(game_save)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
|
|
|
@ -33,6 +33,8 @@ public:
|
|||
class controller;
|
||||
gamestate_inspector(const config& vars, const game_events::manager& events, const display_context& dc, const std::string& title = "");
|
||||
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(gamestate_inspector);
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog. */
|
||||
virtual void pre_show(window& window) override;
|
||||
|
|
|
@ -34,6 +34,8 @@ class mp_change_control : public modal_dialog
|
|||
public:
|
||||
explicit mp_change_control(events::menu_handler& mh);
|
||||
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(mp_change_control)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const override;
|
||||
|
|
|
@ -41,6 +41,8 @@ public:
|
|||
|
||||
~mp_staging();
|
||||
|
||||
DEFINE_SIMPLE_EXECUTE_WRAPPER(mp_staging)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const override;
|
||||
|
|
|
@ -28,6 +28,9 @@ class synched_choice_wait : public modal_dialog, public events::observer
|
|||
public:
|
||||
explicit synched_choice_wait(user_choice_manager& mgr);
|
||||
~synched_choice_wait();
|
||||
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(synched_choice_wait)
|
||||
|
||||
private:
|
||||
user_choice_manager& mgr_;
|
||||
label* message_;
|
||||
|
|
|
@ -62,10 +62,8 @@ void show_transient_message(const std::string& title,
|
|||
const bool message_use_markup,
|
||||
const bool title_use_markup)
|
||||
{
|
||||
dialogs::transient_message dlg(
|
||||
title, title_use_markup, message, message_use_markup, image);
|
||||
|
||||
dlg.show();
|
||||
dialogs::transient_message::display(
|
||||
title, title_use_markup, message, message_use_markup, image);
|
||||
}
|
||||
|
||||
void show_transient_error_message(const std::string& message,
|
||||
|
|
|
@ -31,6 +31,8 @@ public:
|
|||
const bool message_use_markup,
|
||||
const std::string& image);
|
||||
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(transient_message)
|
||||
|
||||
private:
|
||||
bool hide_title_;
|
||||
bool hide_image_;
|
||||
|
|
|
@ -200,8 +200,7 @@ void menu_handler::show_chat_log()
|
|||
{
|
||||
config c;
|
||||
c["name"] = "prototype of chat log";
|
||||
gui2::dialogs::chat_log chat_log_dialog(vconfig(c), *resources::recorder);
|
||||
chat_log_dialog.show();
|
||||
gui2::dialogs::chat_log::display(vconfig(c), *resources::recorder);
|
||||
// std::string text = resources::recorder->build_chat_log();
|
||||
// gui::show_dialog(*gui_,nullptr,_("Chat Log"),"",gui::CLOSE_ONLY,nullptr,nullptr,"",&text);
|
||||
}
|
||||
|
@ -1806,15 +1805,13 @@ void console_handler::do_show_var()
|
|||
void console_handler::do_inspect()
|
||||
{
|
||||
vconfig cfg = vconfig::empty_vconfig();
|
||||
gui2::dialogs::gamestate_inspector inspect_dialog(
|
||||
resources::gamedata->get_variables(), *resources::game_events, *resources::gameboard);
|
||||
inspect_dialog.show();
|
||||
gui2::dialogs::gamestate_inspector::display(
|
||||
resources::gamedata->get_variables(), *resources::game_events, *resources::gameboard);
|
||||
}
|
||||
|
||||
void console_handler::do_control_dialog()
|
||||
{
|
||||
gui2::dialogs::mp_change_control mp_change_control(menu_handler_);
|
||||
mp_change_control.show();
|
||||
gui2::dialogs::mp_change_control::display(menu_handler_);
|
||||
}
|
||||
|
||||
void console_handler::do_unit()
|
||||
|
|
|
@ -938,8 +938,7 @@ int show_lua_console(lua_State* /*L*/, lua_kernel_base* lk)
|
|||
|
||||
int show_gamestate_inspector(const vconfig& cfg, const game_data& data, const game_state& state)
|
||||
{
|
||||
gui2::dialogs::gamestate_inspector inspect_dialog(data.get_variables(), *state.events_manager_, state.board_, cfg["name"]);
|
||||
inspect_dialog.show();
|
||||
gui2::dialogs::gamestate_inspector::display(data.get_variables(), *state.events_manager_, state.board_, cfg["name"]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -392,8 +392,7 @@ static void wait_ingame(user_choice_manager& man)
|
|||
|
||||
static void wait_prestart(user_choice_manager& man)
|
||||
{
|
||||
gui2::dialogs::synched_choice_wait scw(man);
|
||||
scw.show();
|
||||
gui2::dialogs::synched_choice_wait::display(man);
|
||||
}
|
||||
|
||||
std::map<int, config> user_choice_manager::get_user_choice_internal(const std::string &name, const mp_sync::user_choice &uch, const std::set<int>& sides)
|
||||
|
|
Loading…
Add table
Reference in a new issue