From b347b6f9c595e06894ff7551f10ecd9920c816a4 Mon Sep 17 00:00:00 2001 From: Kjell Kernen Date: Mon, 3 Mar 2014 14:40:02 +0100 Subject: [PATCH] Wizard data broken out into separate files. --- companion/src/CMakeLists.txt | 2 + companion/src/wizarddata.cpp | 67 +++ companion/src/wizarddata.h | 39 ++ companion/src/wizarddialog.cpp | 748 ++++++++++++++++----------------- companion/src/wizarddialog.h | 253 +++++------ 5 files changed, 597 insertions(+), 512 deletions(-) create mode 100644 companion/src/wizarddata.cpp create mode 100644 companion/src/wizarddata.h diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 652ca745c..5d60e530b 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -152,6 +152,7 @@ set(companion_SRCS mainwindow.cpp companion.cpp qcustomplot.cpp + wizarddata.cpp wizarddialog.cpp ) @@ -176,6 +177,7 @@ set(companion_MOC_HDRS mainwindow.h qcustomplot.h helpers.h + wizarddata.h wizarddialog.h ) diff --git a/companion/src/wizarddata.cpp b/companion/src/wizarddata.cpp new file mode 100644 index 000000000..abc171372 --- /dev/null +++ b/companion/src/wizarddata.cpp @@ -0,0 +1,67 @@ +#include "wizarddata.h" + +QString inputName(Input input) +{ + switch (input){ + case THROTTLE: return "THR"; + case RUDDER: return "RUD"; + case ELEVATOR: return "ELE"; + case AILERON: return "AIL"; + case FLAP: return "FLP"; + case AIRBREAK: return "AIR"; + default: return "---"; + } +} + +QString vehicleName(Vehicle vehicle) +{ + switch (vehicle){ + case PLANE: return "Plane"; + case MULTICOPTER: return "Multicopter"; + case HELICOPTER: return "Helicopter"; + default: return "---"; + } +} + +Channel::Channel() +{ + clear(); +} + +void Channel::clear() +{ + sourceDlg = -1; + input1 = NOINPUT; + input2 = NOINPUT; + weight1 = 0; + weight2 = 0; +} + +bool Channel::isEmpty() +{ + return sourceDlg < 0; +} + +QString Channel::toString() +{ + QString str; + str = QString("[%1, %2]").arg(inputName(input1)).arg(weight1); + if ( input2 != NOINPUT ) + str += QString("[%1, %2]").arg(inputName(input2)).arg(weight2); + return str; +} + +QString Mix::toString() +{ + QString str; + str = QString(tr("Model Name: ")) + name + "\n"; + str += QString(tr("Model Type: ")) + vehicleName(vehicleType) + "\n"; + for (int i=0; i + +#define MAX_CHANNELS 8 +enum Input {NOINPUT, THROTTLE, RUDDER, ELEVATOR, AILERON, FLAP, AIRBREAK}; +enum Vehicle {NOVEHICLE, PLANE, MULTICOPTER, HELICOPTER }; + +QString inputName(Input); +QString vehicleName(Input); + +class Channel +{ +public: + int sourceDlg; // Originating dialog, only of interest for producer + Input input1; + Input input2; + int weight1; + int weight2; + + Channel(); + bool isEmpty(); + void clear(); + + QString toString(); +}; + +class Mix:QObject +{ + Q_OBJECT +public: + QString name; + Vehicle vehicleType; + Channel channel[MAX_CHANNELS]; + + QString toString(); +}; + +#endif // WIZARDDATA_H \ No newline at end of file diff --git a/companion/src/wizarddialog.cpp b/companion/src/wizarddialog.cpp index 2ee125709..77c376750 100644 --- a/companion/src/wizarddialog.cpp +++ b/companion/src/wizarddialog.cpp @@ -1,133 +1,126 @@ #include #include "wizarddialog.h" -Channel::Channel() -{ - clear(); -} - -void Channel::clear() -{ - sourceDlg = -1; - input1 = UNDEFINED; - input2 = UNDEFINED; - weight1 = 0; - weight2 = 0; -} - -bool Channel::isEmpty() -{ - return sourceDlg < 0; -} - -QString Channel::nameOf(Input input) -{ - switch (input){ - case THROTTLE: return "THR"; - case RUDDER: return "RUD"; - case ELEVATOR: return "ELE"; - case AILERON: return "AIL"; - case FLAP: return "FLP"; - case AIRBREAK: return "AIR"; - default: return "---"; - } -} - -QString Channel::print() -{ - QString str; - str = QString("[%1, %2]").arg(nameOf(input1)).arg(weight1); - if ( input2 != UNDEFINED ) - str += QString("[%1, %2]").arg(nameOf(input2)).arg(weight2); - return str; -} - WizardDialog::WizardDialog(QWidget *parent) - : QWizard(parent) + : QWizard(parent) { - setWindowTitle(tr("Model Wizard")); + setWindowTitle(tr("Model Wizard")); - setPage(Page_Models, new ModelSelectionPage(this, "models",tr("Model Type"),tr("Enter model name and model type."))); - setPage(Page_Throttle, new ThrottlePage(this, "throttle",tr("Throttle"),tr("Has your model got a motor or an engine?"), Page_Wingtypes)); - setPage(Page_Wingtypes, new WingtypeSelectionPage(this, "wingtype",tr("Wing Type"),tr("Is your model a flying wing/deltawing or has it a standard wing configuration?"))); - setPage(Page_Ailerons, new AileronsPage(this, "ailerons",tr("Ailerons"),tr("Has your model got ailerons?"), Page_Flaps)); - setPage(Page_Flaps, new FlapsPage(this, "flaps",tr("Flaps"),tr("Has your model got flaps?"), Page_Airbrakes)); - setPage(Page_Airbrakes, new AirbreaksPage(this, "airbrakes",tr("Airbrakes"),tr("Has your model got airbrakes?"), Page_Tails)); - setPage(Page_Bank, new BankPage(this, "bank",tr("Flying-wing / Delta-wing"),tr("Are the elevons controlled by servos connected to separate channels or by a single servo channel?"), Page_Rudder)); - setPage(Page_Rudder, new RudderPage(this, "rudder",tr("Rudder"),tr("Does your model have a rudder?"), Page_Conclusion)); - setPage(Page_Tails, new TailSelectionPage(this, "tails",tr("Tail Type"),tr("Select which type of tail your model is equiped with."))); - setPage(Page_Tail, new TailPage(this, "tail",tr("Tail"),tr("Select channels for tail control."), Page_Conclusion)); - setPage(Page_Vtail, new VTailPage(this, "vtail",tr("V-Tail"),tr("Select channels for tail control."), Page_Conclusion)); - setPage(Page_Simpletail, new SimpleTailPage(this, "simpletail",tr("Tail"),tr("Select elevator channel."), Page_Conclusion)); - setPage(Page_Cyclic, new CyclicPage(this, "cyclic",tr("Cyclic"),tr("Which type of swash control is installed in your helicopter?"), Page_Gyro)); - setPage(Page_Gyro, new GyroPage(this, "gyro",tr("Tail Gyro"),tr("Has your helicopter got an adjustable gyro for the tail?"), Page_Flybar)); - setPage(Page_Flybar, new FlybarSelectionPage(this, "flybar",tr("Rotor Type"),tr("Has your helicopter got a flybar?"))); - setPage(Page_Fblheli, new FblPage(this, "fblheli",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Conclusion)); - setPage(Page_Helictrl, new HeliPage(this, "helictrl",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Conclusion)); - setPage(Page_Multirotor, new MultirotorPage(this, "multirotor",tr("Multirotor"),tr("Select the control channels for your multirotor"), Page_Conclusion)); - setPage(Page_Conclusion, new ConclusionPage(this, "conclusion",tr("Save Changes"),tr( - "Manually check the direction of each control surface and reverse any channels that make controls move in the wrong direction. " - "Remove the propeller/propellers before you try to control your model for the first time.
" - "Please note that continuing removes all old model settings!"), -1)); - setStartId(Page_Models); + setPage(Page_Models, new ModelSelectionPage(this, "models",tr("Model Type"),tr("Enter model name and model type."))); + setPage(Page_Throttle, new ThrottlePage(this, "throttle",tr("Throttle"),tr("Has your model got a motor or an engine?"), Page_Wingtypes)); + setPage(Page_Wingtypes, new WingtypeSelectionPage(this, "wingtype",tr("Wing Type"),tr("Is your model a flying wing/deltawing or has it a standard wing configuration?"))); + setPage(Page_Ailerons, new AileronsPage(this, "ailerons",tr("Ailerons"),tr("Has your model got ailerons?"), Page_Flaps)); + setPage(Page_Flaps, new FlapsPage(this, "flaps",tr("Flaps"),tr("Has your model got flaps?"), Page_Airbrakes)); + setPage(Page_Airbrakes, new AirbreaksPage(this, "airbrakes",tr("Airbrakes"),tr("Has your model got airbrakes?"), Page_Tails)); + setPage(Page_Bank, new BankPage(this, "bank",tr("Flying-wing / Delta-wing"),tr("Are the elevons controlled by servos connected to separate channels or by a single servo channel?"), Page_Rudder)); + setPage(Page_Rudder, new RudderPage(this, "rudder",tr("Rudder"),tr("Does your model have a rudder?"), Page_Conclusion)); + setPage(Page_Tails, new TailSelectionPage(this, "tails",tr("Tail Type"),tr("Select which type of tail your model is equiped with."))); + setPage(Page_Tail, new TailPage(this, "tail",tr("Tail"),tr("Select channels for tail control."), Page_Conclusion)); + setPage(Page_Vtail, new VTailPage(this, "vtail",tr("V-Tail"),tr("Select channels for tail control."), Page_Conclusion)); + setPage(Page_Simpletail, new SimpleTailPage(this, "simpletail",tr("Tail"),tr("Select elevator channel."), Page_Conclusion)); + setPage(Page_Cyclic, new CyclicPage(this, "cyclic",tr("Cyclic"),tr("Which type of swash control is installed in your helicopter?"), Page_Gyro)); + setPage(Page_Gyro, new GyroPage(this, "gyro",tr("Tail Gyro"),tr("Has your helicopter got an adjustable gyro for the tail?"), Page_Flybar)); + setPage(Page_Flybar, new FlybarSelectionPage(this, "flybar",tr("Rotor Type"),tr("Has your helicopter got a flybar?"))); + setPage(Page_Fblheli, new FblPage(this, "fblheli",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Conclusion)); + setPage(Page_Helictrl, new HeliPage(this, "helictrl",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Conclusion)); + setPage(Page_Multirotor, new MultirotorPage(this, "multirotor",tr("Multirotor"),tr("Select the control channels for your multirotor"), Page_Conclusion)); + setPage(Page_Conclusion, new ConclusionPage(this, "conclusion",tr("Save Changes"),tr( + "Manually check the direction of each control surface and reverse any channels that make controls move in the wrong direction. " + "Remove the propeller/propellers before you try to control your model for the first time.
" + "Please note that continuing removes all old model settings!"), -1)); + setStartId(Page_Models); #ifndef Q_WS_MAC - setWizardStyle(ModernStyle); + setWizardStyle(ModernStyle); #endif - setOption(HaveHelpButton, true); - connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp())); + setOption(HaveHelpButton, true); + connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp())); } void WizardDialog::showHelp() { - QString message; + QString message; - switch (currentId()) { - case Page_Models: message = tr("Select the type of model you want to create settings for."); break; - case Page_Throttle: message = tr("Select the receiver channel that is connected to your ESC or throttle servo."); break; - case Page_Wingtypes: message = tr("The wing control surfaces of flying wings and delta winged aircraft are called elevons and are used for controlling both elevation and roll. " - "These aircrafts do not have a tail with control surfaces"); break; - case Page_Ailerons: message = tr("One or two channels are used to control the Ailerons. " - "If your servos are connected by a common Y-cable you should select the single-servo option."); break; - case Page_Flaps: message = tr("This wizard assumes that your flaps are controlled by a switch. " - "If your flaps are controlled by a potentiometer you can change that manually later." - "Just select the correct receiver channel and an arbitrary switch."); break; - case Page_Airbrakes: message = tr("Air brakes are used to reduce the speed of advanced sail planes. " - "It is very uncommon on other types of planes."); break; - case Page_Bank: message = tr("Please note that, even if the elevons are controlled by separate servos, " - "these may be controlled by a common channel."); break; - case Page_Rudder: message = tr("TBD."); break; - case Page_Tails: message = tr("Select the tail type of your plane."); break; - case Page_Tail: message = tr("TBD."); break; - case Page_Vtail: message = tr("TBD."); break; - case Page_Simpletail: message = tr("TBD."); break; - case Page_Flybar: message = tr("TBD."); break; - case Page_Cyclic: message = tr("TBD."); break; - case Page_Gyro: message = tr("TBD."); break; - case Page_Fblheli: message = tr("TBD."); break; - case Page_Helictrl: message = tr("TBD."); break; - case Page_Multirotor: message = tr("TBD."); break; - case Page_Conclusion: message = tr("TBD."); break; - default: message = tr("Move on. Nothin to see here."); - } - QMessageBox::information(this, tr("Model Wizard Help"), message); + switch (currentId()) { + case Page_Models: + message = tr("Enter a name for your model and select model type."); break; + case Page_Throttle: + message = tr("Select the receiver channel that is connected to your ESC or throttle servo.

