From cb901e7166fbc9d30d6373d43d14fb11ef4b21a7 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Thu, 22 Mar 2018 10:36:06 -0700 Subject: [PATCH] Make reusable Stats control for TransectStyleComplexItem --- qgroundcontrol.qrc | 1 + src/PlanView/CorridorScanEditor.qml | 12 +------- .../TransectStyleComplexItemStats.qml | 30 +++++++++++++++++++ .../QGroundControl.Controls.qmldir | 1 + 4 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 src/PlanView/TransectStyleComplexItemStats.qml diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index ce7371c75..dd06a037a 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -125,6 +125,7 @@ src/QmlControls/SliderSwitch.qml src/QmlControls/SubMenuButton.qml src/PlanView/SurveyMapVisual.qml + src/PlanView/TransectStyleComplexItemStats.qml src/QmlControls/ToolStrip.qml src/QmlControls/VehicleRotationCal.qml src/QmlControls/VehicleSummaryRow.qml diff --git a/src/PlanView/CorridorScanEditor.qml b/src/PlanView/CorridorScanEditor.qml index 754086544..04b0c48b0 100644 --- a/src/PlanView/CorridorScanEditor.qml +++ b/src/PlanView/CorridorScanEditor.qml @@ -189,16 +189,6 @@ Rectangle { text: qsTr("Statistics") } - Grid { - columns: 2 - columnSpacing: ScreenTools.defaultFontPixelWidth - visible: statsHeader.checked - - QGCLabel { text: qsTr("Photo count") } - QGCLabel { text: missionItem.cameraShots } - - QGCLabel { text: qsTr("Photo interval") } - QGCLabel { text: missionItem.timeBetweenShots.toFixed(1) + " " + qsTr("secs") } - } + TransectStyleComplexItemStats { } } // Column } // Rectangle diff --git a/src/PlanView/TransectStyleComplexItemStats.qml b/src/PlanView/TransectStyleComplexItemStats.qml new file mode 100644 index 000000000..0dec0c106 --- /dev/null +++ b/src/PlanView/TransectStyleComplexItemStats.qml @@ -0,0 +1,30 @@ +import QtQuick 2.3 +import QtQuick.Controls 1.2 + +import QGroundControl 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Controls 1.0 + +// Statistics section for TransectStyleComplexItems +Grid { + // The following properties must be available up the hierarchy chain + //property var missionItem ///< Mission Item for editor + + anchors.left: parent.left + anchors.right: parent.right + columns: 2 + columnSpacing: ScreenTools.defaultFontPixelWidth + visible: statsHeader.checked + + QGCLabel { text: qsTr("Survey Area") } + QGCLabel { text: QGroundControl.squareMetersToAppSettingsAreaUnits(missionItem.coveredArea).toFixed(2) + " " + QGroundControl.appSettingsAreaUnitsString } + + QGCLabel { text: qsTr("Photo Count") } + QGCLabel { text: missionItem.cameraShots } + + QGCLabel { text: qsTr("Photo Interval") } + QGCLabel { text: missionItem.timeBetweenShots.toFixed(1) + " " + qsTr("secs") } + + QGCLabel { text: qsTr("Trigger Distance") } + QGCLabel { text: missionItem.cameraCalc.adjustedFootprintFrontal.valueString + " " + missionItem.cameraCalc.adjustedFootprintFrontal.units } +} diff --git a/src/QmlControls/QGroundControl.Controls.qmldir b/src/QmlControls/QGroundControl.Controls.qmldir index 65b86d035..6bbe56f22 100644 --- a/src/QmlControls/QGroundControl.Controls.qmldir +++ b/src/QmlControls/QGroundControl.Controls.qmldir @@ -71,6 +71,7 @@ SimpleItemMapVisuals 1.0 SimpleItemMapVisuals.qml SliderSwitch 1.0 SliderSwitch.qml SubMenuButton 1.0 SubMenuButton.qml SurveyMapVisuals 1.0 SurveyMapVisuals.qml +TransectStyleComplexItemStats 1.0 TransectStyleComplexItemStats.qml ToolStrip 1.0 ToolStrip.qml VehicleRotationCal 1.0 VehicleRotationCal.qml VehicleSummaryRow 1.0 VehicleSummaryRow.qml -- 2.22.0