Update the setting when clicking Show hidden files

(cherry picked from commit 725c2bdf48)
This commit is contained in:
Tomasz Chabora 2020-10-06 15:42:25 +02:00 committed by Rémi Verschelde
parent 11a07d071a
commit ed34eed62d
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -56,8 +56,7 @@ VBoxContainer *EditorFileDialog::get_vbox() {
void EditorFileDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
// update icons
// Update icons.
mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons"));
mode_list->set_icon(get_icon("FileList", "EditorIcons"));
dir_prev->set_icon(get_icon("Back", "EditorIcons"));
@ -94,7 +93,7 @@ void EditorFileDialog::_notification(int p_what) {
set_show_hidden_files(is_showing_hidden);
set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int());
// update icons
// Update icons.
mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons"));
mode_list->set_icon(get_icon("FileList", "EditorIcons"));
dir_prev->set_icon(get_icon("Back", "EditorIcons"));
@ -137,9 +136,7 @@ void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
handled = true;
}
if (ED_IS_SHORTCUT("file_dialog/toggle_hidden_files", p_event)) {
bool show = !show_hidden_files;
set_show_hidden_files(show);
EditorSettings::get_singleton()->set("filesystem/file_dialog/show_hidden_files", show);
set_show_hidden_files(!show_hidden_files);
handled = true;
}
if (ED_IS_SHORTCUT("file_dialog/toggle_favorite", p_event)) {
@ -1455,6 +1452,11 @@ void EditorFileDialog::_bind_methods() {
}
void EditorFileDialog::set_show_hidden_files(bool p_show) {
if (p_show == show_hidden_files) {
return;
}
EditorSettings::get_singleton()->set("filesystem/file_dialog/show_hidden_files", p_show);
show_hidden_files = p_show;
show_hidden->set_pressed(p_show);
invalidate();