From 8d781da1a64133921ac3b46bd4910fcf0829428c Mon Sep 17 00:00:00 2001 From: Alexander Montag Date: Mon, 30 Sep 2024 17:07:26 +0000 Subject: [PATCH] Replace c-strings with LW_NAME for signals in TreeSearch(Panel) --- editor/tree_search.cpp | 22 +++++++++++----------- util/limbo_string_names.cpp | 2 ++ util/limbo_string_names.h | 2 ++ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/editor/tree_search.cpp b/editor/tree_search.cpp index 3462d80..03a11cb 100644 --- a/editor/tree_search.cpp +++ b/editor/tree_search.cpp @@ -445,8 +445,8 @@ void TreeSearch::update_search(Tree *p_tree) { TreeSearch::TreeSearch(TreeSearchPanel *p_search_panel) { search_panel = p_search_panel; - search_panel->connect("text_submitted", callable_mp(this, &TreeSearch::_select_next_match)); - search_panel->connect("closed", callable_mp(this, &TreeSearch::_on_search_panel_closed)); + search_panel->connect(LW_NAME(text_submitted), callable_mp(this, &TreeSearch::_select_next_match)); + search_panel->connect(LW_NAME(Close), callable_mp(this, &TreeSearch::_on_search_panel_closed)); } /* !TreeSearch */ @@ -491,16 +491,16 @@ void TreeSearchPanel::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { // close callbacks - close_button->connect("pressed", Callable(this, "set_visible").bind(false)); - close_button->connect("pressed", Callable(this, "emit_signal").bind("closed")); + close_button->connect(LW_NAME(pressed), Callable(this, LW_NAME(set_visible)).bind(false)); + close_button->connect(LW_NAME(pressed), Callable(this, LW_NAME(emit_signal)).bind(LW_NAME(Close))); close_button->set_shortcut(LW_GET_SHORTCUT("limbo_ai/hide_tree_search")); // search callbacks - Callable c_update_requested = Callable(this, "emit_signal").bind("update_requested"); - Callable c_text_submitted = Callable((Object *)this, "emit_signal").bind("text_submitted"); + Callable c_update_requested = Callable(this, LW_NAME(emit_signal)).bind("update_requested"); + Callable c_text_submitted = Callable((Object *)this, LW_NAME(emit_signal)).bind(LW_NAME(text_submitted)); - line_edit_search->connect("text_changed", c_update_requested.unbind(1)); - check_button_filter_highlight->connect("pressed", c_update_requested); - line_edit_search->connect("text_submitted", c_text_submitted.unbind(1)); + line_edit_search->connect(LW_NAME(text_changed), c_update_requested.unbind(1)); + check_button_filter_highlight->connect(LW_NAME(pressed), c_update_requested); + line_edit_search->connect(LW_NAME(text_submitted), c_text_submitted.unbind(1)); break; } case NOTIFICATION_THEME_CHANGED: { @@ -513,8 +513,8 @@ void TreeSearchPanel::_notification(int p_what) { void TreeSearchPanel::_bind_methods() { ADD_SIGNAL(MethodInfo("update_requested")); - ADD_SIGNAL(MethodInfo("text_submitted")); - ADD_SIGNAL(MethodInfo("closed")); + ADD_SIGNAL(MethodInfo(LW_NAME(text_submitted))); + ADD_SIGNAL(MethodInfo(LW_NAME(Close))); } TreeSearchPanel::TreeSearchPanel() { diff --git a/util/limbo_string_names.cpp b/util/limbo_string_names.cpp index 1a13566..97de228 100644 --- a/util/limbo_string_names.cpp +++ b/util/limbo_string_names.cpp @@ -59,6 +59,7 @@ LimboStringNames::LimboStringNames() { EditorFonts = SN("EditorFonts"); EditorIcons = SN("EditorIcons"); EditorStyles = SN("EditorStyles"); + emit_signal = SN("emit_signal"); entered = SN("entered"); error_value = SN("error_value"); EVENT_FAILURE = SN("failure"); @@ -124,6 +125,7 @@ LimboStringNames::LimboStringNames() { separation = SN("separation"); set_custom_name = SN("set_custom_name"); set_root_task = SN("set_root_task"); + set_visible = SN("set_visible"); set_v_scroll = SN("set_v_scroll"); setup = SN("setup"); started = SN("started"); diff --git a/util/limbo_string_names.h b/util/limbo_string_names.h index 6e4c0ba..d1f7036 100644 --- a/util/limbo_string_names.h +++ b/util/limbo_string_names.h @@ -75,6 +75,7 @@ public: StringName EditorFonts; StringName EditorIcons; StringName EditorStyles; + StringName emit_signal; StringName entered; StringName error_value; StringName EVENT_FAILURE; @@ -140,6 +141,7 @@ public: StringName separation; StringName set_custom_name; StringName set_root_task; + StringName set_visible; StringName set_v_scroll; StringName setup; StringName started;