This commit is contained in:
Spartan322
2025-04-19 07:12:16 -04:00
5209 changed files with 229124 additions and 66199 deletions

View File

@@ -85,7 +85,7 @@ void ProjectDialog::_validate_path() {
_set_message("", MESSAGE_SUCCESS, INSTALL_PATH);
if (project_name->get_text().strip_edges().is_empty()) {
_set_message(TTR("It would be a good idea to name your project."), MESSAGE_ERROR);
_set_message(TTRC("It would be a good idea to name your project."), MESSAGE_ERROR);
return;
}
@@ -121,7 +121,7 @@ void ProjectDialog::_validate_path() {
unzFile pkg = unzOpen2(zip_path.utf8().get_data(), &io);
if (!pkg) {
_set_message(TTR("Invalid \".zip\" project file; it is not in ZIP format."), MESSAGE_ERROR);
_set_message(TTRC("Invalid \".zip\" project file; it is not in ZIP format."), MESSAGE_ERROR);
unzClose(pkg);
return;
}
@@ -149,7 +149,7 @@ void ProjectDialog::_validate_path() {
}
if (ret == UNZ_END_OF_LIST_OF_FILE) {
_set_message(TTR("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
_set_message(TTRC("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
unzClose(pkg);
return;
}
@@ -161,30 +161,30 @@ void ProjectDialog::_validate_path() {
create_dir->hide();
install_path_container->hide();
_set_message(TTR("Valid project found at path."), MESSAGE_SUCCESS);
_set_message(TTRC("Valid project found at path."), MESSAGE_SUCCESS);
} else {
create_dir->hide();
install_path_container->hide();
_set_message(TTR("Please choose a \"project.godot\", a directory with one, or a \".zip\" file."), MESSAGE_ERROR);
_set_message(TTRC("Please choose a \"project.godot\", a directory with one, or a \".zip\" file."), MESSAGE_ERROR);
return;
}
}
if (target_path.is_relative_path()) {
_set_message(TTR("The path specified is invalid."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("The path specified is invalid."), MESSAGE_ERROR, target_path_input_type);
return;
}
if (target_path.get_file() != OS::get_singleton()->get_safe_dir_name(target_path.get_file())) {
_set_message(TTR("The directory name specified contains invalid characters or trailing whitespace."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("The directory name specified contains invalid characters or trailing whitespace."), MESSAGE_ERROR, target_path_input_type);
return;
}
String working_dir = d->get_current_dir();
String executable_dir = OS::get_singleton()->get_executable_path().get_base_dir();
if (target_path == working_dir || target_path == executable_dir) {
_set_message(TTR("Creating a project at the engine's working directory or executable directory is not allowed, as it would prevent the project manager from starting."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("Creating a project at the engine's working directory or executable directory is not allowed, as it would prevent the project manager from starting."), MESSAGE_ERROR, target_path_input_type);
return;
}
@@ -196,7 +196,7 @@ void ProjectDialog::_validate_path() {
#endif
String documents_dir = OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS);
if (target_path == home_dir || target_path == documents_dir) {
_set_message(TTR("You cannot save a project at the selected path. Please create a subfolder or choose a new path."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("You cannot save a project at the selected path. Please create a subfolder or choose a new path."), MESSAGE_ERROR, target_path_input_type);
return;
}
@@ -204,24 +204,24 @@ void ProjectDialog::_validate_path() {
if (mode == MODE_NEW || mode == MODE_INSTALL || (mode == MODE_IMPORT && target_path_input_type == InputType::INSTALL_PATH)) {
if (create_dir->is_pressed()) {
if (!d->dir_exists(target_path.get_base_dir())) {
_set_message(TTR("The parent directory of the path specified doesn't exist."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("The parent directory of the path specified doesn't exist."), MESSAGE_ERROR, target_path_input_type);
return;
}
if (d->dir_exists(target_path)) {
// The path is not necessarily empty here, but we will update the message later if it isn't.
_set_message(TTR("The project folder already exists and is empty."), MESSAGE_SUCCESS, target_path_input_type);
_set_message(TTRC("The project folder already exists and is empty."), MESSAGE_SUCCESS, target_path_input_type);
} else {
_set_message(TTR("The project folder will be automatically created."), MESSAGE_SUCCESS, target_path_input_type);
_set_message(TTRC("The project folder will be automatically created."), MESSAGE_SUCCESS, target_path_input_type);
}
} else {
if (!d->dir_exists(target_path)) {
_set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("The path specified doesn't exist."), MESSAGE_ERROR, target_path_input_type);
return;
}
// The path is not necessarily empty here, but we will update the message later if it isn't.
_set_message(TTR("The project folder exists and is empty."), MESSAGE_SUCCESS, target_path_input_type);
_set_message(TTRC("The project folder exists and is empty."), MESSAGE_SUCCESS, target_path_input_type);
}
// Check if the directory is empty. Not an error, but we want to warn the user.
@@ -242,7 +242,7 @@ void ProjectDialog::_validate_path() {
d->list_dir_end();
if (!is_folder_empty) {
_set_message(TTR("The selected path is not empty. Choosing an empty folder is highly recommended."), MESSAGE_WARNING, target_path_input_type);
_set_message(TTRC("The selected path is not empty. Choosing an empty folder is highly recommended."), MESSAGE_WARNING, target_path_input_type);
}
}
}
@@ -279,7 +279,7 @@ void ProjectDialog::_update_target_auto_dir() {
case 0: // No convention
break;
case 1: // kebab-case
new_auto_dir = new_auto_dir.to_lower().replace(" ", "-");
new_auto_dir = new_auto_dir.to_kebab_case();
break;
case 2: // snake_case
new_auto_dir = new_auto_dir.to_snake_case();
@@ -378,7 +378,7 @@ void ProjectDialog::_browse_project_path() {
if (mode == MODE_IMPORT) {
fdialog_project->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_ANY);
fdialog_project->clear_filters();
fdialog_project->add_filter("project.godot", vformat("%s %s", VERSION_NAME, TTR("Project")));
fdialog_project->add_filter("project.godot", vformat("%s %s", REDOT_VERSION_NAME, TTR("Project")));
fdialog_project->add_filter("*.zip", TTR("ZIP File"));
} else {
fdialog_project->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR);
@@ -499,8 +499,8 @@ void ProjectDialog::ok_pressed() {
if (!is_folder_empty) {
if (!nonempty_confirmation) {
nonempty_confirmation = memnew(ConfirmationDialog);
nonempty_confirmation->set_title(TTR("Warning: This folder is not empty"));
nonempty_confirmation->set_text(TTR("You are about to create a Redot project in a non-empty folder.\nThe entire contents of this folder will be imported as project resources!\n\nAre you sure you wish to continue?"));
nonempty_confirmation->set_title(TTRC("Warning: This folder is not empty"));
nonempty_confirmation->set_text(TTRC("You are about to create a Redot project in a non-empty folder.\nThe entire contents of this folder will be imported as project resources!\n\nAre you sure you wish to continue?"));
nonempty_confirmation->get_ok_button()->connect(SceneStringName(pressed), callable_mp(this, &ProjectDialog::_nonempty_confirmation_ok_pressed));
add_child(nonempty_confirmation);
}
@@ -514,7 +514,7 @@ void ProjectDialog::ok_pressed() {
if (create_dir->is_pressed()) {
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (!d->dir_exists(path) && d->make_dir(path) != OK) {
_set_message(TTR("Couldn't create project directory, check permissions."), MESSAGE_ERROR);
_set_message(TTRC("Couldn't create project directory, check permissions."), MESSAGE_ERROR);
return;
}
}
@@ -550,14 +550,14 @@ void ProjectDialog::ok_pressed() {
Error err = ProjectSettings::get_singleton()->save_custom(path.path_join("project.godot"), initial_settings, Vector<String>(), false);
if (err != OK) {
_set_message(TTR("Couldn't create project.godot in project path."), MESSAGE_ERROR);
_set_message(TTRC("Couldn't create project.godot in project path."), MESSAGE_ERROR);
return;
}
// Store default project icon in SVG format.
Ref<FileAccess> fa_icon = FileAccess::open(path.path_join("icon.svg"), FileAccess::WRITE, &err);
if (err != OK) {
_set_message(TTR("Couldn't create icon.svg in project path."), MESSAGE_ERROR);
_set_message(TTRC("Couldn't create icon.svg in project path."), MESSAGE_ERROR);
return;
}
fa_icon->store_string(get_default_project_icon());
@@ -598,7 +598,7 @@ void ProjectDialog::ok_pressed() {
unzFile pkg = unzOpen2(zip_path.utf8().get_data(), &io);
if (!pkg) {
dialog_error->set_text(TTR("Error opening package file, not in ZIP format."));
dialog_error->set_text(TTRC("Error opening package file, not in ZIP format."));
dialog_error->popup_centered();
return;
}
@@ -629,7 +629,7 @@ void ProjectDialog::ok_pressed() {
}
if (ret == UNZ_END_OF_LIST_OF_FILE) {
_set_message(TTR("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
_set_message(TTRC("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
unzClose(pkg);
return;
}
@@ -637,7 +637,7 @@ void ProjectDialog::ok_pressed() {
if (create_dir->is_pressed()) {
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (!d->dir_exists(path) && d->make_dir(path) != OK) {
_set_message(TTR("Couldn't create project directory, check permissions."), MESSAGE_ERROR);
_set_message(TTRC("Couldn't create project directory, check permissions."), MESSAGE_ERROR);
return;
}
}
@@ -727,6 +727,17 @@ void ProjectDialog::ok_pressed() {
hide();
if (mode == MODE_NEW || mode == MODE_IMPORT || mode == MODE_INSTALL) {
#ifdef ANDROID_ENABLED
// Create a .nomedia file to hide assets from media apps on Android.
const String nomedia_file_path = path.path_join(".nomedia");
Ref<FileAccess> f2 = FileAccess::open(nomedia_file_path, FileAccess::WRITE);
if (f2.is_null()) {
// .nomedia isn't so critical.
ERR_PRINT("Couldn't create .nomedia in project path.");
} else {
f2->close();
}
#endif
emit_signal(SNAME("project_created"), path, edit_check_box->is_pressed());
} else if (mode == MODE_RENAME) {
emit_signal(SNAME("projects_updated"));
@@ -763,8 +774,8 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
// Name and path are set in `ProjectManager::_rename_project`.
project_path->set_editable(false);
set_title(TTR("Rename Project"));
set_ok_button_text(TTR("Rename"));
set_title(TTRC("Rename Project"));
set_ok_button_text(TTRC("Rename"));
create_dir->hide();
project_status_rect->hide();
@@ -803,8 +814,8 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
edit_check_box->show();
if (mode == MODE_IMPORT) {
set_title(TTR("Import Existing Project"));
set_ok_button_text(TTR("Import"));
set_title(TTRC("Import Existing Project"));
set_ok_button_text(TTRC("Import"));
name_container->hide();
install_path_container->hide();
@@ -813,8 +824,8 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
// Project path dialog is also opened; no need to change focus.
} else if (mode == MODE_NEW) {
set_title(TTR("Create New Project"));
set_ok_button_text(TTR("Create"));
set_title(TTRC("Create New Project"));
set_ok_button_text(TTRC("Create"));
name_container->show();
install_path_container->hide();
@@ -825,7 +836,7 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
callable_mp(project_name, &LineEdit::select_all).call_deferred();
} else if (mode == MODE_INSTALL) {
set_title(TTR("Install Project:") + " " + zip_title);
set_ok_button_text(TTR("Install"));
set_ok_button_text(TTRC("Install"));
project_name->set_text(zip_title);
@@ -853,6 +864,10 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
void ProjectDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
_renderer_selected();
} break;
case NOTIFICATION_THEME_CHANGED: {
create_dir->set_button_icon(get_editor_theme_icon(SNAME("FolderCreate")));
project_browse->set_button_icon(get_editor_theme_icon(SNAME("FolderBrowse")));
@@ -883,7 +898,7 @@ ProjectDialog::ProjectDialog() {
vb->add_child(name_container);
Label *l = memnew(Label);
l->set_text(TTR("Project Name:"));
l->set_text(TTRC("Project Name:"));
name_container->add_child(l);
project_name = memnew(LineEdit);
@@ -897,12 +912,12 @@ ProjectDialog::ProjectDialog() {
project_path_container->add_child(pphb_label);
l = memnew(Label);
l->set_text(TTR("Project Path:"));
l->set_text(TTRC("Project Path:"));
l->set_h_size_flags(Control::SIZE_EXPAND_FILL);
pphb_label->add_child(l);
create_dir = memnew(CheckButton);
create_dir->set_text(TTR("Create Folder"));
create_dir->set_text(TTRC("Create Folder"));
create_dir->set_pressed(true);
pphb_label->add_child(create_dir);
create_dir->connect(SceneStringName(toggled), callable_mp(this, &ProjectDialog::_create_dir_toggled));
@@ -912,6 +927,7 @@ ProjectDialog::ProjectDialog() {
project_path = memnew(LineEdit);
project_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
project_path->set_accessibility_name(TTRC("Project Path"));
project_path->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE);
pphb->add_child(project_path);
@@ -919,7 +935,7 @@ ProjectDialog::ProjectDialog() {
vb->add_child(install_path_container);
l = memnew(Label);
l->set_text(TTR("Project Installation Path:"));
l->set_text(TTRC("Project Installation Path:"));
install_path_container->add_child(l);
HBoxContainer *iphb = memnew(HBoxContainer);
@@ -927,6 +943,7 @@ ProjectDialog::ProjectDialog() {
install_path = memnew(LineEdit);
install_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
install_path->set_accessibility_name(TTRC("Install Path"));
install_path->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE);
iphb->add_child(install_path);
@@ -936,7 +953,7 @@ ProjectDialog::ProjectDialog() {
pphb->add_child(project_status_rect);
project_browse = memnew(Button);
project_browse->set_text(TTR("Browse"));
project_browse->set_text(TTRC("Browse"));
project_browse->connect(SceneStringName(pressed), callable_mp(this, &ProjectDialog::_browse_project_path));
pphb->add_child(project_browse);
@@ -946,7 +963,7 @@ ProjectDialog::ProjectDialog() {
iphb->add_child(install_status_rect);
install_browse = memnew(Button);
install_browse->set_text(TTR("Browse"));
install_browse->set_text(TTRC("Browse"));
install_browse->connect(SceneStringName(pressed), callable_mp(this, &ProjectDialog::_browse_install_path));
iphb->add_child(install_browse);
@@ -960,7 +977,7 @@ ProjectDialog::ProjectDialog() {
renderer_container = memnew(VBoxContainer);
vb->add_child(renderer_container);
l = memnew(Label);
l->set_text(TTR("Renderer:"));
l->set_text(TTRC("Renderer:"));
renderer_container->add_child(l);
HBoxContainer *rshc = memnew(HBoxContainer);
renderer_container->add_child(rshc);
@@ -983,7 +1000,7 @@ ProjectDialog::ProjectDialog() {
Button *rs_button = memnew(CheckBox);
rs_button->set_button_group(renderer_button_group);
rs_button->set_text(TTR("Forward+"));
rs_button->set_text(TTRC("Forward+"));
#ifndef RD_ENABLED
rs_button->set_disabled(true);
#endif
@@ -995,7 +1012,7 @@ ProjectDialog::ProjectDialog() {
}
rs_button = memnew(CheckBox);
rs_button->set_button_group(renderer_button_group);
rs_button->set_text(TTR("Mobile"));
rs_button->set_text(TTRC("Mobile"));
#ifndef RD_ENABLED
rs_button->set_disabled(true);
#endif
@@ -1007,7 +1024,7 @@ ProjectDialog::ProjectDialog() {
}
rs_button = memnew(CheckBox);
rs_button->set_button_group(renderer_button_group);
rs_button->set_text(TTR("Compatibility"));
rs_button->set_text(TTRC("Compatibility"));
#if !defined(GLES3_ENABLED)
rs_button->set_disabled(true);
#endif
@@ -1030,7 +1047,7 @@ ProjectDialog::ProjectDialog() {
rvb->add_child(renderer_info);
rd_not_supported = memnew(Label);
rd_not_supported->set_text(vformat(TTR("RenderingDevice-based methods not available on this GPU:\n%s\nPlease use the Compatibility renderer."), RenderingServer::get_singleton()->get_video_adapter_name()));
rd_not_supported->set_text(vformat(TTRC("RenderingDevice-based methods not available on this GPU:\n%s\nPlease use the Compatibility renderer."), RenderingServer::get_singleton()->get_video_adapter_name()));
rd_not_supported->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
rd_not_supported->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
rd_not_supported->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);
@@ -1040,7 +1057,7 @@ ProjectDialog::ProjectDialog() {
_renderer_selected();
l = memnew(Label);
l->set_text(TTR("The renderer can be changed later, but scenes may need to be adjusted."));
l->set_text(TTRC("The renderer can be changed later, but scenes may need to be adjusted."));
// Add some extra spacing to separate it from the list above and the buttons below.
l->set_custom_minimum_size(Size2(0, 40) * EDSCALE);
l->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
@@ -1051,12 +1068,12 @@ ProjectDialog::ProjectDialog() {
default_files_container = memnew(HBoxContainer);
vb->add_child(default_files_container);
l = memnew(Label);
l->set_text(TTR("Version Control Metadata:"));
l->set_text(TTRC("Version Control Metadata:"));
default_files_container->add_child(l);
vcs_metadata_selection = memnew(OptionButton);
vcs_metadata_selection->set_custom_minimum_size(Size2(100, 20));
vcs_metadata_selection->add_item(TTR("None"), (int)EditorVCSInterface::VCSMetadata::NONE);
vcs_metadata_selection->add_item(TTR("Git"), (int)EditorVCSInterface::VCSMetadata::GIT);
vcs_metadata_selection->add_item(TTRC("None"), (int)EditorVCSInterface::VCSMetadata::NONE);
vcs_metadata_selection->add_item(TTRC("Git"), (int)EditorVCSInterface::VCSMetadata::GIT);
vcs_metadata_selection->select((int)EditorVCSInterface::VCSMetadata::GIT);
default_files_container->add_child(vcs_metadata_selection);
Control *spacer = memnew(Control);
@@ -1072,7 +1089,7 @@ ProjectDialog::ProjectDialog() {
vb->add_child(spacer2);
edit_check_box = memnew(CheckBox);
edit_check_box->set_text(TTR("Edit Now"));
edit_check_box->set_text(TTRC("Edit Now"));
edit_check_box->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
edit_check_box->set_pressed(true);
vb->add_child(edit_check_box);