5import QGroundControl.Controls
7import "PlanPanelLogic.js" as Logic
9/// Rally Points tab: the list of points and the inspector of the current one
13 required property var planMasterController
15 readonly property var controller: planMasterController.rallyPointController
16 readonly property var points: controller.points
17 readonly property var current: controller.currentRallyPoint
18 readonly property bool supported: controller.supported
19 readonly property int currentIndex: indexOfPoint(current)
21 function indexOfPoint(point) {
22 for (let i = 0; i < points.count; i++) {
23 if (points.get(i) === point) {
30 function select(point) {
31 controller.currentRallyPoint = point
34 function step(delta) {
35 if (!mainWindow.allowViewSwitch()) {
38 const index = Logic.steppedIndex(currentIndex, delta, points.count)
40 select(points.get(index))
44 function deleteCurrent() {
46 controller.removePoint(current)
50 function openInspector() {
51 listInspector.openInspector()
54 objectName: "planPanel_page_rally"
55 spacing: ScreenTools.defaultFontPixelHeight * 0.3
57 QGCPalette { id: qgcPal }
60 target: root.controller
62 function onCurrentRallyPointChanged() {
63 if (root.controller.currentRallyPoint) {
70 objectName: "planPanel_rallyHeader"
71 Layout.fillWidth: true
72 Layout.margins: ScreenTools.defaultFontPixelWidth
73 wrapMode: Text.WordWrap
74 color: qgcPal.textSecondary
75 font.pointSize: ScreenTools.smallFontPointSize
76 text: root.supported ?
77 qsTr("Rally Points provide alternate landing points when performing a Return to Launch (RTL). Click in the map to add a point.") :
78 qsTr("This vehicle does not support Rally Points.")
84 objectName: "planPanel_rallyListInspector"
85 Layout.fillWidth: true
86 Layout.fillHeight: true
87 visible: root.supported
88 hasSelection: root.current !== null
89 listComponent: rallyListComponent
90 inspectorComponent: rallyInspectorComponent
94 id: rallyListComponent
102 id: rallyInspectorComponent
104 RallyPointInspector {
106 drillIn: listInspector.layoutMode === "drillIn"