Replace c-strings with LW_NAME for signals in TreeSearch(Panel)

This commit is contained in:
Alexander Montag 2024-09-30 17:07:26 +00:00
parent 683834f58e
commit 8d781da1a6
No known key found for this signature in database
GPG Key ID: 07FE50B35A2B7524
3 changed files with 15 additions and 11 deletions

View File

@ -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() {

View File

@ -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");

View File

@ -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;