diff options
-rw-r--r-- | editor/editor_node.cpp | 4 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 25 | ||||
-rw-r--r-- | editor/filesystem_dock.h | 4 |
3 files changed, 13 insertions, 20 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 09117ace90..86e6bd0195 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3868,9 +3868,8 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String } } - int fs_split_ofs = 0; if (p_layout->has_section_key(p_section, "dock_filesystem_split")) { - fs_split_ofs = p_layout->get_value(p_section, "dock_filesystem_split"); + int fs_split_ofs = p_layout->get_value(p_section, "dock_filesystem_split"); filesystem_dock->set_split_offset(fs_split_ofs); } @@ -3883,7 +3882,6 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String FileSystemDock::FileListDisplayMode dock_filesystem_file_list_display_mode = FileSystemDock::FileListDisplayMode(int(p_layout->get_value(p_section, "dock_filesystem_file_list_display_mode"))); filesystem_dock->set_file_list_display_mode(dock_filesystem_file_list_display_mode); } - filesystem_dock->set_split_offset(fs_split_ofs); for (int i = 0; i < vsplits.size(); i++) { diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 0c3c222085..9bd6063a71 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -231,7 +231,6 @@ void FileSystemDock::_update_tree(const Vector<String> p_uncollapsed_paths, bool void FileSystemDock::set_display_mode(DisplayMode p_display_mode) { display_mode = p_display_mode; - emit_signal("display_mode_changed"); _update_display_mode(false); } @@ -284,8 +283,7 @@ 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)); - _update_file_list_display_mode_button(); - button_file_list_display_mode->connect("pressed", this, "_change_file_display"); + button_file_list_display_mode->connect("toggled", this, "_toggle_file_display"); files->connect("item_activated", this, "_file_list_activate_file"); button_hist_next->connect("pressed", this, "_fw_history"); @@ -501,9 +499,13 @@ void FileSystemDock::_tree_thumbnail_done(const String &p_path, const Ref<Textur } } -void FileSystemDock::_update_file_list_display_mode_button() { +void FileSystemDock::_toggle_file_display(bool p_active) { + _set_file_display(p_active); + emit_signal("display_mode_changed"); +} - if (button_file_list_display_mode->is_pressed()) { +void FileSystemDock::_set_file_display(bool p_active) { + if (p_active) { file_list_display_mode = FILE_LIST_DISPLAY_LIST; button_file_list_display_mode->set_icon(get_icon("FileThumbnail", "EditorIcons")); button_file_list_display_mode->set_tooltip(TTR("View items as a grid of thumbnails.")); @@ -512,14 +514,6 @@ void FileSystemDock::_update_file_list_display_mode_button() { button_file_list_display_mode->set_icon(get_icon("FileList", "EditorIcons")); button_file_list_display_mode->set_tooltip(TTR("View items as a list.")); } - emit_signal("display_mode_changed"); -} - -void FileSystemDock::_change_file_display() { - - _update_file_list_display_mode_button(); - - EditorSettings::get_singleton()->set("docks/filesystem/files_display_mode", file_list_display_mode); _update_file_list(true); } @@ -1679,6 +1673,7 @@ void FileSystemDock::_rescan() { void FileSystemDock::_toggle_split_mode(bool p_active) { set_display_mode(p_active ? DISPLAY_MODE_SPLIT : DISPLAY_MODE_TREE_ONLY); + emit_signal("display_mode_changed"); } void FileSystemDock::fix_dependencies(const String &p_for_file) { @@ -1696,7 +1691,7 @@ void FileSystemDock::set_file_list_display_mode(FileListDisplayMode p_mode) { return; button_file_list_display_mode->set_pressed(p_mode == FILE_LIST_DISPLAY_LIST); - _change_file_display(); + _toggle_file_display(p_mode == FILE_LIST_DISPLAY_LIST); } Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from) { @@ -2285,7 +2280,7 @@ void FileSystemDock::_bind_methods() { 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("_navigate_to_path"), &FileSystemDock::_navigate_to_path); - ClassDB::bind_method(D_METHOD("_change_file_display"), &FileSystemDock::_change_file_display); + ClassDB::bind_method(D_METHOD("_toggle_file_display"), &FileSystemDock::_toggle_file_display); ClassDB::bind_method(D_METHOD("_fw_history"), &FileSystemDock::_fw_history); ClassDB::bind_method(D_METHOD("_bw_history"), &FileSystemDock::_bw_history); ClassDB::bind_method(D_METHOD("_fs_changed"), &FileSystemDock::_fs_changed); diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index e31afee23e..7cf37a7634 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -181,8 +181,8 @@ private: void _tree_gui_input(Ref<InputEvent> p_event); void _update_file_list(bool p_keep_selection); - void _update_file_list_display_mode_button(); - void _change_file_display(); + void _toggle_file_display(bool p_active); + void _set_file_display(bool p_active); void _fs_changed(); void _tree_toggle_collapsed(); |