Skip to content

Commit

Permalink
Merge pull request #91939 from AThousandShips/pressed_sname
Browse files Browse the repository at this point in the history
[Scene] Add `SceneStringNames::pressed`
  • Loading branch information
akien-mga committed May 14, 2024
2 parents 882449f + ee79386 commit c0d2464
Show file tree
Hide file tree
Showing 147 changed files with 727 additions and 722 deletions.
6 changes: 3 additions & 3 deletions editor/action_map_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,8 @@ ActionMapEditor::ActionMapEditor() {

Button *clear_all_search = memnew(Button);
clear_all_search->set_text(TTR("Clear All"));
clear_all_search->connect("pressed", callable_mp(action_list_search_by_event, &EventListenerLineEdit::clear_event));
clear_all_search->connect("pressed", callable_mp(action_list_search, &LineEdit::clear));
clear_all_search->connect(SceneStringName(pressed), callable_mp(action_list_search_by_event, &EventListenerLineEdit::clear_event));
clear_all_search->connect(SceneStringName(pressed), callable_mp(action_list_search, &LineEdit::clear));
top_hbox->add_child(clear_all_search);

// Adding Action line edit + button
Expand All @@ -570,7 +570,7 @@ ActionMapEditor::ActionMapEditor() {

add_button = memnew(Button);
add_button->set_text(TTR("Add"));
add_button->connect("pressed", callable_mp(this, &ActionMapEditor::_add_action_pressed));
add_button->connect(SceneStringName(pressed), callable_mp(this, &ActionMapEditor::_add_action_pressed));
add_hbox->add_child(add_button);
// Disable the button and set its tooltip.
_add_edit_text_changed(add_edit->get_text());
Expand Down
20 changes: 10 additions & 10 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() {
loop = memnew(Button);
loop->set_flat(true);
loop->set_tooltip_text(TTR("Animation Looping"));
loop->connect("pressed", callable_mp(this, &AnimationTimelineEdit::_anim_loop_pressed));
loop->connect(SceneStringName(pressed), callable_mp(this, &AnimationTimelineEdit::_anim_loop_pressed));
loop->set_toggle_mode(true);
len_hb->add_child(loop);
add_child(len_hb);
Expand Down Expand Up @@ -7226,21 +7226,21 @@ AnimationTrackEditor::AnimationTrackEditor() {
imported_anim_warning->hide();
imported_anim_warning->set_text(TTR("Imported Scene"));
imported_anim_warning->set_tooltip_text(TTR("Warning: Editing imported animation"));
imported_anim_warning->connect("pressed", callable_mp(this, &AnimationTrackEditor::_show_imported_anim_warning));
imported_anim_warning->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_show_imported_anim_warning));
bottom_hb->add_child(imported_anim_warning);

dummy_player_warning = memnew(Button);
dummy_player_warning->hide();
dummy_player_warning->set_text(TTR("Dummy Player"));
dummy_player_warning->set_tooltip_text(TTR("Warning: Editing dummy AnimationPlayer"));
dummy_player_warning->connect("pressed", callable_mp(this, &AnimationTrackEditor::_show_dummy_player_warning));
dummy_player_warning->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_show_dummy_player_warning));
bottom_hb->add_child(dummy_player_warning);

inactive_player_warning = memnew(Button);
inactive_player_warning->hide();
inactive_player_warning->set_text(TTR("Inactive Player"));
inactive_player_warning->set_tooltip_text(TTR("Warning: AnimationPlayer is inactive"));
inactive_player_warning->connect("pressed", callable_mp(this, &AnimationTrackEditor::_show_inactive_player_warning));
inactive_player_warning->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_show_inactive_player_warning));
bottom_hb->add_child(inactive_player_warning);

