diff --git a/qgcresources.qrc b/qgcresources.qrc
index 0ed46b8829b1ce5bd8562b002771293444acc8a6..049b2a4fdd3f4c70150fde0c5f32c130f25e1fb0 100644
--- a/qgcresources.qrc
+++ b/qgcresources.qrc
@@ -271,9 +271,15 @@
src/FirmwarePlugin/APM/APMParameterFactMetaData.Copter.3.4.xml
src/FirmwarePlugin/APM/APMParameterFactMetaData.Rover.3.0.xml
src/FirmwarePlugin/APM/APMParameterFactMetaData.Sub.3.4.xml
+ src/FirmwarePlugin/APM/CopterGeoFenceEditor.qml
+ src/FirmwarePlugin/APM/PlaneGeoFenceEditor.qml
+
+
+ src/FirmwarePlugin/GeoFenceEditor.qml
src/FirmwarePlugin/PX4/PX4ParameterFactMetaData.xml
+ src/FirmwarePlugin/PX4/PX4GeoFenceEditor.qml
resources/opengl/buglist.json
diff --git a/src/FactSystem/FactMetaData.cc b/src/FactSystem/FactMetaData.cc
index 14ad7be3ae8ad0ecfbd2ba22e72a2e9dd88691fb..e143d817a0d46ba9c7a2a3eed6766e45765bc790 100644
--- a/src/FactSystem/FactMetaData.cc
+++ b/src/FactSystem/FactMetaData.cc
@@ -593,7 +593,8 @@ size_t FactMetaData::typeToSize(ValueType_t type)
/// Set translators according to app settings
void FactMetaData::_setAppSettingsTranslators(void)
{
- if (!_enumStrings.count()) {
+ // We can only translate between real numbers
+ if (!_enumStrings.count() && (type() == valueTypeDouble || type() == valueTypeFloat)) {
for (size_t i=0; imultiRotor() ?
+ QStringLiteral("qrc:/FirmwarePlugin/APM/CopterGeoFenceEditor.qml") :
+ QStringLiteral("qrc:/FirmwarePlugin/APM/PlaneGeoFenceEditor.qml");
+}
diff --git a/src/FirmwarePlugin/APM/APMGeoFenceManager.h b/src/FirmwarePlugin/APM/APMGeoFenceManager.h
index 6141c5a08a10f7ef727dc69936ad0fefbcfb9ce7..918084bd6f93b70f63201d5a3e9848d6acd16605 100644
--- a/src/FirmwarePlugin/APM/APMGeoFenceManager.h
+++ b/src/FirmwarePlugin/APM/APMGeoFenceManager.h
@@ -33,6 +33,7 @@ public:
float circleRadius (void) const final;
QVariantList params (void) const final { return _params; }
QStringList paramLabels (void) const final { return _paramLabels; }
+ QString editorQml (void) const final;
private slots:
void _mavlinkMessageReceived(const mavlink_message_t& message);
diff --git a/src/FirmwarePlugin/APM/CopterGeoFenceEditor.qml b/src/FirmwarePlugin/APM/CopterGeoFenceEditor.qml
new file mode 100644
index 0000000000000000000000000000000000000000..16617acf106a2f10c23fc3392d18bca3b6ca8ef9
--- /dev/null
+++ b/src/FirmwarePlugin/APM/CopterGeoFenceEditor.qml
@@ -0,0 +1,87 @@
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+
+import QGroundControl 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.FactControls 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.FlightMap 1.0
+import QGroundControl.FactSystem 1.0
+
+Column {
+ id: editorColumn
+ width: availableWidth
+ spacing: _margin
+
+ //property real availableWidth - Available width for control - Must be passed in from Loader
+
+ readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
+ readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 15)
+
+ QGCLabel {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ wrapMode: Text.WordWrap
+ text: qsTr("Click in map to set breach return point.")
+ visible: geoFenceController.breachReturnSupported
+ }
+
+ QGCLabel { text: qsTr("Fence Settings:") }
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 1
+ color: qgcPal.text
+ }
+
+ QGCLabel {
+ text: qsTr("Must be connected to Vehicle to change fence settings.")
+ visible: !QGroundControl.multiVehicleManager.activeVehicle
+ }
+
+ Repeater {
+ model: geoFenceController.params
+
+ Item {
+ width: editorColumn.width
+ height: textField.height
+
+ QGCLabel {
+ id: textFieldLabel
+ anchors.baseline: textField.baseline
+ text: geoFenceController.paramLabels[index]
+ }
+
+ FactTextField {
+ id: textField
+ anchors.right: parent.right
+ width: _editFieldWidth
+ showUnits: true
+ fact: modelData
+ visible: !comboField.visible
+ }
+
+ FactComboBox {
+ id: comboField
+ anchors.right: parent.right
+ width: _editFieldWidth
+ indexModel: false
+ fact: visible ? modelData : _nullFact
+ visible: modelData.enumStrings.length
+
+ property var _nullFact: Fact { }
+ }
+ }
+ }
+
+ QGCMapPolygonControls {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ flightMap: editorMap
+ polygon: root.polygon
+ sectionLabel: qsTr("Fence Polygon:")
+ visible: geoFenceController.polygonSupported
+ }
+}
diff --git a/src/FirmwarePlugin/APM/PlaneGeoFenceEditor.qml b/src/FirmwarePlugin/APM/PlaneGeoFenceEditor.qml
new file mode 100644
index 0000000000000000000000000000000000000000..ce2a1e76a64ba8fe462e63ce86b789cb012730a9
--- /dev/null
+++ b/src/FirmwarePlugin/APM/PlaneGeoFenceEditor.qml
@@ -0,0 +1,224 @@
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+
+import QGroundControl 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.FactControls 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.FlightMap 1.0
+import QGroundControl.FactSystem 1.0
+
+Column {
+ id: editorColumn
+ width: availableWidth
+ spacing: _margin
+
+ //property real availableWidth - Available width for control - Must be passed in from Loader
+
+ readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
+ readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 15)
+
+ property Fact fenceAction: factController.getParameterFact(-1, "FENCE_ACTION")
+ property Fact fenceMinAlt: factController.getParameterFact(-1, "FENCE_MINALT")
+ property Fact fenceMaxAlt: factController.getParameterFact(-1, "FENCE_MAXALT")
+ property Fact fenceRetAlt: factController.getParameterFact(-1, "FENCE_RETALT")
+ property Fact fenceAutoEnable: factController.getParameterFact(-1, "FENCE_AUTOENABLE")
+ property Fact fenceRetRally: factController.getParameterFact(-1, "FENCE_RET_RALLY")
+
+ FactPanelController {
+ id: factController
+ factPanel: qgcView.viewPanel
+ }
+
+ Connections {
+ target: fenceAction
+ onValueChanged: actionCombo.recalcSelection()
+ }
+
+ Connections {
+ target: fenceRetRally
+ onValueChanged: actionCombo.recalcSelection()
+ }
+
+
+ QGCLabel { text: qsTr("Fence Settings:") }
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 1
+ color: qgcPal.text
+ }
+
+ QGCLabel { text: qsTr("Action on fence breach:") }
+
+ QGCComboBox {
+ id: actionCombo
+ anchors.leftMargin: ScreenTools.defaultFontPixelWidth
+ anchors.left: parent.left
+ anchors.right: parent.right
+ model: ListModel {
+ id: actionModel
+ ListElement { text: qsTr("None"); actionValue: 0; retRallyValue: 0 }
+ ListElement { text: qsTr("Report only"); actionValue: 2; retRallyValue: 0 }
+ ListElement { text: qsTr("Fly to breach return point"); actionValue: 1; retRallyValue: 0 }
+ ListElement { text: qsTr("Fly to breach return point (throttle control)"); actionValue: 3; retRallyValue: 0 }
+ ListElement { text: qsTr("Fly to nearest rally point"); actionValue: 4; retRallyValue: 1 }
+ }
+
+ onActivated: {
+ fenceAction.value = actionModel.get(index).actionValue
+ fenceRetRally.value = actionModel.get(index).retRallyValue
+ }
+
+ function recalcSelection() {
+ if (fenceAction.value != 0 && fenceRetRally.value == 1) {
+ actionCombo.currentIndex = 4
+ } else {
+ switch (fenceAction.value) {
+ case 0:
+ actionCombo.currentIndex = 0
+ break
+ case 1:
+ actionCombo.currentIndex = 2
+ break
+ case 2:
+ actionCombo.currentIndex = 1
+ break
+ case 3:
+ actionCombo.currentIndex = 3
+ break
+ case 4:
+ actionCombo.currentIndex = 4
+ break
+ case 0:
+ default:
+ actionCombo.currentIndex = 0
+ break
+ }
+ }
+ }
+ }
+
+ Item { width: 1; height: 1 }
+
+ QGCCheckBox {
+ id: minAltFenceCheckBox
+ text: qsTr("Minimum altitude fence")
+ checked: fenceMinAlt.value > 0
+ onClicked: fenceMinAlt.value = checked ? 10 : 0
+ }
+
+ Row {
+ anchors.margins: ScreenTools.defaultFontPixelWidth
+ anchors.left: parent.left
+ spacing: _margin
+
+ QGCLabel {
+ anchors.baseline: fenceAltMinField.baseline
+ text: qsTr("Min Altitude:")
+ }
+
+ FactTextField {
+ id: fenceAltMinField
+ showUnits: true
+ fact: fenceMinAlt
+ enabled: minAltFenceCheckBox.checked
+ width: _editFieldWidth
+ }
+ }
+
+ Item { width: 1; height: 1 }
+
+ QGCCheckBox {
+ id: maxAltFenceCheckBox
+ text: qsTr("Maximum altitude fence")
+ checked: fenceMaxAlt.value > 0
+ onClicked: fenceMaxAlt.value = checked ? 100 : 0
+ }
+
+ Row {
+ anchors.margins: ScreenTools.defaultFontPixelWidth
+ anchors.left: parent.left
+ spacing: _margin
+
+ QGCLabel {
+ anchors.baseline: fenceAltMaxField.baseline
+ text: qsTr("Max Altitude:")
+ }
+
+ FactTextField {
+ id: fenceAltMaxField
+ showUnits: true
+ fact: fenceMaxAlt
+ enabled: maxAltFenceCheckBox.checked
+ width: _editFieldWidth
+ }
+ }
+
+ Item { width: 1; height: 1 }
+
+ QGCLabel { text: qsTr("Breach return point:") }
+
+ QGCLabel {
+ anchors.margins: ScreenTools.defaultFontPixelWidth
+ anchors.left: parent.left
+ anchors.right: parent.right
+ wrapMode: Text.WordWrap
+ text: qsTr("Click in map to set breach return location.")
+ }
+
+ Row {
+ anchors.margins: ScreenTools.defaultFontPixelWidth
+ anchors.left: parent.left
+ spacing: _margin
+
+ QGCLabel {
+ anchors.baseline: retAltField.baseline
+ text: qsTr("Return Alt:")
+ }
+
+ FactTextField {
+ id: retAltField
+ showUnits: true
+ fact: fenceRetAlt
+ width: _editFieldWidth
+ }
+ }
+
+ Item { width: 1; height: 1 }
+
+ FactCheckBox {
+ text: qsTr("Auto-Enable after takeoff")
+ fact: fenceAutoEnable
+ }
+
+ QGCLabel {
+ anchors.margins: ScreenTools.defaultFontPixelWidth
+ anchors.left: parent.left
+ anchors.right: parent.right
+ wrapMode: Text.WordWrap
+ font.pointSize: ScreenTools.smallFontPointSize
+ text: qsTr("If checked, the aircraft will start with the fence disabled. After an autonomous takeoff completes the fences will automatically enable. When the autonomous mission arrives at a landing waypoint the fence automatically disables.")
+ }
+
+ /*
+ FENCE_ACTION - the action to take on fence breach. This defaults to zero which disables geo-fencing. Set it to 1 to enable geo-fencing and fly to the return point on fence breach. Set to 2 to report a breach to the GCS but take no other action. Set to 3 to have the plane head to the return point on breach, but the pilot will maintain manual throttle control in this case.
+ FENCE_MINALT - the minimum altitude in meters. If this is zero then you will not have a minimum altitude.
+ FENCE_MAXALT - the maximum altitude in meters. If this is zero then you will not have a maximum altitude.
+ FENCE_CHANNEL - the RC input channel to watch for enabling the geo-fence. This defaults to zero, which disables geo-fencing. You should set it to a spare RC input channel that is connected to a two position switch on your transmitter. Fencing will be enabled when this channel goes above a PWM value of 1750. If your transmitter supports it it is also a good idea to enable audible feedback when this channel is enabled (a beep every few seconds), so you can tell if the fencing is enabled without looking down.
+ FENCE_TOTAL - the number of points in your fence (the return point plus the enclosed boundary). This should be set for you by the planner when you create the fence.
+ FENCE_RETALT - the altitude the aircraft will fly at when flying to the return point and when loitering at the return point (in meters). Note that when FENCE_RET_RALLY is set to 1 this parameter is ignored and the loiter altitude of the closest Rally Point is used instead. If this parameter is zero and FENCE_RET_RALLY is also zero, the midpoint of the FENCE_MAXALT and FENCE_MINALT parameters is used as the return altitude.
+ FENCE_AUTOENABLE - if set to 1, the aircraft will boot with the fence disabled. After an autonomous takeoff completes the fences will automatically enable. When the autonomous mission arrives at a landing waypoint the fence automatically disables.
+ FENCE_RET_RALLY - if set to 1 the aircraft will head to the nearest Rally Point rather than the fence return point when the fence is breached. Note that the loiter altitude of the Rally Point is used as the return altitude.
+ */
+
+ QGCMapPolygonControls {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ flightMap: editorMap
+ polygon: root.polygon
+ sectionLabel: qsTr("Fence Polygon:")
+ }
+}
diff --git a/src/FirmwarePlugin/GeoFenceEditor.qml b/src/FirmwarePlugin/GeoFenceEditor.qml
new file mode 100644
index 0000000000000000000000000000000000000000..7b5174a44793b456111935d355864a5de895c655
--- /dev/null
+++ b/src/FirmwarePlugin/GeoFenceEditor.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+
+import QGroundControl 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.FactControls 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.FlightMap 1.0
+import QGroundControl.FactSystem 1.0
+
+QGCLabel {
+ width: availableWidth
+ wrapMode: Text.WordWrap
+ text: qsTr("This vehicle does tno support GeoFence.")
+
+ //property var contoller - controller - Must be passed in from Loader
+ //property real availableWidth - Available width for control - Must be passed in from Loader
+}
diff --git a/src/FirmwarePlugin/PX4/PX4GeoFenceEditor.qml b/src/FirmwarePlugin/PX4/PX4GeoFenceEditor.qml
new file mode 100644
index 0000000000000000000000000000000000000000..060bc4eaf5395adbe9195da3afe302937b4deab8
--- /dev/null
+++ b/src/FirmwarePlugin/PX4/PX4GeoFenceEditor.qml
@@ -0,0 +1,105 @@
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+
+import QGroundControl 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.FactControls 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.FlightMap 1.0
+import QGroundControl.FactSystem 1.0
+import QGroundControl.Controllers 1.0
+
+Column {
+ id: editorColumn
+ width: availableWidth
+ spacing: _margin
+
+ //property real availableWidth - Available width for control - Must be passed in from Loader
+
+ readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
+ readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 15)
+
+ property Fact _fenceAction: factController.getParameterFact(-1, "GF_ACTION")
+ property Fact _fenceRadius: factController.getParameterFact(-1, "GF_MAX_HOR_DIST")
+ property Fact _fenceAlt: factController.getParameterFact(-1, "GF_MAX_VER_DIST")
+
+ FactPanelController {
+ id: factController
+ factPanel: qgcView.viewPanel
+ }
+
+ QGCLabel { text: qsTr("Fence Settings:") }
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 1
+ color: qgcPal.text
+ }
+
+ QGCLabel { text: qsTr("Action on fence breach:") }
+ FactComboBox {
+ anchors.margins: ScreenTools.defaultFontPixelWidth
+ anchors.left: parent.left
+ width: _editFieldWidth
+ fact: _fenceAction
+ indexModel: false
+ }
+
+ Item { width: 1; height: 1 }
+
+ QGCCheckBox {
+ id: circleFenceCheckBox
+ text: qsTr("Circular fence around home pos")
+ checked: _fenceRadius.value > 0
+ onClicked: _fenceRadius.value = checked ? 100 : 0
+ }
+
+ Row {
+ anchors.margins: ScreenTools.defaultFontPixelWidth
+ anchors.left: parent.left
+ spacing: _margin
+
+ QGCLabel {
+ anchors.baseline: fenceRadiusField.baseline
+ text: qsTr("Radius:")
+ }
+
+ FactTextField {
+ id: fenceRadiusField
+ showUnits: true
+ fact: _fenceRadius
+ enabled: circleFenceCheckBox.checked
+ width: _editFieldWidth
+ }
+ }
+
+ Item { width: 1; height: 1 }
+
+ QGCCheckBox {
+ id: maxAltFenceCheckBox
+ text: qsTr("Maximum altitude fence")
+ checked: _fenceAlt.value > 0
+ onClicked: _fenceAlt.value = checked ? 100 : 0
+ }
+
+ Row {
+ anchors.margins: ScreenTools.defaultFontPixelWidth
+ anchors.left: parent.left
+ spacing: _margin
+
+ QGCLabel {
+ anchors.baseline: fenceAltMaxField.baseline
+ text: qsTr("Altitude:")
+ }
+
+ FactTextField {
+ id: fenceAltMaxField
+ showUnits: true
+ fact: _fenceAlt
+ enabled: maxAltFenceCheckBox.checked
+ width: _editFieldWidth
+ }
+ }
+}
diff --git a/src/FirmwarePlugin/PX4/PX4GeoFenceManager.h b/src/FirmwarePlugin/PX4/PX4GeoFenceManager.h
index 3101da89ed9b40b7465203e04e95d7f19062a5b6..fbeed77746d9198a7a98faf06182c7bebd9f7eab 100644
--- a/src/FirmwarePlugin/PX4/PX4GeoFenceManager.h
+++ b/src/FirmwarePlugin/PX4/PX4GeoFenceManager.h
@@ -28,6 +28,7 @@ public:
float circleRadius (void) const final;
QVariantList params (void) const final { return _params; }
QStringList paramLabels (void) const final { return _paramLabels; }
+ QString editorQml (void) const final { return QStringLiteral("qrc:/FirmwarePlugin/PX4/PX4GeoFenceEditor.qml"); }
private slots:
void _circleRadiusRawValueChanged(QVariant value);
diff --git a/src/MissionEditor/GeoFenceEditor.qml b/src/MissionEditor/GeoFenceEditor.qml
index 933ed48aec1282595b6eeffa584897c6b299bdf0..af02df40e92f7caa4737a1de9600bfa03e3c10c7 100644
--- a/src/MissionEditor/GeoFenceEditor.qml
+++ b/src/MissionEditor/GeoFenceEditor.qml
@@ -4,10 +4,6 @@ import QtQuick.Controls 1.2
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
-import QGroundControl.FactControls 1.0
-import QGroundControl.Palette 1.0
-import QGroundControl.FlightMap 1.0
-import QGroundControl.FactSystem 1.0
QGCFlickable {
id: root
@@ -54,83 +50,29 @@ QGCFlickable {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: geoFenceLabel.bottom
- height: editorColumn.height + (_margin * 2)
+ height: editorLoader.y + editorLoader.height + (_margin * 2)
color: qgcPal.windowShadeDark
radius: _radius
- Column {
- id: editorColumn
+ QGCLabel {
+ id: geoLabel
anchors.margins: _margin
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
- spacing: _margin
-
- QGCLabel {
- anchors.left: parent.left
- anchors.right: parent.right
- wrapMode: Text.WordWrap
- text: qsTr("Click in map to set breach return point.")
- visible: geoFenceController.breachReturnSupported
- }
-
- QGCLabel { text: qsTr("Fence Settings:") }
-
- Rectangle {
- anchors.left: parent.left
- anchors.right: parent.right
- height: 1
- color: qgcPal.text
- }
-
- QGCLabel {
- text: qsTr("Must be connected to Vehicle to change fence settings.")
- visible: !QGroundControl.multiVehicleManager.activeVehicle
- }
-
- Repeater {
- model: geoFenceController.params
-
- Item {
- width: editorColumn.width
- height: textField.height
-
- QGCLabel {
- id: textFieldLabel
- anchors.baseline: textField.baseline
- text: geoFenceController.paramLabels[index]
- }
-
- FactTextField {
- id: textField
- anchors.right: parent.right
- width: _editFieldWidth
- showUnits: true
- fact: modelData
- visible: !comboField.visible
- }
-
- FactComboBox {
- id: comboField
- anchors.right: parent.right
- width: _editFieldWidth
- indexModel: false
- fact: visible ? modelData : _nullFact
- visible: modelData.enumStrings.length
+ wrapMode: Text.WordWrap
+ font.pointSize: ScreenTools.smallFontPointSize
+ text: qsTr("GeoFencing allows you to set a virtual ‘fence’ around the area you want to fly in.")
+ }
- property var _nullFact: Fact { }
- }
- }
- }
+ Loader {
+ id: editorLoader
+ anchors.margins: _margin
+ anchors.top: geoLabel.bottom
+ anchors.left: parent.left
+ source: geoFenceController.editorQml
- QGCMapPolygonControls {
- anchors.left: parent.left
- anchors.right: parent.right
- flightMap: editorMap
- polygon: root.polygon
- sectionLabel: qsTr("Fence Polygon:")
- visible: geoFenceController.polygonSupported
- }
+ property real availableWidth: parent.width - (_margin * 2)
}
}
}
diff --git a/src/MissionEditor/MissionEditor.qml b/src/MissionEditor/MissionEditor.qml
index 97bc41af9006cd454f2b1e949f1724443d654695..03a3923e7f7782ce245e93aaaa92c7aa6fb5e006 100644
--- a/src/MissionEditor/MissionEditor.qml
+++ b/src/MissionEditor/MissionEditor.qml
@@ -26,9 +26,8 @@ import QGroundControl.Controllers 1.0
/// Mission Editor
QGCView {
- id: _root
-
- viewPanel: panel
+ id: qgcView
+ viewPanel: panel
// zOrder comes from the Loader in MainWindow.qml
z: QGroundControl.zOrderTopMost
@@ -124,7 +123,7 @@ QGCView {
function loadFromSelectedFile() {
if (ScreenTools.isMobile) {
- _root.showDialog(mobileFilePicker, qsTr("Select Mission File"), _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
+ qgcView.showDialog(mobileFilePicker, qsTr("Select Mission File"), qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
} else {
missionController.loadFromFilePicker()
fitViewportToMissionItems()
@@ -134,7 +133,7 @@ QGCView {
function saveToSelectedFile() {
if (ScreenTools.isMobile) {
- _root.showDialog(mobileFileSaver, qsTr("Save Mission File"), _root.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
+ qgcView.showDialog(mobileFileSaver, qsTr("Save Mission File"), qgcView.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
} else {
missionController.saveToFilePicker()
}
@@ -255,7 +254,7 @@ QGCView {
FlightMap {
id: editorMap
- height: _root.height
+ height: qgcView.height
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
@@ -548,7 +547,6 @@ QGCView {
delegate: MissionItemEditor {
missionItem: object
width: parent.width
- qgcView: _root
readOnly: false
onClicked: setCurrentItem(object.sequenceNumber)
@@ -892,7 +890,7 @@ QGCView {
onClicked: {
syncButton.hideDropDown()
if (_syncDropDownController.dirty) {
- _root.showDialog(syncLoadFromVehicleOverwrite, columnHolder._overwriteText, _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
+ qgcView.showDialog(syncLoadFromVehicleOverwrite, columnHolder._overwriteText, qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
} else {
_syncDropDownController.loadFromVehicle()
}
@@ -916,7 +914,7 @@ QGCView {
onClicked: {
syncButton.hideDropDown()
if (_syncDropDownController.dirty) {
- _root.showDialog(syncLoadFromFileOverwrite, columnHolder._overwriteText, _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
+ qgcView.showDialog(syncLoadFromFileOverwrite, columnHolder._overwriteText, qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
} else {
_syncDropDownController.loadFromSelectedFile()
}
@@ -929,7 +927,7 @@ QGCView {
onClicked: {
syncButton.hideDropDown()
_syncDropDownController.removeAll()
- _root.showDialog(removeAllPromptDialog, qsTr("Remove all"), _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No)
+ qgcView.showDialog(removeAllPromptDialog, qsTr("Remove all"), qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No)
}
}
}
diff --git a/src/MissionManager/GeoFenceController.cc b/src/MissionManager/GeoFenceController.cc
index bdea38f366180b81d32426055ebef92f95d75580..953f91102e757eb8684feb4add2ddd11ae8d11c4 100644
--- a/src/MissionManager/GeoFenceController.cc
+++ b/src/MissionManager/GeoFenceController.cc
@@ -59,6 +59,7 @@ void GeoFenceController::_signalAll(void)
emit circleRadiusChanged(circleRadius());
emit paramsChanged(params());
emit paramLabelsChanged(paramLabels());
+ emit editorQmlChanged(editorQml());
}
void GeoFenceController::_activeVehicleBeingRemoved(Vehicle* vehicle)
@@ -254,3 +255,13 @@ QStringList GeoFenceController::paramLabels(void) const
return QStringList();
}
}
+
+QString GeoFenceController::editorQml(void) const
+{
+ if (_activeVehicle) {
+ return _activeVehicle->geoFenceManager()->editorQml();
+ } else {
+ // FIXME: Offline editing support
+ return QString();
+ }
+}
diff --git a/src/MissionManager/GeoFenceController.h b/src/MissionManager/GeoFenceController.h
index 52cb99e3bb6652dfd47b3de6e4af762d7e95c4d9..d09895f28932ed2d2376a166a839a4a5631aa960 100644
--- a/src/MissionManager/GeoFenceController.h
+++ b/src/MissionManager/GeoFenceController.h
@@ -36,6 +36,7 @@ public:
Q_PROPERTY(QGeoCoordinate breachReturnPoint READ breachReturnPoint WRITE setBreachReturnPoint NOTIFY breachReturnPointChanged)
Q_PROPERTY(QVariantList params READ params NOTIFY paramsChanged)
Q_PROPERTY(QStringList paramLabels READ paramLabels NOTIFY paramLabelsChanged)
+ Q_PROPERTY(QString editorQml READ editorQml NOTIFY editorQmlChanged)
void start (bool editMode) final;
void loadFromVehicle (void) final;
@@ -58,6 +59,7 @@ public:
QGeoCoordinate breachReturnPoint (void) const { return _breachReturnPoint; }
QVariantList params (void) const;
QStringList paramLabels (void) const;
+ QString editorQml (void) const;
public slots:
void setBreachReturnPoint(const QGeoCoordinate& breachReturnPoint);
@@ -72,6 +74,7 @@ signals:
void breachReturnPointChanged (QGeoCoordinate breachReturnPoint);
void paramsChanged (QVariantList params);
void paramLabelsChanged (QStringList paramLabels);
+ void editorQmlChanged (QString editorQml);
private slots:
void _polygonDirtyChanged(bool dirty);
diff --git a/src/MissionManager/GeoFenceManager.h b/src/MissionManager/GeoFenceManager.h
index 4a0f4e68dc02572d72fa0bd25297815c1296033a..fcc56813dcf21c91de4ab45bec8de28fc9dd295b 100644
--- a/src/MissionManager/GeoFenceManager.h
+++ b/src/MissionManager/GeoFenceManager.h
@@ -52,6 +52,8 @@ public:
virtual QVariantList params (void) const { return QVariantList(); }
virtual QStringList paramLabels (void) const { return QStringList(); }
+ virtual QString editorQml(void) const { return QStringLiteral("qrc:/FirmwarePlugin/GeoFenceEditor.qml"); }
+
void setPolygon(QGCMapPolygon* polygon);
void setBreachReturnPoint(const QGeoCoordinate& breachReturnPoint);
diff --git a/src/QmlControls/MissionItemEditor.qml b/src/QmlControls/MissionItemEditor.qml
index b2f0bc1091fba7b52329e52a9fd9901220105058..7dbb41bf8039393af0e16a128800d626b66d67fb 100644
--- a/src/QmlControls/MissionItemEditor.qml
+++ b/src/QmlControls/MissionItemEditor.qml
@@ -20,7 +20,6 @@ Rectangle {
property var missionItem ///< MissionItem associated with this editor
property bool readOnly ///< true: read only view, false: full editing view
- property var qgcView ///< QGCView control used for showing dialogs
signal clicked
signal remove