1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

LP-72 Change validate / initialize functions order - remove unused initialize function

This commit is contained in:
Laurent Lalanne 2016-05-22 12:49:36 +02:00
parent aa582a658e
commit e6b2d9cb23
9 changed files with 40 additions and 46 deletions

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file EscCalibrationPage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
* @addtogroup
* @{
* @addtogroup EscCalibrationPage
@ -61,6 +62,11 @@ EscCalibrationPage::~EscCalibrationPage()
delete ui;
}
void EscCalibrationPage::initializePage()
{
resetAllSecurityCheckboxes();
}
bool EscCalibrationPage::validatePage()
{
return true;
@ -180,9 +186,3 @@ void EscCalibrationPage::securityCheckBoxesToggled()
ui->securityCheckBox2->isChecked() &&
ui->securityCheckBox3->isChecked());
}
void EscCalibrationPage::initializePage()
{
resetAllSecurityCheckboxes();
}

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file biascalibrationpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup BiasCalibrationPage
@ -42,8 +43,8 @@ class EscCalibrationPage : public AbstractWizardPage {
public:
explicit EscCalibrationPage(SetupWizard *wizard, QWidget *parent = 0);
~EscCalibrationPage();
bool validatePage();
void initializePage();
bool validatePage();
private slots:
void startButtonClicked();

View File

@ -43,6 +43,17 @@ EscPage::~EscPage()
delete ui;
}
void EscPage::initializePage()
{
bool enabled = isSynchOrOneShotAvailable();
ui->oneshotESCButton->setEnabled(enabled);
if (ui->oneshotESCButton->isChecked() && !enabled) {
ui->oneshotESCButton->setChecked(false);
ui->rapidESCButton->setChecked(true);
}
}
bool EscPage::validatePage()
{
if (ui->oneshotESCButton->isChecked()) {
@ -60,18 +71,6 @@ bool EscPage::validatePage()
return true;
}
void EscPage::initializePage()
{
bool enabled = isSynchOrOneShotAvailable();
ui->oneshotESCButton->setEnabled(enabled);
if (ui->oneshotESCButton->isChecked() && !enabled) {
ui->oneshotESCButton->setChecked(false);
ui->rapidESCButton->setChecked(true);
}
}
bool EscPage::isSynchOrOneShotAvailable()
{
bool available = true;

View File

@ -40,8 +40,8 @@ class EscPage : public AbstractWizardPage {
public:
explicit EscPage(SetupWizard *wizard, QWidget *parent = 0);
~EscPage();
bool validatePage();
void initializePage();
bool validatePage();
private:
Ui::EscPage *ui;

View File

@ -46,6 +46,17 @@ InputPage::~InputPage()
delete ui;
}
void InputPage::initializePage()
{
bool isSparky2 = (getWizard()->getControllerType() == SetupWizard::CONTROLLER_SPARKY2);
ui->pwmButton->setEnabled(!isSparky2);
if (ui->pwmButton->isChecked() && isSparky2) {
ui->pwmButton->setChecked(false);
ui->ppmButton->setChecked(true);
}
}
bool InputPage::validatePage()
{
if (ui->pwmButton->isChecked()) {
@ -70,17 +81,6 @@ bool InputPage::validatePage()
return true;
}
void InputPage::initializePage()
{
bool isSparky2 = (getWizard()->getControllerType() == SetupWizard::CONTROLLER_SPARKY2);
ui->pwmButton->setEnabled(!isSparky2);
if (ui->pwmButton->isChecked() && isSparky2) {
ui->pwmButton->setChecked(false);
ui->ppmButton->setChecked(true);
}
}
bool InputPage::restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedType)
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();

View File

@ -40,8 +40,8 @@ class InputPage : public AbstractWizardPage {
public:
explicit InputPage(SetupWizard *wizard, QWidget *parent = 0);
~InputPage();
bool validatePage();
void initializePage();
bool validatePage();
private:
bool restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedType);

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file summarypage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup SummaryPage
@ -40,8 +41,8 @@ class SummaryPage : public AbstractWizardPage {
public:
explicit SummaryPage(SetupWizard *wizard, QWidget *parent = 0);
~SummaryPage();
bool validatePage();
void initializePage();
bool validatePage();
private:
Ui::SummaryPage *ui;

View File

@ -2,7 +2,7 @@
******************************************************************************
*
* @file vehiclepage.cpp
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
@ -58,10 +58,3 @@ bool VehiclePage::validatePage()
}
return true;
}
void VehiclePage::initializePage()
{
// ui->fixedwingButton->setEnabled(getWizard()->getControllerType() == SetupWizard::CONTROLLER_REVO ||
// getWizard()->getControllerType() == SetupWizard::CONTROLLER_NANO ||
// getWizard()->getControllerType() == SetupWizard::CONTROLLER_SPARKY2);
}

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file vehiclepage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup VehiclePage
@ -41,7 +42,6 @@ public:
explicit VehiclePage(SetupWizard *wizard, QWidget *parent = 0);
~VehiclePage();
bool validatePage();
void initializePage();
private:
Ui::VehiclePage *ui;