1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 16:25:16 +03:00

Wizard data broken out into separate files.

This commit is contained in:
Kjell Kernen 2014-03-03 14:40:02 +01:00
parent 858c9193cb
commit b347b6f9c5
5 changed files with 597 additions and 512 deletions

View file

@ -152,6 +152,7 @@ set(companion_SRCS
mainwindow.cpp mainwindow.cpp
companion.cpp companion.cpp
qcustomplot.cpp qcustomplot.cpp
wizarddata.cpp
wizarddialog.cpp wizarddialog.cpp
) )
@ -176,6 +177,7 @@ set(companion_MOC_HDRS
mainwindow.h mainwindow.h
qcustomplot.h qcustomplot.h
helpers.h helpers.h
wizarddata.h
wizarddialog.h wizarddialog.h
) )

View file

@ -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<MAX_CHANNELS; i++){
if (!channel[i].isEmpty()){
str += QString(tr("Channel %1: ").arg(i+1));
str += channel[i].toString();
str += QString("\n");
}
}
return str;
}

View file

@ -0,0 +1,39 @@
#ifndef WIZARDDATA_H
#define WIZARDDATA_H
#include <QObject>
#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

View file

@ -1,133 +1,126 @@
#include <QtGui> #include <QtGui>
#include "wizarddialog.h" #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) 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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( 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. " "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.<br>" "Remove the propeller/propellers before you try to control your model for the first time.<br>"
"Please note that continuing removes all old model settings!"), -1)); "Please note that continuing removes all old model settings!"), -1));
setStartId(Page_Models); setStartId(Page_Models);
#ifndef Q_WS_MAC #ifndef Q_WS_MAC
setWizardStyle(ModernStyle); setWizardStyle(ModernStyle);
#endif #endif
setOption(HaveHelpButton, true); setOption(HaveHelpButton, true);
connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp())); connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp()));
} }
void WizardDialog::showHelp() void WizardDialog::showHelp()
{ {
QString message; QString message;
switch (currentId()) { switch (currentId()) {
case Page_Models: message = tr("Select the type of model you want to create settings for."); break; case Page_Models:
case Page_Throttle: message = tr("Select the receiver channel that is connected to your ESC or throttle servo."); break; message = tr("Enter a name for your model and select model type."); 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. " case Page_Throttle:
"These aircrafts do not have a tail with control surfaces"); break; message = tr("Select the receiver channel that is connected to your ESC or throttle servo.<br><br>"
case Page_Ailerons: message = tr("One or two channels are used to control the Ailerons. " "Throttle - Spektrum: CH1, Futaba: CH3"); break;
"If your servos are connected by a common Y-cable you should select the single-servo option."); break; case Page_Wingtypes:
case Page_Flaps: message = tr("This wizard assumes that your flaps are controlled by a switch. " 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. "
"If your flaps are controlled by a potentiometer you can change that manually later." "The main control surface on a standard wing controlls the roll of the aircraft. This surface is called an aileron.<br>"
"Just select the correct receiver channel and an arbitrary switch."); break; "The control surface of a delta wing controls both roll and elevation. This surface is called an elevon. "); break;
case Page_Airbrakes: message = tr("Air brakes are used to reduce the speed of advanced sail planes. " case Page_Ailerons:
"It is very uncommon on other types of planes."); break; message = tr("Models use one or two channels to control the ailerons.<br>"
case Page_Bank: message = tr("Please note that, even if the elevons are controlled by separate servos, " "A so called Y-cable can be used to connect single receiver channel to two separeate aileron servos. "
"these may be controlled by a common channel."); break; "If your servos are connected by a Y-cable you should select the single-servo option.<br><br>"
case Page_Rudder: message = tr("TBD."); break; "Aileron - Spektrum: CH2, Futaba: CH1"); break;
case Page_Tails: message = tr("Select the tail type of your plane."); break; case Page_Flaps:
case Page_Tail: message = tr("TBD."); break; message = tr("This wizard assumes that your flaps are controlled by a switch. "
case Page_Vtail: message = tr("TBD."); break; "If your flaps are controlled by a potentiometer you can change that manually later."); break;
case Page_Simpletail: message = tr("TBD."); break; case Page_Airbrakes:
case Page_Flybar: message = tr("TBD."); break; message = tr("Air brakes are used to reduce the speed of advanced sail planes.<br>"
case Page_Cyclic: message = tr("TBD."); break; "They are very uncommon on other types of planes."); break;
case Page_Gyro: message = tr("TBD."); break; case Page_Bank:
case Page_Fblheli: message = tr("TBD."); break; message = tr("Models use one or two channels to control the elevons.<br>"
case Page_Helictrl: message = tr("TBD."); break; "A so called Y-cable can be used to connect single receiver channel to two separeate elevon servos. "
case Page_Multirotor: message = tr("TBD."); break; "If your servos are connected by a Y-cable you should select the single-servo option."); break;
case Page_Conclusion: message = tr("TBD."); break; case Page_Rudder:
default: message = tr("Move on. Nothin to see here."); message = tr("Select the receiver channel that is connected to your rudder.<br><br>"
} "Rudder - Spektrum: CH4, Futaba: CH4"); break;
QMessageBox::information(this, tr("Model Wizard Help"), message); case Page_Tails:
message = tr("Select the tail type of your plane."); break;
case Page_Tail:
message = tr("Select the Rudder and Elevator channels.<br><br>"
"Rudder - Spektrum: CH4, Futaba: CH4<br>"
"Elevator - Spektrum: CH3, Futaba: CH2"); break;
case Page_Vtail:
message = tr("Select the Rudder and Elevator channels.<br><br>"
"Rudder - Spektrum: CH4, Futaba: CH4<br>"
"Elevator - Spektrum: CH3, Futaba: CH2"); break;
case Page_Simpletail:
message = tr("Select the Elevator channel.<br><br>"
"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.<br><br>"
"Throttle - Spektrum: CH1, Futaba: CH3<br>"
"Yaw - Spektrum: CH4, Futaba: CH4<br>"
"Pitch - Spektrum: CH3, Futaba: CH2<br>"
"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 ) StandardPage::StandardPage(int currentPage, WizardDialog *dlg, QString image, QString title, QString text, int nextPage )
: QWizardPage() : QWizardPage()
{ {
pageCurrent = currentPage; pageCurrent = currentPage;
pageFollower = nextPage; pageFollower = nextPage;
wizDlg = dlg; wizDlg = dlg;
setTitle(title); setTitle(title);
setPixmap(QWizard::WatermarkPixmap, QPixmap(QString(":/images/wizard/") + image + QString(".png"))); setPixmap(QWizard::WatermarkPixmap, QPixmap(QString(":/images/wizard/") + image + QString(".png")));
topLabel = new QLabel(text+"<br>"); topLabel = new QLabel(text+"<br>");
topLabel->setWordWrap(true); topLabel->setWordWrap(true);
QVBoxLayout *layout = new QVBoxLayout; QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(topLabel); layout->addWidget(topLabel);
setLayout(layout); setLayout(layout);
} }
void StandardPage::populateCB( QComboBox *CB ) void StandardPage::populateCB( QComboBox *CB )
@ -137,7 +130,7 @@ void StandardPage::populateCB( QComboBox *CB )
for (int i=0; i<MAX_CHANNELS; i++) for (int i=0; i<MAX_CHANNELS; i++)
{ {
if (wizDlg->channel[i].isEmpty()){ if (wizDlg->mix.channel[i].isEmpty()){
CB->addItem(tr("Channel ") + QString("%1").arg(i+1), i); 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) if (index<0 || index >= MAX_CHANNELS)
return false; return false;
if (!wizDlg->channel[index].isEmpty()) if (!wizDlg->mix.channel[index].isEmpty())
return false; return false;
wizDlg->channel[index].sourceDlg = pageCurrent; wizDlg->mix.channel[index].sourceDlg = pageCurrent;
wizDlg->channel[index].input1 = input1; wizDlg->mix.channel[index].input1 = input1;
wizDlg->channel[index].input2 = input2; wizDlg->mix.channel[index].input2 = input2;
wizDlg->channel[index].weight1 = weight1; wizDlg->mix.channel[index].weight1 = weight1;
wizDlg->channel[index].weight2 = weight2; wizDlg->mix.channel[index].weight2 = weight2;
return true; return true;
} }
@ -165,8 +158,8 @@ void StandardPage::releaseChannels()
{ {
for (int i=0; i<MAX_CHANNELS; i++) for (int i=0; i<MAX_CHANNELS; i++)
{ {
if (wizDlg->channel[i].sourceDlg == pageCurrent){ if (wizDlg->mix.channel[i].sourceDlg == pageCurrent){
wizDlg->channel[i].clear(); wizDlg->mix.channel[i].clear();
} }
} }
} }
@ -178,119 +171,131 @@ void StandardPage::cleanupPage()
int StandardPage::nextId() const int StandardPage::nextId() const
{ {
return pageFollower; return pageFollower;
} }
ModelSelectionPage::ModelSelectionPage(WizardDialog *dlg, QString image, QString title, QString text) 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; nameLineEdit = new QLineEdit;
planeRB = new QRadioButton(tr("Plane")); planeRB = new QRadioButton(tr("Plane"));
planeRB->setChecked(true); planeRB->setChecked(true);
multirotorRB = new QRadioButton(tr("Multirotor")); multirotorRB = new QRadioButton(tr("Multirotor"));
helicopterRB = new QRadioButton(tr("Helicopter")); helicopterRB = new QRadioButton(tr("Helicopter"));
registerField("evaluate.name*", nameLineEdit); registerField("evaluate.name*", nameLineEdit);
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(new QLabel(tr("Model Name:"))); l->addWidget(new QLabel(tr("Model Name:")));
l->addWidget(nameLineEdit); l->addWidget(nameLineEdit);
l->addWidget(new QLabel("")); l->addWidget(new QLabel(""));
l->addWidget(new QLabel(tr("Model Type:"))); l->addWidget(new QLabel(tr("Model Type:")));
l->addWidget(planeRB); l->addWidget(planeRB);
l->addWidget(multirotorRB); l->addWidget(multirotorRB);
l->addWidget(helicopterRB); 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 int ModelSelectionPage::nextId() const
{ {
if (helicopterRB->isChecked()) if (helicopterRB->isChecked())
return WizardDialog::Page_Cyclic; return WizardDialog::Page_Cyclic;
else if (multirotorRB->isChecked()) else if (multirotorRB->isChecked())
return WizardDialog::Page_Multirotor; return WizardDialog::Page_Multirotor;
else else
return WizardDialog::Page_Throttle; return WizardDialog::Page_Throttle;
} }
WingtypeSelectionPage::WingtypeSelectionPage(WizardDialog *dlg, QString image, QString title, QString text) 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 = new QRadioButton(tr("Standard Wing"));
standardWingRB->setChecked(true); standardWingRB->setChecked(true);
deltaWingRB = new QRadioButton(tr("Flying Wing / Deltawing")); deltaWingRB = new QRadioButton(tr("Flying Wing / Deltawing"));
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(standardWingRB); l->addWidget(standardWingRB);
l->addWidget(deltaWingRB); l->addWidget(deltaWingRB);
} }
int WingtypeSelectionPage::nextId() const int WingtypeSelectionPage::nextId() const
{ {
if (deltaWingRB->isChecked()) if (deltaWingRB->isChecked())
return WizardDialog::Page_Bank; return WizardDialog::Page_Bank;
else else
return WizardDialog::Page_Ailerons; return WizardDialog::Page_Ailerons;
} }
TailSelectionPage::TailSelectionPage(WizardDialog *dlg, QString image, QString title, QString text) 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 = new QRadioButton(tr("Elevator and Rudder"));
standardTailRB->setChecked(true); standardTailRB->setChecked(true);
simpleTailRB = new QRadioButton(tr("Only Elevator")); simpleTailRB = new QRadioButton(tr("Only Elevator"));
vTailRB = new QRadioButton(tr("V-tail")); vTailRB = new QRadioButton(tr("V-tail"));
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(new QLabel(tr("Tail Type:"))); l->addWidget(new QLabel(tr("Tail Type:")));
l->addWidget(standardTailRB); l->addWidget(standardTailRB);
l->addWidget(simpleTailRB); l->addWidget(simpleTailRB);
l->addWidget(vTailRB); l->addWidget(vTailRB);
} }
int TailSelectionPage::nextId() const int TailSelectionPage::nextId() const
{ {
if (simpleTailRB->isChecked()) if (simpleTailRB->isChecked())
return WizardDialog::Page_Simpletail; return WizardDialog::Page_Simpletail;
else if (vTailRB->isChecked()) else if (vTailRB->isChecked())
return WizardDialog::Page_Vtail; return WizardDialog::Page_Vtail;
else else
return WizardDialog::Page_Tail; return WizardDialog::Page_Tail;
} }
FlybarSelectionPage::FlybarSelectionPage(WizardDialog *dlg, QString image, QString title, QString text) 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 = new QRadioButton(tr("Has Flybar"));
flybarRB->setChecked(true); flybarRB->setChecked(true);
noFlybarRB = new QRadioButton(tr("Flybarless")); noFlybarRB = new QRadioButton(tr("Flybarless"));
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(new QLabel(tr("Flybar:"))); l->addWidget(new QLabel(tr("Flybar:")));
l->addWidget(flybarRB); l->addWidget(flybarRB);
l->addWidget(noFlybarRB); l->addWidget(noFlybarRB);
} }
int FlybarSelectionPage::nextId() const int FlybarSelectionPage::nextId() const
{ {
if (flybarRB->isChecked()) if (flybarRB->isChecked())
return WizardDialog::Page_Helictrl; return WizardDialog::Page_Helictrl;
else else
return WizardDialog::Page_Fblheli; return WizardDialog::Page_Fblheli;
} }
ThrottlePage::ThrottlePage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) 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")); motorRB = new QRadioButton(tr("Yes"));
noMotorRB = new QRadioButton(tr("No")); noMotorRB = new QRadioButton(tr("No"));
motorRB->setChecked(true); motorRB->setChecked(true);
throttleCB = new QComboBox(); throttleCB = new QComboBox();
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(motorRB); l->addWidget(motorRB);
l->addWidget(noMotorRB); l->addWidget(noMotorRB);
l->addWidget(new QLabel(tr("<br>Throttle Channel:"))); l->addWidget(new QLabel(tr("<br>Throttle Channel:")));
l->addWidget(throttleCB); l->addWidget(throttleCB);
} }
void ThrottlePage::initializePage(){ void ThrottlePage::initializePage(){
@ -303,23 +308,23 @@ bool ThrottlePage::validatePage() {
} }
AileronsPage::AileronsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) 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")); noAileronsRB = new QRadioButton(tr("No"));
oneAileronRB = new QRadioButton(tr("Yes, controlled by a single channel")); oneAileronRB = new QRadioButton(tr("Yes, controlled by a single channel"));
twoAileronsRB = new QRadioButton(tr("Yes, controlled by two channels")); twoAileronsRB = new QRadioButton(tr("Yes, controlled by two channels"));
noAileronsRB->setChecked(true); noAileronsRB->setChecked(true);
aileron1CB = new QComboBox(); aileron1CB = new QComboBox();
aileron2CB = new QComboBox(); aileron2CB = new QComboBox();
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(noAileronsRB); l->addWidget(noAileronsRB);
l->addWidget(oneAileronRB); l->addWidget(oneAileronRB);
l->addWidget(twoAileronsRB); l->addWidget(twoAileronsRB);
l->addWidget(new QLabel(tr("<br>First Aileron Channel:"))); l->addWidget(new QLabel(tr("<br>First Aileron Channel:")));
l->addWidget(aileron1CB); l->addWidget(aileron1CB);
l->addWidget(new QLabel(tr("Second Aileron Channel:"))); l->addWidget(new QLabel(tr("Second Aileron Channel:")));
l->addWidget(aileron2CB); l->addWidget(aileron2CB);
} }
void AileronsPage::initializePage(){ void AileronsPage::initializePage(){
@ -336,27 +341,27 @@ bool AileronsPage::validatePage() {
return (bookChannel(aileron1CB->currentText(), AILERON, 100 )); return (bookChannel(aileron1CB->currentText(), AILERON, 100 ));
} }
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) 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")); noFlapsRB = new QRadioButton(tr("No"));
oneFlapRB = new QRadioButton(tr("Yes, controlled by a single channel")); oneFlapRB = new QRadioButton(tr("Yes, controlled by a single channel"));
twoFlapsRB = new QRadioButton(tr("Yes, controlled by two channels")); twoFlapsRB = new QRadioButton(tr("Yes, controlled by two channels"));
noFlapsRB->setChecked(true); noFlapsRB->setChecked(true);
flap1CB = new QComboBox(); flap1CB = new QComboBox();
flap2CB = new QComboBox(); flap2CB = new QComboBox();
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(noFlapsRB); l->addWidget(noFlapsRB);
l->addWidget(oneFlapRB); l->addWidget(oneFlapRB);
l->addWidget(twoFlapsRB); l->addWidget(twoFlapsRB);
l->addWidget(new QLabel(tr("<br>First Flap Channel:"))); l->addWidget(new QLabel(tr("<br>First Flap Channel:")));
l->addWidget(flap1CB); l->addWidget(flap1CB);
l->addWidget(new QLabel(tr("Second Flap Channel:"))); l->addWidget(new QLabel(tr("Second Flap Channel:")));
l->addWidget(flap2CB); l->addWidget(flap2CB);
} }
void FlapsPage::initializePage(){ void FlapsPage::initializePage(){
@ -373,27 +378,27 @@ bool FlapsPage::validatePage() {
return (bookChannel(flap1CB->currentText(), FLAP, 100 )); return (bookChannel(flap1CB->currentText(), FLAP, 100 ));
} }
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) 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")); noAirbreaksRB = new QRadioButton(tr("No"));
oneAirbreakRB = new QRadioButton(tr("Yes, controlled by a single channel")); oneAirbreakRB = new QRadioButton(tr("Yes, controlled by a single channel"));
twoAirbreaksRB = new QRadioButton(tr("Yes, controlled by two channels")); twoAirbreaksRB = new QRadioButton(tr("Yes, controlled by two channels"));
noAirbreaksRB->setChecked(true); noAirbreaksRB->setChecked(true);
airbreak1CB = new QComboBox(); airbreak1CB = new QComboBox();
airbreak2CB = new QComboBox(); airbreak2CB = new QComboBox();
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(noAirbreaksRB); l->addWidget(noAirbreaksRB);
l->addWidget(oneAirbreakRB); l->addWidget(oneAirbreakRB);
l->addWidget(twoAirbreaksRB); l->addWidget(twoAirbreaksRB);
l->addWidget(new QLabel(tr("<br>First Airbreak Channel:"))); l->addWidget(new QLabel(tr("<br>First Airbreak Channel:")));
l->addWidget(airbreak1CB); l->addWidget(airbreak1CB);
l->addWidget(new QLabel(tr("Second Airbreak Channel:"))); l->addWidget(new QLabel(tr("Second Airbreak Channel:")));
l->addWidget(airbreak2CB); l->addWidget(airbreak2CB);
} }
void AirbreaksPage::initializePage(){ void AirbreaksPage::initializePage(){
@ -410,25 +415,25 @@ bool AirbreaksPage::validatePage() {
return (bookChannel(airbreak1CB->currentText(), AIRBREAK, 100 )); return (bookChannel(airbreak1CB->currentText(), AIRBREAK, 100 ));
} }
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) 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 = new QRadioButton(tr("One"));
oneElevonChRB->setChecked(true); oneElevonChRB->setChecked(true);
twoElevonsChRB = new QRadioButton(tr("Two")); twoElevonsChRB = new QRadioButton(tr("Two"));
elevon1CB = new QComboBox(); elevon1CB = new QComboBox();
elevon2CB = new QComboBox(); elevon2CB = new QComboBox();
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(oneElevonChRB); l->addWidget(oneElevonChRB);
l->addWidget(twoElevonsChRB); l->addWidget(twoElevonsChRB);
l->addWidget(new QLabel(tr("<br>First Elevon Channel:"))); l->addWidget(new QLabel(tr("<br>First Elevon Channel:")));
l->addWidget(elevon1CB); l->addWidget(elevon1CB);
l->addWidget(new QLabel(tr("Second Elevon Channel:"))); l->addWidget(new QLabel(tr("Second Elevon Channel:")));
l->addWidget(elevon2CB); l->addWidget(elevon2CB);
} }
void BankPage::initializePage(){ 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 ));
} }
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) 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 = new QRadioButton(tr("No"));
noRudderRB->setChecked(true); noRudderRB->setChecked(true);
hasRudderRB = new QRadioButton(tr("Yes")); hasRudderRB = new QRadioButton(tr("Yes"));
rudderCB = new QComboBox(); rudderCB = new QComboBox();
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(noRudderRB); l->addWidget(noRudderRB);
l->addWidget(hasRudderRB); l->addWidget(hasRudderRB);
l->addWidget(new QLabel(tr("<br>Rudder Channel:"))); l->addWidget(new QLabel(tr("<br>Rudder Channel:")));
l->addWidget(rudderCB); l->addWidget(rudderCB);
} }
void RudderPage::initializePage(){ void RudderPage::initializePage(){
@ -467,22 +472,22 @@ void RudderPage::initializePage(){
bool RudderPage::validatePage() { bool RudderPage::validatePage() {
releaseChannels(); releaseChannels();
if (noRudderRB->isChecked()) if (noRudderRB->isChecked())
return true; return true;
return (bookChannel(rudderCB->currentText(), RUDDER, 100)); return (bookChannel(rudderCB->currentText(), RUDDER, 100));
} }
VTailPage::VTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) 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(); tail1CB = new QComboBox();
tail2CB = new QComboBox(); tail2CB = new QComboBox();
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(new QLabel(tr("First Tail Channel:"))); l->addWidget(new QLabel(tr("First Tail Channel:")));
l->addWidget(tail1CB); l->addWidget(tail1CB);
l->addWidget(new QLabel(tr("Second Tail Channel:"))); l->addWidget(new QLabel(tr("Second Tail Channel:")));
l->addWidget(tail2CB); l->addWidget(tail2CB);
} }
void VTailPage::initializePage(){ void VTailPage::initializePage(){
@ -493,20 +498,20 @@ void VTailPage::initializePage(){
bool VTailPage::validatePage() { bool VTailPage::validatePage() {
releaseChannels(); releaseChannels();
return( bookChannel(tail1CB->currentText(), ELEVATOR, 100, RUDDER, 100 ) && 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) 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(); elevatorCB = new QComboBox();
rudderCB = new QComboBox(); rudderCB = new QComboBox();
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(new QLabel(tr("Rudder Channel:"))); l->addWidget(new QLabel(tr("Rudder Channel:")));
l->addWidget(rudderCB); l->addWidget(rudderCB);
l->addWidget(new QLabel(tr("Elevator Channel:"))); l->addWidget(new QLabel(tr("Elevator Channel:")));
l->addWidget(elevatorCB); l->addWidget(elevatorCB);
} }
void TailPage::initializePage(){ void TailPage::initializePage(){
@ -517,17 +522,17 @@ void TailPage::initializePage(){
bool TailPage::validatePage() { bool TailPage::validatePage() {
releaseChannels(); releaseChannels();
return( bookChannel(elevatorCB->currentText(), ELEVATOR, 100 ) && 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) 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(); QLayout *l = layout();
l->addWidget(new QLabel(tr("Elevator Channel:"))); l->addWidget(new QLabel(tr("Elevator Channel:")));
l->addWidget(elevatorCB); l->addWidget(elevatorCB);
} }
void SimpleTailPage::initializePage(){ void SimpleTailPage::initializePage(){
@ -540,19 +545,19 @@ bool SimpleTailPage::validatePage() {
} }
CyclicPage::CyclicPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) 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 = new QRadioButton(tr("90"));
cyclic90RB->setChecked(true); cyclic90RB->setChecked(true);
cyclic120RB = new QRadioButton(tr("120")); cyclic120RB = new QRadioButton(tr("120"));
cyclic120XRB = new QRadioButton(tr("120x")); cyclic120XRB = new QRadioButton(tr("120x"));
cyclic140RB = new QRadioButton(tr("140")); cyclic140RB = new QRadioButton(tr("140"));
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(cyclic90RB); l->addWidget(cyclic90RB);
l->addWidget(cyclic120RB); l->addWidget(cyclic120RB);
l->addWidget(cyclic120XRB); l->addWidget(cyclic120XRB);
l->addWidget(cyclic140RB); l->addWidget(cyclic140RB);
} }
void CyclicPage::initializePage(){ void CyclicPage::initializePage(){
@ -564,17 +569,17 @@ bool CyclicPage::validatePage() {
} }
GyroPage::GyroPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) 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 = new QRadioButton(tr("No"));
noGyroRB->setChecked(true); noGyroRB->setChecked(true);
switchGyroRB = new QRadioButton(tr("Yes, controled by a switch")); switchGyroRB = new QRadioButton(tr("Yes, controled by a switch"));
potGyroRB = new QRadioButton(tr("Yes, controlled by a pot")); potGyroRB = new QRadioButton(tr("Yes, controlled by a pot"));
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(noGyroRB); l->addWidget(noGyroRB);
l->addWidget(switchGyroRB); l->addWidget(switchGyroRB);
l->addWidget(potGyroRB); l->addWidget(potGyroRB);
} }
void GyroPage::initializePage(){ void GyroPage::initializePage(){
@ -586,22 +591,22 @@ bool GyroPage::validatePage() {
} }
FblPage::FblPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) 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(); throttleCB = new QComboBox();
yawCB = new QComboBox(); yawCB = new QComboBox();
pitchCB = new QComboBox(); pitchCB = new QComboBox();
rollCB = new QComboBox(); rollCB = new QComboBox();
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(new QLabel(tr("Trottle Channel:"))); l->addWidget(new QLabel(tr("Trottle Channel:")));
l->addWidget(throttleCB); l->addWidget(throttleCB);
l->addWidget(new QLabel(tr("Yaw Channel:"))); l->addWidget(new QLabel(tr("Yaw Channel:")));
l->addWidget(yawCB); l->addWidget(yawCB);
l->addWidget(new QLabel(tr("Pitch Channel:"))); l->addWidget(new QLabel(tr("Pitch Channel:")));
l->addWidget(pitchCB); l->addWidget(pitchCB);
l->addWidget(new QLabel(tr("Roll Channel:"))); l->addWidget(new QLabel(tr("Roll Channel:")));
l->addWidget(rollCB); l->addWidget(rollCB);
} }
void FblPage::initializePage(){ void FblPage::initializePage(){
@ -614,28 +619,28 @@ void FblPage::initializePage(){
bool FblPage::validatePage() { bool FblPage::validatePage() {
releaseChannels(); releaseChannels();
return( bookChannel(throttleCB->currentText(), THROTTLE, 100 ) && return( bookChannel(throttleCB->currentText(), THROTTLE, 100 ) &&
bookChannel(yawCB->currentText(), RUDDER, 100 ) && bookChannel( yawCB->currentText(), RUDDER, 100 ) &&
bookChannel(pitchCB->currentText(), ELEVATOR, 100 ) && bookChannel( pitchCB->currentText(), ELEVATOR, 100 ) &&
bookChannel(rollCB->currentText(), AILERON, 100 )); bookChannel( rollCB->currentText(), AILERON, 100 ));
} }
HeliPage::HeliPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) 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(); throttleCB = new QComboBox();
yawCB = new QComboBox(); yawCB = new QComboBox();
pitchCB = new QComboBox(); pitchCB = new QComboBox();
rollCB = new QComboBox(); rollCB = new QComboBox();
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(new QLabel(tr("Trottle Channel:"))); l->addWidget(new QLabel(tr("Trottle Channel:")));
l->addWidget(throttleCB); l->addWidget(throttleCB);
l->addWidget(new QLabel(tr("Yaw Channel:"))); l->addWidget(new QLabel(tr("Yaw Channel:")));
l->addWidget(yawCB); l->addWidget(yawCB);
l->addWidget(new QLabel(tr("Pitch Channel:"))); l->addWidget(new QLabel(tr("Pitch Channel:")));
l->addWidget(pitchCB); l->addWidget(pitchCB);
l->addWidget(new QLabel(tr("Roll Channel:"))); l->addWidget(new QLabel(tr("Roll Channel:")));
l->addWidget(rollCB); l->addWidget(rollCB);
} }
void HeliPage::initializePage(){ void HeliPage::initializePage(){
@ -648,28 +653,28 @@ void HeliPage::initializePage(){
bool HeliPage::validatePage() { bool HeliPage::validatePage() {
releaseChannels(); releaseChannels();
return( bookChannel(throttleCB->currentText(), THROTTLE, 100 ) && return( bookChannel(throttleCB->currentText(), THROTTLE, 100 ) &&
bookChannel(yawCB->currentText(), RUDDER, 100 ) && bookChannel( yawCB->currentText(), RUDDER, 100 ) &&
bookChannel(pitchCB->currentText(), ELEVATOR, 100 ) && bookChannel( pitchCB->currentText(), ELEVATOR, 100 ) &&
bookChannel(rollCB->currentText(), AILERON, 100 )); bookChannel( rollCB->currentText(), AILERON, 100 ));
} }
MultirotorPage::MultirotorPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) 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(); throttleCB = new QComboBox();
yawCB = new QComboBox(); yawCB = new QComboBox();
pitchCB = new QComboBox(); pitchCB = new QComboBox();
rollCB = new QComboBox(); rollCB = new QComboBox();
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(new QLabel(tr("Trottle Channel:"))); l->addWidget(new QLabel(tr("Trottle Channel:")));
l->addWidget(throttleCB); l->addWidget(throttleCB);
l->addWidget(new QLabel(tr("Yaw Channel:"))); l->addWidget(new QLabel(tr("Yaw Channel:")));
l->addWidget(yawCB); l->addWidget(yawCB);
l->addWidget(new QLabel(tr("Pitch Channel:"))); l->addWidget(new QLabel(tr("Pitch Channel:")));
l->addWidget(pitchCB); l->addWidget(pitchCB);
l->addWidget(new QLabel(tr("Roll Channel:"))); l->addWidget(new QLabel(tr("Roll Channel:")));
l->addWidget(rollCB); l->addWidget(rollCB);
} }
void MultirotorPage::initializePage(){ void MultirotorPage::initializePage(){
@ -682,33 +687,26 @@ void MultirotorPage::initializePage(){
bool MultirotorPage::validatePage() { bool MultirotorPage::validatePage() {
releaseChannels(); releaseChannels();
return( bookChannel(throttleCB->currentText(), THROTTLE, 100 ) && return( bookChannel(throttleCB->currentText(), THROTTLE, 100 ) &&
bookChannel(yawCB->currentText(), RUDDER, 100 ) && bookChannel(yawCB->currentText(), RUDDER, 100 ) &&
bookChannel(pitchCB->currentText(), ELEVATOR, 100 ) && bookChannel(pitchCB->currentText(), ELEVATOR, 100 ) &&
bookChannel(rollCB->currentText(), AILERON, 100 )); bookChannel(rollCB->currentText(), AILERON, 100 ));
} }
ConclusionPage::ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) 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(); textLabel = new QLabel();
proceedCB = new QCheckBox(tr("OK, I understand.")); proceedCB = new QCheckBox(tr("OK, I understand."));
registerField("evaluate.proceed*", proceedCB); registerField("evaluate.proceed*", proceedCB);
QLayout *l = layout(); QLayout *l = layout();
l->addWidget(textLabel); l->addWidget(textLabel);
l->addWidget(proceedCB); l->addWidget(proceedCB);
} }
void ConclusionPage::initializePage(){ void ConclusionPage::initializePage(){
QString str;
for (int i=0; i<MAX_CHANNELS; i++){ textLabel->setText(wizDlg->mix.toString());
if (!wizDlg->channel[i].isEmpty()){
str += QString(tr("Channel %1: ").arg(i+1));
str += wizDlg->channel[i].print();
str += QString("<br>");
}
}
textLabel->setText(str);
} }

