Browse Source

AirMap Settings

QGC4.4
Gus Grubba 7 years ago
parent
commit
8a641e2d21
  1. 1
      qgroundcontrol.qrc
  2. 195
      src/Airmap/AirmapSettings.qml
  3. 2
      src/FlightDisplay/FlightDisplayViewWidgets.qml
  4. 14
      src/PlanView/PlanView.qml
  5. 7
      src/Settings/App.SettingsGroup.json
  6. 11
      src/Settings/AppSettings.cc
  7. 4
      src/Settings/AppSettings.h
  8. 8
      src/api/QGCCorePlugin.cc

1
qgroundcontrol.qrc

@ -18,6 +18,7 @@
<file alias="QGroundControl/Airmap/qmldir">src/Airmap/QGroundControl.Airmap.qmldir</file> <file alias="QGroundControl/Airmap/qmldir">src/Airmap/QGroundControl.Airmap.qmldir</file>
<file alias="QGroundControl/Airmap/AirspaceControl.qml">src/Airmap/AirspaceControl.qml</file> <file alias="QGroundControl/Airmap/AirspaceControl.qml">src/Airmap/AirspaceControl.qml</file>
<file alias="QGroundControl/Airmap/AirspaceRegulation.qml">src/Airmap/AirspaceRegulation.qml</file> <file alias="QGroundControl/Airmap/AirspaceRegulation.qml">src/Airmap/AirspaceRegulation.qml</file>
<file alias="AirmapSettings.qml">src/Airmap/AirmapSettings.qml</file>
<file alias="AnalyzeView.qml">src/AnalyzeView/AnalyzeView.qml</file> <file alias="AnalyzeView.qml">src/AnalyzeView/AnalyzeView.qml</file>
<file alias="AppSettings.qml">src/ui/AppSettings.qml</file> <file alias="AppSettings.qml">src/ui/AppSettings.qml</file>
<file alias="BluetoothSettings.qml">src/ui/preferences/BluetoothSettings.qml</file> <file alias="BluetoothSettings.qml">src/ui/preferences/BluetoothSettings.qml</file>

195
src/Airmap/AirmapSettings.qml

