diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-21 18:28:45 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-28 14:24:09 +0100 |
commit | 01afc442c73661df677c2b93f4037a21992ee45b (patch) | |
tree | 9a5b0b68cb022873ba31929fe6a785ddf5c0555c /editor/editor_file_dialog.cpp | |
parent | a439131c2b06b3d452e5be13530b6d2caa72c1aa (diff) |
Signals: Port connect calls to use callable_mp
Remove now unnecessary bindings of signal callbacks in the public API.
There might be some false positives that need rebinding if they were
meant to be public.
No regular expressions were harmed in the making of this commit.
(Nah, just kidding.)
Diffstat (limited to 'editor/editor_file_dialog.cpp')
-rw-r--r-- | editor/editor_file_dialog.cpp | 90 |
1 files changed, 31 insertions, 59 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index dd6523e12c..6262680454 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -1364,19 +1364,7 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("_unhandled_input"), &EditorFileDialog::_unhandled_input); - ClassDB::bind_method(D_METHOD("_item_selected"), &EditorFileDialog::_item_selected); - ClassDB::bind_method(D_METHOD("_multi_selected"), &EditorFileDialog::_multi_selected); - ClassDB::bind_method(D_METHOD("_items_clear_selection"), &EditorFileDialog::_items_clear_selection); - ClassDB::bind_method(D_METHOD("_item_list_item_rmb_selected"), &EditorFileDialog::_item_list_item_rmb_selected); - ClassDB::bind_method(D_METHOD("_item_list_rmb_clicked"), &EditorFileDialog::_item_list_rmb_clicked); - ClassDB::bind_method(D_METHOD("_item_menu_id_pressed"), &EditorFileDialog::_item_menu_id_pressed); - ClassDB::bind_method(D_METHOD("_item_db_selected"), &EditorFileDialog::_item_dc_selected); - ClassDB::bind_method(D_METHOD("_dir_entered"), &EditorFileDialog::_dir_entered); - ClassDB::bind_method(D_METHOD("_file_entered"), &EditorFileDialog::_file_entered); - ClassDB::bind_method(D_METHOD("_action_pressed"), &EditorFileDialog::_action_pressed); ClassDB::bind_method(D_METHOD("_cancel_pressed"), &EditorFileDialog::_cancel_pressed); - ClassDB::bind_method(D_METHOD("_filter_selected"), &EditorFileDialog::_filter_selected); - ClassDB::bind_method(D_METHOD("_save_confirm_pressed"), &EditorFileDialog::_save_confirm_pressed); ClassDB::bind_method(D_METHOD("clear_filters"), &EditorFileDialog::clear_filters); ClassDB::bind_method(D_METHOD("add_filter", "filter"), &EditorFileDialog::add_filter); @@ -1393,11 +1381,7 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("get_access"), &EditorFileDialog::get_access); ClassDB::bind_method(D_METHOD("set_show_hidden_files", "show"), &EditorFileDialog::set_show_hidden_files); ClassDB::bind_method(D_METHOD("is_showing_hidden_files"), &EditorFileDialog::is_showing_hidden_files); - ClassDB::bind_method(D_METHOD("_select_drive"), &EditorFileDialog::_select_drive); - ClassDB::bind_method(D_METHOD("_make_dir"), &EditorFileDialog::_make_dir); - ClassDB::bind_method(D_METHOD("_make_dir_confirm"), &EditorFileDialog::_make_dir_confirm); ClassDB::bind_method(D_METHOD("_update_file_name"), &EditorFileDialog::update_file_name); - ClassDB::bind_method(D_METHOD("_update_file_list"), &EditorFileDialog::update_file_list); ClassDB::bind_method(D_METHOD("_update_dir"), &EditorFileDialog::update_dir); ClassDB::bind_method(D_METHOD("_thumbnail_done"), &EditorFileDialog::_thumbnail_done); ClassDB::bind_method(D_METHOD("set_display_mode", "mode"), &EditorFileDialog::set_display_mode); @@ -1406,16 +1390,6 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("set_disable_overwrite_warning", "disable"), &EditorFileDialog::set_disable_overwrite_warning); ClassDB::bind_method(D_METHOD("is_overwrite_warning_disabled"), &EditorFileDialog::is_overwrite_warning_disabled); - ClassDB::bind_method(D_METHOD("_recent_selected"), &EditorFileDialog::_recent_selected); - ClassDB::bind_method(D_METHOD("_go_back"), &EditorFileDialog::_go_back); - ClassDB::bind_method(D_METHOD("_go_forward"), &EditorFileDialog::_go_forward); - ClassDB::bind_method(D_METHOD("_go_up"), &EditorFileDialog::_go_up); - - ClassDB::bind_method(D_METHOD("_favorite_pressed"), &EditorFileDialog::_favorite_pressed); - ClassDB::bind_method(D_METHOD("_favorite_selected"), &EditorFileDialog::_favorite_selected); - ClassDB::bind_method(D_METHOD("_favorite_move_up"), &EditorFileDialog::_favorite_move_up); - ClassDB::bind_method(D_METHOD("_favorite_move_down"), &EditorFileDialog::_favorite_move_down); - ClassDB::bind_method(D_METHOD("invalidate"), &EditorFileDialog::invalidate); ADD_SIGNAL(MethodInfo("file_selected", PropertyInfo(Variant::STRING, "path"))); @@ -1537,9 +1511,9 @@ EditorFileDialog::EditorFileDialog() { pathhb->add_child(dir_next); pathhb->add_child(dir_up); - dir_prev->connect_compat("pressed", this, "_go_back"); - dir_next->connect_compat("pressed", this, "_go_forward"); - dir_up->connect_compat("pressed", this, "_go_up"); + dir_prev->connect("pressed", callable_mp(this, &EditorFileDialog::_go_back)); + dir_next->connect("pressed", callable_mp(this, &EditorFileDialog::_go_forward)); + dir_up->connect("pressed", callable_mp(this, &EditorFileDialog::_go_up)); pathhb->add_child(memnew(Label(TTR("Path:")))); @@ -1549,20 +1523,20 @@ EditorFileDialog::EditorFileDialog() { refresh = memnew(ToolButton); refresh->set_tooltip(TTR("Refresh files.")); - refresh->connect_compat("pressed", this, "_update_file_list"); + refresh->connect("pressed", callable_mp(this, &EditorFileDialog::update_file_list)); pathhb->add_child(refresh); favorite = memnew(ToolButton); favorite->set_toggle_mode(true); favorite->set_tooltip(TTR("(Un)favorite current folder.")); - favorite->connect_compat("pressed", this, "_favorite_pressed"); + favorite->connect("pressed", callable_mp(this, &EditorFileDialog::_favorite_pressed)); pathhb->add_child(favorite); show_hidden = memnew(ToolButton); show_hidden->set_toggle_mode(true); show_hidden->set_pressed(is_showing_hidden_files()); show_hidden->set_tooltip(TTR("Toggle the visibility of hidden files.")); - show_hidden->connect_compat("toggled", this, "set_show_hidden_files"); + show_hidden->connect("toggled", callable_mp(this, &EditorFileDialog::set_show_hidden_files)); pathhb->add_child(show_hidden); pathhb->add_child(memnew(VSeparator)); @@ -1571,7 +1545,7 @@ EditorFileDialog::EditorFileDialog() { view_mode_group.instance(); mode_thumbnails = memnew(ToolButton); - mode_thumbnails->connect_compat("pressed", this, "set_display_mode", varray(DISPLAY_THUMBNAILS)); + mode_thumbnails->connect("pressed", callable_mp(this, &EditorFileDialog::set_display_mode), varray(DISPLAY_THUMBNAILS)); mode_thumbnails->set_toggle_mode(true); mode_thumbnails->set_pressed(display_mode == DISPLAY_THUMBNAILS); mode_thumbnails->set_button_group(view_mode_group); @@ -1579,7 +1553,7 @@ EditorFileDialog::EditorFileDialog() { pathhb->add_child(mode_thumbnails); mode_list = memnew(ToolButton); - mode_list->connect_compat("pressed", this, "set_display_mode", varray(DISPLAY_LIST)); + mode_list->connect("pressed", callable_mp(this, &EditorFileDialog::set_display_mode), varray(DISPLAY_LIST)); mode_list->set_toggle_mode(true); mode_list->set_pressed(display_mode == DISPLAY_LIST); mode_list->set_button_group(view_mode_group); @@ -1588,11 +1562,11 @@ EditorFileDialog::EditorFileDialog() { drives = memnew(OptionButton); pathhb->add_child(drives); - drives->connect_compat("item_selected", this, "_select_drive"); + drives->connect("item_selected", callable_mp(this, &EditorFileDialog::_select_drive)); makedir = memnew(Button); makedir->set_text(TTR("Create Folder")); - makedir->connect_compat("pressed", this, "_make_dir"); + makedir->connect("pressed", callable_mp(this, &EditorFileDialog::_make_dir)); pathhb->add_child(makedir); list_hb = memnew(HSplitContainer); @@ -1614,15 +1588,15 @@ EditorFileDialog::EditorFileDialog() { fav_hb->add_spacer(); fav_up = memnew(ToolButton); fav_hb->add_child(fav_up); - fav_up->connect_compat("pressed", this, "_favorite_move_up"); + fav_up->connect("pressed", callable_mp(this, &EditorFileDialog::_favorite_move_up)); fav_down = memnew(ToolButton); fav_hb->add_child(fav_down); - fav_down->connect_compat("pressed", this, "_favorite_move_down"); + fav_down->connect("pressed", callable_mp(this, &EditorFileDialog::_favorite_move_down)); favorites = memnew(ItemList); fav_vb->add_child(favorites); favorites->set_v_size_flags(SIZE_EXPAND_FILL); - favorites->connect_compat("item_selected", this, "_favorite_selected"); + favorites->connect("item_selected", callable_mp(this, &EditorFileDialog::_favorite_selected)); VBoxContainer *rec_vb = memnew(VBoxContainer); vsc->add_child(rec_vb); @@ -1631,7 +1605,7 @@ EditorFileDialog::EditorFileDialog() { recent = memnew(ItemList); recent->set_allow_reselect(true); rec_vb->add_margin_child(TTR("Recent:"), recent, true); - recent->connect_compat("item_selected", this, "_recent_selected"); + recent->connect("item_selected", callable_mp(this, &EditorFileDialog::_recent_selected)); VBoxContainer *item_vb = memnew(VBoxContainer); list_hb->add_child(item_vb); @@ -1650,13 +1624,13 @@ EditorFileDialog::EditorFileDialog() { item_list = memnew(ItemList); item_list->set_v_size_flags(SIZE_EXPAND_FILL); - item_list->connect_compat("item_rmb_selected", this, "_item_list_item_rmb_selected"); - item_list->connect_compat("rmb_clicked", this, "_item_list_rmb_clicked"); + item_list->connect("item_rmb_selected", callable_mp(this, &EditorFileDialog::_item_list_item_rmb_selected)); + item_list->connect("rmb_clicked", callable_mp(this, &EditorFileDialog::_item_list_rmb_clicked)); item_list->set_allow_rmb_select(true); list_vb->add_child(item_list); item_menu = memnew(PopupMenu); - item_menu->connect_compat("id_pressed", this, "_item_menu_id_pressed"); + item_menu->connect("id_pressed", callable_mp(this, &EditorFileDialog::_item_menu_id_pressed)); add_child(item_menu); // Other stuff. @@ -1687,19 +1661,19 @@ EditorFileDialog::EditorFileDialog() { access = ACCESS_RESOURCES; _update_drives(); - connect_compat("confirmed", this, "_action_pressed"); - item_list->connect_compat("item_selected", this, "_item_selected", varray(), CONNECT_DEFERRED); - item_list->connect_compat("multi_selected", this, "_multi_selected", varray(), CONNECT_DEFERRED); - item_list->connect_compat("item_activated", this, "_item_db_selected", varray()); - item_list->connect_compat("nothing_selected", this, "_items_clear_selection"); - dir->connect_compat("text_entered", this, "_dir_entered"); - file->connect_compat("text_entered", this, "_file_entered"); - filter->connect_compat("item_selected", this, "_filter_selected"); + connect("confirmed", callable_mp(this, &EditorFileDialog::_action_pressed)); + item_list->connect("item_selected", callable_mp(this, &EditorFileDialog::_item_selected), varray(), CONNECT_DEFERRED); + item_list->connect("multi_selected", callable_mp(this, &EditorFileDialog::_multi_selected), varray(), CONNECT_DEFERRED); + item_list->connect("item_activated", callable_mp(this, &EditorFileDialog::_item_dc_selected), varray()); + item_list->connect("nothing_selected", callable_mp(this, &EditorFileDialog::_items_clear_selection)); + dir->connect("text_entered", callable_mp(this, &EditorFileDialog::_dir_entered)); + file->connect("text_entered", callable_mp(this, &EditorFileDialog::_file_entered)); + filter->connect("item_selected", callable_mp(this, &EditorFileDialog::_filter_selected)); confirm_save = memnew(ConfirmationDialog); confirm_save->set_as_toplevel(true); add_child(confirm_save); - confirm_save->connect_compat("confirmed", this, "_save_confirm_pressed"); + confirm_save->connect("confirmed", callable_mp(this, &EditorFileDialog::_save_confirm_pressed)); remove_dialog = memnew(DependencyRemoveDialog); add_child(remove_dialog); @@ -1713,7 +1687,7 @@ EditorFileDialog::EditorFileDialog() { makevb->add_margin_child(TTR("Name:"), makedirname); add_child(makedialog); makedialog->register_text_enter(makedirname); - makedialog->connect_compat("confirmed", this, "_make_dir_confirm"); + makedialog->connect("confirmed", callable_mp(this, &EditorFileDialog::_make_dir_confirm)); mkdirerr = memnew(AcceptDialog); mkdirerr->set_text(TTR("Could not create folder.")); add_child(mkdirerr); @@ -1752,8 +1726,6 @@ void EditorLineEditFileChooser::_notification(int p_what) { void EditorLineEditFileChooser::_bind_methods() { - ClassDB::bind_method(D_METHOD("_browse"), &EditorLineEditFileChooser::_browse); - ClassDB::bind_method(D_METHOD("_chosen"), &EditorLineEditFileChooser::_chosen); ClassDB::bind_method(D_METHOD("get_button"), &EditorLineEditFileChooser::get_button); ClassDB::bind_method(D_METHOD("get_line_edit"), &EditorLineEditFileChooser::get_line_edit); ClassDB::bind_method(D_METHOD("get_file_dialog"), &EditorLineEditFileChooser::get_file_dialog); @@ -1777,10 +1749,10 @@ EditorLineEditFileChooser::EditorLineEditFileChooser() { line_edit->set_h_size_flags(SIZE_EXPAND_FILL); button = memnew(Button); add_child(button); - button->connect_compat("pressed", this, "_browse"); + button->connect("pressed", callable_mp(this, &EditorLineEditFileChooser::_browse)); dialog = memnew(EditorFileDialog); add_child(dialog); - dialog->connect_compat("file_selected", this, "_chosen"); - dialog->connect_compat("dir_selected", this, "_chosen"); - dialog->connect_compat("files_selected", this, "_chosen"); + dialog->connect("file_selected", callable_mp(this, &EditorLineEditFileChooser::_chosen)); + dialog->connect("dir_selected", callable_mp(this, &EditorLineEditFileChooser::_chosen)); + dialog->connect("files_selected", callable_mp(this, &EditorLineEditFileChooser::_chosen)); } |