forked from qt-creator/qt-creator
QmlDesigner: Add setting to force download mirror
Add setting QML/Designer/ForceDownloadMirror to set a specific mirror for downloads. Remove private QQmlData usage. This was for debugging and the issue was fixed. Task-number: QDS-9687 Change-Id: Icf9a2e2db7d60b13f37d7f51b857cbe7c0a1c3b4 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
#include "filedownloader.h"
|
||||
|
||||
#include <private/qqmldata_p.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/networkaccessmanager.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
@@ -154,6 +155,15 @@ void FileDownloader::setUrl(const QUrl &url)
|
||||
{
|
||||
if (m_url != url) {
|
||||
m_url = url;
|
||||
|
||||
const QString mirror = Core::ICore::settings()->value("QML/Designer/ForceDownloadMirror").toString();
|
||||
if (!mirror.isEmpty()) {
|
||||
qWarning() << Q_FUNC_INFO << "Alternative mirror is used:" << mirror;
|
||||
QString replaced = url.toString();
|
||||
replaced.replace("https://download.qt.io/", mirror);
|
||||
m_url = QUrl::fromUserInput(replaced);
|
||||
}
|
||||
|
||||
emit urlChanged();
|
||||
}
|
||||
|
||||
@@ -262,10 +272,6 @@ void FileDownloader::doProbeUrl()
|
||||
this,
|
||||
[this](QNetworkReply::NetworkError code) {
|
||||
|
||||
if (QQmlData::wasDeleted(this)) {
|
||||
qDebug() << Q_FUNC_INFO << "FileDownloader was deleted.";
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "Network error:" << code
|
||||
<< qobject_cast<QNetworkReply *>(sender())->errorString();
|
||||
|
Reference in New Issue
Block a user