bottom_hb->add_spacer();
Expand All @@ -7249,22 +7249,22 @@ AnimationTrackEditor::AnimationTrackEditor() {
bezier_edit_icon->set_flat(true);
bezier_edit_icon->set_disabled(true);
bezier_edit_icon->set_toggle_mode(true);
bezier_edit_icon->connect("pressed", callable_mp(this, &AnimationTrackEditor::_toggle_bezier_edit));
bezier_edit_icon->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_toggle_bezier_edit));
bezier_edit_icon->set_tooltip_text(TTR("Toggle between the bezier curve editor and track editor."));

bottom_hb->add_child(bezier_edit_icon);

selected_filter = memnew(Button);
selected_filter->set_flat(true);
selected_filter->connect("pressed", callable_mp(this, &AnimationTrackEditor::_view_group_toggle)); // Same function works the same.
selected_filter->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_view_group_toggle)); // Same function works the same.
selected_filter->set_toggle_mode(true);
selected_filter->set_tooltip_text(TTR("Only show tracks from nodes selected in tree."));

bottom_hb->add_child(selected_filter);

view_group = memnew(Button);
view_group->set_flat(true);
view_group->connect("pressed", callable_mp(this, &AnimationTrackEditor::_view_group_toggle));
view_group->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_view_group_toggle));
view_group->set_toggle_mode(true);
view_group->set_tooltip_text(TTR("Group tracks by node or display them as plain list."));

Expand Down Expand Up @@ -7314,14 +7314,14 @@ AnimationTrackEditor::AnimationTrackEditor() {

auto_fit = memnew(Button);
auto_fit->set_flat(true);
auto_fit->connect("pressed", callable_mp(this, &AnimationTrackEditor::_auto_fit));
auto_fit->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_auto_fit));
auto_fit->set_shortcut(ED_SHORTCUT("animation_editor/auto_fit", TTR("Fit to panel"), KeyModifierMask::ALT | Key::F));
bottom_hb->add_child(auto_fit);

auto_fit_bezier = memnew(Button);
auto_fit_bezier->set_flat(true);
auto_fit_bezier->set_visible(false);
auto_fit_bezier->connect("pressed", callable_mp(this, &AnimationTrackEditor::_auto_fit_bezier));
auto_fit_bezier->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_auto_fit_bezier));
auto_fit_bezier->set_shortcut(ED_SHORTCUT("animation_editor/auto_fit", TTR("Fit to panel"), KeyModifierMask::ALT | Key::F));
bottom_hb->add_child(auto_fit_bezier);

Expand Down Expand Up @@ -7572,7 +7572,7 @@ AnimationTrackEditor::AnimationTrackEditor() {

Button *select_all_button = memnew(Button);
select_all_button->set_text(TTR("Select All/None"));
select_all_button->connect("pressed", callable_mp(this, &AnimationTrackEditor::_select_all_tracks_for_copy));
select_all_button->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_select_all_tracks_for_copy));
track_copy_vbox->add_child(select_all_button);

track_copy_select = memnew(Tree);
Expand Down
16 changes: 8 additions & 8 deletions editor/code_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,14 +721,14 @@ FindReplaceBar::FindReplaceBar() {
find_prev->set_tooltip_text(TTR("Previous Match"));
hbc_button_search->add_child(find_prev);
find_prev->set_focus_mode(FOCUS_NONE);
find_prev->connect("pressed", callable_mp(this, &FindReplaceBar::search_prev));
find_prev->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::search_prev));

find_next = memnew(Button);
find_next->set_flat(true);
find_next->set_tooltip_text(TTR("Next Match"));
hbc_button_search->add_child(find_next);
find_next->set_focus_mode(FOCUS_NONE);
find_next->connect("pressed", callable_mp(this, &FindReplaceBar::search_next));
find_next->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::search_next));

case_sensitive = memnew(CheckBox);
hbc_option_search->add_child(case_sensitive);
Expand All @@ -754,12 +754,12 @@ FindReplaceBar::FindReplaceBar() {
replace = memnew(Button);
hbc_button_replace->add_child(replace);
replace->set_text(TTR("Replace"));
replace->connect("pressed", callable_mp(this, &FindReplaceBar::_replace));
replace->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_replace));

