Fix project manager display at small window sizes

- Don't use minimum size for project order/filter controls.
  This also allows the filter field to become longer at large
  window sizes.
- Hide the loading label instead of changing its opacity.
  This causes a reflow during loading, but this is preferable to having
  the UI overflow.
- Hide the language dropdown on Android as it doesn't work correctly.

This allows the project manager to be displayed correctly at much
lower window sizes than previously.
This commit is contained in:
Hugo Locurcio 2022-05-20 03:08:01 +02:00 committed by Relintai
parent 001ad8c051
commit 35a813b06c

View File

@ -1995,7 +1995,7 @@ void ProjectManager::_global_menu_action(const Variant &p_id, const Variant &p_m
void ProjectManager::_open_selected_projects() { void ProjectManager::_open_selected_projects() {
// Show loading text to tell the user that the project manager is busy loading. // Show loading text to tell the user that the project manager is busy loading.
// This is especially important for the HTML5 project manager. // This is especially important for the HTML5 project manager.
loading_label->set_modulate(Color(1, 1, 1)); loading_label->show();
const Set<String> &selected_list = _project_list->get_selected_project_keys(); const Set<String> &selected_list = _project_list->get_selected_project_keys();
@ -2479,8 +2479,8 @@ ProjectManager::ProjectManager() {
loading_label->add_font_override("font", get_font("bold", "EditorFonts")); loading_label->add_font_override("font", get_font("bold", "EditorFonts"));
loading_label->set_h_size_flags(Control::SIZE_EXPAND_FILL); loading_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
sort_filters->add_child(loading_label); sort_filters->add_child(loading_label);
// Hide the label but make it still take up space. This prevents reflows when showing the label. // The loading label is shown later.
loading_label->set_modulate(Color(0, 0, 0, 0)); loading_label->hide();
Label *sort_label = memnew(Label); Label *sort_label = memnew(Label);
sort_label->set_text(TTR("Sort:")); sort_label->set_text(TTR("Sort:"));
@ -2495,7 +2495,6 @@ ProjectManager::ProjectManager() {
project_order_filter->set_filter_size(150); project_order_filter->set_filter_size(150);
sort_filters->add_child(project_order_filter); sort_filters->add_child(project_order_filter);
project_order_filter->connect("filter_changed", this, "_on_order_option_changed"); project_order_filter->connect("filter_changed", this, "_on_order_option_changed");
project_order_filter->set_custom_minimum_size(Size2(180, 10) * EDSCALE);
int projects_sorting_order = (int)EditorSettings::get_singleton()->get("project_manager/sorting_order"); int projects_sorting_order = (int)EditorSettings::get_singleton()->get("project_manager/sorting_order");
project_order_filter->set_filter_option((ProjectListFilter::FilterOption)projects_sorting_order); project_order_filter->set_filter_option((ProjectListFilter::FilterOption)projects_sorting_order);
@ -2503,7 +2502,7 @@ ProjectManager::ProjectManager() {
project_filter = memnew(ProjectListFilter); project_filter = memnew(ProjectListFilter);
project_filter->add_search_box(); project_filter->add_search_box();
project_filter->connect("filter_changed", this, "_on_filter_option_changed"); project_filter->connect("filter_changed", this, "_on_filter_option_changed");
project_filter->set_custom_minimum_size(Size2(280, 10) * EDSCALE); project_filter->set_h_size_flags(SIZE_EXPAND_FILL);
sort_filters->add_child(project_filter); sort_filters->add_child(project_filter);
search_tree_vb->add_child(sort_filters); search_tree_vb->add_child(sort_filters);
@ -2627,6 +2626,12 @@ ProjectManager::ProjectManager() {
language_btn = memnew(OptionButton); language_btn = memnew(OptionButton);
language_btn->set_flat(true); language_btn->set_flat(true);
language_btn->set_focus_mode(Control::FOCUS_NONE); language_btn->set_focus_mode(Control::FOCUS_NONE);
#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; Vector<String> editor_languages;
List<PropertyInfo> editor_settings_properties; List<PropertyInfo> editor_settings_properties;
@ -2703,7 +2708,7 @@ ProjectManager::ProjectManager() {
gui_base->add_child(ask_update_settings); gui_base->add_child(ask_update_settings);
// Define a minimum window size to prevent UI elements from overlapping or being cut off. // Define a minimum window size to prevent UI elements from overlapping or being cut off.
OS::get_singleton()->set_min_window_size(Size2(750, 420) * EDSCALE); OS::get_singleton()->set_min_window_size(Size2(520, 350) * EDSCALE);
// Resize the bootsplash window based on editor display scale. // Resize the bootsplash window based on editor display scale.
const float scale_factor = MAX(1, EDSCALE); const float scale_factor = MAX(1, EDSCALE);