From b6e722c63e365d2108e30702aab50df4965c190c Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Mon, 29 Jun 2015 11:59:36 -0700 Subject: [PATCH] Convert to QGCView --- src/AutoPilotPlugins/PX4/SafetyComponent.qml | 429 ++++++++++--------- 1 file changed, 218 insertions(+), 211 deletions(-) diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.qml b/src/AutoPilotPlugins/PX4/SafetyComponent.qml index b0d70c797..89a27a513 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.qml +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.qml @@ -31,11 +31,12 @@ import QGroundControl.Palette 1.0 import QGroundControl.Controls 1.0 import QGroundControl.ScreenTools 1.0 -FactPanel { - id: panel +QGCView { + id: rootQGCView + viewPanel: view QGCPalette { id: palette; colorGroupEnabled: enabled } - FactPanelController { id: controller; factPanel: panel } + FactPanelController { id: controller; factPanel: rootQGCView } property int flightLineWidth: 2 // width of lines for flight graphic property int loiterAltitudeColumnWidth: 180 // width of loiter altitude column @@ -47,265 +48,271 @@ FactPanel { property int arrowWidth: 18 // width for arrow graphic property int firstColumnWidth: 220 // Width of first column in return home triggers area - Column { + QGCView { + id: view + anchors.fill: parent - QGCLabel { - text: "SAFETY CONFIG" - font.pixelSize: ScreenTools.largeFontPixelSize - } + Column { + anchors.fill: parent - Item { height: 20; width: 10 } // spacer + QGCLabel { + text: "SAFETY CONFIG" + font.pixelSize: ScreenTools.largeFontPixelSize + } - //----------------------------------------------------------------- - //-- Return Home Triggers + Item { height: 20; width: 10 } // spacer - QGCLabel { text: "Triggers For Return Home"; font.pixelSize: ScreenTools.mediumFontPixelSize; } + //----------------------------------------------------------------- + //-- Return Home Triggers - Item { height: 10; width: 10 } // spacer + QGCLabel { text: "Triggers For Return Home"; font.pixelSize: ScreenTools.mediumFontPixelSize; } - Rectangle { - width: parent.width - height: triggerColumn.height - color: palette.windowShade + Item { height: 10; width: 10 } // spacer - Column { - id: triggerColumn - spacing: controlVerticalSpacing - anchors.margins: shadedMargin - anchors.left: parent.left + Rectangle { + width: parent.width + height: triggerColumn.height + color: palette.windowShade - // Top margin - Item { height: 1; width: 10 } + Column { + id: triggerColumn + spacing: controlVerticalSpacing + anchors.margins: shadedMargin + anchors.left: parent.left - Row { - spacing: 10 - QGCLabel { text: "RC Transmitter Signal Loss"; width: firstColumnWidth; anchors.baseline: rcLossField.baseline } - QGCLabel { text: "Return Home after"; anchors.baseline: rcLossField.baseline } - FactTextField { - id: rcLossField - fact: controller.getParameterFact(-1, "COM_RC_LOSS_T") - showUnits: true - } - } + // Top margin + Item { height: 1; width: 10 } - Row { - spacing: 10 - FactCheckBox { - id: telemetryTimeoutCheckbox - anchors.baseline: telemetryLossField.baseline - width: firstColumnWidth - fact: controller.getParameterFact(-1, "COM_DL_LOSS_EN") - checkedValue: 1 - uncheckedValue: 0 - text: "Telemetry Signal Timeout" + Row { + spacing: 10 + QGCLabel { text: "RC Transmitter Signal Loss"; width: firstColumnWidth; anchors.baseline: rcLossField.baseline } + QGCLabel { text: "Return Home after"; anchors.baseline: rcLossField.baseline } + FactTextField { + id: rcLossField + fact: controller.getParameterFact(-1, "COM_RC_LOSS_T") + showUnits: true + } } - QGCLabel { text: "Return Home after"; anchors.baseline: telemetryLossField.baseline } - FactTextField { - id: telemetryLossField - fact: controller.getParameterFact(-1, "COM_DL_LOSS_T") - showUnits: true - enabled: telemetryTimeoutCheckbox.checked + + Row { + spacing: 10 + FactCheckBox { + id: telemetryTimeoutCheckbox + anchors.baseline: telemetryLossField.baseline + width: firstColumnWidth + fact: controller.getParameterFact(-1, "COM_DL_LOSS_EN") + checkedValue: 1 + uncheckedValue: 0 + text: "Telemetry Signal Timeout" + } + QGCLabel { text: "Return Home after"; anchors.baseline: telemetryLossField.baseline } + FactTextField { + id: telemetryLossField + fact: controller.getParameterFact(-1, "COM_DL_LOSS_T") + showUnits: true + enabled: telemetryTimeoutCheckbox.checked + } } - } - // Bottom margin - Item { height: 1; width: 10 } + // Bottom margin + Item { height: 1; width: 10 } + } } - } - - Item { height: 20; width: 10 } // spacer - //----------------------------------------------------------------- - //-- Return Home Settings + Item { height: 20; width: 10 } // spacer - QGCLabel { text: "Return Home Settings"; font.pixelSize: ScreenTools.mediumFontPixelSize; } + //----------------------------------------------------------------- + //-- Return Home Settings - Item { height: 10; width: 10 } // spacer + QGCLabel { text: "Return Home Settings"; font.pixelSize: ScreenTools.mediumFontPixelSize; } - Rectangle { - width: parent.width - height: settingsColumn.height - color: palette.windowShade + Item { height: 10; width: 10 } // spacer - Column { - id: settingsColumn - width: parent.width - anchors.margins: shadedMargin - anchors.left: parent.left + Rectangle { + width: parent.width + height: settingsColumn.height + color: palette.windowShade - Item { height: shadedMargin; width: 10 } // top margin + Column { + id: settingsColumn + width: parent.width + anchors.margins: shadedMargin + anchors.left: parent.left - // This item is the holder for the climb alt and loiter seconds fields - Item { - width: parent.width - height: climbAltitudeColumn.height + Item { height: shadedMargin; width: 10 } // top margin - Column { - id: climbAltitudeColumn - spacing: controlVerticalSpacing - - QGCLabel { text: "Climb to altitude of" } - FactTextField { - id: climbField - fact: controller.getParameterFact(-1, "RTL_RETURN_ALT") - showUnits: true + // This item is the holder for the climb alt and loiter seconds fields + Item { + width: parent.width + height: climbAltitudeColumn.height + + Column { + id: climbAltitudeColumn + spacing: controlVerticalSpacing + + QGCLabel { text: "Climb to altitude of" } + FactTextField { + id: climbField + fact: controller.getParameterFact(-1, "RTL_RETURN_ALT") + showUnits: true + } } - } - Column { - x: flightGraphic.width - 200 - spacing: controlVerticalSpacing + Column { + x: flightGraphic.width - 200 + spacing: controlVerticalSpacing - QGCCheckBox { - id: homeLoiterCheckbox - checked: fact.value > 0 - text: "Loiter at Home altitude for" + QGCCheckBox { + id: homeLoiterCheckbox + checked: fact.value > 0 + text: "Loiter at Home altitude for" - property Fact fact: controller.getParameterFact(-1, "RTL_LAND_DELAY") + property Fact fact: controller.getParameterFact(-1, "RTL_LAND_DELAY") - onClicked: { - fact.value = checked ? 60 : -1 + onClicked: { + fact.value = checked ? 60 : -1 + } } - } - FactTextField { - fact: controller.getParameterFact(-1, "RTL_LAND_DELAY") - showUnits: true - enabled: homeLoiterCheckbox.checked == true + FactTextField { + fact: controller.getParameterFact(-1, "RTL_LAND_DELAY") + showUnits: true + enabled: homeLoiterCheckbox.checked == true + } } } - } - Item { height: 20; width: 10 } // spacer + Item { height: 20; width: 10 } // spacer - // This row holds the flight graphic and the home loiter alt column - Row { - width: parent.width - spacing: 20 + // This row holds the flight graphic and the home loiter alt column + Row { + width: parent.width + spacing: 20 - // Flight graphic - Item { - id: flightGraphic - width: parent.width - loiterAltitudeColumnWidth - height: 200 // controls the height of the flight graphic - - Rectangle { - x: planeWidth / 2 - height: planeImage.y - 5 - width: flightLineWidth - color: palette.button - } - Rectangle { - x: planeWidth / 2 - height: flightLineWidth - width: parent.width - x - color: palette.button - } - Rectangle { - x: parent.width - flightLineWidth - height: parent.height - homeWidth - arrowToHomeSpacing - width: flightLineWidth - color: palette.button - } + // Flight graphic + Item { + id: flightGraphic + width: parent.width - loiterAltitudeColumnWidth + height: 200 // controls the height of the flight graphic - QGCColoredImage { - id: planeImage - y: parent.height - planeWidth - 40 - source: "/qmlimages/SafetyComponentPlane.png" - fillMode: Image.PreserveAspectFit - width: planeWidth - height: planeWidth - smooth: true - color: palette.button - } + Rectangle { + x: planeWidth / 2 + height: planeImage.y - 5 + width: flightLineWidth + color: palette.button + } + Rectangle { + x: planeWidth / 2 + height: flightLineWidth + width: parent.width - x + color: palette.button + } + Rectangle { + x: parent.width - flightLineWidth + height: parent.height - homeWidth - arrowToHomeSpacing + width: flightLineWidth + color: palette.button + } - QGCColoredImage { - x: planeWidth + 70 - y: parent.height - height - 20 - width: 80 - height: parent.height / 2 - source: "/qmlimages/SafetyComponentTree.svg" - fillMode: Image.Stretch - smooth: true - color: palette.windowShadeDark - } + QGCColoredImage { + id: planeImage + y: parent.height - planeWidth - 40 + source: "/qmlimages/SafetyComponentPlane.png" + fillMode: Image.PreserveAspectFit + width: planeWidth + height: planeWidth + smooth: true + color: palette.button + } - QGCColoredImage { - x: planeWidth + 15 - y: parent.height - height - width: 100 - height: parent.height * .75 - source: "/qmlimages/SafetyComponentTree.svg" - fillMode: Image.PreserveAspectFit - smooth: true - color: palette.button - } + QGCColoredImage { + x: planeWidth + 70 + y: parent.height - height - 20 + width: 80 + height: parent.height / 2 + source: "/qmlimages/SafetyComponentTree.svg" + fillMode: Image.Stretch + smooth: true + color: palette.windowShadeDark + } - QGCColoredImage { - x: parent.width - (arrowWidth/2) - 1 - y: parent.height - homeWidth - arrowToHomeSpacing - 2 - source: "/qmlimages/SafetyComponentArrowDown.png" - fillMode: Image.PreserveAspectFit - width: arrowWidth - height: arrowWidth - smooth: true - color: palette.button - } + QGCColoredImage { + x: planeWidth + 15 + y: parent.height - height + width: 100 + height: parent.height * .75 + source: "/qmlimages/SafetyComponentTree.svg" + fillMode: Image.PreserveAspectFit + smooth: true + color: palette.button + } + + QGCColoredImage { + x: parent.width - (arrowWidth/2) - 1 + y: parent.height - homeWidth - arrowToHomeSpacing - 2 + source: "/qmlimages/SafetyComponentArrowDown.png" + fillMode: Image.PreserveAspectFit + width: arrowWidth + height: arrowWidth + smooth: true + color: palette.button + } - QGCColoredImage { - id: homeImage - x: parent.width - (homeWidth / 2) - y: parent.height - homeWidth - source: "/qmlimages/SafetyComponentHome.png" - fillMode: Image.PreserveAspectFit - width: homeWidth - height: homeWidth - smooth: true - color: palette.button + QGCColoredImage { + id: homeImage + x: parent.width - (homeWidth / 2) + y: parent.height - homeWidth + source: "/qmlimages/SafetyComponentHome.png" + fillMode: Image.PreserveAspectFit + width: homeWidth + height: homeWidth + smooth: true + color: palette.button + } } - } - Column { - spacing: controlVerticalSpacing + Column { + spacing: controlVerticalSpacing - QGCLabel { - text: "Home loiter altitude"; - color: palette.text; - enabled: homeLoiterCheckbox.checked === true - } - FactTextField { - id: descendField; - fact: controller.getParameterFact(-1, "RTL_DESCEND_ALT") - enabled: homeLoiterCheckbox.checked === true - showUnits: true + QGCLabel { + text: "Home loiter altitude"; + color: palette.text; + enabled: homeLoiterCheckbox.checked === true + } + FactTextField { + id: descendField; + fact: controller.getParameterFact(-1, "RTL_DESCEND_ALT") + enabled: homeLoiterCheckbox.checked === true + showUnits: true + } } } - } - Item { height: shadedMargin; width: 10 } // bottom margin + Item { height: shadedMargin; width: 10 } // bottom margin + } } - } - QGCLabel { - width: parent.width - font.pixelSize: ScreenTools.mediumFontPixelSize - text: "Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply."; - visible: fact.value !== 0 - wrapMode: Text.Wrap + QGCLabel { + width: parent.width + font.pixelSize: ScreenTools.mediumFontPixelSize + text: "Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply."; + visible: fact.value !== 0 + wrapMode: Text.Wrap - property Fact fact: controller.getParameterFact(-1, "NAV_RCL_OBC") - } + property Fact fact: controller.getParameterFact(-1, "NAV_RCL_OBC") + } - QGCLabel { - width: parent.width - font.pixelSize: ScreenTools.mediumFontPixelSize - text: "Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply."; - visible: fact.value !== 0 - wrapMode: Text.Wrap + QGCLabel { + width: parent.width + font.pixelSize: ScreenTools.mediumFontPixelSize + text: "Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply."; + visible: fact.value !== 0 + wrapMode: Text.Wrap - property Fact fact: controller.getParameterFact(-1, "NAV_DLL_OBC") + property Fact fact: controller.getParameterFact(-1, "NAV_DLL_OBC") + } } - } + } // QGCVIew } -- 2.22.0