diff options
Diffstat (limited to 'editor/project_manager.cpp')
-rw-r--r-- | editor/project_manager.cpp | 72 |
1 files changed, 44 insertions, 28 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index d74cfe4ec0..379c3bbb01 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1064,7 +1064,7 @@ public: void select_first_visible_project(); void erase_selected_projects(bool p_delete_project_contents); Vector<Item> get_selected_projects() const; - const RBSet<String> &get_selected_project_keys() const; + const HashSet<String> &get_selected_project_keys() const; void ensure_project_visible(int p_index); int get_single_selected_index() const; bool is_any_project_missing() const; @@ -1090,7 +1090,7 @@ private: String _search_term; FilterOption _order_option; - RBSet<String> _selected_project_keys; + HashSet<String> _selected_project_keys; String _last_clicked; // Project key VBoxContainer *_scroll_children; int _icon_load_index; @@ -1258,7 +1258,7 @@ void ProjectList::load_projects() { List<PropertyInfo> properties; EditorSettings::get_singleton()->get_property_list(&properties); - RBSet<String> favorites; + HashSet<String> favorites; // Find favourites... for (const PropertyInfo &E : properties) { String property_key = E.name; @@ -1504,7 +1504,7 @@ void ProjectList::sort_projects() { update_dock_menu(); } -const RBSet<String> &ProjectList::get_selected_project_keys() const { +const HashSet<String> &ProjectList::get_selected_project_keys() const { // Faster if that's all you need return _selected_project_keys; } @@ -1539,7 +1539,7 @@ int ProjectList::get_single_selected_index() const { String key; if (_selected_project_keys.size() == 1) { // Only one selected - key = _selected_project_keys.front()->get(); + key = *_selected_project_keys.begin(); } else { // Multiple selected, consider the last clicked one as "main" key = _last_clicked; @@ -1884,6 +1884,16 @@ void ProjectManager::_notification(int p_what) { if (open_templates->is_visible()) { open_templates->popup_centered(); } + real_t size = get_size().x / EDSCALE; + asset_library->set_columns(size < 1000 ? 1 : 2); + // Adjust names of tabs to fit the new size. + if (size < 650) { + local_projects_hb->set_name(TTR("Local")); + asset_library->set_name(TTR("Asset Library")); + } else { + local_projects_hb->set_name(TTR("Local Projects")); + asset_library->set_name(TTR("Asset Library Projects")); + } } break; case NOTIFICATION_READY: { @@ -2095,12 +2105,12 @@ void ProjectManager::_confirm_update_settings() { void ProjectManager::_open_selected_projects() { // Show loading text to tell the user that the project manager is busy loading. // This is especially important for the HTML5 project manager. - loading_label->set_modulate(Color(1, 1, 1)); + loading_label->show(); - const RBSet<String> &selected_list = _project_list->get_selected_project_keys(); + const HashSet<String> &selected_list = _project_list->get_selected_project_keys(); - for (const RBSet<String>::Element *E = selected_list.front(); E; E = E->next()) { - const String &selected = E->get(); + for (const String &E : selected_list) { + const String &selected = E; String path = EditorSettings::get_singleton()->get("projects/" + selected); String conf = path.plus_file("project.godot"); @@ -2146,7 +2156,7 @@ void ProjectManager::_open_selected_projects() { } void ProjectManager::_open_selected_projects_ask() { - const RBSet<String> &selected_list = _project_list->get_selected_project_keys(); + const HashSet<String> &selected_list = _project_list->get_selected_project_keys(); if (selected_list.size() < 1) { return; @@ -2261,7 +2271,7 @@ void ProjectManager::_run_project_confirm() { } void ProjectManager::_run_project() { - const RBSet<String> &selected_list = _project_list->get_selected_project_keys(); + const HashSet<String> &selected_list = _project_list->get_selected_project_keys(); if (selected_list.size() < 1) { return; @@ -2321,14 +2331,14 @@ void ProjectManager::_import_project() { } void ProjectManager::_rename_project() { - const RBSet<String> &selected_list = _project_list->get_selected_project_keys(); + const HashSet<String> &selected_list = _project_list->get_selected_project_keys(); if (selected_list.size() == 0) { return; } - for (RBSet<String>::Element *E = selected_list.front(); E; E = E->next()) { - const String &selected = E->get(); + for (const String &E : selected_list) { + const String &selected = E; String path = EditorSettings::get_singleton()->get("projects/" + selected); npdialog->set_project_path(path); npdialog->set_mode(ProjectDialog::MODE_RENAME); @@ -2347,7 +2357,7 @@ void ProjectManager::_erase_missing_projects_confirm() { } void ProjectManager::_erase_project() { - const RBSet<String> &selected_list = _project_list->get_selected_project_keys(); + const HashSet<String> &selected_list = _project_list->get_selected_project_keys(); if (selected_list.size() == 0) { return; @@ -2404,7 +2414,7 @@ void ProjectManager::_files_dropped(PackedStringArray p_files) { _install_project(p_files[0], file.substr(0, file.length() - 4).capitalize()); return; } - RBSet<String> folders_set; + HashSet<String> folders_set; Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); for (int i = 0; i < p_files.size(); i++) { String file = p_files[i]; @@ -2412,8 +2422,8 @@ void ProjectManager::_files_dropped(PackedStringArray p_files) { } if (folders_set.size() > 0) { PackedStringArray folders; - for (RBSet<String>::Element *E = folders_set.front(); E; E = E->next()) { - folders.push_back(E->get()); + for (const String &E : folders_set) { + folders.push_back(E); } bool confirm = true; @@ -2567,14 +2577,14 @@ ProjectManager::ProjectManager() { tabs->set_anchors_and_offsets_preset(Control::PRESET_WIDE); tabs->connect("tab_changed", callable_mp(this, &ProjectManager::_on_tab_changed)); - HBoxContainer *projects_hb = memnew(HBoxContainer); - projects_hb->set_name(TTR("Local Projects")); - tabs->add_child(projects_hb); + local_projects_hb = memnew(HBoxContainer); + local_projects_hb->set_name(TTR("Local Projects")); + tabs->add_child(local_projects_hb); { // Projects + search bar VBoxContainer *search_tree_vb = memnew(VBoxContainer); - projects_hb->add_child(search_tree_vb); + local_projects_hb->add_child(search_tree_vb); search_tree_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); HBoxContainer *hb = memnew(HBoxContainer); @@ -2592,8 +2602,8 @@ ProjectManager::ProjectManager() { loading_label->add_theme_font_override("font", get_theme_font(SNAME("bold"), SNAME("EditorFonts"))); loading_label->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(loading_label); - // Hide the label but make it still take up space. This prevents reflows when showing the label. - loading_label->set_modulate(Color(0, 0, 0, 0)); + // The loading label is shown later. + loading_label->hide(); Label *sort_label = memnew(Label); sort_label->set_text(TTR("Sort:")); @@ -2601,7 +2611,7 @@ ProjectManager::ProjectManager() { filter_option = memnew(OptionButton); filter_option->set_clip_text(true); - filter_option->set_custom_minimum_size(Size2(150 * EDSCALE, 10 * EDSCALE)); + filter_option->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter_option->connect("item_selected", callable_mp(this, &ProjectManager::_on_order_option_changed)); hb->add_child(filter_option); @@ -2630,7 +2640,7 @@ ProjectManager::ProjectManager() { // Project tab side bar VBoxContainer *tree_vb = memnew(VBoxContainer); tree_vb->set_custom_minimum_size(Size2(120, 120)); - projects_hb->add_child(tree_vb); + local_projects_hb->add_child(tree_vb); Button *create = memnew(Button); create->set_text(TTR("New Project")); @@ -2727,6 +2737,12 @@ ProjectManager::ProjectManager() { language_btn->set_icon(get_theme_icon(SNAME("Environment"), SNAME("EditorIcons"))); language_btn->set_focus_mode(Control::FOCUS_NONE); language_btn->connect("item_selected", callable_mp(this, &ProjectManager::_language_selected)); +#ifdef ANDROID_ENABLED + // The language selection dropdown doesn't work on Android (as the setting isn't saved), see GH-60353. + // Also, the dropdown it spawns is very tall and can't be scrolled without a hardware mouse. + // Hiding the language selection dropdown also leaves more space for the version label to display. + language_btn->hide(); +#endif Vector<String> editor_languages; List<PropertyInfo> editor_settings_properties; @@ -2869,8 +2885,8 @@ ProjectManager::ProjectManager() { SceneTree::get_singleton()->get_root()->connect("files_dropped", callable_mp(this, &ProjectManager::_files_dropped)); - // Define a minimum window size to prevent UI elements from overlapping or being cut off - DisplayServer::get_singleton()->window_set_min_size(Size2(750, 420) * EDSCALE); + // Define a minimum window size to prevent UI elements from overlapping or being cut off. + DisplayServer::get_singleton()->window_set_min_size(Size2(520, 350) * EDSCALE); // Resize the bootsplash window based on Editor display scale EDSCALE. float scale_factor = MAX(1, EDSCALE); |