From 3c91475edb48b9109b1eb7c98ea5e8bbe1493050 Mon Sep 17 00:00:00 2001 From: Chris Cranford Date: Sun, 4 Aug 2024 19:55:27 -0400 Subject: [PATCH] GH-658 Fix Godot 4.2 compatibility --- src/editor/updater.cpp | 13 +++++++++++++ src/editor/updater.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/editor/updater.cpp b/src/editor/updater.cpp index 36e96098..8e9e14ab 100644 --- a/src/editor/updater.cpp +++ b/src/editor/updater.cpp @@ -199,7 +199,9 @@ void OrchestratorUpdaterVersionPicker::_request_download() const String download_url = selected->get_meta("download_url"); if (_download->request(download_url) == OK) { + #if GODOT_VERSION >= 0x040300 _progress->set_indeterminate(true); + #endif set_process(true); } } @@ -221,7 +223,9 @@ void OrchestratorUpdaterVersionPicker::_handle_custom_action(const StringName& p void OrchestratorUpdaterVersionPicker::_download_completed(int p_status, int p_code, const PackedStringArray& p_headers, const PackedByteArray& p_data) { _progress->set_visible(false); + #if GODOT_VERSION >= 0x040300 _progress->set_indeterminate(false); + #endif set_process(false); @@ -303,7 +307,10 @@ void OrchestratorUpdaterVersionPicker::_cancel_and_close() _download->cancel_request(); + #if GODOT_VERSION >= 0x040300 _progress->set_indeterminate(false); + #endif + _progress->set_visible(false); _status->set_visible(false); } @@ -399,6 +406,8 @@ void OrchestratorUpdaterVersionPicker::_notification(int p_what) get_ok_button()->release_focus(); _set_button_enable_state(false); + + _progress->set_value_no_signal(0); } } else if (p_what == NOTIFICATION_READY) @@ -430,14 +439,18 @@ void OrchestratorUpdaterVersionPicker::_notification(int p_what) { if (_download->get_body_size() > 0) { + #if GODOT_VERSION >= 0x040300 _progress->set_indeterminate(false); + #endif _status->set_text(vformat("Downloading (%s / %s)...", String::humanize_size(_download->get_downloaded_bytes()), String::humanize_size(_download->get_body_size()))); } else { + #if GODOT_VERSION >= 0x040300 _progress->set_indeterminate(true); + #endif _status->set_text(vformat("Downloading... (%s)", String::humanize_size(_download->get_downloaded_bytes()))); } diff --git a/src/editor/updater.h b/src/editor/updater.h index 00c576cc..2721ab62 100644 --- a/src/editor/updater.h +++ b/src/editor/updater.h @@ -30,6 +30,7 @@ #include #include #include +#include using namespace godot;