Skip to content

Commit

Permalink
GH-658 Fix Godot 4.2 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Aug 4, 2024
1 parent c594cf1 commit 3c91475
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/editor/updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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);

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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())));
}
Expand Down
1 change: 1 addition & 0 deletions src/editor/updater.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <godot_cpp/classes/progress_bar.hpp>
#include <godot_cpp/classes/rich_text_label.hpp>
#include <godot_cpp/classes/tree.hpp>
#include <godot_cpp/templates/vector.hpp>

using namespace godot;

Expand Down

0 comments on commit 3c91475

Please sign in to comment.