diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-10-25 10:55:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-25 10:55:25 +0200 |
commit | 70454767ee2398f398aa04a8354480f3f2748ca2 (patch) | |
tree | 65f2e47713dc0bd528fea70de0842a6dc2519e7a | |
parent | 220f50e790223c7bc63fd3d2ca3327aa6dcc5d3c (diff) | |
parent | 3af11ff3d8844f4dccd5df307f9383237e8b9fb7 (diff) |
Merge pull request #23215 from Chaosus/filedock_update
Updates filesystem dock when theme is changed
-rw-r--r-- | editor/filesystem_dock.cpp | 12 | ||||
-rw-r--r-- | editor/filesystem_dock.h | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 26bc43c540..701f10ca00 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -225,7 +225,7 @@ void FileSystemDock::_update_tree(const Vector<String> p_uncollapsed_paths, bool updating_tree = false; } -void FileSystemDock::_update_display_mode() { +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) { @@ -234,7 +234,7 @@ void FileSystemDock::_update_display_mode() { new_display_mode = DISPLAY_MODE_SPLIT; } - if (new_display_mode != display_mode || old_display_mode_setting != display_mode_setting) { + if (p_force || new_display_mode != display_mode || old_display_mode_setting != display_mode_setting) { display_mode = new_display_mode; old_display_mode_setting = display_mode_setting; button_toggle_display_mode->set_pressed(display_mode_setting == DISPLAY_MODE_SETTING_SPLIT ? true : false); @@ -352,6 +352,9 @@ void FileSystemDock::_notification(int p_what) { tree->set_drop_mode_flags(0); } break; + case NOTIFICATION_THEME_CHANGED: { + _update_display_mode(true); + } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { // Update icons String ei = "EditorIcons"; @@ -360,6 +363,11 @@ void FileSystemDock::_notification(int p_what) { 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()) { + button_file_list_display_mode->set_icon(get_icon("FileThumbnail", "EditorIcons")); + } else { + button_file_list_display_mode->set_icon(get_icon("FileList", "EditorIcons")); + } tree_search_box->set_right_icon(get_icon("Search", ei)); tree_search_box->set_clear_button_enabled(true); diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index d964515572..2aa79b1ddd 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -268,7 +268,7 @@ private: void _file_list_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata); void _tree_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata); - void _update_display_mode(); + void _update_display_mode(bool p_force = false); Vector<String> _tree_get_selected(bool remove_self_inclusion = true); |