From 04eb5c486a582d923a59631021e1b297450829b6 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 16 Mar 2022 19:55:26 +0800 Subject: [PATCH] Add note about encryption key to export dialog --- editor/project_export.cpp | 15 +++++++++++++++ editor/project_export.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 53c5aaf0412..64414d145e3 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -38,6 +38,7 @@ #include "core/os/file_access.h" #include "core/os/os.h" #include "core/project_settings.h" +#include "core/version_generated.gen.h" #include "editor_data.h" #include "editor_node.h" #include "editor_scale.h" @@ -428,6 +429,10 @@ void ProjectExportDialog::_export_path_changed(const StringName &p_property, con _update_presets(); } +void ProjectExportDialog::_open_key_help_link() { + OS::get_singleton()->shell_open(vformat("%s/development/compiling/compiling_with_script_encryption_key.html", VERSION_DOCS_URL)); +} + void ProjectExportDialog::_script_export_mode_changed(int p_mode) { if (updating) { return; @@ -937,6 +942,7 @@ void ProjectExportDialog::_bind_methods() { ClassDB::bind_method("_open_export_template_manager", &ProjectExportDialog::_open_export_template_manager); ClassDB::bind_method("_validate_export_path", &ProjectExportDialog::_validate_export_path); ClassDB::bind_method("_export_path_changed", &ProjectExportDialog::_export_path_changed); + ClassDB::bind_method("_open_key_help_link", &ProjectExportDialog::_open_key_help_link); ClassDB::bind_method("_script_export_mode_changed", &ProjectExportDialog::_script_export_mode_changed); ClassDB::bind_method("_script_encryption_key_changed", &ProjectExportDialog::_script_encryption_key_changed); ClassDB::bind_method("_export_project", &ProjectExportDialog::_export_project); @@ -1101,6 +1107,15 @@ ProjectExportDialog::ProjectExportDialog() { script_vb->add_child(script_key_error); sections->add_child(script_vb); + Label *sec_info = memnew(Label); + sec_info->set_text(TTR("Note: Encryption key needs to be stored in the binary,\nyou need to build the export templates from source.")); + script_vb->add_child(sec_info); + + LinkButton *sec_more_info = memnew(LinkButton); + sec_more_info->set_text(TTR("More Info...")); + sec_more_info->connect("pressed", this, "_open_key_help_link"); + script_vb->add_child(sec_more_info); + sections->connect("tab_changed", this, "_tab_changed"); // Disable by default. diff --git a/editor/project_export.h b/editor/project_export.h index 7201255a702..c3d1edfedb8 100644 --- a/editor/project_export.h +++ b/editor/project_export.h @@ -156,6 +156,8 @@ private: void _script_encryption_key_changed(const String &p_key); bool _validate_script_encryption_key(const String &p_key); + void _open_key_help_link(); + void _tab_changed(int); protected: