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.)
This commit is contained in:
Rémi Verschelde 2020-02-21 18:28:45 +01:00
parent a439131c2b
commit 01afc442c7
164 changed files with 1795 additions and 3293 deletions

View file

@ -35,6 +35,7 @@
#include "editor/editor_file_system.h"
#include "editor/editor_settings.h"
#include "editor_scale.h"
void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p_dir, const String &p_select_path) {
updating = true;
@ -82,21 +83,21 @@ void EditorDirDialog::reload(const String &p_path) {
void EditorDirDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "reload");
EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload), make_binds(""));
reload();
if (!tree->is_connected_compat("item_collapsed", this, "_item_collapsed")) {
tree->connect_compat("item_collapsed", this, "_item_collapsed", varray(), CONNECT_DEFERRED);
if (!tree->is_connected("item_collapsed", callable_mp(this, &EditorDirDialog::_item_collapsed))) {
tree->connect("item_collapsed", callable_mp(this, &EditorDirDialog::_item_collapsed), varray(), CONNECT_DEFERRED);
}
if (!EditorFileSystem::get_singleton()->is_connected_compat("filesystem_changed", this, "reload")) {
EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "reload");
if (!EditorFileSystem::get_singleton()->is_connected("filesystem_changed", callable_mp(this, &EditorDirDialog::reload))) {
EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload), make_binds(""));
}
}
if (p_what == NOTIFICATION_EXIT_TREE) {
if (EditorFileSystem::get_singleton()->is_connected_compat("filesystem_changed", this, "reload")) {
EditorFileSystem::get_singleton()->disconnect_compat("filesystem_changed", this, "reload");
if (EditorFileSystem::get_singleton()->is_connected("filesystem_changed", callable_mp(this, &EditorDirDialog::reload))) {
EditorFileSystem::get_singleton()->disconnect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload));
}
}
@ -168,11 +169,6 @@ void EditorDirDialog::_make_dir_confirm() {
void EditorDirDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("_item_collapsed"), &EditorDirDialog::_item_collapsed);
ClassDB::bind_method(D_METHOD("_make_dir"), &EditorDirDialog::_make_dir);
ClassDB::bind_method(D_METHOD("_make_dir_confirm"), &EditorDirDialog::_make_dir_confirm);
ClassDB::bind_method(D_METHOD("reload"), &EditorDirDialog::reload, DEFVAL(""));
ADD_SIGNAL(MethodInfo("dir_selected", PropertyInfo(Variant::STRING, "dir")));
}
@ -189,7 +185,7 @@ EditorDirDialog::EditorDirDialog() {
tree->connect_compat("item_activated", this, "_ok");
makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel(), "makedir");
makedir->connect_compat("pressed", this, "_make_dir");
makedir->connect("pressed", callable_mp(this, &EditorDirDialog::_make_dir));
makedialog = memnew(ConfirmationDialog);
makedialog->set_title(TTR("Create Folder"));
@ -202,7 +198,7 @@ EditorDirDialog::EditorDirDialog() {
makedirname = memnew(LineEdit);
makevb->add_margin_child(TTR("Name:"), makedirname);
makedialog->register_text_enter(makedirname);
makedialog->connect_compat("confirmed", this, "_make_dir_confirm");
makedialog->connect("confirmed", callable_mp(this, &EditorDirDialog::_make_dir_confirm));
mkdirerr = memnew(AcceptDialog);
mkdirerr->set_text(TTR("Could not create folder."));