Browse Source

Convert to QGCView

QGC4.4
Don Gagne 10 years ago
parent
commit
b6e722c63e
  1. 429
      src/AutoPilotPlugins/PX4/SafetyComponent.qml

429
src/AutoPilotPlugins/PX4/SafetyComponent.qml

@ -31,11 +31,12 @@ import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
FactPanel { QGCView {
id: panel id: rootQGCView
viewPanel: view
QGCPalette { id: palette; colorGroupEnabled: enabled } 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 flightLineWidth: 2 // width of lines for flight graphic
property int loiterAltitudeColumnWidth: 180 // width of loiter altitude column property int loiterAltitudeColumnWidth: 180 // width of loiter altitude column
@ -47,265 +48,271 @@ FactPanel {
property int arrowWidth: 18 // width for arrow graphic property int arrowWidth: 18 // width for arrow graphic
property int firstColumnWidth: 220 // Width of first column in return home triggers area property int firstColumnWidth: 220 // Width of first column in return home triggers area
Column { QGCView {
id: view
anchors.fill: parent anchors.fill: parent
QGCLabel { Column {
text: "SAFETY CONFIG" anchors.fill: parent
font.pixelSize: ScreenTools.largeFontPixelSize
}
Item { height: 20; width: 10 } // spacer QGCLabel {
text: "SAFETY CONFIG"
font.pixelSize: ScreenTools.largeFontPixelSize
}
//----------------------------------------------------------------- Item { height: 20; width: 10 } // spacer
//-- Return Home Triggers
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 { Item { height: 10; width: 10 } // spacer
width: parent.width
height: triggerColumn.height
color: palette.windowShade
Column { Rectangle {
id: triggerColumn width: parent.width
spacing: controlVerticalSpacing height: triggerColumn.height
anchors.margins: shadedMargin color: palette.windowShade
anchors.left: parent.left
// Top margin Column {
Item { height: 1; width: 10 } id: triggerColumn
spacing: controlVerticalSpacing
anchors.margins: shadedMargin
anchors.left: parent.left
Row { // Top margin
spacing: 10 Item { height: 1; width: 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
}
}
Row { Row {
spacing: 10 spacing: 10
FactCheckBox { QGCLabel { text: "RC Transmitter Signal Loss"; width: firstColumnWidth; anchors.baseline: rcLossField.baseline }
id: telemetryTimeoutCheckbox QGCLabel { text: "Return Home after"; anchors.baseline: rcLossField.baseline }
anchors.baseline: telemetryLossField.baseline FactTextField {
width: firstColumnWidth id: rcLossField
fact: controller.getParameterFact(-1, "COM_DL_LOSS_EN") fact: controller.getParameterFact(-1, "COM_RC_LOSS_T")
checkedValue: 1 showUnits: true
uncheckedValue: 0 }
text: "Telemetry Signal Timeout"
} }
QGCLabel { text: "Return Home after"; anchors.baseline: telemetryLossField.baseline }
FactTextField { Row {
id: telemetryLossField spacing: 10
fact: controller.getParameterFact(-1, "COM_DL_LOSS_T") FactCheckBox {
showUnits: true id: telemetryTimeoutCheckbox
enabled: telemetryTimeoutCheckbox.checked 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 // Bottom margin
Item { height: 1; width: 10 } Item { height: 1; width: 10 }
}
} }
}
Item { height: 20; width: 10 } // spacer
//----------------------------------------------------------------- Item { height: 20; width: 10 } // spacer
//-- Return Home Settings
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 { Item { height: 10; width: 10 } // spacer
width: parent.width
height: settingsColumn.height
color: palette.windowShade
Column { Rectangle {
id: settingsColumn width: parent.width
width: parent.width height: settingsColumn.height
anchors.margins: shadedMargin color: palette.windowShade
anchors.left: parent.left
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 { height: shadedMargin; width: 10 } // top margin
Item {
width: parent.width
height: climbAltitudeColumn.height
Column { // This item is the holder for the climb alt and loiter seconds fields
id: climbAltitudeColumn Item {
spacing: controlVerticalSpacing width: parent.width
height: climbAltitudeColumn.height
QGCLabel { text: "Climb to altitude of" }
FactTextField { Column {
id: climbField id: climbAltitudeColumn
fact: controller.getParameterFact(-1, "RTL_RETURN_ALT") spacing: controlVerticalSpacing
showUnits: true
QGCLabel { text: "Climb to altitude of" }
FactTextField {
id: climbField
fact: controller.getParameterFact(-1, "RTL_RETURN_ALT")
showUnits: true
}
} }
}
Column { Column {
x: flightGraphic.width - 200 x: flightGraphic.width - 200
spacing: controlVerticalSpacing spacing: controlVerticalSpacing
QGCCheckBox { QGCCheckBox {
id: homeLoiterCheckbox id: homeLoiterCheckbox
checked: fact.value > 0 checked: fact.value > 0
text: "Loiter at Home altitude for" 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: { onClicked: {
fact.value = checked ? 60 : -1 fact.value = checked ? 60 : -1
}
} }
}
FactTextField { FactTextField {
fact: controller.getParameterFact(-1, "RTL_LAND_DELAY") fact: controller.getParameterFact(-1, "RTL_LAND_DELAY")
showUnits: true showUnits: true
enabled: homeLoiterCheckbox.checked == 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 // This row holds the flight graphic and the home loiter alt column
Row { Row {
width: parent.width width: parent.width
spacing: 20 spacing: 20
// Flight graphic // Flight graphic
Item { Item {
id: flightGraphic id: flightGraphic
width: parent.width - loiterAltitudeColumnWidth width: parent.width - loiterAltitudeColumnWidth
height: 200 // controls the height of the flight graphic 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
}
QGCColoredImage { Rectangle {
id: planeImage x: planeWidth / 2
y: parent.height - planeWidth - 40 height: planeImage.y - 5
source: "/qmlimages/SafetyComponentPlane.png" width: flightLineWidth
fillMode: Image.PreserveAspectFit color: palette.button
width: planeWidth }
height: planeWidth Rectangle {
smooth: true x: planeWidth / 2
color: palette.button 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 { QGCColoredImage {
x: planeWidth + 70 id: planeImage
y: parent.height - height - 20 y: parent.height - planeWidth - 40
width: 80 source: "/qmlimages/SafetyComponentPlane.png"
height: parent.height / 2 fillMode: Image.PreserveAspectFit
source: "/qmlimages/SafetyComponentTree.svg" width: planeWidth
fillMode: Image.Stretch height: planeWidth
smooth: true smooth: true
color: palette.windowShadeDark color: palette.button
} }
QGCColoredImage { QGCColoredImage {
x: planeWidth + 15 x: planeWidth + 70
y: parent.height - height y: parent.height - height - 20
width: 100 width: 80
height: parent.height * .75 height: parent.height / 2
source: "/qmlimages/SafetyComponentTree.svg" source: "/qmlimages/SafetyComponentTree.svg"
fillMode: Image.PreserveAspectFit fillMode: Image.Stretch
smooth: true smooth: true
color: palette.button color: palette.windowShadeDark
} }
QGCColoredImage { QGCColoredImage {
x: parent.width - (arrowWidth/2) - 1 x: planeWidth + 15
y: parent.height - homeWidth - arrowToHomeSpacing - 2 y: parent.height - height
source: "/qmlimages/SafetyComponentArrowDown.png" width: 100
fillMode: Image.PreserveAspectFit height: parent.height * .75
width: arrowWidth source: "/qmlimages/SafetyComponentTree.svg"
height: arrowWidth fillMode: Image.PreserveAspectFit
smooth: true smooth: true
color: palette.button 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 { QGCColoredImage {
id: homeImage id: homeImage
x: parent.width - (homeWidth / 2) x: parent.width - (homeWidth / 2)
y: parent.height - homeWidth y: parent.height - homeWidth
source: "/qmlimages/SafetyComponentHome.png" source: "/qmlimages/SafetyComponentHome.png"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
width: homeWidth width: homeWidth
height: homeWidth height: homeWidth
smooth: true smooth: true
color: palette.button color: palette.button
}
} }
}
Column { Column {
spacing: controlVerticalSpacing spacing: controlVerticalSpacing
QGCLabel { QGCLabel {
text: "Home loiter altitude"; text: "Home loiter altitude";
color: palette.text; color: palette.text;
enabled: homeLoiterCheckbox.checked === true enabled: homeLoiterCheckbox.checked === true
} }
FactTextField { FactTextField {
id: descendField; id: descendField;
fact: controller.getParameterFact(-1, "RTL_DESCEND_ALT") fact: controller.getParameterFact(-1, "RTL_DESCEND_ALT")
enabled: homeLoiterCheckbox.checked === true enabled: homeLoiterCheckbox.checked === true
showUnits: true showUnits: true
}
} }
} }
}
Item { height: shadedMargin; width: 10 } // bottom margin Item { height: shadedMargin; width: 10 } // bottom margin
}
} }
}
QGCLabel { QGCLabel {
width: parent.width width: parent.width
font.pixelSize: ScreenTools.mediumFontPixelSize 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."; 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 visible: fact.value !== 0
wrapMode: Text.Wrap wrapMode: Text.Wrap
property Fact fact: controller.getParameterFact(-1, "NAV_RCL_OBC") property Fact fact: controller.getParameterFact(-1, "NAV_RCL_OBC")
} }
QGCLabel { QGCLabel {
width: parent.width width: parent.width
font.pixelSize: ScreenTools.mediumFontPixelSize 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."; 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 visible: fact.value !== 0
wrapMode: Text.Wrap wrapMode: Text.Wrap
property Fact fact: controller.getParameterFact(-1, "NAV_DLL_OBC") property Fact fact: controller.getParameterFact(-1, "NAV_DLL_OBC")
}
} }
} } // QGCVIew
} }

Loading…
Cancel
Save