Commit 8a641e2d authored by Gus Grubba's avatar Gus Grubba

AirMap Settings

parent 365c6d71
......@@ -18,6 +18,7 @@
<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/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="AppSettings.qml">src/ui/AppSettings.qml</file>
<file alias="BluetoothSettings.qml">src/ui/preferences/BluetoothSettings.qml</file>
......
/****************************************************************************
*
* (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") }
}
}
}
}
}
}
......@@ -34,6 +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
readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5
......@@ -130,6 +131,7 @@ Item {
AirspaceControl {
id: airspaceControl
width: getPreferredInstrumentWidth()
visible: _enableAirMap
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
onColapsedChanged: {
widgetRoot.showValues = colapsed
......
......@@ -46,18 +46,19 @@ QGCView {
readonly property var _defaultVehicleCoordinate: QtPositioning.coordinate(37.803784, -122.462276)
readonly property bool _waypointsOnlyMode: QGroundControl.corePlugin.options.missionWaypointsOnly
property var _planMasterController: masterController
property var _missionController: _planMasterController.missionController
property var _geoFenceController: _planMasterController.geoFenceController
property var _rallyPointController: _planMasterController.rallyPointController
property var _visualItems: _missionController.visualItems
property bool _lightWidgetBorders: editorMap.isSatelliteMap
property bool _addWaypointOnClick: false
property bool _addROIOnClick: false
property bool _singleComplexItem: _missionController.complexMissionItemNames.length === 1
property real _toolbarHeight: _qgcView.height - ScreenTools.availableHeight
property int _editingLayer: _layerMission
property int _toolStripBottom: toolStrip.height + toolStrip.y
property bool _enableAirMap: QGroundControl.settingsManager.appSettings.enableAirMap.rawValue
property var _planMasterController: masterController
property var _missionController: _planMasterController.missionController
property var _geoFenceController: _planMasterController.geoFenceController
property var _rallyPointController: _planMasterController.rallyPointController
property var _visualItems: _missionController.visualItems
property bool _lightWidgetBorders: editorMap.isSatelliteMap
property bool _addWaypointOnClick: false
property bool _addROIOnClick: false
property bool _singleComplexItem: _missionController.complexMissionItemNames.length === 1
property real _toolbarHeight: _qgcView.height - ScreenTools.availableHeight
property int _editingLayer: _layerMission
property int _toolStripBottom: toolStrip.height + toolStrip.y
readonly property int _layerMission: 1
readonly property int _layerGeoFence: 2
......@@ -94,6 +95,12 @@ QGCView {
planMasterController: _planMasterController
}
on_EnableAirMapChanged: {
if(!_enableAirMap) {
planControlColapsed = false
}
}
Connections {
target: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude
......@@ -267,7 +274,7 @@ QGCView {
function accept() {
var toIndex = toCombo.currentIndex
if (toIndex == 0) {
if (toIndex === 0) {
toIndex = 1
}
_missionController.moveMissionItem(_moveDialogMissionItemIndex, toIndex)
......@@ -514,6 +521,7 @@ QGCView {
AirspaceControl {
id: airspaceControl
width: parent.width
visible: _enableAirMap
showColapse: false
onColapsedChanged: {
if(!airspaceControl.colasped) {
......@@ -529,7 +537,7 @@ QGCView {
height: planControlColapsed ? colapsedRow.height + ScreenTools.defaultFontPixelHeight : 0
color: qgcPal.missionItemEditor
radius: _radius
visible: planControlColapsed
visible: planControlColapsed && _enableAirMap
Row {
id: colapsedRow
spacing: ScreenTools.defaultFontPixelWidth
......@@ -576,7 +584,7 @@ QGCView {
height: !planControlColapsed ? expandedCol.height + ScreenTools.defaultFontPixelHeight : 0
color: qgcPal.missionItemEditor
radius: _radius
visible: !planControlColapsed
visible: !planControlColapsed || !_enableAirMap
Item {
height: expandedCol.height
anchors.left: parent.left
......
......@@ -176,5 +176,12 @@
"shortDescription": "Default firmware type for flashing",
"type": "uint32",
"defaultValue": 12
},
{
"name": "EnableAirMap",
"shortDescription": "Enable AirMap",
"longDescription": "Enable AirMap Services",
"type": "bool",
"defaultValue": false
}
]
......@@ -36,6 +36,7 @@ const char* AppSettings::autoLoadMissionsName = "AutoLoa
const char* AppSettings::mapboxTokenName = "MapboxToken";
const char* AppSettings::esriTokenName = "EsriToken";
const char* AppSettings::defaultFirmwareTypeName = "DefaultFirmwareType";
const char* AppSettings::enableAirMapName = "EnableAirMap";
const char* AppSettings::parameterFileExtension = "params";
const char* AppSettings::planFileExtension = "plan";
......@@ -75,6 +76,7 @@ AppSettings::AppSettings(QObject* parent)
, _mapboxTokenFact(NULL)
, _esriTokenFact(NULL)
, _defaultFirmwareTypeFact(NULL)
, _enableAirMapFact(NULL)
{
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<AppSettings>("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only");
......@@ -389,3 +391,12 @@ Fact* AppSettings::defaultFirmwareType(void)
return _defaultFirmwareTypeFact;
}
Fact* AppSettings::enableAirMap(void)
{
if (!_enableAirMapFact) {
_enableAirMapFact = _createSettingsFact(enableAirMapName);
}
return _enableAirMapFact;
}
......@@ -40,6 +40,7 @@ public:
Q_PROPERTY(Fact* mapboxToken READ mapboxToken CONSTANT)
Q_PROPERTY(Fact* esriToken READ esriToken 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 parameterSavePath READ parameterSavePath NOTIFY savePathsChanged)
......@@ -75,12 +76,13 @@ public:
Fact* mapboxToken (void);
Fact* esriToken (void);
Fact* defaultFirmwareType (void);
Fact* enableAirMap (void);
QString missionSavePath (void);
QString parameterSavePath (void);
QString telemetrySavePath (void);
QString logSavePath (void);
QString videoSavePath (void);
QString videoSavePath (void);
static MAV_AUTOPILOT offlineEditingFirmwareTypeFromFirmwareType(MAV_AUTOPILOT firmwareType);
static MAV_TYPE offlineEditingVehicleTypeFromVehicleType(MAV_TYPE vehicleType);
......@@ -107,6 +109,7 @@ public:
static const char* mapboxTokenName;
static const char* esriTokenName;
static const char* defaultFirmwareTypeName;
static const char* enableAirMapName;
// Application wide file extensions
static const char* parameterFileExtension;
......@@ -154,6 +157,7 @@ private:
SettingsFact* _mapboxTokenFact;
SettingsFact* _esriTokenFact;
SettingsFact* _defaultFirmwareTypeFact;
SettingsFact* _enableAirMapFact;
};
#endif
......@@ -30,6 +30,7 @@ public:
: pGeneral (NULL)
, pCommLinks (NULL)
, pOfflineMaps (NULL)
, pAirmap (NULL)
, pMAVLink (NULL)
, pConsole (NULL)
#if defined(QT_DEBUG)
......@@ -53,6 +54,8 @@ public:
delete pCommLinks;
if(pOfflineMaps)
delete pOfflineMaps;
if(pAirmap)
delete pAirmap;
if(pMAVLink)
delete pMAVLink;
if(pConsole)
......@@ -70,6 +73,7 @@ public:
QmlComponentInfo* pGeneral;
QmlComponentInfo* pCommLinks;
QmlComponentInfo* pOfflineMaps;
QmlComponentInfo* pAirmap;
QmlComponentInfo* pMAVLink;
QmlComponentInfo* pConsole;
#if defined(QT_DEBUG)
......@@ -127,6 +131,10 @@ QVariantList &QGCCorePlugin::settingsPages()
QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"),
QUrl::fromUserInput("qrc:/res/waves.svg"));
_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"),
QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"),
QUrl::fromUserInput("qrc:/res/waves.svg"));
......
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