" + "Throttle - Spektrum: CH1, Futaba: CH3"); break; + case Page_Wingtypes: + message = tr("Most aircraft have a main wing and a tail with control surfaces. Flying wings and delta winged aircraft only have a single wing. " + "The main control surface on a standard wing controlls the roll of the aircraft. This surface is called an aileron.
" + "The control surface of a delta wing controls both roll and elevation. This surface is called an elevon. "); break; + case Page_Ailerons: + message = tr("Models use one or two channels to control the ailerons.
" + "A so called Y-cable can be used to connect single receiver channel to two separeate aileron servos. " + "If your servos are connected by a Y-cable you should select the single-servo option.

" + "Aileron - Spektrum: CH2, Futaba: CH1"); break; + case Page_Flaps: + message = tr("This wizard assumes that your flaps are controlled by a switch. " + "If your flaps are controlled by a potentiometer you can change that manually later."); break; + case Page_Airbrakes: + message = tr("Air brakes are used to reduce the speed of advanced sail planes.
" + "They are very uncommon on other types of planes."); break; + case Page_Bank: + message = tr("Models use one or two channels to control the elevons.
" + "A so called Y-cable can be used to connect single receiver channel to two separeate elevon servos. " + "If your servos are connected by a Y-cable you should select the single-servo option."); break; + case Page_Rudder: + message = tr("Select the receiver channel that is connected to your rudder.

