Initial editor accessibility.

This commit is contained in:
Pāvels Nadtočajevs 2025-03-21 09:55:22 +02:00
parent 4310cb82b8
commit 302fa831cc
No known key found for this signature in database
GPG key ID: 8413210218EF35D2
137 changed files with 1544 additions and 93 deletions

View file

@ -1294,6 +1294,8 @@ ProjectManager::ProjectManager() {
title_bar_logo = memnew(Button);
title_bar_logo->set_flat(true);
title_bar_logo->set_tooltip_text(TTR("About Godot"));
title_bar_logo->set_accessibility_name(TTRC("About Godot"));
left_hbox->add_child(title_bar_logo);
title_bar_logo->connect(SceneStringName(pressed), callable_mp(this, &ProjectManager::_show_about));
@ -1374,12 +1376,14 @@ ProjectManager::ProjectManager() {
hb->add_child(scan_btn);
loading_label = memnew(Label(TTR("Loading, please wait...")));
loading_label->set_accessibility_live(DisplayServer::AccessibilityLiveMode::LIVE_ASSERTIVE);
loading_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
loading_label->hide();
hb->add_child(loading_label);
search_box = memnew(LineEdit);
search_box->set_placeholder(TTR("Filter Projects"));
search_box->set_accessibility_name(TTRC("Filter Projects"));
search_box->set_tooltip_text(TTR("This field filters projects by name and last path component.\nTo filter projects by name and full path, the query must contain at least one `/` character."));
search_box->set_clear_button_enabled(true);
search_box->connect(SceneStringName(text_changed), callable_mp(this, &ProjectManager::_on_search_term_changed));
@ -1387,14 +1391,16 @@ ProjectManager::ProjectManager() {
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hb->add_child(search_box);
Label *sort_label = memnew(Label);
sort_label = memnew(Label);
sort_label->set_text(TTR("Sort:"));
sort_label->set_focus_mode(Control::FOCUS_NONE);
hb->add_child(sort_label);
filter_option = memnew(OptionButton);
filter_option->set_clip_text(true);
filter_option->set_h_size_flags(Control::SIZE_EXPAND_FILL);
filter_option->set_stretch_ratio(0.3);
filter_option->set_accessibility_name(TTRC("Sort"));
filter_option->connect(SceneStringName(item_selected), callable_mp(this, &ProjectManager::_on_order_option_changed));
hb->add_child(filter_option);
@ -1493,6 +1499,7 @@ ProjectManager::ProjectManager() {
open_btn_container->add_child(memnew(VSeparator));
open_options_btn = memnew(Button);
open_options_btn->set_accessibility_name(TTRC("Options"));
open_options_btn->set_icon_alignment(HorizontalAlignment::HORIZONTAL_ALIGNMENT_CENTER);
open_options_btn->connect(SceneStringName(pressed), callable_mp(this, &ProjectManager::_open_options_popup));
open_btn_container->add_child(open_options_btn);
@ -1520,6 +1527,7 @@ ProjectManager::ProjectManager() {
manage_tags_btn = memnew(Button);
manage_tags_btn->set_text(TTR("Manage Tags"));
manage_tags_btn->set_shortcut(ED_SHORTCUT("project_manager/project_tags", TTR("Manage Tags"), KeyModifierMask::CMD_OR_CTRL | Key::T));
project_list_sidebar->add_child(manage_tags_btn);
erase_btn = memnew(Button);
@ -1713,6 +1721,7 @@ ProjectManager::ProjectManager() {
new_tag_name = memnew(LineEdit);
tag_vb->add_child(new_tag_name);
new_tag_name->set_accessibility_name(TTRC("New Tag Name"));
new_tag_name->connect(SceneStringName(text_changed), callable_mp(this, &ProjectManager::_set_new_tag_name));
new_tag_name->connect(SceneStringName(text_submitted), callable_mp(this, &ProjectManager::_create_new_tag).unbind(1));
create_tag_dialog->connect("about_to_popup", callable_mp(new_tag_name, &LineEdit::clear));
@ -1722,6 +1731,7 @@ ProjectManager::ProjectManager() {
tag_vb->add_child(tag_error);
create_tag_btn = memnew(Button);
create_tag_btn->set_accessibility_name(TTRC("Create Tag"));
all_tags->add_child(create_tag_btn);
create_tag_btn->connect(SceneStringName(pressed), callable_mp((Window *)create_tag_dialog, &Window::popup_centered).bind(Vector2i(500, 0) * EDSCALE));
}