forked from mavlink/qgroundcontrol
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mavlink#5156 from dogmaphobic/offlineTokens
Offline map Tokens
- Loading branch information
Showing
10 changed files
with
84 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,9 @@ | |
* @author Gus Grubba <[email protected]> | ||
* | ||
*/ | ||
#include "QGCApplication.h" | ||
#include "AppSettings.h" | ||
#include "SettingsManager.h" | ||
|
||
#include <math.h> | ||
#include <QSettings> | ||
|
@@ -88,8 +91,6 @@ stQGeoTileCacheQGCMapTypes kEsriTypes[] = { | |
|
||
#define NUM_ESRIMAPS (sizeof(kEsriTypes) / sizeof(stQGeoTileCacheQGCMapTypes)) | ||
|
||
static const char* kMapBoxTokenKey = "MapBoxToken"; | ||
static const char* kEsriTokenKey = "EsriToken"; | ||
static const char* kMaxDiskCacheKey = "MaxDiskCache"; | ||
static const char* kMaxMemCacheKey = "MaxMemoryCache"; | ||
|
||
|
@@ -346,59 +347,19 @@ QGCMapEngine::getMapNameList() | |
for(size_t i = 0; i < NUM_MAPS; i++) { | ||
mapList << kMapTypes[i].name; | ||
} | ||
if(!getMapBoxToken().isEmpty()) { | ||
if(!qgcApp()->toolbox()->settingsManager()->appSettings()->mapboxToken()->rawValue().toString().isEmpty()) { | ||
for(size_t i = 0; i < NUM_MAPBOXMAPS; i++) { | ||
mapList << kMapBoxTypes[i].name; | ||
} | ||
} | ||
if(!getEsriToken().isEmpty()) { | ||
if(!qgcApp()->toolbox()->settingsManager()->appSettings()->esriToken()->rawValue().toString().isEmpty()) { | ||
for(size_t i = 0; i < NUM_ESRIMAPS; i++) { | ||
mapList << kEsriTypes[i].name; | ||
} | ||
} | ||
return mapList; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void | ||
QGCMapEngine::setMapBoxToken(const QString& token) | ||
{ | ||
QSettings settings; | ||
settings.setValue(kMapBoxTokenKey, token); | ||
_mapBoxToken = token; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void | ||
QGCMapEngine::setEsriToken(const QString& token) | ||
{ | ||
QSettings settings; | ||
settings.setValue(kEsriTokenKey, token); | ||
_esriToken = token; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
QString | ||
QGCMapEngine::getMapBoxToken() | ||
{ | ||
if(_mapBoxToken.isEmpty()) { | ||
QSettings settings; | ||
_mapBoxToken = settings.value(kMapBoxTokenKey).toString(); | ||
} | ||
return _mapBoxToken; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
QString | ||
QGCMapEngine::getEsriToken() | ||
{ | ||
if(_esriToken.isEmpty()) { | ||
QSettings settings; | ||
_esriToken = settings.value(kEsriTokenKey).toString(); | ||
} | ||
return _esriToken; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
quint32 | ||
QGCMapEngine::getMaxDiskCache() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.