You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Only display download buttons in the template manager when available
Development builds don't have official export templates available. Clicking the "Download" or "Re-Download" button resulted in an error while fetching the list of mirrors. This hides the download-related features when using a development build.
This commit is contained in:
@@ -69,6 +69,9 @@ void ExportTemplateManager::_update_template_list() {
|
|||||||
memdelete(d);
|
memdelete(d);
|
||||||
|
|
||||||
String current_version = VERSION_FULL_CONFIG;
|
String current_version = VERSION_FULL_CONFIG;
|
||||||
|
// Downloadable export templates are only available for stable, alpha, beta and RC versions.
|
||||||
|
// Therefore, don't display download-related features when using a development version
|
||||||
|
const bool downloads_available = String(VERSION_STATUS) != String("dev");
|
||||||
|
|
||||||
Label *current = memnew(Label);
|
Label *current = memnew(Label);
|
||||||
current->set_h_size_flags(SIZE_EXPAND_FILL);
|
current->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
@@ -76,10 +79,14 @@ void ExportTemplateManager::_update_template_list() {
|
|||||||
|
|
||||||
if (templates.has(current_version)) {
|
if (templates.has(current_version)) {
|
||||||
current->add_color_override("font_color", get_color("success_color", "Editor"));
|
current->add_color_override("font_color", get_color("success_color", "Editor"));
|
||||||
Button *redownload = memnew(Button);
|
|
||||||
redownload->set_text(TTR("Re-Download"));
|
// Only display a redownload button if it can be downloaded in the first place
|
||||||
current_hb->add_child(redownload);
|
if (downloads_available) {
|
||||||
redownload->connect("pressed", this, "_download_template", varray(current_version));
|
Button *redownload = memnew(Button);
|
||||||
|
redownload->set_text(TTR("Redownload"));
|
||||||
|
current_hb->add_child(redownload);
|
||||||
|
redownload->connect("pressed", this, "_download_template", varray(current_version));
|
||||||
|
}
|
||||||
|
|
||||||
Button *uninstall = memnew(Button);
|
Button *uninstall = memnew(Button);
|
||||||
uninstall->set_text(TTR("Uninstall"));
|
uninstall->set_text(TTR("Uninstall"));
|
||||||
@@ -91,6 +98,12 @@ void ExportTemplateManager::_update_template_list() {
|
|||||||
current->add_color_override("font_color", get_color("error_color", "Editor"));
|
current->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||||
Button *redownload = memnew(Button);
|
Button *redownload = memnew(Button);
|
||||||
redownload->set_text(TTR("Download"));
|
redownload->set_text(TTR("Download"));
|
||||||
|
|
||||||
|
if (!downloads_available) {
|
||||||
|
redownload->set_disabled(true);
|
||||||
|
redownload->set_tooltip(TTR("Official export templates aren't available for development builds."));
|
||||||
|
}
|
||||||
|
|
||||||
redownload->connect("pressed", this, "_download_template", varray(current_version));
|
redownload->connect("pressed", this, "_download_template", varray(current_version));
|
||||||
current_hb->add_child(redownload);
|
current_hb->add_child(redownload);
|
||||||
current->set_text(current_version + " " + TTR("(Missing)"));
|
current->set_text(current_version + " " + TTR("(Missing)"));
|
||||||
|
|||||||
Reference in New Issue
Block a user