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; return;
} }
ui->saveButton->setEnabled(false); enableButtons(false);
getWizard()->button(QWizard::CancelButton)->setEnabled(false);
setCommitPage(true);
VehicleConfigurationHelper helper(getWizard()); VehicleConfigurationHelper helper(getWizard());
connect(&helper, SIGNAL(saveProgress(int, int, QString)),this, SLOT(saveProgress(int, int, QString))); connect(&helper, SIGNAL(saveProgress(int, int, QString)),this, SLOT(saveProgress(int, int, QString)));
m_successfulWrite = helper.setupVehicle(); m_successfulWrite = helper.setupVehicle();
disconnect(&helper, SIGNAL(saveProgress(int, int, QString)),this, SLOT(saveProgress(int, int, QString))); 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->saveProgressLabel->setText(QString("<font color='%1'>%2</font>").arg(m_successfulWrite ? "green" : "red", ui->saveProgressLabel->text()));
ui->saveButton->setEnabled(true); enableButtons(true);
getWizard()->button(QWizard::CancelButton)->setEnabled(true);
setCommitPage(false);
emit completeChanged(); 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) void FlashPage::saveProgress(int total, int current, QString description)
{ {
if(ui->saveProgressBar->maximum() != total) { if(ui->saveProgressBar->maximum() != total) {

View File

@ -47,6 +47,7 @@ public:
private: private:
Ui::FlashPage *ui; Ui::FlashPage *ui;
bool m_successfulWrite; bool m_successfulWrite;
void enableButtons(bool enable);
private slots: private slots:
void writeToController(); void writeToController();

View File

@ -85,7 +85,6 @@ void LevellingPage::performLevelling()
{ {
m_levellingUtil = new LevellingUtil(BIAS_CYCLES, BIAS_RATE); 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(progress(long,long)), this, SLOT(levellingProgress(long,long)));
connect(m_levellingUtil, SIGNAL(done(accelGyroBias)), this, SLOT(levellingDone(accelGyroBias))); 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")); setWindowTitle(tr("OpenPilot Setup Wizard"));
setOption(QWizard::IndependentPages, false); setOption(QWizard::IndependentPages, false);
setFixedSize(640, 530); setFixedSize(640, 530);
for(int i = 0; i < ActuatorSettings::CHANNELMAX_NUMELEM; i++) for(quint16 i = 0; i < ActuatorSettings::CHANNELMAX_NUMELEM; i++)
{ {
m_actuatorSettings << actuatorChannelSettings(); m_actuatorSettings << actuatorChannelSettings();
} }