summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-11-02 13:09:09 -0300
committerGitHub <noreply@github.com>2018-11-02 13:09:09 -0300
commit03563c8ddf748b73c6bef962f14e0e41eac45447 (patch)
treeb0e8406551807f296eabd33f131311ce0595a563
parent08612e1cfde5dbcc42468cd17104601eaf3e45fb (diff)
parent8f3becafeb254b27fdbf8f1e4dfba4feccb6ce23 (diff)
Merge pull request #23061 from groud/remove_thumbnail_view
Remove the thumnail-only view from the filesystem dock
-rw-r--r--editor/filesystem_dock.cpp77
-rw-r--r--editor/filesystem_dock.h6
2 files changed, 8 insertions, 75 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 48bfa6fddb..22910074f2 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -227,12 +227,7 @@ void FileSystemDock::_update_tree(const Vector<String> p_uncollapsed_paths, bool
void FileSystemDock::_update_display_mode(bool p_force) {
// Compute the new display mode
- DisplayMode new_display_mode;
- if (display_mode_setting == DISPLAY_MODE_SETTING_TREE_ONLY) {
- new_display_mode = file_list_view ? DISPLAY_MODE_FILE_LIST_ONLY : DISPLAY_MODE_TREE_ONLY;
- } else {
- new_display_mode = DISPLAY_MODE_SPLIT;
- }
+ DisplayMode new_display_mode = (display_mode_setting == DISPLAY_MODE_SETTING_TREE_ONLY) ? DISPLAY_MODE_TREE_ONLY : DISPLAY_MODE_SPLIT;
if (p_force || new_display_mode != display_mode || old_display_mode_setting != display_mode_setting) {
display_mode = new_display_mode;
@@ -252,19 +247,9 @@ void FileSystemDock::_update_display_mode(bool p_force) {
file_list_vb->hide();
break;
- case DISPLAY_MODE_FILE_LIST_ONLY:
- tree->hide();
- tree_search_box->hide();
- button_tree->show();
-
- file_list_vb->show();
- _update_file_list(true);
- break;
-
case DISPLAY_MODE_SPLIT:
tree->show();
tree->set_v_size_flags(SIZE_EXPAND_FILL);
- button_tree->hide();
tree->ensure_cursor_is_visible();
tree_search_box->hide();
_update_tree(_compute_uncollapsed_paths());
@@ -295,7 +280,6 @@ void FileSystemDock::_notification(int p_what) {
String ei = "EditorIcons";
button_reload->set_icon(get_icon("Reload", ei));
button_toggle_display_mode->set_icon(get_icon("Panels2", ei));
- button_tree->set_icon(get_icon("Filesystem", ei));
_update_file_list_display_mode_button();
button_file_list_display_mode->connect("pressed", this, "_change_file_display");
@@ -312,7 +296,6 @@ void FileSystemDock::_notification(int p_what) {
file_list_popup->connect("id_pressed", this, "_file_list_rmb_option");
tree_popup->connect("id_pressed", this, "_tree_rmb_option");
- button_tree->connect("pressed", this, "_go_to_tree", varray(), CONNECT_DEFERRED);
current_path->connect("text_entered", this, "navigate_to_path");
display_mode_setting = DisplayModeSetting(int(EditorSettings::get_singleton()->get("docks/filesystem/display_mode")));
@@ -362,7 +345,6 @@ void FileSystemDock::_notification(int p_what) {
String ei = "EditorIcons";
button_reload->set_icon(get_icon("Reload", ei));
button_toggle_display_mode->set_icon(get_icon("Panels2", ei));
- button_tree->set_icon(get_icon("Filesystem", ei));
button_hist_next->set_icon(get_icon("Forward", ei));
button_hist_prev->set_icon(get_icon("Back", ei));
if (button_file_list_display_mode->is_pressed()) {
@@ -484,20 +466,9 @@ void FileSystemDock::navigate_to_path(const String &p_path) {
_set_current_path_text(path);
_push_to_history();
+ _update_tree(_compute_uncollapsed_paths());
if (display_mode == DISPLAY_MODE_SPLIT) {
- if (path.ends_with("/") || path == "Favorites") {
- _go_to_file_list();
- }
- _update_tree(_compute_uncollapsed_paths());
_update_file_list(false);
- } else if (display_mode == DISPLAY_MODE_TREE_ONLY) {
- if (path.ends_with("/") || path == "Favorites") {
- _go_to_file_list();
- } else {
- _update_tree(_compute_uncollapsed_paths());
- }
- } else { // DISPLAY_MODE_FILE_LIST_ONLY
- _update_file_list(true);
}
String file_name = p_path.get_file();
@@ -711,7 +682,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
_search(EditorFileSystem::get_singleton()->get_filesystem(), &filelist, 128);
} else {
- if ((display_mode == DISPLAY_MODE_FILE_LIST_ONLY || display_mode == DISPLAY_MODE_TREE_ONLY) || always_show_folders) {
+ if (display_mode == DISPLAY_MODE_TREE_ONLY || always_show_folders) {
// Display folders in the list
if (directory != "res://") {
@@ -839,35 +810,16 @@ void FileSystemDock::_tree_activate_file() {
TreeItem *selected = tree->get_selected();
if (selected) {
call_deferred("_select_file", selected->get_metadata(0));
- }
-}
-void FileSystemDock::_file_list_activate_file(int p_idx) {
- _select_file(files->get_item_metadata(p_idx));
-}
-
-void FileSystemDock::_go_to_file_list() {
-
- if (display_mode == DISPLAY_MODE_TREE_ONLY) {
-
- file_list_view = true;
- _update_display_mode();
- } else {
- TreeItem *selected = tree->get_selected();
- if (selected) {
+ if (path.ends_with("/") || path == "Favorites") {
bool collapsed = selected->is_collapsed();
selected->set_collapsed(!collapsed);
}
- _update_file_list(false);
}
}
-void FileSystemDock::_go_to_tree() {
-
- file_list_view = false;
- tree->grab_focus();
- _update_display_mode();
- tree->ensure_cursor_is_visible();
+void FileSystemDock::_file_list_activate_file(int p_idx) {
+ _select_file(files->get_item_metadata(p_idx));
}
void FileSystemDock::_preview_invalidated(const String &p_path) {
@@ -1704,9 +1656,6 @@ void FileSystemDock::_search_changed(const String &p_text, const Control *p_from
tree_search_box->set_text(searched_string);
switch (display_mode) {
- case DISPLAY_MODE_FILE_LIST_ONLY: {
- _update_file_list(false);
- } break;
case DISPLAY_MODE_TREE_ONLY: {
_update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>());
} break;
@@ -1735,12 +1684,6 @@ void FileSystemDock::fix_dependencies(const String &p_for_file) {
void FileSystemDock::focus_on_filter() {
- if (display_mode == DISPLAY_MODE_FILE_LIST_ONLY && tree->is_visible()) {
- // Tree mode, switch to files list with search box
- tree->hide();
- file_list_vb->show();
- }
-
file_list_search_box->grab_focus();
}
@@ -2330,7 +2273,6 @@ void FileSystemDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_file_list_activate_file"), &FileSystemDock::_file_list_activate_file);
ClassDB::bind_method(D_METHOD("_tree_activate_file"), &FileSystemDock::_tree_activate_file);
ClassDB::bind_method(D_METHOD("_select_file"), &FileSystemDock::_select_file);
- ClassDB::bind_method(D_METHOD("_go_to_tree"), &FileSystemDock::_go_to_tree);
ClassDB::bind_method(D_METHOD("navigate_to_path"), &FileSystemDock::navigate_to_path);
ClassDB::bind_method(D_METHOD("_change_file_display"), &FileSystemDock::_change_file_display);
ClassDB::bind_method(D_METHOD("_fw_history"), &FileSystemDock::_fw_history);
@@ -2426,7 +2368,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
/*
button_open = memnew( Button );
button_open->set_flat(true);
- button_open->connect("pressed",this,"_go_to_file_list");
+ button_open->connect("pressed",this,"_tree_toggle_collapsed");
toolbar_hbc->add_child(button_open);
button_open->hide();
button_open->set_focus_mode(FOCUS_NONE);
@@ -2476,11 +2418,6 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
path_hb = memnew(HBoxContainer);
file_list_vb->add_child(path_hb);
- button_tree = memnew(ToolButton);
- button_tree->set_tooltip(TTR("Enter tree-view."));
- button_tree->hide();
- path_hb->add_child(button_tree);
-
file_list_search_box = memnew(LineEdit);
file_list_search_box->set_h_size_flags(SIZE_EXPAND_FILL);
file_list_search_box->set_placeholder(TTR("Search files"));
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 2aa79b1ddd..bf7306fc68 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -73,7 +73,6 @@ private:
enum DisplayMode {
DISPLAY_MODE_TREE_ONLY,
- DISPLAY_MODE_FILE_LIST_ONLY,
DISPLAY_MODE_SPLIT,
};
@@ -109,7 +108,6 @@ private:
Button *button_toggle_display_mode;
Button *button_reload;
- Button *button_tree;
Button *button_file_list_display_mode;
Button *button_hist_next;
Button *button_hist_prev;
@@ -127,7 +125,6 @@ private:
DisplayMode display_mode;
DisplayModeSetting display_mode_setting;
DisplayModeSetting old_display_mode_setting;
- bool file_list_view;
PopupMenu *file_list_popup;
PopupMenu *tree_popup;
@@ -193,8 +190,7 @@ private:
void _change_file_display();
void _fs_changed();
- void _go_to_tree();
- void _go_to_file_list();
+ void _tree_toggle_collapsed();
void _select_file(const String p_path);
void _tree_activate_file();