Commit ef77e497 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Add network proxy support (#3687)

parent 33ec4385
......@@ -196,6 +196,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
#endif
// Setup for network proxy support
QNetworkProxyFactory::setUseSystemConfiguration(true);
#ifdef Q_OS_LINUX
#ifndef __mobile__
if (!_runningUnitTests) {
......
......@@ -12,6 +12,7 @@
#include <QFileInfo>
#include <QStandardPaths>
#include <QNetworkProxy>
QGCFileDownload::QGCFileDownload(QObject* parent)
: QNetworkAccessManager(parent)
......@@ -63,6 +64,10 @@ bool QGCFileDownload::download(const QString& remoteFile)
QNetworkRequest networkRequest(remoteUrl);
QNetworkProxy tProxy;
tProxy.setType(QNetworkProxy::DefaultProxy);
setProxy(tProxy);
// Store local file location in user attribute so we can retrieve when the download finishes
networkRequest.setAttribute(QNetworkRequest::User, localFile);
......
......@@ -41,7 +41,6 @@ UrlFactory::UrlFactory()
_language = langs[0];
}
QNetworkProxyFactory::setUseSystemConfiguration(true);
// Google version strings
_versionGoogleMap = "m@338000000";
_versionGoogleSatellite = "198";
......
......@@ -23,6 +23,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QNetworkProxy>
struct FirmwareToUrlElement_t {
FirmwareUpgradeController::AutoPilotStackType_t stackType;
......@@ -533,6 +534,10 @@ void FirmwareUpgradeController::_downloadFirmware(void)
_downloadManager = new QNetworkAccessManager(this);
Q_CHECK_PTR(_downloadManager);
QNetworkProxy tProxy;
tProxy.setType(QNetworkProxy::DefaultProxy);
_downloadManager->setProxy(tProxy);
_downloadNetworkReply = _downloadManager->get(networkRequest);
Q_ASSERT(_downloadNetworkReply);
connect(_downloadNetworkReply, &QNetworkReply::downloadProgress, this, &FirmwareUpgradeController::_downloadProgress);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment