diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-02-25 20:06:47 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-03-04 12:16:49 -0800 |
commit | 03eef5b0c2c1bb2d4ebfd6727b61d38cd640ba3f (patch) | |
tree | 31fa9acbca8cff5df4351ca42e677013d34b1513 | |
parent | 74b542ee60887c3fda348212a0b35720b6e49548 (diff) | |
download | subsurface-03eef5b0c2c1bb2d4ebfd6727b61d38cd640ba3f.tar.gz |
Implement manual setting of depth
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | desktop-widgets/maintab.cpp | 15 | ||||
-rw-r--r-- | qt-models/diveplannermodel.cpp | 1 |
2 files changed, 14 insertions, 2 deletions
diff --git a/desktop-widgets/maintab.cpp b/desktop-widgets/maintab.cpp index 0b69fcdea..fc0fb0005 100644 --- a/desktop-widgets/maintab.cpp +++ b/desktop-widgets/maintab.cpp @@ -1132,6 +1132,8 @@ void MainTab::resetPallete() ui.timeEdit->setPalette(p); ui.tagWidget->setPalette(p); ui.diveTripLocation->setPalette(p); + ui.duration->setPalette(p); + ui.depth->setPalette(p); } #define EDIT_TEXT2(what, text) \ @@ -1248,9 +1250,18 @@ void MainTab::on_depth_textChanged(const QString &text) { if (editMode == IGNORE || acceptingEdit == true) return; - displayed_dive.maxdepth.mm = parseLengthToMm(text); + // don't replot until we set things up the way we want them + MainWindow::instance()->graphics()->setReplot(false); + if (!isEditing()) + enableEdition(); + displayed_dive.dc.maxdepth.mm = parseLengthToMm(text); + displayed_dive.maxdepth = displayed_dive.dc.maxdepth; + displayed_dive.dc.meandepth.mm = 0; + displayed_dive.dc.samples = 0; + DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive); markChangedWidget(ui.depth); - qDebug() << "depth text changed to" << displayed_dive.maxdepth.mm << "mm"; + MainWindow::instance()->graphics()->setReplot(true); + MainWindow::instance()->graphics()->plotDive(); } void MainTab::on_airtemp_textChanged(const QString &text) diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 962bbaa57..7262cf313 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -76,6 +76,7 @@ void DivePlannerPointsModel::loadFromDive(dive *d) duration_t lastrecordedtime = {}; duration_t newtime = {}; free_dps(&diveplan); + clear(); diveplan.when = d->when; // is this a "new" dive where we marked manually entered samples? // if yes then the first sample should be marked |