1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

OP-39 Fixed disabling of wizard buttons during bias calculation and saving of configuration.

This commit is contained in:
Fredrik Arvidsson 2012-09-10 22:55:02 +02:00
parent 37abf82fc2
commit 7d7d1644bc
4 changed files with 17 additions and 9 deletions

View File

@ -66,20 +66,28 @@ void FlashPage::writeToController()
return;
}
ui->saveButton->setEnabled(false);
getWizard()->button(QWizard::CancelButton)->setEnabled(false);
setCommitPage(true);
enableButtons(false);
VehicleConfigurationHelper helper(getWizard());
connect(&helper, SIGNAL(saveProgress(int, int, QString)),this, SLOT(saveProgress(int, int, QString)));
m_successfulWrite = helper.setupVehicle();
disconnect(&helper, SIGNAL(saveProgress(int, int, QString)),this, SLOT(saveProgress(int, int, QString)));
ui->saveProgressLabel->setText(QString("<font color='%1'>%2</font>").arg(m_successfulWrite ? "green" : "red", ui->saveProgressLabel->text()));
ui->saveButton->setEnabled(true);
getWizard()->button(QWizard::CancelButton)->setEnabled(true);
setCommitPage(false);
enableButtons(true);
emit completeChanged();
}
void FlashPage::enableButtons(bool enable)
{
ui->saveButton->setEnabled(enable);
getWizard()->button(QWizard::NextButton)->setEnabled(enable);
getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
getWizard()->button(QWizard::BackButton)->setEnabled(enable);
QApplication::processEvents();
}
void FlashPage::saveProgress(int total, int current, QString description)
{
if(ui->saveProgressBar->maximum() != total) {

View File

@ -44,9 +44,10 @@ public:
bool validatePage();
bool isComplete() const;
private:
private:
Ui::FlashPage *ui;
bool m_successfulWrite;
void enableButtons(bool enable);
private slots:
void writeToController();

View File

@ -85,7 +85,6 @@ void LevellingPage::performLevelling()
{
m_levellingUtil = new LevellingUtil(BIAS_CYCLES, BIAS_RATE);
}
emit completeChanged();
connect(m_levellingUtil, SIGNAL(progress(long,long)), this, SLOT(levellingProgress(long,long)));
connect(m_levellingUtil, SIGNAL(done(accelGyroBias)), this, SLOT(levellingDone(accelGyroBias)));

View File

@ -53,7 +53,7 @@ SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent), VehicleConfiguratio
setWindowTitle(tr("OpenPilot Setup Wizard"));
setOption(QWizard::IndependentPages, false);
setFixedSize(640, 530);
for(int i = 0; i < ActuatorSettings::CHANNELMAX_NUMELEM; i++)
for(quint16 i = 0; i < ActuatorSettings::CHANNELMAX_NUMELEM; i++)
{
m_actuatorSettings << actuatorChannelSettings();
}