replace_all = memnew(Button);
hbc_button_replace->add_child(replace_all);
replace_all->set_text(TTR("Replace All"));
replace_all->connect("pressed", callable_mp(this, &FindReplaceBar::_replace_all));
replace_all->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_replace_all));

selection_only = memnew(CheckBox);
hbc_option_replace->add_child(selection_only);
Expand All @@ -771,7 +771,7 @@ FindReplaceBar::FindReplaceBar() {
add_child(hide_button);
hide_button->set_tooltip_text(TTR("Hide"));
hide_button->set_focus_mode(FOCUS_NONE);
hide_button->connect("pressed", callable_mp(this, &FindReplaceBar::_hide_bar).bind(false));
hide_button->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_hide_bar).bind(false));
hide_button->set_v_size_flags(SIZE_SHRINK_CENTER);
}

Expand Down Expand Up @@ -1713,7 +1713,7 @@ CodeTextEditor::CodeTextEditor() {
toggle_scripts_button = memnew(Button);
toggle_scripts_button->set_flat(true);
toggle_scripts_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
toggle_scripts_button->connect("pressed", callable_mp(this, &CodeTextEditor::_toggle_scripts_pressed));
toggle_scripts_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_toggle_scripts_pressed));
status_bar->add_child(toggle_scripts_button);
toggle_scripts_button->hide();

Expand All @@ -1736,7 +1736,7 @@ CodeTextEditor::CodeTextEditor() {
status_bar->add_child(error_button);
error_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
error_button->set_default_cursor_shape(CURSOR_POINTING_HAND);
error_button->connect("pressed", callable_mp(this, &CodeTextEditor::_error_button_pressed));
error_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_error_button_pressed));
error_button->set_tooltip_text(TTR("Errors"));
set_error_count(0);

Expand All @@ -1746,7 +1746,7 @@ CodeTextEditor::CodeTextEditor() {
status_bar->add_child(warning_button);
warning_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
warning_button->set_default_cursor_shape(CURSOR_POINTING_HAND);
warning_button->connect("pressed", callable_mp(this, &CodeTextEditor::_warning_button_pressed));
warning_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_warning_button_pressed));
warning_button->set_tooltip_text(TTR("Warnings"));
set_warning_count(0);

Expand Down
16 changes: 8 additions & 8 deletions editor/connections_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ ConnectDialog::ConnectDialog() {
Button *focus_current = memnew(Button);
hbc_filter->add_child(focus_current);
focus_current->set_text(TTR("Go to Source"));
focus_current->connect("pressed", callable_mp(this, &ConnectDialog::_focus_currently_connected));
focus_current->connect(SceneStringName(pressed), callable_mp(this, &ConnectDialog::_focus_currently_connected));

Node *mc = vbc_left->add_margin_child(TTR("Connect to Script:"), hbc_filter, false);
connect_to_label = Object::cast_to<Label>(vbc_left->get_child(mc->get_index() - 1));
Expand Down Expand Up @@ -768,13 +768,13 @@ ConnectDialog::ConnectDialog() {
method_vbc->add_child(script_methods_only);
script_methods_only->set_h_size_flags(Control::SIZE_SHRINK_END);
script_methods_only->set_pressed(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "show_script_methods_only", true));
script_methods_only->connect("pressed", callable_mp(this, &ConnectDialog::_method_check_button_pressed).bind(script_methods_only));
script_methods_only->connect(SceneStringName(pressed), callable_mp(this, &ConnectDialog::_method_check_button_pressed).bind(script_methods_only));

compatible_methods_only = memnew(CheckButton(TTR("Compatible Methods Only")));
method_vbc->add_child(compatible_methods_only);
compatible_methods_only->set_h_size_flags(Control::SIZE_SHRINK_END);
compatible_methods_only->set_pressed(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "show_compatible_methods_only", true));
compatible_methods_only->connect("pressed", callable_mp(this, &ConnectDialog::_method_check_button_pressed).bind(compatible_methods_only));
compatible_methods_only->connect(SceneStringName(pressed), callable_mp(this, &ConnectDialog::_method_check_button_pressed).bind(compatible_methods_only));

vbc_right = memnew(VBoxContainer);
main_hb->add_child(vbc_right);
Expand All @@ -800,13 +800,13 @@ ConnectDialog::ConnectDialog() {
Button *add_bind = memnew(Button);
add_bind->set_text(TTR("Add"));
add_bind_hb->add_child(add_bind);
add_bind->connect("pressed", callable_mp(this, &ConnectDialog::_add_bind));
add_bind->connect(SceneStringName(pressed), callable_mp(this, &ConnectDialog::_add_bind));
bind_controls.push_back(add_bind);

Button *del_bind = memnew(Button);
del_bind->set_text(TTR("Remove"));
add_bind_hb->add_child(del_bind);
del_bind->connect("pressed", callable_mp(this, &ConnectDialog::_remove_bind));
del_bind->connect(SceneStringName(pressed), callable_mp(this, &ConnectDialog::_remove_bind));
bind_controls.push_back(del_bind);

vbc_right->add_margin_child(TTR("Add Extra Call Argument:"), add_bind_hb);
Expand Down Expand Up @@ -834,13 +834,13 @@ ConnectDialog::ConnectDialog() {
open_method_tree = memnew(Button);
hbc_method->add_child(open_method_tree);
open_method_tree->set_text("Pick");
open_method_tree->connect("pressed", callable_mp(this, &ConnectDialog::_open_method_popup));
open_method_tree->connect(SceneStringName(pressed), callable_mp(this, &ConnectDialog::_open_method_popup));

advanced = memnew(CheckButton(TTR("Advanced")));
vbc_left->add_child(advanced);
advanced->set_h_size_flags(Control::SIZE_SHRINK_BEGIN | Control::SIZE_EXPAND);
advanced->set_pressed(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "use_advanced_connections", false));
advanced->connect("pressed", callable_mp(this, &ConnectDialog::_advanced_pressed));
advanced->connect(SceneStringName(pressed), callable_mp(this, &ConnectDialog::_advanced_pressed));

HBoxContainer *hbox = memnew(HBoxContainer);
vbc_right->add_child(hbox);
Expand Down Expand Up @@ -1583,7 +1583,7 @@ ConnectionsDock::ConnectionsDock() {
vbc->add_child(hb);
hb->add_spacer();
hb->add_child(connect_button);
connect_button->connect("pressed", callable_mp(this, &ConnectionsDock::_connect_pressed));
connect_button->connect(SceneStringName(pressed), callable_mp(this, &ConnectionsDock::_connect_pressed));

connect_dialog = memnew(ConnectDialog);
connect_dialog->connect("connected", callable_mp(NodeDock::get_singleton(), &NodeDock::restore_last_valid_node), CONNECT_DEFERRED);
Expand Down
2 changes: 1 addition & 1 deletion editor/create_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ CreateDialog::CreateDialog() {
favorite = memnew(Button);
favorite->set_toggle_mode(true);
favorite->set_tooltip_text(TTR("(Un)favorite selected item."));
favorite->connect("pressed", callable_mp(this, &CreateDialog::_favorite_toggled));
favorite->connect(SceneStringName(pressed), callable_mp(this, &CreateDialog::_favorite_toggled));
search_hb->add_child(favorite);
vbc->add_margin_child(TTR("Search:"), search_hb);

Expand Down
2 changes: 1 addition & 1 deletion editor/debugger/debug_adapter/debug_adapter_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ DebugAdapterProtocol::DebugAdapterProtocol() {

reset_ids();

EditorRunBar::get_singleton()->get_pause_button()->connect("pressed", callable_mp(this, &DebugAdapterProtocol::on_debug_paused));
EditorRunBar::get_singleton()->get_pause_button()->connect(SceneStringName(pressed), callable_mp(this, &DebugAdapterProtocol::on_debug_paused));

EditorDebuggerNode *debugger_node = EditorDebuggerNode::get_singleton();
debugger_node->connect("breakpoint_toggled", callable_mp(this, &DebugAdapterProtocol::on_debug_breakpoint_toggled));
Expand Down
2 changes: 1 addition & 1 deletion editor/debugger/editor_debugger_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ EditorDebuggerNode::EditorDebuggerNode() {
remote_scene_tree_timeout = EDITOR_GET("debugger/remote_scene_tree_refresh_interval");
inspect_edited_object_timeout = EDITOR_GET("debugger/remote_inspect_refresh_interval");

EditorRunBar::get_singleton()->get_pause_button()->connect("pressed", callable_mp(this, &EditorDebuggerNode::_paused));
EditorRunBar::get_singleton()->get_pause_button()->connect(SceneStringName(pressed), callable_mp(this, &EditorDebuggerNode::_paused));
}

ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() {
Expand Down
6 changes: 3 additions & 3 deletions editor/debugger/editor_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,12 @@ EditorProfiler::EditorProfiler() {
activate->set_toggle_mode(true);
activate->set_disabled(true);
activate->set_text(TTR("Start"));
activate->connect("pressed", callable_mp(this, &EditorProfiler::_activate_pressed));
activate->connect(SceneStringName(pressed), callable_mp(this, &EditorProfiler::_activate_pressed));
hb->add_child(activate);

clear_button = memnew(Button);
clear_button->set_text(TTR("Clear"));
clear_button->connect("pressed", callable_mp(this, &EditorProfiler::_clear_pressed));
clear_button->connect(SceneStringName(pressed), callable_mp(this, &EditorProfiler::_clear_pressed));
clear_button->set_disabled(true);
hb->add_child(clear_button);

Expand Down Expand Up @@ -649,7 +649,7 @@ EditorProfiler::EditorProfiler() {
display_internal_profiles = memnew(CheckButton(TTR("Display internal functions")));
display_internal_profiles->set_visible(EDITOR_GET("debugger/profile_native_calls"));
display_internal_profiles->set_pressed(false);
display_internal_profiles->connect("pressed", callable_mp(this, &EditorProfiler::_internal_profiles_pressed));
display_internal_profiles->connect(SceneStringName(pressed), callable_mp(this, &EditorProfiler::_internal_profiles_pressed));
hb->add_child(display_internal_profiles);

hb->add_spacer();
Expand Down
8 changes: 4 additions & 4 deletions editor/debugger/editor_visual_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,13 +736,13 @@ EditorVisualProfiler::EditorVisualProfiler() {
activate->set_toggle_mode(true);
activate->set_disabled(true);
activate->set_text(TTR("Start"));
activate->connect("pressed", callable_mp(this, &EditorVisualProfiler::_activate_pressed));
activate->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_activate_pressed));
hb->add_child(activate);

clear_button = memnew(Button);
clear_button->set_text(TTR("Clear"));
clear_button->set_disabled(true);
clear_button->connect("pressed", callable_mp(this, &EditorVisualProfiler::_clear_pressed));
clear_button->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_clear_pressed));
hb->add_child(clear_button);

hb->add_child(memnew(Label(TTR("Measure:"))));
Expand All @@ -757,11 +757,11 @@ EditorVisualProfiler::EditorVisualProfiler() {
frame_relative = memnew(CheckBox(TTR("Fit to Frame")));
frame_relative->set_pressed(true);
hb->add_child(frame_relative);
frame_relative->connect("pressed", callable_mp(this, &EditorVisualProfiler::_update_plot));
frame_relative->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_update_plot));
linked = memnew(CheckBox(TTR("Linked")));
linked->set_pressed(true);
hb->add_child(linked);
linked->connect("pressed", callable_mp(this, &EditorVisualProfiler::_update_plot));
linked->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_update_plot));

hb->add_spacer();

Expand Down
Loading

0 comments on commit c0d2464

Please sign in to comment.