From 5aa27b5ba5dcd02cdf358bd48cdd95963e05accd Mon Sep 17 00:00:00 2001
From: Remek Zajac <remek@airmap.com>
Date: Fri, 13 Aug 2021 15:42:47 +0200
Subject: [PATCH] Migrate away from enums deprecated going from Qt5.12 to
 Qt5.15

In some instances (touched by this commit) QGC has been using enums deprecated
in Qt5.15. Enum deprecation itself appears to be a new thing (there in C++14, but
seemingly not there in C++11). We have since formally upgraded to C++17
(https://github.com/mavlink/qgroundcontrol/pull/9760), but presumably nobody
recompiled against Qt5.15 until I did, saw the errors and found myself needing
to propose this change.

The change itself is trivial and simply follows the migration notes found against
individual deprecated enums.
---
 src/Camera/QGCCameraControl.cc     | 2 +-
 src/QGCApplication.cc              | 2 +-
 src/Vehicle/MAVLinkLogManager.cc   | 2 +-
 src/VideoManager/SubtitleWriter.cc | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Camera/QGCCameraControl.cc b/src/Camera/QGCCameraControl.cc
index e4f2db5..b6f933a 100644
--- a/src/Camera/QGCCameraControl.cc
+++ b/src/Camera/QGCCameraControl.cc
@@ -1994,7 +1994,7 @@ QGCCameraControl::_httpRequest(const QString &url)
     tempProxy.setType(QNetworkProxy::DefaultProxy);
     _netManager->setProxy(tempProxy);
     QNetworkRequest request(url);
-    request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
+    request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, true);
     QSslConfiguration conf = request.sslConfiguration();
     conf.setPeerVerifyMode(QSslSocket::VerifyNone);
     request.setSslConfiguration(conf);
diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc
index a664622..cda50e1 100644
--- a/src/QGCApplication.cc
+++ b/src/QGCApplication.cc
@@ -423,7 +423,7 @@ void QGCApplication::setLanguage()
             _locale = QLocale(QLocale::Korean);
             break;
         case 13:
-            _locale = QLocale(QLocale::Norwegian);
+            _locale = QLocale(QLocale::NorwegianBokmal);
             break;
         case 14:
             _locale = QLocale(QLocale::Polish);
diff --git a/src/Vehicle/MAVLinkLogManager.cc b/src/Vehicle/MAVLinkLogManager.cc
index 1b8d60f..ac215b0 100644
--- a/src/Vehicle/MAVLinkLogManager.cc
+++ b/src/Vehicle/MAVLinkLogManager.cc
@@ -743,7 +743,7 @@ MAVLinkLogManager::_sendLog(const QString& logFile)
     file->setParent(multiPart);
     QNetworkRequest request(_uploadURL);
 #if QT_VERSION > 0x050600
-    request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
+    request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, true);
 #endif
     QNetworkReply* reply = _nam->post(request, multiPart);
     connect(reply, &QNetworkReply::finished,  this, &MAVLinkLogManager::_uploadFinished);
diff --git a/src/VideoManager/SubtitleWriter.cc b/src/VideoManager/SubtitleWriter.cc
index 33ee726..22e6f12 100644
--- a/src/VideoManager/SubtitleWriter.cc
+++ b/src/VideoManager/SubtitleWriter.cc
@@ -166,7 +166,7 @@ void SubtitleWriter::_captureTelemetry()
     stringColumns << QStringLiteral("Dialogue: 0,%1,%2,Default,,0,0,0,,{\\pos(10,35)}%3\n")
         .arg(start.toString("H:mm:ss.zzz").chopped(2))
         .arg(end.toString("H:mm:ss.zzz").chopped(2))
-        .arg(QDateTime::currentDateTime().toString(Qt::SystemLocaleShortDate));
+        .arg(QDateTime::currentDateTime().toString(QLocale::system().dateFormat(QLocale::ShortFormat)));
     // Write new data
     QTextStream stream(&_file);
     for (const auto& i : stringColumns) {