diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index ce254dd5845d1601d948d4c918dd4dca932179d5..7b070e463feca9a80c9aea92372072c96cbb56d0 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -254,6 +254,7 @@ src/QmlControls/QGCLabel.qml src/QmlControls/QGCTextField.qml src/QmlControls/QGCComboBox.qml + src/QmlControls/QGCColoredImage.qml src/QmlControls/arrow-down.png @@ -273,11 +274,17 @@ src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml + src/AutoPilotPlugins/PX4/SafetyComponentTree.png + src/AutoPilotPlugins/PX4/SafetyComponentHome.png + src/AutoPilotPlugins/PX4/SafetyComponentArrowDown.png + src/AutoPilotPlugins/PX4/SafetyComponentPlane.png + files/Setup/cogwheels.png src/AutoPilotPlugins/PX4/SensorsComponentIcon.png src/AutoPilotPlugins/PX4/RadioComponentIcon.png src/AutoPilotPlugins/PX4/FlightModesComponentIcon.png src/AutoPilotPlugins/PX4/AirframeComponentIcon.png + src/AutoPilotPlugins/PX4/SafetyComponentIcon.png src/VehicleSetup/FirmwareUpgradeIcon.png src/VehicleSetup/VehicleSummaryIcon.png diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.cc b/src/AutoPilotPlugins/PX4/SafetyComponent.cc index 4f4e698e893d69d8c8c6390b1a8164292de25981..4f9fbee04aa1e714485450f58b9a819372d0870b 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.cc +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.cc @@ -50,8 +50,7 @@ QString SafetyComponent::description(void) const QString SafetyComponent::iconResource(void) const { - // FIXME: Need real icon - return "subMenuButtonImage.png"; + return "SafetyComponentIcon.png"; } bool SafetyComponent::requiresSetup(void) const diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.qml b/src/AutoPilotPlugins/PX4/SafetyComponent.qml index a0b30c3cd65a1f429df7cbdb4d0a94ef45e5eaf4..c2dfcd65bcc863b9839d6ea3b8c2d2f0b29481b0 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.qml +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.qml @@ -5,6 +5,7 @@ import QtQuick.Controls.Styles 1.2 import QGroundControl.FactSystem 1.0 import QGroundControl.FactControls 1.0 import QGroundControl.Palette 1.0 +import QGroundControl.Controls 1.0 Rectangle { QGCPalette { id: palette; colorGroupEnabled: true } @@ -12,123 +13,265 @@ Rectangle { width: 600 height: 600 color: palette.window - property var leftColWidth: 350 + + property int flightLineWidth: 2 // width of lines for flight graphic + property int loiterAltitudeColumnWidth: 180 // width of loiter altitude column + property int shadedMargin: 20 // margin inset for shaded areas + property int controlVerticalSpacing: 10 // vertical spacing between controls + property int homeWidth: 50 // width of home graphic + property int planeWidth: 40 // width of plane graphic + property int arrowToHomeSpacing: 20 // space between down arrow and home graphic + property int arrowWidth: 18 // width for arrow graphic + property int firstColumnWidth: 220 // Width of first column in return home triggers area Column { anchors.fill: parent - spacing: 40 + + QGCLabel { + text: "SAFETY CONFIG" + font.pointSize: 20 + } + + Item { height: 20; width: 10 } // spacer + //----------------------------------------------------------------- //-- Return Home Triggers - Column { - spacing: 18 - Label { text: "Triggers For Return Home"; color: palette.text; font.pointSize: 20 } - Row { - Label { - width: leftColWidth - text: "RC Transmitter Signal Loss - Return Home After" - color: palette.text - anchors.baseline: rcLossField.baseline - } - FactTextField { - id: rcLossField - fact: autopilot.parameters["COM_RC_LOSS_T"] - showUnits: true - } - } - Row { - FactCheckBox { - id: telemetryLossCheckbox - fact: autopilot.parameters["COM_DL_LOSS_EN"] - width: leftColWidth - checkedValue: 1 - uncheckedValue: 0 - text: "Telemetry Signal Timeout - Return Home After" - anchors.baseline: telemetryLossField.baseline + + QGCLabel { text: "Triggers For Return Home"; color: palette.text; font.pointSize: 20 } + + Item { height: 10; width: 10 } // spacer + + Rectangle { + width: parent.width + height: triggerColumn.height + color: palette.windowShade + + Column { + id: triggerColumn + spacing: controlVerticalSpacing + anchors.margins: shadedMargin + anchors.left: parent.left + + // Top margin + Item { height: 1; width: 10 } + + 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: autopilot.parameters["COM_RC_LOSS_T"] + showUnits: true + } } - FactTextField { - id: telemetryLossField - fact: autopilot.parameters["COM_DL_LOSS_T"]; - showUnits: true + + Row { + spacing: 10 + FactCheckBox { + fact: autopilot.parameters["COM_DL_LOSS_EN"] + checkedValue: 1 + uncheckedValue: 0 + text: "Telemetry Signal Timeout" + anchors.baseline: telemetryLossField.baseline + width: firstColumnWidth + } + QGCLabel { text: "Return Home after"; anchors.baseline: telemetryLossField.baseline } + FactTextField { + id: telemetryLossField + fact: autopilot.parameters["COM_DL_LOSS_T"]; + showUnits: true + } } + + // Bottom margin + Item { height: 1; width: 10 } } } + + Item { height: 20; width: 10 } // spacer + //----------------------------------------------------------------- - //-- Return Home Options - Column { - spacing: 18 - Label { text: "Return Home Options"; color: palette.text; font.pointSize: 20 } - Row { - Label { - width: leftColWidth - text: "Climb to minimum altitude of " - color: palette.text - anchors.baseline: climbField.baseline - } - FactTextField { - id: climbField - fact: autopilot.parameters["RTL_RETURN_ALT"] - showUnits: true - } - } - Row { - CheckBox { - id: homeLoiterCheckbox - property Fact fact: autopilot.parameters["RTL_LAND_DELAY"] - width: leftColWidth - checked: fact.value > 0 - text: "Loiter at Home altitude for " - onClicked: { - fact.value = checked ? 60 : -1 + //-- Return Home Settings + + QGCLabel { text: "Return Home Settings"; font.pointSize: 20 } + + Item { height: 10; width: 10 } // spacer + + Rectangle { + width: parent.width + height: settingsColumn.height + color: palette.windowShade + + Column { + id: settingsColumn + width: parent.width + anchors.margins: shadedMargin + anchors.left: parent.left + + Item { height: shadedMargin; width: 10 } // top margin + + // 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: autopilot.parameters["RTL_RETURN_ALT"] + showUnits: true + } } - style: CheckBoxStyle { - label: Text { - color: palette.text - text: control.text + + + Column { + x: flightGraphic.width - 200 + spacing: controlVerticalSpacing + + QGCCheckBox { + id: homeLoiterCheckbox + property Fact fact: autopilot.parameters["RTL_LAND_DELAY"] + checked: fact.value > 0 + text: "Loiter at Home altitude for" + onClicked: { + fact.value = checked ? 60 : -1 + } + } + FactTextField { + fact: autopilot.parameters["RTL_LAND_DELAY"]; + showUnits: true + enabled: homeLoiterCheckbox.checked == true } } } - FactTextField { - fact: autopilot.parameters["RTL_LAND_DELAY"]; - showUnits: true - anchors.baseline: homeLoiterCheckbox.baseline - enabled: homeLoiterCheckbox.checked == true - } - } - //------------------------------------------------------------- - //-- Visible only if loiter above is checked - // TODO The "enabled" property could be used instead but it - // would have to handle a different "disabled" palette. - Row { - Label { - width: leftColWidth; - text: "When Home is reached, loiter at an altitude of "; - color: palette.text; - anchors.baseline: descendField.baseline - visible: homeLoiterCheckbox.checked == true - } - FactTextField { - id: descendField; - fact: autopilot.parameters["RTL_DESCEND_ALT"]; - visible: homeLoiterCheckbox.checked == true - showUnits: true + + Item { height: 20; width: 10 } // spacer + + // 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 + } + + QGCColoredImage { + id: planeImage + y: parent.height - planeWidth - 40 + source: "/qml/SafetyComponentPlane.png" + fillMode: Image.PreserveAspectFit + width: planeWidth + height: planeWidth + smooth: true + color: palette.button + } + + QGCColoredImage { + x: planeWidth + 70 + y: parent.height - height - 20 + width: 80 + height: parent.height / 2 + source: "/qml/SafetyComponentTree.png" + fillMode: Image.Stretch + smooth: true + color: palette.windowShadeDark + } + + QGCColoredImage { + x: planeWidth + 15 + y: parent.height - height + width: 100 + height: parent.height * .75 + source: "/qml/SafetyComponentTree.png" + fillMode: Image.Stretch + smooth: true + color: palette.button + } + + QGCColoredImage { + x: parent.width - (arrowWidth/2) - 1 + y: parent.height - homeWidth - arrowToHomeSpacing - 2 + source: "/qml/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: "/qml/SafetyComponentHome.png" + fillMode: Image.PreserveAspectFit + width: homeWidth + height: homeWidth + smooth: true + color: palette.button + } + } + + Column { + spacing: controlVerticalSpacing + + QGCLabel { + text: "Home loiter altitude"; + color: palette.text; + enabled: homeLoiterCheckbox.checked == true + } + FactTextField { + id: descendField; + fact: autopilot.parameters["RTL_DESCEND_ALT"]; + enabled: homeLoiterCheckbox.checked == true + showUnits: true + } + } } + + Item { height: shadedMargin; width: 10 } // bottom margin } } - Text { + QGCLabel { width: parent.width font.pointSize: 14 text: "Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply."; visible: autopilot.parameters["NAV_RCL_OBC"].value != 0 - color: palette.text wrapMode: Text.Wrap } - Text { + QGCLabel { width: parent.width font.pointSize: 14 text: "Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply."; visible: autopilot.parameters["NAV_DLL_OBC"].value != 0 - color: palette.text wrapMode: Text.Wrap } } diff --git a/src/AutoPilotPlugins/PX4/SafetyComponentArrowDown.png b/src/AutoPilotPlugins/PX4/SafetyComponentArrowDown.png new file mode 100644 index 0000000000000000000000000000000000000000..ba7cddb82c325dc18bca9f8713065c9d6b9a05a9 Binary files /dev/null and b/src/AutoPilotPlugins/PX4/SafetyComponentArrowDown.png differ diff --git a/src/AutoPilotPlugins/PX4/SafetyComponentHome.png b/src/AutoPilotPlugins/PX4/SafetyComponentHome.png new file mode 100644 index 0000000000000000000000000000000000000000..6a1ef2af464b546e5d93dd3251101b4b97530568 Binary files /dev/null and b/src/AutoPilotPlugins/PX4/SafetyComponentHome.png differ diff --git a/src/AutoPilotPlugins/PX4/SafetyComponentIcon.png b/src/AutoPilotPlugins/PX4/SafetyComponentIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..47f568d2f70f37a6541dc71b6e6aaeca4ec00ee6 Binary files /dev/null and b/src/AutoPilotPlugins/PX4/SafetyComponentIcon.png differ diff --git a/src/AutoPilotPlugins/PX4/SafetyComponentPlane.png b/src/AutoPilotPlugins/PX4/SafetyComponentPlane.png new file mode 100644 index 0000000000000000000000000000000000000000..6aa8343a341df18048e0c9feeeb9491e2c63aaa8 Binary files /dev/null and b/src/AutoPilotPlugins/PX4/SafetyComponentPlane.png differ diff --git a/src/AutoPilotPlugins/PX4/SafetyComponentTree.png b/src/AutoPilotPlugins/PX4/SafetyComponentTree.png new file mode 100644 index 0000000000000000000000000000000000000000..9c618a3060326f456f2cb2ac7aee2cdb466e1025 Binary files /dev/null and b/src/AutoPilotPlugins/PX4/SafetyComponentTree.png differ diff --git a/src/QmlControls/QGCColoredImage.qml b/src/QmlControls/QGCColoredImage.qml new file mode 100644 index 0000000000000000000000000000000000000000..72e4ee77580ddd6aab3504edf31e2b5e4e179b44 --- /dev/null +++ b/src/QmlControls/QGCColoredImage.qml @@ -0,0 +1,40 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QtGraphicalEffects 1.0 + +import QGroundControl.Palette 1.0 + +Item { + property color color: "white" // Image color + + property alias asynchronous: image.asynchronous + property alias cache: image.cache + property alias fillMode: image.fillMode + property alias horizontalAlignment: image.horizontalAlignment + property alias mirror: image.mirror + property alias paintedHeight: image.paintedHeight + property alias paintedWidth: image.paintedWidth + property alias progress: image.progress + property alias smooth: image.smooth + property alias source: image.source + property alias sourceSize: image.sourceSize + property alias status: image.status + property alias verticalAlignment: image.verticalAlignment + + width: image.width + height: image.height + + Image { + id: image + smooth: true + visible: false + anchors.fill: parent + } + + ColorOverlay { + anchors.fill: image + source: image + color: parent.color + } +} \ No newline at end of file diff --git a/src/QmlControls/QGCTextField.qml b/src/QmlControls/QGCTextField.qml index ec98094d02bac3a0ac8038b84788a7e3f2f0a2dc..0b5dec2fcf13e069fb61ac61f9fb94c965ccdbd6 100644 --- a/src/QmlControls/QGCTextField.qml +++ b/src/QmlControls/QGCTextField.qml @@ -8,7 +8,7 @@ TextField { property bool showUnits: false property string unitsLabel: "" - property var __qgcPal: QGCPalette { colorGroupEnabled: true } + property var __qgcPal: QGCPalette { colorGroupEnabled: enabled } textColor: __qgcPal.textFieldText diff --git a/src/QmlControls/SubMenuButton.qml b/src/QmlControls/SubMenuButton.qml index 93d24ed32ce58f00517dcd2f04f50598a02d87f3..5282d3d6a4fe3bdc6036fb440d871a6048804799 100644 --- a/src/QmlControls/SubMenuButton.qml +++ b/src/QmlControls/SubMenuButton.qml @@ -65,19 +65,14 @@ Button { color: __qgcPal.windowShade - Image { - id: buttonImage + QGCColoredImage { source: control.imageResource - sourceSize: Qt.size(parent.width - 20, parent.height - 20) + fillMode: Image.PreserveAspectFit + width: parent.width - 20 + height: parent.height - 20 anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter smooth: true - visible: false - } - - ColorOverlay { - anchors.fill: buttonImage - source: buttonImage color: __showHighlight ? __qgcPal.buttonHighlight : __qgcPal.button } } diff --git a/src/QmlControls/qmldir b/src/QmlControls/qmldir index 9342c160e6042771ffef3bdd4723eefeae5fe367..2cde65c1b63f9e733d986b044ec7bb418b8fe4a8 100644 --- a/src/QmlControls/qmldir +++ b/src/QmlControls/qmldir @@ -6,3 +6,4 @@ QGCRadioButton 1.0 QGCRadioButton.qml QGCCheckBox 1.0 QGCCheckBox.qml QGCTextField 1.0 QGCTextField.qml QGCComboBox 1.0 QGCComboBox.qml +QGCColoredImage 1.0 QGCColoredImage.qml diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index d9d8df5f4348df137126e7517687199cfc915ae9..e6b924b10b587eeb3642e0cb916379f432ab3820 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -24,9 +24,8 @@ Rectangle { Column { anchors.fill:parent - Text { + QGCLabel { text: "FIRMWARE UPDATE" - color: qgcPal.text font.pointSize: 20 }