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) {
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
}
}
......@@ -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": ""
}
]
......@@ -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<AirMapSettings>("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)
......@@ -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)
};
......@@ -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 }
}
}
}
}
}
......
Module
QGroundControl.Airmap
Module QGroundControl.Airmap
AirspaceControl 1.0 AirspaceControl.qml
AirspaceRegulation 1.0 AirspaceRegulation.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
......
......@@ -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
......
......@@ -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
}
]
......@@ -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<AppSettings>("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;
}
......@@ -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
......@@ -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"));
......
......@@ -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 {
......
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