[companion] Adjust GVAR not possible in global functions (fix #5425)
[opentx.git] / companion / src / wizarddialog.h
blob32a7c4b49692a667e4b92383ddcfe5bcd8cacefd
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _WIZARDDIALOG_H_
22 #define _WIZARDDIALOG_H_
24 #include <QtWidgets>
25 #include "wizarddata.h"
27 class WizardDialog : public QWizard
29 Q_OBJECT
31 public:
32 WizMix mix;
33 WizardDialog(const GeneralSettings & settings, const unsigned int modelId, const ModelData & modelData, QWidget *parent = 0);
34 const GeneralSettings & settings;
36 private slots:
37 void showHelp();
40 class StandardPage: public QWizardPage
42 Q_OBJECT
44 public:
45 StandardPage(WizardPage curPage, WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
46 WizardDialog *wizDlg;
48 protected:
49 void releaseBookings();
50 void releasePreBookings();
51 void initializePage();
52 void cleanupPage();
53 int getDefaultChannel(const Input input);
54 int nextFreeChannel(int channel = 0);
55 void populateCB(QComboBox * cb, int preferred=-1);
56 bool bookChannel(QComboBox * cb, Input input1, int weight1, Input input2=NO_INPUT, int weight2=0);
57 int totalChannelsAvailable();
59 private:
60 QLabel *topLabel;
61 WizardPage pageCurrent;
62 int pageFollower;
63 int nextId() const;
66 class ModelSelectionPage: public StandardPage
68 Q_OBJECT
69 public:
70 ModelSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
71 private:
72 QLineEdit *nameLineEdit;
73 QRadioButton *planeRB;
74 QRadioButton *multirotorRB;
75 QRadioButton *helicopterRB;
76 void initializePage();
77 bool validatePage();
78 int nextId() const;
81 class WingtypeSelectionPage: public StandardPage
83 Q_OBJECT
84 public:
85 WingtypeSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
86 private:
87 QRadioButton *deltaWingRB;
88 QRadioButton *standardWingRB;
89 int nextId() const;
92 class TailSelectionPage: public StandardPage
94 Q_OBJECT
95 public:
96 TailSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
97 private:
98 QRadioButton *vTailRB;
99 QRadioButton *standardTailRB;
100 QRadioButton *simpleTailRB;
101 int nextId() const;
104 class FlybarSelectionPage: public StandardPage
106 Q_OBJECT
107 public:
108 FlybarSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
109 private:
110 QRadioButton *flybarRB;
111 QRadioButton *noFlybarRB;
112 int nextId() const;
115 class ThrottlePage: public StandardPage
117 Q_OBJECT
119 public:
120 ThrottlePage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
121 void initializePage();
122 bool validatePage();
124 protected slots:
125 void onMotorStateChanged(bool toggled);
127 private:
128 QRadioButton *motorRB;
129 QRadioButton *noMotorRB;
130 QComboBox *throttleCB;
133 class AileronsPage: public StandardPage
135 Q_OBJECT
136 public:
137 AileronsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
138 void initializePage();
139 bool validatePage();
141 protected slots:
142 void noAileronChannel();
143 void oneAileronChannel();
144 void twoAileronChannels();
146 private:
147 QRadioButton *oneAileronRB;
148 QRadioButton *twoAileronsRB;
149 QRadioButton *noAileronsRB;
150 QComboBox *aileron1CB;
151 QComboBox *aileron2CB;
154 class FlapsPage: public StandardPage
156 Q_OBJECT
157 public:
158 FlapsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
159 void initializePage();
160 bool validatePage();
162 protected slots:
163 void noFlapChannel();
164 void oneFlapChannel();
165 void twoFlapChannels();
167 private:
168 QRadioButton *oneFlapRB;
169 QRadioButton *twoFlapsRB;
170 QRadioButton *noFlapsRB;
171 QComboBox *flap1CB;
172 QComboBox *flap2CB;
175 class AirbrakesPage: public StandardPage
177 Q_OBJECT
178 public:
179 AirbrakesPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
180 void initializePage();
181 bool validatePage();
183 protected slots:
184 void noAirbrakeChannel();
185 void oneAirbrakeChannel();
186 void twoAirbrakeChannels();
188 private:
189 QRadioButton *oneAirbrakeRB;
190 QRadioButton *twoAirbrakesRB;
191 QRadioButton *noAirbrakesRB;
192 QComboBox *airbrake1CB;
193 QComboBox *airbrake2CB;
196 class ElevonsPage: public StandardPage
198 Q_OBJECT
200 public:
201 ElevonsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
202 void initializePage();
203 bool validatePage();
205 private:
206 QComboBox *elevon1CB;
207 QComboBox *elevon2CB;
210 class RudderPage: public StandardPage
212 Q_OBJECT
214 public:
215 RudderPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
216 void initializePage();
217 bool validatePage();
219 protected slots:
220 void noRudder();
221 void hasRudder();
223 private:
224 QRadioButton *noRudderRB;
225 QRadioButton *hasRudderRB;
226 QComboBox *rudderCB;
229 class TailPage: public StandardPage
231 Q_OBJECT
232 public:
233 TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
234 void initializePage();
235 void cleanupPage();
236 bool validatePage();
237 private:
238 QComboBox *elevatorCB;
239 QComboBox *rudderCB;
240 QLayout *l;
241 QLabel *errorMessage;
244 class VTailPage: public StandardPage
246 Q_OBJECT
247 public:
248 VTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
249 void initializePage();
250 bool validatePage();
251 private:
252 QComboBox *tail1CB;
253 QComboBox *tail2CB;
256 class SimpleTailPage: public StandardPage
258 Q_OBJECT
259 public:
260 SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
261 void initializePage();
262 bool validatePage();
263 private:
264 QComboBox *elevatorCB;
267 class CyclicPage: public StandardPage
269 Q_OBJECT
270 public:
271 CyclicPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
272 void initializePage();
273 bool validatePage();
274 private:
275 QRadioButton *cyclic90RB;
276 QRadioButton *cyclic120RB;
277 QRadioButton *cyclic120XRB;
278 QRadioButton *cyclic140RB;
281 class GyroPage: public StandardPage
283 Q_OBJECT
284 public:
285 GyroPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
286 void initializePage();
287 bool validatePage();
288 private:
289 QRadioButton *noGyroRB;
290 QRadioButton *switchGyroRB;
291 QRadioButton *potGyroRB;
294 class FblPage: public StandardPage
296 Q_OBJECT
297 public:
298 FblPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
299 void initializePage();
300 bool validatePage();
301 private:
302 QComboBox *throttleCB;
303 QComboBox *yawCB;
304 QComboBox *pitchCB;
305 QComboBox *rollCB;
308 class HeliPage: public StandardPage
310 Q_OBJECT
311 public:
312 HeliPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
313 void initializePage();
314 bool validatePage();
315 private:
316 QComboBox *throttleCB;
317 QComboBox *yawCB;
318 QComboBox *pitchCB;
319 QComboBox *rollCB;
322 class MultirotorPage: public StandardPage
324 Q_OBJECT
325 public:
326 MultirotorPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
327 void initializePage();
328 bool validatePage();
329 private:
330 QComboBox *throttleCB;
331 QComboBox *yawCB;
332 QComboBox *pitchCB;
333 QComboBox *rollCB;
336 class OptionsPage: public StandardPage
338 Q_OBJECT
339 public:
340 OptionsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
341 void initializePage();
342 bool validatePage();
343 private:
344 QCheckBox *throttleCutRB;
345 QCheckBox *flightTimerRB;
346 QCheckBox *throttleTimerRB;
349 class ConclusionPage: public StandardPage
351 Q_OBJECT
352 public:
353 ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
354 void initializePage();
355 bool validatePage();
356 private:
357 QCheckBox *proceedCB;
358 QLabel *textLabel;
361 class WizardPrinter:QObject
363 Q_OBJECT
364 public:
365 WizardPrinter( WizMix * );
366 QString print();
367 private:
368 WizMix *mix;
369 QString inputName( Input );
370 QString vehicleName( Vehicle );
371 QString printChannel( Input, int, Input, int );
373 #endif // _WIZARDDIALOG_H_