From ad064b526472fc0ec01272ec49490752dac2b057 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Wed, 7 Nov 2018 11:19:02 -0800 Subject: [PATCH] Expose guided altitude settings. Rearrange Fly and Plan view settings. --- qgroundcontrol.pro | 6 +- qgroundcontrol.qrc | 3 +- src/FlightDisplay/GuidedAltitudeSlider.qml | 8 +- src/Settings/FlyView.SettingsGroup.json | 16 ++ src/Settings/FlyViewSettings.cc | 47 +++ src/Settings/FlyViewSettings.h | 36 +++ src/Settings/Guided.SettingsGroup.json | 26 -- src/Settings/GuidedSettings.cc | 69 ----- src/Settings/GuidedSettings.h | 49 ---- src/Settings/PlanView.SettingsGroup.json | 2 + src/Settings/PlanViewSettings.cc | 23 ++ src/Settings/PlanViewSettings.h | 26 ++ src/Settings/SettingsManager.cc | 22 +- src/Settings/SettingsManager.h | 12 +- src/ui/preferences/GeneralSettings.qml | 314 ++++++++++++--------- 15 files changed, 368 insertions(+), 291 deletions(-) create mode 100644 src/Settings/FlyView.SettingsGroup.json create mode 100644 src/Settings/FlyViewSettings.cc create mode 100644 src/Settings/FlyViewSettings.h delete mode 100644 src/Settings/Guided.SettingsGroup.json delete mode 100644 src/Settings/GuidedSettings.cc delete mode 100644 src/Settings/GuidedSettings.h create mode 100644 src/Settings/PlanView.SettingsGroup.json create mode 100644 src/Settings/PlanViewSettings.cc create mode 100644 src/Settings/PlanViewSettings.h diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index cef995c9b..f9af36141 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -599,7 +599,8 @@ HEADERS += \ src/Settings/AutoConnectSettings.h \ src/Settings/BrandImageSettings.h \ src/Settings/FlightMapSettings.h \ - src/Settings/GuidedSettings.h \ + src/Settings/FlyViewSettings.h \ + src/Settings/PlanViewSettings.h \ src/Settings/RTKSettings.h \ src/Settings/SettingsGroup.h \ src/Settings/SettingsManager.h \ @@ -797,7 +798,8 @@ SOURCES += \ src/Settings/AutoConnectSettings.cc \ src/Settings/BrandImageSettings.cc \ src/Settings/FlightMapSettings.cc \ - src/Settings/GuidedSettings.cc \ + src/Settings/FlyViewSettings.cc \ + src/Settings/PlanViewSettings.cc \ src/Settings/RTKSettings.cc \ src/Settings/SettingsGroup.cc \ src/Settings/SettingsManager.cc \ diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index ab82893d4..cf4f3bf54 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -220,7 +220,8 @@ src/MissionManager/CameraSection.FactMetaData.json src/Settings/FlightMap.SettingsGroup.json src/MissionManager/FWLandingPattern.FactMetaData.json - src/Settings/Guided.SettingsGroup.json + src/Settings/FlyView.SettingsGroup.json + src/Settings/PlanView.SettingsGroup.json src/MissionManager/MavCmdInfoCommon.json src/MissionManager/MavCmdInfoFixedWing.json src/MissionManager/MavCmdInfoMultiRotor.json diff --git a/src/FlightDisplay/GuidedAltitudeSlider.qml b/src/FlightDisplay/GuidedAltitudeSlider.qml index a4e61d726..9cf4c7f03 100644 --- a/src/FlightDisplay/GuidedAltitudeSlider.qml +++ b/src/FlightDisplay/GuidedAltitudeSlider.qml @@ -21,12 +21,12 @@ Rectangle { readonly property real _maxAlt: 121.92 // 400 feet readonly property real _minAlt: 3 - property var _guidedSettings: QGroundControl.settingsManager.guidedSettings - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle + property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property real _vehicleAltitude: _activeVehicle ? _activeVehicle.altitudeRelative.rawValue : 0 property bool _fixedWing: _activeVehicle ? _activeVehicle.fixedWing : false - property real _sliderMaxAlt: _guidedSettings ? (_fixedWing ? _guidedSettings.fixedWingMaximumAltitude.rawValue : _guidedSettings.vehicleMaximumAltitude.rawValue) : 0 - property real _sliderMinAlt: _guidedSettings ? (_fixedWing ? _guidedSettings.fixedWingMinimumAltitude.rawValue : _guidedSettings.vehicleMinimumAltitude.rawValue) : 0 + property real _sliderMaxAlt: _flyViewSettings ? _flyViewSettings.guidedMaximumAltitude.rawValue : 0 + property real _sliderMinAlt: _flyViewSettings ? _flyViewSettings.guidedMinimumAltitude.rawValue : 0 function reset() { altSlider.value = 0 diff --git a/src/Settings/FlyView.SettingsGroup.json b/src/Settings/FlyView.SettingsGroup.json new file mode 100644 index 000000000..3ee01ba31 --- /dev/null +++ b/src/Settings/FlyView.SettingsGroup.json @@ -0,0 +1,16 @@ +[ +{ + "name": "GuidedMinimumAltitude", + "shortDescription": "Minimum altitude for guided actions altitude slider.", + "type": "double", + "units": "m", + "defaultValue": 2 +}, +{ + "name": "GuidedMaximumAltitude", + "shortDescription": "Maximum altitude for guided actions altitude slider.", + "type": "double", + "units": "m", + "defaultValue": 121.92 +} +] diff --git a/src/Settings/FlyViewSettings.cc b/src/Settings/FlyViewSettings.cc new file mode 100644 index 000000000..4513df2c9 --- /dev/null +++ b/src/Settings/FlyViewSettings.cc @@ -0,0 +1,47 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#include "FlyViewSettings.h" +#include "QGCPalette.h" +#include "QGCApplication.h" + +#include +#include +#include + +const char* FlyViewSettings::name = "FlyView"; +const char* FlyViewSettings::settingsGroup = "FlyView"; + +const char* FlyViewSettings::guidedMinimumAltitudeName = "GuidedMinimumAltitude"; +const char* FlyViewSettings::guidedMaximumAltitudeName = "GuidedMaximumAltitude"; + +FlyViewSettings::FlyViewSettings(QObject* parent) + : SettingsGroup (name, settingsGroup, parent) + , _guidedMinimumAltitudeFact(NULL) + , _guidedMaximumAltitudeFact(NULL) +{ + QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); + qmlRegisterUncreatableType("QGroundControl.SettingsManager", 1, 0, "FlyViewSettings", "Reference only"); +} + +Fact* FlyViewSettings::guidedMinimumAltitude(void) +{ + if (!_guidedMinimumAltitudeFact) { + _guidedMinimumAltitudeFact = _createSettingsFact(guidedMinimumAltitudeName); + } + return _guidedMinimumAltitudeFact; +} + +Fact* FlyViewSettings::guidedMaximumAltitude(void) +{ + if (!_guidedMaximumAltitudeFact) { + _guidedMaximumAltitudeFact = _createSettingsFact(guidedMaximumAltitudeName); + } + return _guidedMaximumAltitudeFact; +} diff --git a/src/Settings/FlyViewSettings.h b/src/Settings/FlyViewSettings.h new file mode 100644 index 000000000..33628060f --- /dev/null +++ b/src/Settings/FlyViewSettings.h @@ -0,0 +1,36 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#pragma once + +#include "SettingsGroup.h" + +class FlyViewSettings : public SettingsGroup +{ + Q_OBJECT + +public: + FlyViewSettings(QObject* parent = NULL); + + Q_PROPERTY(Fact* guidedMinimumAltitude READ guidedMinimumAltitude CONSTANT) + Q_PROPERTY(Fact* guidedMaximumAltitude READ guidedMaximumAltitude CONSTANT) + + Fact* guidedMinimumAltitude(void); + Fact* guidedMaximumAltitude(void); + + static const char* name; + static const char* settingsGroup; + + static const char* guidedMinimumAltitudeName; + static const char* guidedMaximumAltitudeName; + +private: + SettingsFact* _guidedMinimumAltitudeFact; + SettingsFact* _guidedMaximumAltitudeFact; +}; diff --git a/src/Settings/Guided.SettingsGroup.json b/src/Settings/Guided.SettingsGroup.json deleted file mode 100644 index f1e827081..000000000 --- a/src/Settings/Guided.SettingsGroup.json +++ /dev/null @@ -1,26 +0,0 @@ -[ -{ - "name": "FixedWingMinimumAltitude", - "type": "double", - "units": "m", - "defaultValue": 10 -}, -{ - "name": "FixedWingMaximumAltitude", - "type": "double", - "units": "m", - "defaultValue": 121.92 -}, -{ - "name": "VehicleMinimumAltitude", - "type": "double", - "units": "m", - "defaultValue": 2 -}, -{ - "name": "VehicleMaximumAltitude", - "type": "double", - "units": "m", - "defaultValue": 121.92 -} -] diff --git a/src/Settings/GuidedSettings.cc b/src/Settings/GuidedSettings.cc deleted file mode 100644 index 9c81519bb..000000000 --- a/src/Settings/GuidedSettings.cc +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -#include "GuidedSettings.h" -#include "QGCPalette.h" -#include "QGCApplication.h" - -#include -#include -#include - -const char* GuidedSettings::name = "Guided"; -const char* GuidedSettings::settingsGroup = ""; // settings are in root group - -const char* GuidedSettings::fixedWingMinimumAltitudeName = "FixedWingMinimumAltitude"; -const char* GuidedSettings::fixedWingMaximumAltitudeName = "FixedWingMaximumAltitude"; -const char* GuidedSettings::vehicleMinimumAltitudeName = "VehicleMinimumAltitude"; -const char* GuidedSettings::vehicleMaximumAltitudeName = "VehicleMaximumAltitude"; - -GuidedSettings::GuidedSettings(QObject* parent) - : SettingsGroup(name, settingsGroup, parent) - , _fixedWingMinimumAltitudeFact (NULL) - , _fixedWingMaximumAltitudeFact (NULL) - , _vehicleMinimumAltitudeFact (NULL) - , _vehicleMaximumAltitudeFact (NULL) -{ - QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); - qmlRegisterUncreatableType("QGroundControl.SettingsManager", 1, 0, "GuidedSettings", "Reference only"); -} - -Fact* GuidedSettings::fixedWingMinimumAltitude(void) -{ - if (!_fixedWingMinimumAltitudeFact) { - _fixedWingMinimumAltitudeFact = _createSettingsFact(fixedWingMinimumAltitudeName); - } - - return _fixedWingMinimumAltitudeFact; -} - -Fact* GuidedSettings::fixedWingMaximumAltitude(void) -{ - if (!_fixedWingMaximumAltitudeFact) { - _fixedWingMaximumAltitudeFact = _createSettingsFact(fixedWingMaximumAltitudeName); - } - - return _fixedWingMaximumAltitudeFact; -} - -Fact* GuidedSettings::vehicleMinimumAltitude(void) -{ - if (!_vehicleMinimumAltitudeFact) { - _vehicleMinimumAltitudeFact = _createSettingsFact(vehicleMinimumAltitudeName); - } - return _vehicleMinimumAltitudeFact; -} - -Fact* GuidedSettings::vehicleMaximumAltitude(void) -{ - if (!_vehicleMaximumAltitudeFact) { - _vehicleMaximumAltitudeFact = _createSettingsFact(vehicleMaximumAltitudeName); - } - return _vehicleMaximumAltitudeFact; -} diff --git a/src/Settings/GuidedSettings.h b/src/Settings/GuidedSettings.h deleted file mode 100644 index 52bba3829..000000000 --- a/src/Settings/GuidedSettings.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -#ifndef GuidedSettings_H -#define GuidedSettings_H - -#include "SettingsGroup.h" -#include "QGCMAVLink.h" - -class GuidedSettings : public SettingsGroup -{ - Q_OBJECT - -public: - GuidedSettings(QObject* parent = NULL); - - // These min/max altitudes are used by the guided altitude slider - Q_PROPERTY(Fact* fixedWingMinimumAltitude READ fixedWingMinimumAltitude CONSTANT) - Q_PROPERTY(Fact* fixedWingMaximumAltitude READ fixedWingMaximumAltitude CONSTANT) - Q_PROPERTY(Fact* vehicleMinimumAltitude READ vehicleMinimumAltitude CONSTANT) - Q_PROPERTY(Fact* vehicleMaximumAltitude READ vehicleMaximumAltitude CONSTANT) - - Fact* fixedWingMinimumAltitude (void); - Fact* fixedWingMaximumAltitude (void); - Fact* vehicleMinimumAltitude (void); - Fact* vehicleMaximumAltitude (void); - - static const char* name; - static const char* settingsGroup; - - static const char* fixedWingMinimumAltitudeName; - static const char* fixedWingMaximumAltitudeName; - static const char* vehicleMinimumAltitudeName; - static const char* vehicleMaximumAltitudeName; - -private: - SettingsFact* _fixedWingMinimumAltitudeFact; - SettingsFact* _fixedWingMaximumAltitudeFact; - SettingsFact* _vehicleMinimumAltitudeFact; - SettingsFact* _vehicleMaximumAltitudeFact; -}; - -#endif diff --git a/src/Settings/PlanView.SettingsGroup.json b/src/Settings/PlanView.SettingsGroup.json new file mode 100644 index 000000000..0d4f101c7 --- /dev/null +++ b/src/Settings/PlanView.SettingsGroup.json @@ -0,0 +1,2 @@ +[ +] diff --git a/src/Settings/PlanViewSettings.cc b/src/Settings/PlanViewSettings.cc new file mode 100644 index 000000000..9e10f6257 --- /dev/null +++ b/src/Settings/PlanViewSettings.cc @@ -0,0 +1,23 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#include "PlanViewSettings.h" + +#include +#include + +const char* PlanViewSettings::name = "PlanView"; +const char* PlanViewSettings::settingsGroup = "PlanView"; + +PlanViewSettings::PlanViewSettings(QObject* parent) + : SettingsGroup(name, settingsGroup, parent) +{ + QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); + qmlRegisterUncreatableType("QGroundControl.SettingsManager", 1, 0, "PlanViewSettings", "Reference only"); +} diff --git a/src/Settings/PlanViewSettings.h b/src/Settings/PlanViewSettings.h new file mode 100644 index 000000000..6d14117b4 --- /dev/null +++ b/src/Settings/PlanViewSettings.h @@ -0,0 +1,26 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#pragma once + +#include "SettingsGroup.h" + +class PlanViewSettings : public SettingsGroup +{ + Q_OBJECT + +public: + PlanViewSettings(QObject* parent = NULL); + + // This is currently only used to set custom build visibility of the Plan view settings ui. + // The settings themselves related to PlanView are in still in AppSettings due to historical reasons. + + static const char* name; + static const char* settingsGroup; +}; diff --git a/src/Settings/SettingsManager.cc b/src/Settings/SettingsManager.cc index d002b4911..190f5a5d1 100644 --- a/src/Settings/SettingsManager.cc +++ b/src/Settings/SettingsManager.cc @@ -23,7 +23,8 @@ SettingsManager::SettingsManager(QGCApplication* app, QGCToolbox* toolbox) , _videoSettings (NULL) , _flightMapSettings (NULL) , _rtkSettings (NULL) - , _guidedSettings (NULL) + , _flyViewSettings (NULL) + , _planViewSettings (NULL) , _brandImageSettings (NULL) { @@ -35,15 +36,16 @@ void SettingsManager::setToolbox(QGCToolbox *toolbox) QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); qmlRegisterUncreatableType("QGroundControl.SettingsManager", 1, 0, "SettingsManager", "Reference only"); - _unitsSettings = new UnitsSettings(this); // Must be first since AppSettings references it - _appSettings = new AppSettings(this); - _autoConnectSettings = new AutoConnectSettings(this); - _videoSettings = new VideoSettings(this); - _flightMapSettings = new FlightMapSettings(this); - _rtkSettings = new RTKSettings(this); - _guidedSettings = new GuidedSettings(this); - _brandImageSettings = new BrandImageSettings(this); + _unitsSettings = new UnitsSettings (this); // Must be first since AppSettings references it + _appSettings = new AppSettings (this); + _autoConnectSettings = new AutoConnectSettings (this); + _videoSettings = new VideoSettings (this); + _flightMapSettings = new FlightMapSettings (this); + _rtkSettings = new RTKSettings (this); + _flyViewSettings = new FlyViewSettings (this); + _planViewSettings = new PlanViewSettings (this); + _brandImageSettings = new BrandImageSettings (this); #if defined(QGC_AIRMAP_ENABLED) - _airMapSettings = new AirMapSettings(this); + _airMapSettings = new AirMapSettings (this); #endif } diff --git a/src/Settings/SettingsManager.h b/src/Settings/SettingsManager.h index 5ee29a188..11fdacf48 100644 --- a/src/Settings/SettingsManager.h +++ b/src/Settings/SettingsManager.h @@ -20,7 +20,8 @@ #include "VideoSettings.h" #include "FlightMapSettings.h" #include "RTKSettings.h" -#include "GuidedSettings.h" +#include "FlyViewSettings.h" +#include "PlanViewSettings.h" #include "BrandImageSettings.h" #if defined(QGC_AIRMAP_ENABLED) #include "AirMapSettings.h" @@ -44,7 +45,8 @@ public: Q_PROPERTY(QObject* videoSettings READ videoSettings CONSTANT) Q_PROPERTY(QObject* flightMapSettings READ flightMapSettings CONSTANT) Q_PROPERTY(QObject* rtkSettings READ rtkSettings CONSTANT) - Q_PROPERTY(QObject* guidedSettings READ guidedSettings CONSTANT) + Q_PROPERTY(QObject* flyViewSettings READ flyViewSettings CONSTANT) + Q_PROPERTY(QObject* planViewSettings READ planViewSettings CONSTANT) Q_PROPERTY(QObject* brandImageSettings READ brandImageSettings CONSTANT) // Override from QGCTool @@ -59,7 +61,8 @@ public: VideoSettings* videoSettings (void) { return _videoSettings; } FlightMapSettings* flightMapSettings (void) { return _flightMapSettings; } RTKSettings* rtkSettings (void) { return _rtkSettings; } - GuidedSettings* guidedSettings (void) { return _guidedSettings; } + FlyViewSettings* flyViewSettings (void) { return _flyViewSettings; } + PlanViewSettings* planViewSettings (void) { return _planViewSettings; } BrandImageSettings* brandImageSettings (void) { return _brandImageSettings; } private: @@ -72,7 +75,8 @@ private: VideoSettings* _videoSettings; FlightMapSettings* _flightMapSettings; RTKSettings* _rtkSettings; - GuidedSettings* _guidedSettings; + FlyViewSettings* _flyViewSettings; + PlanViewSettings* _planViewSettings; BrandImageSettings* _brandImageSettings; }; diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index 37ea562da..2853c969f 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -257,22 +257,6 @@ QGCView { property Fact _telemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.telemetrySaveNotArmed } - FactCheckBox { - text: qsTr("Use preflight checklist") - fact: _useChecklist - visible: _useChecklist.visible - - property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist - } - - FactCheckBox { - text: qsTr("Virtual Joystick") - visible: _virtualJoystick.visible - fact: _virtualJoystick - - property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick - } - FactCheckBox { text: qsTr("AutoLoad Missions") fact: _autoLoad @@ -327,17 +311,6 @@ QGCView { enabled: announcePercentCheckbox.checked } } - - RowLayout { - spacing: ScreenTools.defaultFontPixelWidth - visible: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude.visible - - QGCLabel { text: qsTr("Default Mission Altitude") } - FactTextField { - Layout.preferredWidth: _valueFieldWidth - fact: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude - } - } } } @@ -377,6 +350,194 @@ QGCView { Item { width: 1; height: _margins } + QGCLabel { + id: flyViewSectionLabel + text: qsTr("Fly View") + visible: QGroundControl.settingsManager.flyViewSettings.visible + } + Rectangle { + Layout.preferredHeight: flyViewCol.height + (_margins * 2) + Layout.preferredWidth: flyViewCol.width + (_margins * 2) + color: qgcPal.windowShade + visible: flyViewSectionLabel.visible + Layout.fillWidth: true + + ColumnLayout { + id: flyViewCol + anchors.margins: _margins + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + spacing: _margins + + FactCheckBox { + text: qsTr("Use preflight checklist") + fact: _useChecklist + visible: _useChecklist.visible + + property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist + } + + FactCheckBox { + text: qsTr("Virtual Joystick") + visible: _virtualJoystick.visible + fact: _virtualJoystick + + property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick + } + + GridLayout { + columns: 2 + + QGCLabel { text: qsTr("Guided Minimum Altitude") } + FactTextField { + Layout.preferredWidth: _valueFieldWidth + fact: QGroundControl.settingsManager.flyViewSettings.guidedMinimumAltitude + } + + QGCLabel { text: qsTr("Guided Maximum Altitude") } + FactTextField { + Layout.preferredWidth: _valueFieldWidth + fact: QGroundControl.settingsManager.flyViewSettings.guidedMaximumAltitude + } + } + } + } + + Item { width: 1; height: _margins } + + QGCLabel { + id: planViewSectionLabel + text: qsTr("Plan View") + visible: QGroundControl.settingsManager.planViewSettings.visible + } + Rectangle { + Layout.preferredHeight: planViewCol.height + (_margins * 2) + Layout.preferredWidth: planViewCol.width + (_margins * 2) + color: qgcPal.windowShade + visible: planViewSectionLabel.visible + Layout.fillWidth: true + + ColumnLayout { + id: planViewCol + anchors.margins: _margins + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + spacing: _margins + + RowLayout { + spacing: ScreenTools.defaultFontPixelWidth + visible: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude.visible + + QGCLabel { text: qsTr("Default Mission Altitude") } + FactTextField { + Layout.preferredWidth: _valueFieldWidth + fact: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude + } + } + } + } + + Item { width: 1; height: _margins } + + QGCLabel { + id: autoConnectSectionLabel + text: qsTr("AutoConnect to the following devices") + visible: QGroundControl.settingsManager.autoConnectSettings.visible + } + Rectangle { + Layout.preferredWidth: autoConnectCol.width + (_margins * 2) + Layout.preferredHeight: autoConnectCol.height + (_margins * 2) + color: qgcPal.windowShade + visible: autoConnectSectionLabel.visible + Layout.fillWidth: true + + ColumnLayout { + id: autoConnectCol + anchors.margins: _margins + anchors.left: parent.left + anchors.top: parent.top + spacing: _margins + + RowLayout { + spacing: _margins + + Repeater { + id: autoConnectRepeater + model: [ QGroundControl.settingsManager.autoConnectSettings.autoConnectPixhawk, + QGroundControl.settingsManager.autoConnectSettings.autoConnectSiKRadio, + QGroundControl.settingsManager.autoConnectSettings.autoConnectPX4Flow, + QGroundControl.settingsManager.autoConnectSettings.autoConnectLibrePilot, + QGroundControl.settingsManager.autoConnectSettings.autoConnectUDP, + QGroundControl.settingsManager.autoConnectSettings.autoConnectRTKGPS + ] + + property var names: [ qsTr("Pixhawk"), qsTr("SiK Radio"), qsTr("PX4 Flow"), qsTr("LibrePilot"), qsTr("UDP"), qsTr("RTK GPS") ] + + FactCheckBox { + text: autoConnectRepeater.names[index] + fact: modelData + visible: modelData.visible + } + } + } + + GridLayout { + Layout.fillWidth: false + Layout.alignment: Qt.AlignHCenter + columns: 2 + visible: !ScreenTools.isMobile + && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.visible + && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.visible + + QGCLabel { + text: qsTr("NMEA GPS Device") + } + QGCComboBox { + id: nmeaPortCombo + Layout.preferredWidth: _comboFieldWidth + + model: ListModel { + ListElement { text: "disabled" } + } + + onActivated: { + if (index != -1) { + QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.value = textAt(index); + } + } + Component.onCompleted: { + for (var i in QGroundControl.linkManager.serialPorts) { + nmeaPortCombo.model.append({text:QGroundControl.linkManager.serialPorts[i]}) + } + var index = nmeaPortCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.valueString); + nmeaPortCombo.currentIndex = index; + } + } + + QGCLabel { + text: qsTr("NMEA GPS Baudrate") + } + QGCComboBox { + id: nmeaBaudCombo + Layout.preferredWidth: _comboFieldWidth + model: [4800, 9600, 19200, 38400, 57600, 115200] + + onActivated: { + if (index != -1) { + QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.value = textAt(index); + } + } + Component.onCompleted: { + var index = nmeaBaudCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.valueString); + nmeaBaudCombo.currentIndex = index; + } + } + } + } + } + + Item { width: 1; height: _margins } + QGCLabel { id: rtkSectionLabel text: qsTr("RTK GPS") @@ -519,105 +680,6 @@ QGCView { Item { width: 1; height: _margins } - QGCLabel { - id: autoConnectSectionLabel - text: qsTr("AutoConnect to the following devices") - visible: QGroundControl.settingsManager.autoConnectSettings.visible - } - Rectangle { - Layout.preferredWidth: autoConnectCol.width + (_margins * 2) - Layout.preferredHeight: autoConnectCol.height + (_margins * 2) - color: qgcPal.windowShade - visible: autoConnectSectionLabel.visible - Layout.fillWidth: true - - ColumnLayout { - id: autoConnectCol - anchors.margins: _margins - anchors.left: parent.left - anchors.top: parent.top - spacing: _margins - - RowLayout { - spacing: _margins - - Repeater { - id: autoConnectRepeater - model: [ QGroundControl.settingsManager.autoConnectSettings.autoConnectPixhawk, - QGroundControl.settingsManager.autoConnectSettings.autoConnectSiKRadio, - QGroundControl.settingsManager.autoConnectSettings.autoConnectPX4Flow, - QGroundControl.settingsManager.autoConnectSettings.autoConnectLibrePilot, - QGroundControl.settingsManager.autoConnectSettings.autoConnectUDP, - QGroundControl.settingsManager.autoConnectSettings.autoConnectRTKGPS - ] - - property var names: [ qsTr("Pixhawk"), qsTr("SiK Radio"), qsTr("PX4 Flow"), qsTr("LibrePilot"), qsTr("UDP"), qsTr("RTK GPS") ] - - FactCheckBox { - text: autoConnectRepeater.names[index] - fact: modelData - visible: modelData.visible - } - } - } - - GridLayout { - Layout.fillWidth: false - Layout.alignment: Qt.AlignHCenter - columns: 2 - visible: !ScreenTools.isMobile - && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.visible - && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.visible - - QGCLabel { - text: qsTr("NMEA GPS Device") - } - QGCComboBox { - id: nmeaPortCombo - Layout.preferredWidth: _comboFieldWidth - - model: ListModel { - ListElement { text: "disabled" } - } - - onActivated: { - if (index != -1) { - QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.value = textAt(index); - } - } - Component.onCompleted: { - for (var i in QGroundControl.linkManager.serialPorts) { - nmeaPortCombo.model.append({text:QGroundControl.linkManager.serialPorts[i]}) - } - var index = nmeaPortCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.valueString); - nmeaPortCombo.currentIndex = index; - } - } - - QGCLabel { - text: qsTr("NMEA GPS Baudrate") - } - QGCComboBox { - id: nmeaBaudCombo - Layout.preferredWidth: _comboFieldWidth - model: [4800, 9600, 19200, 38400, 57600, 115200] - - onActivated: { - if (index != -1) { - QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.value = textAt(index); - } - } - Component.onCompleted: { - var index = nmeaBaudCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.valueString); - nmeaBaudCombo.currentIndex = index; - } - } - } - } - } - - Item { width: 1; height: _margins } - QGCLabel { id: videoSectionLabel text: qsTr("Video") -- 2.22.0