|
6 | 6 | #include "VideoManager.h" |
7 | 7 | #include "QGCCameraManager.h" |
8 | 8 | #include "FTPManager.h" |
9 | | -#include "QGCLZMA.h" |
| 9 | +#include "QGCCompression.h" |
10 | 10 | #include "QGCCorePlugin.h" |
| 11 | +#include "QGCFileHelper.h" |
11 | 12 | #include "Vehicle.h" |
12 | 13 | #include "LinkInterface.h" |
13 | 14 | #include "MAVLinkProtocol.h" |
|
20 | 21 | #include <QtXml/QDomDocument> |
21 | 22 | #include <QtXml/QDomNodeList> |
22 | 23 | #include <QtQml/QQmlEngine> |
23 | | -#include <QtNetwork/QNetworkProxy> |
24 | 24 | #include <QtNetwork/QNetworkReply> |
25 | 25 |
|
| 26 | +#include "QGCNetworkHelper.h" |
| 27 | + |
26 | 28 | //----------------------------------------------------------------------------- |
27 | 29 | QGCCameraOptionExclusion::QGCCameraOptionExclusion(QObject* parent, QString param_, QString value_, QStringList exclusions_) |
28 | 30 | : QObject(parent) |
@@ -1574,9 +1576,9 @@ VehicleCameraControl::handleCaptureStatus(const mavlink_camera_capture_status_t& |
1574 | 1576 | //-- Time Lapse |
1575 | 1577 | if(photoCaptureStatus() == PHOTO_CAPTURE_INTERVAL_IDLE || photoCaptureStatus() == PHOTO_CAPTURE_INTERVAL_IN_PROGRESS) { |
1576 | 1578 | //-- Capture local image as well |
1577 | | - QString photoPath = SettingsManager::instance()->appSettings()->savePath()->rawValue().toString() + QStringLiteral("/Photo"); |
1578 | | - QDir().mkpath(photoPath); |
1579 | | - photoPath += "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss.zzz") + ".jpg"; |
| 1579 | + const QString photoDir = SettingsManager::instance()->appSettings()->savePath()->rawValue().toString() + QStringLiteral("/Photo"); |
| 1580 | + QGCFileHelper::ensureDirectoryExists(photoDir); |
| 1581 | + const QString photoPath = photoDir + "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss.zzz") + ".jpg"; |
1580 | 1582 | VideoManager::instance()->grabImage(photoPath); |
1581 | 1583 | } |
1582 | 1584 | } |
@@ -2129,18 +2131,14 @@ VehicleCameraControl::_httpRequest(const QString &url) |
2129 | 2131 | if(!_netManager) { |
2130 | 2132 | _netManager = new QNetworkAccessManager(this); |
2131 | 2133 | } |
2132 | | - QNetworkProxy savedProxy = _netManager->proxy(); |
2133 | | - QNetworkProxy tempProxy; |
2134 | | - tempProxy.setType(QNetworkProxy::DefaultProxy); |
2135 | | - _netManager->setProxy(tempProxy); |
| 2134 | + QGCNetworkHelper::configureProxy(_netManager); |
2136 | 2135 | QNetworkRequest request(QUrl::fromUserInput(url)); |
2137 | 2136 | request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, true); |
2138 | 2137 | QSslConfiguration conf = request.sslConfiguration(); |
2139 | 2138 | conf.setPeerVerifyMode(QSslSocket::VerifyNone); |
2140 | 2139 | request.setSslConfiguration(conf); |
2141 | 2140 | QNetworkReply* reply = _netManager->get(request); |
2142 | 2141 | connect(reply, &QNetworkReply::finished, this, &VehicleCameraControl::_downloadFinished); |
2143 | | - _netManager->setProxy(savedProxy); |
2144 | 2142 | } |
2145 | 2143 |
|
2146 | 2144 | //----------------------------------------------------------------------------- |
@@ -2174,16 +2172,9 @@ void VehicleCameraControl::_ftpDownloadComplete(const QString& fileName, const Q |
2174 | 2172 |
|
2175 | 2173 | disconnect(_vehicle->ftpManager(), &FTPManager::downloadComplete, this, &VehicleCameraControl::_ftpDownloadComplete); |
2176 | 2174 |
|
2177 | | - QString outputFileName = fileName; |
2178 | | - |
2179 | | - if (fileName.endsWith(".lzma", Qt::CaseInsensitive) || fileName.endsWith(".xz", Qt::CaseInsensitive)) { |
2180 | | - outputFileName = fileName.left(fileName.lastIndexOf(".")); |
2181 | | - if (QGCLZMA::inflateLZMAFile(fileName, outputFileName)) { |
2182 | | - QFile(fileName).remove(); |
2183 | | - } else { |
2184 | | - qCWarning(CameraControlLog) << "Inflate of compressed xml failed" << fileName; |
2185 | | - outputFileName.clear(); |
2186 | | - } |
| 2175 | + QString outputFileName = QGCCompression::decompressIfNeeded(fileName); |
| 2176 | + if (outputFileName.isEmpty()) { |
| 2177 | + qCWarning(CameraControlLog) << "Inflate of compressed xml failed" << fileName; |
2187 | 2178 | } |
2188 | 2179 |
|
2189 | 2180 | QFile xmlFile(outputFileName); |
|
0 commit comments