@ -0,0 +1,195 @@
/****************************************************************************
*
* (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.
*
****************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.2
import QtMultimedia 5.5
import QtQuick.Layouts 1.2
import QGroundControl 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.MultiVehicleManager 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.SettingsManager 1.0
QGCView {
id: _qgcView
viewPanel: panel
color: qgcPal.window
anchors.fill: parent
anchors.margins: ScreenTools.defaultFontPixelWidth
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 bool _airMapEnabled: _enableAirMapFact.rawValue
readonly property real _internalWidthRatio: 0.8
QGCPalette { id: qgcPal }
QGCViewPanel {
id: panel
anchors.fill: parent
QGCFlickable {
clip: true
anchors.fill: parent
contentHeight: settingsColumn.height
contentWidth: settingsColumn.width
Column {
id: settingsColumn
width: _qgcView.width
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.margins: ScreenTools.defaultFontPixelWidth
//-----------------------------------------------------------------
//-- General
Item {
width: _panelWidth
height: generalLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
visible: QGroundControl.settingsManager.unitsSettings.visible
QGCLabel {
id: generalLabel
text: qsTr("General")
font.family: ScreenTools.demiboldFontFamily
}
}
Rectangle {
height: generalCol.height + (ScreenTools.defaultFontPixelHeight * 2)
width: _panelWidth
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
Column {
id: generalCol
spacing: ScreenTools.defaultFontPixelWidth
anchors.centerIn: parent
FactCheckBox {
text: qsTr("Enable AirMap Services")
fact: _enableAirMapFact
visible: _enableAirMapFact.visible
}
QGCCheckBox {
text: qsTr("Disable Telemetry")
checked: false
enabled: _airMapEnabled
onClicked:
{
}
}
}
}
//-----------------------------------------------------------------
//-- Login / Registration
Item {
width: _panelWidth
height: loginLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
visible: QGroundControl.settingsManager.appSettings.visible
QGCLabel {
id: loginLabel
text: qsTr("Login / Registration")
font.family: ScreenTools.demiboldFontFamily
}
}
Rectangle {
height: loginGrid.height + (ScreenTools.defaultFontPixelHeight * 2)
width: _panelWidth
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
GridLayout {
id: loginGrid
columns: 2
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.25
anchors.centerIn: parent
QGCLabel { text: qsTr("Email:") }
QGCTextField {
width: _editFieldWidth
enabled: _airMapEnabled
}
QGCLabel { text: qsTr("Password:") }
QGCTextField {
width: _editFieldWidth
enabled: _airMapEnabled
}
Item {
width: 1
height: 1
Layout.columnSpan: 2
}
QGCLabel {
text: qsTr("Forgot Your AirMap Password?")
Layout.alignment: Qt.AlignHCenter
Layout.columnSpan: 2
}
Item {
width: 1
height: 1
Layout.columnSpan: 2
}
QGCButton {
text: qsTr("Register for an AirMap Account")
Layout.alignment: Qt.AlignHCenter
Layout.columnSpan: 2
enabled: _airMapEnabled
}
}
}
//-----------------------------------------------------------------
//-- Pilot Profile
Item {
width: _panelWidth
height: profileLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
visible: QGroundControl.settingsManager.appSettings.visible
QGCLabel {
id: profileLabel
text: qsTr("Pilot Profile")
font.family: ScreenTools.demiboldFontFamily
}
}
Rectangle {
height: profileGrid.height + (ScreenTools.defaultFontPixelHeight * 2)
width: _panelWidth
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
GridLayout {
id: profileGrid
columns: 2
columnSpacing: ScreenTools.defaultFontPixelHeight * 2
rowSpacing: ScreenTools.defaultFontPixelWidth * 0.25
anchors.centerIn: parent
QGCLabel { text: qsTr("Name:") }
QGCLabel { text: qsTr("John Doe") }
QGCLabel { text: qsTr("User Name:") }
QGCLabel { text: qsTr("joe36") }
QGCLabel { text: qsTr("Email:") }
QGCLabel { text: qsTr("jonh@doe.com") }
QGCLabel { text: qsTr("Phone:") }
QGCLabel { text: qsTr("+1 212 555 1212") }
}
}
}
}
}
}

2
src/FlightDisplay/FlightDisplayViewWidgets.qml

@ -34,6 +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
readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5 readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5
@ -130,6 +131,7 @@ Item {
AirspaceControl { AirspaceControl {
id: airspaceControl id: airspaceControl
width: getPreferredInstrumentWidth() width: getPreferredInstrumentWidth()
visible: _enableAirMap
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
onColapsedChanged: { onColapsedChanged: {
widgetRoot.showValues = colapsed widgetRoot.showValues = colapsed

14
src/PlanView/PlanView.qml

@ -46,6 +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 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
@ -94,6 +95,12 @@ QGCView {
planMasterController: _planMasterController planMasterController: _planMasterController
} }
on_EnableAirMapChanged: {
if(!_enableAirMap) {
planControlColapsed = false
}
}
Connections { Connections {
target: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude target: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude
@ -267,7 +274,7 @@ QGCView {
function accept() { function accept() {
var toIndex = toCombo.currentIndex var toIndex = toCombo.currentIndex
if (toIndex == 0) { if (toIndex === 0) {
toIndex = 1 toIndex = 1
} }
_missionController.moveMissionItem(_moveDialogMissionItemIndex, toIndex) _missionController.moveMissionItem(_moveDialogMissionItemIndex, toIndex)
@ -514,6 +521,7 @@ QGCView {
AirspaceControl { AirspaceControl {
id: airspaceControl id: airspaceControl
width: parent.width width: parent.width
visible: _enableAirMap
showColapse: false showColapse: false
onColapsedChanged: { onColapsedChanged: {
if(!airspaceControl.colasped) { if(!airspaceControl.colasped) {
@ -529,7 +537,7 @@ QGCView {
height: planControlColapsed ? colapsedRow.height + ScreenTools.defaultFontPixelHeight : 0 height: planControlColapsed ? colapsedRow.height + ScreenTools.defaultFontPixelHeight : 0
color: qgcPal.missionItemEditor color: qgcPal.missionItemEditor
radius: _radius radius: _radius
visible: planControlColapsed visible: planControlColapsed && _enableAirMap
Row { Row {
id: colapsedRow id: colapsedRow
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
@ -576,7 +584,7 @@ QGCView {
height: !planControlColapsed ? expandedCol.height + ScreenTools.defaultFontPixelHeight : 0 height: !planControlColapsed ? expandedCol.height + ScreenTools.defaultFontPixelHeight : 0
color: qgcPal.missionItemEditor color: qgcPal.missionItemEditor
radius: _radius radius: _radius
visible: !planControlColapsed visible: !planControlColapsed || !_enableAirMap
Item { Item {
height: expandedCol.height height: expandedCol.height
anchors.left: parent.left anchors.left: parent.left

7
src/Settings/App.SettingsGroup.json

@ -176,5 +176,12 @@
"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
} }
] ]

11
src/Settings/AppSettings.cc

@ -36,6 +36,7 @@ const char* AppSettings::autoLoadMissionsName = "AutoLoa
const char* AppSettings::mapboxTokenName = "MapboxToken"; const char* AppSettings::mapboxTokenName = "MapboxToken";
const char* AppSettings::esriTokenName = "EsriToken"; const char* AppSettings::esriTokenName = "EsriToken";
const char* AppSettings::defaultFirmwareTypeName = "DefaultFirmwareType"; const char* AppSettings::defaultFirmwareTypeName = "DefaultFirmwareType";
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";
@ -75,6 +76,7 @@ AppSettings::AppSettings(QObject* parent)
, _mapboxTokenFact(NULL) , _mapboxTokenFact(NULL)
, _esriTokenFact(NULL) , _esriTokenFact(NULL)
, _defaultFirmwareTypeFact(NULL) , _defaultFirmwareTypeFact(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");
@ -389,3 +391,12 @@ Fact* AppSettings::defaultFirmwareType(void)
return _defaultFirmwareTypeFact; return _defaultFirmwareTypeFact;
} }
Fact* AppSettings::enableAirMap(void)
{
if (!_enableAirMapFact) {
_enableAirMapFact = _createSettingsFact(enableAirMapName);
}
return _enableAirMapFact;
}

4
src/Settings/AppSettings.h

@ -40,6 +40,7 @@ public:
Q_PROPERTY(Fact* mapboxToken READ mapboxToken CONSTANT) Q_PROPERTY(Fact* mapboxToken READ mapboxToken CONSTANT)
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* 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)
@ -75,6 +76,7 @@ public:
Fact* mapboxToken (void); Fact* mapboxToken (void);
Fact* esriToken (void); Fact* esriToken (void);
Fact* defaultFirmwareType (void); Fact* defaultFirmwareType (void);
Fact* enableAirMap (void);
QString missionSavePath (void); QString missionSavePath (void);
QString parameterSavePath (void); QString parameterSavePath (void);
@ -107,6 +109,7 @@ public:
static const char* mapboxTokenName; static const char* mapboxTokenName;
static const char* esriTokenName; static const char* esriTokenName;
static const char* defaultFirmwareTypeName; static const char* defaultFirmwareTypeName;
static const char* enableAirMapName;
// Application wide file extensions // Application wide file extensions
static const char* parameterFileExtension; static const char* parameterFileExtension;
@ -154,6 +157,7 @@ private:
SettingsFact* _mapboxTokenFact; SettingsFact* _mapboxTokenFact;
SettingsFact* _esriTokenFact; SettingsFact* _esriTokenFact;
SettingsFact* _defaultFirmwareTypeFact; SettingsFact* _defaultFirmwareTypeFact;
SettingsFact* _enableAirMapFact;
}; };
#endif #endif

8
src/api/QGCCorePlugin.cc

@ -30,6 +30,7 @@ public:
: pGeneral (NULL) : pGeneral (NULL)
, pCommLinks (NULL) , pCommLinks (NULL)
, pOfflineMaps (NULL) , pOfflineMaps (NULL)
, pAirmap (NULL)
, pMAVLink (NULL) , pMAVLink (NULL)
, pConsole (NULL) , pConsole (NULL)
#if defined(QT_DEBUG) #if defined(QT_DEBUG)
@ -53,6 +54,8 @@ public:
delete pCommLinks; delete pCommLinks;
if(pOfflineMaps) if(pOfflineMaps)
delete pOfflineMaps; delete pOfflineMaps;
if(pAirmap)
delete pAirmap;
if(pMAVLink) if(pMAVLink)
delete pMAVLink; delete pMAVLink;
if(pConsole) if(pConsole)
@ -70,6 +73,7 @@ public:
QmlComponentInfo* pGeneral; QmlComponentInfo* pGeneral;
QmlComponentInfo* pCommLinks; QmlComponentInfo* pCommLinks;
QmlComponentInfo* pOfflineMaps; QmlComponentInfo* pOfflineMaps;
QmlComponentInfo* pAirmap;
QmlComponentInfo* pMAVLink; QmlComponentInfo* pMAVLink;
QmlComponentInfo* pConsole; QmlComponentInfo* pConsole;
#if defined(QT_DEBUG) #if defined(QT_DEBUG)
@ -127,6 +131,10 @@ 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));
_p->pAirmap = new QmlComponentInfo(tr("AirMap"),
QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"),
QUrl::fromUserInput(""));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pAirmap));
_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"));

Loading…
Cancel
Save