@@ -25,6 +25,11 @@ Item {
2525 width: flightModeSelector .width
2626
2727 property var _flightModes: activeVehicle ? activeVehicle .flightModes : [ ]
28+ property var modeParam1: 0
29+ property var modeParam2: 0
30+ property var modeParam3: 0
31+ property var modeParam4: 0
32+ property var modeParam5: 0
2833
2934 on_FlightModesChanged: flightModeSelector .updateFlightModesMenu ()
3035
@@ -43,6 +48,156 @@ Item {
4348 onTriggered: activeVehicle .flightMode = text
4449 }
4550 }
51+ Component {
52+ id: parametrizedModeSelector
53+ Rectangle {
54+ id: testRect
55+ width: 200
56+ height: 300
57+ radius: ScreenTools .defaultFontPixelHeight * 0.5
58+ color: qgcPal .window
59+ border .color : qgcPal .text
60+ Column{
61+ width: parent .width * 0.9
62+ anchors .horizontalCenter : parent .horizontalCenter
63+ ComboBox {
64+ id: cbFlightMode
65+ currentIndex: - 1
66+ displayText: currentIndex === - 1 ? " Choose mode..." : currentText
67+ model: ListModel {
68+ id: cbFlightModeModel
69+ }
70+ width: parent .width
71+ anchors .horizontalCenter : parent .horizontalCenter
72+ Component .onCompleted : {
73+ cbFlightModeModel .clear ()
74+ var i
75+ for (i = 0 ; i < _flightModes .length ; i++ ) {
76+ cbFlightModeModel .append ({' mode' : _flightModes[i]})
77+ }
78+ currentIndex = find (activeVehicle .flightMode )
79+ }
80+ }
81+ Row {
82+ width: parent .width
83+ QGCLabel {
84+ text: qsTr (" Param1: " )
85+ }
86+ TextField {
87+ id: param1Box
88+ text: modeParam1
89+ width: parent .width * 0.5
90+ anchors .verticalCenter : parent .verticalCenter
91+ inputMethodHints: Qt .ImhDigitsOnly
92+ validator: IntValidator {
93+ bottom: - 32768
94+ top: 32768
95+ }
96+ onAccepted: {
97+ modeParam1 = text
98+ }
99+ }
100+ }
101+ Row {
102+ width: parent .width
103+ QGCLabel {
104+ text: qsTr (" Param2: " )
105+ }
106+ TextField {
107+ id: param2Box
108+ text: modeParam2
109+ width: parent .width * 0.5
110+ anchors .verticalCenter : parent .verticalCenter
111+ inputMethodHints: Qt .ImhDigitsOnly
112+ validator: IntValidator {
113+ bottom: - 32768
114+ top: 32768
115+ }
116+ onAccepted: {
117+ modeParam2 = text
118+ }
119+ }
120+ }
121+ Row {
122+ width: parent .width
123+ QGCLabel {
124+ text: qsTr (" Param3: " )
125+ }
126+ TextField {
127+ id: param3Box
128+ text: modeParam3
129+ width: parent .width * 0.5
130+ anchors .verticalCenter : parent .verticalCenter
131+ inputMethodHints: Qt .ImhDigitsOnly
132+ validator: IntValidator {
133+ bottom: - 32768
134+ top: 32768
135+ }
136+ onAccepted: {
137+ modeParam3 = text
138+ }
139+ }
140+ }
141+ Row {
142+ width: parent .width
143+ QGCLabel {
144+ text: qsTr (" Param4: " )
145+ }
146+ TextField {
147+ id: param4Box
148+ text: modeParam4
149+ width: parent .width * 0.5
150+ anchors .verticalCenter : parent .verticalCenter
151+ inputMethodHints: Qt .ImhDigitsOnly
152+ validator: IntValidator {
153+ bottom: - 32768
154+ top: 32768
155+ }
156+ onAccepted: {
157+ modeParam4 = text
158+ }
159+ }
160+ }
161+ Row {
162+ width: parent .width
163+ QGCLabel {
164+ text: qsTr (" Param5: " )
165+ }
166+ TextField {
167+ id: param5Box
168+ text: modeParam5
169+ width: parent .width * 0.5
170+ anchors .verticalCenter : parent .verticalCenter
171+ inputMethodHints: Qt .ImhDigitsOnly
172+ validator: IntValidator {
173+ bottom: - 32768
174+ top: 32768
175+ }
176+ onAccepted: {
177+ modeParam5 = text
178+ }
179+ }
180+ }
181+ QGCButton {
182+ anchors .horizontalCenter : parent .horizontalCenter
183+ text: qsTr (" Change mode" )
184+ onClicked: {
185+ activeVehicle .setFlightModeParametrized (
186+ cbFlightMode .currentText ,
187+ param1Box .text ? parseFloat (param1Box .text ) : 0 ,
188+ param2Box .text ? parseFloat (param2Box .text ) : 0 ,
189+ param3Box .text ? parseFloat (param3Box .text ) : 0 ,
190+ param4Box .text ? parseFloat (param4Box .text ) : 0 ,
191+ param5Box .text ? parseFloat (param5Box .text ) : 0
192+ )
193+ }
194+ }
195+ }
196+
197+
198+ }
199+
200+ }
46201 property var flightModesMenuItems: []
47202 function updateFlightModesMenu () {
48203 if (activeVehicle && activeVehicle .flightModeSetAvailable ) {
@@ -64,7 +219,13 @@ Item {
64219 MouseArea {
65220 visible: activeVehicle && activeVehicle .flightModeSetAvailable
66221 anchors .fill : parent
67- onClicked: flightModesMenu .popup ()
222+ // onClicked: mainWindow.showPopUp(flightModeSelector, parametrizedModeSelector)
223+ onClicked: {
224+ if (activeVehicle .vehicleTypeName () == " Charging station" )
225+ mainWindow .showPopUp (flightModeSelector, parametrizedModeSelector)
226+ else
227+ flightModesMenu .popup ()
228+ }
68229 }
69230 }
70231}
0 commit comments