Skip to content

Commit

Permalink
Merge pull request #45785 from Calinou/project-manager-add-loading-text
Browse files Browse the repository at this point in the history
Display loading text while the project manager is loading
  • Loading branch information
akien-mga authored Feb 12, 2021
2 parents dbddf52 + 8be5125 commit d3867b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
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));

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

0 comments on commit d3867b2

Please sign in to comment.