View file

@ -1,7 +1,7 @@
#ifndef WIZARDDIALOG_H #ifndef WIZARDDIALOG_H
#define WIZARDDIALOG_H #define WIZARDDIALOG_H
#include <QWizard> #include <QWizard>
#include "wizarddata.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QCheckBox; class QCheckBox;
@ -11,197 +11,176 @@ class QRadioButton;
class QComboBox; class QComboBox;
QT_END_NAMESPACE 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 class WizardDialog : public QWizard
{ {
Q_OBJECT Q_OBJECT
public: public:
enum { Page_Models, Page_Throttle, Page_Wingtypes, Page_Ailerons, Page_Flaps, enum { Page_Models, Page_Throttle, Page_Wingtypes, Page_Ailerons, Page_Flaps,
Page_Airbrakes, Page_Bank, Page_Rudder, Page_Tails, Page_Tail, Page_Airbrakes, Page_Bank, Page_Rudder, Page_Tails, Page_Tail,
Page_Vtail, Page_Simpletail, Page_Cyclic, Page_Gyro, Page_Flybar, Page_Vtail, Page_Simpletail, Page_Cyclic, Page_Gyro, Page_Flybar,
Page_Fblheli, Page_Helictrl, Page_Multirotor, Page_Fblheli, Page_Helictrl, Page_Multirotor,
Page_Conclusion }; Page_Conclusion };
Channel channel[MAX_CHANNELS]; Mix mix;
WizardDialog(QWidget *parent = 0); WizardDialog(QWidget *parent = 0);
private slots: private slots:
void showHelp(); void showHelp();
}; };
class StandardPage: public QWizardPage class StandardPage: public QWizardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
StandardPage(int curPage, WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); StandardPage(int curPage, WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
WizardDialog *wizDlg; WizardDialog *wizDlg;
void populateCB( QComboBox *); void populateCB( QComboBox *);
bool bookChannel(QString label, Input input1, int weight1, Input input2=UNDEFINED, int weight2=0 ); bool bookChannel(QString label, Input input1, int weight1, Input input2=NOINPUT, int weight2=0 );
void releaseChannels(); void releaseChannels();
void cleanupPage(); void cleanupPage();
private: private:
QLabel *topLabel; QLabel *topLabel;
int pageCurrent; int pageCurrent;
int pageFollower; int pageFollower;
int nextId() const; int nextId() const;
}; };
class ModelSelectionPage: public StandardPage class ModelSelectionPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
ModelSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); ModelSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
private: private:
QLineEdit *nameLineEdit; QLineEdit *nameLineEdit;
QRadioButton *planeRB; QRadioButton *planeRB;
QRadioButton *multirotorRB; QRadioButton *multirotorRB;
QRadioButton *helicopterRB; QRadioButton *helicopterRB;
int nextId() const; bool validatePage();
int nextId() const;
}; };
class WingtypeSelectionPage: public StandardPage class WingtypeSelectionPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
WingtypeSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); WingtypeSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
private: private:
QRadioButton *deltaWingRB; QRadioButton *deltaWingRB;
QRadioButton *standardWingRB; QRadioButton *standardWingRB;
int nextId() const; int nextId() const;
}; };
class TailSelectionPage: public StandardPage class TailSelectionPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
TailSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); TailSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
private: private:
QRadioButton *vTailRB; QRadioButton *vTailRB;
QRadioButton *standardTailRB; QRadioButton *standardTailRB;
QRadioButton *simpleTailRB; QRadioButton *simpleTailRB;
int nextId() const; int nextId() const;
}; };
class FlybarSelectionPage: public StandardPage class FlybarSelectionPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
FlybarSelectionPage(WizardDialog *dlg, QString image, QString title, QString text); FlybarSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
private: private:
QRadioButton *flybarRB; QRadioButton *flybarRB;
QRadioButton *noFlybarRB; QRadioButton *noFlybarRB;
int nextId() const; int nextId() const;
}; };
class ThrottlePage: public StandardPage class ThrottlePage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
ThrottlePage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); ThrottlePage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
private: private:
QRadioButton *motorRB; QRadioButton *motorRB;
QRadioButton *noMotorRB; QRadioButton *noMotorRB;
QComboBox *throttleCB; QComboBox *throttleCB;
}; };
class AileronsPage: public StandardPage class AileronsPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
AileronsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); AileronsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
private: private:
QRadioButton *oneAileronRB; QRadioButton *oneAileronRB;
QRadioButton *twoAileronsRB; QRadioButton *twoAileronsRB;
QRadioButton *noAileronsRB; QRadioButton *noAileronsRB;
QComboBox *aileron1CB; QComboBox *aileron1CB;
QComboBox *aileron2CB; QComboBox *aileron2CB;
}; };
class FlapsPage: public StandardPage class FlapsPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
FlapsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); FlapsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
private: private:
QRadioButton *oneFlapRB; QRadioButton *oneFlapRB;
QRadioButton *twoFlapsRB; QRadioButton *twoFlapsRB;
QRadioButton *noFlapsRB; QRadioButton *noFlapsRB;
QComboBox *flap1CB; QComboBox *flap1CB;
QComboBox *flap2CB; QComboBox *flap2CB;
}; };
class AirbreaksPage: public StandardPage class AirbreaksPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
AirbreaksPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); AirbreaksPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
private: private:
QRadioButton *oneAirbreakRB; QRadioButton *oneAirbreakRB;
QRadioButton *twoAirbreaksRB; QRadioButton *twoAirbreaksRB;
QRadioButton *noAirbreaksRB; QRadioButton *noAirbreaksRB;
QComboBox *airbreak1CB; QComboBox *airbreak1CB;
QComboBox *airbreak2CB; QComboBox *airbreak2CB;
}; };
class BankPage: public StandardPage class BankPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
BankPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); BankPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
private: private:
QRadioButton *oneElevonChRB; QRadioButton *oneElevonChRB;
QRadioButton *twoElevonsChRB; QRadioButton *twoElevonsChRB;
QComboBox *elevon1CB; QComboBox *elevon1CB;
QComboBox *elevon2CB; QComboBox *elevon2CB;
}; };
class RudderPage: public StandardPage class RudderPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
RudderPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); RudderPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
private: private:
QRadioButton *noRudderRB; QRadioButton *noRudderRB;
QRadioButton *hasRudderRB; QRadioButton *hasRudderRB;
QComboBox *rudderCB; QComboBox *rudderCB;
}; };
class TailPage: public StandardPage class TailPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
@ -213,7 +192,7 @@ private:
class VTailPage: public StandardPage class VTailPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
VTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); VTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
@ -225,7 +204,7 @@ private:
class SimpleTailPage: public StandardPage class SimpleTailPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
@ -236,34 +215,34 @@ private:
class CyclicPage: public StandardPage class CyclicPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
CyclicPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); CyclicPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
private: private:
QRadioButton *cyclic90RB; QRadioButton *cyclic90RB;
QRadioButton *cyclic120RB; QRadioButton *cyclic120RB;
QRadioButton *cyclic120XRB; QRadioButton *cyclic120XRB;
QRadioButton *cyclic140RB; QRadioButton *cyclic140RB;
}; };
class GyroPage: public StandardPage class GyroPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
GyroPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); GyroPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
private: private:
QRadioButton *noGyroRB; QRadioButton *noGyroRB;
QRadioButton *switchGyroRB; QRadioButton *switchGyroRB;
QRadioButton *potGyroRB; QRadioButton *potGyroRB;
}; };
class FblPage: public StandardPage class FblPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
FblPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); FblPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
@ -277,7 +256,7 @@ private:
class HeliPage: public StandardPage class HeliPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
HeliPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); HeliPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
@ -291,7 +270,7 @@ private:
class MultirotorPage: public StandardPage class MultirotorPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
MultirotorPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); MultirotorPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();
@ -305,7 +284,7 @@ private:
class ConclusionPage: public StandardPage class ConclusionPage: public StandardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage(); void initializePage();