Settings: Sort text editor themes alphabetically
(cherry picked from commit f0051394da
)
This commit is contained in:
parent
a142f89540
commit
272c31c837
|
@ -1159,18 +1159,25 @@ void EditorSettings::load_favorites() {
|
||||||
|
|
||||||
void EditorSettings::list_text_editor_themes() {
|
void EditorSettings::list_text_editor_themes() {
|
||||||
String themes = "Adaptive,Default,Custom";
|
String themes = "Adaptive,Default,Custom";
|
||||||
|
|
||||||
DirAccess *d = DirAccess::open(get_text_editor_themes_dir());
|
DirAccess *d = DirAccess::open(get_text_editor_themes_dir());
|
||||||
if (d) {
|
if (d) {
|
||||||
|
List<String> custom_themes;
|
||||||
d->list_dir_begin();
|
d->list_dir_begin();
|
||||||
String file = d->get_next();
|
String file = d->get_next();
|
||||||
while (file != String()) {
|
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") {
|
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();
|
file = d->get_next();
|
||||||
}
|
}
|
||||||
d->list_dir_end();
|
d->list_dir_end();
|
||||||
memdelete(d);
|
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));
|
add_property_hint(PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, themes));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue