summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-09-22 10:52:06 +0200
committerGitHub <noreply@github.com>2018-09-22 10:52:06 +0200
commit29b093f9e86a97b5cff6cc50afaccc01e9553a69 (patch)
treeba24b07b44b833bf04ea6fa120aaa83337bdedb6
parent29c557a29a7ec47217233726797c4b91374b0a5e (diff)
parentf0051394da56a329107b08e4f3c82de0e5fbf847 (diff)
Merge pull request #22340 from akien-mga/sort_text_editor_themes
Settings: Sort text editor themes alphabetically
-rw-r--r--editor/editor_settings.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 3f49edf88d..29ce8d1830 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -1216,18 +1216,25 @@ bool EditorSettings::is_dark_theme() {
void EditorSettings::list_text_editor_themes() {
String themes = "Adaptive,Default,Custom";
+
DirAccess *d = DirAccess::open(get_text_editor_themes_dir());
if (d) {
+ List<String> custom_themes;
d->list_dir_begin();
String file = d->get_next();
while (file != String()) {
if (file.get_extension() == "tet" && file.get_basename().to_lower() != "default" && file.get_basename().to_lower() != "adaptive" && file.get_basename().to_lower() != "custom") {
- themes += "," + file.get_basename();
+ custom_themes.push_back(file.get_basename());
}
file = d->get_next();
}
d->list_dir_end();
memdelete(d);
+
+ custom_themes.sort();
+ for (List<String>::Element *E = custom_themes.front(); E; E = E->next()) {
+ themes += "," + E->get();
+ }
}
add_property_hint(PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, themes));
}