summaryrefslogtreecommitdiff
path: root/platform/qt/src
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2018-11-12 16:38:34 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2018-11-13 22:55:26 +0200
commitcd92a231b3e11c65321a48d0167898bb0e5a5fa8 (patch)
treef821513781bee5b9039945489d1fe926c8900a6d /platform/qt/src
parentb891a8d6b0dc9e92a283756448b4671bef3da71f (diff)
downloadqtlocation-mapboxgl-cd92a231b3e11c65321a48d0167898bb0e5a5fa8.tar.gz
[qt] Deprecate Qt4 and old versions of Qt5
Not enough adoption to keep the platform alive.
Diffstat (limited to 'platform/qt/src')
-rw-r--r--platform/qt/src/headless_backend_qt.cpp10
-rw-r--r--platform/qt/src/http_file_source.cpp14
-rw-r--r--platform/qt/src/qmapbox.cpp4
-rw-r--r--platform/qt/src/qmapboxgl.cpp17
-rw-r--r--platform/qt/src/qmapboxgl_renderer_backend.cpp12
-rw-r--r--platform/qt/src/qt_conversion.hpp8
-rw-r--r--platform/qt/src/qt_geojson.cpp8
-rw-r--r--platform/qt/src/qt_image.cpp5
-rw-r--r--platform/qt/src/sqlite3.cpp8
-rw-r--r--platform/qt/src/timer.cpp2
10 files changed, 1 insertions, 87 deletions
diff --git a/platform/qt/src/headless_backend_qt.cpp b/platform/qt/src/headless_backend_qt.cpp
index ad3fa42290..3702fdf14a 100644
--- a/platform/qt/src/headless_backend_qt.cpp
+++ b/platform/qt/src/headless_backend_qt.cpp
@@ -1,12 +1,7 @@
#include <mbgl/gl/headless_backend.hpp>
#include <QGLWidget>
-
-#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
-#else
-#include <QGLContext>
-#endif
#include <cassert>
@@ -17,13 +12,8 @@ public:
~QtBackendImpl() final = default;
gl::ProcAddress getExtensionFunctionPointer(const char* name) final {
-#if QT_VERSION >= 0x050000
QOpenGLContext* thisContext = QOpenGLContext::currentContext();
return thisContext->getProcAddress(name);
-#else
- const QGLContext* thisContext = QGLContext::currentContext();
- return reinterpret_cast<gl::ProcAddress>(thisContext->getProcAddress(name));
-#endif
}
void activateContext() final {
diff --git a/platform/qt/src/http_file_source.cpp b/platform/qt/src/http_file_source.cpp
index b95cfed0e9..90abdd0aa3 100644
--- a/platform/qt/src/http_file_source.cpp
+++ b/platform/qt/src/http_file_source.cpp
@@ -29,9 +29,7 @@ void HTTPFileSource::Impl::request(HTTPRequest* req)
}
QNetworkRequest networkRequest = req->networkRequest();
-#if QT_VERSION >= 0x050600
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
-#endif
data.first = m_manager->get(networkRequest);
connect(data.first, SIGNAL(finished()), this, SLOT(onReplyFinished()));
@@ -60,15 +58,7 @@ void HTTPFileSource::Impl::cancel(HTTPRequest* req)
if (requestsVector.empty()) {
m_pending.erase(it);
-#if QT_VERSION >= 0x050000
reply->abort();
-#else
- // XXX: We should be aborting the reply here
- // but a bug on Qt4 causes the connection of
- // other ongoing requests to drop if we call
- // abort() too often (and we do).
- Q_UNUSED(reply);
-#endif
}
}
@@ -105,11 +95,7 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
}
uint32_t HTTPFileSource::maximumConcurrentRequests() {
-#if QT_VERSION >= 0x050000
return 20;
-#else
- return 10;
-#endif
}
} // namespace mbgl
diff --git a/platform/qt/src/qmapbox.cpp b/platform/qt/src/qmapbox.cpp
index 2180f22d07..ab7160c429 100644
--- a/platform/qt/src/qmapbox.cpp
+++ b/platform/qt/src/qmapbox.cpp
@@ -5,11 +5,7 @@
#include <mbgl/util/geometry.hpp>
#include <mbgl/util/traits.hpp>
-#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
-#else
-#include <QGLContext>
-#endif
// mbgl::NetworkStatus::Status
static_assert(mbgl::underlying_type(QMapbox::Online) == mbgl::underlying_type(mbgl::NetworkStatus::Status::Online), "error");
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index d008ad86c9..e292bbd195 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -45,11 +45,7 @@
#include <mbgl/util/traits.hpp>
#include <mbgl/actor/scheduler.hpp>
-#if QT_VERSION >= 0x050000
#include <QGuiApplication>
-#else
-#include <QCoreApplication>
-#endif
#include <QDebug>
#include <QImage>
@@ -140,13 +136,8 @@ std::unique_ptr<mbgl::style::Image> toStyleImage(const QString &id, const QImage
.rgbSwapped()
.convertToFormat(QImage::Format_ARGB32_Premultiplied);
-#if QT_VERSION >= 0x051000
- auto img = std::make_unique<uint8_t[]>(swapped.sizeInBytes());
- memcpy(img.get(), swapped.constBits(), swapped.sizeInBytes());
-#else
auto img = std::make_unique<uint8_t[]>(swapped.byteCount());
memcpy(img.get(), swapped.constBits(), swapped.byteCount());
-#endif
return std::make_unique<mbgl::style::Image>(
id.toStdString(),
@@ -1839,14 +1830,6 @@ void QMapboxGLPrivate::render()
createRenderer();
}
-#if defined(__APPLE__) && QT_VERSION < 0x050000
- // FIXME Qt 4.x provides an incomplete FBO at start.
- // See https://bugreports.qt.io/browse/QTBUG-36802 for details.
- if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
- return;
- }
-#endif
-
m_renderQueued.clear();
m_mapRenderer->render();
}
diff --git a/platform/qt/src/qmapboxgl_renderer_backend.cpp b/platform/qt/src/qmapboxgl_renderer_backend.cpp
index 917741f5ce..c6de7c6d80 100644
--- a/platform/qt/src/qmapboxgl_renderer_backend.cpp
+++ b/platform/qt/src/qmapboxgl_renderer_backend.cpp
@@ -1,12 +1,7 @@
#include "qmapboxgl_renderer_backend.hpp"
-#include <QtGlobal>
-
-#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
-#else
-#include <QGLContext>
-#endif
+#include <QtGlobal>
void QMapboxGLRendererBackend::updateAssumedState()
{
@@ -39,11 +34,6 @@ void QMapboxGLRendererBackend::updateFramebuffer(quint32 fbo, const mbgl::Size &
*/
mbgl::gl::ProcAddress QMapboxGLRendererBackend::getExtensionFunctionPointer(const char* name)
{
-#if QT_VERSION >= 0x050000
QOpenGLContext* thisContext = QOpenGLContext::currentContext();
return thisContext->getProcAddress(name);
-#else
- const QGLContext* thisContext = QGLContext::currentContext();
- return reinterpret_cast<mbgl::gl::ProcAddress>(thisContext->getProcAddress(name));
-#endif
}
diff --git a/platform/qt/src/qt_conversion.hpp b/platform/qt/src/qt_conversion.hpp
index 99a262be54..070a3dd375 100644
--- a/platform/qt/src/qt_conversion.hpp
+++ b/platform/qt/src/qt_conversion.hpp
@@ -35,11 +35,7 @@ public:
static bool isObject(const QVariant& value) {
return value.canConvert(QVariant::Map)
|| value.type() == QVariant::ByteArray
- #if QT_VERSION >= 0x050000
|| QString(value.typeName()) == QStringLiteral("QMapbox::Feature");
- #else
- || QString(value.typeName()) == QString("QMapbox::Feature");
- #endif
}
static optional<QVariant> objectMember(const QVariant& value, const char* key) {
@@ -121,11 +117,7 @@ public:
}
static optional<GeoJSON> toGeoJSON(const QVariant& value, Error& error) {
- #if QT_VERSION >= 0x050000
if (value.typeName() == QStringLiteral("QMapbox::Feature")) {
- #else
- if (value.typeName() == QString("QMapbox::Feature")) {
- #endif
return GeoJSON { asMapboxGLFeature(value.value<QMapbox::Feature>()) };
} else if (value.type() != QVariant::ByteArray) {
error = { "JSON data must be in QByteArray" };
diff --git a/platform/qt/src/qt_geojson.cpp b/platform/qt/src/qt_geojson.cpp
index 9d0a3e96eb..cd808f016c 100644
--- a/platform/qt/src/qt_geojson.cpp
+++ b/platform/qt/src/qt_geojson.cpp
@@ -79,11 +79,7 @@ mbgl::Value asMapboxGLPropertyValue(const QVariant &value) {
};
switch (value.type()) {
-#if QT_VERSION >= 0x050000
case QMetaType::UnknownType:
-#else
- case QVariant::Invalid:
-#endif
return mbgl::NullValue {};
case QMetaType::Bool:
return { value.toBool() };
@@ -107,11 +103,7 @@ mbgl::Value asMapboxGLPropertyValue(const QVariant &value) {
mbgl::FeatureIdentifier asMapboxGLFeatureIdentifier(const QVariant &id) {
switch (id.type()) {
-#if QT_VERSION >= 0x050000
case QMetaType::UnknownType:
-#else
- case QVariant::Invalid:
-#endif
return {};
case QMetaType::ULongLong:
return { uint64_t(id.toULongLong()) };
diff --git a/platform/qt/src/qt_image.cpp b/platform/qt/src/qt_image.cpp
index 848a9b7f0a..302d398739 100644
--- a/platform/qt/src/qt_image.cpp
+++ b/platform/qt/src/qt_image.cpp
@@ -45,13 +45,8 @@ PremultipliedImage decodeImage(const std::string& string) {
throw std::runtime_error("Unsupported image type");
}
-#if QT_VERSION >= 0x051000
- auto img = std::make_unique<uint8_t[]>(image.sizeInBytes());
- memcpy(img.get(), image.constBits(), image.sizeInBytes());
-#else
auto img = std::make_unique<uint8_t[]>(image.byteCount());
memcpy(img.get(), image.constBits(), image.byteCount());
-#endif
return { { static_cast<uint32_t>(image.width()), static_cast<uint32_t>(image.height()) },
std::move(img) };
diff --git a/platform/qt/src/sqlite3.cpp b/platform/qt/src/sqlite3.cpp
index d27ebf354d..6427126875 100644
--- a/platform/qt/src/sqlite3.cpp
+++ b/platform/qt/src/sqlite3.cpp
@@ -26,22 +26,14 @@ namespace sqlite {
void checkQueryError(const QSqlQuery& query) {
QSqlError lastError = query.lastError();
if (lastError.type() != QSqlError::NoError) {
-#if QT_VERSION >= 0x050300
throw Exception { lastError.nativeErrorCode().toInt(), lastError.databaseText().toStdString() };
-#else
- throw Exception { lastError.number(), lastError.databaseText().toStdString() };
-#endif
}
}
void checkDatabaseError(const QSqlDatabase &db) {
QSqlError lastError = db.lastError();
if (lastError.type() != QSqlError::NoError) {
-#if QT_VERSION >= 0x050300
throw Exception { lastError.nativeErrorCode().toInt(), lastError.databaseText().toStdString() };
-#else
- throw Exception { lastError.number(), lastError.databaseText().toStdString() };
-#endif
}
}
diff --git a/platform/qt/src/timer.cpp b/platform/qt/src/timer.cpp
index a0c1328d63..4ae3631e55 100644
--- a/platform/qt/src/timer.cpp
+++ b/platform/qt/src/timer.cpp
@@ -9,9 +9,7 @@ namespace mbgl {
namespace util {
Timer::Impl::Impl() {
-#if QT_VERSION >= 0x050000
timer.setTimerType(Qt::PreciseTimer);
-#endif
connect(&timer, SIGNAL(timeout()), this, SLOT(timerFired()));
}