2
0
Эх сурвалжийг харах

Added "See Migration Guide" button to the Project Manager

patwork 2 сар өмнө
parent
commit
b4627b7a0a

+ 14 - 2
editor/project_manager.cpp

@@ -288,6 +288,9 @@ void ProjectManager::_update_theme(bool p_skip_creation) {
 			open_options_popup->set_item_icon(1, get_editor_theme_icon(SNAME("NodeWarning")));
 		}
 
+		// Dialogs
+		migration_guide_button->set_button_icon(get_editor_theme_icon(SNAME("ExternalLink")));
+
 		// Asset library popup.
 		if (asset_library) {
 			// Removes extra border margins.
@@ -567,6 +570,7 @@ void ProjectManager::_open_selected_projects_check_warnings() {
 	ask_update_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_LEFT); // Reset in case of previous center align.
 	ask_update_backup->set_pressed(false);
 	full_convert_button->hide();
+	migration_guide_button->hide();
 	ask_update_backup->hide();
 
 	ask_update_settings->get_ok_button()->set_text("OK");
@@ -581,14 +585,14 @@ void ProjectManager::_open_selected_projects_check_warnings() {
 	if (config_version < ProjectSettings::CONFIG_VERSION) {
 		if (config_version == GODOT4_CONFIG_VERSION - 1 && ProjectSettings::CONFIG_VERSION == GODOT4_CONFIG_VERSION) { // Conversion from Godot 3 to 4.
 			full_convert_button->show();
-			ask_update_backup->show();
 			ask_update_label->set_text(vformat(TTR("The selected project \"%s\" was generated by Godot 3.x, and needs to be converted for Godot 4.x.\n\nProject path: %s\n\nYou have three options:\n- Convert only the configuration file (\"project.godot\"). Use this to open the project without attempting to convert its scenes, resources and scripts.\n- Convert the entire project including its scenes, resources and scripts (recommended if you are upgrading).\n- Do nothing and go back.\n\nWarning: If you select a conversion option, you won't be able to open the project with previous versions of the engine anymore."), project.project_name, project.path));
 			ask_update_settings->get_ok_button()->set_text(TTRC("Convert project.godot Only"));
 		} else {
-			ask_update_backup->show();
 			ask_update_label->set_text(vformat(TTR("The selected project \"%s\" was generated by an older engine version, and needs to be converted for this version.\n\nProject path: %s\n\nDo you want to convert it?\n\nWarning: You won't be able to open the project with previous versions of the engine anymore."), project.project_name, project.path));
 			ask_update_settings->get_ok_button()->set_text(TTRC("Convert project.godot"));
 		}
+		ask_update_backup->show();
+		migration_guide_button->show();
 		ask_update_settings->popup_centered(popup_min_size);
 		ask_update_settings->get_cancel_button()->grab_focus(); // To prevent accidents.
 		return;
@@ -614,6 +618,7 @@ void ProjectManager::_open_selected_projects_check_warnings() {
 				i--;
 			} else if (ProjectList::project_feature_looks_like_version(feature)) {
 				ask_update_backup->show();
+				migration_guide_button->show();
 				version_convert_feature = feature;
 				warning_message += vformat(TTR("Warning: This project was last edited in Godot %s. Opening will change it to Godot %s.\n\n"), Variant(feature), Variant(GODOT_VERSION_BRANCH));
 				unsupported_features.remove_at(i);
@@ -1088,6 +1093,11 @@ void ProjectManager::_full_convert_button_pressed() {
 	ask_full_convert_dialog->get_cancel_button()->grab_focus();
 }
 
+void ProjectManager::_migration_guide_button_pressed() {
+	const String url = vformat("%s/tutorials/migrating/index.html", GODOT_VERSION_DOCS_URL);
+	OS::get_singleton()->shell_open(url);
+}
+
 void ProjectManager::_perform_full_project_conversion() {
 	Vector<ProjectList::Item> selected_list = project_list->get_selected_projects();
 	if (selected_list.is_empty()) {
@@ -1728,6 +1738,8 @@ ProjectManager::ProjectManager() {
 		}
 		full_convert_button = ask_update_settings->add_button(TTRC("Convert Full Project"), ed_swap_cancel_ok != 2);
 		full_convert_button->connect(SceneStringName(pressed), callable_mp(this, &ProjectManager::_full_convert_button_pressed));
+		migration_guide_button = ask_update_settings->add_button(TTRC("See Migration Guide"), ed_swap_cancel_ok != 2);
+		migration_guide_button->connect(SceneStringName(pressed), callable_mp(this, &ProjectManager::_migration_guide_button_pressed));
 
 		ask_full_convert_dialog = memnew(ConfirmationDialog);
 		ask_full_convert_dialog->set_autowrap(true);

+ 2 - 0
editor/project_manager.h

@@ -244,6 +244,7 @@ class ProjectManager : public Control {
 	Label *ask_update_label = nullptr;
 	CheckBox *ask_update_backup = nullptr;
 	Button *full_convert_button = nullptr;
+	Button *migration_guide_button = nullptr;
 
 	String version_convert_feature;
 	bool open_in_recovery_mode = false;
@@ -253,6 +254,7 @@ class ProjectManager : public Control {
 	void _minor_project_migrate();
 #endif
 	void _full_convert_button_pressed();
+	void _migration_guide_button_pressed();
 	void _perform_full_project_conversion();
 
 	// Input and I/O.