|
@@ -43,6 +43,7 @@
|
|
#include "editor/progress_dialog.h"
|
|
#include "editor/progress_dialog.h"
|
|
#include "editor/themes/editor_scale.h"
|
|
#include "editor/themes/editor_scale.h"
|
|
#include "scene/gui/file_dialog.h"
|
|
#include "scene/gui/file_dialog.h"
|
|
|
|
+#include "scene/gui/link_button.h"
|
|
#include "scene/gui/menu_button.h"
|
|
#include "scene/gui/menu_button.h"
|
|
#include "scene/gui/separator.h"
|
|
#include "scene/gui/separator.h"
|
|
#include "scene/gui/tree.h"
|
|
#include "scene/gui/tree.h"
|
|
@@ -56,9 +57,6 @@ enum DownloadsAvailability {
|
|
|
|
|
|
static DownloadsAvailability _get_downloads_availability() {
|
|
static DownloadsAvailability _get_downloads_availability() {
|
|
const int network_mode = EDITOR_GET("network/connection/network_mode");
|
|
const int network_mode = EDITOR_GET("network/connection/network_mode");
|
|
- if (network_mode == EditorSettings::NETWORK_OFFLINE) {
|
|
|
|
- return DOWNLOADS_NOT_AVAILABLE_IN_OFFLINE_MODE;
|
|
|
|
- }
|
|
|
|
|
|
|
|
// Downloadable export templates are only available for stable and official alpha/beta/RC builds
|
|
// Downloadable export templates are only available for stable and official alpha/beta/RC builds
|
|
// (which always have a number following their status, e.g. "alpha1").
|
|
// (which always have a number following their status, e.g. "alpha1").
|
|
@@ -71,6 +69,10 @@ static DownloadsAvailability _get_downloads_availability() {
|
|
return DOWNLOADS_NOT_AVAILABLE_FOR_DEV_BUILDS;
|
|
return DOWNLOADS_NOT_AVAILABLE_FOR_DEV_BUILDS;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (network_mode == EditorSettings::NETWORK_OFFLINE) {
|
|
|
|
+ return DOWNLOADS_NOT_AVAILABLE_IN_OFFLINE_MODE;
|
|
|
|
+ }
|
|
|
|
+
|
|
return DOWNLOADS_AVAILABLE;
|
|
return DOWNLOADS_AVAILABLE;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -335,6 +337,14 @@ void ExportTemplateManager::_refresh_mirrors_completed(int p_status, int p_code,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void ExportTemplateManager::_force_online_mode() {
|
|
|
|
+ EditorSettings::get_singleton()->set_setting("network/connection/network_mode", EditorSettings::NETWORK_ONLINE);
|
|
|
|
+ EditorSettings::get_singleton()->notify_changes();
|
|
|
|
+ EditorSettings::get_singleton()->save();
|
|
|
|
+
|
|
|
|
+ popup_manager();
|
|
|
|
+}
|
|
|
|
+
|
|
bool ExportTemplateManager::_humanize_http_status(HTTPRequest *p_request, String *r_status, int *r_downloaded_bytes, int *r_total_bytes) {
|
|
bool ExportTemplateManager::_humanize_http_status(HTTPRequest *p_request, String *r_status, int *r_downloaded_bytes, int *r_total_bytes) {
|
|
*r_status = "";
|
|
*r_status = "";
|
|
*r_downloaded_bytes = -1;
|
|
*r_downloaded_bytes = -1;
|
|
@@ -694,6 +704,8 @@ void ExportTemplateManager::popup_manager() {
|
|
if (!is_downloading_templates) {
|
|
if (!is_downloading_templates) {
|
|
_refresh_mirrors();
|
|
_refresh_mirrors();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ enable_online_hb->hide();
|
|
} break;
|
|
} break;
|
|
|
|
|
|
case DOWNLOADS_NOT_AVAILABLE_IN_OFFLINE_MODE: {
|
|
case DOWNLOADS_NOT_AVAILABLE_IN_OFFLINE_MODE: {
|
|
@@ -708,6 +720,8 @@ void ExportTemplateManager::popup_manager() {
|
|
|
|
|
|
download_current_button->set_disabled(true);
|
|
download_current_button->set_disabled(true);
|
|
download_current_button->set_tooltip_text(TTR("Template downloading is disabled in offline mode."));
|
|
download_current_button->set_tooltip_text(TTR("Template downloading is disabled in offline mode."));
|
|
|
|
+
|
|
|
|
+ enable_online_hb->show();
|
|
} break;
|
|
} break;
|
|
|
|
|
|
case DOWNLOADS_NOT_AVAILABLE_FOR_DEV_BUILDS: {
|
|
case DOWNLOADS_NOT_AVAILABLE_FOR_DEV_BUILDS: {
|
|
@@ -722,6 +736,8 @@ void ExportTemplateManager::popup_manager() {
|
|
|
|
|
|
download_current_button->set_disabled(true);
|
|
download_current_button->set_disabled(true);
|
|
download_current_button->set_tooltip_text(TTR("Official export templates aren't available for development builds."));
|
|
download_current_button->set_tooltip_text(TTR("Official export templates aren't available for development builds."));
|
|
|
|
+
|
|
|
|
+ enable_online_hb->hide();
|
|
} break;
|
|
} break;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1053,6 +1069,19 @@ ExportTemplateManager::ExportTemplateManager() {
|
|
install_file_hb->add_child(install_file_button);
|
|
install_file_hb->add_child(install_file_button);
|
|
install_file_button->connect(SceneStringName(pressed), callable_mp(this, &ExportTemplateManager::_install_file));
|
|
install_file_button->connect(SceneStringName(pressed), callable_mp(this, &ExportTemplateManager::_install_file));
|
|
|
|
|
|
|
|
+ enable_online_hb = memnew(HBoxContainer);
|
|
|
|
+ install_options_vb->add_child(enable_online_hb);
|
|
|
|
+
|
|
|
|
+ Label *enable_online_label = memnew(Label);
|
|
|
|
+ enable_online_label->set_text(TTR("Online mode is needed to download the templates."));
|
|
|
|
+ enable_online_hb->add_child(enable_online_label);
|
|
|
|
+
|
|
|
|
+ LinkButton *enable_online_button = memnew(LinkButton);
|
|
|
|
+ enable_online_button->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
|
|
|
|
+ enable_online_button->set_text(TTR("Go Online"));
|
|
|
|
+ enable_online_hb->add_child(enable_online_button);
|
|
|
|
+ enable_online_button->connect(SceneStringName(pressed), callable_mp(this, &ExportTemplateManager::_force_online_mode));
|
|
|
|
+
|
|
// Templates are being downloaded; buttons unavailable.
|
|
// Templates are being downloaded; buttons unavailable.
|
|
download_progress_hb = memnew(HBoxContainer);
|
|
download_progress_hb = memnew(HBoxContainer);
|
|
download_progress_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
|
download_progress_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|