diff options
Diffstat (limited to 'editor/quick_open.h')
-rw-r--r-- | editor/quick_open.h | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/editor/quick_open.h b/editor/quick_open.h index 5bcdfc7bf2..6486ee0221 100644 --- a/editor/quick_open.h +++ b/editor/quick_open.h @@ -31,7 +31,7 @@ #ifndef EDITOR_QUICK_OPEN_H #define EDITOR_QUICK_OPEN_H -#include "core/pair.h" +#include "core/oa_hash_map.h" #include "editor_file_system.h" #include "scene/gui/dialogs.h" #include "scene/gui/tree.h" @@ -41,19 +41,32 @@ class EditorQuickOpen : public ConfirmationDialog { LineEdit *search_box; Tree *search_options; - StringName base_type; - StringName ei; - StringName ot; + bool allow_multi_select; - void _update_search(); + Vector<String> files; + OAHashMap<String, Ref<Texture2D>> icons; - void _sbox_input(const Ref<InputEvent> &p_ie); - void _parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<String, Ref<Texture2D>>> &list); - Vector<Pair<String, Ref<Texture2D>>> _sort_fs(Vector<Pair<String, Ref<Texture2D>>> &list); - float _score_path(String search, String path) const; + struct Entry { + String path; + float score; + }; + + struct EntryComparator { + _FORCE_INLINE_ bool operator()(const Entry &A, const Entry &B) const { + return A.score > B.score; + } + }; + + void _update_search(); + void _build_search_cache(EditorFileSystemDirectory *p_efsd); + float _score_path(const String &p_search, const String &p_path); void _confirmed(); + virtual void cancel_pressed() override; + void _cleanup(); + + void _sbox_input(const Ref<InputEvent> &p_ie); void _text_changed(const String &p_newtext); void _theme_changed(); |