1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +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 * @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
* @{ * @{
* @addtogroup EscCalibrationPage * @addtogroup EscCalibrationPage
@ -61,6 +62,11 @@ EscCalibrationPage::~EscCalibrationPage()
delete ui; delete ui;
} }
void EscCalibrationPage::initializePage()
{
resetAllSecurityCheckboxes();
}
bool EscCalibrationPage::validatePage() bool EscCalibrationPage::validatePage()
{ {
return true; return true;
@ -180,9 +186,3 @@ void EscCalibrationPage::securityCheckBoxesToggled()
ui->securityCheckBox2->isChecked() && ui->securityCheckBox2->isChecked() &&
ui->securityCheckBox3->isChecked()); ui->securityCheckBox3->isChecked());
} }
void EscCalibrationPage::initializePage()
{
resetAllSecurityCheckboxes();
}

View File

@ -2,7 +2,8 @@
****************************************************************************** ******************************************************************************
* *
* @file biascalibrationpage.h * @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
* @{ * @{
* @addtogroup BiasCalibrationPage * @addtogroup BiasCalibrationPage
@ -42,8 +43,8 @@ class EscCalibrationPage : public AbstractWizardPage {
public: public:
explicit EscCalibrationPage(SetupWizard *wizard, QWidget *parent = 0); explicit EscCalibrationPage(SetupWizard *wizard, QWidget *parent = 0);
~EscCalibrationPage(); ~EscCalibrationPage();
bool validatePage();
void initializePage(); void initializePage();
bool validatePage();
private slots: private slots:
void startButtonClicked(); void startButtonClicked();

View File

@ -43,6 +43,17 @@ EscPage::~EscPage()
delete ui; 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() bool EscPage::validatePage()
{ {
if (ui->oneshotESCButton->isChecked()) { if (ui->oneshotESCButton->isChecked()) {
@ -60,18 +71,6 @@ bool EscPage::validatePage()
return true; 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 EscPage::isSynchOrOneShotAvailable()
{ {
bool available = true; bool available = true;

View File

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

View File

@ -46,6 +46,17 @@ InputPage::~InputPage()
delete ui; 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() bool InputPage::validatePage()
{ {
if (ui->pwmButton->isChecked()) { if (ui->pwmButton->isChecked()) {
@ -70,17 +81,6 @@ bool InputPage::validatePage()
return true; 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) bool InputPage::restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedType)
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();

View File

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

View File

@ -2,7 +2,8 @@
****************************************************************************** ******************************************************************************
* *
* @file summarypage.h * @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
* @{ * @{
* @addtogroup SummaryPage * @addtogroup SummaryPage
@ -40,8 +41,8 @@ class SummaryPage : public AbstractWizardPage {
public: public:
explicit SummaryPage(SetupWizard *wizard, QWidget *parent = 0); explicit SummaryPage(SetupWizard *wizard, QWidget *parent = 0);
~SummaryPage(); ~SummaryPage();
bool validatePage();
void initializePage(); void initializePage();
bool validatePage();
private: private:
Ui::SummaryPage *ui; Ui::SummaryPage *ui;

View File

@ -2,7 +2,7 @@
****************************************************************************** ******************************************************************************
* *
* @file vehiclepage.cpp * @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. * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup * @addtogroup
* @{ * @{
@ -58,10 +58,3 @@ bool VehiclePage::validatePage()
} }
return true; 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 * @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
* @{ * @{
* @addtogroup VehiclePage * @addtogroup VehiclePage
@ -41,7 +42,6 @@ public:
explicit VehiclePage(SetupWizard *wizard, QWidget *parent = 0); explicit VehiclePage(SetupWizard *wizard, QWidget *parent = 0);
~VehiclePage(); ~VehiclePage();
bool validatePage(); bool validatePage();
void initializePage();
private: private:
Ui::VehiclePage *ui; Ui::VehiclePage *ui;