diff options
author | Anton Lundin <glance@acc.umu.se> | 2014-11-12 23:33:40 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-11-12 14:42:15 -0800 |
commit | a06befc0075c19afbec31130b6d1e0f4447a2498 (patch) | |
tree | 7a34547df9bb69bdbdeb078f3e58fd10dce9908c /qt-ui/diveplanner.cpp | |
parent | 1617d437d413705977905673ddcde0d8ff0ba068 (diff) | |
download | subsurface-a06befc0075c19afbec31130b6d1e0f4447a2498.tar.gz |
Support different salinity in planner
Depth is often mentioned in a length unit, but what we care about is
pressure. When diving in fresh water the pressure is lower than the same
depth in salt water. This adds support for using different salinities in
planning.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index d825c6e84..b8d251c2c 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -297,6 +297,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg connect(ui.dateEdit, SIGNAL(dateChanged(QDate)), plannerModel, SLOT(setStartDate(QDate))); connect(ui.ATMPressure, SIGNAL(valueChanged(int)), this, SLOT(atmPressureChanged(int))); connect(ui.atmHeight, SIGNAL(valueChanged(int)), this, SLOT(heightChanged(int))); + connect(ui.salinity, SIGNAL(valueChanged(double)), this, SLOT(salinityChanged(double))); connect(DivePlannerPointsModel::instance(), SIGNAL(startTimeChanged(QDateTime)), this, SLOT(setupStartTime(QDateTime))); // Creating (and canceling) the plan @@ -367,6 +368,12 @@ void DivePlannerWidget::heightChanged(const int height) plannerModel->setSurfacePressure(pressure); } +void DivePlannerWidget::salinityChanged(const double salinity) +{ + /* Salinity is expressed in weight in grams per 10l */ + plannerModel->setSalinity(10000 * salinity); +} + void PlannerSettingsWidget::bottomSacChanged(const double bottomSac) { plannerModel->setBottomSac(bottomSac); @@ -786,6 +793,12 @@ void DivePlannerPointsModel::setSurfacePressure(int pressure) emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1)); } +void DivePlannerPointsModel::setSalinity(int salinity) +{ + diveplan.salinity = salinity; + emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1)); +} + int DivePlannerPointsModel::getSurfacePressure() { return diveplan.surface_pressure; |