From 19d1618996e2fa82d4d21c961e654065385176e7 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Thu, 6 Feb 2014 01:40:22 +0100 Subject: [PATCH] OP-1150: Try to fix some cases where Start in not enabled postponing m_thermalCalibrationModel->init() --- .../thermal/thermalcalibrationmodel.cpp | 20 +++++++++++-------- .../thermal/thermalcalibrationmodel.h | 1 + .../src/plugins/config/configrevowidget.cpp | 5 +++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.cpp b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.cpp index c2952a16e..6d0da4398 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.cpp +++ b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.cpp @@ -34,7 +34,8 @@ namespace OpenPilot { ThermalCalibrationModel::ThermalCalibrationModel(QObject *parent) : - WizardModel(parent) + WizardModel(parent), + m_initDone(false) { m_helper.reset(new ThermalCalibrationHelper()); m_readyState = new WizardState(tr("Start"), this), @@ -68,13 +69,16 @@ ThermalCalibrationModel::ThermalCalibrationModel(QObject *parent) : } void ThermalCalibrationModel::init() { - setStartEnabled(true); - setEndEnabled(false); - setCancelEnabled(false); - start(); - setTemperature(0); - setTemperatureGradient(0); - emit instructionsChanged(instructions()); + if(!m_initDone){ + m_initDone = true; + setStartEnabled(true); + setEndEnabled(false); + setCancelEnabled(false); + start(); + setTemperature(0); + setTemperatureGradient(0); + emit instructionsChanged(instructions()); + } } void ThermalCalibrationModel::stepChanged(WizardState *state) diff --git a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.h b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.h index 388fb9caa..310c5024a 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.h +++ b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.h @@ -139,6 +139,7 @@ private: bool m_startEnabled; bool m_cancelEnabled; bool m_endEnabled; + bool m_initDone; int m_progress; QString m_temperature; QString m_temperatureGradient; diff --git a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp index 4e806b30b..26aba775a 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp @@ -236,8 +236,7 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) : 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(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(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. m_ui->sensorsBargraph->fitInView(sensorsBargraph, Qt::KeepAspectRatio); m_ui->sixPointsHelp->fitInView(paperplane, Qt::KeepAspectRatio); + + m_thermalCalibrationModel->init(); } void ConfigRevoWidget::resizeEvent(QResizeEvent *event)