From 255f7f836f6275fc9b115652c2e8306895fcc33b Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 27 May 2022 15:22:39 +0200 Subject: [PATCH] StudioWelcomePage: Disable data download by default QML/Designer/EnableWelcomePageDownload is not set, no download or probing will start. Change-Id: Icadd29b2a8c0439ebd8435b987647f5d6f7167a7 Reviewed-by: Reviewed-by: Qt CI Bot Reviewed-by: hjk Reviewed-by: Tim Jenssen --- src/plugins/studiowelcome/examplecheckout.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/plugins/studiowelcome/examplecheckout.cpp b/src/plugins/studiowelcome/examplecheckout.cpp index d0c3d40734c..c759f684bc1 100644 --- a/src/plugins/studiowelcome/examplecheckout.cpp +++ b/src/plugins/studiowelcome/examplecheckout.cpp @@ -57,6 +57,12 @@ using namespace Utils; +static bool enableDownload() +{ + const QString lastQDSVersionEntry = "QML/Designer/EnableWelcomePageDownload"; + return Core::ICore::settings()->value(lastQDSVersionEntry, false).toBool(); +} + void ExampleCheckout::registerTypes() { static bool once = []() { @@ -186,6 +192,12 @@ bool FileDownloader::available() const void FileDownloader::probeUrl() { + if (!enableDownload()) { + m_available = false; + emit availableChanged(); + return; + } + auto request = QNetworkRequest(m_url); request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::UserVerifiedRedirectPolicy); @@ -447,6 +459,13 @@ DataModelDownloader::DataModelDownloader(QObject * /* parent */) void DataModelDownloader::start() { + + if (!enableDownload()) { + m_available = false; + emit availableChanged(); + return; + } + m_fileDownloader.setUrl(QUrl::fromUserInput( "https://download.qt.io/learning/examples/qtdesignstudio/dataImports.zip"));