Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display loading text while the project manager is loading #45785

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2015,6 +2015,10 @@ 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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any code that would actually hide it again once it finished loading?

Copy link
Member Author

@Calinou Calinou Feb 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akien-mga The project manager quits as soon as the project is starting to be opened. Therefore, there should be no need to hide the text.


const Set<String> &selected_list = _project_list->get_selected_project_keys();

for (const Set<String>::Element *E = selected_list.front(); E; E = E->next()) {
Expand Down Expand Up @@ -2268,11 +2272,6 @@ void ProjectManager::_restart_confirm() {
get_tree()->quit();
}

void ProjectManager::_exit_dialog() {
_dim_window();
get_tree()->quit();
}

void ProjectManager::_install_project(const String &p_zip_path, const String &p_title) {
npdialog->set_mode(ProjectDialog::MODE_INSTALL);
npdialog->set_zip_path(p_zip_path);
Expand Down Expand Up @@ -2351,7 +2350,6 @@ void ProjectManager::_on_search_term_changed(const String &p_term) {
}

void ProjectManager::_bind_methods() {
ClassDB::bind_method("_exit_dialog", &ProjectManager::_exit_dialog);
ClassDB::bind_method("_unhandled_key_input", &ProjectManager::_unhandled_key_input);
ClassDB::bind_method("_update_project_buttons", &ProjectManager::_update_project_buttons);
}
Expand Down Expand Up @@ -2481,7 +2479,12 @@ ProjectManager::ProjectManager() {
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hb->add_child(search_box);

hb->add_spacer();
loading_label = memnew(Label(TTR("Loading, please wait...")));
loading_label->add_theme_font_override("font", get_theme_font("bold", "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));

Label *sort_label = memnew(Label);
sort_label->set_text(TTR("Sort:"));
Expand Down
2 changes: 1 addition & 1 deletion editor/project_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class ProjectManager : public Control {
ProjectList *_project_list;

LineEdit *search_box;
Label *loading_label;
OptionButton *filter_option;

Button *run_btn;
Expand Down Expand Up @@ -98,7 +99,6 @@ class ProjectManager : public Control {
void _update_project_buttons();
void _language_selected(int p_id);
void _restart_confirm();
void _exit_dialog();
void _confirm_update_settings();
void _nonempty_confirmation_ok_pressed();

Expand Down