From 4973fa45ecf4d065364d64a9af4ab50530260e1c Mon Sep 17 00:00:00 2001
From: "Robert C. Helling" <[email protected]>
Date: Sun, 26 Apr 2015 21:40:36 +0200
Subject: [PATCH] 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 <[email protected]>
---
qt-ui/diveplanner.cpp | 12 ++++++++++++
qt-ui/diveplanner.h | 2 ++
2 files changed, 14 insertions(+)
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index b21f7f9..a5b6e1e 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -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));
}
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index 6cfcc5e..988c908 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -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;
--
1.9.5 (Apple Git-50.3)
Thanks Tomaz!
Best
Robert
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface