summaryrefslogtreecommitdiff
path: root/editor/editor_dir_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_dir_dialog.cpp')
-rw-r--r--editor/editor_dir_dialog.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index 09e63f70b4..20fe349ef6 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -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("filesystem_changed", this, "reload");
+ EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload), make_binds(""));
reload();
- if (!tree->is_connected("item_collapsed", this, "_item_collapsed")) {
- tree->connect("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("filesystem_changed", this, "reload")) {
- EditorFileSystem::get_singleton()->connect("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("filesystem_changed", this, "reload")) {
- EditorFileSystem::get_singleton()->disconnect("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));
}
}
@@ -120,6 +121,10 @@ void EditorDirDialog::_item_collapsed(Object *p_item) {
opened_paths.insert(item->get_metadata(0));
}
+void EditorDirDialog::_item_activated() {
+ _ok_pressed(); // From AcceptDialog.
+}
+
void EditorDirDialog::ok_pressed() {
TreeItem *ti = tree->get_selected();
@@ -168,11 +173,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")));
}
@@ -186,10 +186,10 @@ EditorDirDialog::EditorDirDialog() {
tree = memnew(Tree);
add_child(tree);
- tree->connect("item_activated", this, "_ok");
+ tree->connect("item_activated", callable_mp(this, &EditorDirDialog::_item_activated));
makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel(), "makedir");
- makedir->connect("pressed", this, "_make_dir");
+ makedir->connect("pressed", callable_mp(this, &EditorDirDialog::_make_dir));
makedialog = memnew(ConfirmationDialog);
makedialog->set_title(TTR("Create Folder"));
@@ -202,7 +202,7 @@ EditorDirDialog::EditorDirDialog() {
makedirname = memnew(LineEdit);
makevb->add_margin_child(TTR("Name:"), makedirname);
makedialog->register_text_enter(makedirname);
- makedialog->connect("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."));