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