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.cpp49
1 files changed, 24 insertions, 25 deletions
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 9328a5e04d..7cb18432a7 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -30,10 +30,10 @@
#include "export_template_manager.h"
+#include "core/input/input_filter.h"
#include "core/io/json.h"
#include "core/io/zip_io.h"
#include "core/os/dir_access.h"
-#include "core/os/input.h"
#include "core/os/keyboard.h"
#include "core/version.h"
#include "editor_node.h"
@@ -82,11 +82,11 @@ void ExportTemplateManager::_update_template_list() {
String(VERSION_STATUS) != String("rc");
Label *current = memnew(Label);
- current->set_h_size_flags(SIZE_EXPAND_FILL);
+ current->set_h_size_flags(Control::SIZE_EXPAND_FILL);
current_hb->add_child(current);
if (templates.has(current_version)) {
- current->add_color_override("font_color", get_color("success_color", "Editor"));
+ current->add_theme_color_override("font_color", current->get_theme_color("success_color", "Editor"));
// Only display a redownload button if it can be downloaded in the first place
if (downloads_available) {
@@ -103,7 +103,7 @@ void ExportTemplateManager::_update_template_list() {
uninstall->connect("pressed", callable_mp(this, &ExportTemplateManager::_uninstall_template), varray(current_version));
} else {
- current->add_color_override("font_color", get_color("error_color", "Editor"));
+ current->add_theme_color_override("font_color", current->get_theme_color("error_color", "Editor"));
Button *redownload = memnew(Button);
redownload->set_text(TTR("Download"));
@@ -121,13 +121,13 @@ void ExportTemplateManager::_update_template_list() {
HBoxContainer *hbc = memnew(HBoxContainer);
Label *version = memnew(Label);
- version->set_modulate(get_color("disabled_font_color", "Editor"));
+ version->set_modulate(current->get_theme_color("disabled_font_color", "Editor"));
String text = E->get();
if (text == current_version) {
text += " " + TTR("(Current)");
}
version->set_text(text);
- version->set_h_size_flags(SIZE_EXPAND_FILL);
+ version->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->add_child(version);
Button *uninstall = memnew(Button);
@@ -145,7 +145,7 @@ void ExportTemplateManager::_download_template(const String &p_version) {
while (template_list->get_child_count()) {
memdelete(template_list->get_child(0));
}
- template_downloader->popup_centered_minsize();
+ template_downloader->popup_centered();
template_list_state->set_text(TTR("Retrieving mirrors, please wait..."));
template_download_progress->set_max(100);
template_download_progress->set_value(0);
@@ -157,7 +157,7 @@ void ExportTemplateManager::_download_template(const String &p_version) {
void ExportTemplateManager::_uninstall_template(const String &p_version) {
remove_confirm->set_text(vformat(TTR("Remove template version '%s'?"), p_version));
- remove_confirm->popup_centered_minsize();
+ remove_confirm->popup_centered();
to_remove = p_version;
}
@@ -184,7 +184,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
// unzClose() will take care of closing the file stored in the unzFile,
// so we don't need to `memdelete(fa)` in this method.
- FileAccess *fa = NULL;
+ FileAccess *fa = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&fa);
unzFile pkg = unzOpen2(p_file.utf8().get_data(), &io);
@@ -203,7 +203,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
unz_file_info info;
char fname[16384];
- ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+ ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
String file = fname;
@@ -258,7 +258,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
ret = unzGoToFirstFile(pkg);
- EditorProgress *p = NULL;
+ EditorProgress *p = nullptr;
if (p_use_progress) {
p = memnew(EditorProgress("ltask", TTR("Extracting Export Templates"), fc));
}
@@ -270,7 +270,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
//get filename
unz_file_info info;
char fname[16384];
- unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+ unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
String file_path(String(fname).simplify_path());
@@ -342,7 +342,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
void ExportTemplateManager::popup_manager() {
_update_template_list();
- popup_centered_minsize(Size2(400, 400) * EDSCALE);
+ popup_centered(Size2(400, 400) * EDSCALE);
}
void ExportTemplateManager::ok_pressed() {
@@ -446,7 +446,7 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int
void ExportTemplateManager::_begin_template_download(const String &p_url) {
- if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+ if (InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT)) {
OS::get_singleton()->shell_open(p_url);
return;
}
@@ -483,6 +483,11 @@ void ExportTemplateManager::_window_template_downloader_closed() {
void ExportTemplateManager::_notification(int p_what) {
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+ if (!is_visible()) {
+ set_process(false);
+ }
+ }
if (p_what == NOTIFICATION_PROCESS) {
update_countdown -= get_process_delta_time();
@@ -536,12 +541,6 @@ void ExportTemplateManager::_notification(int p_what) {
set_process(false);
}
}
-
- if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
- if (!is_visible_in_tree()) {
- set_process(false);
- }
- }
}
bool ExportTemplateManager::can_install_android_template() {
@@ -588,7 +587,7 @@ Error ExportTemplateManager::install_android_template() {
const String &source_zip = templates_path.plus_file("android_source.zip");
ERR_FAIL_COND_V(!FileAccess::exists(source_zip), ERR_CANT_OPEN);
- FileAccess *src_f = NULL;
+ FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
unzFile pkg = unzOpen2(source_zip.utf8().get_data(), &io);
@@ -612,7 +611,7 @@ Error ExportTemplateManager::install_android_template() {
// Get file path.
unz_file_info info;
char fpath[16384];
- ret = unzGetCurrentFileInfo(pkg, &info, fpath, 16384, NULL, 0, NULL, 0);
+ ret = unzGetCurrentFileInfo(pkg, &info, fpath, 16384, nullptr, 0, nullptr, 0);
String path = fpath;
String base_dir = path.get_base_dir();
@@ -674,7 +673,7 @@ ExportTemplateManager::ExportTemplateManager() {
installed_scroll->add_child(installed_vb);
installed_scroll->set_enable_v_scroll(true);
installed_scroll->set_enable_h_scroll(false);
- installed_vb->set_h_size_flags(SIZE_EXPAND_FILL);
+ installed_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
get_cancel()->set_text(TTR("Close"));
get_ok()->set_text(TTR("Install From File"));
@@ -688,7 +687,7 @@ ExportTemplateManager::ExportTemplateManager() {
template_open->set_title(TTR("Select Template File"));
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->set_file_mode(FileDialog::FILE_MODE_OPEN_FILE);
template_open->connect("file_selected", callable_mp(this, &ExportTemplateManager::_install_from_file), varray(true));
add_child(template_open);
@@ -708,7 +707,7 @@ ExportTemplateManager::ExportTemplateManager() {
template_downloader->get_ok()->set_text(TTR("Close"));
template_downloader->set_exclusive(true);
add_child(template_downloader);
- template_downloader->connect("popup_hide", callable_mp(this, &ExportTemplateManager::_window_template_downloader_closed));
+ template_downloader->connect("cancelled", callable_mp(this, &ExportTemplateManager::_window_template_downloader_closed));
VBoxContainer *vbc = memnew(VBoxContainer);
template_downloader->add_child(vbc);