mirror of
https://github.com/godotengine/godot.git
synced 2026-05-12 22:35:35 +00:00
Merge pull request #114921 from LucaTuerk/quick_open_validate_history
EditorQuickOpenDialog: Rewrite internal paths usage and clean history
This commit is contained in:
@@ -129,6 +129,11 @@ String EditorFileSystemDirectory::get_file_path(int p_idx) const {
|
||||
return get_path().path_join(get_file(p_idx));
|
||||
}
|
||||
|
||||
ResourceUID::ID EditorFileSystemDirectory::get_file_uid(int p_idx) const {
|
||||
ERR_FAIL_INDEX_V(p_idx, files.size(), ResourceUID::INVALID_ID);
|
||||
return files[p_idx]->uid;
|
||||
}
|
||||
|
||||
Vector<String> EditorFileSystemDirectory::get_file_deps(int p_idx) const {
|
||||
ERR_FAIL_INDEX_V(p_idx, files.size(), Vector<String>());
|
||||
Vector<String> deps;
|
||||
|
||||
@@ -91,6 +91,7 @@ public:
|
||||
int get_file_count() const;
|
||||
String get_file(int p_idx) const;
|
||||
String get_file_path(int p_idx) const;
|
||||
ResourceUID::ID get_file_uid(int p_idx) const;
|
||||
StringName get_file_type(int p_idx) const;
|
||||
StringName get_file_resource_script_class(int p_idx) const;
|
||||
Vector<String> get_file_deps(int p_idx) const;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -60,9 +60,12 @@ enum class QuickOpenDisplayMode {
|
||||
};
|
||||
|
||||
struct QuickOpenResultCandidate {
|
||||
String file_path;
|
||||
ResourceUID::ID uid;
|
||||
Ref<Texture2D> thumbnail;
|
||||
const FuzzySearchResult *result = nullptr;
|
||||
|
||||
static QuickOpenResultCandidate from_uid(const ResourceUID::ID &p_uid, bool &r_success);
|
||||
static QuickOpenResultCandidate from_result(const FuzzySearchResult &p_result, bool &r_success);
|
||||
};
|
||||
|
||||
class HighlightedLabel : public Label {
|
||||
@@ -95,7 +98,8 @@ public:
|
||||
void update_results();
|
||||
|
||||
bool has_nothing_selected() const;
|
||||
String get_selected() const;
|
||||
ResourceUID::ID get_selected() const;
|
||||
String get_selected_path() const;
|
||||
|
||||
bool is_instant_preview_enabled() const;
|
||||
void set_instant_preview_toggle_visible(bool p_visible);
|
||||
@@ -113,12 +117,13 @@ private:
|
||||
|
||||
Vector<FuzzySearchResult> search_results;
|
||||
Vector<StringName> base_types;
|
||||
Vector<String> filepaths;
|
||||
AHashMap<String, StringName> filetypes;
|
||||
LocalVector<ResourceUID::ID> uids;
|
||||
AHashMap<ResourceUID::ID, StringName> filetypes;
|
||||
Vector<QuickOpenResultCandidate> candidates;
|
||||
HashSet<ResourceUID::ID> candidates_uids;
|
||||
|
||||
AHashMap<StringName, Vector<QuickOpenResultCandidate>> selected_history;
|
||||
HashSet<String> history_set;
|
||||
AHashMap<StringName, Vector<ResourceUID::ID>> selected_history;
|
||||
HashSet<ResourceUID::ID> history_set;
|
||||
|
||||
String query;
|
||||
int selection_index = -1;
|
||||
@@ -151,13 +156,12 @@ private:
|
||||
static QuickOpenDisplayMode get_adaptive_display_mode(const Vector<StringName> &p_base_types);
|
||||
|
||||
void _ensure_result_vector_capacity();
|
||||
void _sort_filepaths(int p_max_results);
|
||||
void _sort_uids(int p_max_results);
|
||||
void _create_initial_results();
|
||||
void _find_filepaths_in_folder(EditorFileSystemDirectory *p_directory, bool p_include_addons);
|
||||
void _find_uids_in_folder(EditorFileSystemDirectory *p_directory, bool p_include_addons);
|
||||
|
||||
Vector<QuickOpenResultCandidate> *_get_history();
|
||||
void _setup_candidate(QuickOpenResultCandidate &p_candidate, const String &p_filepath);
|
||||
void _setup_candidate(QuickOpenResultCandidate &p_candidate, const FuzzySearchResult &p_result);
|
||||
Vector<ResourceUID::ID> *_get_history();
|
||||
void _add_candidate(QuickOpenResultCandidate &p_candidate);
|
||||
void _update_fuzzy_search_results();
|
||||
void _use_default_candidates();
|
||||
void _score_and_sort_candidates();
|
||||
|
||||
Reference in New Issue
Block a user