Commit 31ab9fff authored by DonLakeFlyer's avatar DonLakeFlyer

Map provider and type move to SettingsManager

* Map type now set from General settings
* No map type control in maps
parent 073295bc
...@@ -443,7 +443,6 @@ HEADERS += \ ...@@ -443,7 +443,6 @@ HEADERS += \
src/CmdLineOptParser.h \ src/CmdLineOptParser.h \
src/FirmwarePlugin/PX4/px4_custom_mode.h \ src/FirmwarePlugin/PX4/px4_custom_mode.h \
src/FlightDisplay/VideoManager.h \ src/FlightDisplay/VideoManager.h \
src/FlightMap/FlightMapSettings.h \
src/FlightMap/Widgets/ValuesWidgetController.h \ src/FlightMap/Widgets/ValuesWidgetController.h \
src/FollowMe/FollowMe.h \ src/FollowMe/FollowMe.h \
src/GAudioOutput.h \ src/GAudioOutput.h \
...@@ -502,6 +501,7 @@ HEADERS += \ ...@@ -502,6 +501,7 @@ HEADERS += \
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h \ src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h \
src/Settings/AppSettings.h \ src/Settings/AppSettings.h \
src/Settings/AutoConnectSettings.h \ src/Settings/AutoConnectSettings.h \
src/Settings/FlightMapSettings.h \
src/Settings/SettingsGroup.h \ src/Settings/SettingsGroup.h \
src/Settings/SettingsManager.h \ src/Settings/SettingsManager.h \
src/Settings/UnitsSettings.h \ src/Settings/UnitsSettings.h \
...@@ -622,7 +622,6 @@ SOURCES += \ ...@@ -622,7 +622,6 @@ SOURCES += \
src/AnalyzeView/ExifParser.cc \ src/AnalyzeView/ExifParser.cc \
src/CmdLineOptParser.cc \ src/CmdLineOptParser.cc \
src/FlightDisplay/VideoManager.cc \ src/FlightDisplay/VideoManager.cc \
src/FlightMap/FlightMapSettings.cc \
src/FlightMap/Widgets/ValuesWidgetController.cc \ src/FlightMap/Widgets/ValuesWidgetController.cc \
src/FollowMe/FollowMe.cc \ src/FollowMe/FollowMe.cc \
src/GAudioOutput.cc \ src/GAudioOutput.cc \
...@@ -678,6 +677,7 @@ SOURCES += \ ...@@ -678,6 +677,7 @@ SOURCES += \
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc \ src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc \
src/Settings/AppSettings.cc \ src/Settings/AppSettings.cc \
src/Settings/AutoConnectSettings.cc \ src/Settings/AutoConnectSettings.cc \
src/Settings/FlightMapSettings.cc \
src/Settings/SettingsGroup.cc \ src/Settings/SettingsGroup.cc \
src/Settings/SettingsManager.cc \ src/Settings/SettingsManager.cc \
src/Settings/UnitsSettings.cc \ src/Settings/UnitsSettings.cc \
......
...@@ -188,6 +188,7 @@ ...@@ -188,6 +188,7 @@
<file alias="MavCmdInfoVTOL.json">src/MissionManager/MavCmdInfoVTOL.json</file> <file alias="MavCmdInfoVTOL.json">src/MissionManager/MavCmdInfoVTOL.json</file>
<file alias="App.SettingsGroup.json">src/Settings/App.SettingsGroup.json</file> <file alias="App.SettingsGroup.json">src/Settings/App.SettingsGroup.json</file>
<file alias="AutoConnect.SettingsGroup.json">src/Settings/AutoConnect.SettingsGroup.json</file> <file alias="AutoConnect.SettingsGroup.json">src/Settings/AutoConnect.SettingsGroup.json</file>
<file alias="FlightMap.SettingsGroup.json">src/Settings/FlightMap.SettingsGroup.json</file>
<file alias="Survey.SettingsGroup.json">src/MissionManager/Survey.SettingsGroup.json</file> <file alias="Survey.SettingsGroup.json">src/MissionManager/Survey.SettingsGroup.json</file>
<file alias="Units.SettingsGroup.json">src/Settings/Units.SettingsGroup.json</file> <file alias="Units.SettingsGroup.json">src/Settings/Units.SettingsGroup.json</file>
<file alias="Video.SettingsGroup.json">src/Settings/Video.SettingsGroup.json</file> <file alias="Video.SettingsGroup.json">src/Settings/Video.SettingsGroup.json</file>
......
...@@ -164,7 +164,7 @@ FlightMap { ...@@ -164,7 +164,7 @@ FlightMap {
color: qgcPal.window color: qgcPal.window
title: qsTr("Fly") title: qsTr("Fly")
z: QGroundControl.zOrderWidgets z: QGroundControl.zOrderWidgets
buttonVisible: [ true, true, _showZoom, _showZoom ] buttonVisible: [ true, _showZoom, _showZoom ]
maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y // Massive reach across hack maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y // Massive reach across hack
property bool _showZoom: !ScreenTools.isMobile property bool _showZoom: !ScreenTools.isMobile
...@@ -175,11 +175,6 @@ FlightMap { ...@@ -175,11 +175,6 @@ FlightMap {
iconSource: "/qmlimages/MapCenter.svg", iconSource: "/qmlimages/MapCenter.svg",
dropPanelComponent: centerMapDropPanel dropPanelComponent: centerMapDropPanel
}, },
{
name: "Map",
iconSource: "/qmlimages/MapType.svg",
dropPanelComponent: mapTypeDropPanel
},
{ {
name: "In", name: "In",
iconSource: "/qmlimages/ZoomPlus.svg" iconSource: "/qmlimages/ZoomPlus.svg"
...@@ -229,33 +224,6 @@ FlightMap { ...@@ -229,33 +224,6 @@ FlightMap {
} }
} }
Component {
id: mapTypeDropPanel
Column {
spacing: ScreenTools.defaultFontPixelHeight / 2
QGCLabel { text: qsTr("Map type:") }
Row {
spacing: ScreenTools.defaultFontPixelWidth
Repeater {
model: QGroundControl.flightMapSettings.mapTypes
QGCButton {
checkable: true
checked: QGroundControl.flightMapSettings.mapType === text
text: modelData
exclusiveGroup: _mapTypeButtonsExclusiveGroup
onClicked: {
QGroundControl.flightMapSettings.mapType = text
dropPanel.hide()
}
}
}
}
}
}
// Add trajectory points to the map // Add trajectory points to the map
MapItemView { MapItemView {
model: _mainIsMap ? _activeVehicle ? _activeVehicle.trajectoryPoints : 0 : 0 model: _mainIsMap ? _activeVehicle ? _activeVehicle.trajectoryPoints : 0 : 0
......
...@@ -85,7 +85,8 @@ Map { ...@@ -85,7 +85,8 @@ Map {
} }
function updateActiveMapType() { function updateActiveMapType() {
var fullMapName = QGroundControl.flightMapSettings.mapProvider + " " + QGroundControl.flightMapSettings.mapType var settings = QGroundControl.settingsManager.flightMapSettings
var fullMapName = settings.mapProvider.enumStringValue + " " + settings.mapType.enumStringValue
for (var i = 0; i < _map.supportedMapTypes.length; i++) { for (var i = 0; i < _map.supportedMapTypes.length; i++) {
if (fullMapName === _map.supportedMapTypes[i].name) { if (fullMapName === _map.supportedMapTypes[i].name) {
_map.activeMapType = _map.supportedMapTypes[i] _map.activeMapType = _map.supportedMapTypes[i]
...@@ -97,8 +98,13 @@ Map { ...@@ -97,8 +98,13 @@ Map {
Component.onCompleted: updateActiveMapType() Component.onCompleted: updateActiveMapType()
Connections { Connections {
target: QGroundControl.flightMapSettings target: QGroundControl.settingsManager.flightMapSettings.mapType
onMapTypeChanged: updateActiveMapType() onRawValueChanged: updateActiveMapType()
}
Connections {
target: QGroundControl.settingsManager.flightMapSettings.mapProvider
onRawValueChanged: updateActiveMapType()
} }
/// Ground Station location /// Ground Station location
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "FlightMapSettings.h"
#include <QSettings>
#include <QtQml>
const char* FlightMapSettings::_defaultMapProvider = "Bing"; // Bing is default since it support full street/satellite/hybrid set
const char* FlightMapSettings::_settingsGroup = "FlightMapSettings";
const char* FlightMapSettings::_mapProviderKey = "MapProvider";
const char* FlightMapSettings::_mapTypeKey = "MapType";
FlightMapSettings::FlightMapSettings(QGCApplication* app)
: QGCTool(app)
, _mapProvider(_defaultMapProvider)
{
}
void FlightMapSettings::setToolbox(QGCToolbox *toolbox)
{
QGCTool::setToolbox(toolbox);
qmlRegisterUncreatableType<FlightMapSettings> ("QGroundControl", 1, 0, "FlightMapSetting", "Reference only");
_supportedMapProviders << "Bing";
#ifndef QGC_NO_GOOGLE_MAPS
_supportedMapProviders << "Google";
#endif
_supportedMapProviders << "Statkart";
_loadSettings();
}
void FlightMapSettings::_storeSettings(void)
{
QSettings settings;
settings.beginGroup(_settingsGroup);
settings.setValue(_mapProviderKey, _supportedMapProviders.contains(_mapProvider) ? _mapProvider : _defaultMapProvider);
}
void FlightMapSettings::_loadSettings(void)
{
#ifdef QGC_NO_GOOGLE_MAPS
_mapProvider = _defaultMapProvider;
#else
QSettings settings;
settings.beginGroup(_settingsGroup);
_mapProvider = settings.value(_mapProviderKey, _defaultMapProvider).toString();
if (!_supportedMapProviders.contains(_mapProvider)) {
_mapProvider = _defaultMapProvider;
}
#endif
_setMapTypesForCurrentProvider();
}
QString FlightMapSettings::mapProvider(void)
{
return _mapProvider;
}
void FlightMapSettings::setMapProvider(const QString& mapProvider)
{
if (_supportedMapProviders.contains(mapProvider)) {
_mapProvider = mapProvider;
_storeSettings();
_setMapTypesForCurrentProvider();
emit mapProviderChanged(mapProvider);
}
}
void FlightMapSettings::_setMapTypesForCurrentProvider(void)
{
_mapTypes.clear();
#ifdef QGC_NO_GOOGLE_MAPS
_mapTypes << "Street Map" << "Satellite Map" << "Hybrid Map";
#else
if (_mapProvider == "Bing") {
_mapTypes << "Street Map" << "Satellite Map" << "Hybrid Map";
} else if (_mapProvider == "Google") {
_mapTypes << "Street Map" << "Satellite Map" << "Terrain Map";
} else if (_mapProvider == "Statkart") {
_mapTypes << "Topo2";
}
#endif
emit mapTypesChanged(_mapTypes);
}
QString FlightMapSettings::mapType(void)
{
QSettings settings;
settings.beginGroup(_settingsGroup);
settings.beginGroup(_mapProvider);
return settings.value(_mapTypeKey, "Satellite Map").toString();
}
void FlightMapSettings::setMapType(const QString& mapType)
{
QSettings settings;
settings.beginGroup(_settingsGroup);
settings.beginGroup(_mapProvider);
settings.setValue(_mapTypeKey, mapType);
emit mapTypeChanged(mapType);
}
void FlightMapSettings::saveMapSetting (const QString &mapName, const QString& key, const QString& value)
{
QSettings settings;
settings.beginGroup(_settingsGroup);
settings.beginGroup(mapName);
settings.setValue(key, value);
}
QString FlightMapSettings::loadMapSetting (const QString &mapName, const QString& key, const QString& defaultValue)
{
QSettings settings;
settings.beginGroup(_settingsGroup);
settings.beginGroup(mapName);
return settings.value(key, defaultValue).toString();
}
void FlightMapSettings::saveBoolMapSetting (const QString &mapName, const QString& key, bool value)
{
QSettings settings;
settings.beginGroup(_settingsGroup);
settings.beginGroup(mapName);
settings.setValue(key, value);
}
bool FlightMapSettings::loadBoolMapSetting (const QString &mapName, const QString& key, bool defaultValue)
{
QSettings settings;
settings.beginGroup(_settingsGroup);
settings.beginGroup(mapName);
return settings.value(key, defaultValue).toBool();
}
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#ifndef FlightMapSettings_H
#define FlightMapSettings_H
#include "QGCToolbox.h"
#include <QObject>
#include <QStringList>
/*
TODO: Map settings should come from QGCMapEngineManager. What is currently in
FlightMapSettings should be moved there so all map related funtions are in
one place.
*/
class FlightMapSettings : public QGCTool
{
Q_OBJECT
public:
FlightMapSettings(QGCApplication* app);
/// mapProvider is either Bing, Google or Open to specify to set of maps available
Q_PROPERTY(QString mapProvider READ mapProvider WRITE setMapProvider NOTIFY mapProviderChanged)
/// Map providers
Q_PROPERTY(QStringList mapProviders READ mapProviders CONSTANT)
/// Map types associated with current map provider
Q_PROPERTY(QStringList mapTypes MEMBER _mapTypes NOTIFY mapTypesChanged)
/// Map type to be used for all maps
Q_PROPERTY(QString mapType READ mapType WRITE setMapType NOTIFY mapTypeChanged)
/// Is Google Maps Enabled
Q_PROPERTY(bool googleMapEnabled READ googleMapEnabled CONSTANT)
Q_INVOKABLE void saveMapSetting (const QString &mapName, const QString& key, const QString& value);
Q_INVOKABLE QString loadMapSetting (const QString &mapName, const QString& key, const QString& defaultValue);
Q_INVOKABLE void saveBoolMapSetting (const QString &mapName, const QString& key, bool value);
Q_INVOKABLE bool loadBoolMapSetting (const QString &mapName, const QString& key, bool defaultValue);
// Property accessors
QString mapProvider(void);
void setMapProvider(const QString& mapProvider);
QString mapType(void);
void setMapType(const QString& mapType);
// Override from QGCTool
virtual void setToolbox(QGCToolbox *toolbox);
QStringList mapProviders() { return _supportedMapProviders; }
#ifdef QGC_NO_GOOGLE_MAPS
bool googleMapEnabled () { return false; }
#else
bool googleMapEnabled () { return true; }
#endif
signals:
void mapProviderChanged (const QString& mapProvider);
void mapTypesChanged (const QStringList& mapTypes);
void mapTypeChanged (const QString& mapType);
private:
void _storeSettings (void);
void _loadSettings (void);
void _setMapTypesForCurrentProvider(void);
QString _mapProvider; ///< Current map provider
QStringList _supportedMapProviders;
QStringList _mapTypes; ///< Map types associated with current map provider
static const char* _defaultMapProvider;
static const char* _settingsGroup;
static const char* _mapProviderKey;
static const char* _mapTypeKey;
};
#endif
...@@ -679,11 +679,11 @@ QGCView { ...@@ -679,11 +679,11 @@ QGCView {
color: qgcPal.window color: qgcPal.window
title: qsTr("Plan") title: qsTr("Plan")
z: QGroundControl.zOrderWidgets z: QGroundControl.zOrderWidgets
showAlternateIcon: [ false, false, _syncDropDownController.dirty, false, false, false, false ] showAlternateIcon: [ false, false, _syncDropDownController.dirty, false, false, false ]
rotateImage: [ false, false, _syncDropDownController.syncInProgress, false, false, false, false ] rotateImage: [ false, false, _syncDropDownController.syncInProgress, false, false, false ]
animateImage: [ false, false, _syncDropDownController.dirty, false, false, false, false ] animateImage: [ false, false, _syncDropDownController.dirty, false, false, false ]
buttonEnabled: [ true, true, !_syncDropDownController.syncInProgress, true, true, true, true ] buttonEnabled: [ true, true, !_syncDropDownController.syncInProgress, true, true, true ]
buttonVisible: [ true, true, true, true, true, _showZoom, _showZoom ] buttonVisible: [ true, true, true, true, _showZoom, _showZoom ]
maxHeight: mapScale.y - toolStrip.y maxHeight: mapScale.y - toolStrip.y
property bool _showZoom: !ScreenTools.isMobile property bool _showZoom: !ScreenTools.isMobile
...@@ -710,11 +710,6 @@ QGCView { ...@@ -710,11 +710,6 @@ QGCView {
iconSource: "/qmlimages/MapCenter.svg", iconSource: "/qmlimages/MapCenter.svg",
dropPanelComponent: centerMapDropPanel dropPanelComponent: centerMapDropPanel
}, },
{
name: "Map",
iconSource: "/qmlimages/MapType.svg",
dropPanelComponent: mapTypeDropPanel
},
{ {
name: "In", name: "In",
iconSource: "/qmlimages/ZoomPlus.svg" iconSource: "/qmlimages/ZoomPlus.svg"
...@@ -904,34 +899,6 @@ QGCView { ...@@ -904,34 +899,6 @@ QGCView {
} }
} }
Component {
id: mapTypeDropPanel
Column {
spacing: _margin
QGCLabel { text: qsTr("Map type:") }
Row {
spacing: ScreenTools.defaultFontPixelWidth
Repeater {
model: QGroundControl.flightMapSettings.mapTypes
QGCButton {
checkable: true
checked: QGroundControl.flightMapSettings.mapType === text
text: modelData
exclusiveGroup: _mapTypeButtonsExclusiveGroup
onClicked: {
QGroundControl.flightMapSettings.mapType = text
dropPanel.hide()
}
}
}
}
}
}
Component { Component {
id: patternDropPanel id: patternDropPanel
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "FactSystem.h" #include "FactSystem.h"
#include "FirmwarePluginManager.h" #include "FirmwarePluginManager.h"
#include "FlightMapSettings.h"
#include "GAudioOutput.h" #include "GAudioOutput.h"
#ifndef __mobile__ #ifndef __mobile__
#include "GPSManager.h" #include "GPSManager.h"
...@@ -39,7 +38,6 @@ QGCToolbox::QGCToolbox(QGCApplication* app) ...@@ -39,7 +38,6 @@ QGCToolbox::QGCToolbox(QGCApplication* app)
: _audioOutput(NULL) : _audioOutput(NULL)
, _factSystem(NULL) , _factSystem(NULL)
, _firmwarePluginManager(NULL) , _firmwarePluginManager(NULL)
, _flightMapSettings(NULL)
#ifndef __mobile__ #ifndef __mobile__
, _gpsManager(NULL) , _gpsManager(NULL)
#endif #endif
...@@ -66,7 +64,6 @@ QGCToolbox::QGCToolbox(QGCApplication* app) ...@@ -66,7 +64,6 @@ QGCToolbox::QGCToolbox(QGCApplication* app)
_audioOutput = new GAudioOutput(app); _audioOutput = new GAudioOutput(app);
_factSystem = new FactSystem(app); _factSystem = new FactSystem(app);
_firmwarePluginManager = new FirmwarePluginManager(app); _firmwarePluginManager = new FirmwarePluginManager(app);
_flightMapSettings = new FlightMapSettings(app);
#ifndef __mobile__ #ifndef __mobile__
_gpsManager = new GPSManager(app); _gpsManager = new GPSManager(app);
#endif #endif
...@@ -93,7 +90,6 @@ void QGCToolbox::setChildToolboxes(void) ...@@ -93,7 +90,6 @@ void QGCToolbox::setChildToolboxes(void)
_audioOutput->setToolbox(this); _audioOutput->setToolbox(this);
_factSystem->setToolbox(this); _factSystem->setToolbox(this);
_firmwarePluginManager->setToolbox(this); _firmwarePluginManager->setToolbox(this);
_flightMapSettings->setToolbox(this);
#ifndef __mobile__ #ifndef __mobile__
_gpsManager->setToolbox(this); _gpsManager->setToolbox(this);
#endif #endif
...@@ -118,7 +114,6 @@ QGCToolbox::~QGCToolbox() ...@@ -118,7 +114,6 @@ QGCToolbox::~QGCToolbox()
delete _audioOutput; delete _audioOutput;
delete _factSystem; delete _factSystem;
delete _firmwarePluginManager; delete _firmwarePluginManager;
delete _flightMapSettings;
delete _joystickManager; delete _joystickManager;
delete _linkManager; delete _linkManager;
delete _mavlinkProtocol; delete _mavlinkProtocol;
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
class FactSystem; class FactSystem;
class FirmwarePluginManager; class FirmwarePluginManager;
class FlightMapSettings;
class GAudioOutput; class GAudioOutput;
class GPSManager; class GPSManager;
class JoystickManager; class JoystickManager;
...@@ -42,7 +41,6 @@ public: ...@@ -42,7 +41,6 @@ public:
~QGCToolbox(); ~QGCToolbox();
FirmwarePluginManager* firmwarePluginManager(void) { return _firmwarePluginManager; } FirmwarePluginManager* firmwarePluginManager(void) { return _firmwarePluginManager; }
FlightMapSettings* flightMapSettings(void) { return _flightMapSettings; }
GAudioOutput* audioOutput(void) { return _audioOutput; } GAudioOutput* audioOutput(void) { return _audioOutput; }
JoystickManager* joystickManager(void) { return _joystickManager; } JoystickManager* joystickManager(void) { return _joystickManager; }
LinkManager* linkManager(void) { return _linkManager; } LinkManager* linkManager(void) { return _linkManager; }
...@@ -71,7 +69,6 @@ private: ...@@ -71,7 +69,6 @@ private:
GAudioOutput* _audioOutput; GAudioOutput* _audioOutput;
FactSystem* _factSystem; FactSystem* _factSystem;
FirmwarePluginManager* _firmwarePluginManager; FirmwarePluginManager* _firmwarePluginManager;
FlightMapSettings* _flightMapSettings;
#ifndef __mobile__ #ifndef __mobile__
GPSManager* _gpsManager; GPSManager* _gpsManager;
#endif #endif
......
...@@ -21,7 +21,6 @@ static const char* kQmlGlobalKeyName = "QGCQml"; ...@@ -21,7 +21,6 @@ static const char* kQmlGlobalKeyName = "QGCQml";
QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app) QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app)
: QGCTool(app) : QGCTool(app)
, _flightMapSettings(NULL)
, _linkManager(NULL) , _linkManager(NULL)
, _multiVehicleManager(NULL) , _multiVehicleManager(NULL)
, _mapEngineManager(NULL) , _mapEngineManager(NULL)
...@@ -47,7 +46,6 @@ void QGroundControlQmlGlobal::setToolbox(QGCToolbox* toolbox) ...@@ -47,7 +46,6 @@ void QGroundControlQmlGlobal::setToolbox(QGCToolbox* toolbox)
{ {
QGCTool::setToolbox(toolbox); QGCTool::setToolbox(toolbox);
_flightMapSettings = toolbox->flightMapSettings();
_linkManager = toolbox->linkManager(); _linkManager = toolbox->linkManager();
_multiVehicleManager = toolbox->multiVehicleManager(); _multiVehicleManager = toolbox->multiVehicleManager();
_mapEngineManager = toolbox->mapEngineManager(); _mapEngineManager = toolbox->mapEngineManager();
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "QGCToolbox.h" #include "QGCToolbox.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "LinkManager.h" #include "LinkManager.h"
#include "FlightMapSettings.h"
#include "SettingsFact.h" #include "SettingsFact.h"
#include "FactMetaData.h" #include "FactMetaData.h"
#include "SimulatedPosition.h" #include "SimulatedPosition.h"
...@@ -39,7 +38,6 @@ public: ...@@ -39,7 +38,6 @@ public:
Q_PROPERTY(QString appName READ appName CONSTANT) Q_PROPERTY(QString appName READ appName CONSTANT)
Q_PROPERTY(FlightMapSettings* flightMapSettings READ flightMapSettings CONSTANT)
Q_PROPERTY(LinkManager* linkManager READ linkManager CONSTANT) Q_PROPERTY(LinkManager* linkManager READ linkManager CONSTANT)
Q_PROPERTY(MultiVehicleManager* multiVehicleManager READ multiVehicleManager CONSTANT) Q_PROPERTY(MultiVehicleManager* multiVehicleManager READ multiVehicleManager CONSTANT)
Q_PROPERTY(QGCMapEngineManager* mapEngineManager READ mapEngineManager CONSTANT) Q_PROPERTY(QGCMapEngineManager* mapEngineManager READ mapEngineManager CONSTANT)
...@@ -126,7 +124,6 @@ public: ...@@ -126,7 +124,6 @@ public:
// Property accesors // Property accesors
QString appName () { return qgcApp()->applicationName(); } QString appName () { return qgcApp()->applicationName(); }
FlightMapSettings* flightMapSettings () { return _flightMapSettings; }
LinkManager* linkManager () { return _linkManager; } LinkManager* linkManager () { return _linkManager; }
MultiVehicleManager* multiVehicleManager () { return _multiVehicleManager; } MultiVehicleManager* multiVehicleManager () { return _multiVehicleManager; }
QGCMapEngineManager* mapEngineManager () { return _mapEngineManager; } QGCMapEngineManager* mapEngineManager () { return _mapEngineManager; }
...@@ -172,7 +169,6 @@ signals: ...@@ -172,7 +169,6 @@ signals:
void skipSetupPageChanged (); void skipSetupPageChanged ();
private: private:
FlightMapSettings* _flightMapSettings;
LinkManager* _linkManager; LinkManager* _linkManager;
MultiVehicleManager* _multiVehicleManager; MultiVehicleManager* _multiVehicleManager;
QGCMapEngineManager* _mapEngineManager; QGCMapEngineManager* _mapEngineManager;
......
...@@ -31,7 +31,7 @@ QGCView { ...@@ -31,7 +31,7 @@ QGCView {
property string mapKey: "lastMapType" property string mapKey: "lastMapType"
property string mapType: QGroundControl.flightMapSettings.mapProvider + " " + QGroundControl.flightMapSettings.mapType 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
property real savedZoom: 3 property real savedZoom: 3
...@@ -47,6 +47,7 @@ QGCView { ...@@ -47,6 +47,7 @@ QGCView {
property var _mapAdjustedColor: _map.isSatelliteMap ? "white" : "black" property var _mapAdjustedColor: _map.isSatelliteMap ? "white" : "black"
property bool _tooManyTiles: QGroundControl.mapEngineManager.tileCount > _maxTilesForDownload property bool _tooManyTiles: QGroundControl.mapEngineManager.tileCount > _maxTilesForDownload
property var _settings: QGroundControl.settingsManager.flightMapSettings
readonly property real minZoomLevel: 3 readonly property real minZoomLevel: 3
readonly property real maxZoomLevel: 20 readonly property real maxZoomLevel: 20
...@@ -97,7 +98,7 @@ QGCView { ...@@ -97,7 +98,7 @@ QGCView {
function addNewSet() { function addNewSet() {
isMapInteractive = true isMapInteractive = true
mapType = QGroundControl.flightMapSettings.mapProvider + " " + QGroundControl.flightMapSettings.mapType mapType = _settings.mapProvider.enumStringValue + " " + _settings.mapType.enumStringValue
resetMapToDefaults() resetMapToDefaults()
handleChanges() handleChanges()
_map.visible = true _map.visible = true
......
[
{
"name": "MapProvider",
"shortDescription": "Currently selected map provider for flight maps",
"type": "uint32",
"enumStrings": "Bing,Google,Statkart",
"enumValues": "0,1,2",
"defaultValue": 0
},
{
"name": "MapType",
"shortDescription": "Currently selected map type for flight maps",
"type": "uint32",
"enumStrings": "Street Map,Satellite Map,Hybrid Map,Terrain Map",
"enumValues": "0,1,2,3",
"defaultValue": 2
}
]
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/