Commit f5cdf449 authored by Gus Grubba's avatar Gus Grubba

Windows fixes

parent f30a47d9
...@@ -33,6 +33,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -33,6 +33,7 @@ This file is part of the QGROUNDCONTROL project
#include <QSettings> #include <QSettings>
#include <QStandardPaths> #include <QStandardPaths>
#include <QDir> #include <QDir>
#include <stdio.h>
#include "QGCMapEngine.h" #include "QGCMapEngine.h"
#include "QGCMapTileSet.h" #include "QGCMapTileSet.h"
...@@ -208,9 +209,7 @@ QGCMapEngine::cacheTile(UrlFactory::MapType type, const QString& hash, const QBy ...@@ -208,9 +209,7 @@ QGCMapEngine::cacheTile(UrlFactory::MapType type, const QString& hash, const QBy
QString QString
QGCMapEngine::getTileHash(UrlFactory::MapType type, int x, int y, int z) QGCMapEngine::getTileHash(UrlFactory::MapType type, int x, int y, int z)
{ {
char hashSource[64]; return QString().sprintf("%04d%08d%08d%03d", (int)type, x, y, z);
snprintf(hashSource, sizeof(hashSource), "%04d%08d%08d%03d", (int)type, x, y, z);
return QString(hashSource);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -226,9 +226,13 @@ QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap &parameters) ...@@ -226,9 +226,13 @@ QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap &parameters)
QGeoTileCache* pTileCache = createTileCacheWithDir(cacheDir); QGeoTileCache* pTileCache = createTileCacheWithDir(cacheDir);
if(pTileCache) if(pTileCache)
{ {
//-- We're basically telling it to use 1kb of disk for cache. It doesn't like //-- We're basically telling it to use 1kb (100k for Windows) of disk for cache. It doesn't like
// values smaller than that and I could not find a way to make it NOT cache. // values smaller than that and I could not find a way to make it NOT cache.
#ifdef Q_OS_WIN
pTileCache->setMaxDiskUsage(1024 * 100);
#else
pTileCache->setMaxDiskUsage(1024); pTileCache->setMaxDiskUsage(1024);
#endif
pTileCache->setMaxMemoryUsage(memLimit); pTileCache->setMaxMemoryUsage(memLimit);
} }
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "QGCMapTileSet.h" #include "QGCMapTileSet.h"
#include "QGCMapUrlEngine.h" #include "QGCMapUrlEngine.h"
#include <QStorageInfo> #include <QStorageInfo>
#include <stdio.h>
QGC_LOGGING_CATEGORY(QGCMapEngineManagerLog, "QGCMapEngineManagerLog") QGC_LOGGING_CATEGORY(QGCMapEngineManagerLog, "QGCMapEngineManagerLog")
...@@ -378,10 +379,8 @@ QGCMapEngineManager::getUniqueName() ...@@ -378,10 +379,8 @@ QGCMapEngineManager::getUniqueName()
QString name; QString name;
int count = 1; int count = 1;
while (true) { while (true) {
char numb[16];
snprintf(numb, sizeof(numb), "%03d", count++);
name = test; name = test;
name += numb; name += QString().sprintf("%03d", count++);
if(!findName(name)) if(!findName(name))
return name; return name;
} }
......
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