diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2023-12-24 13:59:32 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2023-12-25 19:14:04 +0800 |
commit | a42ead59da853cb4afb1dbfd77bdb16cdd90d266 (patch) | |
tree | f017f11f7026964e3ed8d24fb0b5240dda4571b4 /editor/filesystem_dock.cpp | |
parent | 13a0d6e9b253654f5cc2a44f3d0b3cae10440443 (diff) | |
download | redot-engine-a42ead59da853cb4afb1dbfd77bdb16cdd90d266.tar.gz |
Improve EditorDirDialog
* Automatically selects the newly created directory
* Automatically selects "res://" when nothing is selected
* Fixes an error when overwrite/replace dialog appears
* Changes "copy checkbox + action button" to "copy button + move button"
* Double clicking a directory (un)collapses it instead of copy/move
* Uses DirectoryCreateDialog for "Create Folder"
Diffstat (limited to 'editor/filesystem_dock.cpp')
-rw-r--r-- | editor/filesystem_dock.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index e5d03942e3..54c15069dc 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1883,10 +1883,6 @@ Vector<String> FileSystemDock::_check_existing() { return conflicting_items; } -void FileSystemDock::_move_dialog_confirm(const String &p_path) { - _move_operation_confirm(p_path, move_dialog->is_copy_pressed()); -} - void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_copy, Overwrite p_overwrite) { if (p_overwrite == OVERWRITE_UNDECIDED) { to_move_path = p_to_path; @@ -2363,6 +2359,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected } } if (to_move.size() > 0) { + move_dialog->config(p_selected); move_dialog->popup_centered_ratio(0.4); } } break; @@ -3847,7 +3844,8 @@ FileSystemDock::FileSystemDock() { move_dialog = memnew(EditorDirDialog); add_child(move_dialog); - move_dialog->connect("dir_selected", callable_mp(this, &FileSystemDock::_move_dialog_confirm)); + move_dialog->connect("move_pressed", callable_mp(this, &FileSystemDock::_move_operation_confirm).bind(false, OVERWRITE_UNDECIDED)); + move_dialog->connect("copy_pressed", callable_mp(this, &FileSystemDock::_move_operation_confirm).bind(true, OVERWRITE_UNDECIDED)); overwrite_dialog = memnew(ConfirmationDialog); add_child(overwrite_dialog); @@ -3884,7 +3882,7 @@ FileSystemDock::FileSystemDock() { make_dir_dialog = memnew(DirectoryCreateDialog); add_child(make_dir_dialog); - make_dir_dialog->connect("dir_created", callable_mp(this, &FileSystemDock::_rescan)); + make_dir_dialog->connect("dir_created", callable_mp(this, &FileSystemDock::_rescan).unbind(1)); make_scene_dialog = memnew(SceneCreateDialog); add_child(make_scene_dialog); |