summaryrefslogtreecommitdiffstats
path: root/editor/filesystem_dock.h
diff options
context:
space:
mode:
authorMillionOstrich <31486600+MillionOstrich@users.noreply.github.com>2017-10-01 22:59:27 +0100
committerMillionOstrich <31486600+MillionOstrich@users.noreply.github.com>2017-10-09 15:07:36 +0100
commit716e5b2943965688127d079bbdba91597907e483 (patch)
treef8076c8a210377e1acb38587e4731048a1f6c43d /editor/filesystem_dock.h
parente1fb38e8918b7fb054847b23b996a85ade7bbe86 (diff)
downloadredot-engine-716e5b2943965688127d079bbdba91597907e483.tar.gz
Reworked rename & move for files & folders.
Move/rename don't depend on the path variable anymore. Fixed dependencies not updating correctly when dragging folders in the folder tree. Dependencies will only update for files which sucessfully moved. Reduced code duplication between move & rename. Added rename & move options to folders tree.
Diffstat (limited to 'editor/filesystem_dock.h')
-rw-r--r--editor/filesystem_dock.h32
1 files changed, 25 insertions, 7 deletions
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index b38e3e63f0..1491e1c7a7 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -32,6 +32,7 @@
#include "scene/gui/box_container.h"
#include "scene/gui/control.h"
+#include "scene/gui/dialogs.h"
#include "scene/gui/item_list.h"
#include "scene/gui/label.h"
#include "scene/gui/menu_button.h"
@@ -67,6 +68,7 @@ private:
FILE_DEPENDENCIES,
FILE_OWNERS,
FILE_MOVE,
+ FILE_RENAME,
FILE_REMOVE,
FILE_REIMPORT,
FILE_INFO,
@@ -77,6 +79,8 @@ private:
enum FolderMenu {
FOLDER_EXPAND_ALL,
FOLDER_COLLAPSE_ALL,
+ FOLDER_MOVE,
+ FOLDER_RENAME,
FOLDER_SHOW_IN_EXPLORER,
FOLDER_COPY_PATH
};
@@ -111,10 +115,21 @@ private:
DependencyRemoveDialog *remove_dialog;
EditorDirDialog *move_dialog;
- EditorFileDialog *rename_dialog;
+ ConfirmationDialog *rename_dialog;
+ LineEdit *rename_dialog_text;
- Vector<String> move_dirs;
- Vector<String> move_files;
+ class FileOrFolder {
+ public:
+ String path;
+ bool is_file;
+
+ FileOrFolder()
+ : path(""), is_file(false) {}
+ FileOrFolder(const String &p_path, bool p_is_file)
+ : path(p_path), is_file(p_is_file) {}
+ };
+ FileOrFolder to_rename;
+ Vector<FileOrFolder> to_move;
Vector<String> history;
int history_pos;
@@ -136,11 +151,14 @@ private:
bool _create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir);
void _thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata);
- void _find_inside_move_files(EditorFileSystemDirectory *efsd, Vector<String> &files);
- void _find_remaps(EditorFileSystemDirectory *efsd, Map<String, String> &renames, List<String> &to_remaps);
- void _rename_operation(const String &p_to_path);
- void _move_operation(const String &p_to_path);
+ void _get_all_files_in_dir(EditorFileSystemDirectory *efsd, Vector<String> &files) const;
+ void _find_remaps(EditorFileSystemDirectory *efsd, const Map<String, String> &renames, Vector<String> &to_remaps) const;
+ void _try_move_item(const FileOrFolder &p_item, const String &p_new_path, Map<String, String> &p_renames) const;
+ void _update_dependencies_after_move(const Map<String, String> &p_renames) const;
+
+ void _rename_operation_confirm();
+ void _move_operation_confirm(const String &p_to_path);
void _file_option(int p_option);
void _folder_option(int p_option);