Unverified Commit 6db84fcc authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8815 from patrickelectric/goodbye_my_good_friend

Remove QT_VERSION for old and not supported Qt versions 
parents b2371899 14b95ce3
...@@ -226,7 +226,7 @@ private: ...@@ -226,7 +226,7 @@ private:
/*! Returns a signal index that is can be compared to QMetaCallEvent.signalId. */ /*! Returns a signal index that is can be compared to QMetaCallEvent.signalId. */
static int signalIndex(const QMetaMethod & method) { static int signalIndex(const QMetaMethod & method) {
Q_ASSERT(method.methodType() == QMetaMethod::Signal); Q_ASSERT(method.methodType() == QMetaMethod::Signal);
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
int index = -1; int index = -1;
const QMetaObject * mobj = method.enclosingMetaObject(); const QMetaObject * mobj = method.enclosingMetaObject();
for (int i = 0; i <= method.methodIndex(); ++i) { for (int i = 0; i <= method.methodIndex(); ++i) {
...@@ -234,9 +234,6 @@ private: ...@@ -234,9 +234,6 @@ private:
++ index; ++ index;
} }
return index; return index;
#else
return method.methodIndex();
#endif
} }
public: public:
SignalList() {} SignalList() {}
......
...@@ -50,28 +50,18 @@ ...@@ -50,28 +50,18 @@
#include <QtLocation/private/qgeocameracapabilities_p.h> #include <QtLocation/private/qgeocameracapabilities_p.h>
#include <QtLocation/private/qgeomaptype_p.h> #include <QtLocation/private/qgeomaptype_p.h>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QtLocation/private/qgeotiledmapdata_p.h>
#else
#include <QtLocation/private/qgeotiledmap_p.h> #include <QtLocation/private/qgeotiledmap_p.h>
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
#include <QtLocation/private/qgeofiletilecache_p.h> #include <QtLocation/private/qgeofiletilecache_p.h>
#else
#include <QtLocation/private/qgeotilecache_p.h>
#endif
#endif
#include <QDir> #include <QDir>
#include <QStandardPaths> #include <QStandardPaths>
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
QGeoTiledMapQGC::QGeoTiledMapQGC(QGeoTiledMappingManagerEngine *engine, QObject *parent) QGeoTiledMapQGC::QGeoTiledMapQGC(QGeoTiledMappingManagerEngine *engine, QObject *parent)
: QGeoTiledMap(engine, parent) : QGeoTiledMap(engine, parent)
{ {
} }
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString)
...@@ -86,15 +76,7 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian ...@@ -86,15 +76,7 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
setTileSize(QSize(256, 256)); setTileSize(QSize(256, 256));
// In Qt 5.10 QGeoMapType need QGeoCameraCapabilities as argument
// E.g: https://github.com/qt/qtlocation/blob/2b230b0a10d898979e9d5193f4da2e408b397fe3/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp#L167
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
#define QGCGEOMAPTYPE(a,b,c,d,e,f) QGeoMapType(a,b,c,d,e,f,QByteArray("QGroundControl"), cameraCaps) #define QGCGEOMAPTYPE(a,b,c,d,e,f) QGeoMapType(a,b,c,d,e,f,QByteArray("QGroundControl"), cameraCaps)
#elif QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
#define QGCGEOMAPTYPE(a,b,c,d,e,f) QGeoMapType(a,b,c,d,e,f,QByteArray("QGroundControl"))
#else
#define QGCGEOMAPTYPE(a,b,c,d,e,f) QGeoMapType(a,b,c,d,e,f)
#endif
/* /*
* Google and Bing don't seem kosher at all. This was based on original code from OpenPilot and heavily modified to be used in QGC. * Google and Bing don't seem kosher at all. This was based on original code from OpenPilot and heavily modified to be used in QGC.
...@@ -117,9 +99,7 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian ...@@ -117,9 +99,7 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
getQGCMapEngine()->setUserAgent(parameters.value(QStringLiteral("useragent")).toString().toLatin1()); getQGCMapEngine()->setUserAgent(parameters.value(QStringLiteral("useragent")).toString().toLatin1());
} }
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
_setCache(parameters); _setCache(parameters);
#endif
setTileFetcher(new QGeoTileFetcherQGC(this)); setTileFetcher(new QGeoTileFetcherQGC(this));
...@@ -132,16 +112,6 @@ QGeoTiledMappingManagerEngineQGC::~QGeoTiledMappingManagerEngineQGC() ...@@ -132,16 +112,6 @@ QGeoTiledMappingManagerEngineQGC::~QGeoTiledMappingManagerEngineQGC()
{ {
} }
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
//-----------------------------------------------------------------------------
QGeoMapData *QGeoTiledMappingManagerEngineQGC::createMapData()
{
return new QGeoTiledMapData(this, 0);
}
#else
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
QGeoMap* QGeoMap*
QGeoTiledMappingManagerEngineQGC::createMap() QGeoTiledMappingManagerEngineQGC::createMap()
...@@ -149,9 +119,6 @@ QGeoTiledMappingManagerEngineQGC::createMap() ...@@ -149,9 +119,6 @@ QGeoTiledMappingManagerEngineQGC::createMap()
return new QGeoTiledMapQGC(this); return new QGeoTiledMapQGC(this);
} }
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap &parameters) QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap &parameters)
...@@ -194,12 +161,8 @@ QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap &parameters) ...@@ -194,12 +161,8 @@ QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap &parameters)
if(memLimit > 1024 * 1024 * 1024) if(memLimit > 1024 * 1024 * 1024)
memLimit = 1024 * 1024 * 1024; memLimit = 1024 * 1024 * 1024;
//-- Disable Qt's disk cache (sort of) //-- Disable Qt's disk cache (sort of)
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
QAbstractGeoTileCache *pTileCache = new QGeoFileTileCache(cacheDir); QAbstractGeoTileCache *pTileCache = new QGeoFileTileCache(cacheDir);
setTileCache(pTileCache); setTileCache(pTileCache);
#else
QGeoTileCache* pTileCache = createTileCacheWithDir(cacheDir);
#endif
if(pTileCache) if(pTileCache)
{ {
//-- We're basically telling it to use 100k of disk for cache. It doesn't like //-- We're basically telling it to use 100k of disk for cache. It doesn't like
...@@ -209,4 +172,3 @@ QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap &parameters) ...@@ -209,4 +172,3 @@ QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap &parameters)
pTileCache->setMaxMemoryUsage(memLimit); pTileCache->setMaxMemoryUsage(memLimit);
} }
} }
#endif
...@@ -48,19 +48,15 @@ ...@@ -48,19 +48,15 @@
#define QGEOTILEDMAPPINGMANAGERENGINEQGC_H #define QGEOTILEDMAPPINGMANAGERENGINEQGC_H
#include <QtLocation/QGeoServiceProvider> #include <QtLocation/QGeoServiceProvider>
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
#include <QtLocation/private/qgeotiledmap_p.h> #include <QtLocation/private/qgeotiledmap_p.h>
#endif
#include <QtLocation/private/qgeotiledmappingmanagerengine_p.h> #include <QtLocation/private/qgeotiledmappingmanagerengine_p.h>
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
class QGeoTiledMapQGC : public QGeoTiledMap class QGeoTiledMapQGC : public QGeoTiledMap
{ {
Q_OBJECT Q_OBJECT
public: public:
QGeoTiledMapQGC(QGeoTiledMappingManagerEngine *engine, QObject *parent = 0); QGeoTiledMapQGC(QGeoTiledMappingManagerEngine *engine, QObject *parent = 0);
}; };
#endif
class QGeoTileFetcherQGC; class QGeoTileFetcherQGC;
...@@ -70,15 +66,10 @@ class QGeoTiledMappingManagerEngineQGC : public QGeoTiledMappingManagerEngine ...@@ -70,15 +66,10 @@ class QGeoTiledMappingManagerEngineQGC : public QGeoTiledMappingManagerEngine
public: public:
QGeoTiledMappingManagerEngineQGC(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString); QGeoTiledMappingManagerEngineQGC(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString);
~QGeoTiledMappingManagerEngineQGC(); ~QGeoTiledMappingManagerEngineQGC();
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
QGeoMapData *createMapData();
#else
QGeoMap *createMap(); QGeoMap *createMap();
#endif
private: private:
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
void _setCache(const QVariantMap &parameters); void _setCache(const QVariantMap &parameters);
#endif
}; };
#endif // QGEOTILEDMAPPINGMANAGERENGINEQGC_H #endif // QGEOTILEDMAPPINGMANAGERENGINEQGC_H
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