Disable planner UI elements without function

This disables planner UI elements in recreational mode that have no function
in that mode.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2015-04-26 21:40:36 +02:00 committed by Dirk Hohndel
parent 35a3ba0be0
commit e19d38193d
2 changed files with 14 additions and 0 deletions

View file

@ -376,6 +376,15 @@ void PlannerSettingsWidget::decoSacChanged(const double decosac)
plannerModel->setDecoSac(decosac);
}
void PlannerSettingsWidget::disableDecoElements(bool value)
{
ui.lastStop->setDisabled(value);
ui.backgasBreaks->setDisabled(value);
ui.bottompo2->setDisabled(value);
ui.decopo2->setDisabled(value);
ui.reserve_gas->setDisabled(!value);
}
void DivePlannerWidget::printDecoPlan()
{
MainWindow::instance()->printPlan();
@ -457,6 +466,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFLow()));
connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), plannerModel, SLOT(setRebreatherMode(int)));
connect(DivePlannerPointsModel::instance(), SIGNAL(recreationChanged(bool)), this, SLOT(disableDecoElements(bool)));
settingsChanged();
ui.gflow->setValue(prefs.gflow);
ui.gfhigh->setValue(prefs.gfhigh);
@ -876,6 +887,7 @@ void DivePlannerPointsModel::setDisplayTransitions(bool value)
void DivePlannerPointsModel::setRecreationalMode(bool value)
{
prefs.recreational_mode = value;
emit recreationChanged(value);
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1));
}

View file

@ -100,6 +100,7 @@ signals:
void planCanceled();
void cylinderModelEdited();
void startTimeChanged(QDateTime);
void recreationChanged(bool);
private:
explicit DivePlannerPointsModel(QObject *parent = 0);
@ -183,6 +184,7 @@ slots:
void setBottomPo2(double po2);
void setDecoPo2(double po2);
void setBackgasBreaks(bool dobreaks);
void disableDecoElements(bool value);
private:
Ui::plannerSettingsWidget ui;