diff options
Diffstat (limited to 'editor/editor_help_search.cpp')
-rw-r--r-- | editor/editor_help_search.cpp | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index c747ae326f..424195e4dd 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -185,7 +185,7 @@ EditorHelpSearch::EditorHelpSearch() { set_title(TTR("Search Help")); get_ok_button()->set_disabled(true); - get_ok_button()->set_text(TTR("Open")); + set_ok_button_text(TTR("Open")); // Split search and results area. VBoxContainer *vbox = memnew(VBoxContainer); @@ -250,7 +250,7 @@ EditorHelpSearch::EditorHelpSearch() { results_tree->set_hide_root(true); results_tree->set_select_mode(Tree::SELECT_ROW); results_tree->connect("item_activated", callable_mp(this, &EditorHelpSearch::_confirmed)); - results_tree->connect("item_selected", callable_mp((BaseButton *)get_ok_button(), &BaseButton::set_disabled), varray(false)); + results_tree->connect("item_selected", callable_mp((BaseButton *)get_ok_button(), &BaseButton::set_disabled).bind(false)); vbox->add_child(results_tree, true); } @@ -313,7 +313,7 @@ bool EditorHelpSearch::Runner::_slice() { } bool EditorHelpSearch::Runner::_phase_match_classes_init() { - iterator_doc = EditorHelp::get_doc_data()->class_list.front(); + iterator_doc = EditorHelp::get_doc_data()->class_list.begin(); matches.clear(); matched_item = nullptr; match_highest_score = 0; @@ -322,17 +322,18 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() { } bool EditorHelpSearch::Runner::_phase_match_classes() { - DocData::ClassDoc &class_doc = iterator_doc->value(); + DocData::ClassDoc &class_doc = iterator_doc->value; + if (class_doc.name.is_empty()) { + return false; + } if (!_is_class_disabled_by_feature_profile(class_doc.name)) { - matches[class_doc.name] = ClassMatch(); - ClassMatch &match = matches[class_doc.name]; - + ClassMatch match; match.doc = &class_doc; // Match class name. if (search_flags & SEARCH_CLASSES) { // If the search term is empty, add any classes which are not script docs or which don't start with - // a double-quotation. This will ensure that only C++ classes and explictly named classes will + // a double-quotation. This will ensure that only C++ classes and explicitly named classes will // be added. match.name = (term.is_empty() && (!class_doc.is_script_doc || class_doc.name[0] != '\"')) || _match_string(term, class_doc.name); } @@ -400,16 +401,17 @@ bool EditorHelpSearch::Runner::_phase_match_classes() { } } } + matches[class_doc.name] = match; } matches[class_doc.name] = match; } - iterator_doc = iterator_doc->next(); + ++iterator_doc; return !iterator_doc; } bool EditorHelpSearch::Runner::_phase_class_items_init() { - iterator_match = matches.front(); + iterator_match = matches.begin(); results_tree->clear(); root_item = results_tree->create_item(); @@ -419,7 +421,10 @@ bool EditorHelpSearch::Runner::_phase_class_items_init() { } bool EditorHelpSearch::Runner::_phase_class_items() { - ClassMatch &match = iterator_match->value(); + if (!iterator_match) { + return false; + } + ClassMatch &match = iterator_match->value; if (search_flags & SEARCH_SHOW_HIERARCHY) { if (match.required()) { @@ -431,18 +436,25 @@ bool EditorHelpSearch::Runner::_phase_class_items() { } } - iterator_match = iterator_match->next(); + ++iterator_match; return !iterator_match; } bool EditorHelpSearch::Runner::_phase_member_items_init() { - iterator_match = matches.front(); + iterator_match = matches.begin(); return true; } bool EditorHelpSearch::Runner::_phase_member_items() { - ClassMatch &match = iterator_match->value(); + ClassMatch &match = iterator_match->value; + + if (!match.doc) { + return false; + } + if (match.doc->name.is_empty()) { + return false; + } TreeItem *parent = (search_flags & SEARCH_SHOW_HIERARCHY) ? class_items[match.doc->name] : root_item; bool constructor_created = false; @@ -473,7 +485,7 @@ bool EditorHelpSearch::Runner::_phase_member_items() { _create_theme_property_item(parent, match.doc, match.theme_properties[i]); } - iterator_match = iterator_match->next(); + ++iterator_match; return !iterator_match; } @@ -511,6 +523,9 @@ void EditorHelpSearch::Runner::_match_item(TreeItem *p_item, const String &p_tex } TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_match) { + if (p_match.doc->name.is_empty()) { + return nullptr; + } if (class_items.has(p_match.doc->name)) { return class_items[p_match.doc->name]; } @@ -522,7 +537,9 @@ TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_ parent = class_items[p_match.doc->inherits]; } else { ClassMatch &base_match = matches[p_match.doc->inherits]; - parent = _create_class_hierarchy(base_match); + if (base_match.doc) { + parent = _create_class_hierarchy(base_match); + } } } |