Commit c3282048 authored by Gus Grubba's avatar Gus Grubba

Consolidate settings

All settings wired and persistent
Cleanup non Airmap builds
parent a5e8264b
...@@ -137,13 +137,16 @@ contains (DEFINES, DISABLE_AIRMAP) { ...@@ -137,13 +137,16 @@ contains (DEFINES, DISABLE_AIRMAP) {
DEFINES -= QGC_AIRMAP_ENABLED DEFINES -= QGC_AIRMAP_ENABLED
} else { } else {
AIRMAPD_PATH = $$PWD/libs/airmapd AIRMAPD_PATH = $$PWD/libs/airmapd
INCLUDEPATH += \
$${AIRMAPD_PATH}/include
MacBuild|iOSBuild { MacBuild|iOSBuild {
message("Including support for AirMap") message("Including support for AirMap for macOS")
LIBS += -L$${AIRMAPD_PATH}/macOS/Qt.5.9 -lairmap-qt LIBS += -L$${AIRMAPD_PATH}/macOS/Qt.5.9 -lairmap-qt
DEFINES += QGC_AIRMAP_ENABLED DEFINES += QGC_AIRMAP_ENABLED
} else { } else {
message("Skipping support for Airmap (unsupported platform)") message("Skipping support for Airmap (unsupported platform)")
DEFINES -= QGC_AIRMAP_ENABLED
}
contains (DEFINES, QGC_AIRMAP_ENABLED) {
INCLUDEPATH += \
$${AIRMAPD_PATH}/include
} }
} }
...@@ -22,5 +22,29 @@ ...@@ -22,5 +22,29 @@
"shortDescription": "AirMap Password", "shortDescription": "AirMap Password",
"type": "string", "type": "string",
"defaultValue": "" "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": ""
} }
] ]
...@@ -20,6 +20,10 @@ DECLARE_SETTINGGROUP(AirMap) ...@@ -20,6 +20,10 @@ DECLARE_SETTINGGROUP(AirMap)
INIT_SETTINGFACT(clientID); INIT_SETTINGFACT(clientID);
INIT_SETTINGFACT(userName); INIT_SETTINGFACT(userName);
INIT_SETTINGFACT(password); INIT_SETTINGFACT(password);
INIT_SETTINGFACT(enableAirMap);
INIT_SETTINGFACT(enableTelemetry);
INIT_SETTINGFACT(loginEmail);
INIT_SETTINGFACT(loginPassword);
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<AirMapSettings>("QGroundControl.SettingsManager", 1, 0, "AirMapSettings", "Reference only"); qmlRegisterUncreatableType<AirMapSettings>("QGroundControl.SettingsManager", 1, 0, "AirMapSettings", "Reference only");
} }
...@@ -28,3 +32,7 @@ DECLARE_SETTINGSFACT(AirMapSettings, apiKey) ...@@ -28,3 +32,7 @@ DECLARE_SETTINGSFACT(AirMapSettings, apiKey)
DECLARE_SETTINGSFACT(AirMapSettings, clientID) DECLARE_SETTINGSFACT(AirMapSettings, clientID)
DECLARE_SETTINGSFACT(AirMapSettings, userName) DECLARE_SETTINGSFACT(AirMapSettings, userName)
DECLARE_SETTINGSFACT(AirMapSettings, password) DECLARE_SETTINGSFACT(AirMapSettings, password)
DECLARE_SETTINGSFACT(AirMapSettings, enableAirMap)
DECLARE_SETTINGSFACT(AirMapSettings, enableTelemetry)
DECLARE_SETTINGSFACT(AirMapSettings, loginEmail)
DECLARE_SETTINGSFACT(AirMapSettings, loginPassword)
...@@ -24,5 +24,9 @@ public: ...@@ -24,5 +24,9 @@ public:
DEFINE_SETTINGFACT(clientID) DEFINE_SETTINGFACT(clientID)
DEFINE_SETTINGFACT(userName) DEFINE_SETTINGFACT(userName)
DEFINE_SETTINGFACT(password) DEFINE_SETTINGFACT(password)
DEFINE_SETTINGFACT(enableAirMap)
DEFINE_SETTINGFACT(enableTelemetry)
DEFINE_SETTINGFACT(loginEmail)
DEFINE_SETTINGFACT(loginPassword)
}; };
...@@ -35,7 +35,7 @@ QGCView { ...@@ -35,7 +35,7 @@ QGCView {
property real _labelWidth: ScreenTools.defaultFontPixelWidth * 20 property real _labelWidth: ScreenTools.defaultFontPixelWidth * 20
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 30 property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 30
property real _panelWidth: _qgcView.width * _internalWidthRatio 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 property bool _airMapEnabled: _enableAirMapFact.rawValue
readonly property real _internalWidthRatio: 0.8 readonly property real _internalWidthRatio: 0.8
...@@ -84,14 +84,12 @@ QGCView { ...@@ -84,14 +84,12 @@ QGCView {
fact: _enableAirMapFact fact: _enableAirMapFact
visible: _enableAirMapFact.visible visible: _enableAirMapFact.visible
} }
QGCCheckBox { FactCheckBox {
text: qsTr("Disable Telemetry") text: qsTr("Enable Telemetry")
checked: false fact: _enableTelemetryFact
visible: _enableTelemetryFact.visible
enabled: _airMapEnabled enabled: _airMapEnabled
onClicked: property Fact _enableTelemetryFact: QGroundControl.settingsManager.airMapSettings.enableTelemetry
{
}
} }
} }
} }
...@@ -102,7 +100,6 @@ QGCView { ...@@ -102,7 +100,6 @@ QGCView {
height: loginLabel.height height: loginLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: QGroundControl.settingsManager.appSettings.visible
QGCLabel { QGCLabel {
id: loginLabel id: loginLabel
text: qsTr("Login / Registration") text: qsTr("Login / Registration")
...@@ -121,14 +118,18 @@ QGCView { ...@@ -121,14 +118,18 @@ QGCView {
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.25 rowSpacing: ScreenTools.defaultFontPixelHeight * 0.25
anchors.centerIn: parent anchors.centerIn: parent
QGCLabel { text: qsTr("Email:") } QGCLabel { text: qsTr("Email:") }
QGCTextField { FactTextField {
width: _editFieldWidth fact: _loginEmailFact
enabled: _airMapEnabled enabled: _airMapEnabled
visible: _loginEmailFact.visible
property Fact _loginEmailFact: QGroundControl.settingsManager.airMapSettings.loginEmail
} }
QGCLabel { text: qsTr("Password:") } QGCLabel { text: qsTr("Password:") }
QGCTextField { FactTextField {
width: _editFieldWidth fact: _loginPasswordFact
enabled: _airMapEnabled enabled: _airMapEnabled
visible: _loginPasswordFact.visible
property Fact _loginPasswordFact: QGroundControl.settingsManager.airMapSettings.loginPassword
} }
Item { Item {
width: 1 width: 1
...@@ -150,6 +151,9 @@ QGCView { ...@@ -150,6 +151,9 @@ QGCView {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.columnSpan: 2 Layout.columnSpan: 2
enabled: _airMapEnabled enabled: _airMapEnabled
onClicked: {
Qt.openUrlExternally("https://www.airmap.com");
}
} }
} }
} }
...@@ -189,6 +193,42 @@ QGCView { ...@@ -189,6 +193,42 @@ QGCView {
QGCLabel { text: qsTr("+1 212 555 1212") } 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 }
}
}
} }
} }
} }
......
Module Module QGroundControl.Airmap
QGroundControl.Airmap
AirspaceControl 1.0 AirspaceControl.qml AirspaceControl 1.0 AirspaceControl.qml
AirspaceRegulation 1.0 AirspaceRegulation.qml AirspaceRegulation 1.0 AirspaceRegulation.qml
...@@ -34,7 +34,7 @@ Item { ...@@ -34,7 +34,7 @@ Item {
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _isSatellite: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true property bool _isSatellite: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true
property bool _lightWidgetBorders: _isSatellite 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 readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5
......
...@@ -46,7 +46,7 @@ QGCView { ...@@ -46,7 +46,7 @@ QGCView {
readonly property var _defaultVehicleCoordinate: QtPositioning.coordinate(37.803784, -122.462276) readonly property var _defaultVehicleCoordinate: QtPositioning.coordinate(37.803784, -122.462276)
readonly property bool _waypointsOnlyMode: QGroundControl.corePlugin.options.missionWaypointsOnly 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 _planMasterController: masterController
property var _missionController: _planMasterController.missionController property var _missionController: _planMasterController.missionController
property var _geoFenceController: _planMasterController.geoFenceController property var _geoFenceController: _planMasterController.geoFenceController
......
...@@ -183,12 +183,5 @@ ...@@ -183,12 +183,5 @@
"shortDescription": "Default firmware type for flashing", "shortDescription": "Default firmware type for flashing",
"type": "uint32", "type": "uint32",
"defaultValue": 12 "defaultValue": 12
},
{
"name": "EnableAirMap",
"shortDescription": "Enable AirMap",
"longDescription": "Enable AirMap Services",
"type": "bool",
"defaultValue": false
} }
] ]
...@@ -37,7 +37,6 @@ const char* AppSettings::mapboxTokenName = "MapboxT ...@@ -37,7 +37,6 @@ const char* AppSettings::mapboxTokenName = "MapboxT
const char* AppSettings::esriTokenName = "EsriToken"; const char* AppSettings::esriTokenName = "EsriToken";
const char* AppSettings::defaultFirmwareTypeName = "DefaultFirmwareType"; const char* AppSettings::defaultFirmwareTypeName = "DefaultFirmwareType";
const char* AppSettings::gstDebugName = "GstreamerDebugLevel"; const char* AppSettings::gstDebugName = "GstreamerDebugLevel";
const char* AppSettings::enableAirMapName = "EnableAirMap";
const char* AppSettings::parameterFileExtension = "params"; const char* AppSettings::parameterFileExtension = "params";
const char* AppSettings::planFileExtension = "plan"; const char* AppSettings::planFileExtension = "plan";
...@@ -78,7 +77,6 @@ AppSettings::AppSettings(QObject* parent) ...@@ -78,7 +77,6 @@ AppSettings::AppSettings(QObject* parent)
, _esriTokenFact(NULL) , _esriTokenFact(NULL)
, _defaultFirmwareTypeFact(NULL) , _defaultFirmwareTypeFact(NULL)
, _gstDebugFact(NULL) , _gstDebugFact(NULL)
, _enableAirMapFact(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");
...@@ -402,12 +400,3 @@ Fact* AppSettings::defaultFirmwareType(void) ...@@ -402,12 +400,3 @@ Fact* AppSettings::defaultFirmwareType(void)
return _defaultFirmwareTypeFact; return _defaultFirmwareTypeFact;
} }
Fact* AppSettings::enableAirMap(void)
{
if (!_enableAirMapFact) {
_enableAirMapFact = _createSettingsFact(enableAirMapName);
}
return _enableAirMapFact;
}
...@@ -41,7 +41,6 @@ public: ...@@ -41,7 +41,6 @@ public:
Q_PROPERTY(Fact* esriToken READ esriToken CONSTANT) Q_PROPERTY(Fact* esriToken READ esriToken CONSTANT)
Q_PROPERTY(Fact* defaultFirmwareType READ defaultFirmwareType CONSTANT) Q_PROPERTY(Fact* defaultFirmwareType READ defaultFirmwareType CONSTANT)
Q_PROPERTY(Fact* gstDebug READ gstDebug 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 missionSavePath READ missionSavePath NOTIFY savePathsChanged)
Q_PROPERTY(QString parameterSavePath READ parameterSavePath NOTIFY savePathsChanged) Q_PROPERTY(QString parameterSavePath READ parameterSavePath NOTIFY savePathsChanged)
...@@ -78,7 +77,6 @@ public: ...@@ -78,7 +77,6 @@ public:
Fact* esriToken (void); Fact* esriToken (void);
Fact* defaultFirmwareType (void); Fact* defaultFirmwareType (void);
Fact* gstDebug (void); Fact* gstDebug (void);
Fact* enableAirMap (void);
QString missionSavePath (void); QString missionSavePath (void);
QString parameterSavePath (void); QString parameterSavePath (void);
...@@ -112,7 +110,6 @@ public: ...@@ -112,7 +110,6 @@ public:
static const char* esriTokenName; static const char* esriTokenName;
static const char* defaultFirmwareTypeName; static const char* defaultFirmwareTypeName;
static const char* gstDebugName; static const char* gstDebugName;
static const char* enableAirMapName;
// Application wide file extensions // Application wide file extensions
static const char* parameterFileExtension; static const char* parameterFileExtension;
...@@ -161,7 +158,6 @@ private: ...@@ -161,7 +158,6 @@ private:
SettingsFact* _esriTokenFact; SettingsFact* _esriTokenFact;
SettingsFact* _defaultFirmwareTypeFact; SettingsFact* _defaultFirmwareTypeFact;
SettingsFact* _gstDebugFact; SettingsFact* _gstDebugFact;
SettingsFact* _enableAirMapFact;
}; };
#endif #endif
...@@ -30,7 +30,9 @@ public: ...@@ -30,7 +30,9 @@ public:
: pGeneral (NULL) : pGeneral (NULL)
, pCommLinks (NULL) , pCommLinks (NULL)
, pOfflineMaps (NULL) , pOfflineMaps (NULL)
#if defined(QGC_AIRMAP_ENABLED)
, pAirmap (NULL) , pAirmap (NULL)
#endif
, pMAVLink (NULL) , pMAVLink (NULL)
, pConsole (NULL) , pConsole (NULL)
#if defined(QT_DEBUG) #if defined(QT_DEBUG)
...@@ -54,8 +56,10 @@ public: ...@@ -54,8 +56,10 @@ public:
delete pCommLinks; delete pCommLinks;
if(pOfflineMaps) if(pOfflineMaps)
delete pOfflineMaps; delete pOfflineMaps;
#if defined(QGC_AIRMAP_ENABLED)
if(pAirmap) if(pAirmap)
delete pAirmap; delete pAirmap;
#endif
if(pMAVLink) if(pMAVLink)
delete pMAVLink; delete pMAVLink;
if(pConsole) if(pConsole)
...@@ -73,7 +77,9 @@ public: ...@@ -73,7 +77,9 @@ public:
QmlComponentInfo* pGeneral; QmlComponentInfo* pGeneral;
QmlComponentInfo* pCommLinks; QmlComponentInfo* pCommLinks;
QmlComponentInfo* pOfflineMaps; QmlComponentInfo* pOfflineMaps;
#if defined(QGC_AIRMAP_ENABLED)
QmlComponentInfo* pAirmap; QmlComponentInfo* pAirmap;
#endif
QmlComponentInfo* pMAVLink; QmlComponentInfo* pMAVLink;
QmlComponentInfo* pConsole; QmlComponentInfo* pConsole;
#if defined(QT_DEBUG) #if defined(QT_DEBUG)
...@@ -131,10 +137,12 @@ QVariantList &QGCCorePlugin::settingsPages() ...@@ -131,10 +137,12 @@ QVariantList &QGCCorePlugin::settingsPages()
QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"), QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"),
QUrl::fromUserInput("qrc:/res/waves.svg")); QUrl::fromUserInput("qrc:/res/waves.svg"));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pOfflineMaps)); _p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pOfflineMaps));
#if defined(QGC_AIRMAP_ENABLED)
_p->pAirmap = new QmlComponentInfo(tr("AirMap"), _p->pAirmap = new QmlComponentInfo(tr("AirMap"),
QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"), QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"),
QUrl::fromUserInput("")); QUrl::fromUserInput(""));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pAirmap)); _p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pAirmap));
#endif
_p->pMAVLink = new QmlComponentInfo(tr("MAVLink"), _p->pMAVLink = new QmlComponentInfo(tr("MAVLink"),
QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"), QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"),
QUrl::fromUserInput("qrc:/res/waves.svg")); QUrl::fromUserInput("qrc:/res/waves.svg"));
......
...@@ -555,52 +555,6 @@ QGCView { ...@@ -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 //-- Video Source
Item { Item {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment