Commit 04ea3c19 authored by dogmaphobic's avatar dogmaphobic

Fixes for Linux and Android

Fixing QmlObjectListModel usage bug
parent 4112826b
...@@ -114,7 +114,7 @@ destroyMapEngine() ...@@ -114,7 +114,7 @@ destroyMapEngine()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
QGCMapEngine::QGCMapEngine() QGCMapEngine::QGCMapEngine()
: _urlFactory(new UrlFactory::UrlFactory()) : _urlFactory(new UrlFactory())
#ifdef WE_ARE_KOSHER #ifdef WE_ARE_KOSHER
//-- TODO: Get proper version //-- TODO: Get proper version
#if defined Q_OS_MAC #if defined Q_OS_MAC
...@@ -173,6 +173,7 @@ QGCMapEngine::init() ...@@ -173,6 +173,7 @@ QGCMapEngine::init()
if(!_cachePath.isEmpty()) { if(!_cachePath.isEmpty()) {
_cacheFile = kDbFileName; _cacheFile = kDbFileName;
_worker.setDatabaseFile(_cachePath + "/" + _cacheFile); _worker.setDatabaseFile(_cachePath + "/" + _cacheFile);
qDebug() << "Map Cache in:" << _cachePath << "/" << _cacheFile;
} else { } else {
qCritical() << "Could not find suitable map cache directory."; qCritical() << "Could not find suitable map cache directory.";
} }
......
...@@ -42,9 +42,8 @@ This file is part of the QGROUNDCONTROL project ...@@ -42,9 +42,8 @@ This file is part of the QGROUNDCONTROL project
class QGCCachedTileSet; class QGCCachedTileSet;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class QGCTile : public QObject class QGCTile
{ {
Q_OBJECT
public: public:
QGCTile() QGCTile()
: _x(0) : _x(0)
...@@ -55,16 +54,6 @@ public: ...@@ -55,16 +54,6 @@ public:
{ {
} }
QGCTile(const QGCTile& other)
: _x(other.x())
, _y(other.y())
, _z(other.z())
, _set(other.set())
, _hash(other.hash())
, _type(other.type())
{
}
enum TyleState { enum TyleState {
StatePending = 0, StatePending = 0,
StateDownloading, StateDownloading,
......
...@@ -115,8 +115,10 @@ QGCCachedTileSet::savedSizeStr() ...@@ -115,8 +115,10 @@ QGCCachedTileSet::savedSizeStr()
QString QString
QGCCachedTileSet::downloadStatus() QGCCachedTileSet::downloadStatus()
{ {
//-- Default size has no estimage. If complete, show only total size as well. if(_defaultSet) {
if(_defaultSet || _numTiles == _savedTiles) { return tilesSizeStr();
}
if(_numTiles == _savedTiles) {
return savedSizeStr(); return savedSizeStr();
} else { } else {
return savedSizeStr() + " / " + tilesSizeStr(); return savedSizeStr() + " / " + tilesSizeStr();
...@@ -222,7 +224,7 @@ void QGCCachedTileSet::_prepareDownload() ...@@ -222,7 +224,7 @@ void QGCCachedTileSet::_prepareDownload()
connect(reply, &QNetworkReply::finished, this, &QGCCachedTileSet::_networkReplyFinished); connect(reply, &QNetworkReply::finished, this, &QGCCachedTileSet::_networkReplyFinished);
connect(reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &QGCCachedTileSet::_networkReplyError); connect(reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &QGCCachedTileSet::_networkReplyError);
_replies.insert(tile->hash(), reply); _replies.insert(tile->hash(), reply);
tile->deleteLater(); delete tile;
//-- Refill queue if running low //-- Refill queue if running low
if(!_batchRequested && !_noMoreTiles && _tilesToDownload.count() < (QGCMapEngine::concurrentDownloads(_type) * 10)) { if(!_batchRequested && !_noMoreTiles && _tilesToDownload.count() < (QGCMapEngine::concurrentDownloads(_type) * 10)) {
//-- Request new batch of tiles //-- Request new batch of tiles
......
...@@ -352,9 +352,8 @@ QGCCacheWorker::_getTileSets(QGCMapTask* mtask) ...@@ -352,9 +352,8 @@ QGCCacheWorker::_getTileSets(QGCMapTask* mtask)
void void
QGCCacheWorker::_updateSetTotals(QGCCachedTileSet* set) QGCCacheWorker::_updateSetTotals(QGCCachedTileSet* set)
{ {
_updateTotals();
if(set->defaultSet()) { if(set->defaultSet()) {
//-- Default Set is already computed _updateTotals();
set->setSavedTiles(_totalCount); set->setSavedTiles(_totalCount);
set->setSavedSize(_totalSize); set->setSavedSize(_totalSize);
set->setNumTiles(_defaultCount); set->setNumTiles(_defaultCount);
...@@ -362,7 +361,6 @@ QGCCacheWorker::_updateSetTotals(QGCCachedTileSet* set) ...@@ -362,7 +361,6 @@ QGCCacheWorker::_updateSetTotals(QGCCachedTileSet* set)
return; return;
} }
QSqlQuery subquery(*_db); QSqlQuery subquery(*_db);
//-- Count everythin for Default Set
QString sq = QString("SELECT COUNT(size), SUM(size) FROM Tiles A INNER JOIN SetTiles B on A.tileID = B.tileID WHERE B.setID = %1").arg(set->id()); QString sq = QString("SELECT COUNT(size), SUM(size) FROM Tiles A INNER JOIN SetTiles B on A.tileID = B.tileID WHERE B.setID = %1").arg(set->id());
if(subquery.exec(sq)) { if(subquery.exec(sq)) {
if(subquery.next()) { if(subquery.next()) {
......
...@@ -226,7 +226,9 @@ QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap &parameters) ...@@ -226,7 +226,9 @@ QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap &parameters)
QGeoTileCache* pTileCache = createTileCacheWithDir(cacheDir); QGeoTileCache* pTileCache = createTileCacheWithDir(cacheDir);
if(pTileCache) if(pTileCache)
{ {
pTileCache->setMaxDiskUsage(1); //-- We're basically telling it to use 1kb of disk for cache. It doesn't like
// values smaller than that and I could not find a way to make it NOT cache.
pTileCache->setMaxDiskUsage(1024);
pTileCache->setMaxMemoryUsage(memLimit); pTileCache->setMaxMemoryUsage(memLimit);
} }
} }
......
...@@ -54,7 +54,7 @@ QGCMapEngineManager::QGCMapEngineManager(QGCApplication* app) ...@@ -54,7 +54,7 @@ QGCMapEngineManager::QGCMapEngineManager(QGCApplication* app)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
QGCMapEngineManager::~QGCMapEngineManager() QGCMapEngineManager::~QGCMapEngineManager()
{ {
//_clearTileSets(); _tileSets.clear();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -120,7 +120,7 @@ void ...@@ -120,7 +120,7 @@ void
QGCMapEngineManager::loadTileSets() QGCMapEngineManager::loadTileSets()
{ {
if(_tileSets.count()) { if(_tileSets.count()) {
_clearTileSets(); _tileSets.clear();
emit tileSetsChanged(); emit tileSetsChanged();
} }
QGCFetchTileSetTask* task = new QGCFetchTileSetTask(); QGCFetchTileSetTask* task = new QGCFetchTileSetTask();
...@@ -142,18 +142,6 @@ QGCMapEngineManager::_tileSetFetched(QGCCachedTileSet* tileSet) ...@@ -142,18 +142,6 @@ QGCMapEngineManager::_tileSetFetched(QGCCachedTileSet* tileSet)
emit tileSetsChanged(); emit tileSetsChanged();
} }
//-----------------------------------------------------------------------------
void
QGCMapEngineManager::_clearTileSets()
{
while(_tileSets.count()) {
QGCCachedTileSet* tileSet = qobject_cast<QGCCachedTileSet*>(_tileSets[0]);
if(tileSet)
delete tileSet;
_tileSets.removeAt(0);
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
QGCMapEngineManager::startDownload(const QString& name, const QString& description, const QString& mapType, const QImage& image) QGCMapEngineManager::startDownload(const QString& name, const QString& description, const QString& mapType, const QImage& image)
......
...@@ -123,7 +123,6 @@ private slots: ...@@ -123,7 +123,6 @@ private slots:
void _resetCompleted (); void _resetCompleted ();
private: private:
void _clearTileSets ();
void _updateDiskFreeSpace (); void _updateDiskFreeSpace ();
private: private:
......
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