summaryrefslogtreecommitdiff
path: root/editor/project_export.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/project_export.cpp')
-rw-r--r--editor/project_export.cpp110
1 files changed, 68 insertions, 42 deletions
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 617ad62d4a..753125eb03 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -40,6 +40,7 @@
#include "core/project_settings.h"
#include "editor_data.h"
#include "editor_node.h"
+#include "editor_scale.h"
#include "editor_settings.h"
#include "scene/gui/box_container.h"
#include "scene/gui/margin_container.h"
@@ -52,7 +53,7 @@ void ProjectExportDialog::_notification(int p_what) {
case NOTIFICATION_READY: {
duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons"));
delete_preset->set_icon(get_icon("Remove", "EditorIcons"));
- connect("confirmed", this, "_export_pck_zip");
+ connect_compat("confirmed", this, "_export_pck_zip");
custom_feature_display->get_parent_control()->add_style_override("panel", get_stylebox("bg", "Tree"));
} break;
case NOTIFICATION_POPUP_HIDE: {
@@ -253,9 +254,9 @@ void ProjectExportDialog::_edit_preset(int p_index) {
TreeItem *patch_add = patches->create_item(patch_root);
patch_add->set_metadata(0, patchlist.size());
if (patchlist.size() == 0)
- patch_add->set_text(0, "Add initial export...");
+ patch_add->set_text(0, TTR("Add initial export..."));
else
- patch_add->set_text(0, "Add previous patches...");
+ patch_add->set_text(0, TTR("Add previous patches..."));
patch_add->add_button(0, get_icon("folder", "FileDialog"), 1);
@@ -912,10 +913,10 @@ void ProjectExportDialog::_validate_export_path(const String &p_path) {
if (invalid_path) {
export_project->get_ok()->set_disabled(true);
- export_project->get_line_edit()->disconnect("text_entered", export_project, "_file_entered");
+ export_project->get_line_edit()->disconnect_compat("text_entered", export_project, "_file_entered");
} else {
export_project->get_ok()->set_disabled(false);
- export_project->get_line_edit()->connect("text_entered", export_project, "_file_entered");
+ export_project->get_line_edit()->connect_compat("text_entered", export_project, "_file_entered");
}
}
@@ -945,9 +946,9 @@ void ProjectExportDialog::_export_project() {
}
// Ensure that signal is connected if previous attempt left it disconnected with _validate_export_path
- if (!export_project->get_line_edit()->is_connected("text_entered", export_project, "_file_entered")) {
+ if (!export_project->get_line_edit()->is_connected_compat("text_entered", export_project, "_file_entered")) {
export_project->get_ok()->set_disabled(false);
- export_project->get_line_edit()->connect("text_entered", export_project, "_file_entered");
+ export_project->get_line_edit()->connect_compat("text_entered", export_project, "_file_entered");
}
export_project->set_mode(EditorFileDialog::MODE_SAVE_FILE);
@@ -973,7 +974,7 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
error_dialog->set_text(vformat(TTR("Failed to export the project for platform '%s'.\nThis might be due to a configuration issue in the export preset or your export settings."), platform->get_name()));
}
- ERR_PRINTS(vformat("Failed to export the project for platform '%s'.", platform->get_name()));
+ ERR_PRINT(vformat("Failed to export the project for platform '%s'.", platform->get_name()));
error_dialog->show();
error_dialog->popup_centered_minsize(Size2(300, 80));
}
@@ -1071,6 +1072,8 @@ ProjectExportDialog::ProjectExportDialog() {
main_vb->add_child(hbox);
hbox->set_v_size_flags(SIZE_EXPAND_FILL);
+ // Presets list.
+
VBoxContainer *preset_vb = memnew(VBoxContainer);
preset_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbox->add_child(preset_vb);
@@ -1082,7 +1085,7 @@ ProjectExportDialog::ProjectExportDialog() {
add_preset = memnew(MenuButton);
add_preset->set_text(TTR("Add..."));
- add_preset->get_popup()->connect("index_pressed", this, "_add_preset");
+ add_preset->get_popup()->connect_compat("index_pressed", this, "_add_preset");
preset_hb->add_child(add_preset);
MarginContainer *mc = memnew(MarginContainer);
preset_vb->add_child(mc);
@@ -1090,13 +1093,15 @@ ProjectExportDialog::ProjectExportDialog() {
presets = memnew(ItemList);
presets->set_drag_forwarding(this);
mc->add_child(presets);
- presets->connect("item_selected", this, "_edit_preset");
+ presets->connect_compat("item_selected", this, "_edit_preset");
duplicate_preset = memnew(ToolButton);
preset_hb->add_child(duplicate_preset);
- duplicate_preset->connect("pressed", this, "_duplicate_preset");
+ duplicate_preset->connect_compat("pressed", this, "_duplicate_preset");
delete_preset = memnew(ToolButton);
preset_hb->add_child(delete_preset);
- delete_preset->connect("pressed", this, "_delete_preset");
+ delete_preset->connect_compat("pressed", this, "_delete_preset");
+
+ // Preset settings.
VBoxContainer *settings_vb = memnew(VBoxContainer);
settings_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
@@ -1104,11 +1109,11 @@ ProjectExportDialog::ProjectExportDialog() {
name = memnew(LineEdit);
settings_vb->add_margin_child(TTR("Name:"), name);
- name->connect("text_changed", this, "_name_changed");
+ name->connect_compat("text_changed", this, "_name_changed");
runnable = memnew(CheckButton);
runnable->set_text(TTR("Runnable"));
runnable->set_tooltip(TTR("If checked, the preset will be available for use in one-click deploy.\nOnly one preset per platform may be marked as runnable."));
- runnable->connect("pressed", this, "_runnable_pressed");
+ runnable->connect_compat("pressed", this, "_runnable_pressed");
settings_vb->add_child(runnable);
export_path = memnew(EditorPropertyPath);
@@ -1116,7 +1121,9 @@ ProjectExportDialog::ProjectExportDialog() {
export_path->set_label(TTR("Export Path"));
export_path->set_object_and_property(this, "export_path");
export_path->set_save_mode();
- export_path->connect("property_changed", this, "_export_path_changed");
+ export_path->connect_compat("property_changed", this, "_export_path_changed");
+
+ // Subsections.
sections = memnew(TabContainer);
sections->set_tab_align(TabContainer::ALIGN_LEFT);
@@ -1124,11 +1131,15 @@ ProjectExportDialog::ProjectExportDialog() {
settings_vb->add_child(sections);
sections->set_v_size_flags(SIZE_EXPAND_FILL);
+ // Main preset parameters.
+
parameters = memnew(EditorInspector);
sections->add_child(parameters);
parameters->set_name(TTR("Options"));
parameters->set_v_size_flags(SIZE_EXPAND_FILL);
- parameters->connect("property_edited", this, "_update_parameters");
+ parameters->connect_compat("property_edited", this, "_update_parameters");
+
+ // Resources export parameters.
VBoxContainer *resources_vb = memnew(VBoxContainer);
sections->add_child(resources_vb);
@@ -1139,7 +1150,7 @@ ProjectExportDialog::ProjectExportDialog() {
export_filter->add_item(TTR("Export selected scenes (and dependencies)"));
export_filter->add_item(TTR("Export selected resources (and dependencies)"));
resources_vb->add_margin_child(TTR("Export Mode:"), export_filter);
- export_filter->connect("item_selected", this, "_export_type_changed");
+ export_filter->connect_compat("item_selected", this, "_export_type_changed");
include_label = memnew(Label);
include_label->set_text(TTR("Resources to export:"));
@@ -1150,30 +1161,37 @@ ProjectExportDialog::ProjectExportDialog() {
include_files = memnew(Tree);
include_margin->add_child(include_files);
- include_files->connect("item_edited", this, "_tree_changed");
+ include_files->connect_compat("item_edited", this, "_tree_changed");
include_filters = memnew(LineEdit);
resources_vb->add_margin_child(
TTR("Filters to export non-resource files/folders\n(comma-separated, e.g: *.json, *.txt, docs/*)"),
include_filters);
- include_filters->connect("text_changed", this, "_filter_changed");
+ include_filters->connect_compat("text_changed", this, "_filter_changed");
exclude_filters = memnew(LineEdit);
resources_vb->add_margin_child(
TTR("Filters to exclude files/folders from project\n(comma-separated, e.g: *.json, *.txt, docs/*)"),
exclude_filters);
- exclude_filters->connect("text_changed", this, "_filter_changed");
+ exclude_filters->connect_compat("text_changed", this, "_filter_changed");
+
+ // Patch packages.
VBoxContainer *patch_vb = memnew(VBoxContainer);
sections->add_child(patch_vb);
patch_vb->set_name(TTR("Patches"));
+ // FIXME: Patching support doesn't seem properly implemented yet, so we hide it.
+ // The rest of the code is still kept for now, in the hope that it will be made
+ // functional and reactivated.
+ patch_vb->hide();
+
patches = memnew(Tree);
patch_vb->add_child(patches);
patches->set_v_size_flags(SIZE_EXPAND_FILL);
patches->set_hide_root(true);
- patches->connect("button_pressed", this, "_patch_button_pressed");
- patches->connect("item_edited", this, "_patch_edited");
+ patches->connect_compat("button_pressed", this, "_patch_button_pressed");
+ patches->connect_compat("item_edited", this, "_patch_edited");
patches->set_drag_forwarding(this);
patches->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true);
@@ -1186,20 +1204,22 @@ ProjectExportDialog::ProjectExportDialog() {
patches_hb->add_spacer();
patch_dialog = memnew(EditorFileDialog);
- patch_dialog->add_filter("*.pck ; Pack File");
+ patch_dialog->add_filter("*.pck ; " + TTR("Pack File"));
patch_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
- patch_dialog->connect("file_selected", this, "_patch_selected");
+ patch_dialog->connect_compat("file_selected", this, "_patch_selected");
add_child(patch_dialog);
patch_erase = memnew(ConfirmationDialog);
patch_erase->get_ok()->set_text(TTR("Delete"));
- patch_erase->connect("confirmed", this, "_patch_deleted");
+ patch_erase->connect_compat("confirmed", this, "_patch_deleted");
add_child(patch_erase);
+ // Feature tags.
+
VBoxContainer *feature_vb = memnew(VBoxContainer);
feature_vb->set_name(TTR("Features"));
custom_features = memnew(LineEdit);
- custom_features->connect("text_changed", this, "_custom_features_changed");
+ custom_features->connect_compat("text_changed", this, "_custom_features_changed");
feature_vb->add_margin_child(TTR("Custom (comma-separated):"), custom_features);
Panel *features_panel = memnew(Panel);
custom_feature_display = memnew(RichTextLabel);
@@ -1209,6 +1229,8 @@ ProjectExportDialog::ProjectExportDialog() {
feature_vb->add_margin_child(TTR("Feature List:"), features_panel, true);
sections->add_child(feature_vb);
+ // Script export parameters.
+
updating_script_key = false;
VBoxContainer *script_vb = memnew(VBoxContainer);
@@ -1218,9 +1240,9 @@ ProjectExportDialog::ProjectExportDialog() {
script_mode->add_item(TTR("Text"), (int)EditorExportPreset::MODE_SCRIPT_TEXT);
script_mode->add_item(TTR("Compiled"), (int)EditorExportPreset::MODE_SCRIPT_COMPILED);
script_mode->add_item(TTR("Encrypted (Provide Key Below)"), (int)EditorExportPreset::MODE_SCRIPT_ENCRYPTED);
- script_mode->connect("item_selected", this, "_script_export_mode_changed");
+ script_mode->connect_compat("item_selected", this, "_script_export_mode_changed");
script_key = memnew(LineEdit);
- script_key->connect("text_changed", this, "_script_encryption_key_changed");
+ script_key->connect_compat("text_changed", this, "_script_encryption_key_changed");
script_key_error = memnew(Label);
script_key_error->set_text("- " + TTR("Invalid Encryption Key (must be 64 characters long)"));
script_key_error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
@@ -1228,9 +1250,9 @@ ProjectExportDialog::ProjectExportDialog() {
script_vb->add_child(script_key_error);
sections->add_child(script_vb);
- sections->connect("tab_changed", this, "_tab_changed");
+ sections->connect_compat("tab_changed", this, "_tab_changed");
- //disable by default
+ // Disable by default.
name->set_editable(false);
export_path->hide();
runnable->set_disabled(true);
@@ -1240,17 +1262,21 @@ ProjectExportDialog::ProjectExportDialog() {
sections->hide();
parameters->edit(NULL);
+ // Deletion dialog.
+
delete_confirm = memnew(ConfirmationDialog);
add_child(delete_confirm);
delete_confirm->get_ok()->set_text(TTR("Delete"));
- delete_confirm->connect("confirmed", this, "_delete_preset_confirm");
+ delete_confirm->connect_compat("confirmed", this, "_delete_preset_confirm");
+
+ // Export buttons, dialogs and errors.
updating = false;
get_cancel()->set_text(TTR("Close"));
get_ok()->set_text(TTR("Export PCK/Zip"));
export_button = add_button(TTR("Export Project"), !OS::get_singleton()->get_swap_ok_cancel(), "export");
- export_button->connect("pressed", this, "_export_project");
+ export_button->connect_compat("pressed", this, "_export_project");
// Disable initially before we select a valid preset
export_button->set_disabled(true);
get_ok()->set_disabled(true);
@@ -1262,19 +1288,19 @@ ProjectExportDialog::ProjectExportDialog() {
export_all_dialog->get_ok()->hide();
export_all_dialog->add_button(TTR("Debug"), true, "debug");
export_all_dialog->add_button(TTR("Release"), true, "release");
- export_all_dialog->connect("custom_action", this, "_export_all_dialog_action");
+ export_all_dialog->connect_compat("custom_action", this, "_export_all_dialog_action");
export_all_button = add_button(TTR("Export All"), !OS::get_singleton()->get_swap_ok_cancel(), "export");
- export_all_button->connect("pressed", this, "_export_all_dialog");
+ export_all_button->connect_compat("pressed", this, "_export_all_dialog");
export_all_button->set_disabled(true);
export_pck_zip = memnew(EditorFileDialog);
- export_pck_zip->add_filter("*.zip ; ZIP File");
- export_pck_zip->add_filter("*.pck ; Godot Game Pack");
+ export_pck_zip->add_filter("*.zip ; " + TTR("ZIP File"));
+ export_pck_zip->add_filter("*.pck ; " + TTR("Godot Game Pack"));
export_pck_zip->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
export_pck_zip->set_mode(EditorFileDialog::MODE_SAVE_FILE);
add_child(export_pck_zip);
- export_pck_zip->connect("file_selected", this, "_export_pck_zip_selected");
+ export_pck_zip->connect_compat("file_selected", this, "_export_pck_zip_selected");
export_error = memnew(Label);
main_vb->add_child(export_error);
@@ -1300,13 +1326,13 @@ ProjectExportDialog::ProjectExportDialog() {
download_templates->set_text(TTR("Manage Export Templates"));
download_templates->set_v_size_flags(SIZE_SHRINK_CENTER);
export_templates_error->add_child(download_templates);
- download_templates->connect("pressed", this, "_open_export_template_manager");
+ download_templates->connect_compat("pressed", this, "_open_export_template_manager");
export_project = memnew(EditorFileDialog);
export_project->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
add_child(export_project);
- export_project->connect("file_selected", this, "_export_project_to_path");
- export_project->get_line_edit()->connect("text_changed", this, "_validate_export_path");
+ export_project->connect_compat("file_selected", this, "_export_project_to_path");
+ export_project->get_line_edit()->connect_compat("text_changed", this, "_validate_export_path");
export_debug = memnew(CheckBox);
export_debug->set_text(TTR("Export With Debug"));