Rename all GUI2 dialogs to drop t- prefix
This also places them in a new dialogs namespace.
This commit is contained in:
parent
3c0470ad93
commit
10b6a34615
214 changed files with 2438 additions and 1918 deletions
|
@ -78,7 +78,7 @@ namespace
|
|||
}
|
||||
|
||||
if (previews.size() > 1 || always_display) {
|
||||
gui2::tunit_advance dlg(previews, num_real_advances);
|
||||
gui2::dialogs::unit_advance dlg(previews, num_real_advances);
|
||||
|
||||
dlg.show(CVideo::get_singleton());
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ static lg::log_domain log_addons_client("addons-client");
|
|||
#define LOG_ADDONS LOG_STREAM(info, log_addons_client)
|
||||
#define DBG_ADDONS LOG_STREAM(debug, log_addons_client)
|
||||
|
||||
using gui2::dialogs::network_transmission;
|
||||
|
||||
addons_client::addons_client(CVideo& v, const std::string& address)
|
||||
: v_(v)
|
||||
, addr_(address)
|
||||
|
@ -294,7 +296,7 @@ void addons_client::send_simple_request(const std::string& request_string, confi
|
|||
request.add_child(request_string);
|
||||
this->send_request(request, response);
|
||||
}
|
||||
struct read_addon_connection_data : public gui2::tnetwork_transmission::connection_data
|
||||
struct read_addon_connection_data : public network_transmission::connection_data
|
||||
{
|
||||
read_addon_connection_data(network_asio::connection& conn) : conn_(conn) {}
|
||||
size_t total() override { return conn_.bytes_to_read(); }
|
||||
|
@ -304,7 +306,7 @@ struct read_addon_connection_data : public gui2::tnetwork_transmission::connecti
|
|||
virtual void poll() override { conn_.poll(); }
|
||||
network_asio::connection& conn_;
|
||||
};
|
||||
struct write_addon_connection_data : public gui2::tnetwork_transmission::connection_data
|
||||
struct write_addon_connection_data : public network_transmission::connection_data
|
||||
{
|
||||
write_addon_connection_data(network_asio::connection& conn) : conn_(conn) {}
|
||||
size_t total() override { return conn_.bytes_to_write(); }
|
||||
|
@ -317,13 +319,13 @@ struct write_addon_connection_data : public gui2::tnetwork_transmission::connect
|
|||
void addons_client::wait_for_transfer_done(const std::string& status_message, bool track_upload)
|
||||
{
|
||||
check_connected();
|
||||
std::unique_ptr<gui2::tnetwork_transmission::connection_data> cd;
|
||||
std::unique_ptr<network_transmission::connection_data> cd;
|
||||
if(track_upload)
|
||||
cd.reset(new write_addon_connection_data{ *conn_ });
|
||||
else
|
||||
cd.reset(new read_addon_connection_data{ *conn_ });
|
||||
if(!stat_) {
|
||||
stat_ = new gui2::tnetwork_transmission(*cd, _("Add-ons Manager"), status_message);
|
||||
stat_ = new network_transmission(*cd, _("Add-ons Manager"), status_message);
|
||||
} else {
|
||||
stat_->set_subtitle(status_message);
|
||||
stat_->set_connection_data(*cd);
|
||||
|
|
|
@ -139,7 +139,7 @@ private:
|
|||
std::string host_;
|
||||
std::string port_;
|
||||
network_asio::connection* conn_;
|
||||
gui2::tnetwork_transmission* stat_;
|
||||
gui2::dialogs::network_transmission* stat_;
|
||||
std::string last_error_;
|
||||
|
||||
/** Makes sure the add-ons server connection is working. */
|
||||
|
|
|
@ -190,7 +190,7 @@ addon_op_result do_resolve_addon_dependencies(CVideo& v, addons_client& client,
|
|||
broken_deps_report += "\n " + font::unicode_bullet + " " + make_addon_title(broken_dep_id);
|
||||
}
|
||||
|
||||
if(gui2::show_message(v, _("Broken Dependencies"), broken_deps_report, gui2::tmessage::yes_no_buttons) != gui2::window::OK) {
|
||||
if(gui2::show_message(v, _("Broken Dependencies"), broken_deps_report, gui2::dialogs::message::yes_no_buttons) != gui2::window::OK) {
|
||||
result.outcome = ABORT;
|
||||
return result; // canceled by user
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ addon_op_result do_resolve_addon_dependencies(CVideo& v, addons_client& client,
|
|||
"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::tmessage::yes_no_buttons) == gui2::window::OK ? SUCCESS : ABORT; // If the user cancels, return ABORT. Otherwise, return SUCCESS, since the user chose to ignore the failure.
|
||||
result.outcome = gui2::show_message(v, _("Dependencies Installation Failed"), failed_deps_report, gui2::dialogs::message::yes_no_buttons) == gui2::window::OK ? SUCCESS : ABORT; // If the user cancels, return ABORT. Otherwise, return SUCCESS, since the user chose to ignore the failure.
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ bool do_check_before_overwriting_addon(CVideo& video, const addon_info& addon)
|
|||
text += utils::bullet_list(extra_items) + "\n\n";
|
||||
text += _("Do you really wish to continue?");
|
||||
|
||||
return gui2::show_message(video, _("Confirm"), text, gui2::tmessage::yes_no_buttons) == gui2::window::OK;
|
||||
return gui2::show_message(video, _("Confirm"), text, gui2::dialogs::message::yes_no_buttons) == gui2::window::OK;
|
||||
}
|
||||
|
||||
/** Do a 'smart' fetch of an add-on, checking to avoid overwrites for devs and resolving dependencies, using gui interaction to handle issues that arise
|
||||
|
@ -360,7 +360,7 @@ void do_remote_addon_delete(CVideo& video, addons_client& client, const std::str
|
|||
const std::string& text = vgettext("Deleting '$addon|' will permanently erase its download and upload counts on the add-ons server. Do you really wish to continue?", symbols);
|
||||
|
||||
const int res = gui2::show_message(
|
||||
video, _("Confirm"), text, gui2::tmessage::yes_no_buttons);
|
||||
video, _("Confirm"), text, gui2::dialogs::message::yes_no_buttons);
|
||||
|
||||
if(res != gui2::window::OK) {
|
||||
return;
|
||||
|
@ -390,7 +390,7 @@ void do_remote_addon_publish(CVideo& video, addons_client& client, const std::st
|
|||
if(version_to_publish <= remote_version) {
|
||||
const int res = gui2::show_message(video, _("Warning"),
|
||||
_("The remote version of this add-on is greater or equal to the version being uploaded. Do you really wish to continue?"),
|
||||
gui2::tmessage::yes_no_buttons);
|
||||
gui2::dialogs::message::yes_no_buttons);
|
||||
|
||||
if(res != gui2::window::OK) {
|
||||
return;
|
||||
|
@ -403,7 +403,7 @@ void do_remote_addon_publish(CVideo& video, addons_client& client, const std::st
|
|||
gui2::show_error_message(video,
|
||||
_("The server responded with an error:") + "\n" +
|
||||
client.get_last_server_error());
|
||||
} else if(gui2::show_message(video, _("Terms"), server_msg, gui2::tmessage::ok_cancel_buttons) == gui2::window::OK) {
|
||||
} else if(gui2::show_message(video, _("Terms"), server_msg, gui2::dialogs::message::ok_cancel_buttons) == gui2::window::OK) {
|
||||
if(!client.upload_addon(addon_id, server_msg, cfg)) {
|
||||
gui2::show_error_message(video,
|
||||
_("The server responded with an error:") + "\n" +
|
||||
|
@ -439,7 +439,7 @@ public:
|
|||
if(choice < display_ids_.size()) {
|
||||
const std::string& id = display_ids_[choice];
|
||||
assert(tracking_.find(id) != tracking_.end());
|
||||
gui2::taddon_description::display(id, addons_, tracking_, v_);
|
||||
gui2::dialogs::addon_description::display(id, addons_, tracking_, v_);
|
||||
}
|
||||
|
||||
return gui::CONTINUE_DIALOG;
|
||||
|
@ -485,7 +485,7 @@ public:
|
|||
|
||||
virtual gui::dialog_button_action::RESULT button_pressed(int)
|
||||
{
|
||||
gui2::taddon_filter_options dlg;
|
||||
gui2::dialogs::addon_filter_options dlg;
|
||||
|
||||
dlg.set_displayed_status(f_.status);
|
||||
dlg.set_displayed_types(f_.types);
|
||||
|
@ -984,7 +984,7 @@ void show_addons_manager_dialog(CVideo& v, addons_client& client, addons_list& a
|
|||
"The following add-ons could not be downloaded or installed successfully:",
|
||||
failed_titles.size());
|
||||
|
||||
gui2::show_message(v, msg_title, msg_text + std::string("\n\n") + utils::bullet_list(failed_titles), gui2::tmessage::ok_button);
|
||||
gui2::show_message(v, msg_title, msg_text + std::string("\n\n") + utils::bullet_list(failed_titles), gui2::dialogs::message::ok_button);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1027,7 +1027,7 @@ bool addons_manager_ui(CVideo& v, const std::string& remote_address)
|
|||
"add-ons list from the server."));
|
||||
return need_wml_cache_refresh;
|
||||
}
|
||||
gui2::taddon_list dlg(cfg);
|
||||
gui2::dialogs::addon_manager dlg(cfg);
|
||||
dlg.show(v);
|
||||
return need_wml_cache_refresh;
|
||||
}
|
||||
|
@ -1122,7 +1122,7 @@ bool uninstall_local_addons(CVideo& v)
|
|||
std::set<std::string> remove_names;
|
||||
|
||||
do {
|
||||
gui2::taddon_uninstall_list dlg(addon_titles_map);
|
||||
gui2::dialogs::addon_uninstall_list dlg(addon_titles_map);
|
||||
dlg.show(v);
|
||||
|
||||
remove_ids = dlg.selected_addons();
|
||||
|
@ -1144,7 +1144,7 @@ bool uninstall_local_addons(CVideo& v)
|
|||
res = gui2::show_message(v
|
||||
, _("Confirm")
|
||||
, confirm_message
|
||||
, gui2::tmessage::yes_no_buttons);
|
||||
, gui2::dialogs::message::yes_no_buttons);
|
||||
} while (res != gui2::window::OK);
|
||||
|
||||
std::set<std::string> failed_names, skipped_names, succeeded_names;
|
||||
|
@ -1207,7 +1207,7 @@ bool manage_addons(CVideo& v)
|
|||
std::string host_name = preferences::campaign_server();
|
||||
const bool have_addons = !installed_addons().empty();
|
||||
|
||||
gui2::taddon_connect addon_dlg(host_name, have_addons);
|
||||
gui2::dialogs::addon_connect addon_dlg(host_name, have_addons);
|
||||
addon_dlg.show(v);
|
||||
int res = addon_dlg.get_retval();
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ void chat_command_handler::do_remove()
|
|||
void chat_command_handler::do_display()
|
||||
{
|
||||
// TODO: add video and game config argument to chat_command_handler?
|
||||
gui2::tpreferences::display(CVideo::get_singleton(), game_config_manager::get()->game_config(),
|
||||
gui2::dialogs::preferences_dialog::display(CVideo::get_singleton(), game_config_manager::get()->game_config(),
|
||||
preferences::VIEW_FRIENDS);
|
||||
}
|
||||
|
||||
|
|
|
@ -3252,7 +3252,7 @@ void display::handle_window_event(const SDL_Event& event) {
|
|||
}
|
||||
|
||||
void display::handle_event(const SDL_Event& event) {
|
||||
if (gui2::tloadscreen::displaying()) {
|
||||
if (gui2::dialogs::loading_screen::displaying()) {
|
||||
return;
|
||||
}
|
||||
if (event.type == DRAW_ALL_EVENT) {
|
||||
|
|
|
@ -80,7 +80,7 @@ editor_action* mouse_action_map_label::up_left(editor_display& disp, int x, int
|
|||
bool immutable = old_label ? old_label->immutable() : true;
|
||||
SDL_Color color = old_label ? old_label->color() : font::NORMAL_COLOR;
|
||||
|
||||
gui2::teditor_edit_label d(label, immutable, visible_fog, visible_shroud, color, category);
|
||||
gui2::dialogs::editor_edit_label d(label, immutable, visible_fog, visible_shroud, color, category);
|
||||
|
||||
editor_action* a = nullptr;
|
||||
if(d.show(disp.video())) {
|
||||
|
|
|
@ -228,7 +228,7 @@ void editor_controller::custom_tods_dialog()
|
|||
|
||||
std::vector<time_of_day> schedule = context_manager_->get_map_context().get_time_manager()->times();
|
||||
|
||||
if(!gui2::tcustom_tod::execute(gui(), schedule)) {
|
||||
if(!gui2::dialogs::custom_tod::execute(gui(), schedule)) {
|
||||
adjust_resetter.reset();
|
||||
} else {
|
||||
// TODO save the new tod here
|
||||
|
@ -1096,7 +1096,7 @@ void editor_controller::show_menu(const std::vector<std::string>& items_arg, int
|
|||
void editor_controller::preferences()
|
||||
{
|
||||
gui_->video().clear_all_help_strings();
|
||||
gui2::tpreferences::display(gui_->video(), game_config_);
|
||||
gui2::dialogs::preferences_dialog::display(gui_->video(), game_config_);
|
||||
|
||||
gui_->redraw_everything();
|
||||
}
|
||||
|
@ -1139,7 +1139,7 @@ void editor_controller::change_unit_id()
|
|||
|
||||
if(un != units.end()) {
|
||||
std::string id = un->id();
|
||||
if (gui2::tedit_text::execute(title, label, id, gui_->video())) {
|
||||
if (gui2::dialogs::edit_text::execute(title, label, id, gui_->video())) {
|
||||
un->set_id(id);
|
||||
}
|
||||
}
|
||||
|
@ -1156,7 +1156,7 @@ void editor_controller::rename_unit()
|
|||
|
||||
if(un != units.end()) {
|
||||
std::string name = un->name();
|
||||
if(gui2::tedit_text::execute(title, label, name, gui_->video())) {
|
||||
if(gui2::dialogs::edit_text::execute(title, label, name, gui_->video())) {
|
||||
//TODO we may not want a translated name here.
|
||||
un->set_name(name);
|
||||
}
|
||||
|
@ -1165,7 +1165,7 @@ void editor_controller::rename_unit()
|
|||
|
||||
void editor_controller::unit_list()
|
||||
{
|
||||
gui2::show_unit_list(*gui_);
|
||||
gui2::dialogs::show_unit_list(*gui_);
|
||||
}
|
||||
|
||||
void editor_controller::cut_selection()
|
||||
|
|
|
@ -193,7 +193,7 @@ void context_manager::load_map_dialog(bool force_same_context /* = false */)
|
|||
fn = default_dir_;
|
||||
}
|
||||
|
||||
gui2::tfile_dialog dlg;
|
||||
gui2::dialogs::file_dialog dlg;
|
||||
|
||||
dlg.set_title(_("Load Map"))
|
||||
.set_path(fn);
|
||||
|
@ -226,7 +226,7 @@ void context_manager::edit_side_dialog(int side_index)
|
|||
// The side number perhaps should have been set in map_context::new_side() but the design of team::team_info appears to be read-only.
|
||||
team_info.side = side_index + 1; // note team_info::side is supposed to be 1 to n, while side/team indexes are 0 to n-1
|
||||
|
||||
if(gui2::teditor_edit_side::execute(team_info, gui_.video())) {
|
||||
if(gui2::dialogs::editor_edit_side::execute(team_info, gui_.video())) {
|
||||
get_map_context().set_side_setup(team_info);
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ void context_manager::edit_scenario_dialog()
|
|||
bool victory = get_map_context().victory_defeated();
|
||||
bool random = get_map_context().random_start_time();
|
||||
|
||||
bool ok = gui2::teditor_edit_scenario::execute(id, name, description,
|
||||
bool ok = gui2::dialogs::editor_edit_scenario::execute(id, name, description,
|
||||
turns, xp_mod,
|
||||
victory, random,
|
||||
gui_.video());
|
||||
|
@ -262,7 +262,7 @@ void context_manager::new_map_dialog()
|
|||
{
|
||||
int w = get_map().w();
|
||||
int h = get_map().h();
|
||||
if(gui2::teditor_new_map::execute(w, h, gui_.video())) {
|
||||
if(gui2::dialogs::editor_new_map::execute(w, h, gui_.video())) {
|
||||
const t_translation::terrain_code& fill = get_selected_bg_terrain();
|
||||
new_map(w, h, fill, true);
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ void context_manager::new_scenario_dialog()
|
|||
{
|
||||
int w = get_map().w();
|
||||
int h = get_map().h();
|
||||
if(gui2::teditor_new_map::execute(w, h, gui_.video())) {
|
||||
if(gui2::dialogs::editor_new_map::execute(w, h, gui_.video())) {
|
||||
const t_translation::terrain_code& fill = get_selected_bg_terrain();
|
||||
new_scenario(w, h, fill, true);
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ void context_manager::apply_mask_dialog()
|
|||
fn = default_dir_;
|
||||
}
|
||||
|
||||
gui2::tfile_dialog dlg;
|
||||
gui2::dialogs::file_dialog dlg;
|
||||
|
||||
dlg.set_title(_("Apply Mask"))
|
||||
.set_path(fn);
|
||||
|
@ -482,7 +482,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::tedit_text::execute(N_("Rename Area"), N_("Identifier:"), name, gui_.video())) {
|
||||
if (gui2::dialogs::edit_text::execute(N_("Rename Area"), N_("Identifier:"), name, gui_.video())) {
|
||||
get_map_context().get_time_manager()->set_area_id(active_area, name);
|
||||
}
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ void context_manager::create_mask_to_dialog()
|
|||
fn = default_dir_;
|
||||
}
|
||||
|
||||
gui2::tfile_dialog dlg;
|
||||
gui2::dialogs::file_dialog dlg;
|
||||
|
||||
dlg.set_title(_("Choose Target Map"))
|
||||
.set_path(fn);
|
||||
|
@ -555,9 +555,9 @@ void context_manager::resize_map_dialog()
|
|||
{
|
||||
int w = get_map().w();
|
||||
int h = get_map().h();
|
||||
gui2::teditor_resize_map::EXPAND_DIRECTION dir;
|
||||
gui2::dialogs::editor_resize_map::EXPAND_DIRECTION dir;
|
||||
bool copy = false;
|
||||
if(gui2::teditor_resize_map::execute(w, h, dir, copy, gui_.video())) {
|
||||
if(gui2::dialogs::editor_resize_map::execute(w, h, dir, copy, gui_.video())) {
|
||||
|
||||
if (w != get_map().w() || h != get_map().h()) {
|
||||
t_translation::terrain_code fill = get_selected_bg_terrain();
|
||||
|
@ -567,19 +567,19 @@ void context_manager::resize_map_dialog()
|
|||
int x_offset = get_map().w() - w;
|
||||
int y_offset = get_map().h() - h;
|
||||
switch (dir) {
|
||||
case gui2::teditor_resize_map::EXPAND_BOTTOM_RIGHT:
|
||||
case gui2::teditor_resize_map::EXPAND_BOTTOM:
|
||||
case gui2::teditor_resize_map::EXPAND_BOTTOM_LEFT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_BOTTOM_RIGHT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_BOTTOM:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_BOTTOM_LEFT:
|
||||
y_offset = 0;
|
||||
break;
|
||||
case gui2::teditor_resize_map::EXPAND_RIGHT:
|
||||
case gui2::teditor_resize_map::EXPAND_CENTER:
|
||||
case gui2::teditor_resize_map::EXPAND_LEFT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_RIGHT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_CENTER:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_LEFT:
|
||||
y_offset /= 2;
|
||||
break;
|
||||
case gui2::teditor_resize_map::EXPAND_TOP_RIGHT:
|
||||
case gui2::teditor_resize_map::EXPAND_TOP:
|
||||
case gui2::teditor_resize_map::EXPAND_TOP_LEFT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_TOP_RIGHT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_TOP:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_TOP_LEFT:
|
||||
break;
|
||||
default:
|
||||
y_offset = 0;
|
||||
|
@ -587,19 +587,19 @@ void context_manager::resize_map_dialog()
|
|||
break;
|
||||
}
|
||||
switch (dir) {
|
||||
case gui2::teditor_resize_map::EXPAND_BOTTOM_RIGHT:
|
||||
case gui2::teditor_resize_map::EXPAND_RIGHT:
|
||||
case gui2::teditor_resize_map::EXPAND_TOP_RIGHT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_BOTTOM_RIGHT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_RIGHT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_TOP_RIGHT:
|
||||
x_offset = 0;
|
||||
break;
|
||||
case gui2::teditor_resize_map::EXPAND_BOTTOM:
|
||||
case gui2::teditor_resize_map::EXPAND_CENTER:
|
||||
case gui2::teditor_resize_map::EXPAND_TOP:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_BOTTOM:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_CENTER:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_TOP:
|
||||
x_offset /= 2;
|
||||
break;
|
||||
case gui2::teditor_resize_map::EXPAND_BOTTOM_LEFT:
|
||||
case gui2::teditor_resize_map::EXPAND_LEFT:
|
||||
case gui2::teditor_resize_map::EXPAND_TOP_LEFT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_BOTTOM_LEFT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_LEFT:
|
||||
case gui2::dialogs::editor_resize_map::EXPAND_TOP_LEFT:
|
||||
break;
|
||||
default:
|
||||
x_offset = 0;
|
||||
|
@ -618,7 +618,7 @@ void context_manager::save_map_as_dialog()
|
|||
input_name = filesystem::get_dir(default_dir_ + "/maps");
|
||||
}
|
||||
|
||||
gui2::tfile_dialog dlg;
|
||||
gui2::dialogs::file_dialog dlg;
|
||||
|
||||
dlg.set_title(_("Save Map As"))
|
||||
.set_save_mode(true)
|
||||
|
@ -639,7 +639,7 @@ void context_manager::save_scenario_as_dialog()
|
|||
input_name = filesystem::get_dir(default_dir_ + "/scenarios");
|
||||
}
|
||||
|
||||
gui2::tfile_dialog dlg;
|
||||
gui2::dialogs::file_dialog dlg;
|
||||
|
||||
dlg.set_title(_("Save Scenario As"))
|
||||
.set_save_mode(true)
|
||||
|
@ -678,7 +678,7 @@ void context_manager::generate_map_dialog()
|
|||
_("No random map generators found."));
|
||||
return;
|
||||
}
|
||||
gui2::teditor_generate_map dialog;
|
||||
gui2::dialogs::editor_generate_map dialog;
|
||||
dialog.set_map_generators(map_generators_);
|
||||
dialog.select_map_generator(last_map_generator_);
|
||||
dialog.show(gui_.video());
|
||||
|
@ -707,7 +707,7 @@ bool context_manager::confirm_discard()
|
|||
{
|
||||
if (get_map_context().modified()) {
|
||||
const int res = gui2::show_message(gui_.video(), _("Unsaved Changes"),
|
||||
_("Do you want to discard all changes made to the map since the last save?"), gui2::tmessage::yes_no_buttons);
|
||||
_("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;
|
||||
} else {
|
||||
return true;
|
||||
|
|
|
@ -253,7 +253,7 @@ void location_palette::adjust_size(const SDL_Rect& target)
|
|||
}));
|
||||
button_add_.reset(new location_palette_button(video(), SDL_Rect{ target.x , bottom -= button_height, target.w - 10, button_height }, _("Add"), [this]() {
|
||||
std::string newid;
|
||||
if (gui2::tedit_text::execute(_("New Location Identifer"), "", newid, video())) {
|
||||
if (gui2::dialogs::edit_text::execute(_("New Location Identifer"), "", newid, video())) {
|
||||
add_item(newid);
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -158,7 +158,7 @@ void formula_debugger::show_gui()
|
|||
return;
|
||||
}
|
||||
if (game_config::debug) {
|
||||
gui2::tformula_debugger debug_dialog(*this);
|
||||
gui2::dialogs::formula_debugger debug_dialog(*this);
|
||||
debug_dialog.show(resources::screen->video());
|
||||
} else {
|
||||
WRN_FDB << "do not showing debug window due to disabled --new-widgets"<< std::endl;
|
||||
|
|
|
@ -132,7 +132,7 @@ void game_config_manager::load_game_config_with_loadscreen(FORCE_RELOAD_CONFIG f
|
|||
}
|
||||
}
|
||||
|
||||
gui2::tloadscreen::display(video_, [this, force_reload, classification]() {
|
||||
gui2::dialogs::loading_screen::display(video_, [this, force_reload, classification]() {
|
||||
load_game_config(force_reload, classification);
|
||||
});
|
||||
}
|
||||
|
@ -154,9 +154,9 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
// Load the selected core.
|
||||
// Handle terrains so that they are last loaded from the core.
|
||||
// Load every compatible addon.
|
||||
gui2::tloadscreen::progress("verify cache");
|
||||
gui2::dialogs::loading_screen::progress("verify cache");
|
||||
filesystem::data_tree_checksum();
|
||||
gui2::tloadscreen::progress("create cache");
|
||||
gui2::dialogs::loading_screen::progress("create cache");
|
||||
|
||||
// Start transaction so macros are shared.
|
||||
game_config::config_cache_transaction main_transaction;
|
||||
|
@ -190,7 +190,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
|
||||
const std::string& id = core["id"];
|
||||
if (id.empty()) {
|
||||
gui2::twml_error::display(
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error validating data core."),
|
||||
_("Found a core without id attribute.")
|
||||
+ '\n' + _("Skipping the core."),
|
||||
|
@ -198,7 +198,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
continue;
|
||||
}
|
||||
if (*&valid_cores.find_child("core", "id", id)) {
|
||||
gui2::twml_error::display(
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error validating data core."),
|
||||
_("Core ID: ") + id
|
||||
+ '\n' + _("The ID is already in use.")
|
||||
|
@ -209,7 +209,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
|
||||
const std::string& path = core["path"];
|
||||
if (!filesystem::file_exists(filesystem::get_wml_location(path))) {
|
||||
gui2::twml_error::display(
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error validating data core."),
|
||||
_("Core ID: ") + id
|
||||
+ '\n' + _("Core Path: ") + path
|
||||
|
@ -231,7 +231,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
}
|
||||
|
||||
if (!current_core_valid) {
|
||||
gui2::twml_error::display(
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error loading core data."),
|
||||
_("Core ID: ") + preferences::core_id()
|
||||
+ '\n' + _("Error loading the core with named id.")
|
||||
|
@ -242,7 +242,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
|
||||
// check if we have a valid default core which should always be the case.
|
||||
if (wml_tree_root.empty()) {
|
||||
gui2::twml_error::display(
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error loading core data."),
|
||||
_("Can't locate the default core.")
|
||||
+ '\n' + _("The game will now exit."),
|
||||
|
@ -303,19 +303,19 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
// Try reloading without add-ons
|
||||
if (!game_config::no_addons) {
|
||||
game_config::no_addons = true;
|
||||
gui2::twml_error::display(
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error loading custom game configuration files. The game will try without loading add-ons."),
|
||||
e.message, video_);
|
||||
load_game_config(force_reload, classification);
|
||||
} else if (preferences::core_id() != "default") {
|
||||
gui2::twml_error::display(
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error loading custom game configuration files. The game will fallback to the default core files."),
|
||||
e.message, video_);
|
||||
preferences::set_core_id("default");
|
||||
game_config::no_addons = false;
|
||||
load_game_config(force_reload, classification);
|
||||
} else {
|
||||
gui2::twml_error::display(
|
||||
gui2::dialogs::wml_error::display(
|
||||
_("Error loading default core game configuration files. The game will now exit."),
|
||||
e.message, video_);
|
||||
throw;
|
||||
|
@ -452,7 +452,7 @@ void game_config_manager::load_addons_cfg()
|
|||
|
||||
const std::string& report = utils::join(error_log, "\n\n");
|
||||
|
||||
gui2::twml_error::display(msg1, msg2, error_addons, report,
|
||||
gui2::dialogs::wml_error::display(msg1, msg2, error_addons, report,
|
||||
video_);
|
||||
}
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ void game_config_manager::set_color_info()
|
|||
void game_config_manager::set_unit_data()
|
||||
{
|
||||
game_config_.merge_children("units");
|
||||
gui2::tloadscreen::progress("load unit types");
|
||||
gui2::dialogs::loading_screen::progress("load unit types");
|
||||
if(config &units = game_config_.child("units")) {
|
||||
unit_types.set_config(units);
|
||||
}
|
||||
|
|
|
@ -625,7 +625,7 @@ std::string create_engine::select_campaign_difficulty(int set_value)
|
|||
// If not, let the user pick one from the prompt
|
||||
// We don't pass the difficulties vector here because additional data is required
|
||||
// to constrict the dialog
|
||||
gui2::tcampaign_difficulty dlg(current_level().data());
|
||||
gui2::dialogs::campaign_difficulty dlg(current_level().data());
|
||||
dlg.show(video_);
|
||||
|
||||
selected_campaign_difficulty_ = dlg.selected_difficulty();
|
||||
|
|
|
@ -437,7 +437,7 @@ bool manager::enable_mods_dialog(const std::vector<std::string>& mods,
|
|||
items.push_back(depinfo_.find_child("modification", "id", mod)["name"]);
|
||||
}
|
||||
|
||||
gui2::tdepcheck_confirm_change dialog(true, items, requester);
|
||||
gui2::dialogs::depcheck_confirm_change dialog(true, items, requester);
|
||||
return dialog.show(video_);
|
||||
}
|
||||
|
||||
|
@ -449,7 +449,7 @@ bool manager::disable_mods_dialog(const std::vector<std::string>& mods,
|
|||
items.push_back(depinfo_.find_child("modification", "id", mod)["name"]);
|
||||
}
|
||||
|
||||
gui2::tdepcheck_confirm_change dialog(false, items, requester);
|
||||
gui2::dialogs::depcheck_confirm_change dialog(false, items, requester);
|
||||
return dialog.show(video_);
|
||||
}
|
||||
|
||||
|
@ -460,7 +460,7 @@ std::string manager::change_era_dialog(const std::vector<std::string>& eras)
|
|||
items.push_back(depinfo_.find_child("era", "id", era)["name"]);
|
||||
}
|
||||
|
||||
gui2::tdepcheck_select_new dialog(ERA, items);
|
||||
gui2::dialogs::depcheck_select_new dialog(ERA, items);
|
||||
|
||||
if (dialog.show(video_)) {
|
||||
return eras[dialog.result()];
|
||||
|
@ -477,7 +477,7 @@ std::string
|
|||
items.push_back(depinfo_.find_child("scenario", "id", scenario)["name"]);
|
||||
}
|
||||
|
||||
gui2::tdepcheck_select_new dialog(SCENARIO, items);
|
||||
gui2::dialogs::depcheck_select_new dialog(SCENARIO, items);
|
||||
if (dialog.show(video_)) {
|
||||
return scenarios[dialog.result()];
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ static std::unique_ptr<wesnothd_connection> open_connection(CVideo& video, const
|
|||
std::string h = original_host;
|
||||
|
||||
if(h.empty()) {
|
||||
gui2::tmp_connect dlg;
|
||||
gui2::dialogs::mp_connect dlg;
|
||||
|
||||
dlg.show(video);
|
||||
if(dlg.get_retval() == gui2::window::OK) {
|
||||
|
@ -147,7 +147,7 @@ static std::unique_ptr<wesnothd_connection> open_connection(CVideo& video, const
|
|||
shown_hosts.insert(hostpair(host, port));
|
||||
|
||||
config data;
|
||||
sock = gui2::tnetwork_transmission::wesnothd_connect_dialog(video, "connect to server", host, port);
|
||||
sock = gui2::dialogs::network_transmission::wesnothd_connect_dialog(video, "connect to server", host, port);
|
||||
do {
|
||||
|
||||
if (!sock) {
|
||||
|
@ -155,7 +155,7 @@ static std::unique_ptr<wesnothd_connection> open_connection(CVideo& video, const
|
|||
}
|
||||
|
||||
data.clear();
|
||||
gui2::tnetwork_transmission::wesnothd_receive_dialog(video, "waiting", data, *sock);
|
||||
gui2::dialogs::network_transmission::wesnothd_receive_dialog(video, "waiting", data, *sock);
|
||||
//mp::check_response(data_res, data);
|
||||
|
||||
if (data.has_child("reject") || data.has_attribute("version")) {
|
||||
|
@ -185,7 +185,7 @@ static std::unique_ptr<wesnothd_connection> open_connection(CVideo& video, const
|
|||
}
|
||||
shown_hosts.insert(hostpair(host, port));
|
||||
sock.release();
|
||||
sock = gui2::tnetwork_transmission::wesnothd_connect_dialog(video, "redirect", host, port);
|
||||
sock = gui2::dialogs::network_transmission::wesnothd_connect_dialog(video, "redirect", host, port);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ static std::unique_ptr<wesnothd_connection> open_connection(CVideo& video, const
|
|||
sp["selective_ping"] = true;
|
||||
}
|
||||
sock->send_data(response);
|
||||
gui2::tnetwork_transmission::wesnothd_receive_dialog(video, "login response", data, *sock);
|
||||
gui2::dialogs::network_transmission::wesnothd_receive_dialog(video, "login response", data, *sock);
|
||||
config *warning = &data.child("warning");
|
||||
|
||||
if(*warning) {
|
||||
|
@ -243,7 +243,7 @@ static std::unique_ptr<wesnothd_connection> open_connection(CVideo& video, const
|
|||
warning_msg += "\n\n";
|
||||
warning_msg += _("Do you want to continue?");
|
||||
|
||||
if(gui2::show_message(video, _("Warning"), warning_msg, gui2::tmessage::yes_no_buttons) != gui2::window::OK) {
|
||||
if(gui2::show_message(video, _("Warning"), warning_msg, gui2::dialogs::message::yes_no_buttons) != gui2::window::OK) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ static std::unique_ptr<wesnothd_connection> open_connection(CVideo& video, const
|
|||
std::string password = preferences::password();
|
||||
|
||||
bool fall_through = (*error)["force_confirmation"].to_bool() ?
|
||||
(gui2::show_message(video, _("Confirm"), (*error)["message"], gui2::tmessage::ok_cancel_buttons) == gui2::window::CANCEL) :
|
||||
(gui2::show_message(video, _("Confirm"), (*error)["message"], gui2::dialogs::message::ok_cancel_buttons) == gui2::window::CANCEL) :
|
||||
false;
|
||||
|
||||
const bool is_pw_request = !((*error)["password_request"].empty()) && !(password.empty());
|
||||
|
@ -302,7 +302,7 @@ static std::unique_ptr<wesnothd_connection> open_connection(CVideo& video, const
|
|||
|
||||
// Once again send our request...
|
||||
sock->send_data(response);
|
||||
gui2::tnetwork_transmission::wesnothd_receive_dialog(video, "login response", data, *sock);
|
||||
gui2::dialogs::network_transmission::wesnothd_receive_dialog(video, "login response", data, *sock);
|
||||
|
||||
|
||||
error = &data.child("error");
|
||||
|
@ -357,7 +357,7 @@ static std::unique_ptr<wesnothd_connection> open_connection(CVideo& video, const
|
|||
error_message = (*error)["message"].str();
|
||||
}
|
||||
|
||||
gui2::tmp_login dlg(error_message, !((*error)["password_request"].empty()));
|
||||
gui2::dialogs::mp_login dlg(error_message, !((*error)["password_request"].empty()));
|
||||
dlg.show(video);
|
||||
|
||||
switch(dlg.get_retval()) {
|
||||
|
@ -427,7 +427,7 @@ static void enter_wait_mode(CVideo& video, const config& game_config, saved_game
|
|||
{
|
||||
if(preferences::new_lobby()) {
|
||||
|
||||
gui2::tmp_join_game dlg(state, li, *connection, true, observe);
|
||||
gui2::dialogs::mp_join_game dlg(state, li, *connection, true, observe);
|
||||
|
||||
if(!dlg.fetch_game_config(video)) {
|
||||
return;
|
||||
|
@ -502,7 +502,7 @@ static bool enter_connect_mode(CVideo& video, const config& game_config,
|
|||
ng::connect_engine_ptr connect_engine(new ng::connect_engine(state, true, campaign_info.get()));
|
||||
|
||||
if(preferences::new_lobby()) {
|
||||
gui2::tmp_staging dlg(*connect_engine, li, connection);
|
||||
gui2::dialogs::mp_staging dlg(*connect_engine, li, connection);
|
||||
dlg.show(video);
|
||||
|
||||
if(dlg.get_retval() == gui2::window::OK) {
|
||||
|
@ -573,7 +573,7 @@ static void enter_create_mode(CVideo& video, const config& game_config,
|
|||
if(preferences::new_lobby()) {
|
||||
ng::create_engine create_eng(video, state);
|
||||
|
||||
gui2::tmp_create_game dlg(game_config, create_eng);
|
||||
gui2::dialogs::mp_create_game dlg(game_config, create_eng);
|
||||
|
||||
dlg.show(video);
|
||||
|
||||
|
@ -662,7 +662,7 @@ static bool enter_configure_mode(CVideo& video, const config& game_config,
|
|||
static void do_preferences_dialog(CVideo& video, const config& game_config)
|
||||
{
|
||||
DBG_MP << "displaying preferences dialog" << std::endl;
|
||||
gui2::tpreferences::display(video, game_config);
|
||||
gui2::dialogs::preferences_dialog::display(video, game_config);
|
||||
|
||||
/**
|
||||
* The screen size might have changed force an update of the size.
|
||||
|
@ -710,20 +710,20 @@ static void enter_lobby_mode(CVideo& video, const config& game_config,
|
|||
sdl::fill_rect(video.getSurface(), nullptr, color);
|
||||
|
||||
if(preferences::new_lobby()) {
|
||||
gui2::tlobby_main dlg(game_config, li, *connection);
|
||||
gui2::dialogs::lobby_main dlg(game_config, li, *connection);
|
||||
dlg.set_preferences_callback(
|
||||
std::bind(do_preferences_dialog,
|
||||
std::ref(video), std::ref(game_config)));
|
||||
dlg.show(video);
|
||||
//ugly kludge for launching other dialogs like the old lobby
|
||||
switch(dlg.get_retval()) {
|
||||
case gui2::tlobby_main::CREATE:
|
||||
case gui2::dialogs::lobby_main::CREATE:
|
||||
res = mp::ui::CREATE;
|
||||
break;
|
||||
case gui2::tlobby_main::JOIN:
|
||||
case gui2::dialogs::lobby_main::JOIN:
|
||||
res = mp::ui::JOIN;
|
||||
break;
|
||||
case gui2::tlobby_main::OBSERVE:
|
||||
case gui2::dialogs::lobby_main::OBSERVE:
|
||||
res = mp::ui::OBSERVE;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -373,7 +373,7 @@ void configure::process_event_impl(const process_event_data & data)
|
|||
}
|
||||
|
||||
if(password_button_.pressed()) {
|
||||
gui2::tmp_create_game_set_password::execute(
|
||||
gui2::dialogs::mp_create_game_set_password::execute(
|
||||
parameters_.password
|
||||
, video());
|
||||
}
|
||||
|
|
|
@ -1205,7 +1205,7 @@ static void handle_addon_requirements_gui(CVideo & v, const std::vector<required
|
|||
err_msg += "\n";
|
||||
}
|
||||
}
|
||||
gui2::show_message(v, e_title, err_msg, gui2::tmessage::auto_close);
|
||||
gui2::show_message(v, e_title, err_msg, gui2::dialogs::message::auto_close);
|
||||
} else if (addon_outcome == NEED_DOWNLOAD) {
|
||||
std::string e_title = _("Missing user-made content.");
|
||||
std::string err_msg = _("This game requires one or more user-made addons to be installed or updated in order to join. Do you want to try to install them?");
|
||||
|
@ -1227,7 +1227,7 @@ static void handle_addon_requirements_gui(CVideo & v, const std::vector<required
|
|||
}
|
||||
assert(needs_download.size() > 0);
|
||||
|
||||
if (gui2::show_message(v, e_title, err_msg, gui2::tmessage::yes_no_buttons) == gui2::window::OK) {
|
||||
if (gui2::show_message(v, e_title, err_msg, gui2::dialogs::message::yes_no_buttons) == gui2::window::OK) {
|
||||
ad_hoc_addon_fetch_session(v, needs_download);
|
||||
throw lobby_reload_request_exception();
|
||||
}
|
||||
|
@ -1284,7 +1284,7 @@ void lobby::process_event_impl(const process_event_data & data)
|
|||
|
||||
std::string password;
|
||||
if(join && game.password_required) {
|
||||
if(!gui2::tmp_join_game_password_prompt::execute(password, video())) {
|
||||
if(!gui2::dialogs::mp_join_game_password_prompt::execute(password, video())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -307,7 +307,7 @@ void ui::process_event()
|
|||
|
||||
void ui::handle_event(const SDL_Event& event)
|
||||
{
|
||||
if (gui2::tloadscreen::displaying()) {
|
||||
if (gui2::dialogs::loading_screen::displaying()) {
|
||||
return;
|
||||
}
|
||||
gui::widget::handle_event(event);
|
||||
|
@ -332,7 +332,7 @@ void ui::handle_event(const SDL_Event& event)
|
|||
/** @todo find out why the help string stays visible and fix it */
|
||||
video().clear_all_help_strings();
|
||||
|
||||
gui2::tmp_cmd_wrapper dlg(_("Selected user: ") + usr_text);
|
||||
gui2::dialogs::mp_cmd_wrapper dlg(_("Selected user: ") + usr_text);
|
||||
dlg.show(video());
|
||||
|
||||
std::stringstream msg;
|
||||
|
|
|
@ -223,7 +223,7 @@ void wait::join_game(bool observe)
|
|||
}
|
||||
}
|
||||
|
||||
gui2::tfaction_select dlg(flg, color, side_num + 1);
|
||||
gui2::dialogs::faction_select dlg(flg, color, side_num + 1);
|
||||
dlg.show(video());
|
||||
|
||||
if(dlg.get_retval() != gui2::window::OK) {
|
||||
|
@ -480,7 +480,7 @@ bool wait::download_level_data()
|
|||
bool has_scenario_and_controllers = false;
|
||||
while (!has_scenario_and_controllers) {
|
||||
config revc;
|
||||
bool data_res = gui2::tnetwork_transmission::wesnothd_receive_dialog(
|
||||
bool data_res = gui2::dialogs::network_transmission::wesnothd_receive_dialog(
|
||||
video(), "download level data", revc, *wesnothd_connection_);
|
||||
|
||||
if (!data_res) {
|
||||
|
|
|
@ -343,7 +343,7 @@ LEVEL_RESULT campaign_controller::play_game()
|
|||
{
|
||||
const int dlg_res = gui2::show_message(video_, _("Game Over"),
|
||||
_("This scenario has ended. Do you want to continue the campaign?"),
|
||||
gui2::tmessage::yes_no_buttons);
|
||||
gui2::dialogs::message::yes_no_buttons);
|
||||
|
||||
if(dlg_res == gui2::window::CANCEL) {
|
||||
return res;
|
||||
|
|
|
@ -59,7 +59,7 @@ bool enter_create_mode(CVideo& video, const config& game_config, saved_game& sta
|
|||
|
||||
// No campaign selected from command line
|
||||
if(jump_to_campaign.campaign_id_.empty()) {
|
||||
gui2::tcampaign_selection dlg(create_eng);
|
||||
gui2::dialogs::campaign_selection dlg(create_eng);
|
||||
|
||||
try {
|
||||
dlg.show(video);
|
||||
|
@ -130,7 +130,7 @@ bool enter_create_mode(CVideo& video, const config& game_config, saved_game& sta
|
|||
|
||||
bool enter_configure_mode(CVideo& video, const config& game_config, saved_game& state, ng::create_engine& create_eng, bool local_players_only)
|
||||
{
|
||||
if(!gui2::tsp_options_configure::execute(create_eng, video)) {
|
||||
if(!gui2::dialogs::sp_options_configure::execute(create_eng, video)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "generators/map_generator.hpp" // for mapgen_exception
|
||||
#include "gettext.hpp" // for _
|
||||
#include "gui/dialogs/end_credits.hpp"
|
||||
#include "gui/dialogs/language_selection.hpp" // for tlanguage_selection
|
||||
#include "gui/dialogs/language_selection.hpp" // for language_selection
|
||||
#include "gui/dialogs/loadscreen.hpp"
|
||||
#include "gui/dialogs/message.hpp" //for show error message
|
||||
#include "gui/dialogs/multiplayer/mp_host_game_prompt.hpp" //for host game prompt
|
||||
|
@ -170,7 +170,7 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts, const char
|
|||
}
|
||||
}
|
||||
if (cmdline_opts_.clock)
|
||||
gui2::show_debug_clock_button = true;
|
||||
gui2::dialogs::show_debug_clock_button = true;
|
||||
if (cmdline_opts_.debug) {
|
||||
game_config::debug = true;
|
||||
game_config::mp_debug = true;
|
||||
|
@ -912,7 +912,7 @@ bool game_launcher::play_multiplayer_commandline()
|
|||
|
||||
bool game_launcher::change_language()
|
||||
{
|
||||
gui2::tlanguage_selection dlg;
|
||||
gui2::dialogs::language_selection dlg;
|
||||
dlg.show(video());
|
||||
if (dlg.get_retval() != gui2::window::OK) return false;
|
||||
|
||||
|
@ -925,7 +925,7 @@ bool game_launcher::change_language()
|
|||
|
||||
void game_launcher::show_preferences()
|
||||
{
|
||||
gui2::tpreferences::display(video(), game_config_manager::get()->game_config());
|
||||
gui2::dialogs::preferences_dialog::display(video(), game_config_manager::get()->game_config());
|
||||
}
|
||||
|
||||
void game_launcher::launch_game(RELOAD_GAME_DATA reload)
|
||||
|
@ -937,9 +937,9 @@ void game_launcher::launch_game(RELOAD_GAME_DATA reload)
|
|||
return;
|
||||
}
|
||||
|
||||
gui2::tloadscreen::display(video(), [this, reload]() {
|
||||
gui2::dialogs::loading_screen::display(video(), [this, reload]() {
|
||||
|
||||
gui2::tloadscreen::progress("load data");
|
||||
gui2::dialogs::loading_screen::progress("load data");
|
||||
if(reload == RELOAD_DATA) {
|
||||
try {
|
||||
game_config_manager::get()->
|
||||
|
@ -959,7 +959,7 @@ void game_launcher::launch_game(RELOAD_GAME_DATA reload)
|
|||
preferences::add_completed_campaign(state_.classification().campaign, state_.classification().difficulty);
|
||||
the_end(video(), state_.classification().end_text, state_.classification().end_text_duration);
|
||||
if(state_.classification().end_credits) {
|
||||
gui2::tend_credits::display(video(), state_.classification().campaign);
|
||||
gui2::dialogs::end_credits::display(video(), state_.classification().campaign);
|
||||
}
|
||||
}
|
||||
} catch (savegame::load_game_exception &e) {
|
||||
|
|
|
@ -166,7 +166,7 @@ void game_state::place_sides_in_preferred_locations(const config& level)
|
|||
void game_state::init(const config& level, play_controller & pc)
|
||||
{
|
||||
events_manager_->read_scenario(level);
|
||||
gui2::tloadscreen::progress("init teams");
|
||||
gui2::dialogs::loading_screen::progress("init teams");
|
||||
if (level["modify_placing"].to_bool()) {
|
||||
LOG_NG << "modifying placing..." << std::endl;
|
||||
place_sides_in_preferred_locations(level);
|
||||
|
|
|
@ -63,7 +63,7 @@ bool default_map_generator::allow_user_config() const { return true; }
|
|||
|
||||
void default_map_generator::user_config()
|
||||
{
|
||||
gui2::tgenerator_settings::execute(data_, CVideo::get_singleton());
|
||||
gui2::dialogs::generator_settings::execute(data_, CVideo::get_singleton());
|
||||
}
|
||||
|
||||
std::string default_map_generator::name() const { return "default"; }
|
||||
|
|
|
@ -447,7 +447,7 @@ builder_window::window_resolution::window_resolution(const config& cfg)
|
|||
}
|
||||
}
|
||||
|
||||
builder_window::window_resolution::ttip::ttip(const config& cfg, const std::string& tagname) : id(cfg["id"])
|
||||
builder_window::window_resolution::tooltip_info::tooltip_info(const config& cfg, const std::string& tagname) : id(cfg["id"])
|
||||
{
|
||||
VALIDATE(!id.empty(),
|
||||
missing_mandatory_wml_key("[window][resolution][" + tagname + "]", "id"));
|
||||
|
|
|
@ -199,15 +199,15 @@ public:
|
|||
std::vector<linked_group> linked_groups;
|
||||
|
||||
/** Helper struct to store information about the tips. */
|
||||
struct ttip
|
||||
struct tooltip_info
|
||||
{
|
||||
ttip(const config& cfg, const std::string& tagname);
|
||||
tooltip_info(const config& cfg, const std::string& tagname);
|
||||
|
||||
std::string id;
|
||||
};
|
||||
|
||||
ttip tooltip;
|
||||
ttip helptip;
|
||||
tooltip_info tooltip;
|
||||
tooltip_info helptip;
|
||||
|
||||
builder_grid_ptr grid;
|
||||
};
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -53,7 +55,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(addon_connect)
|
||||
|
||||
taddon_connect::taddon_connect(std::string& host_name,
|
||||
addon_connect::addon_connect(std::string& host_name,
|
||||
const bool allow_remove)
|
||||
: allow_remove_(allow_remove)
|
||||
{
|
||||
|
@ -61,24 +63,24 @@ taddon_connect::taddon_connect(std::string& host_name,
|
|||
register_text("host_name", false, host_name, true);
|
||||
}
|
||||
|
||||
void taddon_connect::help_button_callback(window& window)
|
||||
void addon_connect::help_button_callback(window& window)
|
||||
{
|
||||
help::show_help(window.video(), "installing_addons");
|
||||
}
|
||||
|
||||
void taddon_connect::pre_show(window& window)
|
||||
void addon_connect::pre_show(window& window)
|
||||
{
|
||||
find_widget<button>(&window, "remove_addons", false)
|
||||
.set_active(allow_remove_);
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "show_help", false),
|
||||
std::bind(&taddon_connect::help_button_callback,
|
||||
std::bind(&addon_connect::help_button_callback,
|
||||
this,
|
||||
std::ref(window)));
|
||||
}
|
||||
|
||||
void taddon_connect::post_show(window& window)
|
||||
void addon_connect::post_show(window& window)
|
||||
{
|
||||
if(get_retval() == window::OK) {
|
||||
text_box& host_widget
|
||||
|
@ -88,4 +90,5 @@ void taddon_connect::post_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -21,9 +21,11 @@ class display;
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/** Addon connect dialog. */
|
||||
class taddon_connect : public tdialog
|
||||
class addon_connect : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -38,7 +40,7 @@ public:
|
|||
* @param disp The display object used for showing the
|
||||
* in-game help when requested.
|
||||
*/
|
||||
taddon_connect(std::string& host_name,
|
||||
addon_connect(std::string& host_name,
|
||||
const bool allow_remove);
|
||||
|
||||
private:
|
||||
|
@ -47,16 +49,17 @@ private:
|
|||
|
||||
void help_button_callback(window& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -225,6 +225,8 @@ std::string make_display_dependencies(const std::string& addon_id,
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -303,7 +305,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(addon_description)
|
||||
|
||||
taddon_description::taddon_description(const std::string& addon_id,
|
||||
addon_description::addon_description(const std::string& addon_id,
|
||||
const addons_list& addons_list,
|
||||
const addons_tracking_list& addon_states)
|
||||
: feedback_url_()
|
||||
|
@ -355,19 +357,19 @@ taddon_description::taddon_description(const std::string& addon_id,
|
|||
}
|
||||
}
|
||||
|
||||
void taddon_description::browse_url_callback()
|
||||
void addon_description::browse_url_callback()
|
||||
{
|
||||
/* TODO: ask for confirmation */
|
||||
|
||||
desktop::open_object(feedback_url_);
|
||||
}
|
||||
|
||||
void taddon_description::copy_url_callback()
|
||||
void addon_description::copy_url_callback()
|
||||
{
|
||||
desktop::clipboard::copy_to_clipboard(feedback_url_, false);
|
||||
}
|
||||
|
||||
void taddon_description::pre_show(window& window)
|
||||
void addon_description::pre_show(window& window)
|
||||
{
|
||||
control& url_none = find_widget<control>(&window, "url_none", false);
|
||||
button& url_go_button = find_widget<button>(&window, "url_go", false);
|
||||
|
@ -382,11 +384,11 @@ void taddon_description::pre_show(window& window)
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
url_go_button,
|
||||
std::bind(&taddon_description::browse_url_callback, this));
|
||||
std::bind(&addon_description::browse_url_callback, this));
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
url_copy_button,
|
||||
std::bind(&taddon_description::copy_url_callback, this));
|
||||
std::bind(&addon_description::copy_url_callback, this));
|
||||
|
||||
if (!desktop::clipboard::available()) {
|
||||
url_copy_button.set_active(false);
|
||||
|
@ -408,4 +410,5 @@ void taddon_description::pre_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace gui2
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class taddon_description : public tdialog
|
||||
class addon_description : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -35,35 +37,36 @@ public:
|
|||
* @param addon_states Local installation status of the add-ons in
|
||||
* @a addons_list.
|
||||
*/
|
||||
taddon_description(const std::string& addon_id,
|
||||
addon_description(const std::string& addon_id,
|
||||
const addons_list& addons_list,
|
||||
const addons_tracking_list& addon_states);
|
||||
|
||||
/**
|
||||
* The display function.
|
||||
*
|
||||
* See @ref tdialog for more information.
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static void display(const std::string& addon_id,
|
||||
const addons_list& addons_list,
|
||||
const addons_tracking_list& addon_states,
|
||||
CVideo& video)
|
||||
{
|
||||
taddon_description(addon_id, addons_list, addon_states).show(video);
|
||||
addon_description(addon_id, addons_list, addon_states).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string feedback_url_;
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
void browse_url_callback();
|
||||
void copy_url_callback();
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,6 +43,8 @@ bool unchecked_bool_field_finder(gui2::window& window,
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -115,7 +117,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(addon_filter_options)
|
||||
|
||||
taddon_filter_options::taddon_filter_options()
|
||||
addon_filter_options::addon_filter_options()
|
||||
: displayed_status_()
|
||||
, displayed_types_()
|
||||
, displayed_types_fields_()
|
||||
|
@ -145,14 +147,14 @@ taddon_filter_options::taddon_filter_options()
|
|||
register_displayed_type_field("show_other", ADDON_OTHER);
|
||||
}
|
||||
|
||||
void taddon_filter_options::register_displayed_type_field(
|
||||
void addon_filter_options::register_displayed_type_field(
|
||||
const std::string& field_id, ADDON_TYPE addon_type)
|
||||
{
|
||||
displayed_types_fields_.push_back(
|
||||
register_bool(field_id, true, displayed_types_[addon_type]));
|
||||
}
|
||||
|
||||
void taddon_filter_options::read_types_vector(const boost::dynamic_bitset<>& v)
|
||||
void addon_filter_options::read_types_vector(const boost::dynamic_bitset<>& v)
|
||||
{
|
||||
for(size_t k = 0; k < displayed_types_.size(); ++k) {
|
||||
// All unspecified types default to visible.
|
||||
|
@ -160,7 +162,7 @@ void taddon_filter_options::read_types_vector(const boost::dynamic_bitset<>& v)
|
|||
}
|
||||
}
|
||||
|
||||
void taddon_filter_options::toggle_all_displayed_types_button_callback(
|
||||
void addon_filter_options::toggle_all_displayed_types_button_callback(
|
||||
window& window)
|
||||
{
|
||||
const bool have_any_unchecked
|
||||
|
@ -177,17 +179,17 @@ void taddon_filter_options::toggle_all_displayed_types_button_callback(
|
|||
}
|
||||
}
|
||||
|
||||
void taddon_filter_options::toggle_sort_callback()
|
||||
void addon_filter_options::toggle_sort_callback()
|
||||
{
|
||||
sort_ = sort_tgroup_.get_active_member_value();
|
||||
}
|
||||
|
||||
void taddon_filter_options::toggle_dir_callback()
|
||||
void addon_filter_options::toggle_dir_callback()
|
||||
{
|
||||
dir_ = dir_tgroup_.get_active_member_value();
|
||||
}
|
||||
|
||||
void taddon_filter_options::pre_show(window& window)
|
||||
void addon_filter_options::pre_show(window& window)
|
||||
{
|
||||
listbox& list = find_widget<listbox>(&window, "statuses_list", false);
|
||||
window.keyboard_capture(&list);
|
||||
|
@ -206,7 +208,7 @@ void taddon_filter_options::pre_show(window& window)
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "toggle_all_displayed_types", false),
|
||||
std::bind(&taddon_filter_options::
|
||||
std::bind(&addon_filter_options::
|
||||
toggle_all_displayed_types_button_callback,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
@ -221,7 +223,7 @@ void taddon_filter_options::pre_show(window& window)
|
|||
register_dir_toggle(window, "descending", DIRECTION_DESCENDING);
|
||||
}
|
||||
|
||||
void taddon_filter_options::register_sort_toggle(window& window,
|
||||
void addon_filter_options::register_sort_toggle(window& window,
|
||||
const std::string& toggle_id,
|
||||
ADDON_SORT value)
|
||||
{
|
||||
|
@ -234,10 +236,10 @@ void taddon_filter_options::register_sort_toggle(window& window,
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
*b,
|
||||
std::bind(&taddon_filter_options::toggle_sort_callback, this));
|
||||
std::bind(&addon_filter_options::toggle_sort_callback, this));
|
||||
}
|
||||
|
||||
void taddon_filter_options::register_dir_toggle(window& window,
|
||||
void addon_filter_options::register_dir_toggle(window& window,
|
||||
const std::string& toggle_id,
|
||||
ADDON_SORT_DIRECTION value)
|
||||
{
|
||||
|
@ -250,10 +252,10 @@ void taddon_filter_options::register_dir_toggle(window& window,
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
*b,
|
||||
std::bind(&taddon_filter_options::toggle_dir_callback, this));
|
||||
std::bind(&addon_filter_options::toggle_dir_callback, this));
|
||||
}
|
||||
|
||||
void taddon_filter_options::post_show(window& window)
|
||||
void addon_filter_options::post_show(window& window)
|
||||
{
|
||||
// Sorting and direction options are handled in widget
|
||||
// callbacks.
|
||||
|
@ -268,7 +270,7 @@ void taddon_filter_options::post_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
std::string taddon_filter_options::status_label(ADDON_STATUS_FILTER s)
|
||||
std::string addon_filter_options::status_label(ADDON_STATUS_FILTER s)
|
||||
{
|
||||
switch(s) {
|
||||
case FILTER_NOT_INSTALLED:
|
||||
|
@ -282,4 +284,5 @@ std::string taddon_filter_options::status_label(ADDON_STATUS_FILTER s)
|
|||
}
|
||||
}
|
||||
|
||||
} // end namespace gui2
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -29,10 +29,13 @@ namespace gui2
|
|||
|
||||
class toggle_button;
|
||||
|
||||
class taddon_filter_options : public tdialog
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class addon_filter_options : public modal_dialog
|
||||
{
|
||||
public:
|
||||
taddon_filter_options();
|
||||
addon_filter_options();
|
||||
|
||||
boost::dynamic_bitset<> displayed_types() const
|
||||
{
|
||||
|
@ -106,19 +109,19 @@ private:
|
|||
void toggle_sort_callback();
|
||||
void toggle_dir_callback();
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
|
||||
static std::string status_label(ADDON_STATUS_FILTER s);
|
||||
};
|
||||
|
||||
|
||||
} // namespace dialogs
|
||||
} // end namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -59,6 +59,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -155,9 +157,9 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
REGISTER_DIALOG(addon_list)
|
||||
REGISTER_DIALOG(addon_manager)
|
||||
|
||||
taddon_list::taddon_list(const config& cfg)
|
||||
addon_manager::addon_manager(const config& cfg)
|
||||
: orders_()
|
||||
, cfg_(cfg)
|
||||
, cfg_iterators_(cfg_.child_range("campaign"))
|
||||
|
@ -168,7 +170,7 @@ taddon_list::taddon_list(const config& cfg)
|
|||
read_addons_list(cfg, addons_);
|
||||
}
|
||||
|
||||
void taddon_list::on_filtertext_changed(text_box_base* textbox, const std::string& text)
|
||||
void addon_manager::on_filtertext_changed(text_box_base* textbox, const std::string& text)
|
||||
{
|
||||
listbox& addons = find_widget<listbox>(textbox->get_window(), "addons", true);
|
||||
filter_transform filter(utils::split(text, ' '));
|
||||
|
@ -312,7 +314,7 @@ static std::string describe_status_verbose(const addon_tracking_info& state)
|
|||
return colorify_addon_state_string(s, state);
|
||||
}
|
||||
|
||||
void taddon_list::pre_show(window& window)
|
||||
void addon_manager::pre_show(window& window)
|
||||
{
|
||||
listbox& list = find_widget<listbox>(&window, "addons", false);
|
||||
|
||||
|
@ -374,16 +376,16 @@ void taddon_list::pre_show(window& window)
|
|||
list.register_sorting_option(4, [this](const int i) { return addon_at(ids_[i], addons_).type; });
|
||||
|
||||
find_widget<text_box>(&window, "filter", false).set_text_changed_callback(
|
||||
std::bind(&taddon_list::on_filtertext_changed, this, _1, _2));
|
||||
std::bind(&addon_manager::on_filtertext_changed, this, _1, _2));
|
||||
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
connect_signal_notify_modified(list,
|
||||
std::bind(&taddon_list::on_addon_select,
|
||||
std::bind(&addon_manager::on_addon_select,
|
||||
*this,
|
||||
std::ref(window)));
|
||||
#else
|
||||
list.set_callback_value_change(
|
||||
dialog_callback<taddon_list, &taddon_list::on_addon_select>);
|
||||
dialog_callback<addon_manager, &addon_manager::on_addon_select>);
|
||||
#endif
|
||||
|
||||
button& url_go_button = find_widget<button>(&window, "url_go", false);
|
||||
|
@ -405,27 +407,27 @@ void taddon_list::pre_show(window& window)
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
url_go_button,
|
||||
std::bind(&taddon_list::browse_url_callback, this, std::ref(url_textbox)));
|
||||
std::bind(&addon_manager::browse_url_callback, this, std::ref(url_textbox)));
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
url_copy_button,
|
||||
std::bind(&taddon_list::copy_url_callback, this, std::ref(url_textbox)));
|
||||
std::bind(&addon_manager::copy_url_callback, this, std::ref(url_textbox)));
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "options", false),
|
||||
std::bind(&taddon_list::options_button_callback, this, std::ref(window)));
|
||||
std::bind(&addon_manager::options_button_callback, this, std::ref(window)));
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "show_help", false),
|
||||
std::bind(&taddon_list::show_help, this, std::ref(window)));
|
||||
std::bind(&addon_manager::show_help, this, std::ref(window)));
|
||||
|
||||
on_addon_select(window);
|
||||
}
|
||||
|
||||
void taddon_list::options_button_callback(window& window)
|
||||
void addon_manager::options_button_callback(window& window)
|
||||
{
|
||||
// TODO
|
||||
//gui2::taddon_filter_options dlg;
|
||||
//gui2::addon_filter_options dlg;
|
||||
|
||||
//dlg.set_displayed_status(f_.status);
|
||||
//dlg.set_displayed_types(f_.types);
|
||||
|
@ -436,19 +438,19 @@ void taddon_list::options_button_callback(window& window)
|
|||
UNUSED(window); // Remove this once the code works.
|
||||
}
|
||||
|
||||
void taddon_list::show_help(window& window)
|
||||
void addon_manager::show_help(window& window)
|
||||
{
|
||||
help::show_help(window.video(), "installing_addons");
|
||||
}
|
||||
|
||||
void taddon_list::browse_url_callback(text_box& url_box)
|
||||
void addon_manager::browse_url_callback(text_box& url_box)
|
||||
{
|
||||
/* TODO: ask for confirmation */
|
||||
|
||||
desktop::open_object(url_box.get_value());
|
||||
}
|
||||
|
||||
void taddon_list::copy_url_callback(text_box& url_box)
|
||||
void addon_manager::copy_url_callback(text_box& url_box)
|
||||
{
|
||||
desktop::clipboard::copy_to_clipboard(url_box.get_value(), false);
|
||||
}
|
||||
|
@ -471,7 +473,7 @@ static std::string format_addon_time(time_t time)
|
|||
return font::unicode_em_dash;
|
||||
}
|
||||
|
||||
void taddon_list::on_addon_select(window& window)
|
||||
void addon_manager::on_addon_select(window& window)
|
||||
{
|
||||
const int index = find_widget<listbox>(&window, "addons", false).get_selected_row();
|
||||
|
||||
|
@ -510,4 +512,5 @@ void taddon_list::on_addon_select(window& window)
|
|||
find_widget<button>(&window, "uninstall", false).set_active(tracking_info_[info.id].state == ADDON_INSTALLED);
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -29,12 +29,14 @@ class text_box_base;
|
|||
class text_box;
|
||||
class pane;
|
||||
class selectable_item;
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/** Shows the list of addons on the server. */
|
||||
class taddon_list : public tdialog
|
||||
class addon_manager : public modal_dialog
|
||||
{
|
||||
public:
|
||||
explicit taddon_list(const config& cfg);
|
||||
explicit addon_manager(const config& cfg);
|
||||
|
||||
private:
|
||||
void on_filtertext_changed(text_box_base* textbox, const std::string& text);
|
||||
|
@ -42,10 +44,10 @@ private:
|
|||
std::vector<selectable_item*> orders_;
|
||||
|
||||
void on_addon_select(window& window);
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Config which contains the list with the campaigns. */
|
||||
|
@ -68,6 +70,7 @@ private:
|
|||
void show_help(window& window);
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -54,7 +56,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(addon_uninstall_list)
|
||||
|
||||
void taddon_uninstall_list::pre_show(window& window)
|
||||
void addon_uninstall_list::pre_show(window& window)
|
||||
{
|
||||
set_restore(true);
|
||||
|
||||
|
@ -81,7 +83,7 @@ void taddon_uninstall_list::pre_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
void taddon_uninstall_list::post_show(window& window)
|
||||
void addon_uninstall_list::post_show(window& window)
|
||||
{
|
||||
const listbox& list = find_widget<listbox>(&window, "addons_list", false);
|
||||
const unsigned rows = list.get_item_count();
|
||||
|
@ -100,7 +102,7 @@ void taddon_uninstall_list::post_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> taddon_uninstall_list::selected_addons() const
|
||||
std::vector<std::string> addon_uninstall_list::selected_addons() const
|
||||
{
|
||||
std::vector<std::string> retv;
|
||||
|
||||
|
@ -114,5 +116,5 @@ std::vector<std::string> taddon_uninstall_list::selected_addons() const
|
|||
return retv;
|
||||
}
|
||||
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -21,8 +21,10 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class taddon_uninstall_list : public tdialog
|
||||
class addon_uninstall_list : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -32,7 +34,7 @@ public:
|
|||
* Internal id <-> user-visible title mappings for
|
||||
* the add-ons to display.
|
||||
*/
|
||||
explicit taddon_uninstall_list(
|
||||
explicit addon_uninstall_list(
|
||||
const std::map<std::string, std::string>& addon_titles_map)
|
||||
: titles_map_(addon_titles_map), ids_(), selections_()
|
||||
{
|
||||
|
@ -45,16 +47,17 @@ private:
|
|||
std::vector<std::string> ids_;
|
||||
std::map<std::string, bool> selections_;
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -35,12 +35,14 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
REGISTER_DIALOG(advanced_graphics_options)
|
||||
|
||||
const std::vector<std::string> tadvanced_graphics_options::scale_cases = {"zoom", "hex"};
|
||||
const std::vector<std::string> advanced_graphics_options::scale_cases = {"zoom", "hex"};
|
||||
|
||||
tadvanced_graphics_options::SCALING_ALGORITHM tadvanced_graphics_options::get_scale_pref(const std::string& pref_id)
|
||||
advanced_graphics_options::SCALING_ALGORITHM advanced_graphics_options::get_scale_pref(const std::string& pref_id)
|
||||
{
|
||||
SCALING_ALGORITHM algo = SCALING_ALGORITHM::LINEAR;
|
||||
try {
|
||||
|
@ -52,7 +54,7 @@ tadvanced_graphics_options::SCALING_ALGORITHM tadvanced_graphics_options::get_sc
|
|||
return algo;
|
||||
}
|
||||
|
||||
void tadvanced_graphics_options::setup_scale_case(const std::string & case_id, window & window)
|
||||
void advanced_graphics_options::setup_scale_case(const std::string & case_id, window & window)
|
||||
{
|
||||
std::string pref_id = "scale_" + case_id;
|
||||
group<SCALING_ALGORITHM>& group = groups_[case_id];
|
||||
|
@ -64,7 +66,7 @@ void tadvanced_graphics_options::setup_scale_case(const std::string & case_id, w
|
|||
group.set_member_states(get_scale_pref(pref_id));
|
||||
}
|
||||
|
||||
void tadvanced_graphics_options::update_scale_case(const std::string & case_id)
|
||||
void advanced_graphics_options::update_scale_case(const std::string & case_id)
|
||||
{
|
||||
std::string pref_id = "scale_" + case_id;
|
||||
SCALING_ALGORITHM new_val = groups_[case_id].get_active_member_value();
|
||||
|
@ -74,11 +76,11 @@ void tadvanced_graphics_options::update_scale_case(const std::string & case_id)
|
|||
preferences::set(pref_id, new_val.to_string());
|
||||
}
|
||||
|
||||
tadvanced_graphics_options::tadvanced_graphics_options()
|
||||
advanced_graphics_options::advanced_graphics_options()
|
||||
{
|
||||
}
|
||||
|
||||
void tadvanced_graphics_options::pre_show(window& window)
|
||||
void advanced_graphics_options::pre_show(window& window)
|
||||
{
|
||||
for(const std::string & i : scale_cases) {
|
||||
setup_scale_case(i, window);
|
||||
|
@ -91,7 +93,7 @@ void tadvanced_graphics_options::pre_show(window& window)
|
|||
*/
|
||||
}
|
||||
|
||||
void tadvanced_graphics_options::post_show(window& /*window*/)
|
||||
void advanced_graphics_options::post_show(window& /*window*/)
|
||||
{
|
||||
if(get_retval() == window::OK) {
|
||||
for(const std::string & i : scale_cases) {
|
||||
|
@ -101,4 +103,5 @@ void tadvanced_graphics_options::post_show(window& /*window*/)
|
|||
}
|
||||
}
|
||||
|
||||
} // end namespace gui2
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -23,21 +23,23 @@ namespace gui2
|
|||
{
|
||||
class label;
|
||||
class toggle_button;
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tadvanced_graphics_options : public tdialog
|
||||
class advanced_graphics_options : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/** Constructor. */
|
||||
tadvanced_graphics_options();
|
||||
advanced_graphics_options();
|
||||
|
||||
/**
|
||||
* The display function.
|
||||
*
|
||||
* See @ref tdialog for more information.
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static void display(CVideo& video)
|
||||
{
|
||||
tadvanced_graphics_options().show(video);
|
||||
advanced_graphics_options().show(video);
|
||||
}
|
||||
|
||||
// These names must match the infixes of the widget ids in advanced_graphics_options.cfg
|
||||
|
@ -52,13 +54,13 @@ public:
|
|||
)
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
|
||||
void setup_scale_case(const std::string &, window &);
|
||||
|
@ -68,6 +70,7 @@ private:
|
|||
std::map<std::string,group<SCALING_ALGORITHM> > groups_;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // end namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -37,6 +37,8 @@ static lg::log_domain log_wml("wml");
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -109,7 +111,7 @@ config generate_difficulty_config(const config& source)
|
|||
return result;
|
||||
}
|
||||
|
||||
tcampaign_difficulty::tcampaign_difficulty(const config& campaign)
|
||||
campaign_difficulty::campaign_difficulty(const config& campaign)
|
||||
: difficulties_()
|
||||
, campaign_id_(campaign["id"])
|
||||
, selected_difficulty_()
|
||||
|
@ -119,7 +121,7 @@ tcampaign_difficulty::tcampaign_difficulty(const config& campaign)
|
|||
difficulties_ = generate_difficulty_config(campaign);
|
||||
}
|
||||
|
||||
void tcampaign_difficulty::pre_show(window& window)
|
||||
void campaign_difficulty::pre_show(window& window)
|
||||
{
|
||||
listbox& list = find_widget<listbox>(&window, "listbox", false);
|
||||
window.keyboard_capture(&list);
|
||||
|
@ -153,7 +155,7 @@ void tcampaign_difficulty::pre_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
void tcampaign_difficulty::post_show(window& window)
|
||||
void campaign_difficulty::post_show(window& window)
|
||||
{
|
||||
if(get_retval() != window::OK) {
|
||||
selected_difficulty_ = "CANCEL";
|
||||
|
@ -163,4 +165,5 @@ void tcampaign_difficulty::post_show(window& window)
|
|||
listbox& list = find_widget<listbox>(&window, "listbox", false);
|
||||
selected_difficulty_ = difficulties_.child("difficulty", list.get_selected_row())["define"].str();
|
||||
}
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/**
|
||||
* Helper function to convert old difficulty markup. Declared outside class to allow other
|
||||
|
@ -29,13 +31,13 @@ namespace gui2
|
|||
*/
|
||||
config generate_difficulty_config(const config& source);
|
||||
|
||||
class tcampaign_difficulty : public tdialog
|
||||
class campaign_difficulty : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @param config of the campaign difficulty is being chosen for
|
||||
*/
|
||||
tcampaign_difficulty(const config& campaign);
|
||||
campaign_difficulty(const config& campaign);
|
||||
|
||||
/**
|
||||
* Returns the selected difficulty define after displaying.
|
||||
|
@ -51,15 +53,16 @@ private:
|
|||
std::string campaign_id_;
|
||||
std::string selected_difficulty_;
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_CAMPAIGN_DIFFICULTY_HPP_INCLUDED */
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -82,7 +84,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(campaign_selection)
|
||||
|
||||
void tcampaign_selection::campaign_selected(window& window)
|
||||
void campaign_selection::campaign_selected(window& window)
|
||||
{
|
||||
if(new_widgets || true) {
|
||||
tree_view& tree
|
||||
|
@ -115,12 +117,12 @@ void tcampaign_selection::campaign_selected(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
void tcampaign_selection::show_settings(CVideo& video) {
|
||||
tcampaign_settings settings_dlg(engine_);
|
||||
void campaign_selection::show_settings(CVideo& video) {
|
||||
campaign_settings settings_dlg(engine_);
|
||||
settings_dlg.show(video);
|
||||
}
|
||||
|
||||
void tcampaign_selection::pre_show(window& window)
|
||||
void campaign_selection::pre_show(window& window)
|
||||
{
|
||||
if(new_widgets || true) {
|
||||
/***** Setup campaign tree. *****/
|
||||
|
@ -128,7 +130,7 @@ void tcampaign_selection::pre_show(window& window)
|
|||
= find_widget<tree_view>(&window, "campaign_tree", false);
|
||||
|
||||
tree.set_selection_change_callback(
|
||||
std::bind(&tcampaign_selection::campaign_selected,
|
||||
std::bind(&campaign_selection::campaign_selected,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
||||
|
@ -197,7 +199,7 @@ void tcampaign_selection::pre_show(window& window)
|
|||
VALIDATE(checkbox, missing_widget("checkb"));
|
||||
checkbox->set_value(active);
|
||||
checkbox->set_label(mod->name);
|
||||
checkbox->set_callback_state_change(std::bind(&tcampaign_selection::mod_toggled, this, id, _1));
|
||||
checkbox->set_callback_state_change(std::bind(&campaign_selection::mod_toggled, this, id, _1));
|
||||
++id;
|
||||
}
|
||||
}
|
||||
|
@ -214,13 +216,13 @@ void tcampaign_selection::pre_show(window& window)
|
|||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
connect_signal_notify_modified(
|
||||
list,
|
||||
std::bind(&tcampaign_selection::campaign_selected,
|
||||
std::bind(&campaign_selection::campaign_selected,
|
||||
this,
|
||||
std::ref(window)));
|
||||
#else
|
||||
list.set_callback_value_change(
|
||||
dialog_callback<tcampaign_selection,
|
||||
&tcampaign_selection::campaign_selected>);
|
||||
dialog_callback<campaign_selection,
|
||||
&campaign_selection::campaign_selected>);
|
||||
#endif
|
||||
window.keyboard_capture(&list);
|
||||
|
||||
|
@ -272,11 +274,11 @@ void tcampaign_selection::pre_show(window& window)
|
|||
find_widget<button>(&window, "advanced_settings", false, false);
|
||||
if(advanced_settings_button) {
|
||||
advanced_settings_button->connect_click_handler(
|
||||
std::bind(&tcampaign_selection::show_settings, this, std::ref(window.video())));
|
||||
std::bind(&campaign_selection::show_settings, this, std::ref(window.video())));
|
||||
}
|
||||
}
|
||||
|
||||
void tcampaign_selection::post_show(window& window)
|
||||
void campaign_selection::post_show(window& window)
|
||||
{
|
||||
if(new_widgets || true) {
|
||||
tree_view& tree
|
||||
|
@ -304,10 +306,11 @@ void tcampaign_selection::post_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
void tcampaign_selection::mod_toggled(int id, widget &)
|
||||
void campaign_selection::mod_toggled(int id, widget &)
|
||||
{
|
||||
engine_.set_current_mod_index(id);
|
||||
engine_.toggle_current_mod();
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -21,11 +21,13 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tcampaign_selection : public tdialog
|
||||
class campaign_selection : public modal_dialog
|
||||
{
|
||||
public:
|
||||
explicit tcampaign_selection(ng::create_engine& eng) :
|
||||
explicit campaign_selection(ng::create_engine& eng) :
|
||||
engine_(eng),
|
||||
choice_(-1),
|
||||
deterministic_(false)
|
||||
|
@ -49,15 +51,15 @@ private:
|
|||
/** Called when another campaign is selected. */
|
||||
void campaign_selected(window& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
void show_settings(CVideo& video);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
|
||||
|
||||
|
@ -72,6 +74,7 @@ private:
|
|||
bool deterministic_;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -78,25 +80,25 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(campaign_settings)
|
||||
|
||||
tcampaign_settings::tcampaign_settings(ng::create_engine& eng)
|
||||
campaign_settings::campaign_settings(ng::create_engine& eng)
|
||||
: engine_(eng)
|
||||
{ }
|
||||
|
||||
|
||||
void tcampaign_settings::change_era(window& window)
|
||||
void campaign_settings::change_era(window& window)
|
||||
{
|
||||
listbox& list = find_widget<listbox>(&window, "era_list", false);
|
||||
engine_.set_current_era_index(list.get_selected_row());
|
||||
}
|
||||
|
||||
void tcampaign_settings::change_mod(size_t index, window&)
|
||||
void campaign_settings::change_mod(size_t index, window&)
|
||||
{
|
||||
engine_.set_current_mod_index(index);
|
||||
// force toggle mod.
|
||||
engine_.toggle_current_mod(true);
|
||||
}
|
||||
|
||||
void tcampaign_settings::update_lists(window& window)
|
||||
void campaign_settings::update_lists(window& window)
|
||||
{
|
||||
listbox& era_list = find_widget<listbox>(&window, "era_list", false);
|
||||
listbox& mod_list = find_widget<listbox>(&window, "modification_list", false);
|
||||
|
@ -149,7 +151,7 @@ void tcampaign_settings::update_lists(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
void tcampaign_settings::pre_show(window& window)
|
||||
void campaign_settings::pre_show(window& window)
|
||||
{
|
||||
find_widget<toggle_button>(&window, "mp_connect", false).set_value(
|
||||
engine_.get_state().mp_settings().show_connect);
|
||||
|
@ -170,15 +172,16 @@ void tcampaign_settings::pre_show(window& window)
|
|||
}
|
||||
|
||||
era_list.set_callback_item_change(
|
||||
std::bind(&tcampaign_settings::change_era, this, std::ref(window)));
|
||||
std::bind(&campaign_settings::change_era, this, std::ref(window)));
|
||||
mod_list.set_callback_item_change(
|
||||
std::bind(&tcampaign_settings::change_mod, this, _1, std::ref(window)));
|
||||
std::bind(&campaign_settings::change_mod, this, _1, std::ref(window)));
|
||||
}
|
||||
|
||||
void tcampaign_settings::post_show(window& window)
|
||||
void campaign_settings::post_show(window& window)
|
||||
{
|
||||
engine_.get_state().mp_settings().show_connect =
|
||||
find_widget<toggle_button>(&window, "mp_connect", false).get_value_bool();
|
||||
}
|
||||
|
||||
} // end namespace gui2
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -24,11 +24,13 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tcampaign_settings : public tdialog
|
||||
class campaign_settings : public modal_dialog
|
||||
{
|
||||
public:
|
||||
tcampaign_settings(ng::create_engine& eng);
|
||||
campaign_settings(ng::create_engine& eng);
|
||||
|
||||
// whether configure is enabled
|
||||
bool enable_configure();
|
||||
|
@ -50,16 +52,17 @@ private:
|
|||
// populate era and mod lists
|
||||
void update_lists(window& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // end namespace gui2
|
||||
#endif
|
||||
|
|
|
@ -50,6 +50,8 @@ static lg::log_domain log_chat_log("chat_log");
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -66,7 +68,7 @@ REGISTER_DIALOG(chat_log)
|
|||
|
||||
// The model is an interface defining the data to be displayed or otherwise
|
||||
// acted upon in the user interface.
|
||||
class tchat_log::model
|
||||
class chat_log::model
|
||||
{
|
||||
public:
|
||||
model(const vconfig& c, const replay& r)
|
||||
|
@ -81,8 +83,8 @@ public:
|
|||
, filter()
|
||||
, copy_button()
|
||||
{
|
||||
LOG_CHAT_LOG << "entering tchat_log::model...\n";
|
||||
LOG_CHAT_LOG << "finished tchat_log::model...\n";
|
||||
LOG_CHAT_LOG << "entering chat_log::model...\n";
|
||||
LOG_CHAT_LOG << "finished chat_log::model...\n";
|
||||
}
|
||||
|
||||
vconfig cfg;
|
||||
|
@ -119,7 +121,7 @@ public:
|
|||
}
|
||||
|
||||
const std::string& lcfilter = utf8::lowercase(filter->get_value());
|
||||
LOG_CHAT_LOG << "entering tchat_log::model::stream_log\n";
|
||||
LOG_CHAT_LOG << "entering chat_log::model::stream_log\n";
|
||||
|
||||
for(const auto & t : make_pair(chat_log_history.begin() + first,
|
||||
chat_log_history.begin() + last))
|
||||
|
@ -216,18 +218,18 @@ public:
|
|||
// The controller acts upon the model. It retrieves data from repositories,
|
||||
// persists it, manipulates it, and determines how it will be displayed in the
|
||||
// view.
|
||||
class tchat_log::controller
|
||||
class chat_log::controller
|
||||
{
|
||||
public:
|
||||
controller(model& m) : model_(m)
|
||||
{
|
||||
LOG_CHAT_LOG << "Entering tchat_log::controller" << std::endl;
|
||||
LOG_CHAT_LOG << "Exiting tchat_log::controller" << std::endl;
|
||||
LOG_CHAT_LOG << "Entering chat_log::controller" << std::endl;
|
||||
LOG_CHAT_LOG << "Exiting chat_log::controller" << std::endl;
|
||||
}
|
||||
|
||||
void next_page()
|
||||
{
|
||||
LOG_CHAT_LOG << "Entering tchat_log::controller::next_page"
|
||||
LOG_CHAT_LOG << "Entering chat_log::controller::next_page"
|
||||
<< std::endl;
|
||||
if(model_.page >= model_.count_of_pages() - 1) {
|
||||
return;
|
||||
|
@ -235,12 +237,12 @@ public:
|
|||
model_.page++;
|
||||
LOG_CHAT_LOG << "Set page to " << model_.page + 1 << std::endl;
|
||||
update_view_from_model();
|
||||
LOG_CHAT_LOG << "Exiting tchat_log::controller::next_page" << std::endl;
|
||||
LOG_CHAT_LOG << "Exiting chat_log::controller::next_page" << std::endl;
|
||||
}
|
||||
|
||||
void previous_page()
|
||||
{
|
||||
LOG_CHAT_LOG << "Entering tchat_log::controller::previous_page"
|
||||
LOG_CHAT_LOG << "Entering chat_log::controller::previous_page"
|
||||
<< std::endl;
|
||||
if(model_.page == 0) {
|
||||
return;
|
||||
|
@ -248,27 +250,27 @@ public:
|
|||
model_.page--;
|
||||
LOG_CHAT_LOG << "Set page to " << model_.page + 1 << std::endl;
|
||||
update_view_from_model();
|
||||
LOG_CHAT_LOG << "Exiting tchat_log::controller::previous_page"
|
||||
LOG_CHAT_LOG << "Exiting chat_log::controller::previous_page"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
void filter()
|
||||
{
|
||||
LOG_CHAT_LOG << "Entering tchat_log::controller::filter" << std::endl;
|
||||
LOG_CHAT_LOG << "Entering chat_log::controller::filter" << std::endl;
|
||||
update_view_from_model();
|
||||
LOG_CHAT_LOG << "Exiting tchat_log::controller::filter" << std::endl;
|
||||
LOG_CHAT_LOG << "Exiting chat_log::controller::filter" << std::endl;
|
||||
}
|
||||
|
||||
void handle_page_number_changed()
|
||||
{
|
||||
LOG_CHAT_LOG
|
||||
<< "Entering tchat_log::controller::handle_page_number_changed"
|
||||
<< "Entering chat_log::controller::handle_page_number_changed"
|
||||
<< std::endl;
|
||||
model_.page = model_.page_number->get_value() - 1;
|
||||
LOG_CHAT_LOG << "Set page to " << model_.page + 1 << std::endl;
|
||||
update_view_from_model();
|
||||
LOG_CHAT_LOG
|
||||
<< "Exiting tchat_log::controller::handle_page_number_changed"
|
||||
<< "Exiting chat_log::controller::handle_page_number_changed"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
@ -295,7 +297,7 @@ public:
|
|||
|
||||
void update_view_from_model(bool select_last_page = false)
|
||||
{
|
||||
LOG_CHAT_LOG << "Entering tchat_log::controller::update_view_from_model"
|
||||
LOG_CHAT_LOG << "Entering chat_log::controller::update_view_from_model"
|
||||
<< std::endl;
|
||||
model_.msg_label->set_use_markup(true);
|
||||
int size = model_.chat_log_history.size();
|
||||
|
@ -328,7 +330,7 @@ public:
|
|||
cur_page_text << (page + 1) << '/' << std::max(1, count_of_pages);
|
||||
model_.page_label->set_label(cur_page_text.str());
|
||||
|
||||
LOG_CHAT_LOG << "Exiting tchat_log::controller::update_view_from_model"
|
||||
LOG_CHAT_LOG << "Exiting chat_log::controller::update_view_from_model"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
@ -345,7 +347,7 @@ private:
|
|||
|
||||
// The view is an interface that displays data (the model) and routes user
|
||||
// commands to the controller to act upon that data.
|
||||
class tchat_log::view
|
||||
class chat_log::view
|
||||
{
|
||||
public:
|
||||
view(const vconfig& cfg, const replay& r) : model_(cfg, r), controller_(model_)
|
||||
|
@ -354,9 +356,9 @@ public:
|
|||
|
||||
void pre_show()
|
||||
{
|
||||
LOG_CHAT_LOG << "Entering tchat_log::view::pre_show" << std::endl;
|
||||
LOG_CHAT_LOG << "Entering chat_log::view::pre_show" << std::endl;
|
||||
controller_.update_view_from_model(true);
|
||||
LOG_CHAT_LOG << "Exiting tchat_log::view::pre_show" << std::endl;
|
||||
LOG_CHAT_LOG << "Exiting chat_log::view::pre_show" << std::endl;
|
||||
}
|
||||
|
||||
void handle_page_number_changed()
|
||||
|
@ -386,7 +388,7 @@ public:
|
|||
|
||||
void bind(window& window)
|
||||
{
|
||||
LOG_CHAT_LOG << "Entering tchat_log::view::bind" << std::endl;
|
||||
LOG_CHAT_LOG << "Entering chat_log::view::bind" << std::endl;
|
||||
model_.msg_label = &find_widget<control>(&window, "msg", false);
|
||||
model_.page_number
|
||||
= &find_widget<slider>(&window, "page_number", false);
|
||||
|
@ -421,7 +423,7 @@ public:
|
|||
|
||||
model_.page_label = &find_widget<control>(&window, "page_label", false);
|
||||
|
||||
LOG_CHAT_LOG << "Exiting tchat_log::view::bind" << std::endl;
|
||||
LOG_CHAT_LOG << "Exiting chat_log::view::bind" << std::endl;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -430,29 +432,30 @@ private:
|
|||
};
|
||||
|
||||
|
||||
tchat_log::tchat_log(const vconfig& cfg, const replay& r) : view_()
|
||||
chat_log::chat_log(const vconfig& cfg, const replay& r) : view_()
|
||||
{
|
||||
LOG_CHAT_LOG << "Entering tchat_log::tchat_log" << std::endl;
|
||||
LOG_CHAT_LOG << "Entering chat_log::chat_log" << std::endl;
|
||||
view_ = std::make_shared<view>(cfg, r);
|
||||
LOG_CHAT_LOG << "Exiting tchat_log::tchat_log" << std::endl;
|
||||
LOG_CHAT_LOG << "Exiting chat_log::chat_log" << std::endl;
|
||||
}
|
||||
|
||||
std::shared_ptr<tchat_log::view> tchat_log::get_view()
|
||||
std::shared_ptr<chat_log::view> chat_log::get_view()
|
||||
{
|
||||
return view_;
|
||||
}
|
||||
|
||||
window* tchat_log::build_window(CVideo& video)
|
||||
window* chat_log::build_window(CVideo& video)
|
||||
{
|
||||
return build(video, window_id());
|
||||
}
|
||||
|
||||
void tchat_log::pre_show(window& window)
|
||||
void chat_log::pre_show(window& window)
|
||||
{
|
||||
LOG_CHAT_LOG << "Entering tchat_log::pre_show" << std::endl;
|
||||
LOG_CHAT_LOG << "Entering chat_log::pre_show" << std::endl;
|
||||
view_->bind(window);
|
||||
view_->pre_show();
|
||||
LOG_CHAT_LOG << "Exiting tchat_log::pre_show" << std::endl;
|
||||
LOG_CHAT_LOG << "Exiting chat_log::pre_show" << std::endl;
|
||||
}
|
||||
|
||||
} // end of namespace gui2
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -22,29 +22,32 @@ class replay;
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tchat_log : public tdialog
|
||||
class chat_log : public modal_dialog
|
||||
{
|
||||
public:
|
||||
class model;
|
||||
class view;
|
||||
class controller;
|
||||
tchat_log(const vconfig& cfg, const replay& replay);
|
||||
chat_log(const vconfig& cfg, const replay& replay);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
window* build_window(CVideo& video);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
std::shared_ptr<view> get_view();
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
std::shared_ptr<view> view_;
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_CHAT_LOG_HPP_INCLUDED */
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -70,7 +72,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(core_selection)
|
||||
|
||||
void tcore_selection::core_selected(window& window)
|
||||
void core_selection::core_selected(window& window)
|
||||
{
|
||||
const int selected_row
|
||||
= find_widget<listbox>(&window, "core_list", false)
|
||||
|
@ -82,20 +84,20 @@ void tcore_selection::core_selected(window& window)
|
|||
pages.select_page(selected_row);
|
||||
}
|
||||
|
||||
void tcore_selection::pre_show(window& window)
|
||||
void core_selection::pre_show(window& window)
|
||||
{
|
||||
/***** Setup core list. *****/
|
||||
listbox& list = find_widget<listbox>(&window, "core_list", false);
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
connect_signal_notify_modified(
|
||||
list,
|
||||
std::bind(&tcore_selection::core_selected,
|
||||
std::bind(&core_selection::core_selected,
|
||||
this,
|
||||
std::ref(window)));
|
||||
#else
|
||||
list.set_callback_value_change(
|
||||
dialog_callback<tcore_selection,
|
||||
&tcore_selection::core_selected>);
|
||||
dialog_callback<core_selection,
|
||||
&core_selection::core_selected>);
|
||||
#endif
|
||||
window.keyboard_capture(&list);
|
||||
|
||||
|
@ -133,10 +135,11 @@ void tcore_selection::pre_show(window& window)
|
|||
core_selected(window);
|
||||
}
|
||||
|
||||
void tcore_selection::post_show(window& window)
|
||||
void core_selection::post_show(window& window)
|
||||
{
|
||||
choice_ = find_widget<listbox>(&window, "core_list", false)
|
||||
.get_selected_row();
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -21,11 +21,13 @@ class config;
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tcore_selection : public tdialog
|
||||
class core_selection : public modal_dialog
|
||||
{
|
||||
public:
|
||||
explicit tcore_selection(const std::vector<config>& cores, int choice)
|
||||
explicit core_selection(const std::vector<config>& cores, int choice)
|
||||
: cores_(cores), choice_(choice)
|
||||
|
||||
{
|
||||
|
@ -42,13 +44,13 @@ private:
|
|||
/** Called when another core is selected. */
|
||||
void core_selected(window& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
|
||||
/** Contains the config objects for all cores. */
|
||||
|
@ -58,6 +60,7 @@ private:
|
|||
int choice_;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -75,7 +77,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(debug_clock)
|
||||
|
||||
void tdebug_clock::pre_show(window& window)
|
||||
void debug_clock::pre_show(window& window)
|
||||
{
|
||||
hour_percentage_ = find_widget<progress_bar>(
|
||||
&window, "hour_percentage", false, false);
|
||||
|
@ -103,7 +105,7 @@ void tdebug_clock::pre_show(window& window)
|
|||
|
||||
window_ = &window;
|
||||
|
||||
signal_ = std::bind(&tdebug_clock::update_time, this, false);
|
||||
signal_ = std::bind(&debug_clock::update_time, this, false);
|
||||
window.connect_signal<event::DRAW>(signal_,
|
||||
event::dispatcher::front_child);
|
||||
|
||||
|
@ -111,12 +113,12 @@ void tdebug_clock::pre_show(window& window)
|
|||
update_time(true);
|
||||
}
|
||||
|
||||
void tdebug_clock::post_show(CVideo& /*video*/)
|
||||
void debug_clock::post_show(CVideo& /*video*/)
|
||||
{
|
||||
window_->disconnect_signal<event::DRAW>(signal_);
|
||||
}
|
||||
|
||||
void tdebug_clock::update_time(const bool force)
|
||||
void debug_clock::update_time(const bool force)
|
||||
{
|
||||
if(!time_.step() && !force) {
|
||||
return;
|
||||
|
@ -168,11 +170,11 @@ void tdebug_clock::update_time(const bool force)
|
|||
}
|
||||
}
|
||||
|
||||
tdebug_clock::ttime::ttime() : hour(0), minute(0), second(0), millisecond(0)
|
||||
debug_clock::ttime::ttime() : hour(0), minute(0), second(0), millisecond(0)
|
||||
{
|
||||
}
|
||||
|
||||
void tdebug_clock::ttime::set_current_time()
|
||||
void debug_clock::ttime::set_current_time()
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
tm* stamp = localtime(&now);
|
||||
|
@ -183,7 +185,7 @@ void tdebug_clock::ttime::set_current_time()
|
|||
millisecond = 0;
|
||||
}
|
||||
|
||||
bool tdebug_clock::ttime::step(const unsigned milliseconds)
|
||||
bool debug_clock::ttime::step(const unsigned milliseconds)
|
||||
{
|
||||
millisecond += milliseconds;
|
||||
|
||||
|
@ -213,4 +215,5 @@ bool tdebug_clock::ttime::step(const unsigned milliseconds)
|
|||
return true;
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -27,12 +27,15 @@ class pane;
|
|||
class progress_bar;
|
||||
class integer_selector;
|
||||
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/** Clock to test the draw events. */
|
||||
class tdebug_clock : public tpopup
|
||||
class debug_clock : public modeless_dialog
|
||||
{
|
||||
public:
|
||||
tdebug_clock()
|
||||
: tpopup()
|
||||
debug_clock()
|
||||
: modeless_dialog()
|
||||
, hour_percentage_(nullptr)
|
||||
, minute_percentage_(nullptr)
|
||||
, second_percentage_(nullptr)
|
||||
|
@ -124,13 +127,13 @@ private:
|
|||
*/
|
||||
ttime time_;
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(CVideo& video);
|
||||
|
||||
/**
|
||||
|
@ -145,6 +148,7 @@ private:
|
|||
void update_time(const bool force);
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -52,7 +54,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(depcheck_confirm_change)
|
||||
|
||||
tdepcheck_confirm_change::tdepcheck_confirm_change(
|
||||
depcheck_confirm_change::depcheck_confirm_change(
|
||||
bool action,
|
||||
const std::vector<std::string>& mods,
|
||||
const std::string& requester)
|
||||
|
@ -77,4 +79,5 @@ tdepcheck_confirm_change::tdepcheck_confirm_change(
|
|||
|
||||
register_label("itemlist", false, list);
|
||||
}
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -21,8 +21,10 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tdepcheck_confirm_change : public tdialog
|
||||
class depcheck_confirm_change : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -34,15 +36,16 @@ public:
|
|||
* @param requester the name of the component which requests the change
|
||||
*
|
||||
*/
|
||||
tdepcheck_confirm_change(bool action,
|
||||
depcheck_confirm_change(bool action,
|
||||
const std::vector<std::string>& mods,
|
||||
const std::string& requester);
|
||||
|
||||
protected:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -58,7 +60,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(depcheck_select_new)
|
||||
|
||||
tdepcheck_select_new::tdepcheck_select_new(
|
||||
depcheck_select_new::depcheck_select_new(
|
||||
ng::depcheck::component_type name,
|
||||
const std::vector<std::string>& items)
|
||||
: items_(items), result_(-1)
|
||||
|
@ -87,7 +89,7 @@ tdepcheck_select_new::tdepcheck_select_new(
|
|||
register_label("message", false, message);
|
||||
}
|
||||
|
||||
void tdepcheck_select_new::pre_show(window& window)
|
||||
void depcheck_select_new::pre_show(window& window)
|
||||
{
|
||||
listbox& items = find_widget<listbox>(&window, "itemlist", false);
|
||||
|
||||
|
@ -102,11 +104,12 @@ void tdepcheck_select_new::pre_show(window& window)
|
|||
items.select_row(0);
|
||||
}
|
||||
|
||||
void tdepcheck_select_new::post_show(window& window)
|
||||
void depcheck_select_new::post_show(window& window)
|
||||
{
|
||||
if(get_retval() == window::OK) {
|
||||
listbox& items = find_widget<listbox>(&window, "itemlist", false);
|
||||
result_ = items.get_selected_row();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tdepcheck_select_new : public tdialog
|
||||
class depcheck_select_new : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -32,7 +34,7 @@ public:
|
|||
* @param name the type of which we want to select a new item
|
||||
* @param options the names of the components which can be choosed
|
||||
*/
|
||||
tdepcheck_select_new(ng::depcheck::component_type name,
|
||||
depcheck_select_new(ng::depcheck::component_type name,
|
||||
const std::vector<std::string>& options);
|
||||
|
||||
/**
|
||||
|
@ -47,13 +49,13 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog */
|
||||
/** Inherited from modal_dialog */
|
||||
virtual void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog */
|
||||
/** Inherited from modal_dialog */
|
||||
virtual void post_show(window& window);
|
||||
|
||||
private:
|
||||
|
@ -63,5 +65,6 @@ private:
|
|||
/** the index of the selected item */
|
||||
int result_;
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
#endif
|
||||
|
|
|
@ -24,8 +24,10 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
tdialog::~tdialog()
|
||||
modal_dialog::~modal_dialog()
|
||||
{
|
||||
for(auto field : fields_)
|
||||
{
|
||||
|
@ -33,7 +35,7 @@ tdialog::~tdialog()
|
|||
}
|
||||
}
|
||||
|
||||
bool tdialog::show(CVideo& video, const unsigned auto_close_time)
|
||||
bool modal_dialog::show(CVideo& video, const unsigned auto_close_time)
|
||||
{
|
||||
if(video.faked() && !show_even_without_video_) {
|
||||
if(!allow_plugin_skip_) {
|
||||
|
@ -93,7 +95,7 @@ bool tdialog::show(CVideo& video, const unsigned auto_close_time)
|
|||
return retval_ == window::OK;
|
||||
}
|
||||
|
||||
field_bool* tdialog::register_bool(
|
||||
field_bool* modal_dialog::register_bool(
|
||||
const std::string& id,
|
||||
const bool mandatory,
|
||||
const std::function<bool()> callback_load_value,
|
||||
|
@ -113,7 +115,7 @@ field_bool* tdialog::register_bool(
|
|||
}
|
||||
|
||||
field_bool*
|
||||
tdialog::register_bool(const std::string& id,
|
||||
modal_dialog::register_bool(const std::string& id,
|
||||
const bool mandatory,
|
||||
bool& linked_variable,
|
||||
const std::function<void(widget&)> callback_change,
|
||||
|
@ -126,7 +128,7 @@ tdialog::register_bool(const std::string& id,
|
|||
return field;
|
||||
}
|
||||
|
||||
field_integer* tdialog::register_integer(
|
||||
field_integer* modal_dialog::register_integer(
|
||||
const std::string& id,
|
||||
const bool mandatory,
|
||||
const std::function<int()> callback_load_value,
|
||||
|
@ -139,7 +141,7 @@ field_integer* tdialog::register_integer(
|
|||
return field;
|
||||
}
|
||||
|
||||
field_integer* tdialog::register_integer(const std::string& id,
|
||||
field_integer* modal_dialog::register_integer(const std::string& id,
|
||||
const bool mandatory,
|
||||
int& linked_variable)
|
||||
{
|
||||
|
@ -149,7 +151,7 @@ field_integer* tdialog::register_integer(const std::string& id,
|
|||
return field;
|
||||
}
|
||||
|
||||
field_text* tdialog::register_text(
|
||||
field_text* modal_dialog::register_text(
|
||||
const std::string& id,
|
||||
const bool mandatory,
|
||||
const std::function<std::string()> callback_load_value,
|
||||
|
@ -167,7 +169,7 @@ field_text* tdialog::register_text(
|
|||
return field;
|
||||
}
|
||||
|
||||
field_text* tdialog::register_text(const std::string& id,
|
||||
field_text* modal_dialog::register_text(const std::string& id,
|
||||
const bool mandatory,
|
||||
std::string& linked_variable,
|
||||
const bool capture_focus)
|
||||
|
@ -182,7 +184,7 @@ field_text* tdialog::register_text(const std::string& id,
|
|||
return field;
|
||||
}
|
||||
|
||||
field_label* tdialog::register_label(const std::string& id,
|
||||
field_label* modal_dialog::register_label(const std::string& id,
|
||||
const bool mandatory,
|
||||
const std::string& text,
|
||||
const bool use_markup)
|
||||
|
@ -193,27 +195,27 @@ field_label* tdialog::register_label(const std::string& id,
|
|||
return field;
|
||||
}
|
||||
|
||||
window* tdialog::build_window(CVideo& video) const
|
||||
window* modal_dialog::build_window(CVideo& video) const
|
||||
{
|
||||
return build(video, window_id());
|
||||
}
|
||||
|
||||
void tdialog::post_build(window& /*window*/)
|
||||
void modal_dialog::post_build(window& /*window*/)
|
||||
{
|
||||
/* DO NOTHING */
|
||||
}
|
||||
|
||||
void tdialog::pre_show(window& /*window*/)
|
||||
void modal_dialog::pre_show(window& /*window*/)
|
||||
{
|
||||
/* DO NOTHING */
|
||||
}
|
||||
|
||||
void tdialog::post_show(window& /*window*/)
|
||||
void modal_dialog::post_show(window& /*window*/)
|
||||
{
|
||||
/* DO NOTHING */
|
||||
}
|
||||
|
||||
void tdialog::init_fields(window& window)
|
||||
void modal_dialog::init_fields(window& window)
|
||||
{
|
||||
for(auto field : fields_)
|
||||
{
|
||||
|
@ -228,7 +230,7 @@ void tdialog::init_fields(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
void tdialog::finalize_fields(window& window, const bool save_fields)
|
||||
void modal_dialog::finalize_fields(window& window, const bool save_fields)
|
||||
{
|
||||
for(auto field : fields_)
|
||||
{
|
||||
|
@ -239,6 +241,7 @@ void tdialog::finalize_fields(window& window, const bool save_fields)
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ class CVideo;
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/**
|
||||
* Registers a window.
|
||||
|
@ -47,15 +49,15 @@ namespace gui2
|
|||
namespace ns_##id \
|
||||
{ \
|
||||
\
|
||||
struct tregister_helper \
|
||||
struct register_helper \
|
||||
{ \
|
||||
tregister_helper() \
|
||||
register_helper() \
|
||||
{ \
|
||||
register_window(#id); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
tregister_helper register_helper; \
|
||||
struct register_helper register_helper; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -65,7 +67,7 @@ namespace gui2
|
|||
* Call this function to register a window. In the header of the class it adds
|
||||
* the following code:
|
||||
*@code
|
||||
* // Inherited from tdialog, implemented by REGISTER_DIALOG.
|
||||
* // Inherited from modal_dialog, implemented by REGISTER_DIALOG.
|
||||
* virtual const std::string& id() const;
|
||||
*@endcode
|
||||
* Then use this macro in the implementation, inside the gui2 namespace.
|
||||
|
@ -88,12 +90,12 @@ namespace gui2
|
|||
/**
|
||||
* Wrapper for REGISTER_DIALOG2.
|
||||
*
|
||||
* "Calls" REGISTER_DIALOG2(twindow_id, window_id)
|
||||
* "Calls" REGISTER_DIALOG2(window_id, window_id)
|
||||
*/
|
||||
#define REGISTER_DIALOG(window_id) REGISTER_DIALOG2(t##window_id, window_id)
|
||||
#define REGISTER_DIALOG(window_id) REGISTER_DIALOG2(window_id, window_id)
|
||||
|
||||
/**
|
||||
* Abstract base class for all dialogs.
|
||||
* Abstract base class for all modal dialogs.
|
||||
*
|
||||
* A dialog shows a certain window instance to the user. The subclasses of this
|
||||
* class will hold the parameters used for a certain window, eg a server
|
||||
|
@ -106,7 +108,7 @@ namespace gui2
|
|||
* add a static member called @p execute. The parameters to the function are:
|
||||
* - references to in + out parameters by reference
|
||||
* - references to the in parameters
|
||||
* - the parameters for @ref tdialog::show.
|
||||
* - the parameters for @ref modal_dialog::show.
|
||||
*
|
||||
* The 'in + out parameters' are used as initial value and final value when the
|
||||
* OK button is pressed. The 'in parameters' are just extra parameters for
|
||||
|
@ -115,10 +117,10 @@ namespace gui2
|
|||
* When a function only has 'in parameters' it should return a void value and
|
||||
* the function should be called @p display, if it has 'in + out parameters' it
|
||||
* must return a bool value. This value indicates whether or not the OK button
|
||||
* was pressed to close the dialog. See @ref teditor_new_map::execute for an
|
||||
* was pressed to close the dialog. See @ref editor_new_map::execute for an
|
||||
* example.
|
||||
*/
|
||||
class tdialog
|
||||
class modal_dialog
|
||||
{
|
||||
/**
|
||||
* Special helper function to get the id of the window.
|
||||
|
@ -126,10 +128,10 @@ class tdialog
|
|||
* This is used in the unit tests, but these implementation details
|
||||
* shouldn't be used in the normal code.
|
||||
*/
|
||||
friend std::string unit_test_mark_as_tested(const tdialog& dialog);
|
||||
friend std::string unit_test_mark_as_tested(const modal_dialog& dialog);
|
||||
|
||||
public:
|
||||
tdialog()
|
||||
modal_dialog()
|
||||
: retval_(0)
|
||||
, always_save_fields_(false)
|
||||
, fields_()
|
||||
|
@ -140,7 +142,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual ~tdialog();
|
||||
virtual ~modal_dialog();
|
||||
|
||||
/**
|
||||
* Shows the window.
|
||||
|
@ -189,7 +191,7 @@ protected:
|
|||
/**
|
||||
* Creates a new boolean field.
|
||||
*
|
||||
* The field created is owned by tdialog, the returned pointer can be used
|
||||
* The field created is owned by modal_dialog, the returned pointer can be used
|
||||
* in the child classes as access to a field.
|
||||
*
|
||||
* @param id Id of the widget, same value as in WML.
|
||||
|
@ -216,7 +218,7 @@ protected:
|
|||
/**
|
||||
* Creates a new boolean field.
|
||||
*
|
||||
* The field created is owned by tdialog, the returned pointer can be used
|
||||
* The field created is owned by modal_dialog, the returned pointer can be used
|
||||
* in the child classes as access to a field.
|
||||
*
|
||||
* @param id Id of the widget, same value as in WML.
|
||||
|
@ -422,6 +424,7 @@ private:
|
|||
virtual void finalize_fields(window& window, const bool save_fields);
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,8 +30,10 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
REGISTER_DIALOG(drop_down_list)
|
||||
REGISTER_DIALOG(drop_down_menu)
|
||||
|
||||
namespace {
|
||||
void click_callback(window& window, bool&, bool&, point coordinate)
|
||||
|
@ -70,7 +72,7 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
void tdrop_down_list::pre_show(window& window)
|
||||
void drop_down_menu::pre_show(window& window)
|
||||
{
|
||||
window.set_variable("button_x", variant(button_pos_.x));
|
||||
window.set_variable("button_y", variant(button_pos_.y));
|
||||
|
@ -130,9 +132,10 @@ void tdrop_down_list::pre_show(window& window)
|
|||
window.connect_signal<event::SDL_VIDEO_RESIZE>(std::bind(&resize_callback, std::ref(window)), event::dispatcher::front_child);
|
||||
}
|
||||
|
||||
void tdrop_down_list::post_show(window& window)
|
||||
void drop_down_menu::post_show(window& window)
|
||||
{
|
||||
selected_item_ = find_widget<listbox>(&window, "list", true).get_selected_row();
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -21,11 +21,13 @@ class config;
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
///Used by the menu_button widget.
|
||||
class tdrop_down_list : public tdialog
|
||||
class drop_down_menu : public modal_dialog
|
||||
{
|
||||
public:
|
||||
tdrop_down_list(SDL_Rect button_pos, const std::vector<config>& items, int selected_item, bool use_markup)
|
||||
drop_down_menu(SDL_Rect button_pos, const std::vector<config>& items, int selected_item, bool use_markup)
|
||||
: button_pos_(button_pos)
|
||||
, items_(items)
|
||||
, selected_item_(selected_item)
|
||||
|
@ -42,14 +44,15 @@ private:
|
|||
std::vector<config> items_;
|
||||
int selected_item_;
|
||||
bool use_markup_;
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -46,9 +48,10 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(edit_label)
|
||||
|
||||
tedit_label::tedit_label(std::string& label, bool& team_only)
|
||||
edit_label::edit_label(std::string& label, bool& team_only)
|
||||
{
|
||||
register_text("label", true, label, true);
|
||||
register_bool("team_only_toggle", true, team_only);
|
||||
}
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tedit_label : public tdialog
|
||||
class edit_label : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -38,18 +40,19 @@ public:
|
|||
* toggle if the dialog returns @ref
|
||||
* window::OK undefined otherwise.
|
||||
*/
|
||||
tedit_label(std::string& label, bool& team_only);
|
||||
edit_label(std::string& label, bool& team_only);
|
||||
|
||||
/** The execute function see @ref tdialog for more information. */
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(std::string& label, bool& team_only, CVideo& video)
|
||||
{
|
||||
return tedit_label(label, team_only).show(video);
|
||||
return edit_label(label, team_only).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_EDIT_LABEL_INCLUDED */
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -40,7 +42,7 @@ namespace gui2
|
|||
REGISTER_DIALOG(edit_text)
|
||||
|
||||
//TODO: add a way to disallow certain chracters (like spaces or ")
|
||||
tedit_text::tedit_text(const std::string& title,
|
||||
edit_text::edit_text(const std::string& title,
|
||||
const std::string& label,
|
||||
std::string& text)
|
||||
{
|
||||
|
@ -48,4 +50,5 @@ tedit_text::tedit_text(const std::string& title,
|
|||
register_label("label", true, label, true);
|
||||
register_text("text", true, text, true);
|
||||
}
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tedit_text : public tdialog
|
||||
class edit_text : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -34,13 +36,13 @@ public:
|
|||
* if the dialog returns @ref window::OK,
|
||||
* undefined otherwise.
|
||||
*/
|
||||
tedit_text(const std::string& title,
|
||||
edit_text(const std::string& title,
|
||||
const std::string& label,
|
||||
std::string& text);
|
||||
|
||||
/**
|
||||
* Executes the dialog.
|
||||
* See @ref tdialog for more information.
|
||||
* See @ref modal_dialog for more information.
|
||||
*
|
||||
* @param [in, out] text The parameter's usage is:
|
||||
* - Input: The initial value of the unit name.
|
||||
|
@ -53,13 +55,14 @@ public:
|
|||
std::string& text,
|
||||
CVideo& video)
|
||||
{
|
||||
return tedit_text(title, label, text).show(video);
|
||||
return edit_text(title, label, text).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_EDIT_TEXT_INCLUDED */
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -85,7 +87,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(custom_tod)
|
||||
|
||||
tcustom_tod::tcustom_tod(display& display,
|
||||
custom_tod::custom_tod(display& display,
|
||||
const std::vector<time_of_day>& tods)
|
||||
: tods_(tods)
|
||||
, current_tod_(0)
|
||||
|
@ -103,7 +105,7 @@ tcustom_tod::tcustom_tod(display& display,
|
|||
{
|
||||
}
|
||||
|
||||
void tcustom_tod::select_file(const std::string& filename,
|
||||
void custom_tod::select_file(const std::string& filename,
|
||||
const std::string& default_dir,
|
||||
const std::string& attribute,
|
||||
window& window)
|
||||
|
@ -114,7 +116,7 @@ void tcustom_tod::select_file(const std::string& filename,
|
|||
dn = default_dir;
|
||||
}
|
||||
|
||||
gui2::tfile_dialog dlg;
|
||||
gui2::dialogs::file_dialog dlg;
|
||||
|
||||
dlg.set_title(_("Choose File"))
|
||||
.set_ok_label(_("Select"))
|
||||
|
@ -135,25 +137,25 @@ void tcustom_tod::select_file(const std::string& filename,
|
|||
update_selected_tod_info(window);
|
||||
}
|
||||
|
||||
void tcustom_tod::do_next_tod(window& window)
|
||||
void custom_tod::do_next_tod(window& window)
|
||||
{
|
||||
current_tod_ = (current_tod_ + 1) % tods_.size();
|
||||
update_selected_tod_info(window);
|
||||
}
|
||||
|
||||
void tcustom_tod::do_prev_tod(window& window)
|
||||
void custom_tod::do_prev_tod(window& window)
|
||||
{
|
||||
current_tod_ = (current_tod_ ? current_tod_ : tods_.size()) - 1;
|
||||
update_selected_tod_info(window);
|
||||
}
|
||||
|
||||
void tcustom_tod::do_new_tod(window& window)
|
||||
void custom_tod::do_new_tod(window& window)
|
||||
{
|
||||
tods_.insert(tods_.begin() + current_tod_, time_of_day());
|
||||
update_selected_tod_info(window);
|
||||
}
|
||||
|
||||
void tcustom_tod::do_delete_tod(window& window)
|
||||
void custom_tod::do_delete_tod(window& window)
|
||||
{
|
||||
assert(tods_.begin() + current_tod_ < tods_.end());
|
||||
if(tods_.size() == 1) {
|
||||
|
@ -168,13 +170,13 @@ void tcustom_tod::do_delete_tod(window& window)
|
|||
update_selected_tod_info(window);
|
||||
}
|
||||
|
||||
const time_of_day& tcustom_tod::get_selected_tod() const
|
||||
const time_of_day& custom_tod::get_selected_tod() const
|
||||
{
|
||||
assert(static_cast<size_t>(current_tod_) < tods_.size());
|
||||
return tods_[current_tod_];
|
||||
}
|
||||
|
||||
void tcustom_tod::update_tod_display(window& window)
|
||||
void custom_tod::update_tod_display(window& window)
|
||||
{
|
||||
::image::set_color_adjustment(tod_red_field_->get_value(),
|
||||
tod_green_field_->get_value(),
|
||||
|
@ -203,13 +205,13 @@ void tcustom_tod::update_tod_display(window& window)
|
|||
window.invalidate_layout();
|
||||
}
|
||||
|
||||
void tcustom_tod::update_lawful_bonus(window& window)
|
||||
void custom_tod::update_lawful_bonus(window& window)
|
||||
{
|
||||
tods_[current_tod_].lawful_bonus
|
||||
= lawful_bonus_field_->get_widget_value(window);
|
||||
}
|
||||
|
||||
void tcustom_tod::update_selected_tod_info(window& window)
|
||||
void custom_tod::update_selected_tod_info(window& window)
|
||||
{
|
||||
current_tod_name_->set_value(get_selected_tod().name);
|
||||
current_tod_id_->set_value(get_selected_tod().id);
|
||||
|
@ -230,7 +232,7 @@ void tcustom_tod::update_selected_tod_info(window& window)
|
|||
update_tod_display(window);
|
||||
}
|
||||
|
||||
void tcustom_tod::pre_show(window& window)
|
||||
void custom_tod::pre_show(window& window)
|
||||
{
|
||||
assert(!tods_.empty());
|
||||
|
||||
|
@ -261,7 +263,7 @@ void tcustom_tod::pre_show(window& window)
|
|||
= find_widget<label>(&window, "tod_number", false, true);
|
||||
|
||||
connect_signal_mouse_left_click(find_widget<button>(&window, "image_button", false),
|
||||
std::bind(&tcustom_tod::select_file,
|
||||
std::bind(&custom_tod::select_file,
|
||||
this,
|
||||
get_selected_tod().image,
|
||||
"data/core/images/misc",
|
||||
|
@ -269,7 +271,7 @@ void tcustom_tod::pre_show(window& window)
|
|||
std::ref(window)));
|
||||
|
||||
connect_signal_mouse_left_click(find_widget<button>(&window, "mask_button", false),
|
||||
std::bind(&tcustom_tod::select_file,
|
||||
std::bind(&custom_tod::select_file,
|
||||
this,
|
||||
get_selected_tod().image_mask,
|
||||
"data/core/images",
|
||||
|
@ -277,7 +279,7 @@ void tcustom_tod::pre_show(window& window)
|
|||
std::ref(window)));
|
||||
|
||||
connect_signal_mouse_left_click(find_widget<button>(&window, "sound_button", false),
|
||||
std::bind(&tcustom_tod::select_file,
|
||||
std::bind(&custom_tod::select_file,
|
||||
this,
|
||||
get_selected_tod().sounds,
|
||||
"data/core/sounds/ambient",
|
||||
|
@ -286,41 +288,41 @@ void tcustom_tod::pre_show(window& window)
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "next_tod", false),
|
||||
std::bind(&tcustom_tod::do_next_tod, this, std::ref(window)));
|
||||
std::bind(&custom_tod::do_next_tod, this, std::ref(window)));
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "previous_tod", false),
|
||||
std::bind(&tcustom_tod::do_prev_tod, this, std::ref(window)));
|
||||
std::bind(&custom_tod::do_prev_tod, this, std::ref(window)));
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "new", false),
|
||||
std::bind(&tcustom_tod::do_new_tod, this, std::ref(window)));
|
||||
std::bind(&custom_tod::do_new_tod, this, std::ref(window)));
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "delete", false),
|
||||
std::bind(&tcustom_tod::do_delete_tod, this, std::ref(window)));
|
||||
std::bind(&custom_tod::do_delete_tod, this, std::ref(window)));
|
||||
|
||||
connect_signal_notify_modified(
|
||||
*(lawful_bonus_field_->get_widget()),
|
||||
std::bind(&tcustom_tod::update_lawful_bonus,
|
||||
std::bind(&custom_tod::update_lawful_bonus,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
||||
connect_signal_notify_modified(
|
||||
*tod_red_field_,
|
||||
std::bind(&tcustom_tod::update_tod_display,
|
||||
std::bind(&custom_tod::update_tod_display,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
||||
connect_signal_notify_modified(
|
||||
*tod_green_field_,
|
||||
std::bind(&tcustom_tod::update_tod_display,
|
||||
std::bind(&custom_tod::update_tod_display,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
||||
connect_signal_notify_modified(
|
||||
*tod_blue_field_,
|
||||
std::bind(&tcustom_tod::update_tod_display,
|
||||
std::bind(&custom_tod::update_tod_display,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
||||
|
@ -339,7 +341,7 @@ void tcustom_tod::pre_show(window& window)
|
|||
update_selected_tod_info(window);
|
||||
}
|
||||
|
||||
void tcustom_tod::post_show(window& window)
|
||||
void custom_tod::post_show(window& window)
|
||||
{
|
||||
update_tod_display(window);
|
||||
|
||||
|
@ -348,4 +350,5 @@ void tcustom_tod::post_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -38,15 +38,18 @@ class image;
|
|||
class slider;
|
||||
class text_box;
|
||||
|
||||
class tcustom_tod : public tdialog
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class custom_tod : public modal_dialog
|
||||
{
|
||||
public:
|
||||
tcustom_tod(display& display,
|
||||
custom_tod(display& display,
|
||||
const std::vector<time_of_day>& tods);
|
||||
|
||||
static bool execute(display& display, const std::vector<time_of_day>& tods)
|
||||
{
|
||||
return tcustom_tod(display, tods).show(display.video());
|
||||
return custom_tod(display, tods).show(display.video());
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -74,13 +77,13 @@ private:
|
|||
|
||||
void update_selected_tod_info(window& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
|
||||
/** Current map generator index */
|
||||
|
@ -109,6 +112,7 @@ private:
|
|||
display& display_;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -49,7 +51,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(editor_edit_label)
|
||||
|
||||
teditor_edit_label::teditor_edit_label(std::string& text,
|
||||
editor_edit_label::editor_edit_label(std::string& text,
|
||||
bool& immutable,
|
||||
bool& visible_fog,
|
||||
bool& visible_shroud,
|
||||
|
@ -80,17 +82,18 @@ teditor_edit_label::teditor_edit_label(std::string& text,
|
|||
register_color_component("slider_blue", &SDL_Color::b);
|
||||
}
|
||||
|
||||
void teditor_edit_label::register_color_component(std::string widget_id, Uint8 SDL_Color::* component) {
|
||||
void editor_edit_label::register_color_component(std::string widget_id, Uint8 SDL_Color::* component) {
|
||||
register_integer(widget_id, true,
|
||||
std::bind(&teditor_edit_label::load_color_component, this, component),
|
||||
std::bind(&teditor_edit_label::save_color_component, this, component, _1));
|
||||
std::bind(&editor_edit_label::load_color_component, this, component),
|
||||
std::bind(&editor_edit_label::save_color_component, this, component, _1));
|
||||
}
|
||||
|
||||
int teditor_edit_label::load_color_component(Uint8 SDL_Color::* component) {
|
||||
int editor_edit_label::load_color_component(Uint8 SDL_Color::* component) {
|
||||
return color_store.*component;
|
||||
}
|
||||
|
||||
void teditor_edit_label::save_color_component(Uint8 SDL_Color::* component, const int value) {
|
||||
void editor_edit_label::save_color_component(Uint8 SDL_Color::* component, const int value) {
|
||||
color_store.*component = value;
|
||||
}
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class teditor_edit_label : public tdialog
|
||||
class editor_edit_label : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -33,14 +35,14 @@ public:
|
|||
* the dialog returns @ref window::OK
|
||||
* undefined otherwise.
|
||||
*/
|
||||
teditor_edit_label(std::string& text,
|
||||
editor_edit_label(std::string& text,
|
||||
bool& immutable,
|
||||
bool& visible_fog,
|
||||
bool& visible_shroud,
|
||||
SDL_Color& color,
|
||||
std::string& category);
|
||||
|
||||
/** The execute function see @ref tdialog for more information. */
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(std::string& text,
|
||||
bool& immutable,
|
||||
bool& visible_fog,
|
||||
|
@ -49,7 +51,7 @@ public:
|
|||
std::string& category,
|
||||
CVideo& video)
|
||||
{
|
||||
return teditor_edit_label(text, immutable, visible_fog, visible_shroud, color, category)
|
||||
return editor_edit_label(text, immutable, visible_fog, visible_shroud, color, category)
|
||||
.show(video);
|
||||
}
|
||||
|
||||
|
@ -58,9 +60,10 @@ private:
|
|||
int load_color_component(Uint8 SDL_Color::* component);
|
||||
void save_color_component(Uint8 SDL_Color::* component, const int value);
|
||||
void register_color_component(std::string widget_id, Uint8 SDL_Color::* component);
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_EDIT_LABEL_INCLUDED */
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -46,7 +48,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(editor_edit_scenario)
|
||||
|
||||
teditor_edit_scenario::teditor_edit_scenario(
|
||||
editor_edit_scenario::editor_edit_scenario(
|
||||
std::string& id,
|
||||
std::string& name,
|
||||
std::string& description,
|
||||
|
@ -65,4 +67,5 @@ teditor_edit_scenario::teditor_edit_scenario(
|
|||
victory_when_enemies_defeated);
|
||||
register_bool("random_start_time", true, random_start_time);
|
||||
}
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -19,11 +19,13 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class teditor_edit_scenario : public tdialog
|
||||
class editor_edit_scenario : public modal_dialog
|
||||
{
|
||||
public:
|
||||
teditor_edit_scenario(std::string& id,
|
||||
editor_edit_scenario(std::string& id,
|
||||
std::string& name,
|
||||
std::string& description,
|
||||
int& turns,
|
||||
|
@ -31,7 +33,7 @@ public:
|
|||
bool& victory_when_enemies_defeated,
|
||||
bool& random_start_time);
|
||||
|
||||
/** The execute function see @ref tdialog for more information. */
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(std::string& id,
|
||||
std::string& name,
|
||||
std::string& description,
|
||||
|
@ -41,7 +43,7 @@ public:
|
|||
bool& random_start_time,
|
||||
CVideo& video)
|
||||
{
|
||||
return teditor_edit_scenario(id,
|
||||
return editor_edit_scenario(id,
|
||||
name,
|
||||
description,
|
||||
turns,
|
||||
|
@ -51,9 +53,10 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_EDIT_LABEL_INCLUDED */
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -50,7 +52,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(editor_edit_side)
|
||||
|
||||
teditor_edit_side::teditor_edit_side(editor::editor_team_info& info)
|
||||
editor_edit_side::editor_edit_side(editor::editor_team_info& info)
|
||||
: controller_(info.controller)
|
||||
, share_vision_(info.share_vision)
|
||||
{
|
||||
|
@ -72,7 +74,7 @@ teditor_edit_side::teditor_edit_side(editor::editor_team_info& info)
|
|||
register_bool("hidden", true, info.hidden);
|
||||
}
|
||||
|
||||
void teditor_edit_side::pre_show(window& window)
|
||||
void editor_edit_side::pre_show(window& window)
|
||||
{
|
||||
controller_group.add_member(&find_widget<toggle_button>(&window, "controller_human", false), team::CONTROLLER::HUMAN);
|
||||
controller_group.add_member(&find_widget<toggle_button>(&window, "controller_ai", false), team::CONTROLLER::AI);
|
||||
|
@ -87,10 +89,11 @@ void teditor_edit_side::pre_show(window& window)
|
|||
vision_group.set_member_states(share_vision_);
|
||||
}
|
||||
|
||||
void teditor_edit_side::post_show(window&)
|
||||
void editor_edit_side::post_show(window&)
|
||||
{
|
||||
controller_ = controller_group.get_active_member_value();
|
||||
share_vision_ = vision_group.get_active_member_value();
|
||||
}
|
||||
|
||||
} // end namespace gui2
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -25,15 +25,18 @@ namespace gui2
|
|||
|
||||
class toggle_button;
|
||||
|
||||
class teditor_edit_side : public tdialog
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class editor_edit_side : public modal_dialog
|
||||
{
|
||||
public:
|
||||
explicit teditor_edit_side(editor::editor_team_info& info);
|
||||
explicit editor_edit_side(editor::editor_team_info& info);
|
||||
|
||||
/** The execute function see @ref tdialog for more information. */
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(editor::editor_team_info& info, CVideo& video)
|
||||
{
|
||||
return teditor_edit_side(info).show(video);
|
||||
return editor_edit_side(info).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -46,9 +49,10 @@ private:
|
|||
team::SHARE_VISION& share_vision_;
|
||||
group<team::SHARE_VISION> vision_group;
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_EDIT_LABEL_INCLUDED */
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -61,7 +63,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(editor_generate_map)
|
||||
|
||||
teditor_generate_map::teditor_generate_map()
|
||||
editor_generate_map::editor_generate_map()
|
||||
: map_generators_()
|
||||
, last_map_generator_(nullptr)
|
||||
, current_map_generator_(0)
|
||||
|
@ -69,7 +71,7 @@ teditor_generate_map::teditor_generate_map()
|
|||
{
|
||||
}
|
||||
|
||||
void teditor_generate_map::do_generator_selected(window& window)
|
||||
void editor_generate_map::do_generator_selected(window& window)
|
||||
{
|
||||
listbox& list = find_widget<listbox>(&window, "generators_list", false);
|
||||
const int current = list.get_selected_row();
|
||||
|
@ -84,24 +86,24 @@ void teditor_generate_map::do_generator_selected(window& window)
|
|||
current_map_generator_ = current;
|
||||
}
|
||||
|
||||
void teditor_generate_map::do_settings()
|
||||
void editor_generate_map::do_settings()
|
||||
{
|
||||
get_selected_map_generator()->user_config();
|
||||
}
|
||||
|
||||
map_generator* teditor_generate_map::get_selected_map_generator()
|
||||
map_generator* editor_generate_map::get_selected_map_generator()
|
||||
{
|
||||
assert(static_cast<size_t>(current_map_generator_)
|
||||
< map_generators_.size());
|
||||
return map_generators_[current_map_generator_];
|
||||
}
|
||||
|
||||
void teditor_generate_map::select_map_generator(map_generator* mg)
|
||||
void editor_generate_map::select_map_generator(map_generator* mg)
|
||||
{
|
||||
last_map_generator_ = mg;
|
||||
}
|
||||
|
||||
void teditor_generate_map::pre_show(window& window)
|
||||
void editor_generate_map::pre_show(window& window)
|
||||
{
|
||||
assert(!map_generators_.empty());
|
||||
|
||||
|
@ -132,15 +134,15 @@ void teditor_generate_map::pre_show(window& window)
|
|||
}
|
||||
|
||||
list.set_callback_item_change(
|
||||
std::bind(&teditor_generate_map::do_generator_selected, this, std::ref(window)));
|
||||
std::bind(&editor_generate_map::do_generator_selected, this, std::ref(window)));
|
||||
|
||||
button& settings_button = find_widget<button>(&window, "settings", false);
|
||||
connect_signal_mouse_left_click(
|
||||
settings_button,
|
||||
std::bind(&teditor_generate_map::do_settings,this));
|
||||
std::bind(&editor_generate_map::do_settings,this));
|
||||
}
|
||||
|
||||
boost::optional<uint32_t> teditor_generate_map::get_seed()
|
||||
boost::optional<uint32_t> editor_generate_map::get_seed()
|
||||
{
|
||||
try {
|
||||
return lexical_cast<uint32_t>(random_seed_);
|
||||
|
@ -150,4 +152,5 @@ boost::optional<uint32_t> teditor_generate_map::get_seed()
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -28,11 +28,14 @@ namespace gui2
|
|||
class label;
|
||||
class text_box;
|
||||
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/** The dialog for selecting which random generator to use in the editor. */
|
||||
class teditor_generate_map : public tdialog
|
||||
class editor_generate_map : public modal_dialog
|
||||
{
|
||||
public:
|
||||
teditor_generate_map();
|
||||
editor_generate_map();
|
||||
|
||||
void set_map_generators(std::vector<map_generator*> mg)
|
||||
{
|
||||
|
@ -51,10 +54,10 @@ public:
|
|||
boost::optional<uint32_t> get_seed();
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Callback for generator list selection changes. */
|
||||
|
@ -76,6 +79,7 @@ private:
|
|||
std::string random_seed_;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
static int max_coastal = 5;
|
||||
static int extra_size_per_player = 2;
|
||||
|
@ -33,7 +35,7 @@ static int min_size = 20;
|
|||
|
||||
REGISTER_DIALOG(generator_settings)
|
||||
|
||||
tgenerator_settings::tgenerator_settings(generator_data& data)
|
||||
generator_settings::generator_settings(generator_data& data)
|
||||
: players_(register_integer("players", true, data.nplayers))
|
||||
, width_(register_integer("width", true, data.width))
|
||||
, height_(register_integer("height", true, data.height))
|
||||
|
@ -50,12 +52,12 @@ tgenerator_settings::tgenerator_settings(generator_data& data)
|
|||
register_bool("show_labels", true, data.show_labels);
|
||||
}
|
||||
|
||||
void tgenerator_settings::pre_show(window& window)
|
||||
void generator_settings::pre_show(window& window)
|
||||
{
|
||||
// We adjust the minimum values of the width and height sliders when the number of players changes.
|
||||
// This is done because the map generator needs more space to generate more castles for more players.
|
||||
connect_signal_notify_modified(*players_->get_widget(), std::bind(
|
||||
&tgenerator_settings::adjust_minimum_size_by_players, this, std::ref(window)));
|
||||
&generator_settings::adjust_minimum_size_by_players, this, std::ref(window)));
|
||||
|
||||
gui2::bind_status_label<slider>(window, "players");
|
||||
|
||||
|
@ -68,7 +70,7 @@ void tgenerator_settings::pre_show(window& window)
|
|||
return s.get_value() == 0 ? _("Inland") : (s.get_value() < max_coastal ? _("Coastal") : _("Island")); });
|
||||
}
|
||||
|
||||
void tgenerator_settings::adjust_minimum_size_by_players(window& window)
|
||||
void generator_settings::adjust_minimum_size_by_players(window& window)
|
||||
{
|
||||
const int extra_size = (players_->get_widget_value(window) - 2) * extra_size_per_player;
|
||||
|
||||
|
@ -84,4 +86,5 @@ void tgenerator_settings::adjust_minimum_size_by_players(window& window)
|
|||
update_height_label_();
|
||||
}
|
||||
|
||||
} // end namespace gui2
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -23,15 +23,18 @@ namespace gui2
|
|||
class label;
|
||||
class slider;
|
||||
|
||||
class tgenerator_settings : public tdialog
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class generator_settings : public modal_dialog
|
||||
{
|
||||
public:
|
||||
explicit tgenerator_settings(generator_data& data);
|
||||
explicit generator_settings(generator_data& data);
|
||||
|
||||
/** The execute function see @ref tdialog for more information. */
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(generator_data& data, CVideo& video)
|
||||
{
|
||||
return tgenerator_settings(data).show(video);
|
||||
return generator_settings(data).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -39,7 +42,7 @@ private:
|
|||
|
||||
void adjust_minimum_size_by_players(window& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** We need to own these fields to access the underlying widget */
|
||||
|
@ -50,6 +53,7 @@ private:
|
|||
std::function<void()> update_width_label_, update_height_label_;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_GENERATOR_SETTINGS_HPP_INCLUDED */
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -41,10 +43,11 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(editor_new_map)
|
||||
|
||||
teditor_new_map::teditor_new_map(int& width, int& height)
|
||||
editor_new_map::editor_new_map(int& width, int& height)
|
||||
{
|
||||
register_integer("width", true, width);
|
||||
register_integer("height", true, height);
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class teditor_new_map : public tdialog
|
||||
class editor_new_map : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -37,19 +39,20 @@ public:
|
|||
* the dialog returns @ref window::OK
|
||||
* undefined otherwise.
|
||||
*/
|
||||
teditor_new_map(int& width, int& height);
|
||||
editor_new_map(int& width, int& height);
|
||||
|
||||
/** The execute function see @ref tdialog for more information. */
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(int& width, int& height, CVideo& video)
|
||||
{
|
||||
return teditor_new_map(width, height).show(video);
|
||||
return editor_new_map(width, height).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -88,7 +90,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(editor_resize_map)
|
||||
|
||||
teditor_resize_map::teditor_resize_map(int& width,
|
||||
editor_resize_map::editor_resize_map(int& width,
|
||||
int& height,
|
||||
EXPAND_DIRECTION& expand_direction,
|
||||
bool& copy_edge_terrain)
|
||||
|
@ -104,19 +106,19 @@ teditor_resize_map::teditor_resize_map(int& width,
|
|||
register_label("old_height", false, std::to_string(height));
|
||||
}
|
||||
|
||||
void teditor_resize_map::pre_show(window& window)
|
||||
void editor_resize_map::pre_show(window& window)
|
||||
{
|
||||
slider& height = find_widget<slider>(&window, "height", false);
|
||||
connect_signal_notify_modified(
|
||||
height,
|
||||
std::bind(&teditor_resize_map::update_expand_direction,
|
||||
std::bind(&editor_resize_map::update_expand_direction,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
||||
slider& width = find_widget<slider>(&window, "width", false);
|
||||
connect_signal_notify_modified(
|
||||
width,
|
||||
std::bind(&teditor_resize_map::update_expand_direction,
|
||||
std::bind(&editor_resize_map::update_expand_direction,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
||||
|
@ -127,8 +129,8 @@ void teditor_resize_map::pre_show(window& window)
|
|||
= find_widget<toggle_button>(&window, name, false, true);
|
||||
|
||||
direction_buttons_[i]->set_callback_state_change(
|
||||
dialog_callback<teditor_resize_map,
|
||||
&teditor_resize_map::update_expand_direction>);
|
||||
dialog_callback<editor_resize_map,
|
||||
&editor_resize_map::update_expand_direction>);
|
||||
}
|
||||
direction_buttons_[0]->set_value(true);
|
||||
update_expand_direction(window);
|
||||
|
@ -147,7 +149,7 @@ static int resize_grid_xy_to_idx(const int x, const int y)
|
|||
}
|
||||
}
|
||||
|
||||
void teditor_resize_map::set_direction_icon(int index, std::string icon)
|
||||
void editor_resize_map::set_direction_icon(int index, std::string icon)
|
||||
{
|
||||
if(index < 9) {
|
||||
direction_buttons_[index]->set_icon_name("icons/arrows/arrows_blank_"
|
||||
|
@ -155,7 +157,7 @@ void teditor_resize_map::set_direction_icon(int index, std::string icon)
|
|||
}
|
||||
}
|
||||
|
||||
void teditor_resize_map::update_expand_direction(window& window)
|
||||
void editor_resize_map::update_expand_direction(window& window)
|
||||
{
|
||||
for(int i = 0; i < 9; ++i) {
|
||||
if(direction_buttons_[i]->get_value()
|
||||
|
@ -212,4 +214,5 @@ void teditor_resize_map::update_expand_direction(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -22,7 +22,10 @@ namespace gui2
|
|||
|
||||
class toggle_button;
|
||||
|
||||
class teditor_resize_map : public tdialog
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class editor_resize_map : public modal_dialog
|
||||
{
|
||||
public:
|
||||
enum EXPAND_DIRECTION {
|
||||
|
@ -65,19 +68,19 @@ public:
|
|||
* toggle if the dialog returns @ref
|
||||
* window::OK undefined otherwise.
|
||||
*/
|
||||
teditor_resize_map(int& width,
|
||||
editor_resize_map(int& width,
|
||||
int& height,
|
||||
EXPAND_DIRECTION& expand_direction,
|
||||
bool& copy_edge_terrain);
|
||||
|
||||
/** The execute function see @ref tdialog for more information. */
|
||||
/** 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 teditor_resize_map(
|
||||
return editor_resize_map(
|
||||
width, height, expand_direction, copy_edge_terrain)
|
||||
.show(video);
|
||||
}
|
||||
|
@ -110,13 +113,14 @@ private:
|
|||
|
||||
void set_direction_icon(int index, std::string icon);
|
||||
|
||||
/** Inherited from tdialog */
|
||||
/** Inherited from modal_dialog */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -63,7 +65,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(editor_set_starting_position)
|
||||
|
||||
teditor_set_starting_position::teditor_set_starting_position(
|
||||
editor_set_starting_position::editor_set_starting_position(
|
||||
unsigned current_player,
|
||||
unsigned maximum_players,
|
||||
const std::vector<map_location>& starting_positions)
|
||||
|
@ -75,7 +77,7 @@ teditor_set_starting_position::teditor_set_starting_position(
|
|||
}
|
||||
}
|
||||
|
||||
void teditor_set_starting_position::pre_show(window& window)
|
||||
void editor_set_starting_position::pre_show(window& window)
|
||||
{
|
||||
listbox& list = find_widget<listbox>(&window, "listbox", false);
|
||||
window.keyboard_capture(&list);
|
||||
|
@ -111,7 +113,7 @@ void teditor_set_starting_position::pre_show(window& window)
|
|||
list.select_row(selection_);
|
||||
}
|
||||
|
||||
void teditor_set_starting_position::post_show(window& window)
|
||||
void editor_set_starting_position::post_show(window& window)
|
||||
{
|
||||
if(get_retval() != window::OK) {
|
||||
return;
|
||||
|
@ -120,4 +122,5 @@ void teditor_set_starting_position::post_show(window& window)
|
|||
listbox& list = find_widget<listbox>(&window, "listbox", false);
|
||||
selection_ = list.get_selected_row();
|
||||
}
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -23,11 +23,13 @@ struct map_location;
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class teditor_set_starting_position : public tdialog
|
||||
class editor_set_starting_position : public modal_dialog
|
||||
{
|
||||
public:
|
||||
teditor_set_starting_position(
|
||||
editor_set_starting_position(
|
||||
unsigned current_player,
|
||||
unsigned maximum_players,
|
||||
const std::vector<map_location>& starting_positions);
|
||||
|
@ -41,15 +43,16 @@ private:
|
|||
unsigned selection_;
|
||||
std::vector<map_location> starting_positions_;
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_EDITOR_SET_STARTING_POSITION_HPP_INCLUDED */
|
||||
|
|
|
@ -34,10 +34,12 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
REGISTER_DIALOG(end_credits)
|
||||
|
||||
tend_credits::tend_credits(const std::string& campaign)
|
||||
end_credits::end_credits(const std::string& campaign)
|
||||
: focus_on_(campaign)
|
||||
, backgrounds_()
|
||||
, timer_id_()
|
||||
|
@ -46,7 +48,7 @@ tend_credits::tend_credits(const std::string& campaign)
|
|||
{
|
||||
}
|
||||
|
||||
tend_credits::~tend_credits()
|
||||
end_credits::~end_credits()
|
||||
{
|
||||
if(timer_id_ != 0) {
|
||||
remove_timer(timer_id_);
|
||||
|
@ -69,14 +71,14 @@ static void parse_about_tags(const config& cfg, std::stringstream& ss)
|
|||
}
|
||||
}
|
||||
|
||||
void tend_credits::pre_show(window& window)
|
||||
void end_credits::pre_show(window& window)
|
||||
{
|
||||
timer_id_ = add_timer(10, std::bind(&tend_credits::timer_callback, this), true);
|
||||
timer_id_ = add_timer(10, std::bind(&end_credits::timer_callback, this), true);
|
||||
|
||||
// Delay a little before beginning the scrolling
|
||||
last_scroll_ = SDL_GetTicks() + 3000;
|
||||
|
||||
connect_signal_pre_key_press(window, std::bind(&tend_credits::key_press_callback, this, _3, _4, _5));
|
||||
connect_signal_pre_key_press(window, std::bind(&end_credits::key_press_callback, this, _3, _4, _5));
|
||||
|
||||
std::stringstream ss;
|
||||
std::stringstream focus_ss;
|
||||
|
@ -125,7 +127,7 @@ void tend_credits::pre_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
void tend_credits::timer_callback()
|
||||
void end_credits::timer_callback()
|
||||
{
|
||||
uint32_t now = SDL_GetTicks();
|
||||
if(last_scroll_ > now) {
|
||||
|
@ -149,7 +151,7 @@ void tend_credits::timer_callback()
|
|||
}
|
||||
}
|
||||
|
||||
void tend_credits::key_press_callback(bool&, bool&, const SDL_Keycode key)
|
||||
void end_credits::key_press_callback(bool&, bool&, const SDL_Keycode key)
|
||||
{
|
||||
if(key == SDLK_UP && scroll_speed_ < 400) {
|
||||
scroll_speed_ <<= 1;
|
||||
|
@ -160,4 +162,5 @@ void tend_credits::key_press_callback(bool&, bool&, const SDL_Keycode key)
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -28,23 +28,26 @@ namespace gui2
|
|||
|
||||
class scroll_label;
|
||||
|
||||
class tend_credits : public tdialog
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class end_credits : public modal_dialog
|
||||
{
|
||||
public:
|
||||
explicit tend_credits(const std::string& campaign);
|
||||
explicit end_credits(const std::string& campaign);
|
||||
|
||||
~tend_credits();
|
||||
~end_credits();
|
||||
|
||||
static void display(CVideo& video, const std::string& campaign = "")
|
||||
{
|
||||
tend_credits(campaign).show(video);
|
||||
end_credits(campaign).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
void timer_callback();
|
||||
|
@ -64,6 +67,7 @@ private:
|
|||
uint32_t last_scroll_;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_END_CREDITS_HPP_INCLUDED */
|
||||
|
|
|
@ -101,10 +101,12 @@ inline void isort_dir_entries(std::vector<std::string>& entries)
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
REGISTER_DIALOG(file_dialog)
|
||||
|
||||
tfile_dialog::tfile_dialog()
|
||||
file_dialog::file_dialog()
|
||||
: title_(_("Find File"))
|
||||
, msg_()
|
||||
, ok_label_()
|
||||
|
@ -122,7 +124,7 @@ tfile_dialog::tfile_dialog()
|
|||
set_restore(true);
|
||||
}
|
||||
|
||||
std::string tfile_dialog::path() const
|
||||
std::string file_dialog::path() const
|
||||
{
|
||||
const std::string& dir_norm = fs::normalize_path(current_dir_, true);
|
||||
|
||||
|
@ -135,7 +137,7 @@ std::string tfile_dialog::path() const
|
|||
return concat_path(dir_norm, current_entry_);
|
||||
}
|
||||
|
||||
tfile_dialog& tfile_dialog::set_path(const std::string& value)
|
||||
file_dialog& file_dialog::set_path(const std::string& value)
|
||||
{
|
||||
if(value.empty()) {
|
||||
current_dir_ = filesystem_root();
|
||||
|
@ -158,14 +160,14 @@ tfile_dialog& tfile_dialog::set_path(const std::string& value)
|
|||
return *this;
|
||||
}
|
||||
|
||||
tfile_dialog& tfile_dialog::set_filename(const std::string& value)
|
||||
file_dialog& file_dialog::set_filename(const std::string& value)
|
||||
{
|
||||
current_entry_ = value;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void tfile_dialog::pre_show(window& window)
|
||||
void file_dialog::pre_show(window& window)
|
||||
{
|
||||
control& title = find_widget<control>(&window, "title", false);
|
||||
control& message = find_widget<control>(&window, "message", false);
|
||||
|
@ -229,18 +231,18 @@ void tfile_dialog::pre_show(window& window)
|
|||
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
connect_signal_notify_modified(filelist, std::bind(
|
||||
&tfile_dialog::on_row_selected
|
||||
&file_dialog::on_row_selected
|
||||
, *this
|
||||
, std::ref(window)));
|
||||
connect_signal_notify_modified(bookmarks_bar, std::begin(
|
||||
&tfile_dialog::on_bookmark_selected
|
||||
&file_dialog::on_bookmark_selected
|
||||
, *this
|
||||
, std::ref(window)));
|
||||
#else
|
||||
filelist.set_callback_value_change(
|
||||
dialog_callback<tfile_dialog, &tfile_dialog::on_row_selected>);
|
||||
dialog_callback<file_dialog, &file_dialog::on_row_selected>);
|
||||
bookmarks_bar.set_callback_value_change(
|
||||
dialog_callback<tfile_dialog, &tfile_dialog::on_bookmark_selected>);
|
||||
dialog_callback<file_dialog, &file_dialog::on_bookmark_selected>);
|
||||
#endif
|
||||
|
||||
button& mkdir_button = find_widget<button>(&window, "new_dir", false);
|
||||
|
@ -249,13 +251,13 @@ void tfile_dialog::pre_show(window& window)
|
|||
button& bookmark_del_button = find_widget<button>(&window, "remove_bookmark", false);
|
||||
|
||||
connect_signal_mouse_left_click(mkdir_button,
|
||||
std::bind(&tfile_dialog::on_dir_create_cmd, this, std::ref(window)));
|
||||
std::bind(&file_dialog::on_dir_create_cmd, this, std::ref(window)));
|
||||
connect_signal_mouse_left_click(rm_button,
|
||||
std::bind(&tfile_dialog::on_file_delete_cmd, this, std::ref(window)));
|
||||
std::bind(&file_dialog::on_file_delete_cmd, this, std::ref(window)));
|
||||
connect_signal_mouse_left_click(bookmark_add_button,
|
||||
std::bind(&tfile_dialog::on_bookmark_add_cmd, this, std::ref(window)));
|
||||
std::bind(&file_dialog::on_bookmark_add_cmd, this, std::ref(window)));
|
||||
connect_signal_mouse_left_click(bookmark_del_button,
|
||||
std::bind(&tfile_dialog::on_bookmark_del_cmd, this, std::ref(window)));
|
||||
std::bind(&file_dialog::on_bookmark_del_cmd, this, std::ref(window)));
|
||||
|
||||
if(read_only_) {
|
||||
mkdir_button.set_active(false);
|
||||
|
@ -269,10 +271,10 @@ void tfile_dialog::pre_show(window& window)
|
|||
|
||||
window.keyboard_capture(&find_widget<text_box>(&window, "filename", false));
|
||||
window.add_to_keyboard_chain(&filelist);
|
||||
window.set_exit_hook(std::bind(&tfile_dialog::on_exit, this, std::ref(window)));
|
||||
window.set_exit_hook(std::bind(&file_dialog::on_exit, this, std::ref(window)));
|
||||
}
|
||||
|
||||
bool tfile_dialog::on_exit(window& window)
|
||||
bool file_dialog::on_exit(window& window)
|
||||
{
|
||||
if(window.get_retval() == FILE_DIALOG_ITEM_RETVAL) {
|
||||
// Attempting to exit by double clicking items -- only proceeds if the item
|
||||
|
@ -295,7 +297,7 @@ bool tfile_dialog::on_exit(window& window)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool tfile_dialog::is_selection_type_acceptable(tfile_dialog::SELECTION_TYPE stype) const
|
||||
bool file_dialog::is_selection_type_acceptable(file_dialog::SELECTION_TYPE stype) const
|
||||
{
|
||||
// TODO: Adapt for implementing directory selection mode.
|
||||
return save_mode_
|
||||
|
@ -303,7 +305,7 @@ bool tfile_dialog::is_selection_type_acceptable(tfile_dialog::SELECTION_TYPE sty
|
|||
: stype == SELECTION_IS_FILE;
|
||||
}
|
||||
|
||||
bool tfile_dialog::confirm_overwrite(window& window, tfile_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) {
|
||||
|
@ -312,10 +314,10 @@ bool tfile_dialog::confirm_overwrite(window& window, tfile_dialog::SELECTION_TYP
|
|||
|
||||
const std::string& message
|
||||
= _("The file already exists. Do you wish to overwrite it?");
|
||||
return gui2::show_message(window.video(), _("Confirm"), message, gui2::tmessage::yes_no_buttons) != gui2::window::CANCEL;
|
||||
return gui2::show_message(window.video(), _("Confirm"), message, message::yes_no_buttons) != gui2::window::CANCEL;
|
||||
}
|
||||
|
||||
bool tfile_dialog::process_submit_common(window& window, const std::string& name)
|
||||
bool file_dialog::process_submit_common(window& window, const std::string& name)
|
||||
{
|
||||
const auto stype = register_new_selection(name);
|
||||
|
||||
|
@ -351,21 +353,21 @@ bool tfile_dialog::process_submit_common(window& window, const std::string& name
|
|||
return false;
|
||||
}
|
||||
|
||||
bool tfile_dialog::process_fileview_submit(window& window)
|
||||
bool file_dialog::process_fileview_submit(window& window)
|
||||
{
|
||||
listbox& filelist = find_widget<listbox>(&window, "filelist", false);
|
||||
const std::string& selected_name = get_filelist_selection(filelist);
|
||||
return process_submit_common(window, selected_name);
|
||||
}
|
||||
|
||||
bool tfile_dialog::process_textbox_submit(window& window)
|
||||
bool file_dialog::process_textbox_submit(window& window)
|
||||
{
|
||||
text_box& file_textbox = find_widget<text_box>(&window, "filename", false);
|
||||
const std::string& input_name = file_textbox.get_value();
|
||||
return !input_name.empty() && process_submit_common(window, input_name);
|
||||
}
|
||||
|
||||
std::string tfile_dialog::get_filelist_selection(listbox& filelist)
|
||||
std::string file_dialog::get_filelist_selection(listbox& filelist)
|
||||
{
|
||||
const int row = filelist.get_selected_row();
|
||||
|
||||
|
@ -397,7 +399,7 @@ std::string tfile_dialog::get_filelist_selection(listbox& filelist)
|
|||
return "";
|
||||
}
|
||||
|
||||
tfile_dialog::SELECTION_TYPE tfile_dialog::register_new_selection(const std::string& name)
|
||||
file_dialog::SELECTION_TYPE file_dialog::register_new_selection(const std::string& name)
|
||||
{
|
||||
std::string new_path, new_parent;
|
||||
|
||||
|
@ -455,7 +457,7 @@ tfile_dialog::SELECTION_TYPE tfile_dialog::register_new_selection(const std::str
|
|||
return SELECTION_PARENT_NOT_FOUND;
|
||||
}
|
||||
|
||||
void tfile_dialog::set_input_text(text_box& t, const std::string& value)
|
||||
void file_dialog::set_input_text(text_box& t, const std::string& value)
|
||||
{
|
||||
if(value.empty()) {
|
||||
clear_input_text(t);
|
||||
|
@ -475,7 +477,7 @@ void tfile_dialog::set_input_text(text_box& t, const std::string& value)
|
|||
}
|
||||
}
|
||||
|
||||
void tfile_dialog::clear_input_text(text_box& t)
|
||||
void file_dialog::clear_input_text(text_box& t)
|
||||
{
|
||||
if(save_mode_ && !extension_.empty()) {
|
||||
t.set_value(extension_);
|
||||
|
@ -485,7 +487,7 @@ void tfile_dialog::clear_input_text(text_box& t)
|
|||
}
|
||||
}
|
||||
|
||||
void tfile_dialog::refresh_fileview(window& window)
|
||||
void file_dialog::refresh_fileview(window& window)
|
||||
{
|
||||
cursor::setter cur{cursor::WAIT};
|
||||
|
||||
|
@ -532,7 +534,7 @@ void tfile_dialog::refresh_fileview(window& window)
|
|||
set_input_text(find_widget<text_box>(&window, "filename", false), current_entry_);
|
||||
}
|
||||
|
||||
void tfile_dialog::push_fileview_row(listbox& filelist, const std::string& name, const std::string& icon, bool check_selection)
|
||||
void file_dialog::push_fileview_row(listbox& filelist, const std::string& name, const std::string& icon, bool check_selection)
|
||||
{
|
||||
// TODO: Hopefully some day GUI2 will allow us to make labels be ellipsized
|
||||
// dynamically at layout/rendering time.
|
||||
|
@ -559,7 +561,7 @@ void tfile_dialog::push_fileview_row(listbox& filelist, const std::string& name,
|
|||
}
|
||||
}
|
||||
|
||||
void tfile_dialog::sync_bookmarks_bar(window& window)
|
||||
void file_dialog::sync_bookmarks_bar(window& window)
|
||||
{
|
||||
listbox& bookmarks_bar = find_widget<listbox>(&window, "bookmarks", false);
|
||||
|
||||
|
@ -600,7 +602,7 @@ void tfile_dialog::sync_bookmarks_bar(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
void tfile_dialog::on_row_selected(window& window)
|
||||
void file_dialog::on_row_selected(window& window)
|
||||
{
|
||||
listbox& filelist = find_widget<listbox>(&window, "filelist", false);
|
||||
text_box& file_textbox = find_widget<text_box>(&window, "filename", false);
|
||||
|
@ -624,7 +626,7 @@ void tfile_dialog::on_row_selected(window& window)
|
|||
window.keyboard_capture(&file_textbox);
|
||||
}
|
||||
|
||||
void tfile_dialog::on_bookmark_selected(window& window)
|
||||
void file_dialog::on_bookmark_selected(window& window)
|
||||
{
|
||||
// Don't let us steal the focus from the primary widgets.
|
||||
text_box& file_textbox = find_widget<text_box>(&window, "filename", false);
|
||||
|
@ -654,13 +656,13 @@ void tfile_dialog::on_bookmark_selected(window& window)
|
|||
&& current_bookmark_ >= user_bookmarks_begin_);
|
||||
}
|
||||
|
||||
void tfile_dialog::on_bookmark_add_cmd(window& window)
|
||||
void file_dialog::on_bookmark_add_cmd(window& window)
|
||||
{
|
||||
const std::string& default_label = fs::base_name(current_dir_);
|
||||
|
||||
std::string label = default_label;
|
||||
|
||||
const bool confirm = gui2::tbookmark_create::execute(label, window.video());
|
||||
const bool confirm = tbookmark_create::execute(label, window.video());
|
||||
if(!confirm) {
|
||||
return;
|
||||
}
|
||||
|
@ -688,7 +690,7 @@ void tfile_dialog::on_bookmark_add_cmd(window& window)
|
|||
sync_bookmarks_bar(window);
|
||||
}
|
||||
|
||||
void tfile_dialog::on_bookmark_del_cmd(window& window)
|
||||
void file_dialog::on_bookmark_del_cmd(window& window)
|
||||
{
|
||||
assert(user_bookmarks_begin_ >= 0
|
||||
&& current_bookmark_ >= 0
|
||||
|
@ -705,11 +707,11 @@ void tfile_dialog::on_bookmark_del_cmd(window& window)
|
|||
sync_bookmarks_bar(window);
|
||||
}
|
||||
|
||||
void tfile_dialog::on_dir_create_cmd(window& window)
|
||||
void file_dialog::on_dir_create_cmd(window& window)
|
||||
{
|
||||
std::string new_dir_name;
|
||||
|
||||
if(tfolder_create::execute(new_dir_name, window.video())) {
|
||||
if(folder_create::execute(new_dir_name, window.video())) {
|
||||
const std::string& new_path = concat_path(current_dir_, new_dir_name);
|
||||
|
||||
if(!fs::make_directory(new_path)) {
|
||||
|
@ -722,7 +724,7 @@ void tfile_dialog::on_dir_create_cmd(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
void tfile_dialog::on_file_delete_cmd(window& window)
|
||||
void file_dialog::on_file_delete_cmd(window& window)
|
||||
{
|
||||
if(current_entry_.empty()) {
|
||||
return;
|
||||
|
@ -736,7 +738,7 @@ void tfile_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, gui2::tmessage::yes_no_buttons) == gui2::window::CANCEL) {
|
||||
if(gui2::show_message(window.video(), _("Confirm"), message, message::yes_no_buttons) == gui2::window::CANCEL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -753,4 +755,5 @@ void tfile_dialog::on_file_delete_cmd(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -32,10 +32,16 @@
|
|||
namespace gui2
|
||||
{
|
||||
|
||||
class tfile_dialog : public tdialog
|
||||
class listbox;
|
||||
class text_box;
|
||||
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class file_dialog : public modal_dialog
|
||||
{
|
||||
public:
|
||||
tfile_dialog();
|
||||
file_dialog();
|
||||
|
||||
/**
|
||||
* Gets the current dialog title text.
|
||||
|
@ -48,7 +54,7 @@ public:
|
|||
/**
|
||||
* Sets the current dialog title text.
|
||||
*/
|
||||
tfile_dialog& set_title(const std::string& value)
|
||||
file_dialog& set_title(const std::string& value)
|
||||
{
|
||||
title_ = value;
|
||||
return *this;
|
||||
|
@ -67,7 +73,7 @@ public:
|
|||
*
|
||||
* The message text may contain Pango markup.
|
||||
*/
|
||||
tfile_dialog& set_message(const std::string& value)
|
||||
file_dialog& set_message(const std::string& value)
|
||||
{
|
||||
msg_ = value;
|
||||
return *this;
|
||||
|
@ -93,7 +99,7 @@ public:
|
|||
* If you want to set an initial file name hint/template, use set_filename()
|
||||
* <b>after</b> calling this method.
|
||||
*/
|
||||
tfile_dialog& set_path(const std::string& value);
|
||||
file_dialog& set_path(const std::string& value);
|
||||
|
||||
/**
|
||||
* Sets the initial file name input but not the path.
|
||||
|
@ -103,7 +109,7 @@ public:
|
|||
* If this is used before set_path() and the path passed there points to a
|
||||
* file, that file name will replace the one given here.
|
||||
*/
|
||||
tfile_dialog& set_filename(const std::string& value);
|
||||
file_dialog& set_filename(const std::string& value);
|
||||
|
||||
/**
|
||||
* Sets the default file extension for file names in save mode.
|
||||
|
@ -117,7 +123,7 @@ public:
|
|||
* The value provided to this method should be preceded by a dot if
|
||||
* applicable (e.g. ".cfg").
|
||||
*/
|
||||
tfile_dialog& set_extension(const std::string& value)
|
||||
file_dialog& set_extension(const std::string& value)
|
||||
{
|
||||
extension_ = value;
|
||||
return *this;
|
||||
|
@ -136,7 +142,7 @@ public:
|
|||
*
|
||||
* This is initially disabled.
|
||||
*/
|
||||
tfile_dialog& set_read_only(bool value)
|
||||
file_dialog& set_read_only(bool value)
|
||||
{
|
||||
read_only_ = value;
|
||||
return *this;
|
||||
|
@ -161,7 +167,7 @@ public:
|
|||
* need not exist already (but their parent directories still do). Otherwise,
|
||||
* the user is only able to select existing files.
|
||||
*/
|
||||
tfile_dialog& set_save_mode(bool value)
|
||||
file_dialog& set_save_mode(bool value)
|
||||
{
|
||||
save_mode_ = value;
|
||||
return *this;
|
||||
|
@ -174,7 +180,7 @@ public:
|
|||
* Calling this method with an empty string will reset the label to the
|
||||
* default.
|
||||
*/
|
||||
tfile_dialog& set_ok_label(const std::string& value)
|
||||
file_dialog& set_ok_label(const std::string& value)
|
||||
{
|
||||
ok_label_ = value;
|
||||
return *this;
|
||||
|
@ -199,10 +205,10 @@ private:
|
|||
int current_bookmark_;
|
||||
int user_bookmarks_begin_;
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Handles dialog exit events and decides whether to proceed or not. */
|
||||
|
@ -307,7 +313,7 @@ private:
|
|||
void push_fileview_row(class listbox& filelist, const std::string& name, const std::string& icon, bool check_selection = true);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -46,17 +48,18 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(folder_create)
|
||||
|
||||
tfolder_create::tfolder_create(std::string& folder_name)
|
||||
folder_create::folder_create(std::string& folder_name)
|
||||
: bookmark_mode_(false)
|
||||
{
|
||||
register_text("name", true, folder_name, true);
|
||||
}
|
||||
|
||||
void tfolder_create::pre_show(window& window)
|
||||
void folder_create::pre_show(window& window)
|
||||
{
|
||||
if(bookmark_mode_) {
|
||||
find_widget<control>(&window, "title", false).set_label(_("New Bookmark"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tfolder_create : public tdialog
|
||||
class folder_create : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -33,12 +35,12 @@ public:
|
|||
* entered if the dialog returns @ref
|
||||
* window::OK; undefined otherwise.
|
||||
*/
|
||||
tfolder_create(std::string& folder_name);
|
||||
folder_create(std::string& folder_name);
|
||||
|
||||
/** The execute function; see @ref tdialog for more information. */
|
||||
/** The execute function; see @ref modal_dialog for more information. */
|
||||
static bool execute(std::string& folder_name, CVideo& video)
|
||||
{
|
||||
return tfolder_create(folder_name).show(video);
|
||||
return folder_create(folder_name).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -47,29 +49,30 @@ private:
|
|||
bool bookmark_mode_;
|
||||
|
||||
/** Changes the dialog caption so it can be used for naming bookmarks. */
|
||||
tfolder_create& enable_bookmark_mode()
|
||||
folder_create& enable_bookmark_mode()
|
||||
{
|
||||
bookmark_mode_ = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
};
|
||||
|
||||
class tbookmark_create
|
||||
{
|
||||
public:
|
||||
/** The execute function; see @ref tdialog for more information. */
|
||||
/** The execute function; see @ref modal_dialog for more information. */
|
||||
static bool execute(std::string& bookmark_name, CVideo& video)
|
||||
{
|
||||
return tfolder_create(bookmark_name).enable_bookmark_mode().show(video);
|
||||
return folder_create(bookmark_name).enable_bookmark_mode().show(video);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_EDIT_LABEL_INCLUDED */
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -66,7 +68,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(formula_debugger)
|
||||
|
||||
void tformula_debugger::pre_show(window& window)
|
||||
void formula_debugger::pre_show(window& window)
|
||||
{
|
||||
// stack label
|
||||
scroll_label* stack_label
|
||||
|
@ -136,28 +138,28 @@ void tformula_debugger::pre_show(window& window)
|
|||
button& step_button = find_widget<button>(&window, "step", false);
|
||||
connect_signal_mouse_left_click(
|
||||
step_button,
|
||||
std::bind(&tformula_debugger::callback_step_button,
|
||||
std::bind(&formula_debugger::callback_step_button,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
||||
button& stepout_button = find_widget<button>(&window, "stepout", false);
|
||||
connect_signal_mouse_left_click(
|
||||
stepout_button,
|
||||
std::bind(&tformula_debugger::callback_stepout_button,
|
||||
std::bind(&formula_debugger::callback_stepout_button,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
||||
button& next_button = find_widget<button>(&window, "next", false);
|
||||
connect_signal_mouse_left_click(
|
||||
next_button,
|
||||
std::bind(&tformula_debugger::callback_next_button,
|
||||
std::bind(&formula_debugger::callback_next_button,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
||||
button& continue_button = find_widget<button>(&window, "continue", false);
|
||||
connect_signal_mouse_left_click(
|
||||
continue_button,
|
||||
std::bind(&tformula_debugger::callback_continue_button,
|
||||
std::bind(&formula_debugger::callback_continue_button,
|
||||
this,
|
||||
std::ref(window)));
|
||||
|
||||
|
@ -169,28 +171,29 @@ void tformula_debugger::pre_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
void tformula_debugger::callback_continue_button(window& window)
|
||||
void formula_debugger::callback_continue_button(window& window)
|
||||
{
|
||||
fdb_.add_breakpoint_continue_to_end();
|
||||
window.set_retval(window::OK);
|
||||
}
|
||||
|
||||
void tformula_debugger::callback_next_button(window& window)
|
||||
void formula_debugger::callback_next_button(window& window)
|
||||
{
|
||||
fdb_.add_breakpoint_next();
|
||||
window.set_retval(window::OK);
|
||||
}
|
||||
|
||||
void tformula_debugger::callback_step_button(window& window)
|
||||
void formula_debugger::callback_step_button(window& window)
|
||||
{
|
||||
fdb_.add_breakpoint_step_into();
|
||||
window.set_retval(window::OK);
|
||||
}
|
||||
|
||||
void tformula_debugger::callback_stepout_button(window& window)
|
||||
void formula_debugger::callback_stepout_button(window& window)
|
||||
{
|
||||
fdb_.add_breakpoint_step_out();
|
||||
window.set_retval(window::OK);
|
||||
}
|
||||
|
||||
} // end of namespace gui2
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -24,19 +24,21 @@ class formula_debugger;
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tformula_debugger : public tdialog
|
||||
class formula_debugger : public modal_dialog
|
||||
{
|
||||
public:
|
||||
explicit tformula_debugger(game_logic::formula_debugger& fdb) : fdb_(fdb)
|
||||
explicit formula_debugger(game_logic::formula_debugger& fdb) : fdb_(fdb)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/***** ***** button callbacks ***** *****/
|
||||
|
@ -51,6 +53,7 @@ private:
|
|||
game_logic::formula_debugger& fdb_;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_FORMULA_DEBUGGER_HPP_INCLUDED */
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -75,7 +77,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(game_cache_options)
|
||||
|
||||
tgame_cache_options::tgame_cache_options()
|
||||
game_cache_options::game_cache_options()
|
||||
: cache_path_(filesystem::get_cache_dir())
|
||||
, clean_button_(nullptr)
|
||||
, purge_button_(nullptr)
|
||||
|
@ -83,7 +85,7 @@ tgame_cache_options::tgame_cache_options()
|
|||
{
|
||||
}
|
||||
|
||||
void tgame_cache_options::pre_show(window& window)
|
||||
void game_cache_options::pre_show(window& window)
|
||||
{
|
||||
clean_button_ = &find_widget<button>(&window, "clean", false);
|
||||
purge_button_ = &find_widget<button>(&window, "purge", false);
|
||||
|
@ -97,7 +99,7 @@ void tgame_cache_options::pre_show(window& window)
|
|||
|
||||
button& copy = find_widget<button>(&window, "copy", false);
|
||||
connect_signal_mouse_left_click(copy,
|
||||
std::bind(&tgame_cache_options::copy_to_clipboard_callback,
|
||||
std::bind(&game_cache_options::copy_to_clipboard_callback,
|
||||
this));
|
||||
if (!desktop::clipboard::available()) {
|
||||
copy.set_active(false);
|
||||
|
@ -106,26 +108,26 @@ void tgame_cache_options::pre_show(window& window)
|
|||
|
||||
button& browse = find_widget<button>(&window, "browse", false);
|
||||
connect_signal_mouse_left_click(browse,
|
||||
std::bind(&tgame_cache_options::browse_cache_callback,
|
||||
std::bind(&game_cache_options::browse_cache_callback,
|
||||
this));
|
||||
|
||||
connect_signal_mouse_left_click(*clean_button_,
|
||||
std::bind(&tgame_cache_options::clean_cache_callback,
|
||||
std::bind(&game_cache_options::clean_cache_callback,
|
||||
this,
|
||||
std::ref(window.video())));
|
||||
|
||||
connect_signal_mouse_left_click(*purge_button_,
|
||||
std::bind(&tgame_cache_options::purge_cache_callback,
|
||||
std::bind(&game_cache_options::purge_cache_callback,
|
||||
this,
|
||||
std::ref(window.video())));
|
||||
}
|
||||
|
||||
void tgame_cache_options::post_show(window& /*window*/)
|
||||
void game_cache_options::post_show(window& /*window*/)
|
||||
{
|
||||
size_label_ = nullptr;
|
||||
}
|
||||
|
||||
void tgame_cache_options::update_cache_size_display()
|
||||
void game_cache_options::update_cache_size_display()
|
||||
{
|
||||
if(!size_label_) {
|
||||
return;
|
||||
|
@ -146,17 +148,17 @@ void tgame_cache_options::update_cache_size_display()
|
|||
}
|
||||
}
|
||||
|
||||
void tgame_cache_options::copy_to_clipboard_callback()
|
||||
void game_cache_options::copy_to_clipboard_callback()
|
||||
{
|
||||
desktop::clipboard::copy_to_clipboard(cache_path_, false);
|
||||
}
|
||||
|
||||
void tgame_cache_options::browse_cache_callback()
|
||||
void game_cache_options::browse_cache_callback()
|
||||
{
|
||||
desktop::open_object(cache_path_);
|
||||
}
|
||||
|
||||
void tgame_cache_options::clean_cache_callback(CVideo& video)
|
||||
void game_cache_options::clean_cache_callback(CVideo& video)
|
||||
{
|
||||
if(clean_cache()) {
|
||||
show_message(video,
|
||||
|
@ -170,13 +172,13 @@ void tgame_cache_options::clean_cache_callback(CVideo& video)
|
|||
update_cache_size_display();
|
||||
}
|
||||
|
||||
bool tgame_cache_options::clean_cache()
|
||||
bool game_cache_options::clean_cache()
|
||||
{
|
||||
const cursor::setter cs(cursor::WAIT);
|
||||
return game_config::config_cache::instance().clean_cache();
|
||||
}
|
||||
|
||||
void tgame_cache_options::purge_cache_callback(CVideo& video)
|
||||
void game_cache_options::purge_cache_callback(CVideo& video)
|
||||
{
|
||||
if(purge_cache()) {
|
||||
show_message(video,
|
||||
|
@ -190,10 +192,11 @@ void tgame_cache_options::purge_cache_callback(CVideo& video)
|
|||
update_cache_size_display();
|
||||
}
|
||||
|
||||
bool tgame_cache_options::purge_cache()
|
||||
bool game_cache_options::purge_cache()
|
||||
{
|
||||
const cursor::setter cs(cursor::WAIT);
|
||||
return game_config::config_cache::instance().purge_cache();
|
||||
}
|
||||
|
||||
} // end namespace gui2
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -21,21 +21,23 @@ namespace gui2
|
|||
{
|
||||
class label;
|
||||
class button;
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tgame_cache_options : public tdialog
|
||||
class game_cache_options : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/** Constructor. */
|
||||
tgame_cache_options();
|
||||
game_cache_options();
|
||||
|
||||
/**
|
||||
* The display function.
|
||||
*
|
||||
* See @ref tdialog for more information.
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static void display(CVideo& video)
|
||||
{
|
||||
tgame_cache_options().show(video);
|
||||
game_cache_options().show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -57,16 +59,17 @@ private:
|
|||
|
||||
void update_cache_size_display();
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -58,7 +60,7 @@ static void set_dont_ask_again(const bool ask_again)
|
|||
preferences::set_ask_delete_saves(!ask_again);
|
||||
}
|
||||
|
||||
tgame_delete::tgame_delete()
|
||||
game_delete::game_delete()
|
||||
{
|
||||
set_restore(true);
|
||||
|
||||
|
@ -66,4 +68,5 @@ tgame_delete::tgame_delete()
|
|||
"dont_ask_again", true, &get_dont_ask_again, &set_dont_ask_again);
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -19,22 +19,25 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tgame_delete : public tdialog
|
||||
class game_delete : public modal_dialog
|
||||
{
|
||||
public:
|
||||
tgame_delete();
|
||||
game_delete();
|
||||
|
||||
/** The execute function see @ref tdialog for more information. */
|
||||
/** The execute function see @ref modal_dialog for more information. */
|
||||
static bool execute(CVideo& video)
|
||||
{
|
||||
return tgame_delete().show(video);
|
||||
return game_delete().show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -88,7 +90,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(game_load)
|
||||
|
||||
tgame_load::tgame_load(const config& cache_config, savegame::load_game_metadata& data)
|
||||
game_load::game_load(const config& cache_config, savegame::load_game_metadata& data)
|
||||
: filename_(data.filename)
|
||||
, change_difficulty_(register_bool("change_difficulty", true, data.select_difficulty))
|
||||
, show_replay_(register_bool("show_replay", true, data.show_replay))
|
||||
|
@ -100,23 +102,23 @@ tgame_load::tgame_load(const config& cache_config, savegame::load_game_metadata&
|
|||
{
|
||||
}
|
||||
|
||||
void tgame_load::pre_show(window& window)
|
||||
void game_load::pre_show(window& window)
|
||||
{
|
||||
find_widget<minimap>(&window, "minimap", false).set_config(&cache_config_);
|
||||
|
||||
text_box* filter = find_widget<text_box>(&window, "txtFilter", false, true);
|
||||
|
||||
filter->set_text_changed_callback(
|
||||
std::bind(&tgame_load::filter_text_changed, this, _1, _2));
|
||||
std::bind(&game_load::filter_text_changed, this, _1, _2));
|
||||
|
||||
listbox& list = find_widget<listbox>(&window, "savegame_list", false);
|
||||
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
connect_signal_notify_modified(list,
|
||||
std::bind(&tgame_load::display_savegame, *this, std::ref(window)));
|
||||
std::bind(&game_load::display_savegame, *this, std::ref(window)));
|
||||
#else
|
||||
list.set_callback_value_change(
|
||||
dialog_callback<tgame_load, &tgame_load::display_savegame>);
|
||||
dialog_callback<game_load, &game_load::display_savegame>);
|
||||
#endif
|
||||
|
||||
window.keyboard_capture(filter);
|
||||
|
@ -144,13 +146,13 @@ void tgame_load::pre_show(window& window)
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "delete", false),
|
||||
std::bind(&tgame_load::delete_button_callback,
|
||||
std::bind(&game_load::delete_button_callback,
|
||||
this, std::ref(window)));
|
||||
|
||||
display_savegame(window);
|
||||
}
|
||||
|
||||
void tgame_load::display_savegame(window& window)
|
||||
void game_load::display_savegame(window& window)
|
||||
{
|
||||
const int selected_row =
|
||||
find_widget<listbox>(&window, "savegame_list", false).get_selected_row();
|
||||
|
@ -222,7 +224,7 @@ void tgame_load::display_savegame(window& window)
|
|||
change_difficulty_toggle.set_active(!is_replay && is_scenario_start);
|
||||
}
|
||||
|
||||
void tgame_load::filter_text_changed(text_box_base* textbox, const std::string& text)
|
||||
void game_load::filter_text_changed(text_box_base* textbox, const std::string& text)
|
||||
{
|
||||
window& window = *textbox->get_window();
|
||||
|
||||
|
@ -275,7 +277,7 @@ void tgame_load::filter_text_changed(text_box_base* textbox, const std::string&
|
|||
window.set_enter_disabled(!any_shown);
|
||||
}
|
||||
|
||||
void tgame_load::evaluate_summary_string(std::stringstream& str, const config& cfg_summary)
|
||||
void game_load::evaluate_summary_string(std::stringstream& str, const config& cfg_summary)
|
||||
{
|
||||
if(cfg_summary["corrupt"].to_bool()) {
|
||||
str << "\n<span color='#f00'>" << _("(Invalid)") << "</span>";
|
||||
|
@ -345,7 +347,7 @@ void tgame_load::evaluate_summary_string(std::stringstream& str, const config& c
|
|||
}
|
||||
}
|
||||
|
||||
void tgame_load::delete_button_callback(window& window)
|
||||
void game_load::delete_button_callback(window& window)
|
||||
{
|
||||
listbox& list = find_widget<listbox>(&window, "savegame_list", false);
|
||||
|
||||
|
@ -354,7 +356,7 @@ void tgame_load::delete_button_callback(window& window)
|
|||
|
||||
// See if we should ask the user for deletion confirmation
|
||||
if(preferences::ask_delete_saves()) {
|
||||
if(!gui2::tgame_delete::execute(window.video())) {
|
||||
if(!gui2::dialogs::game_delete::execute(window.video())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -376,4 +378,5 @@ void tgame_load::delete_button_callback(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -28,10 +28,13 @@ namespace gui2
|
|||
class listbox;
|
||||
class text_box_base;
|
||||
|
||||
class tgame_load : public tdialog
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class game_load : public modal_dialog
|
||||
{
|
||||
public:
|
||||
tgame_load(const config& cache_config, savegame::load_game_metadata& data);
|
||||
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)
|
||||
{
|
||||
|
@ -40,14 +43,14 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
return tgame_load(cache_config, data).show(video);
|
||||
return game_load(cache_config, data).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
void filter_text_changed(text_box_base* textbox, const std::string& text);
|
||||
|
@ -69,6 +72,7 @@ private:
|
|||
|
||||
std::vector<std::string> last_words_;
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -49,7 +51,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(game_save)
|
||||
|
||||
tgame_save::tgame_save(std::string& filename, const std::string& title)
|
||||
game_save::game_save(std::string& filename, const std::string& title)
|
||||
{
|
||||
set_restore(true);
|
||||
|
||||
|
@ -59,7 +61,7 @@ tgame_save::tgame_save(std::string& filename, const std::string& title)
|
|||
|
||||
REGISTER_DIALOG(game_save_message)
|
||||
|
||||
tgame_save_message::tgame_save_message(std::string& filename,
|
||||
game_save_message::game_save_message(std::string& filename,
|
||||
const std::string& title,
|
||||
const std::string& message)
|
||||
{
|
||||
|
@ -72,7 +74,7 @@ tgame_save_message::tgame_save_message(std::string& filename,
|
|||
|
||||
REGISTER_DIALOG(game_save_oos)
|
||||
|
||||
tgame_save_oos::tgame_save_oos(bool& ignore_all,
|
||||
game_save_oos::game_save_oos(bool& ignore_all,
|
||||
std::string& filename,
|
||||
const std::string& title,
|
||||
const std::string& message)
|
||||
|
@ -86,4 +88,5 @@ tgame_save_oos::tgame_save_oos(bool& ignore_all,
|
|||
set_always_save_fields(true);
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -19,27 +19,29 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tgame_save : public tdialog
|
||||
class game_save : public modal_dialog
|
||||
{
|
||||
public:
|
||||
tgame_save(std::string& filename, const std::string& title);
|
||||
game_save(std::string& filename, const std::string& title);
|
||||
|
||||
static bool
|
||||
execute(std::string& filename, const std::string& title, CVideo& video)
|
||||
{
|
||||
return tgame_save(filename, title).show(video);
|
||||
return game_save(filename, title).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
|
||||
class tgame_save_message : public tdialog
|
||||
class game_save_message : public modal_dialog
|
||||
{
|
||||
public:
|
||||
tgame_save_message(std::string& filename,
|
||||
game_save_message(std::string& filename,
|
||||
const std::string& title,
|
||||
const std::string& message);
|
||||
|
||||
|
@ -48,18 +50,18 @@ public:
|
|||
const std::string& message,
|
||||
CVideo& video)
|
||||
{
|
||||
return tgame_save_message(filename, title, message).show(video);
|
||||
return game_save_message(filename, title, message).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
|
||||
class tgame_save_oos : public tdialog
|
||||
class game_save_oos : public modal_dialog
|
||||
{
|
||||
public:
|
||||
tgame_save_oos(bool& ignore_all,
|
||||
game_save_oos(bool& ignore_all,
|
||||
std::string& filename,
|
||||
const std::string& title,
|
||||
const std::string& message);
|
||||
|
@ -70,13 +72,14 @@ public:
|
|||
const std::string& message,
|
||||
CVideo& video)
|
||||
{
|
||||
return tgame_save_oos(ignore_all, filename, title, message).show(video);
|
||||
return game_save_oos(ignore_all, filename, title, message).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -49,10 +49,12 @@ static lg::log_domain log_display("display");
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
REGISTER_DIALOG(game_stats)
|
||||
|
||||
tgame_stats::tgame_stats(const display_context& board, const int viewing_team, int& selected_index)
|
||||
game_stats::game_stats(const display_context& board, const int viewing_team, int& selected_index)
|
||||
: board_(board)
|
||||
, viewing_team_(board_.teams()[viewing_team])
|
||||
, selected_index_(selected_index)
|
||||
|
@ -62,7 +64,7 @@ tgame_stats::tgame_stats(const display_context& board, const int viewing_team, i
|
|||
}
|
||||
}
|
||||
|
||||
unit_const_ptr tgame_stats::get_leader(const int side)
|
||||
unit_const_ptr game_stats::get_leader(const int side)
|
||||
{
|
||||
unit_map::const_iterator leader = board_.units().find_leader(side);
|
||||
|
||||
|
@ -73,7 +75,7 @@ unit_const_ptr tgame_stats::get_leader(const int side)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void tgame_stats::pre_show(window& window)
|
||||
void game_stats::pre_show(window& window)
|
||||
{
|
||||
listbox& stats_list = find_widget<listbox>(&window, "game_stats_list", false);
|
||||
listbox& settings_list = find_widget<listbox>(&window, "scenario_settings_list", false);
|
||||
|
@ -234,17 +236,17 @@ void tgame_stats::pre_show(window& window)
|
|||
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
connect_signal_notify_modified(*tab_bar,
|
||||
std::bind(&tgame_stats::on_tab_select,
|
||||
std::bind(&game_stats::on_tab_select,
|
||||
*this, std::ref(window)));
|
||||
#else
|
||||
tab_bar.set_callback_value_change(
|
||||
dialog_callback<tgame_stats, &tgame_stats::on_tab_select>);
|
||||
dialog_callback<game_stats, &game_stats::on_tab_select>);
|
||||
#endif
|
||||
|
||||
on_tab_select(window);
|
||||
}
|
||||
|
||||
void tgame_stats::on_tab_select(window& window)
|
||||
void game_stats::on_tab_select(window& window)
|
||||
{
|
||||
const int i = find_widget<listbox>(&window, "tab_bar", false).get_selected_row();
|
||||
|
||||
|
@ -256,7 +258,7 @@ void tgame_stats::on_tab_select(window& window)
|
|||
);
|
||||
}
|
||||
|
||||
void tgame_stats::post_show(window& window)
|
||||
void game_stats::post_show(window& window)
|
||||
{
|
||||
if(get_retval() == window::OK) {
|
||||
const int selected_tab = find_widget<listbox>(&window, "tab_bar", false).get_selected_row();
|
||||
|
@ -266,4 +268,5 @@ void tgame_stats::post_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -30,11 +30,13 @@ struct team_data;
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class tgame_stats : public tdialog
|
||||
class game_stats : public modal_dialog
|
||||
{
|
||||
public:
|
||||
tgame_stats(const display_context& board, const int viewing_team, int& selected_index);
|
||||
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)
|
||||
{
|
||||
|
@ -43,7 +45,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
return tgame_stats(board, viewing_team, selected_index).show(video);
|
||||
return game_stats(board, viewing_team, selected_index).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -60,16 +62,17 @@ private:
|
|||
|
||||
void on_tab_select(window& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void post_show(window& window);
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_GAME_STATS_HPP_INCLUDED */
|
||||
|
|
|
@ -57,6 +57,8 @@ const std::string text_feature_off = "<span color='#f00'>●</span>";
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
|
@ -87,7 +89,7 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(game_version)
|
||||
|
||||
tgame_version::tgame_version()
|
||||
game_version::game_version()
|
||||
: path_wid_stem_("path_")
|
||||
, copy_wid_stem_("copy_")
|
||||
, browse_wid_stem_("browse_")
|
||||
|
@ -124,7 +126,7 @@ tgame_version::tgame_version()
|
|||
generate_plain_text_report();
|
||||
}
|
||||
|
||||
void tgame_version::pre_show(window& window)
|
||||
void game_version::pre_show(window& window)
|
||||
{
|
||||
string_map i18n_syms;
|
||||
|
||||
|
@ -143,7 +145,7 @@ void tgame_version::pre_show(window& window)
|
|||
button& copy_all = find_widget<button>(&window, "copy_all", false);
|
||||
connect_signal_mouse_left_click(
|
||||
copy_all,
|
||||
std::bind(&tgame_version::report_copy_callback, this));
|
||||
std::bind(&game_version::report_copy_callback, this));
|
||||
|
||||
//
|
||||
// Game paths tab.
|
||||
|
@ -166,12 +168,12 @@ void tgame_version::pre_show(window& window)
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
copy_w,
|
||||
std::bind(&tgame_version::copy_to_clipboard_callback,
|
||||
std::bind(&game_version::copy_to_clipboard_callback,
|
||||
this,
|
||||
path_path));
|
||||
connect_signal_mouse_left_click(
|
||||
browse_w,
|
||||
std::bind(&tgame_version::browse_directory_callback,
|
||||
std::bind(&game_version::browse_directory_callback,
|
||||
this,
|
||||
path_path));
|
||||
|
||||
|
@ -196,7 +198,7 @@ void tgame_version::pre_show(window& window)
|
|||
= find_widget<button>(&window, "open_stderr", false);
|
||||
connect_signal_mouse_left_click(
|
||||
stderr_button,
|
||||
std::bind(&tgame_version::browse_directory_callback,
|
||||
std::bind(&game_version::browse_directory_callback,
|
||||
this,
|
||||
log_path_));
|
||||
stderr_button.set_active(!log_path_.empty());
|
||||
|
@ -274,14 +276,14 @@ void tgame_version::pre_show(window& window)
|
|||
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
connect_signal_notify_modified(tab_bar,
|
||||
std::bind(&tgame_version::tab_switch_callback, *this, std::ref(window)));
|
||||
std::bind(&game_version::tab_switch_callback, *this, std::ref(window)));
|
||||
#else
|
||||
tab_bar.set_callback_value_change(
|
||||
dialog_callback<tgame_version, &tgame_version::tab_switch_callback>);
|
||||
dialog_callback<game_version, &game_version::tab_switch_callback>);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tgame_version::tab_switch_callback(window& window)
|
||||
void game_version::tab_switch_callback(window& window)
|
||||
{
|
||||
stacked_widget& pager
|
||||
= find_widget<stacked_widget>(&window, "tabs_container", false);
|
||||
|
@ -291,22 +293,22 @@ void tgame_version::tab_switch_callback(window& window)
|
|||
pager.select_layer(std::max<int>(0, tab_bar.get_selected_row()));
|
||||
}
|
||||
|
||||
void tgame_version::browse_directory_callback(const std::string& path)
|
||||
void game_version::browse_directory_callback(const std::string& path)
|
||||
{
|
||||
desktop::open_object(path);
|
||||
}
|
||||
|
||||
void tgame_version::copy_to_clipboard_callback(const std::string& path)
|
||||
void game_version::copy_to_clipboard_callback(const std::string& path)
|
||||
{
|
||||
desktop::clipboard::copy_to_clipboard(path, false);
|
||||
}
|
||||
|
||||
void tgame_version::report_copy_callback()
|
||||
void game_version::report_copy_callback()
|
||||
{
|
||||
desktop::clipboard::copy_to_clipboard(report_, false);
|
||||
}
|
||||
|
||||
void tgame_version::generate_plain_text_report()
|
||||
void game_version::generate_plain_text_report()
|
||||
{
|
||||
std::ostringstream o;
|
||||
|
||||
|
@ -336,5 +338,5 @@ void tgame_version::generate_plain_text_report()
|
|||
report_ = o.str();
|
||||
}
|
||||
|
||||
|
||||
} // end namespace gui2
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
|
|
@ -33,22 +33,25 @@ class listbox;
|
|||
#endif
|
||||
class stacked_widget;
|
||||
|
||||
class tgame_version : public tdialog
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class game_version : public modal_dialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
tgame_version();
|
||||
game_version();
|
||||
|
||||
/**
|
||||
* The display function.
|
||||
*
|
||||
* See @ref tdialog for more information.
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
static void display(CVideo& video)
|
||||
{
|
||||
tgame_version().show(video);
|
||||
game_version().show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -71,10 +74,10 @@ private:
|
|||
|
||||
void generate_plain_text_report();
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
/** Inherited from modal_dialog. */
|
||||
void pre_show(window& window);
|
||||
|
||||
//
|
||||
|
@ -105,6 +108,7 @@ private:
|
|||
*/
|
||||
void browse_directory_callback(const std::string& path);
|
||||
};
|
||||
}
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue