summaryrefslogtreecommitdiff
path: root/editor/export_template_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/export_template_manager.cpp')
-rw-r--r--editor/export_template_manager.cpp44
1 files changed, 23 insertions, 21 deletions
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index f47f9b8b92..5ff4cb6246 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.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 */
@@ -38,6 +38,8 @@
#include "core/version.h"
#include "editor_node.h"
#include "editor_scale.h"
+#include "progress_dialog.h"
+#include "scene/gui/link_button.h"
void ExportTemplateManager::_update_template_list() {
@@ -91,14 +93,14 @@ void ExportTemplateManager::_update_template_list() {
Button *redownload = memnew(Button);
redownload->set_text(TTR("Redownload"));
current_hb->add_child(redownload);
- redownload->connect("pressed", this, "_download_template", varray(current_version));
+ redownload->connect_compat("pressed", this, "_download_template", varray(current_version));
}
Button *uninstall = memnew(Button);
uninstall->set_text(TTR("Uninstall"));
current_hb->add_child(uninstall);
current->set_text(current_version + " " + TTR("(Installed)"));
- uninstall->connect("pressed", this, "_uninstall_template", varray(current_version));
+ uninstall->connect_compat("pressed", this, "_uninstall_template", varray(current_version));
} else {
current->add_color_override("font_color", get_color("error_color", "Editor"));
@@ -110,7 +112,7 @@ void ExportTemplateManager::_update_template_list() {
redownload->set_tooltip(TTR("Official export templates aren't available for development builds."));
}
- redownload->connect("pressed", this, "_download_template", varray(current_version));
+ redownload->connect_compat("pressed", this, "_download_template", varray(current_version));
current_hb->add_child(redownload);
current->set_text(current_version + " " + TTR("(Missing)"));
}
@@ -132,7 +134,7 @@ void ExportTemplateManager::_update_template_list() {
uninstall->set_text(TTR("Uninstall"));
hbc->add_child(uninstall);
- uninstall->connect("pressed", this, "_uninstall_template", varray(E->get()));
+ uninstall->connect_compat("pressed", this, "_uninstall_template", varray(E->get()));
installed_vb->add_child(hbc);
}
@@ -172,7 +174,7 @@ void ExportTemplateManager::_uninstall_template_confirm() {
ERR_FAIL_COND_MSG(err != OK, "Could not remove all templates in '" + templates_dir.plus_file(to_remove) + "'.");
da->change_dir("..");
- da->remove(to_remove);
+ err = da->remove(to_remove);
ERR_FAIL_COND_MSG(err != OK, "Could not remove templates directory at '" + templates_dir.plus_file(to_remove) + "'.");
_update_template_list();
@@ -348,17 +350,17 @@ void ExportTemplateManager::ok_pressed() {
template_open->popup_centered_ratio();
}
-void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) {
+void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) {
if (p_status != HTTPRequest::RESULT_SUCCESS || p_code != 200) {
- EditorNode::get_singleton()->show_warning("Error getting the list of mirrors.");
+ EditorNode::get_singleton()->show_warning(TTR("Error getting the list of mirrors."));
return;
}
String mirror_str;
{
- PoolByteArray::Read r = p_data.read();
- mirror_str.parse_utf8((const char *)r.ptr(), p_data.size());
+ const uint8_t *r = p_data.ptr();
+ mirror_str.parse_utf8((const char *)r, p_data.size());
}
template_list_state->hide();
@@ -369,7 +371,7 @@ void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_
int errline;
Error err = JSON::parse(mirror_str, r, errs, errline);
if (err != OK) {
- EditorNode::get_singleton()->show_warning("Error parsing JSON of mirror list. Please report this issue!");
+ EditorNode::get_singleton()->show_warning(TTR("Error parsing JSON of mirror list. Please report this issue!"));
return;
}
@@ -383,7 +385,7 @@ void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_
ERR_CONTINUE(!m.has("url") || !m.has("name"));
LinkButton *lb = memnew(LinkButton);
lb->set_text(m["name"]);
- lb->connect("pressed", this, "_begin_template_download", varray(m["url"]));
+ lb->connect_compat("pressed", this, "_begin_template_download", varray(m["url"]));
template_list->add_child(lb);
mirrors_found = true;
}
@@ -394,7 +396,7 @@ void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_
return;
}
}
-void ExportTemplateManager::_http_download_templates_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) {
+void ExportTemplateManager::_http_download_templates_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) {
switch (p_status) {
@@ -636,7 +638,7 @@ Error ExportTemplateManager::install_android_template() {
FileAccess::set_unix_permissions(to_write, (info.external_fa >> 16) & 0x01FF);
#endif
} else {
- ERR_PRINTS("Can't uncompress file: " + to_write);
+ ERR_PRINT("Can't uncompress file: " + to_write);
}
}
@@ -687,14 +689,14 @@ ExportTemplateManager::ExportTemplateManager() {
remove_confirm = memnew(ConfirmationDialog);
remove_confirm->set_title(TTR("Remove Template"));
add_child(remove_confirm);
- remove_confirm->connect("confirmed", this, "_uninstall_template_confirm");
+ remove_confirm->connect_compat("confirmed", this, "_uninstall_template_confirm");
template_open = memnew(FileDialog);
template_open->set_title(TTR("Select Template File"));
- template_open->add_filter("*.tpz ; Godot Export Templates");
+ template_open->add_filter("*.tpz ; " + TTR("Godot Export Templates"));
template_open->set_access(FileDialog::ACCESS_FILESYSTEM);
template_open->set_mode(FileDialog::MODE_OPEN_FILE);
- template_open->connect("file_selected", this, "_install_from_file", varray(true));
+ template_open->connect_compat("file_selected", this, "_install_from_file", varray(true));
add_child(template_open);
set_title(TTR("Export Template Manager"));
@@ -702,18 +704,18 @@ ExportTemplateManager::ExportTemplateManager() {
request_mirror = memnew(HTTPRequest);
add_child(request_mirror);
- request_mirror->connect("request_completed", this, "_http_download_mirror_completed");
+ request_mirror->connect_compat("request_completed", this, "_http_download_mirror_completed");
download_templates = memnew(HTTPRequest);
add_child(download_templates);
- download_templates->connect("request_completed", this, "_http_download_templates_completed");
+ download_templates->connect_compat("request_completed", this, "_http_download_templates_completed");
template_downloader = memnew(AcceptDialog);
template_downloader->set_title(TTR("Download Templates"));
template_downloader->get_ok()->set_text(TTR("Close"));
template_downloader->set_exclusive(true);
add_child(template_downloader);
- template_downloader->connect("popup_hide", this, "_window_template_downloader_closed");
+ template_downloader->connect_compat("popup_hide", this, "_window_template_downloader_closed");
VBoxContainer *vbc = memnew(VBoxContainer);
template_downloader->add_child(vbc);