diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-11-14 18:36:21 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-11-14 18:36:21 +0900 |
commit | f6eb26dbae7be8a5a8482127ee331ee863f13fc3 (patch) | |
tree | 90cc0b128c2a2eceed20301bbcdd5391c0455684 | |
parent | dfd17c7a7fd1f5dd85f61a6feef96c616e02cfcb (diff) | |
download | subsurface-f6eb26dbae7be8a5a8482127ee331ee863f13fc3.tar.gz |
Handle tank data correctly in profile editing mode for manually added dive
This is subtle. Normally you would expect someone to edit the tank data by
simply clicking on it in the equipment tab. But a user could conceivably
edit the tank data after clicking on the profile editing button instead.
This works now as well.
This also addresses the issue that start and end pressure were not shown
in profile editing mode.
Fixes #235
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/diveplanner.cpp | 7 | ||||
-rw-r--r-- | qt-ui/diveplanner.h | 1 | ||||
-rw-r--r-- | qt-ui/maintab.cpp | 4 |
3 files changed, 11 insertions, 1 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index ab39d42cb..37005e149 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -444,6 +444,8 @@ void DivePlannerPointsModel::loadFromDive(dive* d) for(int i = 0; i < d->dc.samples-1; i++){ backupSamples.push_back( d->dc.sample[i]); } + copy_cylinders(current_dive, stagingDive); // this way the correct cylinder data is shown + CylindersModel::instance()->setDive(stagingDive); int lasttime = 0; Q_FOREACH(const sample &s, backupSamples){ int o2 = 0, he = 0; @@ -453,6 +455,11 @@ void DivePlannerPointsModel::loadFromDive(dive* d) } } +void DivePlannerPointsModel::copyCylinders(dive *d) +{ + copy_cylinders(stagingDive, d); +} + QStringList& DivePlannerPointsModel::getGasList() { static QStringList list; diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index fcb679f89..8f51c932c 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -37,6 +37,7 @@ public: void tanksUpdated(); void rememberTanks(); bool tankInUse(int o2, int he); + void copyCylinders(struct dive *d); /** * @return the row number. */ diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 005efe496..f53defbbf 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -474,7 +474,9 @@ void MainTab::acceptChanges() if (notesBackup[curr].tags != ui.tagWidget->text()) saveTags(); - if (editMode != ADD && cylindersModel->changed) { + if (editMode == MANUALLY_ADDED_DIVE) { + DivePlannerPointsModel::instance()->copyCylinders(curr); + } else if (editMode != ADD && cylindersModel->changed) { mark_divelist_changed(TRUE); Q_FOREACH (dive *d, notesBackup.keys()) { for (int i = 0; i < MAX_CYLINDERS; i++) { |