diff --git a/QGCExternalLibs.pri b/QGCExternalLibs.pri index 651e40d028bb630a46fdda76c3189be009833bdd..6e13bbbda038d320f9f623c6ec1b0c735d2949da 100644 --- a/QGCExternalLibs.pri +++ b/QGCExternalLibs.pri @@ -137,13 +137,16 @@ contains (DEFINES, DISABLE_AIRMAP) { DEFINES -= QGC_AIRMAP_ENABLED } else { AIRMAPD_PATH = $$PWD/libs/airmapd - INCLUDEPATH += \ - $${AIRMAPD_PATH}/include MacBuild|iOSBuild { - message("Including support for AirMap") + message("Including support for AirMap for macOS") LIBS += -L$${AIRMAPD_PATH}/macOS/Qt.5.9 -lairmap-qt DEFINES += QGC_AIRMAP_ENABLED } else { message("Skipping support for Airmap (unsupported platform)") + DEFINES -= QGC_AIRMAP_ENABLED + } + contains (DEFINES, QGC_AIRMAP_ENABLED) { + INCLUDEPATH += \ + $${AIRMAPD_PATH}/include } } diff --git a/src/Airmap/AirMap.SettingsGroup.json b/src/Airmap/AirMap.SettingsGroup.json index 5806903ae0445c06c8f65496769a1b56b23db052..4263833d340ec25a9ea7791a77cc13ca160c6e01 100644 --- a/src/Airmap/AirMap.SettingsGroup.json +++ b/src/Airmap/AirMap.SettingsGroup.json @@ -22,5 +22,29 @@ "shortDescription": "AirMap Password", "type": "string", "defaultValue": "" +}, +{ + "name": "enableAirMap", + "shortDescription": "Enable AirMap", + "type": "bool", + "defaultValue": false +}, +{ + "name": "enableTelemetry", + "shortDescription": "Enable AirMap Telemetry", + "type": "bool", + "defaultValue": false +}, +{ + "name": "loginEmail", + "shortDescription": "AirMap Login Email", + "type": "string", + "defaultValue": "" +}, +{ + "name": "loginPassword", + "shortDescription": "AirMap Login Password", + "type": "string", + "defaultValue": "" } ] diff --git a/src/Airmap/AirMapSettings.cc b/src/Airmap/AirMapSettings.cc index a2cc7ce0ea48f0a7f500b1b13311d8c414dd093a..c3de29a42b623a004533e8a656ea174bd81ad04b 100644 --- a/src/Airmap/AirMapSettings.cc +++ b/src/Airmap/AirMapSettings.cc @@ -20,6 +20,10 @@ DECLARE_SETTINGGROUP(AirMap) INIT_SETTINGFACT(clientID); INIT_SETTINGFACT(userName); INIT_SETTINGFACT(password); + INIT_SETTINGFACT(enableAirMap); + INIT_SETTINGFACT(enableTelemetry); + INIT_SETTINGFACT(loginEmail); + INIT_SETTINGFACT(loginPassword); QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); qmlRegisterUncreatableType("QGroundControl.SettingsManager", 1, 0, "AirMapSettings", "Reference only"); } @@ -28,3 +32,7 @@ DECLARE_SETTINGSFACT(AirMapSettings, apiKey) DECLARE_SETTINGSFACT(AirMapSettings, clientID) DECLARE_SETTINGSFACT(AirMapSettings, userName) DECLARE_SETTINGSFACT(AirMapSettings, password) +DECLARE_SETTINGSFACT(AirMapSettings, enableAirMap) +DECLARE_SETTINGSFACT(AirMapSettings, enableTelemetry) +DECLARE_SETTINGSFACT(AirMapSettings, loginEmail) +DECLARE_SETTINGSFACT(AirMapSettings, loginPassword) diff --git a/src/Airmap/AirMapSettings.h b/src/Airmap/AirMapSettings.h index 04542d52d76a85a54b93decc510ad775ecb9595a..4d6ba52fe6b796253c5d4b297126ad75fdda899a 100644 --- a/src/Airmap/AirMapSettings.h +++ b/src/Airmap/AirMapSettings.h @@ -24,5 +24,9 @@ public: DEFINE_SETTINGFACT(clientID) DEFINE_SETTINGFACT(userName) DEFINE_SETTINGFACT(password) + DEFINE_SETTINGFACT(enableAirMap) + DEFINE_SETTINGFACT(enableTelemetry) + DEFINE_SETTINGFACT(loginEmail) + DEFINE_SETTINGFACT(loginPassword) }; diff --git a/src/Airmap/AirmapSettings.qml b/src/Airmap/AirmapSettings.qml index 89f23400c3a4187dd8cce4b0c9d483fbe8eb69bb..29e1e839a52b70c7d5493991a8ef731d123f0d05 100644 --- a/src/Airmap/AirmapSettings.qml +++ b/src/Airmap/AirmapSettings.qml @@ -35,7 +35,7 @@ QGCView { property real _labelWidth: ScreenTools.defaultFontPixelWidth * 20 property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 30 property real _panelWidth: _qgcView.width * _internalWidthRatio - property Fact _enableAirMapFact: QGroundControl.settingsManager.appSettings.enableAirMap + property Fact _enableAirMapFact: QGroundControl.settingsManager.airMapSettings.enableAirMap property bool _airMapEnabled: _enableAirMapFact.rawValue readonly property real _internalWidthRatio: 0.8 @@ -84,14 +84,12 @@ QGCView { fact: _enableAirMapFact visible: _enableAirMapFact.visible } - QGCCheckBox { - text: qsTr("Disable Telemetry") - checked: false + FactCheckBox { + text: qsTr("Enable Telemetry") + fact: _enableTelemetryFact + visible: _enableTelemetryFact.visible enabled: _airMapEnabled - onClicked: - { - - } + property Fact _enableTelemetryFact: QGroundControl.settingsManager.airMapSettings.enableTelemetry } } } @@ -102,7 +100,6 @@ QGCView { height: loginLabel.height anchors.margins: ScreenTools.defaultFontPixelWidth anchors.horizontalCenter: parent.horizontalCenter - visible: QGroundControl.settingsManager.appSettings.visible QGCLabel { id: loginLabel text: qsTr("Login / Registration") @@ -121,14 +118,18 @@ QGCView { rowSpacing: ScreenTools.defaultFontPixelHeight * 0.25 anchors.centerIn: parent QGCLabel { text: qsTr("Email:") } - QGCTextField { - width: _editFieldWidth - enabled: _airMapEnabled + FactTextField { + fact: _loginEmailFact + enabled: _airMapEnabled + visible: _loginEmailFact.visible + property Fact _loginEmailFact: QGroundControl.settingsManager.airMapSettings.loginEmail } QGCLabel { text: qsTr("Password:") } - QGCTextField { - width: _editFieldWidth - enabled: _airMapEnabled + FactTextField { + fact: _loginPasswordFact + enabled: _airMapEnabled + visible: _loginPasswordFact.visible + property Fact _loginPasswordFact: QGroundControl.settingsManager.airMapSettings.loginPassword } Item { width: 1 @@ -150,6 +151,9 @@ QGCView { Layout.alignment: Qt.AlignHCenter Layout.columnSpan: 2 enabled: _airMapEnabled + onClicked: { + Qt.openUrlExternally("https://www.airmap.com"); + } } } } @@ -189,6 +193,42 @@ QGCView { QGCLabel { text: qsTr("+1 212 555 1212") } } } + //----------------------------------------------------------------- + //-- License (Will this stay here?) + Item { + width: _panelWidth + height: licenseLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: QGroundControl.settingsManager.appSettings.visible + QGCLabel { + id: licenseLabel + text: qsTr("License") + font.family: ScreenTools.demiboldFontFamily + } + } + Rectangle { + height: licenseGrid.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + GridLayout { + id: licenseGrid + columns: 2 + columnSpacing: ScreenTools.defaultFontPixelHeight * 2 + rowSpacing: ScreenTools.defaultFontPixelWidth * 0.25 + anchors.centerIn: parent + QGCLabel { text: qsTr("API Key:") } + FactTextField { fact: QGroundControl.settingsManager.airMapSettings.apiKey; } + QGCLabel { text: qsTr("Client ID:") } + FactTextField { fact: QGroundControl.settingsManager.airMapSettings.clientID; } + QGCLabel { text: qsTr("User Name:") } + FactTextField { fact: QGroundControl.settingsManager.airMapSettings.userName; } + QGCLabel { text: qsTr("Password:") } + FactTextField { fact: QGroundControl.settingsManager.airMapSettings.password; echoMode: TextInput.Password } + } + } } } } diff --git a/src/Airmap/QGroundControl.Airmap.qmldir b/src/Airmap/QGroundControl.Airmap.qmldir index a6cf465b22edf0485104cf438d26b43d07355287..116917dfddfea92440f489592f6f50be96565a64 100644 --- a/src/Airmap/QGroundControl.Airmap.qmldir +++ b/src/Airmap/QGroundControl.Airmap.qmldir @@ -1,6 +1,4 @@ -Module - -QGroundControl.Airmap +Module QGroundControl.Airmap AirspaceControl 1.0 AirspaceControl.qml AirspaceRegulation 1.0 AirspaceRegulation.qml diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index e51bed6927806339ef222dab525ecbcfbd0151dc..09cba31c57ee791e52023a41ce9008d7a574d22b 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -34,7 +34,7 @@ Item { property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property bool _isSatellite: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true property bool _lightWidgetBorders: _isSatellite - property bool _enableAirMap: QGroundControl.settingsManager.appSettings.enableAirMap.rawValue + property bool _enableAirMap: QGroundControl.airmapSupported ? QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue : false readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5 diff --git a/src/PlanView/PlanView.qml b/src/PlanView/PlanView.qml index 49da675e43fc5470654e8a052f9ace019bcabad3..816db62de8726fd2d22022344945394ab8bb6221 100644 --- a/src/PlanView/PlanView.qml +++ b/src/PlanView/PlanView.qml @@ -46,7 +46,7 @@ QGCView { readonly property var _defaultVehicleCoordinate: QtPositioning.coordinate(37.803784, -122.462276) readonly property bool _waypointsOnlyMode: QGroundControl.corePlugin.options.missionWaypointsOnly - property bool _enableAirMap: QGroundControl.settingsManager.appSettings.enableAirMap.rawValue + property bool _enableAirMap: QGroundControl.airmapSupported ? QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue : false property var _planMasterController: masterController property var _missionController: _planMasterController.missionController property var _geoFenceController: _planMasterController.geoFenceController diff --git a/src/Settings/App.SettingsGroup.json b/src/Settings/App.SettingsGroup.json index ca59f385e89c5b4eaab98abbb8e31200a84c350f..81520a00d83d844c8af5b5436cfe0616471935de 100644 --- a/src/Settings/App.SettingsGroup.json +++ b/src/Settings/App.SettingsGroup.json @@ -183,12 +183,5 @@ "shortDescription": "Default firmware type for flashing", "type": "uint32", "defaultValue": 12 -}, -{ - "name": "EnableAirMap", - "shortDescription": "Enable AirMap", - "longDescription": "Enable AirMap Services", - "type": "bool", - "defaultValue": false } ] diff --git a/src/Settings/AppSettings.cc b/src/Settings/AppSettings.cc index a4a6f88142a1db880e8e567ada67d0bbfd3e9365..3e8b950e88401411b79425f9ede36e74db97f3eb 100644 --- a/src/Settings/AppSettings.cc +++ b/src/Settings/AppSettings.cc @@ -37,7 +37,6 @@ const char* AppSettings::mapboxTokenName = "MapboxT const char* AppSettings::esriTokenName = "EsriToken"; const char* AppSettings::defaultFirmwareTypeName = "DefaultFirmwareType"; const char* AppSettings::gstDebugName = "GstreamerDebugLevel"; -const char* AppSettings::enableAirMapName = "EnableAirMap"; const char* AppSettings::parameterFileExtension = "params"; const char* AppSettings::planFileExtension = "plan"; @@ -78,7 +77,6 @@ AppSettings::AppSettings(QObject* parent) , _esriTokenFact(NULL) , _defaultFirmwareTypeFact(NULL) , _gstDebugFact(NULL) - , _enableAirMapFact(NULL) { QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); qmlRegisterUncreatableType("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only"); @@ -402,12 +400,3 @@ Fact* AppSettings::defaultFirmwareType(void) return _defaultFirmwareTypeFact; } - -Fact* AppSettings::enableAirMap(void) -{ - if (!_enableAirMapFact) { - _enableAirMapFact = _createSettingsFact(enableAirMapName); - } - - return _enableAirMapFact; -} diff --git a/src/Settings/AppSettings.h b/src/Settings/AppSettings.h index 12334aee6b096229a3b415a099e82f9b2e10eea9..0c7b441eab91d5f2faf2c982c2db8dc4979d724f 100644 --- a/src/Settings/AppSettings.h +++ b/src/Settings/AppSettings.h @@ -41,7 +41,6 @@ public: Q_PROPERTY(Fact* esriToken READ esriToken CONSTANT) Q_PROPERTY(Fact* defaultFirmwareType READ defaultFirmwareType CONSTANT) Q_PROPERTY(Fact* gstDebug READ gstDebug CONSTANT) - Q_PROPERTY(Fact* enableAirMap READ enableAirMap CONSTANT) Q_PROPERTY(QString missionSavePath READ missionSavePath NOTIFY savePathsChanged) Q_PROPERTY(QString parameterSavePath READ parameterSavePath NOTIFY savePathsChanged) @@ -78,7 +77,6 @@ public: Fact* esriToken (void); Fact* defaultFirmwareType (void); Fact* gstDebug (void); - Fact* enableAirMap (void); QString missionSavePath (void); QString parameterSavePath (void); @@ -112,7 +110,6 @@ public: static const char* esriTokenName; static const char* defaultFirmwareTypeName; static const char* gstDebugName; - static const char* enableAirMapName; // Application wide file extensions static const char* parameterFileExtension; @@ -161,7 +158,6 @@ private: SettingsFact* _esriTokenFact; SettingsFact* _defaultFirmwareTypeFact; SettingsFact* _gstDebugFact; - SettingsFact* _enableAirMapFact; }; #endif diff --git a/src/api/QGCCorePlugin.cc b/src/api/QGCCorePlugin.cc index a2e2519687249738ac2c95b340d3c7ec48d49863..b07da6377d276fe0db30246b0aaac42b7f78c4cb 100644 --- a/src/api/QGCCorePlugin.cc +++ b/src/api/QGCCorePlugin.cc @@ -30,7 +30,9 @@ public: : pGeneral (NULL) , pCommLinks (NULL) , pOfflineMaps (NULL) + #if defined(QGC_AIRMAP_ENABLED) , pAirmap (NULL) + #endif , pMAVLink (NULL) , pConsole (NULL) #if defined(QT_DEBUG) @@ -54,8 +56,10 @@ public: delete pCommLinks; if(pOfflineMaps) delete pOfflineMaps; +#if defined(QGC_AIRMAP_ENABLED) if(pAirmap) delete pAirmap; +#endif if(pMAVLink) delete pMAVLink; if(pConsole) @@ -73,7 +77,9 @@ public: QmlComponentInfo* pGeneral; QmlComponentInfo* pCommLinks; QmlComponentInfo* pOfflineMaps; +#if defined(QGC_AIRMAP_ENABLED) QmlComponentInfo* pAirmap; +#endif QmlComponentInfo* pMAVLink; QmlComponentInfo* pConsole; #if defined(QT_DEBUG) @@ -131,10 +137,12 @@ QVariantList &QGCCorePlugin::settingsPages() QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"), QUrl::fromUserInput("qrc:/res/waves.svg")); _p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pOfflineMaps)); +#if defined(QGC_AIRMAP_ENABLED) _p->pAirmap = new QmlComponentInfo(tr("AirMap"), QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"), QUrl::fromUserInput("")); _p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pAirmap)); +#endif _p->pMAVLink = new QmlComponentInfo(tr("MAVLink"), QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"), QUrl::fromUserInput("qrc:/res/waves.svg")); diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index 4a36ad9608269ea3ea66ec1c9d79de86ce80e186..e74cfe334f5cfb5fe4d05d06a2c5604a449a5b41 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -555,52 +555,6 @@ QGCView { } } - //----------------------------------------------------------------- - //-- AirMap - Item { - width: _qgcView.width * 0.8 - height: unitLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: QGroundControl.settingsManager.rtkSettings.visible - QGCLabel { - text: qsTr("AirMap") - font.family: ScreenTools.demiboldFontFamily - } - } - Rectangle { - height: airMapCol.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _qgcView.width * 0.8 - color: qgcPal.windowShade - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: QGroundControl.settingsManager.airMapSettings.visible - Column { - id: airMapCol - spacing: ScreenTools.defaultFontPixelWidth - anchors.centerIn: parent - Row { - spacing: ScreenTools.defaultFontPixelWidth - QGCLabel {text: qsTr("API Key:"); width: _labelWidth; anchors.verticalCenter: parent.verticalCenter } - FactTextField {fact: QGroundControl.settingsManager.airMapSettings.apiKey; width: _editFieldWidth; anchors.verticalCenter: parent.verticalCenter } - } - Row { - spacing: ScreenTools.defaultFontPixelWidth - QGCLabel {text: qsTr("Client ID:"); width: _labelWidth; anchors.verticalCenter: parent.verticalCenter } - FactTextField {fact: QGroundControl.settingsManager.airMapSettings.clientID; width: _editFieldWidth; anchors.verticalCenter: parent.verticalCenter } - } - Row { - spacing: ScreenTools.defaultFontPixelWidth - QGCLabel {text: qsTr("User Name:"); width: _labelWidth; anchors.verticalCenter: parent.verticalCenter } - FactTextField {fact: QGroundControl.settingsManager.airMapSettings.userName; width: _editFieldWidth; anchors.verticalCenter: parent.verticalCenter } - } - Row { - spacing: ScreenTools.defaultFontPixelWidth - QGCLabel {text: qsTr("Password:"); width: _labelWidth; anchors.verticalCenter: parent.verticalCenter } - FactTextField {fact: QGroundControl.settingsManager.airMapSettings.password; width: _editFieldWidth; anchors.verticalCenter: parent.verticalCenter; echoMode: TextInput.Password } - } - } - } //----------------------------------------------------------------- //-- Video Source Item {