Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
22595287
Commit
22595287
authored
May 15, 2017
by
Gus Grubba
Committed by
GitHub
May 15, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5156 from dogmaphobic/offlineTokens
Offline map Tokens
parents
86647cab
56b3a295
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
84 additions
and
113 deletions
+84
-113
QGCMapEngine.cpp
src/QtLocationPlugin/QGCMapEngine.cpp
+5
-44
QGCMapEngine.h
src/QtLocationPlugin/QGCMapEngine.h
+0
-6
QGCMapUrlEngine.cpp
src/QtLocationPlugin/QGCMapUrlEngine.cpp
+5
-2
OfflineMap.qml
src/QtLocationPlugin/QMLControl/OfflineMap.qml
+21
-22
QGCMapEngineManager.cc
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc
+0
-28
QGCMapEngineManager.h
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h
+0
-8
App.SettingsGroup.json
src/Settings/App.SettingsGroup.json
+14
-0
AppSettings.cc
src/Settings/AppSettings.cc
+22
-0
AppSettings.h
src/Settings/AppSettings.h
+9
-1
FlightMapSettings.cc
src/Settings/FlightMapSettings.cc
+8
-2
No files found.
src/QtLocationPlugin/QGCMapEngine.cpp
View file @
22595287
...
@@ -15,6 +15,9 @@
...
@@ -15,6 +15,9 @@
* @author Gus Grubba <mavlink@grubba.com>
* @author Gus Grubba <mavlink@grubba.com>
*
*
*/
*/
#include "QGCApplication.h"
#include "AppSettings.h"
#include "SettingsManager.h"
#include <math.h>
#include <math.h>
#include <QSettings>
#include <QSettings>
...
@@ -88,8 +91,6 @@ stQGeoTileCacheQGCMapTypes kEsriTypes[] = {
...
@@ -88,8 +91,6 @@ stQGeoTileCacheQGCMapTypes kEsriTypes[] = {
#define NUM_ESRIMAPS (sizeof(kEsriTypes) / sizeof(stQGeoTileCacheQGCMapTypes))
#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
*
kMaxDiskCacheKey
=
"MaxDiskCache"
;
static
const
char
*
kMaxMemCacheKey
=
"MaxMemoryCache"
;
static
const
char
*
kMaxMemCacheKey
=
"MaxMemoryCache"
;
...
@@ -346,12 +347,12 @@ QGCMapEngine::getMapNameList()
...
@@ -346,12 +347,12 @@ QGCMapEngine::getMapNameList()
for
(
size_t
i
=
0
;
i
<
NUM_MAPS
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
NUM_MAPS
;
i
++
)
{
mapList
<<
kMapTypes
[
i
].
name
;
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
++
)
{
for
(
size_t
i
=
0
;
i
<
NUM_MAPBOXMAPS
;
i
++
)
{
mapList
<<
kMapBoxTypes
[
i
].
name
;
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
++
)
{
for
(
size_t
i
=
0
;
i
<
NUM_ESRIMAPS
;
i
++
)
{
mapList
<<
kEsriTypes
[
i
].
name
;
mapList
<<
kEsriTypes
[
i
].
name
;
}
}
...
@@ -359,46 +360,6 @@ QGCMapEngine::getMapNameList()
...
@@ -359,46 +360,6 @@ QGCMapEngine::getMapNameList()
return
mapList
;
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
quint32
QGCMapEngine
::
getMaxDiskCache
()
QGCMapEngine
::
getMaxDiskCache
()
...
...
src/QtLocationPlugin/QGCMapEngine.h
View file @
22595287
...
@@ -78,10 +78,6 @@ public:
...
@@ -78,10 +78,6 @@ public:
const
QString
userAgent
()
{
return
_userAgent
;
}
const
QString
userAgent
()
{
return
_userAgent
;
}
void
setUserAgent
(
const
QString
&
ua
)
{
_userAgent
=
ua
;
}
void
setUserAgent
(
const
QString
&
ua
)
{
_userAgent
=
ua
;
}
UrlFactory
::
MapType
hashToType
(
const
QString
&
hash
);
UrlFactory
::
MapType
hashToType
(
const
QString
&
hash
);
QString
getMapBoxToken
();
QString
getEsriToken
();
void
setMapBoxToken
(
const
QString
&
token
);
void
setEsriToken
(
const
QString
&
token
);
quint32
getMaxDiskCache
();
quint32
getMaxDiskCache
();
void
setMaxDiskCache
(
quint32
size
);
void
setMaxDiskCache
(
quint32
size
);
quint32
getMaxMemCache
();
quint32
getMaxMemCache
();
...
@@ -121,8 +117,6 @@ private:
...
@@ -121,8 +117,6 @@ private:
QGCCacheWorker
_worker
;
QGCCacheWorker
_worker
;
QString
_cachePath
;
QString
_cachePath
;
QString
_cacheFile
;
QString
_cacheFile
;
QString
_mapBoxToken
;
QString
_esriToken
;
UrlFactory
*
_urlFactory
;
UrlFactory
*
_urlFactory
;
QString
_userAgent
;
QString
_userAgent
;
quint32
_maxDiskCache
;
quint32
_maxDiskCache
;
...
...
src/QtLocationPlugin/QGCMapUrlEngine.cpp
View file @
22595287
...
@@ -16,7 +16,10 @@
...
@@ -16,7 +16,10 @@
//#define DEBUG_GOOGLE_MAPS
//#define DEBUG_GOOGLE_MAPS
#include "QGCApplication.h"
#include "QGCMapEngine.h"
#include "QGCMapEngine.h"
#include "AppSettings.h"
#include "SettingsManager.h"
#include <QRegExp>
#include <QRegExp>
#include <QNetworkReply>
#include <QNetworkReply>
...
@@ -168,7 +171,7 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag
...
@@ -168,7 +171,7 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag
case
EsriWorldStreet
:
case
EsriWorldStreet
:
case
EsriWorldSatellite
:
case
EsriWorldSatellite
:
case
EsriTerrain
:
{
case
EsriTerrain
:
{
QByteArray
token
=
getQGCMapEngine
()
->
getEsriToken
().
toLatin1
();
QByteArray
token
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
esriToken
()
->
rawValue
().
toString
().
toLatin1
();
request
.
setRawHeader
(
"User-Agent"
,
QByteArrayLiteral
(
"Qt Location based application"
));
request
.
setRawHeader
(
"User-Agent"
,
QByteArrayLiteral
(
"Qt Location based application"
));
request
.
setRawHeader
(
"User-Token"
,
token
);
request
.
setRawHeader
(
"User-Token"
,
token
);
}
}
...
@@ -335,7 +338,7 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
...
@@ -335,7 +338,7 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
case
MapBoxEmerald
:
case
MapBoxEmerald
:
case
MapBoxHighContrast
:
case
MapBoxHighContrast
:
{
{
QString
mapBoxToken
=
getQGCMapEngine
()
->
getMapBoxToken
();
QString
mapBoxToken
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
mapboxToken
()
->
rawValue
().
toString
();
if
(
!
mapBoxToken
.
isEmpty
())
{
if
(
!
mapBoxToken
.
isEmpty
())
{
QString
server
=
"https://api.mapbox.com/v4/"
;
QString
server
=
"https://api.mapbox.com/v4/"
;
switch
(
type
)
{
switch
(
type
)
{
...
...
src/QtLocationPlugin/QMLControl/OfflineMap.qml
View file @
22595287
...
@@ -21,6 +21,8 @@ import QGroundControl.ScreenTools 1.0
...
@@ -21,6 +21,8 @@ import QGroundControl.ScreenTools 1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
FlightMap
1.0
import
QGroundControl
.
FlightMap
1.0
import
QGroundControl
.
QGCMapEngineManager
1.0
import
QGroundControl
.
QGCMapEngineManager
1.0
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
QGCView
{
QGCView
{
id
:
offlineMapView
id
:
offlineMapView
...
@@ -31,6 +33,9 @@ QGCView {
...
@@ -31,6 +33,9 @@ QGCView {
property
string
mapKey
:
"
lastMapType
"
property
string
mapKey
:
"
lastMapType
"
property
Fact
_mapboxFact
:
QGroundControl
.
settingsManager
.
appSettings
.
mapboxToken
property
Fact
_esriFact
:
QGroundControl
.
settingsManager
.
appSettings
.
esriToken
property
string
mapType
:
_settings
.
mapProvider
.
enumStringValue
+
"
"
+
_settings
.
mapType
.
enumStringValue
property
string
mapType
:
_settings
.
mapProvider
.
enumStringValue
+
"
"
+
_settings
.
mapType
.
enumStringValue
property
bool
isMapInteractive
:
false
property
bool
isMapInteractive
:
false
property
var
savedCenter
:
undefined
property
var
savedCenter
:
undefined
...
@@ -227,8 +232,6 @@ QGCView {
...
@@ -227,8 +232,6 @@ QGCView {
id
:
optionDialog
id
:
optionDialog
function
accept
()
{
function
accept
()
{
QGroundControl
.
mapEngineManager
.
mapboxToken
=
mapBoxToken
.
text
QGroundControl
.
mapEngineManager
.
esriToken
=
esriToken
.
text
QGroundControl
.
mapEngineManager
.
maxDiskCache
=
parseInt
(
maxCacheSize
.
text
)
QGroundControl
.
mapEngineManager
.
maxDiskCache
=
parseInt
(
maxCacheSize
.
text
)
QGroundControl
.
mapEngineManager
.
maxMemCache
=
parseInt
(
maxCacheMemSize
.
text
)
QGroundControl
.
mapEngineManager
.
maxMemCache
=
parseInt
(
maxCacheMemSize
.
text
)
optionDialog
.
hideDialog
()
optionDialog
.
hideDialog
()
...
@@ -273,35 +276,31 @@ QGCView {
...
@@ -273,35 +276,31 @@ QGCView {
text
:
qsTr
(
"
Memory cache changes require a restart to take effect.
"
)
text
:
qsTr
(
"
Memory cache changes require a restart to take effect.
"
)
}
}
Item
{
width
:
1
;
height
:
1
}
Item
{
width
:
1
;
height
:
1
;
visible
:
_mapboxFact
?
_mapboxFact
.
visible
:
false
}
QGCLabel
{
text
:
qsTr
(
"
MapBox Access Token
"
);
visible
:
_mapboxFact
?
_mapboxFact
.
visible
:
false
}
QGCLabel
{
text
:
qsTr
(
"
MapBox Access Token
"
)
}
FactTextField
{
fact
:
_mapboxFact
QGCTextField
{
visible
:
_mapboxFact
?
_mapboxFact
.
visible
:
false
id
:
mapBoxToken
maximumLength
:
256
maximumLength
:
256
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
text
:
QGroundControl
.
mapEngineManager
.
mapboxToken
}
}
QGCLabel
{
QGCLabel
{
text
:
qsTr
(
"
With an access token, you can use MapBox Maps.
"
)
text
:
qsTr
(
"
With an access token, you can use MapBox Maps.
"
)
visible
:
_mapboxFact
?
_mapboxFact
.
visible
:
false
font.pointSize
:
_adjustableFontPointSize
font.pointSize
:
_adjustableFontPointSize
}
}
Item
{
width
:
1
;
height
:
1
}
Item
{
width
:
1
;
height
:
1
;
visible
:
_esriFact
?
_esriFact
.
visible
:
false
}
QGCLabel
{
text
:
qsTr
(
"
Esri Access Token
"
);
visible
:
_esriFact
?
_esriFact
.
visible
:
false
}
QGCLabel
{
text
:
qsTr
(
"
Esri Access Token
"
)
}
FactTextField
{
fact
:
_esriFact
QGCTextField
{
visible
:
_esriFact
?
_esriFact
.
visible
:
false
id
:
esriToken
maximumLength
:
256
maximumLength
:
256
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
text
:
QGroundControl
.
mapEngineManager
.
esriToken
}
}
QGCLabel
{
QGCLabel
{
text
:
qsTr
(
"
With an access token, you can use Esri Maps.
"
)
text
:
qsTr
(
"
With an access token, you can use Esri Maps.
"
)
visible
:
_esriFact
?
_esriFact
.
visible
:
false
font.pointSize
:
_adjustableFontPointSize
font.pointSize
:
_adjustableFontPointSize
}
}
}
// GridLayout
}
// GridLayout
...
...
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc
View file @
22595287
...
@@ -195,34 +195,6 @@ QGCMapEngineManager::mapList()
...
@@ -195,34 +195,6 @@ QGCMapEngineManager::mapList()
return
getQGCMapEngine
()
->
getMapNameList
();
return
getQGCMapEngine
()
->
getMapNameList
();
}
}
//-----------------------------------------------------------------------------
QString
QGCMapEngineManager
::
mapboxToken
()
{
return
getQGCMapEngine
()
->
getMapBoxToken
();
}
//-----------------------------------------------------------------------------
void
QGCMapEngineManager
::
setMapboxToken
(
QString
token
)
{
getQGCMapEngine
()
->
setMapBoxToken
(
token
);
}
//-----------------------------------------------------------------------------
QString
QGCMapEngineManager
::
esriToken
()
{
return
getQGCMapEngine
()
->
getEsriToken
();
}
//-----------------------------------------------------------------------------
void
QGCMapEngineManager
::
setEsriToken
(
QString
token
)
{
getQGCMapEngine
()
->
setEsriToken
(
token
);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
quint32
quint32
QGCMapEngineManager
::
maxMemCache
()
QGCMapEngineManager
::
maxMemCache
()
...
...
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h
View file @
22595287
...
@@ -47,8 +47,6 @@ public:
...
@@ -47,8 +47,6 @@ public:
Q_PROPERTY
(
QString
tileSizeStr
READ
tileSizeStr
NOTIFY
tileSizeChanged
)
Q_PROPERTY
(
QString
tileSizeStr
READ
tileSizeStr
NOTIFY
tileSizeChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
tileSets
READ
tileSets
NOTIFY
tileSetsChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
tileSets
READ
tileSets
NOTIFY
tileSetsChanged
)
Q_PROPERTY
(
QStringList
mapList
READ
mapList
CONSTANT
)
Q_PROPERTY
(
QStringList
mapList
READ
mapList
CONSTANT
)
Q_PROPERTY
(
QString
mapboxToken
READ
mapboxToken
WRITE
setMapboxToken
NOTIFY
mapboxTokenChanged
)
Q_PROPERTY
(
QString
esriToken
READ
esriToken
WRITE
setEsriToken
NOTIFY
esriTokenChanged
)
Q_PROPERTY
(
quint32
maxMemCache
READ
maxMemCache
WRITE
setMaxMemCache
NOTIFY
maxMemCacheChanged
)
Q_PROPERTY
(
quint32
maxMemCache
READ
maxMemCache
WRITE
setMaxMemCache
NOTIFY
maxMemCacheChanged
)
Q_PROPERTY
(
quint32
maxDiskCache
READ
maxDiskCache
WRITE
setMaxDiskCache
NOTIFY
maxDiskCacheChanged
)
Q_PROPERTY
(
quint32
maxDiskCache
READ
maxDiskCache
WRITE
setMaxDiskCache
NOTIFY
maxDiskCacheChanged
)
Q_PROPERTY
(
QString
errorMessage
READ
errorMessage
NOTIFY
errorMessageChanged
)
Q_PROPERTY
(
QString
errorMessage
READ
errorMessage
NOTIFY
errorMessageChanged
)
...
@@ -85,8 +83,6 @@ public:
...
@@ -85,8 +83,6 @@ public:
quint64
tileSize
()
{
return
_totalSet
.
tileSize
;
}
quint64
tileSize
()
{
return
_totalSet
.
tileSize
;
}
QString
tileSizeStr
();
QString
tileSizeStr
();
QStringList
mapList
();
QStringList
mapList
();
QString
mapboxToken
();
QString
esriToken
();
QmlObjectListModel
*
tileSets
()
{
return
&
_tileSets
;
}
QmlObjectListModel
*
tileSets
()
{
return
&
_tileSets
;
}
quint32
maxMemCache
();
quint32
maxMemCache
();
quint32
maxDiskCache
();
quint32
maxDiskCache
();
...
@@ -98,8 +94,6 @@ public:
...
@@ -98,8 +94,6 @@ public:
ImportAction
importAction
()
{
return
_importAction
;
}
ImportAction
importAction
()
{
return
_importAction
;
}
bool
importReplace
()
{
return
_importReplace
;
}
bool
importReplace
()
{
return
_importReplace
;
}
void
setMapboxToken
(
QString
token
);
void
setEsriToken
(
QString
token
);
void
setMaxMemCache
(
quint32
size
);
void
setMaxMemCache
(
quint32
size
);
void
setMaxDiskCache
(
quint32
size
);
void
setMaxDiskCache
(
quint32
size
);
void
setImportReplace
(
bool
replace
)
{
_importReplace
=
replace
;
emit
importReplaceChanged
();
}
void
setImportReplace
(
bool
replace
)
{
_importReplace
=
replace
;
emit
importReplaceChanged
();
}
...
@@ -116,8 +110,6 @@ signals:
...
@@ -116,8 +110,6 @@ signals:
void
tileY1Changed
();
void
tileY1Changed
();
void
tileCountChanged
();
void
tileCountChanged
();
void
tileSizeChanged
();
void
tileSizeChanged
();
void
mapboxTokenChanged
();
void
esriTokenChanged
();
void
tileSetsChanged
();
void
tileSetsChanged
();
void
maxMemCacheChanged
();
void
maxMemCacheChanged
();
void
maxDiskCacheChanged
();
void
maxDiskCacheChanged
();
...
...
src/Settings/App.SettingsGroup.json
View file @
22595287
...
@@ -122,5 +122,19 @@
...
@@ -122,5 +122,19 @@
"longDescription"
:
"Directory to which all data files are saved/loaded from"
,
"longDescription"
:
"Directory to which all data files are saved/loaded from"
,
"type"
:
"string"
,
"type"
:
"string"
,
"defaultValue"
:
""
"defaultValue"
:
""
},
{
"name"
:
"MapBoxToken"
,
"shortDescription"
:
"Access token to MapBox maps"
,
"longDescription"
:
"Your personal access token for MapBox maps"
,
"type"
:
"string"
,
"defaultValue"
:
""
},
{
"name"
:
"EsriToken"
,
"shortDescription"
:
"Access token to Esri maps"
,
"longDescription"
:
"Your personal access token for Esri maps"
,
"type"
:
"string"
,
"defaultValue"
:
""
}
}
]
]
src/Settings/AppSettings.cc
View file @
22595287
...
@@ -31,6 +31,8 @@ const char* AppSettings::indoorPaletteName = "StyleIs
...
@@ -31,6 +31,8 @@ const char* AppSettings::indoorPaletteName = "StyleIs
const
char
*
AppSettings
::
showLargeCompassName
=
"ShowLargeCompass"
;
const
char
*
AppSettings
::
showLargeCompassName
=
"ShowLargeCompass"
;
const
char
*
AppSettings
::
savePathName
=
"SavePath"
;
const
char
*
AppSettings
::
savePathName
=
"SavePath"
;
const
char
*
AppSettings
::
autoLoadMissionsName
=
"AutoLoadMissions"
;
const
char
*
AppSettings
::
autoLoadMissionsName
=
"AutoLoadMissions"
;
const
char
*
AppSettings
::
mapboxTokenName
=
"MapBoxToken"
;
const
char
*
AppSettings
::
esriTokenName
=
"EsriToken"
;
const
char
*
AppSettings
::
parameterFileExtension
=
"params"
;
const
char
*
AppSettings
::
parameterFileExtension
=
"params"
;
const
char
*
AppSettings
::
planFileExtension
=
"plan"
;
const
char
*
AppSettings
::
planFileExtension
=
"plan"
;
...
@@ -61,6 +63,8 @@ AppSettings::AppSettings(QObject* parent)
...
@@ -61,6 +63,8 @@ AppSettings::AppSettings(QObject* parent)
,
_showLargeCompassFact
(
NULL
)
,
_showLargeCompassFact
(
NULL
)
,
_savePathFact
(
NULL
)
,
_savePathFact
(
NULL
)
,
_autoLoadMissionsFact
(
NULL
)
,
_autoLoadMissionsFact
(
NULL
)
,
_mapboxTokenFact
(
NULL
)
,
_esriTokenFact
(
NULL
)
{
{
QQmlEngine
::
setObjectOwnership
(
this
,
QQmlEngine
::
CppOwnership
);
QQmlEngine
::
setObjectOwnership
(
this
,
QQmlEngine
::
CppOwnership
);
qmlRegisterUncreatableType
<
AppSettings
>
(
"QGroundControl.SettingsManager"
,
1
,
0
,
"AppSettings"
,
"Reference only"
);
qmlRegisterUncreatableType
<
AppSettings
>
(
"QGroundControl.SettingsManager"
,
1
,
0
,
"AppSettings"
,
"Reference only"
);
...
@@ -278,6 +282,24 @@ Fact* AppSettings::autoLoadMissions(void)
...
@@ -278,6 +282,24 @@ Fact* AppSettings::autoLoadMissions(void)
return
_autoLoadMissionsFact
;
return
_autoLoadMissionsFact
;
}
}
Fact
*
AppSettings
::
mapboxToken
(
void
)
{
if
(
!
_mapboxTokenFact
)
{
_mapboxTokenFact
=
_createSettingsFact
(
mapboxTokenName
);
}
return
_mapboxTokenFact
;
}
Fact
*
AppSettings
::
esriToken
(
void
)
{
if
(
!
_esriTokenFact
)
{
_esriTokenFact
=
_createSettingsFact
(
esriTokenName
);
}
return
_esriTokenFact
;
}
MAV_AUTOPILOT
AppSettings
::
offlineEditingFirmwareTypeFromFirmwareType
(
MAV_AUTOPILOT
firmwareType
)
MAV_AUTOPILOT
AppSettings
::
offlineEditingFirmwareTypeFromFirmwareType
(
MAV_AUTOPILOT
firmwareType
)
{
{
if
(
firmwareType
!=
MAV_AUTOPILOT_PX4
&&
firmwareType
!=
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
if
(
firmwareType
!=
MAV_AUTOPILOT_PX4
&&
firmwareType
!=
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
...
...
src/Settings/AppSettings.h
View file @
22595287
...
@@ -35,12 +35,14 @@ public:
...
@@ -35,12 +35,14 @@ public:
Q_PROPERTY
(
Fact
*
showLargeCompass
READ
showLargeCompass
CONSTANT
)
Q_PROPERTY
(
Fact
*
showLargeCompass
READ
showLargeCompass
CONSTANT
)
Q_PROPERTY
(
Fact
*
savePath
READ
savePath
CONSTANT
)
Q_PROPERTY
(
Fact
*
savePath
READ
savePath
CONSTANT
)
Q_PROPERTY
(
Fact
*
autoLoadMissions
READ
autoLoadMissions
CONSTANT
)
Q_PROPERTY
(
Fact
*
autoLoadMissions
READ
autoLoadMissions
CONSTANT
)
Q_PROPERTY
(
Fact
*
mapboxToken
READ
mapboxToken
CONSTANT
)
Q_PROPERTY
(
Fact
*
esriToken
READ
esriToken
CONSTANT
)
Q_PROPERTY
(
QString
missionSavePath
READ
missionSavePath
NOTIFY
savePathsChanged
)
Q_PROPERTY
(
QString
missionSavePath
READ
missionSavePath
NOTIFY
savePathsChanged
)
Q_PROPERTY
(
QString
parameterSavePath
READ
parameterSavePath
NOTIFY
savePathsChanged
)
Q_PROPERTY
(
QString
parameterSavePath
READ
parameterSavePath
NOTIFY
savePathsChanged
)
Q_PROPERTY
(
QString
telemetrySavePath
READ
telemetrySavePath
NOTIFY
savePathsChanged
)
Q_PROPERTY
(
QString
telemetrySavePath
READ
telemetrySavePath
NOTIFY
savePathsChanged
)
Q_PROPERTY
(
QString
planFileExtension
MEMBER
planFileExtension
CONSTANT
)
Q_PROPERTY
(
QString
planFileExtension
MEMBER
planFileExtension
CONSTANT
)
Q_PROPERTY
(
QString
missionFileExtension
MEMBER
missionFileExtension
CONSTANT
)
Q_PROPERTY
(
QString
missionFileExtension
MEMBER
missionFileExtension
CONSTANT
)
Q_PROPERTY
(
QString
waypointsFileExtension
MEMBER
waypointsFileExtension
CONSTANT
)
Q_PROPERTY
(
QString
waypointsFileExtension
MEMBER
waypointsFileExtension
CONSTANT
)
Q_PROPERTY
(
QString
parameterFileExtension
MEMBER
parameterFileExtension
CONSTANT
)
Q_PROPERTY
(
QString
parameterFileExtension
MEMBER
parameterFileExtension
CONSTANT
)
...
@@ -61,6 +63,8 @@ public:
...
@@ -61,6 +63,8 @@ public:
Fact
*
showLargeCompass
(
void
);
Fact
*
showLargeCompass
(
void
);
Fact
*
savePath
(
void
);
Fact
*
savePath
(
void
);
Fact
*
autoLoadMissions
(
void
);
Fact
*
autoLoadMissions
(
void
);
Fact
*
mapboxToken
(
void
);
Fact
*
esriToken
(
void
);
QString
missionSavePath
(
void
);
QString
missionSavePath
(
void
);
QString
parameterSavePath
(
void
);
QString
parameterSavePath
(
void
);
...
@@ -86,6 +90,8 @@ public:
...
@@ -86,6 +90,8 @@ public:
static
const
char
*
showLargeCompassName
;
static
const
char
*
showLargeCompassName
;
static
const
char
*
savePathName
;
static
const
char
*
savePathName
;
static
const
char
*
autoLoadMissionsName
;
static
const
char
*
autoLoadMissionsName
;
static
const
char
*
mapboxTokenName
;
static
const
char
*
esriTokenName
;
// Application wide file extensions
// Application wide file extensions
static
const
char
*
parameterFileExtension
;
static
const
char
*
parameterFileExtension
;
...
@@ -124,6 +130,8 @@ private:
...
@@ -124,6 +130,8 @@ private:
SettingsFact
*
_showLargeCompassFact
;
SettingsFact
*
_showLargeCompassFact
;
SettingsFact
*
_savePathFact
;
SettingsFact
*
_savePathFact
;
SettingsFact
*
_autoLoadMissionsFact
;
SettingsFact
*
_autoLoadMissionsFact
;
SettingsFact
*
_mapboxTokenFact
;
SettingsFact
*
_esriTokenFact
;
};
};
#endif
#endif
src/Settings/FlightMapSettings.cc
View file @
22595287
...
@@ -7,8 +7,11 @@
...
@@ -7,8 +7,11 @@
*
*
****************************************************************************/
****************************************************************************/
#include "QGCApplication.h"
#include "FlightMapSettings.h"
#include "FlightMapSettings.h"
#include "QGCMapEngine.h"
#include "QGCMapEngine.h"
#include "AppSettings.h"
#include "SettingsManager.h"
#include <QQmlEngine>
#include <QQmlEngine>
#include <QtQml>
#include <QtQml>
...
@@ -34,10 +37,10 @@ FlightMapSettings::FlightMapSettings(QObject* parent)
...
@@ -34,10 +37,10 @@ FlightMapSettings::FlightMapSettings(QObject* parent)
//-- Remove Google
//-- Remove Google
_excludeProvider
(
mapProviderGoogle
);
_excludeProvider
(
mapProviderGoogle
);
#endif
#endif
if
(
getQGCMapEngine
()
->
getMapBoxToken
().
isEmpty
())
{
if
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
mapboxToken
()
->
rawValue
().
toString
().
isEmpty
())
{
_excludeProvider
(
mapProviderMapBox
);
_excludeProvider
(
mapProviderMapBox
);
}
}
if
(
getQGCMapEngine
()
->
getEsriToken
().
isEmpty
())
{
if
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
esriToken
()
->
rawValue
().
toString
().
isEmpty
())
{
_excludeProvider
(
mapProviderEsri
);
_excludeProvider
(
mapProviderEsri
);
}
}
_newMapProvider
(
mapProvider
()
->
rawValue
());
_newMapProvider
(
mapProvider
()
->
rawValue
());
...
@@ -107,6 +110,9 @@ void FlightMapSettings::_newMapProvider(QVariant value)
...
@@ -107,6 +110,9 @@ void FlightMapSettings::_newMapProvider(QVariant value)
_removeEnumValue
(
mapTypeSatellite
,
enumStrings
,
enumValues
);
_removeEnumValue
(
mapTypeSatellite
,
enumStrings
,
enumValues
);
_removeEnumValue
(
mapTypeHybrid
,
enumStrings
,
enumValues
);
_removeEnumValue
(
mapTypeHybrid
,
enumStrings
,
enumValues
);
break
;
break
;
case
mapProviderEsri
:
_removeEnumValue
(
mapTypeHybrid
,
enumStrings
,
enumValues
);
break
;
}
}
metaData
->
setEnumInfo
(
enumStrings
,
enumValues
);
metaData
->
setEnumInfo
(
enumStrings
,
enumValues
);
emit
mapTypeChanged
();
emit
mapTypeChanged
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment