From ac99b3fe6ce6f0822380e3ebf1b6c9bab918693e Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Tue, 29 Aug 2017 16:54:34 -0400 Subject: [PATCH] Enable/Disable Offline maps import/export. --- src/QtLocationPlugin/QMLControl/OfflineMap.qml | 4 ++-- src/api/QGCOptions.h | 12 ++++++++++++ src/ui/preferences/GeneralSettings.qml | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/QtLocationPlugin/QMLControl/OfflineMap.qml b/src/QtLocationPlugin/QMLControl/OfflineMap.qml index a5fd64cae..e2d336c84 100644 --- a/src/QtLocationPlugin/QMLControl/OfflineMap.qml +++ b/src/QtLocationPlugin/QMLControl/OfflineMap.qml @@ -955,7 +955,7 @@ QGCView { QGCButton { text: qsTr("Import") width: _buttonSize - visible: !ScreenTools.isMobile + visible: QGroundControl.corePlugin.options.showOfflineMapImport onClicked: { QGroundControl.mapEngineManager.importAction = QGCMapEngineManager.ActionNone rootLoader.sourceComponent = importDialog @@ -964,7 +964,7 @@ QGCView { QGCButton { text: qsTr("Export") width: _buttonSize - visible: !ScreenTools.isMobile + visible: QGroundControl.corePlugin.options.showOfflineMapExport enabled: QGroundControl.mapEngineManager.tileSets.count > 1 onClicked: showExport() } diff --git a/src/api/QGCOptions.h b/src/api/QGCOptions.h index b79fd9f34..2929cfbdf 100644 --- a/src/api/QGCOptions.h +++ b/src/api/QGCOptions.h @@ -42,6 +42,8 @@ public: Q_PROPERTY(bool guidedBarShowOrbit READ guidedBarShowOrbit NOTIFY guidedBarShowOrbitChanged) Q_PROPERTY(bool missionWaypointsOnly READ missionWaypointsOnly NOTIFY missionWaypointsOnlyChanged) Q_PROPERTY(bool multiVehicleEnabled READ multiVehicleEnabled NOTIFY multiVehicleEnabledChanged) + Q_PROPERTY(bool showOfflineMapExport READ showOfflineMapExport NOTIFY showOfflineMapExportChanged) + Q_PROPERTY(bool showOfflineMapImport READ showOfflineMapImport NOTIFY showOfflineMapImportChanged) /// Should QGC hide its settings menu and colapse it into one single menu (Settings and Vehicle Setup)? /// @return true if QGC should consolidate both menus into one. @@ -75,6 +77,14 @@ public: virtual bool missionWaypointsOnly () const { return false; } ///< true: Only allow waypoints and complex items in Plan virtual bool multiVehicleEnabled () const { return true; } ///< false: multi vehicle support is disabled +#if defined(__mobile__) + virtual bool showOfflineMapExport () const { return false; } + virtual bool showOfflineMapImport () const { return false; } +#else + virtual bool showOfflineMapExport () const { return true; } + virtual bool showOfflineMapImport () const { return true; } +#endif + /// If returned QString in non-empty it means that firmware upgrade will run in a mode which only /// supports downloading a single firmware file from the URL. It also supports custom install through /// the Advanced options. @@ -91,6 +101,8 @@ signals: void guidedBarShowOrbitChanged (bool show); void missionWaypointsOnlyChanged (bool missionWaypointsOnly); void multiVehicleEnabledChanged (bool multiVehicleEnabled); + void showOfflineMapExportChanged (); + void showOfflineMapImportChanged (); private: CustomInstrumentWidget* _defaultInstrumentWidget; diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index 68abd6072..156b2d451 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -294,7 +294,8 @@ QGCView { //----------------------------------------------------------------- //-- Battery talker Row { - spacing: ScreenTools.defaultFontPixelWidth + spacing: ScreenTools.defaultFontPixelWidth + visible: QGroundControl.settingsManager.appSettings.batteryPercentRemainingAnnounce.visible QGCCheckBox { id: announcePercentCheckbox text: qsTr("Announce battery lower than:") -- 2.22.0