" + "Rudder - Spektrum: CH4, Futaba: CH4"); break; + case Page_Tails: + message = tr("Select the tail type of your plane."); break; + case Page_Tail: + message = tr("Select the Rudder and Elevator channels.

" + "Rudder - Spektrum: CH4, Futaba: CH4
" + "Elevator - Spektrum: CH3, Futaba: CH2"); break; + case Page_Vtail: + message = tr("Select the Rudder and Elevator channels.

" + "Rudder - Spektrum: CH4, Futaba: CH4
" + "Elevator - Spektrum: CH3, Futaba: CH2"); break; + case Page_Simpletail: + message = tr("Select the Elevator channel.

" + "Elevator - Spektrum: CH3, Futaba: CH2"); break; + case Page_Flybar: + message = tr("TBD."); break; + case Page_Cyclic: + message = tr("TBD."); break; + case Page_Gyro: + message = tr("TBD."); break; + case Page_Fblheli: + message = tr("TBD."); break; + case Page_Helictrl: + message = tr("TBD."); break; + case Page_Multirotor: + message = tr("Select the control channels for your multirotor.

" + "Throttle - Spektrum: CH1, Futaba: CH3
" + "Yaw - Spektrum: CH4, Futaba: CH4
" + "Pitch - Spektrum: CH3, Futaba: CH2
" + "Roll - Spektrum: CH2, Futaba: CH1"); break; + case Page_Conclusion: + message = tr("TBD."); break; + default: + message = tr("There is no help available for the current page."); + } + QMessageBox::information(this, tr("Model Wizard Help"), message); } StandardPage::StandardPage(int currentPage, WizardDialog *dlg, QString image, QString title, QString text, int nextPage ) - : QWizardPage() + : QWizardPage() { - pageCurrent = currentPage; - pageFollower = nextPage; - wizDlg = dlg; + pageCurrent = currentPage; + pageFollower = nextPage; + wizDlg = dlg; - setTitle(title); - setPixmap(QWizard::WatermarkPixmap, QPixmap(QString(":/images/wizard/") + image + QString(".png"))); - topLabel = new QLabel(text+"
"); - topLabel->setWordWrap(true); + setTitle(title); + setPixmap(QWizard::WatermarkPixmap, QPixmap(QString(":/images/wizard/") + image + QString(".png"))); + topLabel = new QLabel(text+"
"); + topLabel->setWordWrap(true); - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(topLabel); - setLayout(layout); + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(topLabel); + setLayout(layout); } void StandardPage::populateCB( QComboBox *CB ) @@ -137,7 +130,7 @@ void StandardPage::populateCB( QComboBox *CB ) for (int i=0; ichannel[i].isEmpty()){ + if (wizDlg->mix.channel[i].isEmpty()){ CB->addItem(tr("Channel ") + QString("%1").arg(i+1), i); } } @@ -149,15 +142,15 @@ bool StandardPage::bookChannel(QString label, Input input1, int weight1, Input i if (index<0 || index >= MAX_CHANNELS) return false; - if (!wizDlg->channel[index].isEmpty()) + if (!wizDlg->mix.channel[index].isEmpty()) return false; - wizDlg->channel[index].sourceDlg = pageCurrent; - wizDlg->channel[index].input1 = input1; - wizDlg->channel[index].input2 = input2; - wizDlg->channel[index].weight1 = weight1; - wizDlg->channel[index].weight2 = weight2; - + wizDlg->mix.channel[index].sourceDlg = pageCurrent; + wizDlg->mix.channel[index].input1 = input1; + wizDlg->mix.channel[index].input2 = input2; + wizDlg->mix.channel[index].weight1 = weight1; + wizDlg->mix.channel[index].weight2 = weight2; + return true; } @@ -165,8 +158,8 @@ void StandardPage::releaseChannels() { for (int i=0; ichannel[i].sourceDlg == pageCurrent){ - wizDlg->channel[i].clear(); + if (wizDlg->mix.channel[i].sourceDlg == pageCurrent){ + wizDlg->mix.channel[i].clear(); } } } @@ -178,119 +171,131 @@ void StandardPage::cleanupPage() int StandardPage::nextId() const { - return pageFollower; + return pageFollower; } ModelSelectionPage::ModelSelectionPage(WizardDialog *dlg, QString image, QString title, QString text) - : StandardPage(WizardDialog::Page_Models, dlg, image, title, text) + : StandardPage(WizardDialog::Page_Models, dlg, image, title, text) { - nameLineEdit = new QLineEdit; - planeRB = new QRadioButton(tr("Plane")); - planeRB->setChecked(true); - multirotorRB = new QRadioButton(tr("Multirotor")); - helicopterRB = new QRadioButton(tr("Helicopter")); + nameLineEdit = new QLineEdit; + planeRB = new QRadioButton(tr("Plane")); + planeRB->setChecked(true); + multirotorRB = new QRadioButton(tr("Multirotor")); + helicopterRB = new QRadioButton(tr("Helicopter")); - registerField("evaluate.name*", nameLineEdit); + registerField("evaluate.name*", nameLineEdit); - QLayout *l = layout(); - l->addWidget(new QLabel(tr("Model Name:"))); - l->addWidget(nameLineEdit); - l->addWidget(new QLabel("")); - l->addWidget(new QLabel(tr("Model Type:"))); - l->addWidget(planeRB); - l->addWidget(multirotorRB); - l->addWidget(helicopterRB); + QLayout *l = layout(); + l->addWidget(new QLabel(tr("Model Name:"))); + l->addWidget(nameLineEdit); + l->addWidget(new QLabel("")); + l->addWidget(new QLabel(tr("Model Type:"))); + l->addWidget(planeRB); + l->addWidget(multirotorRB); + l->addWidget(helicopterRB); +} + +bool ModelSelectionPage::validatePage() +{ + wizDlg->mix.name = nameLineEdit->text(); + if (multirotorRB->isChecked()) + wizDlg->mix.vehicleType = MULTICOPTER; + else if (helicopterRB->isChecked()) + wizDlg->mix.vehicleType = HELICOPTER; + else + wizDlg->mix.vehicleType = PLANE; + return true; } int ModelSelectionPage::nextId() const { - if (helicopterRB->isChecked()) - return WizardDialog::Page_Cyclic; - else if (multirotorRB->isChecked()) - return WizardDialog::Page_Multirotor; - else - return WizardDialog::Page_Throttle; + if (helicopterRB->isChecked()) + return WizardDialog::Page_Cyclic; + else if (multirotorRB->isChecked()) + return WizardDialog::Page_Multirotor; + else + return WizardDialog::Page_Throttle; } WingtypeSelectionPage::WingtypeSelectionPage(WizardDialog *dlg, QString image, QString title, QString text) - : StandardPage(WizardDialog::Page_Wingtypes, dlg, image, title, text) + : StandardPage(WizardDialog::Page_Wingtypes, dlg, image, title, text) { - standardWingRB = new QRadioButton(tr("Standard Wing")); - standardWingRB->setChecked(true); - deltaWingRB = new QRadioButton(tr("Flying Wing / Deltawing")); + standardWingRB = new QRadioButton(tr("Standard Wing")); + standardWingRB->setChecked(true); + deltaWingRB = new QRadioButton(tr("Flying Wing / Deltawing")); - QLayout *l = layout(); - l->addWidget(standardWingRB); - l->addWidget(deltaWingRB); + QLayout *l = layout(); + l->addWidget(standardWingRB); + l->addWidget(deltaWingRB); } int WingtypeSelectionPage::nextId() const { - if (deltaWingRB->isChecked()) - return WizardDialog::Page_Bank; - else - return WizardDialog::Page_Ailerons; + if (deltaWingRB->isChecked()) + return WizardDialog::Page_Bank; + else + return WizardDialog::Page_Ailerons; } TailSelectionPage::TailSelectionPage(WizardDialog *dlg, QString image, QString title, QString text) - : StandardPage(WizardDialog::Page_Tails, dlg, image, title, text) + : StandardPage(WizardDialog::Page_Tails, dlg, image, title, text) { - standardTailRB = new QRadioButton(tr("Elevator and Rudder")); - standardTailRB->setChecked(true); - simpleTailRB = new QRadioButton(tr("Only Elevator")); - vTailRB = new QRadioButton(tr("V-tail")); + standardTailRB = new QRadioButton(tr("Elevator and Rudder")); + standardTailRB->setChecked(true); + simpleTailRB = new QRadioButton(tr("Only Elevator")); + vTailRB = new QRadioButton(tr("V-tail")); - QLayout *l = layout(); - l->addWidget(new QLabel(tr("Tail Type:"))); - l->addWidget(standardTailRB); - l->addWidget(simpleTailRB); - l->addWidget(vTailRB); + QLayout *l = layout(); + l->addWidget(new QLabel(tr("Tail Type:"))); + l->addWidget(standardTailRB); + l->addWidget(simpleTailRB); + l->addWidget(vTailRB); } int TailSelectionPage::nextId() const { - if (simpleTailRB->isChecked()) - return WizardDialog::Page_Simpletail; - else if (vTailRB->isChecked()) - return WizardDialog::Page_Vtail; - else - return WizardDialog::Page_Tail; + if (simpleTailRB->isChecked()) + return WizardDialog::Page_Simpletail; + else if (vTailRB->isChecked()) + return WizardDialog::Page_Vtail; + else + return WizardDialog::Page_Tail; } FlybarSelectionPage::FlybarSelectionPage(WizardDialog *dlg, QString image, QString title, QString text) - : StandardPage(WizardDialog::Page_Flybar, dlg, image, title, text) + : StandardPage(WizardDialog::Page_Flybar, dlg, image, title, text) { - flybarRB = new QRadioButton(tr("Has Flybar")); - flybarRB->setChecked(true); - noFlybarRB = new QRadioButton(tr("Flybarless")); + flybarRB = new QRadioButton(tr("Has Flybar")); + flybarRB->setChecked(true); + noFlybarRB = new QRadioButton(tr("Flybarless")); - QLayout *l = layout(); - l->addWidget(new QLabel(tr("Flybar:"))); - l->addWidget(flybarRB); - l->addWidget(noFlybarRB); + QLayout *l = layout(); + l->addWidget(new QLabel(tr("Flybar:"))); + l->addWidget(flybarRB); + l->addWidget(noFlybarRB); } int FlybarSelectionPage::nextId() const { - if (flybarRB->isChecked()) - return WizardDialog::Page_Helictrl; - else - return WizardDialog::Page_Fblheli; + if (flybarRB->isChecked()) + return WizardDialog::Page_Helictrl; + else + return WizardDialog::Page_Fblheli; } ThrottlePage::ThrottlePage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Throttle, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Throttle, dlg, image, title, text, nextPage) { - motorRB = new QRadioButton(tr("Yes")); - noMotorRB = new QRadioButton(tr("No")); - motorRB->setChecked(true); - throttleCB = new QComboBox(); + motorRB = new QRadioButton(tr("Yes")); + noMotorRB = new QRadioButton(tr("No")); + motorRB->setChecked(true); + throttleCB = new QComboBox(); - QLayout *l = layout(); - l->addWidget(motorRB); - l->addWidget(noMotorRB); - l->addWidget(new QLabel(tr("
Throttle Channel:"))); - l->addWidget(throttleCB); + QLayout *l = layout(); + l->addWidget(motorRB); + l->addWidget(noMotorRB); + l->addWidget(new QLabel(tr("
Throttle Channel:"))); + l->addWidget(throttleCB); } void ThrottlePage::initializePage(){ @@ -303,23 +308,23 @@ bool ThrottlePage::validatePage() { } AileronsPage::AileronsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Ailerons, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Ailerons, dlg, image, title, text, nextPage) { - noAileronsRB = new QRadioButton(tr("No")); - oneAileronRB = new QRadioButton(tr("Yes, controlled by a single channel")); - twoAileronsRB = new QRadioButton(tr("Yes, controlled by two channels")); - noAileronsRB->setChecked(true); - aileron1CB = new QComboBox(); - aileron2CB = new QComboBox(); - - QLayout *l = layout(); - l->addWidget(noAileronsRB); - l->addWidget(oneAileronRB); - l->addWidget(twoAileronsRB); - l->addWidget(new QLabel(tr("
First Aileron Channel:"))); - l->addWidget(aileron1CB); - l->addWidget(new QLabel(tr("Second Aileron Channel:"))); - l->addWidget(aileron2CB); + noAileronsRB = new QRadioButton(tr("No")); + oneAileronRB = new QRadioButton(tr("Yes, controlled by a single channel")); + twoAileronsRB = new QRadioButton(tr("Yes, controlled by two channels")); + noAileronsRB->setChecked(true); + aileron1CB = new QComboBox(); + aileron2CB = new QComboBox(); + + QLayout *l = layout(); + l->addWidget(noAileronsRB); + l->addWidget(oneAileronRB); + l->addWidget(twoAileronsRB); + l->addWidget(new QLabel(tr("
First Aileron Channel:"))); + l->addWidget(aileron1CB); + l->addWidget(new QLabel(tr("Second Aileron Channel:"))); + l->addWidget(aileron2CB); } void AileronsPage::initializePage(){ @@ -336,27 +341,27 @@ bool AileronsPage::validatePage() { return (bookChannel(aileron1CB->currentText(), AILERON, 100 )); } return( bookChannel(aileron1CB->currentText(), AILERON, 100 ) && - bookChannel(aileron2CB->currentText(), AILERON, 100 )); + bookChannel(aileron2CB->currentText(), AILERON, 100 )); } FlapsPage::FlapsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Flaps, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Flaps, dlg, image, title, text, nextPage) { - noFlapsRB = new QRadioButton(tr("No")); - oneFlapRB = new QRadioButton(tr("Yes, controlled by a single channel")); - twoFlapsRB = new QRadioButton(tr("Yes, controlled by two channels")); - noFlapsRB->setChecked(true); - flap1CB = new QComboBox(); - flap2CB = new QComboBox(); + noFlapsRB = new QRadioButton(tr("No")); + oneFlapRB = new QRadioButton(tr("Yes, controlled by a single channel")); + twoFlapsRB = new QRadioButton(tr("Yes, controlled by two channels")); + noFlapsRB->setChecked(true); + flap1CB = new QComboBox(); + flap2CB = new QComboBox(); - QLayout *l = layout(); - l->addWidget(noFlapsRB); - l->addWidget(oneFlapRB); - l->addWidget(twoFlapsRB); - l->addWidget(new QLabel(tr("
First Flap Channel:"))); - l->addWidget(flap1CB); - l->addWidget(new QLabel(tr("Second Flap Channel:"))); - l->addWidget(flap2CB); + QLayout *l = layout(); + l->addWidget(noFlapsRB); + l->addWidget(oneFlapRB); + l->addWidget(twoFlapsRB); + l->addWidget(new QLabel(tr("
First Flap Channel:"))); + l->addWidget(flap1CB); + l->addWidget(new QLabel(tr("Second Flap Channel:"))); + l->addWidget(flap2CB); } void FlapsPage::initializePage(){ @@ -373,27 +378,27 @@ bool FlapsPage::validatePage() { return (bookChannel(flap1CB->currentText(), FLAP, 100 )); } return( bookChannel(flap1CB->currentText(), FLAP, 100 ) && - bookChannel(flap2CB->currentText(), FLAP, 100 )); + bookChannel(flap2CB->currentText(), FLAP, 100 )); } AirbreaksPage::AirbreaksPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Airbrakes, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Airbrakes, dlg, image, title, text, nextPage) { - noAirbreaksRB = new QRadioButton(tr("No")); - oneAirbreakRB = new QRadioButton(tr("Yes, controlled by a single channel")); - twoAirbreaksRB = new QRadioButton(tr("Yes, controlled by two channels")); - noAirbreaksRB->setChecked(true); - airbreak1CB = new QComboBox(); - airbreak2CB = new QComboBox(); + noAirbreaksRB = new QRadioButton(tr("No")); + oneAirbreakRB = new QRadioButton(tr("Yes, controlled by a single channel")); + twoAirbreaksRB = new QRadioButton(tr("Yes, controlled by two channels")); + noAirbreaksRB->setChecked(true); + airbreak1CB = new QComboBox(); + airbreak2CB = new QComboBox(); - QLayout *l = layout(); - l->addWidget(noAirbreaksRB); - l->addWidget(oneAirbreakRB); - l->addWidget(twoAirbreaksRB); - l->addWidget(new QLabel(tr("
First Airbreak Channel:"))); - l->addWidget(airbreak1CB); - l->addWidget(new QLabel(tr("Second Airbreak Channel:"))); - l->addWidget(airbreak2CB); + QLayout *l = layout(); + l->addWidget(noAirbreaksRB); + l->addWidget(oneAirbreakRB); + l->addWidget(twoAirbreaksRB); + l->addWidget(new QLabel(tr("
First Airbreak Channel:"))); + l->addWidget(airbreak1CB); + l->addWidget(new QLabel(tr("Second Airbreak Channel:"))); + l->addWidget(airbreak2CB); } void AirbreaksPage::initializePage(){ @@ -410,25 +415,25 @@ bool AirbreaksPage::validatePage() { return (bookChannel(airbreak1CB->currentText(), AIRBREAK, 100 )); } return( bookChannel(airbreak1CB->currentText(), AIRBREAK, 100 ) && - bookChannel(airbreak2CB->currentText(), AIRBREAK, 100 )); + bookChannel(airbreak2CB->currentText(), AIRBREAK, 100 )); } BankPage::BankPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Bank, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Bank, dlg, image, title, text, nextPage) { - oneElevonChRB = new QRadioButton(tr("One")); - oneElevonChRB->setChecked(true); - twoElevonsChRB = new QRadioButton(tr("Two")); - elevon1CB = new QComboBox(); - elevon2CB = new QComboBox(); + oneElevonChRB = new QRadioButton(tr("One")); + oneElevonChRB->setChecked(true); + twoElevonsChRB = new QRadioButton(tr("Two")); + elevon1CB = new QComboBox(); + elevon2CB = new QComboBox(); - QLayout *l = layout(); - l->addWidget(oneElevonChRB); - l->addWidget(twoElevonsChRB); - l->addWidget(new QLabel(tr("
First Elevon Channel:"))); - l->addWidget(elevon1CB); - l->addWidget(new QLabel(tr("Second Elevon Channel:"))); - l->addWidget(elevon2CB); + QLayout *l = layout(); + l->addWidget(oneElevonChRB); + l->addWidget(twoElevonsChRB); + l->addWidget(new QLabel(tr("
First Elevon Channel:"))); + l->addWidget(elevon1CB); + l->addWidget(new QLabel(tr("Second Elevon Channel:"))); + l->addWidget(elevon2CB); } void BankPage::initializePage(){ @@ -442,22 +447,22 @@ bool BankPage::validatePage() { return (bookChannel(elevon1CB->currentText(), AILERON, 100, ELEVATOR, 100 )); } return( bookChannel(elevon1CB->currentText(), AILERON, 100, ELEVATOR, 100 ) && - bookChannel(elevon2CB->currentText(), AILERON, 100, ELEVATOR, 100 )); + bookChannel(elevon2CB->currentText(), AILERON, 100, ELEVATOR, 100 )); } RudderPage::RudderPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Rudder, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Rudder, dlg, image, title, text, nextPage) { - noRudderRB = new QRadioButton(tr("No")); - noRudderRB->setChecked(true); - hasRudderRB = new QRadioButton(tr("Yes")); - rudderCB = new QComboBox(); + noRudderRB = new QRadioButton(tr("No")); + noRudderRB->setChecked(true); + hasRudderRB = new QRadioButton(tr("Yes")); + rudderCB = new QComboBox(); - QLayout *l = layout(); - l->addWidget(noRudderRB); - l->addWidget(hasRudderRB); - l->addWidget(new QLabel(tr("
Rudder Channel:"))); - l->addWidget(rudderCB); + QLayout *l = layout(); + l->addWidget(noRudderRB); + l->addWidget(hasRudderRB); + l->addWidget(new QLabel(tr("
Rudder Channel:"))); + l->addWidget(rudderCB); } void RudderPage::initializePage(){ @@ -467,22 +472,22 @@ void RudderPage::initializePage(){ bool RudderPage::validatePage() { releaseChannels(); if (noRudderRB->isChecked()) - return true; + return true; return (bookChannel(rudderCB->currentText(), RUDDER, 100)); } VTailPage::VTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Tail, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Tail, dlg, image, title, text, nextPage) { - tail1CB = new QComboBox(); - tail2CB = new QComboBox(); + tail1CB = new QComboBox(); + tail2CB = new QComboBox(); - QLayout *l = layout(); - l->addWidget(new QLabel(tr("First Tail Channel:"))); - l->addWidget(tail1CB); - l->addWidget(new QLabel(tr("Second Tail Channel:"))); - l->addWidget(tail2CB); + QLayout *l = layout(); + l->addWidget(new QLabel(tr("First Tail Channel:"))); + l->addWidget(tail1CB); + l->addWidget(new QLabel(tr("Second Tail Channel:"))); + l->addWidget(tail2CB); } void VTailPage::initializePage(){ @@ -493,20 +498,20 @@ void VTailPage::initializePage(){ bool VTailPage::validatePage() { releaseChannels(); return( bookChannel(tail1CB->currentText(), ELEVATOR, 100, RUDDER, 100 ) && - bookChannel(tail2CB->currentText(), ELEVATOR, 100, RUDDER, 100 )); + bookChannel(tail2CB->currentText(), ELEVATOR, 100, RUDDER, 100 )); } TailPage::TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Tail, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Tail, dlg, image, title, text, nextPage) { - elevatorCB = new QComboBox(); - rudderCB = new QComboBox(); + elevatorCB = new QComboBox(); + rudderCB = new QComboBox(); - QLayout *l = layout(); - l->addWidget(new QLabel(tr("Rudder Channel:"))); - l->addWidget(rudderCB); - l->addWidget(new QLabel(tr("Elevator Channel:"))); - l->addWidget(elevatorCB); + QLayout *l = layout(); + l->addWidget(new QLabel(tr("Rudder Channel:"))); + l->addWidget(rudderCB); + l->addWidget(new QLabel(tr("Elevator Channel:"))); + l->addWidget(elevatorCB); } void TailPage::initializePage(){ @@ -517,17 +522,17 @@ void TailPage::initializePage(){ bool TailPage::validatePage() { releaseChannels(); return( bookChannel(elevatorCB->currentText(), ELEVATOR, 100 ) && - bookChannel(rudderCB->currentText(), RUDDER, 100 )); + bookChannel(rudderCB->currentText(), RUDDER, 100 )); } SimpleTailPage::SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Simpletail, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Simpletail, dlg, image, title, text, nextPage) { - elevatorCB = new QComboBox(); + elevatorCB = new QComboBox(); - QLayout *l = layout(); - l->addWidget(new QLabel(tr("Elevator Channel:"))); - l->addWidget(elevatorCB); + QLayout *l = layout(); + l->addWidget(new QLabel(tr("Elevator Channel:"))); + l->addWidget(elevatorCB); } void SimpleTailPage::initializePage(){ @@ -540,19 +545,19 @@ bool SimpleTailPage::validatePage() { } CyclicPage::CyclicPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Cyclic, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Cyclic, dlg, image, title, text, nextPage) { - cyclic90RB = new QRadioButton(tr("90")); - cyclic90RB->setChecked(true); - cyclic120RB = new QRadioButton(tr("120")); - cyclic120XRB = new QRadioButton(tr("120x")); - cyclic140RB = new QRadioButton(tr("140")); + cyclic90RB = new QRadioButton(tr("90")); + cyclic90RB->setChecked(true); + cyclic120RB = new QRadioButton(tr("120")); + cyclic120XRB = new QRadioButton(tr("120x")); + cyclic140RB = new QRadioButton(tr("140")); - QLayout *l = layout(); - l->addWidget(cyclic90RB); - l->addWidget(cyclic120RB); - l->addWidget(cyclic120XRB); - l->addWidget(cyclic140RB); + QLayout *l = layout(); + l->addWidget(cyclic90RB); + l->addWidget(cyclic120RB); + l->addWidget(cyclic120XRB); + l->addWidget(cyclic140RB); } void CyclicPage::initializePage(){ @@ -564,17 +569,17 @@ bool CyclicPage::validatePage() { } GyroPage::GyroPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Gyro, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Gyro, dlg, image, title, text, nextPage) { - noGyroRB = new QRadioButton(tr("No")); - noGyroRB->setChecked(true); - switchGyroRB = new QRadioButton(tr("Yes, controled by a switch")); - potGyroRB = new QRadioButton(tr("Yes, controlled by a pot")); + noGyroRB = new QRadioButton(tr("No")); + noGyroRB->setChecked(true); + switchGyroRB = new QRadioButton(tr("Yes, controled by a switch")); + potGyroRB = new QRadioButton(tr("Yes, controlled by a pot")); - QLayout *l = layout(); - l->addWidget(noGyroRB); - l->addWidget(switchGyroRB); - l->addWidget(potGyroRB); + QLayout *l = layout(); + l->addWidget(noGyroRB); + l->addWidget(switchGyroRB); + l->addWidget(potGyroRB); } void GyroPage::initializePage(){ @@ -586,22 +591,22 @@ bool GyroPage::validatePage() { } FblPage::FblPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Fblheli, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Fblheli, dlg, image, title, text, nextPage) { - throttleCB = new QComboBox(); - yawCB = new QComboBox(); - pitchCB = new QComboBox(); - rollCB = new QComboBox(); + throttleCB = new QComboBox(); + yawCB = new QComboBox(); + pitchCB = new QComboBox(); + rollCB = new QComboBox(); - QLayout *l = layout(); - l->addWidget(new QLabel(tr("Trottle Channel:"))); - l->addWidget(throttleCB); - l->addWidget(new QLabel(tr("Yaw Channel:"))); - l->addWidget(yawCB); - l->addWidget(new QLabel(tr("Pitch Channel:"))); - l->addWidget(pitchCB); - l->addWidget(new QLabel(tr("Roll Channel:"))); - l->addWidget(rollCB); + QLayout *l = layout(); + l->addWidget(new QLabel(tr("Trottle Channel:"))); + l->addWidget(throttleCB); + l->addWidget(new QLabel(tr("Yaw Channel:"))); + l->addWidget(yawCB); + l->addWidget(new QLabel(tr("Pitch Channel:"))); + l->addWidget(pitchCB); + l->addWidget(new QLabel(tr("Roll Channel:"))); + l->addWidget(rollCB); } void FblPage::initializePage(){ @@ -614,28 +619,28 @@ void FblPage::initializePage(){ bool FblPage::validatePage() { releaseChannels(); return( bookChannel(throttleCB->currentText(), THROTTLE, 100 ) && - bookChannel(yawCB->currentText(), RUDDER, 100 ) && - bookChannel(pitchCB->currentText(), ELEVATOR, 100 ) && - bookChannel(rollCB->currentText(), AILERON, 100 )); + bookChannel( yawCB->currentText(), RUDDER, 100 ) && + bookChannel( pitchCB->currentText(), ELEVATOR, 100 ) && + bookChannel( rollCB->currentText(), AILERON, 100 )); } HeliPage::HeliPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Helictrl, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Helictrl, dlg, image, title, text, nextPage) { - throttleCB = new QComboBox(); - yawCB = new QComboBox(); - pitchCB = new QComboBox(); - rollCB = new QComboBox(); + throttleCB = new QComboBox(); + yawCB = new QComboBox(); + pitchCB = new QComboBox(); + rollCB = new QComboBox(); - QLayout *l = layout(); - l->addWidget(new QLabel(tr("Trottle Channel:"))); - l->addWidget(throttleCB); - l->addWidget(new QLabel(tr("Yaw Channel:"))); - l->addWidget(yawCB); - l->addWidget(new QLabel(tr("Pitch Channel:"))); - l->addWidget(pitchCB); - l->addWidget(new QLabel(tr("Roll Channel:"))); - l->addWidget(rollCB); + QLayout *l = layout(); + l->addWidget(new QLabel(tr("Trottle Channel:"))); + l->addWidget(throttleCB); + l->addWidget(new QLabel(tr("Yaw Channel:"))); + l->addWidget(yawCB); + l->addWidget(new QLabel(tr("Pitch Channel:"))); + l->addWidget(pitchCB); + l->addWidget(new QLabel(tr("Roll Channel:"))); + l->addWidget(rollCB); } void HeliPage::initializePage(){ @@ -648,28 +653,28 @@ void HeliPage::initializePage(){ bool HeliPage::validatePage() { releaseChannels(); return( bookChannel(throttleCB->currentText(), THROTTLE, 100 ) && - bookChannel(yawCB->currentText(), RUDDER, 100 ) && - bookChannel(pitchCB->currentText(), ELEVATOR, 100 ) && - bookChannel(rollCB->currentText(), AILERON, 100 )); + bookChannel( yawCB->currentText(), RUDDER, 100 ) && + bookChannel( pitchCB->currentText(), ELEVATOR, 100 ) && + bookChannel( rollCB->currentText(), AILERON, 100 )); } MultirotorPage::MultirotorPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Multirotor, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Multirotor, dlg, image, title, text, nextPage) { - throttleCB = new QComboBox(); - yawCB = new QComboBox(); - pitchCB = new QComboBox(); - rollCB = new QComboBox(); + throttleCB = new QComboBox(); + yawCB = new QComboBox(); + pitchCB = new QComboBox(); + rollCB = new QComboBox(); - QLayout *l = layout(); - l->addWidget(new QLabel(tr("Trottle Channel:"))); - l->addWidget(throttleCB); - l->addWidget(new QLabel(tr("Yaw Channel:"))); - l->addWidget(yawCB); - l->addWidget(new QLabel(tr("Pitch Channel:"))); - l->addWidget(pitchCB); - l->addWidget(new QLabel(tr("Roll Channel:"))); - l->addWidget(rollCB); + QLayout *l = layout(); + l->addWidget(new QLabel(tr("Trottle Channel:"))); + l->addWidget(throttleCB); + l->addWidget(new QLabel(tr("Yaw Channel:"))); + l->addWidget(yawCB); + l->addWidget(new QLabel(tr("Pitch Channel:"))); + l->addWidget(pitchCB); + l->addWidget(new QLabel(tr("Roll Channel:"))); + l->addWidget(rollCB); } void MultirotorPage::initializePage(){ @@ -682,33 +687,26 @@ void MultirotorPage::initializePage(){ bool MultirotorPage::validatePage() { releaseChannels(); return( bookChannel(throttleCB->currentText(), THROTTLE, 100 ) && - bookChannel(yawCB->currentText(), RUDDER, 100 ) && - bookChannel(pitchCB->currentText(), ELEVATOR, 100 ) && - bookChannel(rollCB->currentText(), AILERON, 100 )); + bookChannel(yawCB->currentText(), RUDDER, 100 ) && + bookChannel(pitchCB->currentText(), ELEVATOR, 100 ) && + bookChannel(rollCB->currentText(), AILERON, 100 )); } ConclusionPage::ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) - : StandardPage(WizardDialog::Page_Conclusion, dlg, image, title, text, nextPage) + : StandardPage(WizardDialog::Page_Conclusion, dlg, image, title, text, nextPage) { - textLabel = new QLabel(); - proceedCB = new QCheckBox(tr("OK, I understand.")); - registerField("evaluate.proceed*", proceedCB); + textLabel = new QLabel(); + proceedCB = new QCheckBox(tr("OK, I understand.")); + registerField("evaluate.proceed*", proceedCB); - QLayout *l = layout(); - l->addWidget(textLabel); - l->addWidget(proceedCB); + QLayout *l = layout(); + l->addWidget(textLabel); + l->addWidget(proceedCB); } void ConclusionPage::initializePage(){ - QString str; - for (int i=0; ichannel[i].isEmpty()){ - str += QString(tr("Channel %1: ").arg(i+1)); - str += wizDlg->channel[i].print(); - str += QString("
"); - } - } - textLabel->setText(str); + + textLabel->setText(wizDlg->mix.toString()); } diff --git a/companion/src/wizarddialog.h b/companion/src/wizarddialog.h index 36e52275e..0cbd18b95 100644 --- a/companion/src/wizarddialog.h +++ b/companion/src/wizarddialog.h @@ -1,7 +1,7 @@ #ifndef WIZARDDIALOG_H #define WIZARDDIALOG_H - #include +#include "wizarddata.h" QT_BEGIN_NAMESPACE class QCheckBox; @@ -11,197 +11,176 @@ class QRadioButton; class QComboBox; QT_END_NAMESPACE - -#define MAX_CHANNELS 8 - -enum Input {UNDEFINED, THROTTLE, RUDDER, ELEVATOR, AILERON, FLAP, AIRBREAK}; - -class Channel -{ -public: - int sourceDlg; - Input input1; - Input input2; - int weight1; - int weight2; - - Channel(); - QString nameOf(Input); - bool isEmpty(); - void clear(); - QString print(); -}; - - class WizardDialog : public QWizard { - Q_OBJECT + Q_OBJECT public: - enum { Page_Models, Page_Throttle, Page_Wingtypes, Page_Ailerons, Page_Flaps, - Page_Airbrakes, Page_Bank, Page_Rudder, Page_Tails, Page_Tail, - Page_Vtail, Page_Simpletail, Page_Cyclic, Page_Gyro, Page_Flybar, - Page_Fblheli, Page_Helictrl, Page_Multirotor, - Page_Conclusion }; + enum { Page_Models, Page_Throttle, Page_Wingtypes, Page_Ailerons, Page_Flaps, + Page_Airbrakes, Page_Bank, Page_Rudder, Page_Tails, Page_Tail, + Page_Vtail, Page_Simpletail, Page_Cyclic, Page_Gyro, Page_Flybar, + Page_Fblheli, Page_Helictrl, Page_Multirotor, + Page_Conclusion }; - Channel channel[MAX_CHANNELS]; - WizardDialog(QWidget *parent = 0); + Mix mix; + WizardDialog(QWidget *parent = 0); -private slots: + private slots: void showHelp(); }; class StandardPage: public QWizardPage { - Q_OBJECT + Q_OBJECT public: - StandardPage(int curPage, WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); - WizardDialog *wizDlg; - void populateCB( QComboBox *); - bool bookChannel(QString label, Input input1, int weight1, Input input2=UNDEFINED, int weight2=0 ); - void releaseChannels(); - void cleanupPage(); + StandardPage(int curPage, WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); + WizardDialog *wizDlg; + void populateCB( QComboBox *); + bool bookChannel(QString label, Input input1, int weight1, Input input2=NOINPUT, int weight2=0 ); + void releaseChannels(); + void cleanupPage(); private: - QLabel *topLabel; - int pageCurrent; - int pageFollower; - int nextId() const; + QLabel *topLabel; + int pageCurrent; + int pageFollower; + int nextId() const; }; class ModelSelectionPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - ModelSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); + ModelSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); private: - QLineEdit *nameLineEdit; - QRadioButton *planeRB; - QRadioButton *multirotorRB; - QRadioButton *helicopterRB; - int nextId() const; + QLineEdit *nameLineEdit; + QRadioButton *planeRB; + QRadioButton *multirotorRB; + QRadioButton *helicopterRB; + bool validatePage(); + int nextId() const; }; class WingtypeSelectionPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - WingtypeSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); + WingtypeSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); private: - QRadioButton *deltaWingRB; - QRadioButton *standardWingRB; - int nextId() const; + QRadioButton *deltaWingRB; + QRadioButton *standardWingRB; + int nextId() const; }; class TailSelectionPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - TailSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); + TailSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); private: - QRadioButton *vTailRB; - QRadioButton *standardTailRB; - QRadioButton *simpleTailRB; - int nextId() const; + QRadioButton *vTailRB; + QRadioButton *standardTailRB; + QRadioButton *simpleTailRB; + int nextId() const; }; class FlybarSelectionPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - FlybarSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); + FlybarSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); private: - QRadioButton *flybarRB; - QRadioButton *noFlybarRB; - int nextId() const; + QRadioButton *flybarRB; + QRadioButton *noFlybarRB; + int nextId() const; }; class ThrottlePage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - ThrottlePage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); - void initializePage(); - bool validatePage(); + ThrottlePage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); + void initializePage(); + bool validatePage(); private: - QRadioButton *motorRB; - QRadioButton *noMotorRB; - QComboBox *throttleCB; + QRadioButton *motorRB; + QRadioButton *noMotorRB; + QComboBox *throttleCB; }; class AileronsPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - AileronsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); - void initializePage(); - bool validatePage(); + AileronsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); + void initializePage(); + bool validatePage(); private: - QRadioButton *oneAileronRB; - QRadioButton *twoAileronsRB; - QRadioButton *noAileronsRB; - QComboBox *aileron1CB; - QComboBox *aileron2CB; + QRadioButton *oneAileronRB; + QRadioButton *twoAileronsRB; + QRadioButton *noAileronsRB; + QComboBox *aileron1CB; + QComboBox *aileron2CB; }; class FlapsPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - FlapsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); - void initializePage(); - bool validatePage(); + FlapsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); + void initializePage(); + bool validatePage(); private: - QRadioButton *oneFlapRB; - QRadioButton *twoFlapsRB; - QRadioButton *noFlapsRB; - QComboBox *flap1CB; - QComboBox *flap2CB; + QRadioButton *oneFlapRB; + QRadioButton *twoFlapsRB; + QRadioButton *noFlapsRB; + QComboBox *flap1CB; + QComboBox *flap2CB; }; class AirbreaksPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - AirbreaksPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); - void initializePage(); - bool validatePage(); + AirbreaksPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); + void initializePage(); + bool validatePage(); private: - QRadioButton *oneAirbreakRB; - QRadioButton *twoAirbreaksRB; - QRadioButton *noAirbreaksRB; - QComboBox *airbreak1CB; - QComboBox *airbreak2CB; + QRadioButton *oneAirbreakRB; + QRadioButton *twoAirbreaksRB; + QRadioButton *noAirbreaksRB; + QComboBox *airbreak1CB; + QComboBox *airbreak2CB; }; class BankPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - BankPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); - void initializePage(); - bool validatePage(); + BankPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); + void initializePage(); + bool validatePage(); private: - QRadioButton *oneElevonChRB; - QRadioButton *twoElevonsChRB; - QComboBox *elevon1CB; - QComboBox *elevon2CB; + QRadioButton *oneElevonChRB; + QRadioButton *twoElevonsChRB; + QComboBox *elevon1CB; + QComboBox *elevon2CB; }; class RudderPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - RudderPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); - void initializePage(); - bool validatePage(); + RudderPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); + void initializePage(); + bool validatePage(); private: - QRadioButton *noRudderRB; - QRadioButton *hasRudderRB; - QComboBox *rudderCB; + QRadioButton *noRudderRB; + QRadioButton *hasRudderRB; + QComboBox *rudderCB; }; class TailPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); void initializePage(); @@ -213,7 +192,7 @@ private: class VTailPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: VTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); void initializePage(); @@ -225,7 +204,7 @@ private: class SimpleTailPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); void initializePage(); @@ -236,34 +215,34 @@ private: class CyclicPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - CyclicPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); - void initializePage(); - bool validatePage(); + CyclicPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); + void initializePage(); + bool validatePage(); private: - QRadioButton *cyclic90RB; - QRadioButton *cyclic120RB; - QRadioButton *cyclic120XRB; - QRadioButton *cyclic140RB; + QRadioButton *cyclic90RB; + QRadioButton *cyclic120RB; + QRadioButton *cyclic120XRB; + QRadioButton *cyclic140RB; }; class GyroPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: - GyroPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); - void initializePage(); - bool validatePage(); + GyroPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); + void initializePage(); + bool validatePage(); private: - QRadioButton *noGyroRB; - QRadioButton *switchGyroRB; - QRadioButton *potGyroRB; + QRadioButton *noGyroRB; + QRadioButton *switchGyroRB; + QRadioButton *potGyroRB; }; class FblPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: FblPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); void initializePage(); @@ -277,7 +256,7 @@ private: class HeliPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: HeliPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); void initializePage(); @@ -291,7 +270,7 @@ private: class MultirotorPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: MultirotorPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); void initializePage(); @@ -305,7 +284,7 @@ private: class ConclusionPage: public StandardPage { - Q_OBJECT + Q_OBJECT public: ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); void initializePage();