summaryrefslogtreecommitdiff
path: root/editor/editor_file_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_file_dialog.cpp')
-rw-r--r--editor/editor_file_dialog.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 46518d387b..02a9cc905b 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -35,6 +35,7 @@
#include "core/os/os.h"
#include "core/print_string.h"
#include "dependency_editor.h"
+#include "editor_file_system.h"
#include "editor_resource_preview.h"
#include "editor_scale.h"
#include "editor_settings.h"
@@ -257,6 +258,7 @@ void EditorFileDialog::_post_popup() {
if (is_visible_in_tree()) {
Ref<Texture> folder = get_icon("folder", "FileDialog");
+ const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
recent->clear();
bool res = access == ACCESS_RESOURCES;
@@ -274,6 +276,7 @@ void EditorFileDialog::_post_popup() {
recent->add_item(name, folder);
recent->set_item_metadata(recent->get_item_count() - 1, recentd[i]);
+ recent->set_item_icon_modulate(recent->get_item_count() - 1, folder_color);
}
local_history.clear();
@@ -680,7 +683,12 @@ void EditorFileDialog::update_file_name() {
String filter_str = filters[idx];
String file_str = file->get_text();
String base_name = file_str.get_basename();
- file_str = base_name + "." + filter_str.split(";")[1].strip_edges().to_lower();
+ Vector<String> filter_substr = filter_str.split(";");
+ if (filter_substr.size() >= 2) {
+ file_str = base_name + "." + filter_substr[1].strip_edges().to_lower();
+ } else {
+ file_str = base_name + "." + filter_str.get_extension().strip_edges().to_lower();
+ }
file->set_text(file_str);
}
}
@@ -729,6 +737,7 @@ void EditorFileDialog::update_file_list() {
dir_access->list_dir_begin();
Ref<Texture> folder = get_icon("folder", "FileDialog");
+ const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
List<String> files;
List<String> dirs;
@@ -769,6 +778,7 @@ void EditorFileDialog::update_file_list() {
d["dir"] = true;
item_list->set_item_metadata(item_list->get_item_count() - 1, d);
+ item_list->set_item_icon_modulate(item_list->get_item_count() - 1, folder_color);
dirs.pop_front();
}
@@ -1076,7 +1086,7 @@ void EditorFileDialog::_make_dir_confirm() {
update_filters();
update_dir();
_push_history();
-
+ EditorFileSystem::get_singleton()->scan_changes(); //we created a dir, so rescan changes
} else {
mkdirerr->popup_centered_minsize(Size2(250, 50) * EDSCALE);
}
@@ -1195,6 +1205,7 @@ void EditorFileDialog::_update_favorites() {
String current = get_current_dir();
Ref<Texture> folder_icon = get_icon("Folder", "EditorIcons");
+ const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
favorites->clear();
favorite->set_pressed(false);
@@ -1225,6 +1236,7 @@ void EditorFileDialog::_update_favorites() {
}
favorites->set_item_metadata(favorites->get_item_count() - 1, favorited[i]);
+ favorites->set_item_icon_modulate(favorites->get_item_count() - 1, folder_color);
if (setthis) {
favorite->set_pressed(true);
@@ -1504,9 +1516,9 @@ EditorFileDialog::EditorFileDialog() {
HBoxContainer *pathhb = memnew(HBoxContainer);
dir_prev = memnew(ToolButton);
- dir_prev->set_tooltip(TTR("Previous Folder"));
+ dir_prev->set_tooltip(TTR("Go to previous folder."));
dir_next = memnew(ToolButton);
- dir_next->set_tooltip(TTR("Next Folder"));
+ dir_next->set_tooltip(TTR("Go to next folder."));
dir_up = memnew(ToolButton);
dir_up->set_tooltip(TTR("Go to parent folder."));
@@ -1525,7 +1537,7 @@ EditorFileDialog::EditorFileDialog() {
dir->set_h_size_flags(SIZE_EXPAND_FILL);
refresh = memnew(ToolButton);
- refresh->set_tooltip(TTR("Refresh"));
+ refresh->set_tooltip(TTR("Refresh files."));
refresh->connect("pressed", this, "_update_file_list");
pathhb->add_child(refresh);
@@ -1538,7 +1550,7 @@ EditorFileDialog::EditorFileDialog() {
show_hidden = memnew(ToolButton);
show_hidden->set_toggle_mode(true);
show_hidden->set_pressed(is_showing_hidden_files());
- show_hidden->set_tooltip(TTR("Toggle visibility of hidden files."));
+ show_hidden->set_tooltip(TTR("Toggle the visibility of hidden files."));
show_hidden->connect("toggled", this, "set_show_hidden_files");
pathhb->add_child(show_hidden);