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

OP-1150: Try to fix some cases where Start in not enabled postponing m_thermalCalibrationModel->init()

This commit is contained in:
Alessio Morale 2014-02-06 01:40:22 +01:00
parent 128daa9f03
commit 19d1618996
3 changed files with 16 additions and 10 deletions

View File

@ -34,7 +34,8 @@
namespace OpenPilot { namespace OpenPilot {
ThermalCalibrationModel::ThermalCalibrationModel(QObject *parent) : ThermalCalibrationModel::ThermalCalibrationModel(QObject *parent) :
WizardModel(parent) WizardModel(parent),
m_initDone(false)
{ {
m_helper.reset(new ThermalCalibrationHelper()); m_helper.reset(new ThermalCalibrationHelper());
m_readyState = new WizardState(tr("Start"), this), m_readyState = new WizardState(tr("Start"), this),
@ -68,6 +69,8 @@ ThermalCalibrationModel::ThermalCalibrationModel(QObject *parent) :
} }
void ThermalCalibrationModel::init() void ThermalCalibrationModel::init()
{ {
if(!m_initDone){
m_initDone = true;
setStartEnabled(true); setStartEnabled(true);
setEndEnabled(false); setEndEnabled(false);
setCancelEnabled(false); setCancelEnabled(false);
@ -76,6 +79,7 @@ void ThermalCalibrationModel::init()
setTemperatureGradient(0); setTemperatureGradient(0);
emit instructionsChanged(instructions()); emit instructionsChanged(instructions());
} }
}
void ThermalCalibrationModel::stepChanged(WizardState *state) void ThermalCalibrationModel::stepChanged(WizardState *state)
{ {

View File

@ -139,6 +139,7 @@ private:
bool m_startEnabled; bool m_startEnabled;
bool m_cancelEnabled; bool m_cancelEnabled;
bool m_endEnabled; bool m_endEnabled;
bool m_initDone;
int m_progress; int m_progress;
QString m_temperature; QString m_temperature;
QString m_temperatureGradient; QString m_temperatureGradient;

View File

@ -236,8 +236,7 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
connect(m_thermalCalibrationModel, SIGNAL(temperatureChanged(QString)), m_ui->textTemperature, SLOT(setText(QString))); connect(m_thermalCalibrationModel, SIGNAL(temperatureChanged(QString)), m_ui->textTemperature, SLOT(setText(QString)));
connect(m_thermalCalibrationModel, SIGNAL(temperatureGradientChanged(QString)), m_ui->textThermalGradient, SLOT(setText(QString))); connect(m_thermalCalibrationModel, SIGNAL(temperatureGradientChanged(QString)), m_ui->textThermalGradient, SLOT(setText(QString)));
connect(m_thermalCalibrationModel, SIGNAL(progressChanged(int)), m_ui->thermalBiasProgress, SLOT(setValue(int))); connect(m_thermalCalibrationModel, SIGNAL(progressChanged(int)), m_ui->thermalBiasProgress, SLOT(setValue(int)));
m_thermalCalibrationModel->init(); //note: init for m_thermalCalibrationModel is done in showEvent to prevent cases wiht "Start" button not enabled due to some itming issue.
// Connect the signals // Connect the signals
connect(m_ui->accelBiasStart, SIGNAL(clicked()), this, SLOT(doStartAccelGyroBiasCalibration())); connect(m_ui->accelBiasStart, SIGNAL(clicked()), this, SLOT(doStartAccelGyroBiasCalibration()));
@ -273,6 +272,8 @@ void ConfigRevoWidget::showEvent(QShowEvent *event)
// the result is usually a sensorsBargraph that is way too small. // the result is usually a sensorsBargraph that is way too small.
m_ui->sensorsBargraph->fitInView(sensorsBargraph, Qt::KeepAspectRatio); m_ui->sensorsBargraph->fitInView(sensorsBargraph, Qt::KeepAspectRatio);
m_ui->sixPointsHelp->fitInView(paperplane, Qt::KeepAspectRatio); m_ui->sixPointsHelp->fitInView(paperplane, Qt::KeepAspectRatio);
m_thermalCalibrationModel->init();
} }
void ConfigRevoWidget::resizeEvent(QResizeEvent *event) void ConfigRevoWidget::resizeEvent(QResizeEvent *event)