diff --git a/companion/src/companion.qrc b/companion/src/companion.qrc index 9fb054ce9..0b8688d97 100644 --- a/companion/src/companion.qrc +++ b/companion/src/companion.qrc @@ -71,6 +71,7 @@ images/wizard/models.png images/wizard/multirotor.png images/wizard/rudder.png + images/wizard/options.png images/wizard/simpletail.png images/wizard/tail.png images/wizard/tails.png diff --git a/companion/src/images/wizard/options.png b/companion/src/images/wizard/options.png new file mode 100644 index 000000000..39d6190e7 Binary files /dev/null and b/companion/src/images/wizard/options.png differ diff --git a/companion/src/wizarddata.h b/companion/src/wizarddata.h index f361f7e88..19e421404 100644 --- a/companion/src/wizarddata.h +++ b/companion/src/wizarddata.h @@ -18,7 +18,7 @@ #include "eeprominterface.h" #define WIZ_MAX_CHANNELS 8 - +#define WIZ_MAX_OPTIONS 2 // TODO use a constant common to the whole companion // TODO when in the wizard use the getCapacity(...) to know how long the name can be #define WIZ_MODEL_NAME_LENGTH 12 @@ -40,6 +40,11 @@ enum Vehicle { HELICOPTER }; +enum Options { + THROTTLE_CUT, + THROTTLE_TIMER +}; + enum WizardPage { Page_None = -1, Page_Models, @@ -60,6 +65,7 @@ enum WizardPage { Page_Fblheli, Page_Helictrl, Page_Multirotor, + Page_Options, Page_Conclusion }; @@ -86,6 +92,7 @@ class WizMix const GeneralSettings & settings; Vehicle vehicle; Channel channel[WIZ_MAX_CHANNELS]; + bool options[WIZ_MAX_OPTIONS]; WizMix(const GeneralSettings & settings, const unsigned int modelId); operator ModelData(); diff --git a/companion/src/wizarddialog.cpp b/companion/src/wizarddialog.cpp index 25232bf10..b69bf3e54 100644 --- a/companion/src/wizarddialog.cpp +++ b/companion/src/wizarddialog.cpp @@ -32,17 +32,18 @@ WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelI setPage(Page_Flaps, new FlapsPage(this, "flaps",tr("Flaps"),tr("Has your model got flaps?"), Page_Airbrakes)); setPage(Page_Airbrakes, new AirbrakesPage(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_Rudder, new RudderPage(this, "rudder",tr("Rudder"),tr("Does your model have a rudder?"), Page_Options)); 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_Tail, new TailPage(this, "tail",tr("Tail"),tr("Select channels for tail control."), Page_Options)); + setPage(Page_Vtail, new VTailPage(this, "vtail",tr("V-Tail"),tr("Select channels for tail control."), Page_Options)); + setPage(Page_Simpletail, new SimpleTailPage(this, "simpletail",tr("Tail"),tr("Select elevator channel."), Page_Options)); 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_Fblheli, new FblPage(this, "fblheli",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Options)); + setPage(Page_Helictrl, new HeliPage(this, "helictrl",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Options)); + setPage(Page_Multirotor, new MultirotorPage(this, "multirotor",tr("Multirotor"),tr("Select the control channels for your multirotor"), Page_Options)); + setPage(Page_Options, new OptionsPage(this, "options",tr("Model Options"),tr("Select additional options"), 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.
" @@ -117,6 +118,8 @@ void WizardDialog::showHelp() "Yaw - Spektrum: CH4, Futaba: CH4
" "Pitch - Spektrum: CH3, Futaba: CH2
" "Roll - Spektrum: CH2, Futaba: CH1"); break; + case Page_Options: + message = tr("TBD."); break; case Page_Conclusion: message = tr("TBD."); break; default: @@ -832,6 +835,27 @@ bool MultirotorPage::validatePage() { bookChannel(rollCB, AILERONS_INPUT, 100 )); } +OptionsPage::OptionsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) + : StandardPage(Page_Options, dlg, image, title, text, nextPage) +{ + throttleCutRB = new QCheckBox(tr("Throttle Cut")); + throttleTimerRB = new QCheckBox(tr("Throttle Timer")); + + QLayout *l = layout(); + l->addWidget(throttleCutRB); + l->addWidget(throttleTimerRB); +} + +void OptionsPage::initializePage(){ + StandardPage::initializePage(); +} + +bool OptionsPage::validatePage(){ + wizDlg->mix.options[THROTTLE_CUT] = throttleCutRB->isChecked(); + wizDlg->mix.options[THROTTLE_TIMER] = throttleTimerRB->isChecked(); + return true; +} + ConclusionPage::ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage) : StandardPage(Page_Conclusion, dlg, image, title, text, nextPage) { @@ -840,8 +864,8 @@ ConclusionPage::ConclusionPage(WizardDialog *dlg, QString image, QString title, registerField("evaluate.proceed*", proceedCB); QLayout *l = layout(); - l->addWidget(proceedCB); l->addWidget(textLabel); + l->addWidget(proceedCB); } void ConclusionPage::initializePage(){ @@ -898,6 +922,16 @@ QString WizardPrinter::print() QString str; str = QString(tr("Model Name: ")) + mix->name + "\n"; str += QString(tr("Model Type: ")) + vehicleName(mix->vehicle) + "\n"; + + str += QString(tr("Options: [")); + for (int i=0; ioptions[i]) + str += "X"; + else + str += "-"; + } + str += QString(tr("]")) + "\n"; + for (int i=0; ichannel[i].page != Page_None) { Channel ch = mix->channel[i]; diff --git a/companion/src/wizarddialog.h b/companion/src/wizarddialog.h index 94ef18a5e..b512d695b 100644 --- a/companion/src/wizarddialog.h +++ b/companion/src/wizarddialog.h @@ -333,6 +333,18 @@ private: QComboBox *rollCB; }; +class OptionsPage: public StandardPage +{ + Q_OBJECT +public: + OptionsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1); + void initializePage(); + bool validatePage(); +private: + QCheckBox *throttleCutRB; + QCheckBox *throttleTimerRB; +}; + class ConclusionPage: public StandardPage { Q_OBJECT