summaryrefslogtreecommitdiff
path: root/editor/filesystem_dock.h
diff options
context:
space:
mode:
Diffstat (limited to 'editor/filesystem_dock.h')
-rw-r--r--editor/filesystem_dock.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index ec2a075834..1db1485426 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -69,6 +69,16 @@ public:
DISPLAY_MODE_SPLIT,
};
+ enum FileSortOption {
+ FILE_SORT_NAME = 0,
+ FILE_SORT_NAME_REVERSE,
+ FILE_SORT_TYPE,
+ FILE_SORT_TYPE_REVERSE,
+ FILE_SORT_MODIFIED_TIME,
+ FILE_SORT_MODIFIED_TIME_REVERSE,
+ FILE_SORT_MAX,
+ };
+
private:
enum FileMenu {
FILE_OPEN,
@@ -95,6 +105,8 @@ private:
FOLDER_COLLAPSE_ALL,
};
+ FileSortOption file_sort = FILE_SORT_NAME;
+
VBoxContainer *scanning_vb;
ProgressBar *scanning_progress;
VSplitContainer *split_box;
@@ -109,8 +121,13 @@ private:
Button *button_hist_next;
Button *button_hist_prev;
LineEdit *current_path;
+
+ HBoxContainer *toolbar2_hbc;
LineEdit *tree_search_box;
+ MenuButton *tree_button_sort;
+
LineEdit *file_list_search_box;
+ MenuButton *file_list_button_sort;
String searched_string;
Vector<String> uncollapsed_paths_before_search;
@@ -173,7 +190,7 @@ private:
ItemList *files;
bool import_dock_needs_update;
- Ref<Texture2D> _get_tree_item_icon(EditorFileSystemDirectory *p_dir, int p_idx);
+ Ref<Texture2D> _get_tree_item_icon(bool p_is_valid, String p_file_type);
bool _create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths, bool p_select_in_favorites, bool p_unfold_path = false);
Vector<String> _compute_uncollapsed_paths();
void _update_tree(const Vector<String> &p_uncollapsed_paths = Vector<String>(), bool p_uncollapse_root = false, bool p_select_in_favorites = false, bool p_unfold_path = false);
@@ -238,6 +255,9 @@ private:
void _search_changed(const String &p_text, const Control *p_from);
+ MenuButton *_create_file_menu_button();
+ void _file_sort_popup(int p_id);
+
void _file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options = true);
void _tree_rmb_select(const Vector2 &p_pos);
void _tree_rmb_empty(const Vector2 &p_pos);
@@ -251,12 +271,18 @@ private:
StringName type;
Vector<String> sources;
bool import_broken;
+ uint64_t modified_time;
bool operator<(const FileInfo &fi) const {
return NaturalNoCaseComparator()(name, fi.name);
}
};
+ struct FileInfoTypeComparator;
+ struct FileInfoModifiedTimeComparator;
+
+ void _sort_file_info_list(List<FileSystemDock::FileInfo> &r_file_list);
+
void _search(EditorFileSystemDirectory *p_path, List<FileInfo> *matches, int p_max_items);
void _set_current_path_text(const String &p_path);
@@ -299,6 +325,9 @@ public:
void set_display_mode(DisplayMode p_display_mode);
DisplayMode get_display_mode() { return display_mode; }
+ void set_file_sort(FileSortOption p_file_sort);
+ FileSortOption get_file_sort() { return file_sort; }
+
void set_file_list_display_mode(FileListDisplayMode p_mode);
FileListDisplayMode get_file_list_display_mode() { return file_list_display_mode; };