1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

[Scene] Add SceneStringNames::pressed

This commit is contained in:
A Thousand Ships
2024-05-14 09:40:21 +02:00
parent 78cce1954d
commit ee79386f7b
147 changed files with 727 additions and 722 deletions

View File

@@ -165,10 +165,10 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) {
if (p_clickable) {
author->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
icon->set_default_cursor_shape(CURSOR_POINTING_HAND);
icon->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_asset_clicked));
title->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_asset_clicked));
category->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_category_clicked));
author->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_author_clicked));
icon->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItem::_asset_clicked));
title->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItem::_asset_clicked));
category->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItem::_category_clicked));
author->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItem::_author_clicked));
} else {
title->set_mouse_filter(MOUSE_FILTER_IGNORE);
category->set_mouse_filter(MOUSE_FILTER_IGNORE);
@@ -303,7 +303,7 @@ void EditorAssetLibraryItemDescription::add_preview(int p_id, bool p_video, cons
new_preview.button = memnew(Button);
new_preview.button->set_icon(previews->get_editor_theme_icon(SNAME("ThumbnailWait")));
new_preview.button->set_toggle_mode(true);
new_preview.button->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDescription::_preview_click).bind(p_id));
new_preview.button->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItemDescription::_preview_click).bind(p_id));
preview_hb->add_child(new_preview.button);
if (!p_video) {
new_preview.image = previews->get_editor_theme_icon(SNAME("ThumbnailWait"));
@@ -577,7 +577,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
title->set_h_size_flags(Control::SIZE_EXPAND_FILL);
dismiss_button = memnew(TextureButton);
dismiss_button->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDownload::_close));
dismiss_button->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItemDownload::_close));
title_hb->add_child(dismiss_button);
title->set_clip_text(true);
@@ -597,11 +597,11 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
install_button = memnew(Button);
install_button->set_text(TTR("Install..."));
install_button->set_disabled(true);
install_button->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDownload::install));
install_button->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItemDownload::install));
retry_button = memnew(Button);
retry_button->set_text(TTR("Retry"));
retry_button->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDownload::_make_request));
retry_button->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItemDownload::_make_request));
// Only show the Retry button in case of a failure.
retry_button->hide();
@@ -1134,7 +1134,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
first->set_text(TTR("First", "Pagination"));
first->set_theme_type_variation("PanelBackgroundButton");
if (p_page != 0) {
first->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search).bind(0));
first->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibrary::_search).bind(0));
} else {
first->set_disabled(true);
first->set_focus_mode(Control::FOCUS_NONE);
@@ -1145,7 +1145,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
prev->set_text(TTR("Previous", "Pagination"));
prev->set_theme_type_variation("PanelBackgroundButton");
if (p_page > 0) {
prev->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search).bind(p_page - 1));
prev->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibrary::_search).bind(p_page - 1));
} else {
prev->set_disabled(true);
prev->set_focus_mode(Control::FOCUS_NONE);
@@ -1162,7 +1162,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
current->set_disabled(true);
current->set_focus_mode(Control::FOCUS_NONE);
} else {
current->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search).bind(i));
current->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibrary::_search).bind(i));
}
hbc->add_child(current);
}
@@ -1171,7 +1171,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
next->set_text(TTR("Next", "Pagination"));
next->set_theme_type_variation("PanelBackgroundButton");
if (p_page < p_page_count - 1) {
next->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search).bind(p_page + 1));
next->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibrary::_search).bind(p_page + 1));
} else {
next->set_disabled(true);
next->set_focus_mode(Control::FOCUS_NONE);
@@ -1183,7 +1183,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
last->set_text(TTR("Last", "Pagination"));
last->set_theme_type_variation("PanelBackgroundButton");
if (p_page != p_page_count - 1) {
last->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search).bind(p_page_count - 1));
last->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibrary::_search).bind(p_page_count - 1));
} else {
last->set_disabled(true);
last->set_focus_mode(Control::FOCUS_NONE);
@@ -1542,7 +1542,7 @@ void EditorAssetLibrary::_set_library_message(const String &p_message) {
library_message->set_text(p_message);
if (library_message_action.is_valid()) {
library_message_button->disconnect("pressed", library_message_action);
library_message_button->disconnect(SceneStringName(pressed), library_message_action);
library_message_action = Callable();
}
library_message_button->hide();
@@ -1555,11 +1555,11 @@ void EditorAssetLibrary::_set_library_message_with_action(const String &p_messag
library_message_button->set_text(p_action_text);
if (library_message_action.is_valid()) {
library_message_button->disconnect("pressed", library_message_action);
library_message_button->disconnect(SceneStringName(pressed), library_message_action);
library_message_action = Callable();
}
library_message_action = p_action;
library_message_button->connect("pressed", library_message_action);
library_message_button->connect(SceneStringName(pressed), library_message_action);
library_message_button->show();
library_message_box->show();
@@ -1618,12 +1618,12 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
Button *open_asset = memnew(Button);
open_asset->set_text(TTR("Import..."));
search_hb->add_child(open_asset);
open_asset->connect("pressed", callable_mp(this, &EditorAssetLibrary::_asset_open));
open_asset->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibrary::_asset_open));
Button *plugins = memnew(Button);
plugins->set_text(TTR("Plugins..."));
search_hb->add_child(plugins);
plugins->connect("pressed", callable_mp(this, &EditorAssetLibrary::_manage_plugins));
plugins->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibrary::_manage_plugins));
if (p_templates_only) {
open_asset->hide();